package com.google.android.gms.internal.vision; import com.google.android.gms.internal.vision.zzfr; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class zzfp> { private static final zzfp zztp = new zzfp(true); private boolean zztn; private boolean zzto = false; private final zzhz zztm = zzhz.zzbo(16); private zzfp() { } private zzfp(boolean z) { zzci(); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean isEmpty() { return this.zztm.isEmpty(); } public final void zzci() { if (this.zztn) { return; } this.zztm.zzci(); this.zztn = true; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof zzfp) { return this.zztm.equals(((zzfp) obj).zztm); } return false; } public final int hashCode() { return this.zztm.hashCode(); } public final Iterator> iterator() { if (this.zzto) { return new zzgl(this.zztm.entrySet().iterator()); } return this.zztm.entrySet().iterator(); } /* JADX INFO: Access modifiers changed from: package-private */ public final Iterator> descendingIterator() { if (this.zzto) { return new zzgl(this.zztm.zzgw().iterator()); } return this.zztm.zzgw().iterator(); } public final Object zza(FieldDescriptorType fielddescriptortype) { Object obj = this.zztm.get(fielddescriptortype); return obj instanceof zzgi ? zzgi.zzfr() : obj; } public final void zza(FieldDescriptorType fielddescriptortype, Object obj) { if (fielddescriptortype.zzeu()) { if (!(obj instanceof List)) { throw new IllegalArgumentException("Wrong object type used with protocol message reflection."); } ArrayList arrayList = new ArrayList(); arrayList.addAll((List) obj); int size = arrayList.size(); int i = 0; while (i < size) { Object obj2 = arrayList.get(i); i++; zza(fielddescriptortype.zzes(), obj2); } obj = arrayList; } else { zza(fielddescriptortype.zzes(), obj); } if (obj instanceof zzgi) { this.zzto = true; } this.zztm.zza((zzhz) fielddescriptortype, (FieldDescriptorType) obj); } public final void zzb(FieldDescriptorType fielddescriptortype, Object obj) { List list; if (!fielddescriptortype.zzeu()) { throw new IllegalArgumentException("addRepeatedField() can only be called on repeated fields."); } zza(fielddescriptortype.zzes(), obj); Object zza = zza((zzfp) fielddescriptortype); if (zza == null) { list = new ArrayList(); this.zztm.zza((zzhz) fielddescriptortype, (FieldDescriptorType) list); } else { list = (List) zza; } list.add(obj); } /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARN: Failed to find 'out' block for switch in B:2:0x000f. Please report as an issue. */ /* JADX WARN: Removed duplicated region for block: B:24:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void zza(com.google.android.gms.internal.vision.zzjd r1, java.lang.Object r2) { /* com.google.android.gms.internal.vision.zzga.checkNotNull(r2) int[] r0 = com.google.android.gms.internal.vision.zzfq.zztq com.google.android.gms.internal.vision.zzji r1 = r1.zzho() int r1 = r1.ordinal() r1 = r0[r1] switch(r1) { case 1: goto L3d; case 2: goto L3a; case 3: goto L37; case 4: goto L34; case 5: goto L31; case 6: goto L2e; case 7: goto L25; case 8: goto L1c; case 9: goto L13; default: goto L12; } L12: goto L42 L13: boolean r1 = r2 instanceof com.google.android.gms.internal.vision.zzhf if (r1 != 0) goto L41 boolean r1 = r2 instanceof com.google.android.gms.internal.vision.zzgi if (r1 == 0) goto L42 goto L41 L1c: boolean r1 = r2 instanceof java.lang.Integer if (r1 != 0) goto L41 boolean r1 = r2 instanceof com.google.android.gms.internal.vision.zzgb if (r1 == 0) goto L42 goto L41 L25: boolean r1 = r2 instanceof com.google.android.gms.internal.vision.zzeo if (r1 != 0) goto L41 boolean r1 = r2 instanceof byte[] if (r1 == 0) goto L42 goto L41 L2e: boolean r1 = r2 instanceof java.lang.String goto L3f L31: boolean r1 = r2 instanceof java.lang.Boolean goto L3f L34: boolean r1 = r2 instanceof java.lang.Double goto L3f L37: boolean r1 = r2 instanceof java.lang.Float goto L3f L3a: boolean r1 = r2 instanceof java.lang.Long goto L3f L3d: boolean r1 = r2 instanceof java.lang.Integer L3f: if (r1 == 0) goto L42 L41: return L42: java.lang.IllegalArgumentException r1 = new java.lang.IllegalArgumentException java.lang.String r2 = "Wrong object type used with protocol message reflection." r1.(r2) throw r1 */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.vision.zzfp.zza(com.google.android.gms.internal.vision.zzjd, java.lang.Object):void"); } public final boolean isInitialized() { for (int i = 0; i < this.zztm.zzgu(); i++) { if (!zzb(this.zztm.zzbp(i))) { return false; } } Iterator> it = this.zztm.zzgv().iterator(); while (it.hasNext()) { if (!zzb(it.next())) { return false; } } return true; } private static boolean zzb(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); if (key.zzet() == zzji.MESSAGE) { if (key.zzeu()) { Iterator it = ((List) entry.getValue()).iterator(); while (it.hasNext()) { if (!((zzhf) it.next()).isInitialized()) { return false; } } } else { Object value = entry.getValue(); if (value instanceof zzhf) { if (!((zzhf) value).isInitialized()) { return false; } } else { if (value instanceof zzgi) { return true; } throw new IllegalArgumentException("Wrong object type used with protocol message reflection."); } } } return true; } public final void zza(zzfp zzfpVar) { for (int i = 0; i < zzfpVar.zztm.zzgu(); i++) { zzc(zzfpVar.zztm.zzbp(i)); } Iterator> it = zzfpVar.zztm.zzgv().iterator(); while (it.hasNext()) { zzc(it.next()); } } private static Object zzf(Object obj) { if (obj instanceof zzhm) { return ((zzhm) obj).zzgh(); } if (!(obj instanceof byte[])) { return obj; } byte[] bArr = (byte[]) obj; byte[] bArr2 = new byte[bArr.length]; System.arraycopy(bArr, 0, bArr2, 0, bArr.length); return bArr2; } private final void zzc(Map.Entry entry) { zzhf zzfg; FieldDescriptorType key = entry.getKey(); Object value = entry.getValue(); if (value instanceof zzgi) { value = zzgi.zzfr(); } if (key.zzeu()) { Object zza = zza((zzfp) key); if (zza == null) { zza = new ArrayList(); } Iterator it = ((List) value).iterator(); while (it.hasNext()) { ((List) zza).add(zzf(it.next())); } this.zztm.zza((zzhz) key, (FieldDescriptorType) zza); return; } if (key.zzet() == zzji.MESSAGE) { Object zza2 = zza((zzfp) key); if (zza2 == null) { this.zztm.zza((zzhz) key, (FieldDescriptorType) zzf(value)); return; } if (zza2 instanceof zzhm) { zzfg = key.zza((zzhm) zza2, (zzhm) value); } else { zzfg = key.zza(((zzhf) zza2).zzez(), (zzhf) value).zzfg(); } this.zztm.zza((zzhz) key, (FieldDescriptorType) zzfg); return; } this.zztm.zza((zzhz) key, (FieldDescriptorType) zzf(value)); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(zzfe zzfeVar, zzjd zzjdVar, int i, Object obj) throws IOException { if (zzjdVar == zzjd.zzacd) { zzhf zzhfVar = (zzhf) obj; zzga.zzf(zzhfVar); zzfeVar.zzd(i, 3); zzhfVar.zzb(zzfeVar); zzfeVar.zzd(i, 4); return; } zzfeVar.zzd(i, zzjdVar.zzhp()); switch (zzfq.zzrr[zzjdVar.ordinal()]) { case 1: zzfeVar.zza(((Double) obj).doubleValue()); return; case 2: zzfeVar.zzf(((Float) obj).floatValue()); return; case 3: zzfeVar.zze(((Long) obj).longValue()); return; case 4: zzfeVar.zze(((Long) obj).longValue()); return; case 5: zzfeVar.zzar(((Integer) obj).intValue()); return; case 6: zzfeVar.zzg(((Long) obj).longValue()); return; case 7: zzfeVar.zzau(((Integer) obj).intValue()); return; case 8: zzfeVar.zzh(((Boolean) obj).booleanValue()); return; case 9: ((zzhf) obj).zzb(zzfeVar); return; case 10: zzfeVar.zzb((zzhf) obj); return; case 11: if (obj instanceof zzeo) { zzfeVar.zza((zzeo) obj); return; } else { zzfeVar.zzm((String) obj); return; } case 12: if (obj instanceof zzeo) { zzfeVar.zza((zzeo) obj); return; } else { byte[] bArr = (byte[]) obj; zzfeVar.zzf(bArr, 0, bArr.length); return; } case 13: zzfeVar.zzas(((Integer) obj).intValue()); return; case 14: zzfeVar.zzau(((Integer) obj).intValue()); return; case 15: zzfeVar.zzg(((Long) obj).longValue()); return; case 16: zzfeVar.zzat(((Integer) obj).intValue()); return; case 17: zzfeVar.zzf(((Long) obj).longValue()); return; case 18: if (obj instanceof zzgb) { zzfeVar.zzar(((zzgb) obj).zzr()); return; } else { zzfeVar.zzar(((Integer) obj).intValue()); return; } default: return; } } public final int zzeq() { int i = 0; for (int i2 = 0; i2 < this.zztm.zzgu(); i2++) { Map.Entry zzbp = this.zztm.zzbp(i2); i += zzc(zzbp.getKey(), zzbp.getValue()); } for (Map.Entry entry : this.zztm.zzgv()) { i += zzc(entry.getKey(), entry.getValue()); } return i; } public final int zzer() { int i = 0; for (int i2 = 0; i2 < this.zztm.zzgu(); i2++) { i += zzd(this.zztm.zzbp(i2)); } Iterator> it = this.zztm.zzgv().iterator(); while (it.hasNext()) { i += zzd(it.next()); } return i; } private static int zzd(Map.Entry entry) { FieldDescriptorType key = entry.getKey(); Object value = entry.getValue(); if (key.zzet() == zzji.MESSAGE && !key.zzeu() && !key.zzev()) { if (value instanceof zzgi) { return zzfe.zzb(entry.getKey().zzr(), (zzgi) value); } return zzfe.zzd(entry.getKey().zzr(), (zzhf) value); } return zzc(key, value); } /* JADX INFO: Access modifiers changed from: package-private */ public static int zza(zzjd zzjdVar, int i, Object obj) { int zzav = zzfe.zzav(i); if (zzjdVar == zzjd.zzacd) { zzga.zzf((zzhf) obj); zzav <<= 1; } return zzav + zzb(zzjdVar, obj); } private static int zzb(zzjd zzjdVar, Object obj) { switch (zzfq.zzrr[zzjdVar.ordinal()]) { case 1: return zzfe.zzb(((Double) obj).doubleValue()); case 2: return zzfe.zzg(((Float) obj).floatValue()); case 3: return zzfe.zzh(((Long) obj).longValue()); case 4: return zzfe.zzi(((Long) obj).longValue()); case 5: return zzfe.zzaw(((Integer) obj).intValue()); case 6: return zzfe.zzk(((Long) obj).longValue()); case 7: return zzfe.zzaz(((Integer) obj).intValue()); case 8: return zzfe.zzi(((Boolean) obj).booleanValue()); case 9: return zzfe.zzd((zzhf) obj); case 10: if (obj instanceof zzgi) { return zzfe.zza((zzgi) obj); } return zzfe.zzc((zzhf) obj); case 11: if (obj instanceof zzeo) { return zzfe.zzb((zzeo) obj); } return zzfe.zzn((String) obj); case 12: if (obj instanceof zzeo) { return zzfe.zzb((zzeo) obj); } return zzfe.zzh((byte[]) obj); case 13: return zzfe.zzax(((Integer) obj).intValue()); case 14: return zzfe.zzba(((Integer) obj).intValue()); case 15: return zzfe.zzl(((Long) obj).longValue()); case 16: return zzfe.zzay(((Integer) obj).intValue()); case 17: return zzfe.zzj(((Long) obj).longValue()); case 18: if (obj instanceof zzgb) { return zzfe.zzbb(((zzgb) obj).zzr()); } return zzfe.zzbb(((Integer) obj).intValue()); default: throw new RuntimeException("There is no way to get here, but the compiler thinks otherwise."); } } private static int zzc(zzfr zzfrVar, Object obj) { zzjd zzes = zzfrVar.zzes(); int zzr = zzfrVar.zzr(); if (zzfrVar.zzeu()) { int i = 0; if (zzfrVar.zzev()) { Iterator it = ((List) obj).iterator(); while (it.hasNext()) { i += zzb(zzes, it.next()); } return zzfe.zzav(zzr) + i + zzfe.zzbd(i); } Iterator it2 = ((List) obj).iterator(); while (it2.hasNext()) { i += zza(zzes, zzr, it2.next()); } return i; } return zza(zzes, zzr, obj); } public final /* synthetic */ Object clone() throws CloneNotSupportedException { zzfp zzfpVar = new zzfp(); for (int i = 0; i < this.zztm.zzgu(); i++) { Map.Entry zzbp = this.zztm.zzbp(i); zzfpVar.zza((zzfp) zzbp.getKey(), zzbp.getValue()); } for (Map.Entry entry : this.zztm.zzgv()) { zzfpVar.zza((zzfp) entry.getKey(), entry.getValue()); } zzfpVar.zzto = this.zzto; return zzfpVar; } public final boolean isImmutable() { return this.zztn; } public static > zzfp zzep() { return zztp; } }