package com.google.firebase.auth; import android.text.TextUtils; import android.util.Log; import androidx.annotation.Keep; import com.google.android.gms.common.api.Status; import com.google.android.gms.common.internal.Preconditions; import com.google.android.gms.internal.p002firebaseauthapi.zzaao; import com.google.android.gms.internal.p002firebaseauthapi.zzaas; import com.google.android.gms.internal.p002firebaseauthapi.zzadu; import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.Tasks; import com.google.android.recaptcha.RecaptchaAction; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; /* loaded from: classes2.dex */ public abstract class FirebaseAuth implements a4.a { /* renamed from: a, reason: collision with root package name */ private final w3.f f5276a; /* renamed from: b, reason: collision with root package name */ private final List f5277b; /* renamed from: c, reason: collision with root package name */ private final List f5278c; /* renamed from: d, reason: collision with root package name */ private final List f5279d; /* renamed from: e, reason: collision with root package name */ private final zzaao f5280e; /* renamed from: f, reason: collision with root package name */ private t f5281f; /* renamed from: g, reason: collision with root package name */ private final a4.d1 f5282g; /* renamed from: h, reason: collision with root package name */ private final Object f5283h; /* renamed from: i, reason: collision with root package name */ private String f5284i; /* renamed from: j, reason: collision with root package name */ private final Object f5285j; /* renamed from: k, reason: collision with root package name */ private String f5286k; /* renamed from: l, reason: collision with root package name */ private a4.f0 f5287l; /* renamed from: m, reason: collision with root package name */ private final RecaptchaAction f5288m; /* renamed from: n, reason: collision with root package name */ private final RecaptchaAction f5289n; /* renamed from: o, reason: collision with root package name */ private final RecaptchaAction f5290o; /* renamed from: p, reason: collision with root package name */ private final a4.h0 f5291p; /* renamed from: q, reason: collision with root package name */ private final a4.l0 f5292q; /* renamed from: r, reason: collision with root package name */ private final a4.m0 f5293r; /* renamed from: s, reason: collision with root package name */ private final o4.b f5294s; /* renamed from: t, reason: collision with root package name */ private final o4.b f5295t; /* renamed from: u, reason: collision with root package name */ private a4.j0 f5296u; /* renamed from: v, reason: collision with root package name */ private final Executor f5297v; /* renamed from: w, reason: collision with root package name */ private final Executor f5298w; /* renamed from: x, reason: collision with root package name */ private final Executor f5299x; public FirebaseAuth(w3.f fVar, o4.b bVar, o4.b bVar2, Executor executor, Executor executor2, Executor executor3, ScheduledExecutorService scheduledExecutorService, Executor executor4) { zzadu b10; zzaao zzaaoVar = new zzaao(fVar, executor2, scheduledExecutorService); a4.h0 h0Var = new a4.h0(fVar.k(), fVar.p()); a4.l0 a10 = a4.l0.a(); a4.m0 a11 = a4.m0.a(); this.f5277b = new CopyOnWriteArrayList(); this.f5278c = new CopyOnWriteArrayList(); this.f5279d = new CopyOnWriteArrayList(); this.f5283h = new Object(); this.f5285j = new Object(); this.f5288m = RecaptchaAction.custom("getOobCode"); this.f5289n = RecaptchaAction.custom("signInWithPassword"); this.f5290o = RecaptchaAction.custom("signUpPassword"); this.f5276a = (w3.f) Preconditions.checkNotNull(fVar); this.f5280e = (zzaao) Preconditions.checkNotNull(zzaaoVar); a4.h0 h0Var2 = (a4.h0) Preconditions.checkNotNull(h0Var); this.f5291p = h0Var2; this.f5282g = new a4.d1(); a4.l0 l0Var = (a4.l0) Preconditions.checkNotNull(a10); this.f5292q = l0Var; this.f5293r = (a4.m0) Preconditions.checkNotNull(a11); this.f5294s = bVar; this.f5295t = bVar2; this.f5297v = executor2; this.f5298w = executor3; this.f5299x = executor4; t a12 = h0Var2.a(); this.f5281f = a12; if (a12 != null && (b10 = h0Var2.b(a12)) != null) { v(this, this.f5281f, b10, false, false); } l0Var.c(this); } @Keep public static FirebaseAuth getInstance() { return (FirebaseAuth) w3.f.l().i(FirebaseAuth.class); } public static a4.j0 j(FirebaseAuth firebaseAuth) { if (firebaseAuth.f5296u == null) { firebaseAuth.f5296u = new a4.j0((w3.f) Preconditions.checkNotNull(firebaseAuth.f5276a)); } return firebaseAuth.f5296u; } public static void t(FirebaseAuth firebaseAuth, t tVar) { if (tVar != null) { Log.d("FirebaseAuth", "Notifying auth state listeners about user ( " + tVar.Y() + " )."); } else { Log.d("FirebaseAuth", "Notifying auth state listeners about a sign-out event."); } firebaseAuth.f5299x.execute(new l1(firebaseAuth)); } public static void u(FirebaseAuth firebaseAuth, t tVar) { if (tVar != null) { Log.d("FirebaseAuth", "Notifying id token listeners about user ( " + tVar.Y() + " )."); } else { Log.d("FirebaseAuth", "Notifying id token listeners about a sign-out event."); } firebaseAuth.f5299x.execute(new k1(firebaseAuth, new t4.b(tVar != null ? tVar.zze() : null))); } static void v(FirebaseAuth firebaseAuth, t tVar, zzadu zzaduVar, boolean z10, boolean z11) { boolean z12; Preconditions.checkNotNull(tVar); Preconditions.checkNotNull(zzaduVar); boolean z13 = true; boolean z14 = firebaseAuth.f5281f != null && tVar.Y().equals(firebaseAuth.f5281f.Y()); if (z14 || !z11) { t tVar2 = firebaseAuth.f5281f; if (tVar2 == null) { z12 = true; } else { boolean z15 = !z14 || (tVar2.j0().zze().equals(zzaduVar.zze()) ^ true); z12 = true ^ z14; z13 = z15; } Preconditions.checkNotNull(tVar); if (firebaseAuth.f5281f == null || !tVar.Y().equals(firebaseAuth.e())) { firebaseAuth.f5281f = tVar; } else { firebaseAuth.f5281f.f0(tVar.R()); if (!tVar.a0()) { firebaseAuth.f5281f.d0(); } firebaseAuth.f5281f.q0(tVar.P().a()); } if (z10) { firebaseAuth.f5291p.d(firebaseAuth.f5281f); } if (z13) { t tVar3 = firebaseAuth.f5281f; if (tVar3 != null) { tVar3.n0(zzaduVar); } u(firebaseAuth, firebaseAuth.f5281f); } if (z12) { t(firebaseAuth, firebaseAuth.f5281f); } if (z10) { firebaseAuth.f5291p.e(tVar, zzaduVar); } t tVar4 = firebaseAuth.f5281f; if (tVar4 != null) { j(firebaseAuth).d(tVar4.j0()); } } } private final Task w(String str, String str2, String str3, t tVar, boolean z10) { return new n1(this, str, z10, tVar, str2, str3).b(this, str3, this.f5289n); } private final Task x(g gVar, t tVar, boolean z10) { return new q0(this, z10, tVar, gVar).b(this, this.f5286k, this.f5288m); } private final boolean y(String str) { e b10 = e.b(str); return (b10 == null || TextUtils.equals(this.f5286k, b10.c())) ? false : true; } public final Task A(String str) { return this.f5280e.zzm(this.f5286k, "RECAPTCHA_ENTERPRISE"); } public final Task B(t tVar, f fVar) { Preconditions.checkNotNull(fVar); Preconditions.checkNotNull(tVar); return this.f5280e.zzn(this.f5276a, tVar, fVar.R(), new s0(this)); } public final Task C(t tVar, f fVar) { Preconditions.checkNotNull(tVar); Preconditions.checkNotNull(fVar); f R = fVar.R(); if (!(R instanceof g)) { return R instanceof f0 ? this.f5280e.zzv(this.f5276a, tVar, (f0) R, this.f5286k, new s0(this)) : this.f5280e.zzp(this.f5276a, tVar, R, tVar.S(), new s0(this)); } g gVar = (g) R; return "password".equals(gVar.S()) ? w(gVar.a0(), Preconditions.checkNotEmpty(gVar.zze()), tVar.S(), tVar, true) : y(Preconditions.checkNotEmpty(gVar.zzf())) ? Tasks.forException(zzaas.zza(new Status(17072))) : x(gVar, tVar, true); } public final Task a(boolean z10) { return z(this.f5281f, z10); } public w3.f b() { return this.f5276a; } public t c() { return this.f5281f; } public String d() { String str; synchronized (this.f5283h) { str = this.f5284i; } return str; } public final String e() { t tVar = this.f5281f; if (tVar == null) { return null; } return tVar.Y(); } public void f(String str) { Preconditions.checkNotEmpty(str); synchronized (this.f5285j) { this.f5286k = str; } } public Task g(f fVar) { Preconditions.checkNotNull(fVar); f R = fVar.R(); if (R instanceof g) { g gVar = (g) R; return !gVar.zzg() ? w(gVar.a0(), (String) Preconditions.checkNotNull(gVar.zze()), this.f5286k, null, false) : y(Preconditions.checkNotEmpty(gVar.zzf())) ? Tasks.forException(zzaas.zza(new Status(17072))) : x(gVar, null, false); } if (R instanceof f0) { return this.f5280e.zzG(this.f5276a, (f0) R, this.f5286k, new r0(this)); } return this.f5280e.zzC(this.f5276a, R, this.f5286k, new r0(this)); } public void h() { q(); a4.j0 j0Var = this.f5296u; if (j0Var != null) { j0Var.c(); } } public final synchronized a4.f0 i() { return this.f5287l; } public final o4.b k() { return this.f5294s; } public final o4.b l() { return this.f5295t; } public final Executor p() { return this.f5297v; } public final void q() { Preconditions.checkNotNull(this.f5291p); t tVar = this.f5281f; if (tVar != null) { a4.h0 h0Var = this.f5291p; Preconditions.checkNotNull(tVar); h0Var.c(String.format("com.google.firebase.auth.GET_TOKEN_RESPONSE.%s", tVar.Y())); this.f5281f = null; } this.f5291p.c("com.google.firebase.auth.FIREBASE_USER"); u(this, null); t(this, null); } public final synchronized void r(a4.f0 f0Var) { this.f5287l = f0Var; } public final void s(t tVar, zzadu zzaduVar, boolean z10) { v(this, tVar, zzaduVar, true, false); } public final Task z(t tVar, boolean z10) { if (tVar == null) { return Tasks.forException(zzaas.zza(new Status(17495))); } zzadu j02 = tVar.j0(); return (!j02.zzj() || z10) ? this.f5280e.zzk(this.f5276a, tVar, j02.zzf(), new m1(this)) : Tasks.forResult(a4.q.a(j02.zze())); } @Keep public static FirebaseAuth getInstance(w3.f fVar) { return (FirebaseAuth) fVar.i(FirebaseAuth.class); } }