MD5 校验值:63f8e52e07318fa084f03ba71262387f
n.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package c6; import a6.h; import c6.b0; import c6.n; import c6.v; import c6.y; import com.google.firebase.database.b; import com.google.firebase.database.i; import f6.k; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.concurrent.ScheduledExecutorService; public class n implements h.a { private final c6.q f4564a; private a6.h f4566c; private c6.u f4567d; private c6.v f4568e; private f6.k<List<z>> f4569f; private final h6.g f4571h; private final c6.g f4572i; private final j6.c f4573j; private final j6.c f4574k; private final j6.c f4575l; private c6.y f4578o; private c6.y f4579p; private com.google.firebase.database.c f4580q; private final f6.f f4565b = new f6.f(new f6.b(), 0); private boolean f4570g = false; public long f4576m = 0; private long f4577n = 1; private boolean f4581r = false; private long f4582s = 0; public class a implements a6.p { final c6.l f4583a; final long f4584b; final b.e f4585c; a(c6.l lVar, long j10, b.e eVar) { this.f4583a = lVar; this.f4584b = j10; this.f4585c = eVar; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); n.this.q0("updateChildren", this.f4583a, I); n.this.C(this.f4584b, this.f4583a, I); n.this.G(this.f4585c, I, this.f4583a); } } public enum a0 { INITIALIZING, RUN, SENT, COMPLETED, SENT_NEEDS_ABORT, NEEDS_ABORT } class b implements a6.p { final c6.l f4594a; final k6.n f4595b; final b.e f4596c; b(c6.l lVar, k6.n nVar, b.e eVar) { this.f4594a = lVar; this.f4595b = nVar; this.f4596c = eVar; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); n.this.q0("onDisconnect().setValue", this.f4594a, I); if (I == null) { n.this.f4568e.d(this.f4594a, this.f4595b); } n.this.G(this.f4596c, I, this.f4594a); } } class c implements a6.p { final c6.l f4598a; final Map f4599b; final b.e f4600c; c(c6.l lVar, Map map, b.e eVar) { this.f4598a = lVar; this.f4599b = map; this.f4600c = eVar; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); n.this.q0("onDisconnect().updateChildren", this.f4598a, I); if (I == null) { for (Map.Entry entry : this.f4599b.entrySet()) { n.this.f4568e.d(this.f4598a.P((c6.l) entry.getKey()), (k6.n) entry.getValue()); } } n.this.G(this.f4600c, I, this.f4598a); } } class d implements a6.p { final c6.l f4602a; final b.e f4603b; d(c6.l lVar, b.e eVar) { this.f4602a = lVar; this.f4603b = eVar; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); if (I == null) { n.this.f4568e.c(this.f4602a); } n.this.G(this.f4603b, I, this.f4602a); } } public class e implements v.d { final Map f4605a; final List f4606b; e(Map map, List list) { this.f4605a = map; this.f4606b = list; } @Override public void a(c6.l lVar, k6.n nVar) { this.f4606b.addAll(n.this.f4579p.A(lVar, c6.t.i(nVar, n.this.f4579p.J(lVar, new ArrayList()), this.f4605a))); n.this.d0(n.this.g(lVar, -9)); } } public class f implements x5.j { f() { } @Override public void onCancelled(x5.b bVar) { } @Override public void onDataChange(com.google.firebase.database.a aVar) { } } public class g implements Runnable { final i.b f4609o; final x5.b f4610p; final com.google.firebase.database.a f4611q; g(i.b bVar, x5.b bVar2, com.google.firebase.database.a aVar) { this.f4609o = bVar; this.f4610p = bVar2; this.f4611q = aVar; } @Override public void run() { this.f4609o.onComplete(this.f4610p, false, this.f4611q); } } public class h implements k.c<List<z>> { h() { } @Override public void a(f6.k<List<z>> kVar) { n.this.k0(kVar); } } public class i implements a6.p { final c6.l f4614a; final List f4615b; final n f4616c; class a implements Runnable { final z f4618o; final com.google.firebase.database.a f4619p; a(z zVar, com.google.firebase.database.a aVar) { this.f4618o = zVar; this.f4619p = aVar; } @Override public void run() { this.f4618o.f4662p.onComplete(null, true, this.f4619p); } } i(c6.l lVar, List list, n nVar) { this.f4614a = lVar; this.f4615b = list; this.f4616c = nVar; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); n.this.q0("Transaction", this.f4614a, I); ArrayList arrayList = new ArrayList(); if (I != null) { if (I.f() == -1) { for (z zVar : this.f4615b) { zVar.f4664r = zVar.f4664r == a0.SENT_NEEDS_ABORT ? a0.NEEDS_ABORT : a0.RUN; } } else { for (z zVar2 : this.f4615b) { zVar2.f4664r = a0.NEEDS_ABORT; zVar2.f4668v = I; } } n.this.d0(this.f4614a); return; } ArrayList arrayList2 = new ArrayList(); for (z zVar3 : this.f4615b) { zVar3.f4664r = a0.COMPLETED; arrayList.addAll(n.this.f4579p.s(zVar3.f4669w, false, false, n.this.f4565b)); arrayList2.add(new a(zVar3, com.google.firebase.database.e.a(com.google.firebase.database.e.c(this.f4616c, zVar3.f4661o), k6.i.b(zVar3.f4672z)))); n nVar = n.this; nVar.b0(new e0(nVar, zVar3.f4663q, h6.i.a(zVar3.f4661o))); } n nVar2 = n.this; nVar2.Z(nVar2.f4569f.k(this.f4614a)); n.this.j0(); this.f4616c.Y(arrayList); for (int i10 = 0; i10 < arrayList2.size(); i10++) { n.this.X((Runnable) arrayList2.get(i10)); } } } public class j implements k.c<List<z>> { j() { } @Override public void a(f6.k<List<z>> kVar) { n.this.Z(kVar); } } public class k implements Runnable { k() { } @Override public void run() { n.this.H(); } } public class l implements Runnable { final z f4623o; l(z zVar) { this.f4623o = zVar; } @Override public void run() { n nVar = n.this; nVar.b0(new e0(nVar, this.f4623o.f4663q, h6.i.a(this.f4623o.f4661o))); } } public class m implements Runnable { final z f4625o; final x5.b f4626p; final com.google.firebase.database.a f4627q; m(z zVar, x5.b bVar, com.google.firebase.database.a aVar) { this.f4625o = zVar; this.f4626p = bVar; this.f4627q = aVar; } @Override public void run() { this.f4625o.f4662p.onComplete(this.f4626p, false, this.f4627q); } } public class C0091n implements k.c<List<z>> { final List f4629a; C0091n(List list) { this.f4629a = list; } @Override public void a(f6.k<List<z>> kVar) { n.this.E(this.f4629a, kVar); } } public class o implements k.b<List<z>> { final int f4631a; o(int i10) { this.f4631a = i10; } @Override public boolean a(f6.k<List<z>> kVar) { n.this.h(kVar, this.f4631a); return false; } } public class p implements k.c<List<z>> { final int f4633a; p(int i10) { this.f4633a = i10; } @Override public void a(f6.k<List<z>> kVar) { n.this.h(kVar, this.f4633a); } } public class q implements Runnable { final z f4635o; final x5.b f4636p; q(z zVar, x5.b bVar) { this.f4635o = zVar; this.f4636p = bVar; } @Override public void run() { this.f4635o.f4662p.onComplete(this.f4636p, false, null); } } public class r implements b0.b { r() { } } public class s implements b0.b { s() { } } public class t implements y.s { class a implements Runnable { final h6.i f4641o; final y.p f4642p; a(h6.i iVar, y.p pVar) { this.f4641o = iVar; this.f4642p = pVar; } @Override public void run() { k6.n a10 = n.this.f4567d.a(this.f4641o.e()); if (a10.isEmpty()) { return; } n.this.Y(n.this.f4578o.A(this.f4641o.e(), a10)); this.f4642p.c(null); } } t() { } @Override public void a(h6.i iVar, c6.z zVar) { } @Override public void b(h6.i iVar, c6.z zVar, a6.g gVar, y.p pVar) { n.this.i0(new a(iVar, pVar)); } } public class u implements y.s { class a implements a6.p { final y.p f4645a; a(y.p pVar) { this.f4645a = pVar; } @Override public void a(String str, String str2) { n.this.Y(this.f4645a.c(n.I(str, str2))); } } u() { } @Override public void a(h6.i iVar, c6.z zVar) { n.this.f4566c.q(iVar.e().O(), iVar.d().k()); } @Override public void b(h6.i iVar, c6.z zVar, a6.g gVar, y.p pVar) { n.this.f4566c.l(iVar.e().O(), iVar.d().k(), gVar, zVar != null ? Long.valueOf(zVar.a()) : null, new a(pVar)); } } public class v implements a6.p { final c0 f4647a; v(c0 c0Var) { this.f4647a = c0Var; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); n.this.q0("Persisted write", this.f4647a.c(), I); n.this.C(this.f4647a.d(), this.f4647a.c(), I); } } public class w implements Runnable { final b.e f4649o; final x5.b f4650p; final com.google.firebase.database.b f4651q; w(b.e eVar, x5.b bVar, com.google.firebase.database.b bVar2) { this.f4649o = eVar; this.f4650p = bVar; this.f4651q = bVar2; } @Override public void run() { this.f4649o.a(this.f4650p, this.f4651q); } } public class x implements a6.p { final c6.l f4653a; final long f4654b; final b.e f4655c; x(c6.l lVar, long j10, b.e eVar) { this.f4653a = lVar; this.f4654b = j10; this.f4655c = eVar; } @Override public void a(String str, String str2) { x5.b I = n.I(str, str2); n.this.q0("setValue", this.f4653a, I); n.this.C(this.f4654b, this.f4653a, I); n.this.G(this.f4655c, I, this.f4653a); } } public class y implements Runnable { final com.google.firebase.database.h f4657o; final u4.m f4658p; final n f4659q; y(com.google.firebase.database.h hVar, u4.m mVar, n nVar) { this.f4657o = hVar; this.f4658p = mVar; this.f4659q = nVar; } public void d(u4.m mVar, com.google.firebase.database.a aVar, com.google.firebase.database.h hVar, n nVar, u4.l lVar) { if (mVar.a().p()) { return; } if (lVar.q()) { k6.n a10 = k6.o.a(lVar.m()); h6.i u10 = hVar.u(); n.this.R(u10, true, true); nVar.Y(u10.g() ? n.this.f4579p.A(u10.e(), a10) : n.this.f4579p.F(u10.e(), a10, n.this.N().b0(u10))); mVar.c(com.google.firebase.database.e.a(hVar.t(), k6.i.f(a10, hVar.u().c()))); n.this.R(u10, false, true); return; } if (aVar.b()) { mVar.c(aVar); return; } Exception l10 = lVar.l(); Objects.requireNonNull(l10); mVar.b(l10); } @Override public void run() { k6.n N = n.this.f4579p.N(this.f4657o.u()); if (N != null) { this.f4658p.c(com.google.firebase.database.e.a(this.f4657o.t(), k6.i.b(N))); return; } n.this.f4579p.Z(this.f4657o.u()); final com.google.firebase.database.a Q = n.this.f4579p.Q(this.f4657o); if (Q.b()) { n nVar = n.this; final u4.m mVar = this.f4658p; nVar.h0(new Runnable() { @Override public final void run() { u4.m.this.e(Q); } }, 3000L); } u4.l<Object> a10 = n.this.f4566c.a(this.f4657o.s().O(), this.f4657o.u().d().k()); ScheduledExecutorService d10 = ((f6.c) n.this.f4572i.v()).d(); final u4.m mVar2 = this.f4658p; final com.google.firebase.database.h hVar = this.f4657o; final n nVar2 = this.f4659q; a10.b(d10, new u4.f() { @Override public final void onComplete(u4.l lVar) { n.y.this.d(mVar2, Q, hVar, nVar2, lVar); } }); } } public static class z implements Comparable<z> { private c6.l f4661o; private i.b f4662p; private x5.j f4663q; private a0 f4664r; private long f4665s; private boolean f4666t; private int f4667u; private x5.b f4668v; private long f4669w; private k6.n f4670x; private k6.n f4671y; private k6.n f4672z; private z(c6.l lVar, i.b bVar, x5.j jVar, a0 a0Var, boolean z10, long j10) { this.f4661o = lVar; this.f4662p = bVar; this.f4663q = jVar; this.f4664r = a0Var; this.f4667u = 0; this.f4666t = z10; this.f4665s = j10; this.f4668v = null; this.f4670x = null; this.f4671y = null; this.f4672z = null; } z(c6.l lVar, i.b bVar, x5.j jVar, a0 a0Var, boolean z10, long j10, k kVar) { this(lVar, bVar, jVar, a0Var, z10, j10); } static int u(z zVar) { int i10 = zVar.f4667u; zVar.f4667u = i10 + 1; return i10; } @Override public int compareTo(z zVar) { long j10 = this.f4665s; long j11 = zVar.f4665s; if (j10 < j11) { return -1; } return j10 == j11 ? 0 : 1; } } public n(c6.q qVar, c6.g gVar, com.google.firebase.database.c cVar) { this.f4564a = qVar; this.f4572i = gVar; this.f4580q = cVar; this.f4573j = gVar.q("RepoOperation"); this.f4574k = gVar.q("Transaction"); this.f4575l = gVar.q("DataOperation"); this.f4571h = new h6.g(gVar); i0(new k()); } public void C(long j10, c6.l lVar, x5.b bVar) { if (bVar == null || bVar.f() != -25) { List<? extends h6.e> s10 = this.f4579p.s(j10, !(bVar == null), true, this.f4565b); if (s10.size() > 0) { d0(lVar); } Y(s10); } } public void E(List<z> list, f6.k<List<z>> kVar) { List<z> g10 = kVar.g(); if (g10 != null) { list.addAll(g10); } kVar.c(new C0091n(list)); } private List<z> F(f6.k<List<z>> kVar) { ArrayList arrayList = new ArrayList(); E(arrayList, kVar); Collections.sort(arrayList); return arrayList; } public void H() { c6.q qVar = this.f4564a; this.f4566c = this.f4572i.E(new a6.f(qVar.f4680a, qVar.f4682c, qVar.f4681b), this); this.f4572i.m().b(((f6.c) this.f4572i.v()).d(), new r()); this.f4572i.l().b(((f6.c) this.f4572i.v()).d(), new s()); this.f4566c.initialize(); e6.e t10 = this.f4572i.t(this.f4564a.f4680a); this.f4567d = new c6.u(); this.f4568e = new c6.v(); this.f4569f = new f6.k<>(); this.f4578o = new c6.y(this.f4572i, new e6.d(), new t()); this.f4579p = new c6.y(this.f4572i, t10, new u()); e0(t10); k6.b bVar = c6.c.f4503c; Boolean bool = Boolean.FALSE; p0(bVar, bool); p0(c6.c.f4504d, bool); } public static x5.b I(String str, String str2) { if (str != null) { return x5.b.d(str, str2); } return null; } private f6.k<List<z>> J(c6.l lVar) { f6.k<List<z>> kVar = this.f4569f; while (!lVar.isEmpty() && kVar.g() == null) { kVar = kVar.k(new c6.l(lVar.V())); lVar = lVar.Y(); } return kVar; } private k6.n K(c6.l lVar) { return L(lVar, new ArrayList()); } private k6.n L(c6.l lVar, List<Long> list) { k6.n J = this.f4579p.J(lVar, list); return J == null ? k6.g.S() : J; } private long M() { long j10 = this.f4577n; this.f4577n = 1 + j10; return j10; } private long S() { long j10 = this.f4582s; this.f4582s = 1 + j10; return j10; } public void Y(List<? extends h6.e> list) { if (list.isEmpty()) { return; } this.f4571h.b(list); } public void Z(f6.k<List<z>> kVar) { List<z> g10 = kVar.g(); if (g10 != null) { int i10 = 0; while (i10 < g10.size()) { if (g10.get(i10).f4664r == a0.COMPLETED) { g10.remove(i10); } else { i10++; } } if (g10.size() <= 0) { g10 = null; } kVar.j(g10); } kVar.c(new j()); } private void c0(List<z> list, c6.l lVar) { int i10; x5.b b10; i.c a10; if (list.isEmpty()) { return; } ArrayList arrayList = new ArrayList(); List<Long> arrayList2 = new ArrayList<>(); Iterator<z> it = list.iterator(); while (it.hasNext()) { arrayList2.add(Long.valueOf(it.next().f4669w)); } Iterator<z> it2 = list.iterator(); while (true) { i10 = 0; if (!it2.hasNext()) { break; } z next = it2.next(); c6.l X = c6.l.X(lVar, next.f4661o); ArrayList arrayList3 = new ArrayList(); f6.m.f(X != null); x5.b bVar = null; if (next.f4664r == a0.NEEDS_ABORT) { bVar = next.f4668v; } else { if (next.f4664r == a0.RUN) { if (next.f4667u >= 25) { bVar = x5.b.c("maxretries"); } else { k6.n L = L(next.f4661o, arrayList2); next.f4670x = L; try { a10 = next.f4662p.doTransaction(com.google.firebase.database.e.b(L)); b10 = null; } catch (Throwable th) { this.f4573j.c("Caught Throwable.", th); b10 = x5.b.b(th); a10 = com.google.firebase.database.i.a(); } if (a10.b()) { Long valueOf = Long.valueOf(next.f4669w); Map<String, Object> c10 = c6.t.c(this.f4565b); k6.n a11 = a10.a(); k6.n i11 = c6.t.i(a11, L, c10); next.f4671y = a11; next.f4672z = i11; next.f4669w = M(); arrayList2.remove(valueOf); arrayList3.addAll(this.f4579p.I(next.f4661o, a11, i11, next.f4669w, next.f4666t, false)); arrayList3.addAll(this.f4579p.s(valueOf.longValue(), true, false, this.f4565b)); } else { arrayList3.addAll(this.f4579p.s(next.f4669w, true, false, this.f4565b)); i10 = 1; bVar = b10; } } } Y(arrayList3); if (i10 == 0) { next.f4664r = a0.COMPLETED; com.google.firebase.database.a a12 = com.google.firebase.database.e.a(com.google.firebase.database.e.c(this, next.f4661o), k6.i.b(next.f4670x)); i0(new l(next)); arrayList.add(new m(next, bVar, a12)); } } arrayList3.addAll(this.f4579p.s(next.f4669w, true, false, this.f4565b)); i10 = 1; Y(arrayList3); if (i10 == 0) { } } Z(this.f4569f); while (i10 < arrayList.size()) { X((Runnable) arrayList.get(i10)); i10++; } j0(); } public c6.l d0(c6.l lVar) { f6.k<List<z>> J = J(lVar); c6.l f10 = J.f(); c0(F(J), f10); return f10; } private void e0(e6.e eVar) { List<c0> d10 = eVar.d(); Map<String, Object> c10 = c6.t.c(this.f4565b); long j10 = Long.MIN_VALUE; for (c0 c0Var : d10) { v vVar = new v(c0Var); if (j10 >= c0Var.d()) { throw new IllegalStateException("Write ids were not in order."); } j10 = c0Var.d(); this.f4577n = c0Var.d() + 1; if (c0Var.e()) { if (this.f4573j.f()) { this.f4573j.b("Restoring overwrite with id " + c0Var.d(), new Object[0]); } this.f4566c.n(c0Var.c().O(), c0Var.b().I(true), vVar); this.f4579p.I(c0Var.c(), c0Var.b(), c6.t.g(c0Var.b(), this.f4579p, c0Var.c(), c10), c0Var.d(), true, false); } else { if (this.f4573j.f()) { this.f4573j.b("Restoring merge with id " + c0Var.d(), new Object[0]); } this.f4566c.h(c0Var.c().O(), c0Var.a().O(true), vVar); this.f4579p.H(c0Var.c(), c0Var.a(), c6.t.f(c0Var.a(), this.f4579p, c0Var.c(), c10), c0Var.d(), false); } } } public c6.l g(c6.l lVar, int i10) { c6.l f10 = J(lVar).f(); if (this.f4574k.f()) { this.f4573j.b("Aborting transactions for path: " + lVar + ". Affected: " + f10, new Object[0]); } f6.k<List<z>> k10 = this.f4569f.k(lVar); k10.a(new o(i10)); h(k10, i10); k10.d(new p(i10)); return f10; } private void g0() { Map<String, Object> c10 = c6.t.c(this.f4565b); ArrayList arrayList = new ArrayList(); this.f4568e.b(c6.l.U(), new e(c10, arrayList)); this.f4568e = new c6.v(); Y(arrayList); } public void h(f6.k<List<z>> kVar, int i10) { x5.b a10; List<z> g10 = kVar.g(); ArrayList arrayList = new ArrayList(); if (g10 != null) { ArrayList arrayList2 = new ArrayList(); if (i10 == -9) { a10 = x5.b.c("overriddenBySet"); } else { f6.m.g(i10 == -25, "Unknown transaction abort reason: " + i10); a10 = x5.b.a(-25); } int i11 = -1; for (int i12 = 0; i12 < g10.size(); i12++) { z zVar = g10.get(i12); a0 a0Var = zVar.f4664r; a0 a0Var2 = a0.SENT_NEEDS_ABORT; if (a0Var != a0Var2) { if (zVar.f4664r == a0.SENT) { f6.m.f(i11 == i12 + (-1)); zVar.f4664r = a0Var2; zVar.f4668v = a10; i11 = i12; } else { f6.m.f(zVar.f4664r == a0.RUN); b0(new e0(this, zVar.f4663q, h6.i.a(zVar.f4661o))); if (i10 == -9) { arrayList.addAll(this.f4579p.s(zVar.f4669w, true, false, this.f4565b)); } else { f6.m.g(i10 == -25, "Unknown transaction abort reason: " + i10); } arrayList2.add(new q(zVar, a10)); } } } kVar.j(i11 == -1 ? null : g10.subList(0, i11 + 1)); Y(arrayList); Iterator it = arrayList2.iterator(); while (it.hasNext()) { X((Runnable) it.next()); } } } public void j0() { f6.k<List<z>> kVar = this.f4569f; Z(kVar); k0(kVar); } public void k0(f6.k<List<z>> kVar) { if (kVar.g() == null) { if (kVar.h()) { kVar.c(new h()); return; } return; } List<z> F = F(kVar); f6.m.f(F.size() > 0); Boolean bool = Boolean.TRUE; Iterator<z> it = F.iterator(); while (true) { if (!it.hasNext()) { break; } else if (it.next().f4664r != a0.RUN) { bool = Boolean.FALSE; break; } } if (bool.booleanValue()) { l0(F, kVar.f()); } } private void l0(List<z> list, c6.l lVar) { ArrayList arrayList = new ArrayList(); Iterator<z> it = list.iterator(); while (it.hasNext()) { arrayList.add(Long.valueOf(it.next().f4669w)); } k6.n L = L(lVar, arrayList); String N = !this.f4570g ? L.N() : "badhash"; Iterator<z> it2 = list.iterator(); while (true) { boolean z10 = true; if (!it2.hasNext()) { this.f4566c.p(lVar.O(), L.I(true), N, new i(lVar, list, this)); return; } z next = it2.next(); if (next.f4664r != a0.RUN) { z10 = false; } f6.m.f(z10); next.f4664r = a0.SENT; z.u(next); L = L.y(c6.l.X(lVar, next.f4661o), next.f4671y); } } private void p0(k6.b bVar, Object obj) { if (bVar.equals(c6.c.f4502b)) { this.f4565b.b(((Long) obj).longValue()); } c6.l lVar = new c6.l(c6.c.f4501a, bVar); try { k6.n a10 = k6.o.a(obj); this.f4567d.c(lVar, a10); Y(this.f4578o.A(lVar, a10)); } catch (x5.c e10) { this.f4573j.c("Failed to parse info update", e10); } } public void q0(String str, c6.l lVar, x5.b bVar) { if (bVar == null || bVar.f() == -1 || bVar.f() == -25) { return; } this.f4573j.i(str + " at " + lVar.toString() + " failed: " + bVar.toString()); } public void D(c6.i iVar) { k6.b V = iVar.e().e().V(); Y(((V == null || !V.equals(c6.c.f4501a)) ? this.f4579p : this.f4578o).t(iVar)); } void G(b.e eVar, x5.b bVar, c6.l lVar) { if (eVar != null) { k6.b T = lVar.T(); if (T != null && T.t()) { lVar = lVar.W(); } X(new w(eVar, bVar, com.google.firebase.database.e.c(this, lVar))); } } c6.y N() { return this.f4579p; } public u4.l<com.google.firebase.database.a> O(com.google.firebase.database.h hVar) { u4.m mVar = new u4.m(); i0(new y(hVar, mVar, this)); return mVar.a(); } public void P() { this.f4566c.c("repo_interrupt"); } public void Q(h6.i iVar, boolean z10) { R(iVar, z10, false); } public void R(h6.i iVar, boolean z10, boolean z11) { f6.m.f(iVar.e().isEmpty() || !iVar.e().V().equals(c6.c.f4501a)); this.f4579p.O(iVar, z10, z11); } public void T(c6.l lVar, b.e eVar) { this.f4566c.d(lVar.O(), new d(lVar, eVar)); } public void U(c6.l lVar, k6.n nVar, b.e eVar) { this.f4566c.m(lVar.O(), nVar.I(true), new b(lVar, nVar, eVar)); } public void V(c6.l lVar, Map<c6.l, k6.n> map, b.e eVar, Map<String, Object> map2) { this.f4566c.o(lVar.O(), map2, new c(lVar, map, eVar)); } public void W(k6.b bVar, Object obj) { p0(bVar, obj); } public void X(Runnable runnable) { this.f4572i.F(); this.f4572i.o().b(runnable); } @Override public void a(List<String> list, Object obj, boolean z10, Long l10) { List<? extends h6.e> A; c6.l lVar = new c6.l(list); if (this.f4573j.f()) { this.f4573j.b("onDataUpdate: " + lVar, new Object[0]); } if (this.f4575l.f()) { this.f4573j.b("onDataUpdate: " + lVar + " " + obj, new Object[0]); } this.f4576m++; try { if (l10 != null) { c6.z zVar = new c6.z(l10.longValue()); if (z10) { HashMap hashMap = new HashMap(); for (Map.Entry entry : ((Map) obj).entrySet()) { hashMap.put(new c6.l((String) entry.getKey()), k6.o.a(entry.getValue())); } A = this.f4579p.E(lVar, hashMap, zVar); } else { A = this.f4579p.F(lVar, k6.o.a(obj), zVar); } } else if (z10) { HashMap hashMap2 = new HashMap(); for (Map.Entry entry2 : ((Map) obj).entrySet()) { hashMap2.put(new c6.l((String) entry2.getKey()), k6.o.a(entry2.getValue())); } A = this.f4579p.z(lVar, hashMap2); } else { A = this.f4579p.A(lVar, k6.o.a(obj)); } if (A.size() > 0) { d0(lVar); } Y(A); } catch (x5.c e10) { this.f4573j.c("FIREBASE INTERNAL ERROR", e10); } } public void a0() { if (this.f4573j.f()) { this.f4573j.b("Purging writes", new Object[0]); } Y(this.f4579p.U()); g(c6.l.U(), -25); this.f4566c.b(); } @Override public void b(boolean z10) { W(c6.c.f4503c, Boolean.valueOf(z10)); } public void b0(c6.i iVar) { Y((c6.c.f4501a.equals(iVar.e().e().V()) ? this.f4578o : this.f4579p).V(iVar)); } @Override public void c() { W(c6.c.f4504d, Boolean.TRUE); } @Override public void d(Map<String, Object> map) { for (Map.Entry<String, Object> entry : map.entrySet()) { p0(k6.b.g(entry.getKey()), entry.getValue()); } } @Override public void e() { W(c6.c.f4504d, Boolean.FALSE); g0(); } @Override public void f(List<String> list, List<a6.o> list2, Long l10) { c6.l lVar = new c6.l(list); if (this.f4573j.f()) { this.f4573j.b("onRangeMergeUpdate: " + lVar, new Object[0]); } if (this.f4575l.f()) { this.f4573j.b("onRangeMergeUpdate: " + lVar + " " + list2, new Object[0]); } this.f4576m++; ArrayList arrayList = new ArrayList(list2.size()); Iterator<a6.o> it = list2.iterator(); while (it.hasNext()) { arrayList.add(new k6.s(it.next())); } c6.y yVar = this.f4579p; List<? extends h6.e> G = l10 != null ? yVar.G(lVar, arrayList, new c6.z(l10.longValue())) : yVar.B(lVar, arrayList); if (G.size() > 0) { d0(lVar); } Y(G); } public void f0() { this.f4566c.f("repo_interrupt"); } public void h0(Runnable runnable, long j10) { this.f4572i.F(); this.f4572i.v().c(runnable, j10); } public void i0(Runnable runnable) { this.f4572i.F(); this.f4572i.v().b(runnable); } public void m0(c6.l lVar, k6.n nVar, b.e eVar) { if (this.f4573j.f()) { this.f4573j.b("set: " + lVar, new Object[0]); } if (this.f4575l.f()) { this.f4575l.b("set: " + lVar + " " + nVar, new Object[0]); } k6.n i10 = c6.t.i(nVar, this.f4579p.J(lVar, new ArrayList()), c6.t.c(this.f4565b)); long M = M(); Y(this.f4579p.I(lVar, nVar, i10, M, true, true)); this.f4566c.n(lVar.O(), nVar.I(true), new x(lVar, M, eVar)); d0(g(lVar, -9)); } public void n0(c6.l lVar, i.b bVar, boolean z10) { x5.b b10; i.c a10; if (this.f4573j.f()) { this.f4573j.b("transaction: " + lVar, new Object[0]); } if (this.f4575l.f()) { this.f4573j.b("transaction: " + lVar, new Object[0]); } if (this.f4572i.C() && !this.f4581r) { this.f4581r = true; this.f4574k.e("runTransaction() usage detected while persistence is enabled. Please be aware that transactions *will not* be persisted across database restarts. See https://www.firebase.com/docs/android/guide/offline-capabilities.html#section-handling-transactions-offline for more details."); } com.google.firebase.database.b c10 = com.google.firebase.database.e.c(this, lVar); f fVar = new f(); D(new e0(this, fVar, c10.u())); z zVar = new z(lVar, bVar, fVar, a0.INITIALIZING, z10, S(), null); k6.n K = K(lVar); zVar.f4670x = K; try { a10 = bVar.doTransaction(com.google.firebase.database.e.b(K)); } catch (Throwable th) { this.f4573j.c("Caught Throwable.", th); b10 = x5.b.b(th); a10 = com.google.firebase.database.i.a(); } if (a10 == null) { throw new NullPointerException("Transaction returned null as result"); } b10 = null; if (!a10.b()) { zVar.f4671y = null; zVar.f4672z = null; X(new g(bVar, b10, com.google.firebase.database.e.a(c10, k6.i.b(zVar.f4670x)))); return; } zVar.f4664r = a0.RUN; f6.k<List<z>> k10 = this.f4569f.k(lVar); List<z> g10 = k10.g(); if (g10 == null) { g10 = new ArrayList<>(); } g10.add(zVar); k10.j(g10); Map<String, Object> c11 = c6.t.c(this.f4565b); k6.n a11 = a10.a(); k6.n i10 = c6.t.i(a11, zVar.f4670x, c11); zVar.f4671y = a11; zVar.f4672z = i10; zVar.f4669w = M(); Y(this.f4579p.I(lVar, a11, i10, zVar.f4669w, z10, false)); j0(); } public void o0(c6.l lVar, c6.b bVar, b.e eVar, Map<String, Object> map) { if (this.f4573j.f()) { this.f4573j.b("update: " + lVar, new Object[0]); } if (this.f4575l.f()) { this.f4575l.b("update: " + lVar + " " + map, new Object[0]); } if (bVar.isEmpty()) { if (this.f4573j.f()) { this.f4573j.b("update called with no changes. No-op", new Object[0]); } G(eVar, null, lVar); return; } c6.b f10 = c6.t.f(bVar, this.f4579p, lVar, c6.t.c(this.f4565b)); long M = M(); Y(this.f4579p.H(lVar, bVar, f10, M, true)); this.f4566c.h(lVar.O(), map, new a(lVar, M, eVar)); Iterator<Map.Entry<c6.l, k6.n>> it = bVar.iterator(); while (it.hasNext()) { d0(g(lVar.P(it.next().getKey()), -9)); } } public String toString() { return this.f4564a.toString(); } }