what-the-bank/sources/com/facetec/sdk/dx.java

562 lines
18 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import com.google.gson.Gson;
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: classes.dex */
public final class dx {
private static fv<?> b = fv.b(Object.class);
private fe a;
private Map<fv<?>, ek<?>> c;
private ThreadLocal<Map<fv<?>, c<?>>> d;
private eq e;
private ev f;
private dw g;
private List<en> h;
private Map<Type, dz<?>> i;
private boolean j;
private boolean k;
private boolean l;
private boolean m;
private boolean n;
/* renamed from: o, reason: collision with root package name */
private boolean f6440o;
private boolean p;
private String q;
private int r;
private int s;
private ej t;
private List<en> u;
private List<en> x;
public dx() {
this(ev.d, du.IDENTITY, Collections.emptyMap(), false, false, false, true, false, false, false, ej.DEFAULT, null, 2, 2, Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
}
/* JADX INFO: Access modifiers changed from: package-private */
public dx(ev evVar, dw dwVar, Map<Type, dz<?>> map, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, ej ejVar, String str, int i, int i2, List<en> list, List<en> list2, List<en> list3) {
ek<Number> ekVar;
ek<Number> ekVar2;
ek<Number> ekVar3;
ArrayList arrayList = new ArrayList(list3);
arrayList.add(new hb());
this.d = new ThreadLocal<>();
this.c = new ConcurrentHashMap();
this.f = evVar;
this.g = dwVar;
this.i = map;
this.e = new eq(map);
this.j = z;
this.n = z2;
this.f6440o = z3;
this.k = z4;
this.l = z5;
this.m = z6;
this.p = z7;
this.t = ejVar;
this.q = str;
this.r = i;
this.s = i2;
this.x = list;
this.u = list2;
ArrayList arrayList2 = new ArrayList();
arrayList2.add(fs.D);
arrayList2.add(fm.a);
arrayList2.add(evVar);
arrayList2.addAll(arrayList);
arrayList2.add(fs.r);
arrayList2.add(fs.g);
arrayList2.add(fs.b);
arrayList2.add(fs.c);
arrayList2.add(fs.h);
if (ejVar == ej.DEFAULT) {
ekVar = fs.n;
} else {
ekVar = new ek<Number>() { // from class: com.facetec.sdk.dx.5
@Override // com.facetec.sdk.ek
public final /* synthetic */ void b(ga gaVar, Number number) throws IOException {
Number number2 = number;
if (number2 == null) {
gaVar.h();
} else {
gaVar.b(number2.toString());
}
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ Number a(fu fuVar) throws IOException {
if (fuVar.i() == gc.NULL) {
fuVar.l();
return null;
}
return Long.valueOf(fuVar.k());
}
};
}
arrayList2.add(fs.b(Long.TYPE, Long.class, ekVar));
Class cls = Double.TYPE;
if (z7) {
ekVar2 = fs.l;
} else {
ekVar2 = new ek<Number>(this) { // from class: com.facetec.sdk.dx.2
private dx e;
{
this.e = this;
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ void b(ga gaVar, Number number) throws IOException {
Number number2 = number;
if (number2 == null) {
gaVar.h();
} else {
dx.b(number2.doubleValue());
gaVar.b(number2);
}
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ Number a(fu fuVar) throws IOException {
if (fuVar.i() == gc.NULL) {
fuVar.l();
return null;
}
return Double.valueOf(fuVar.o());
}
};
}
arrayList2.add(fs.b(cls, Double.class, ekVar2));
Class cls2 = Float.TYPE;
if (z7) {
ekVar3 = fs.k;
} else {
ekVar3 = new ek<Number>(this) { // from class: com.facetec.sdk.dx.4
private dx c;
{
this.c = this;
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ void b(ga gaVar, Number number) throws IOException {
Number number2 = number;
if (number2 == null) {
gaVar.h();
} else {
dx.b(number2.floatValue());
gaVar.b(number2);
}
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ Number a(fu fuVar) throws IOException {
if (fuVar.i() == gc.NULL) {
fuVar.l();
return null;
}
return Float.valueOf((float) fuVar.o());
}
};
}
arrayList2.add(fs.b(cls2, Float.class, ekVar3));
arrayList2.add(fs.m);
arrayList2.add(fs.j);
arrayList2.add(fs.i);
arrayList2.add(fs.d(AtomicLong.class, new ek<AtomicLong>(ekVar) { // from class: com.facetec.sdk.dx.3
private ek b;
{
this.b = ekVar;
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ void b(ga gaVar, AtomicLong atomicLong) throws IOException {
this.b.b(gaVar, Long.valueOf(atomicLong.get()));
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ AtomicLong a(fu fuVar) throws IOException {
return new AtomicLong(((Number) this.b.a(fuVar)).longValue());
}
}.b()));
arrayList2.add(fs.d(AtomicLongArray.class, new ek<AtomicLongArray>(ekVar) { // from class: com.facetec.sdk.dx.1
private ek d;
{
this.d = ekVar;
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ void b(ga gaVar, AtomicLongArray atomicLongArray) throws IOException {
AtomicLongArray atomicLongArray2 = atomicLongArray;
gaVar.e();
int length = atomicLongArray2.length();
for (int i3 = 0; i3 < length; i3++) {
this.d.b(gaVar, Long.valueOf(atomicLongArray2.get(i3)));
}
gaVar.b();
}
@Override // com.facetec.sdk.ek
public final /* synthetic */ AtomicLongArray a(fu fuVar) throws IOException {
ArrayList arrayList3 = new ArrayList();
fuVar.a();
while (fuVar.e()) {
arrayList3.add(Long.valueOf(((Number) this.d.a(fuVar)).longValue()));
}
fuVar.c();
int size = arrayList3.size();
AtomicLongArray atomicLongArray = new AtomicLongArray(size);
for (int i3 = 0; i3 < size; i3++) {
atomicLongArray.set(i3, ((Long) arrayList3.get(i3)).longValue());
}
return atomicLongArray;
}
}.b()));
arrayList2.add(fs.f);
arrayList2.add(fs.f6441o);
arrayList2.add(fs.s);
arrayList2.add(fs.q);
arrayList2.add(fs.d(BigDecimal.class, fs.p));
arrayList2.add(fs.d(BigInteger.class, fs.t));
arrayList2.add(fs.w);
arrayList2.add(fs.y);
arrayList2.add(fs.x);
arrayList2.add(fs.u);
arrayList2.add(fs.z);
arrayList2.add(fs.v);
arrayList2.add(fs.a);
arrayList2.add(fh.a);
arrayList2.add(fs.A);
arrayList2.add(fo.b);
arrayList2.add(fk.e);
arrayList2.add(fs.C);
arrayList2.add(fg.a);
arrayList2.add(fs.d);
arrayList2.add(new ff(this.e));
arrayList2.add(new fj(this.e, z2));
fe feVar = new fe(this.e);
this.a = feVar;
arrayList2.add(feVar);
arrayList2.add(fs.F);
arrayList2.add(new fn(this.e, dwVar, evVar, this.a));
this.h = Collections.unmodifiableList(arrayList2);
}
static void b(double d) {
if (Double.isNaN(d) || Double.isInfinite(d)) {
StringBuilder sb = new StringBuilder();
sb.append(d);
sb.append(" is not a valid double value as per JSON specification. To override this behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method.");
throw new IllegalArgumentException(sb.toString());
}
}
public final <T> ek<T> d(fv<T> fvVar) {
boolean z;
ek<T> ekVar = (ek) this.c.get(fvVar == null ? b : fvVar);
if (ekVar != null) {
return ekVar;
}
Map<fv<?>, c<?>> map = this.d.get();
if (map == null) {
map = new HashMap<>();
this.d.set(map);
z = true;
} else {
z = false;
}
c<?> cVar = map.get(fvVar);
if (cVar != null) {
return cVar;
}
try {
c<?> cVar2 = new c<>();
map.put(fvVar, cVar2);
Iterator<en> it = this.h.iterator();
while (it.hasNext()) {
ek<T> e = it.next().e(this, fvVar);
if (e != null) {
if (cVar2.c != null) {
throw new AssertionError();
}
cVar2.c = e;
this.c.put(fvVar, e);
return e;
}
}
throw new IllegalArgumentException("GSON (2.8.6) cannot handle ".concat(String.valueOf(fvVar)));
} finally {
map.remove(fvVar);
if (z) {
this.d.remove();
}
}
}
public final <T> ek<T> c(en enVar, fv<T> fvVar) {
if (!this.h.contains(enVar)) {
enVar = this.a;
}
boolean z = false;
for (en enVar2 : this.h) {
if (z) {
ek<T> e = enVar2.e(this, fvVar);
if (e != null) {
return e;
}
} else if (enVar2 == enVar) {
z = true;
}
}
throw new IllegalArgumentException("GSON cannot serialize ".concat(String.valueOf(fvVar)));
}
public final <T> ek<T> b(Class<T> cls) {
return d(fv.b((Class) cls));
}
public final eb c(Object obj) {
if (obj == null) {
return ea.a;
}
return a(obj, obj.getClass());
}
private eb a(Object obj, Type type) {
fl flVar = new fl();
a(obj, type, flVar);
return flVar.c();
}
public final String b(Object obj) {
if (obj == null) {
return c((eb) ea.a);
}
return e(obj, obj.getClass());
}
private String e(Object obj, Type type) {
StringWriter stringWriter = new StringWriter();
c(obj, type, stringWriter);
return stringWriter.toString();
}
private void c(Object obj, Type type, Appendable appendable) throws ed {
try {
a(obj, type, e(fd.a(appendable)));
} catch (IOException e) {
throw new ed(e);
}
}
private void a(Object obj, Type type, ga gaVar) throws ed {
ek d = d(fv.b(type));
boolean i = gaVar.i();
gaVar.c(true);
boolean j = gaVar.j();
gaVar.b(this.k);
boolean f = gaVar.f();
gaVar.e(this.j);
try {
try {
d.b(gaVar, obj);
} catch (IOException e) {
throw new ed(e);
} catch (AssertionError e2) {
StringBuilder sb = new StringBuilder("AssertionError (GSON 2.8.6): ");
sb.append(e2.getMessage());
AssertionError assertionError = new AssertionError(sb.toString());
assertionError.initCause(e2);
throw assertionError;
}
} finally {
gaVar.c(i);
gaVar.b(j);
gaVar.e(f);
}
}
private String c(eb ebVar) {
StringWriter stringWriter = new StringWriter();
a(ebVar, stringWriter);
return stringWriter.toString();
}
private void a(eb ebVar, Appendable appendable) throws ed {
try {
a(ebVar, e(fd.a(appendable)));
} catch (IOException e) {
throw new ed(e);
}
}
private ga e(Writer writer) throws IOException {
if (this.f6440o) {
writer.write(Gson.JSON_NON_EXECUTABLE_PREFIX);
}
ga gaVar = new ga(writer);
if (this.l) {
gaVar.d(" ");
}
gaVar.e(this.j);
return gaVar;
}
private fu c(Reader reader) {
fu fuVar = new fu(reader);
fuVar.b(this.m);
return fuVar;
}
private void a(eb ebVar, ga gaVar) throws ed {
boolean i = gaVar.i();
gaVar.c(true);
boolean j = gaVar.j();
gaVar.b(this.k);
boolean f = gaVar.f();
gaVar.e(this.j);
try {
try {
fd.c(ebVar, gaVar);
} catch (IOException e) {
throw new ed(e);
} catch (AssertionError e2) {
StringBuilder sb = new StringBuilder("AssertionError (GSON 2.8.6): ");
sb.append(e2.getMessage());
AssertionError assertionError = new AssertionError(sb.toString());
assertionError.initCause(e2);
throw assertionError;
}
} finally {
gaVar.c(i);
gaVar.b(j);
gaVar.e(f);
}
}
public final <T> T d(String str, Class<T> cls) throws ei {
return (T) ez.e(cls).cast(d(str, (Type) cls));
}
private <T> T d(String str, Type type) throws ei {
if (str == null) {
return null;
}
return (T) c(new StringReader(str), type);
}
private <T> T c(Reader reader, Type type) throws ed, ei {
fu c2 = c(reader);
T t = (T) e(c2, type);
c(t, c2);
return t;
}
private static void c(Object obj, fu fuVar) {
if (obj != null) {
try {
if (fuVar.i() == gc.END_DOCUMENT) {
} else {
throw new ed("JSON document was not fully consumed.");
}
} catch (fz e) {
throw new ei(e);
} catch (IOException e2) {
throw new ed(e2);
}
}
}
private <T> T e(fu fuVar, Type type) throws ed, ei {
boolean r = fuVar.r();
boolean z = true;
fuVar.b(true);
try {
try {
try {
fuVar.i();
z = false;
return d(fv.b(type)).a(fuVar);
} catch (IOException e) {
throw new ei(e);
} catch (IllegalStateException e2) {
throw new ei(e2);
}
} catch (EOFException e3) {
if (!z) {
throw new ei(e3);
}
fuVar.b(r);
return null;
} catch (AssertionError e4) {
StringBuilder sb = new StringBuilder("AssertionError (GSON 2.8.6): ");
sb.append(e4.getMessage());
AssertionError assertionError = new AssertionError(sb.toString());
assertionError.initCause(e4);
throw assertionError;
}
} finally {
fuVar.b(r);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static final class c<T> extends ek<T> {
ek<T> c;
c() {
}
@Override // com.facetec.sdk.ek
public final T a(fu fuVar) throws IOException {
ek<T> ekVar = this.c;
if (ekVar == null) {
throw new IllegalStateException();
}
return ekVar.a(fuVar);
}
@Override // com.facetec.sdk.ek
public final void b(ga gaVar, T t) throws IOException {
ek<T> ekVar = this.c;
if (ekVar == null) {
throw new IllegalStateException();
}
ekVar.b(gaVar, t);
}
}
public final String toString() {
StringBuilder sb = new StringBuilder("{serializeNulls:");
sb.append(this.j);
sb.append(",factories:");
sb.append(this.h);
sb.append(",instanceCreators:");
sb.append(this.e);
sb.append(UrlTreeKt.componentParamSuffix);
return sb.toString();
}
}