package com.google.android.gms.internal.p002firebaseauthapi; import androidx.recyclerview.widget.RecyclerView; import com.google.android.gms.common.api.Api; import com.google.android.gms.internal.p002firebaseauthapi.zzagz; import com.google.android.gms.internal.p002firebaseauthapi.zzahd; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /* loaded from: classes.dex */ public abstract class zzahd, BuilderType extends zzagz> extends zzafi { private static final Map zzb = new ConcurrentHashMap(); private int zzd = -1; protected zzajp zzc = zzajp.zzc(); protected static zzahi zzA() { return zzair.zze(); } protected static zzahi zzB(zzahi zzahiVar) { int size = zzahiVar.size(); return zzahiVar.zzd(size == 0 ? 10 : size + size); } static Object zzD(Method method, Object obj, Object... objArr) { try { return method.invoke(obj, objArr); } catch (IllegalAccessException e10) { throw new RuntimeException("Couldn't use Java reflection to implement protocol message reflection.", e10); } catch (InvocationTargetException e11) { Throwable cause = e11.getCause(); if (cause instanceof RuntimeException) { throw ((RuntimeException) cause); } if (cause instanceof Error) { throw ((Error) cause); } throw new RuntimeException("Unexpected exception thrown by generated accessor method.", cause); } } protected static Object zzE(zzaii zzaiiVar, String str, Object[] objArr) { return new zzais(zzaiiVar, str, objArr); } protected static void zzH(Class cls, zzahd zzahdVar) { zzahdVar.zzG(); zzb.put(cls, zzahdVar); } private final int zza(zzaiu zzaiuVar) { return zzaiq.zza().zzb(getClass()).zza(this); } private static zzahd zzb(zzahd zzahdVar) { if (zzahdVar == null || zzahdVar.zzK()) { return zzahdVar; } zzahl zza = new zzajn(zzahdVar).zza(); zza.zzh(zzahdVar); throw zza; } private static zzahd zzc(zzahd zzahdVar, byte[] bArr, int i10, int i11, zzagq zzagqVar) { zzahd zzw = zzahdVar.zzw(); try { zzaiu zzb2 = zzaiq.zza().zzb(zzw.getClass()); zzb2.zzi(zzw, bArr, 0, i11, new zzafl(zzagqVar)); zzb2.zzf(zzw); return zzw; } catch (zzahl e10) { e = e10; if (e.zzl()) { e = new zzahl(e); } e.zzh(zzw); throw e; } catch (zzajn e11) { zzahl zza = e11.zza(); zza.zzh(zzw); throw zza; } catch (IOException e12) { if (e12.getCause() instanceof zzahl) { throw ((zzahl) e12.getCause()); } zzahl zzahlVar = new zzahl(e12); zzahlVar.zzh(zzw); throw zzahlVar; } catch (IndexOutOfBoundsException unused) { zzahl zzj = zzahl.zzj(); zzj.zzh(zzw); throw zzj; } } static zzahd zzv(Class cls) { Map map = zzb; zzahd zzahdVar = (zzahd) map.get(cls); if (zzahdVar == null) { try { Class.forName(cls.getName(), true, cls.getClassLoader()); zzahdVar = (zzahd) map.get(cls); } catch (ClassNotFoundException e10) { throw new IllegalStateException("Class initialization cannot fail.", e10); } } if (zzahdVar == null) { zzahdVar = (zzahd) ((zzahd) zzajy.zze(cls)).zzj(6, null, null); if (zzahdVar == null) { throw new IllegalStateException(); } map.put(cls, zzahdVar); } return zzahdVar; } protected static zzahd zzx(zzahd zzahdVar, zzafy zzafyVar, zzagq zzagqVar) { zzage zzh = zzafyVar.zzh(); zzahd zzw = zzahdVar.zzw(); try { zzaiu zzb2 = zzaiq.zza().zzb(zzw.getClass()); zzb2.zzh(zzw, zzagf.zzq(zzh), zzagqVar); zzb2.zzf(zzw); try { zzh.zzz(0); zzb(zzw); return zzw; } catch (zzahl e10) { e10.zzh(zzw); throw e10; } } catch (zzahl e11) { e = e11; if (e.zzl()) { e = new zzahl(e); } e.zzh(zzw); throw e; } catch (zzajn e12) { zzahl zza = e12.zza(); zza.zzh(zzw); throw zza; } catch (IOException e13) { if (e13.getCause() instanceof zzahl) { throw ((zzahl) e13.getCause()); } zzahl zzahlVar = new zzahl(e13); zzahlVar.zzh(zzw); throw zzahlVar; } catch (RuntimeException e14) { if (e14.getCause() instanceof zzahl) { throw ((zzahl) e14.getCause()); } throw e14; } } protected static zzahd zzy(zzahd zzahdVar, InputStream inputStream, zzagq zzagqVar) { zzagc zzagcVar = new zzagc(inputStream, 4096, null); zzahd zzw = zzahdVar.zzw(); try { zzaiu zzb2 = zzaiq.zza().zzb(zzw.getClass()); zzb2.zzh(zzw, zzagf.zzq(zzagcVar), zzagqVar); zzb2.zzf(zzw); zzb(zzw); return zzw; } catch (zzahl e10) { e = e10; if (e.zzl()) { e = new zzahl(e); } e.zzh(zzw); throw e; } catch (zzajn e11) { zzahl zza = e11.zza(); zza.zzh(zzw); throw zza; } catch (IOException e12) { if (e12.getCause() instanceof zzahl) { throw ((zzahl) e12.getCause()); } zzahl zzahlVar = new zzahl(e12); zzahlVar.zzh(zzw); throw zzahlVar; } catch (RuntimeException e13) { if (e13.getCause() instanceof zzahl) { throw ((zzahl) e13.getCause()); } throw e13; } } protected static zzahd zzz(zzahd zzahdVar, byte[] bArr, zzagq zzagqVar) { zzahd zzc = zzc(zzahdVar, bArr, 0, bArr.length, zzagqVar); zzb(zzc); return zzc; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } return zzaiq.zza().zzb(getClass()).zzj(this, (zzahd) obj); } public final int hashCode() { if (zzL()) { return zzr(); } int i10 = this.zza; if (i10 != 0) { return i10; } int zzr = zzr(); this.zza = zzr; return zzr; } public final String toString() { return zzaik.zza(this, super.toString()); } @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaii public final /* synthetic */ zzaih zzC() { return (zzagz) zzj(5, null, null); } protected final void zzF() { zzaiq.zza().zzb(getClass()).zzf(this); zzG(); } final void zzG() { this.zzd &= Api.BaseClientBuilder.API_PRIORITY_OTHER; } final void zzI(int i10) { this.zzd = (this.zzd & RecyclerView.UNDEFINED_DURATION) | Api.BaseClientBuilder.API_PRIORITY_OTHER; } @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaii public final void zzJ(zzagl zzaglVar) { zzaiq.zza().zzb(getClass()).zzm(this, zzagm.zza(zzaglVar)); } public final boolean zzK() { byte byteValue = ((Byte) zzj(1, null, null)).byteValue(); if (byteValue == 1) { return true; } if (byteValue == 0) { return false; } boolean zzk = zzaiq.zza().zzb(getClass()).zzk(this); zzj(2, true != zzk ? null : this, null); return zzk; } final boolean zzL() { return (this.zzd & RecyclerView.UNDEFINED_DURATION) != 0; } @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaij public final /* synthetic */ zzaii zzM() { return (zzahd) zzj(6, null, null); } protected abstract Object zzj(int i10, Object obj, Object obj2); @Override // com.google.android.gms.internal.p002firebaseauthapi.zzafi final int zzn(zzaiu zzaiuVar) { if (zzL()) { int zza = zzaiuVar.zza(this); if (zza >= 0) { return zza; } throw new IllegalStateException("serialized size must be non-negative, was " + zza); } int i10 = this.zzd & Api.BaseClientBuilder.API_PRIORITY_OTHER; if (i10 != Integer.MAX_VALUE) { return i10; } int zza2 = zzaiuVar.zza(this); if (zza2 >= 0) { this.zzd = (this.zzd & RecyclerView.UNDEFINED_DURATION) | zza2; return zza2; } throw new IllegalStateException("serialized size must be non-negative, was " + zza2); } final int zzr() { return zzaiq.zza().zzb(getClass()).zzb(this); } @Override // com.google.android.gms.internal.p002firebaseauthapi.zzaii public final int zzs() { int i10; if (zzL()) { i10 = zza(null); if (i10 < 0) { throw new IllegalStateException("serialized size must be non-negative, was " + i10); } } else { i10 = this.zzd & Api.BaseClientBuilder.API_PRIORITY_OTHER; if (i10 == Integer.MAX_VALUE) { i10 = zza(null); if (i10 < 0) { throw new IllegalStateException("serialized size must be non-negative, was " + i10); } this.zzd = (this.zzd & RecyclerView.UNDEFINED_DURATION) | i10; } } return i10; } protected final zzagz zzt() { return (zzagz) zzj(5, null, null); } public final zzagz zzu() { zzagz zzagzVar = (zzagz) zzj(5, null, null); zzagzVar.zzh(this); return zzagzVar; } final zzahd zzw() { return (zzahd) zzj(4, null, null); } }