package z4; import java.io.EOFException; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; 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.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLongArray; /* loaded from: classes2.dex */ public final class e { /* renamed from: v, reason: collision with root package name */ private static final f5.a f15819v = f5.a.a(Object.class); /* renamed from: a, reason: collision with root package name */ private final ThreadLocal f15820a; /* renamed from: b, reason: collision with root package name */ private final Map f15821b; /* renamed from: c, reason: collision with root package name */ private final b5.c f15822c; /* renamed from: d, reason: collision with root package name */ private final c5.d f15823d; /* renamed from: e, reason: collision with root package name */ final List f15824e; /* renamed from: f, reason: collision with root package name */ final b5.d f15825f; /* renamed from: g, reason: collision with root package name */ final z4.d f15826g; /* renamed from: h, reason: collision with root package name */ final Map f15827h; /* renamed from: i, reason: collision with root package name */ final boolean f15828i; /* renamed from: j, reason: collision with root package name */ final boolean f15829j; /* renamed from: k, reason: collision with root package name */ final boolean f15830k; /* renamed from: l, reason: collision with root package name */ final boolean f15831l; /* renamed from: m, reason: collision with root package name */ final boolean f15832m; /* renamed from: n, reason: collision with root package name */ final boolean f15833n; /* renamed from: o, reason: collision with root package name */ final boolean f15834o; /* renamed from: p, reason: collision with root package name */ final String f15835p; /* renamed from: q, reason: collision with root package name */ final int f15836q; /* renamed from: r, reason: collision with root package name */ final int f15837r; /* renamed from: s, reason: collision with root package name */ final p f15838s; /* renamed from: t, reason: collision with root package name */ final List f15839t; /* renamed from: u, reason: collision with root package name */ final List f15840u; class a extends q { a() { } @Override // z4.q /* renamed from: e, reason: merged with bridge method [inline-methods] */ public Double b(g5.a aVar) { if (aVar.F0() != g5.b.NULL) { return Double.valueOf(aVar.m0()); } aVar.w0(); return null; } @Override // z4.q /* renamed from: f, reason: merged with bridge method [inline-methods] */ public void d(g5.c cVar, Number number) { if (number == null) { cVar.j0(); } else { e.d(number.doubleValue()); cVar.H0(number); } } } class b extends q { b() { } @Override // z4.q /* renamed from: e, reason: merged with bridge method [inline-methods] */ public Float b(g5.a aVar) { if (aVar.F0() != g5.b.NULL) { return Float.valueOf((float) aVar.m0()); } aVar.w0(); return null; } @Override // z4.q /* renamed from: f, reason: merged with bridge method [inline-methods] */ public void d(g5.c cVar, Number number) { if (number == null) { cVar.j0(); } else { e.d(number.floatValue()); cVar.H0(number); } } } class c extends q { c() { } @Override // z4.q /* renamed from: e, reason: merged with bridge method [inline-methods] */ public Number b(g5.a aVar) { if (aVar.F0() != g5.b.NULL) { return Long.valueOf(aVar.q0()); } aVar.w0(); return null; } @Override // z4.q /* renamed from: f, reason: merged with bridge method [inline-methods] */ public void d(g5.c cVar, Number number) { if (number == null) { cVar.j0(); } else { cVar.I0(number.toString()); } } } class d extends q { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ q f15843a; d(q qVar) { this.f15843a = qVar; } @Override // z4.q /* renamed from: e, reason: merged with bridge method [inline-methods] */ public AtomicLong b(g5.a aVar) { return new AtomicLong(((Number) this.f15843a.b(aVar)).longValue()); } @Override // z4.q /* renamed from: f, reason: merged with bridge method [inline-methods] */ public void d(g5.c cVar, AtomicLong atomicLong) { this.f15843a.d(cVar, Long.valueOf(atomicLong.get())); } } /* renamed from: z4.e$e, reason: collision with other inner class name */ class C0270e extends q { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ q f15844a; C0270e(q qVar) { this.f15844a = qVar; } @Override // z4.q /* renamed from: e, reason: merged with bridge method [inline-methods] */ public AtomicLongArray b(g5.a aVar) { ArrayList arrayList = new ArrayList(); aVar.c(); while (aVar.Y()) { arrayList.add(Long.valueOf(((Number) this.f15844a.b(aVar)).longValue())); } aVar.P(); int size = arrayList.size(); AtomicLongArray atomicLongArray = new AtomicLongArray(size); for (int i10 = 0; i10 < size; i10++) { atomicLongArray.set(i10, ((Long) arrayList.get(i10)).longValue()); } return atomicLongArray; } @Override // z4.q /* renamed from: f, reason: merged with bridge method [inline-methods] */ public void d(g5.c cVar, AtomicLongArray atomicLongArray) { cVar.G(); int length = atomicLongArray.length(); for (int i10 = 0; i10 < length; i10++) { this.f15844a.d(cVar, Long.valueOf(atomicLongArray.get(i10))); } cVar.P(); } } static class f extends q { /* renamed from: a, reason: collision with root package name */ private q f15845a; f() { } @Override // z4.q public Object b(g5.a aVar) { q qVar = this.f15845a; if (qVar != null) { return qVar.b(aVar); } throw new IllegalStateException(); } @Override // z4.q public void d(g5.c cVar, Object obj) { q qVar = this.f15845a; if (qVar == null) { throw new IllegalStateException(); } qVar.d(cVar, obj); } public void e(q qVar) { if (this.f15845a != null) { throw new AssertionError(); } this.f15845a = qVar; } } public e() { this(b5.d.f3173g, z4.c.f15812a, Collections.emptyMap(), false, false, false, true, false, false, false, p.f15866a, null, 2, 2, Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); } private static void a(Object obj, g5.a aVar) { if (obj != null) { try { if (aVar.F0() == g5.b.END_DOCUMENT) { } else { throw new i("JSON document was not fully consumed."); } } catch (g5.d e10) { throw new o(e10); } catch (IOException e11) { throw new i(e11); } } } private static q b(q qVar) { return new d(qVar).a(); } private static q c(q qVar) { return new C0270e(qVar).a(); } static void d(double d10) { if (Double.isNaN(d10) || Double.isInfinite(d10)) { throw new IllegalArgumentException(d10 + " is not a valid double value as per JSON specification. To override this behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method."); } } private q e(boolean z10) { return z10 ? c5.m.f3802v : new a(); } private q f(boolean z10) { return z10 ? c5.m.f3801u : new b(); } private static q p(p pVar) { return pVar == p.f15866a ? c5.m.f3800t : new c(); } public h A(Object obj, Type type) { c5.f fVar = new c5.f(); v(obj, type, fVar); return fVar.L0(); } public Object g(g5.a aVar, Type type) { boolean a02 = aVar.a0(); boolean z10 = true; aVar.K0(true); try { try { try { aVar.F0(); z10 = false; return m(f5.a.b(type)).b(aVar); } catch (EOFException e10) { if (!z10) { throw new o(e10); } aVar.K0(a02); return null; } catch (IOException e11) { throw new o(e11); } } catch (AssertionError e12) { AssertionError assertionError = new AssertionError("AssertionError (GSON 2.8.6): " + e12.getMessage()); assertionError.initCause(e12); throw assertionError; } catch (IllegalStateException e13) { throw new o(e13); } } finally { aVar.K0(a02); } } public Object h(Reader reader, Type type) { g5.a q10 = q(reader); Object g10 = g(q10, type); a(g10, q10); return g10; } public Object i(String str, Class cls) { return b5.k.b(cls).cast(j(str, cls)); } public Object j(String str, Type type) { if (str == null) { return null; } return h(new StringReader(str), type); } public Object k(h hVar, Class cls) { return b5.k.b(cls).cast(l(hVar, cls)); } public Object l(h hVar, Type type) { if (hVar == null) { return null; } return g(new c5.e(hVar), type); } public q m(f5.a aVar) { boolean z10; q qVar = (q) this.f15821b.get(aVar == null ? f15819v : aVar); if (qVar != null) { return qVar; } Map map = (Map) this.f15820a.get(); if (map == null) { map = new HashMap(); this.f15820a.set(map); z10 = true; } else { z10 = false; } f fVar = (f) map.get(aVar); if (fVar != null) { return fVar; } try { f fVar2 = new f(); map.put(aVar, fVar2); Iterator it = this.f15824e.iterator(); while (it.hasNext()) { q a10 = ((r) it.next()).a(this, aVar); if (a10 != null) { fVar2.e(a10); this.f15821b.put(aVar, a10); return a10; } } throw new IllegalArgumentException("GSON (2.8.6) cannot handle " + aVar); } finally { map.remove(aVar); if (z10) { this.f15820a.remove(); } } } public q n(Class cls) { return m(f5.a.a(cls)); } public q o(r rVar, f5.a aVar) { if (!this.f15824e.contains(rVar)) { rVar = this.f15823d; } boolean z10 = false; for (r rVar2 : this.f15824e) { if (z10) { q a10 = rVar2.a(this, aVar); if (a10 != null) { return a10; } } else if (rVar2 == rVar) { z10 = true; } } throw new IllegalArgumentException("GSON cannot serialize " + aVar); } public g5.a q(Reader reader) { g5.a aVar = new g5.a(reader); aVar.K0(this.f15833n); return aVar; } public g5.c r(Writer writer) { if (this.f15830k) { writer.write(")]}'\n"); } g5.c cVar = new g5.c(writer); if (this.f15832m) { cVar.w0(" "); } cVar.D0(this.f15828i); return cVar; } public String s(Object obj) { return obj == null ? u(j.f15863a) : t(obj, obj.getClass()); } public String t(Object obj, Type type) { StringWriter stringWriter = new StringWriter(); w(obj, type, stringWriter); return stringWriter.toString(); } public String toString() { return "{serializeNulls:" + this.f15828i + ",factories:" + this.f15824e + ",instanceCreators:" + this.f15822c + "}"; } public String u(h hVar) { StringWriter stringWriter = new StringWriter(); y(hVar, stringWriter); return stringWriter.toString(); } public void v(Object obj, Type type, g5.c cVar) { q m10 = m(f5.a.b(type)); boolean a02 = cVar.a0(); cVar.z0(true); boolean Y = cVar.Y(); cVar.u0(this.f15831l); boolean S = cVar.S(); cVar.D0(this.f15828i); try { try { m10.d(cVar, obj); } catch (IOException e10) { throw new i(e10); } catch (AssertionError e11) { AssertionError assertionError = new AssertionError("AssertionError (GSON 2.8.6): " + e11.getMessage()); assertionError.initCause(e11); throw assertionError; } } finally { cVar.z0(a02); cVar.u0(Y); cVar.D0(S); } } public void w(Object obj, Type type, Appendable appendable) { try { v(obj, type, r(b5.l.c(appendable))); } catch (IOException e10) { throw new i(e10); } } public void x(h hVar, g5.c cVar) { boolean a02 = cVar.a0(); cVar.z0(true); boolean Y = cVar.Y(); cVar.u0(this.f15831l); boolean S = cVar.S(); cVar.D0(this.f15828i); try { try { b5.l.b(hVar, cVar); } catch (IOException e10) { throw new i(e10); } catch (AssertionError e11) { AssertionError assertionError = new AssertionError("AssertionError (GSON 2.8.6): " + e11.getMessage()); assertionError.initCause(e11); throw assertionError; } } finally { cVar.z0(a02); cVar.u0(Y); cVar.D0(S); } } public void y(h hVar, Appendable appendable) { try { x(hVar, r(b5.l.c(appendable))); } catch (IOException e10) { throw new i(e10); } } public h z(Object obj) { return obj == null ? j.f15863a : A(obj, obj.getClass()); } e(b5.d dVar, z4.d dVar2, Map map, boolean z10, boolean z11, boolean z12, boolean z13, boolean z14, boolean z15, boolean z16, p pVar, String str, int i10, int i11, List list, List list2, List list3) { this.f15820a = new ThreadLocal(); this.f15821b = new ConcurrentHashMap(); this.f15825f = dVar; this.f15826g = dVar2; this.f15827h = map; b5.c cVar = new b5.c(map); this.f15822c = cVar; this.f15828i = z10; this.f15829j = z11; this.f15830k = z12; this.f15831l = z13; this.f15832m = z14; this.f15833n = z15; this.f15834o = z16; this.f15838s = pVar; this.f15835p = str; this.f15836q = i10; this.f15837r = i11; this.f15839t = list; this.f15840u = list2; ArrayList arrayList = new ArrayList(); arrayList.add(c5.m.Y); arrayList.add(c5.h.f3754b); arrayList.add(dVar); arrayList.addAll(list3); arrayList.add(c5.m.D); arrayList.add(c5.m.f3793m); arrayList.add(c5.m.f3787g); arrayList.add(c5.m.f3789i); arrayList.add(c5.m.f3791k); q p10 = p(pVar); arrayList.add(c5.m.a(Long.TYPE, Long.class, p10)); arrayList.add(c5.m.a(Double.TYPE, Double.class, e(z16))); arrayList.add(c5.m.a(Float.TYPE, Float.class, f(z16))); arrayList.add(c5.m.f3804x); arrayList.add(c5.m.f3795o); arrayList.add(c5.m.f3797q); arrayList.add(c5.m.b(AtomicLong.class, b(p10))); arrayList.add(c5.m.b(AtomicLongArray.class, c(p10))); arrayList.add(c5.m.f3799s); arrayList.add(c5.m.f3806z); arrayList.add(c5.m.F); arrayList.add(c5.m.H); arrayList.add(c5.m.b(BigDecimal.class, c5.m.B)); arrayList.add(c5.m.b(BigInteger.class, c5.m.C)); arrayList.add(c5.m.J); arrayList.add(c5.m.L); arrayList.add(c5.m.P); arrayList.add(c5.m.R); arrayList.add(c5.m.W); arrayList.add(c5.m.N); arrayList.add(c5.m.f3784d); arrayList.add(c5.c.f3734b); arrayList.add(c5.m.U); arrayList.add(c5.k.f3776b); arrayList.add(c5.j.f3774b); arrayList.add(c5.m.S); arrayList.add(c5.a.f3728c); arrayList.add(c5.m.f3782b); arrayList.add(new c5.b(cVar)); arrayList.add(new c5.g(cVar, z11)); c5.d dVar3 = new c5.d(cVar); this.f15823d = dVar3; arrayList.add(dVar3); arrayList.add(c5.m.Z); arrayList.add(new c5.i(cVar, dVar2, dVar, dVar3)); this.f15824e = Collections.unmodifiableList(arrayList); } }