package com.google.android.gms.internal.gtm; import java.io.IOException; import java.util.Iterator; import java.util.Map; /* loaded from: classes2.dex */ final class zzsp implements zzsz { private final zzsk zzbdc; private final boolean zzbdd; private final zztr zzbdm; private final zzqq zzbdn; private zzsp(zztr zztrVar, zzqq zzqqVar, zzsk zzskVar) { this.zzbdm = zztrVar; this.zzbdd = zzqqVar.zze(zzskVar); this.zzbdn = zzqqVar; this.zzbdc = zzskVar; } /* JADX INFO: Access modifiers changed from: package-private */ public static zzsp zza(zztr zztrVar, zzqq zzqqVar, zzsk zzskVar) { return new zzsp<>(zztrVar, zzqqVar, zzskVar); } @Override // com.google.android.gms.internal.gtm.zzsz public final T newInstance() { return (T) this.zzbdc.zzph().zzpl(); } @Override // com.google.android.gms.internal.gtm.zzsz public final boolean equals(T t, T t2) { if (!this.zzbdm.zzag(t).equals(this.zzbdm.zzag(t2))) { return false; } if (this.zzbdd) { return this.zzbdn.zzr(t).equals(this.zzbdn.zzr(t2)); } return true; } @Override // com.google.android.gms.internal.gtm.zzsz public final int hashCode(T t) { int hashCode = this.zzbdm.zzag(t).hashCode(); return this.zzbdd ? (hashCode * 53) + this.zzbdn.zzr(t).hashCode() : hashCode; } @Override // com.google.android.gms.internal.gtm.zzsz public final void zzd(T t, T t2) { zztb.zza(this.zzbdm, t, t2); if (this.zzbdd) { zztb.zza(this.zzbdn, t, t2); } } @Override // com.google.android.gms.internal.gtm.zzsz public final void zza(T t, zzum zzumVar) throws IOException { Iterator> it = this.zzbdn.zzr(t).iterator(); while (it.hasNext()) { Map.Entry next = it.next(); zzqv zzqvVar = (zzqv) next.getKey(); if (zzqvVar.zzoy() != zzul.MESSAGE || zzqvVar.zzoz() || zzqvVar.zzpa()) { throw new IllegalStateException("Found invalid MessageSet item."); } if (next instanceof zzrp) { zzumVar.zza(zzqvVar.zzc(), (Object) ((zzrp) next).zzpz().zzmv()); } else { zzumVar.zza(zzqvVar.zzc(), next.getValue()); } } zztr zztrVar = this.zzbdm; zztrVar.zzc(zztrVar.zzag(t), zzumVar); } @Override // com.google.android.gms.internal.gtm.zzsz public final void zza(T t, zzsy zzsyVar, zzqp zzqpVar) throws IOException { boolean zzoh; zztr zztrVar = this.zzbdm; zzqq zzqqVar = this.zzbdn; Object zzah = zztrVar.zzah(t); zzqt zzs = zzqqVar.zzs(t); while (zzsyVar.zzog() != Integer.MAX_VALUE) { try { int tag = zzsyVar.getTag(); if (tag != 11) { if ((tag & 7) == 2) { Object zza = zzqqVar.zza(zzqpVar, this.zzbdc, tag >>> 3); if (zza != null) { zzqqVar.zza(zzsyVar, zza, zzqpVar, zzs); } else { zzoh = zztrVar.zza((zztr) zzah, zzsyVar); } } else { zzoh = zzsyVar.zzoh(); } if (!zzoh) { return; } } else { Object obj = null; int i = 0; zzps zzpsVar = null; while (zzsyVar.zzog() != Integer.MAX_VALUE) { int tag2 = zzsyVar.getTag(); if (tag2 == 16) { i = zzsyVar.zznr(); obj = zzqqVar.zza(zzqpVar, this.zzbdc, i); } else if (tag2 == 26) { if (obj != null) { zzqqVar.zza(zzsyVar, obj, zzqpVar, zzs); } else { zzpsVar = zzsyVar.zznq(); } } else if (!zzsyVar.zzoh()) { break; } } if (zzsyVar.getTag() != 12) { throw zzrk.zzps(); } if (zzpsVar != null) { if (obj != null) { zzqqVar.zza(zzpsVar, obj, zzqpVar, zzs); } else { zztrVar.zza((zztr) zzah, i, zzpsVar); } } } } finally { zztrVar.zzg(t, zzah); } } } @Override // com.google.android.gms.internal.gtm.zzsz public final void zzt(T t) { this.zzbdm.zzt(t); this.zzbdn.zzt(t); } @Override // com.google.android.gms.internal.gtm.zzsz public final boolean zzae(T t) { return this.zzbdn.zzr(t).isInitialized(); } @Override // com.google.android.gms.internal.gtm.zzsz public final int zzad(T t) { zztr zztrVar = this.zzbdm; int zzai = zztrVar.zzai(zztrVar.zzag(t)); return this.zzbdd ? zzai + this.zzbdn.zzr(t).zzow() : zzai; } }