package com.facetec.sdk; import com.facetec.sdk.jt; import com.facetec.sdk.jv; import com.facetec.sdk.jx; import com.facetec.sdk.kh; import com.huawei.hms.android.HwBuildEx; import java.io.IOException; import java.lang.ref.Reference; import java.net.Proxy; import java.net.ProxySelector; import java.net.Socket; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.net.SocketFactory; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; /* loaded from: classes.dex */ public class ka implements Cloneable { private boolean A; private boolean B; private ju C; private boolean D; final List b; final jx.a c; final List d; final int f; final int g; public final jf h; final ku i; final jg j; final int k; public final int l; final int m; private jr n; /* renamed from: o, reason: collision with root package name */ private Proxy f6446o; private List p; private SocketFactory q; private ProxySelector r; private js s; private List t; private HostnameVerifier u; private jf v; private jk w; private SSLSocketFactory x; private mm y; private jp z; static final List e = km.d(kd.HTTP_2, kd.HTTP_1_1); static final List a = km.d(jt.d, jt.b); static { kn.a = new kn() { // from class: com.facetec.sdk.ka.1 @Override // com.facetec.sdk.kn public final void c(jv.a aVar, String str, String str2) { aVar.c(str, str2); } @Override // com.facetec.sdk.kn public final boolean e(jp jpVar, kt ktVar) { return jpVar.a(ktVar); } @Override // com.facetec.sdk.kn public final boolean a(jj jjVar, jj jjVar2) { return jjVar.d(jjVar2); } @Override // com.facetec.sdk.kn public final kv b(jp jpVar) { return jpVar.d; } @Override // com.facetec.sdk.kn public final int c(kh.d dVar) { return dVar.d; } @Override // com.facetec.sdk.kn public final IOException a(jo joVar, IOException iOException) { return ((kg) joVar).e(iOException); } @Override // com.facetec.sdk.kn public final void a(jv.a aVar, String str) { int indexOf = str.indexOf(":", 1); if (indexOf != -1) { aVar.c(str.substring(0, indexOf), str.substring(indexOf + 1)); } else if (str.startsWith(":")) { aVar.c("", str.substring(1)); } else { aVar.c("", str); } } @Override // com.facetec.sdk.kn public final kt d(jp jpVar, jj jjVar, ky kyVar, kj kjVar) { if (!jp.h && !Thread.holdsLock(jpVar)) { throw new AssertionError(); } for (kt ktVar : jpVar.e) { if (ktVar.c(jjVar, kjVar)) { kyVar.b(ktVar, true); return ktVar; } } return null; } @Override // com.facetec.sdk.kn public final Socket a(jp jpVar, jj jjVar, ky kyVar) { if (!jp.h && !Thread.holdsLock(jpVar)) { throw new AssertionError(); } for (kt ktVar : jpVar.e) { if (ktVar.c(jjVar, null) && ktVar.b() && ktVar != kyVar.e()) { if (!ky.j && !Thread.holdsLock(kyVar.b)) { throw new AssertionError(); } if (kyVar.h != null || kyVar.c.f6451o.size() != 1) { throw new IllegalStateException(); } Reference reference = kyVar.c.f6451o.get(0); Socket b = kyVar.b(true, false, false); kyVar.c = ktVar; ktVar.f6451o.add(reference); return b; } } return null; } @Override // com.facetec.sdk.kn public final void c(jp jpVar, kt ktVar) { if (!jp.h && !Thread.holdsLock(jpVar)) { throw new AssertionError(); } if (!jpVar.a) { jpVar.a = true; jp.b.execute(jpVar.c); } jpVar.e.add(ktVar); } @Override // com.facetec.sdk.kn public final void e(jt jtVar, SSLSocket sSLSocket, boolean z) { String[] enabledCipherSuites; String[] enabledProtocols; if (jtVar.e != null) { enabledCipherSuites = km.b(jn.c, sSLSocket.getEnabledCipherSuites(), jtVar.e); } else { enabledCipherSuites = sSLSocket.getEnabledCipherSuites(); } if (jtVar.i != null) { enabledProtocols = km.b(km.g, sSLSocket.getEnabledProtocols(), jtVar.i); } else { enabledProtocols = sSLSocket.getEnabledProtocols(); } String[] supportedCipherSuites = sSLSocket.getSupportedCipherSuites(); int b = km.b(jn.c, supportedCipherSuites, "TLS_FALLBACK_SCSV"); if (z && b != -1) { enabledCipherSuites = km.c(enabledCipherSuites, supportedCipherSuites[b]); } jt a2 = new jt.a(jtVar).a(enabledCipherSuites).e(enabledProtocols).a(); if (a2.i != null) { sSLSocket.setEnabledProtocols(a2.i); } if (a2.e != null) { sSLSocket.setEnabledCipherSuites(a2.e); } } }; } public ka() { this(new e()); } ka(e eVar) { boolean z; this.n = eVar.b; this.f6446o = eVar.c; this.p = eVar.e; this.t = eVar.d; this.d = km.e(eVar.a); this.b = km.e(eVar.f); this.c = eVar.i; this.r = eVar.j; this.s = eVar.g; this.j = eVar.h; this.i = eVar.k; this.q = eVar.n; Iterator it = this.t.iterator(); loop0: while (true) { while (it.hasNext()) { z = z || it.next().b(); } } if (eVar.m != null || !z) { this.x = eVar.m; this.y = eVar.f6447o; } else { X509TrustManager a2 = km.a(); this.x = d(a2); this.y = mi.c().a(a2); } if (this.x != null) { mi.c().d(this.x); } this.u = eVar.l; jk jkVar = eVar.q; mm mmVar = this.y; this.w = km.b(jkVar.c, mmVar) ? jkVar : new jk(jkVar.d, mmVar); this.v = eVar.s; this.h = eVar.r; this.z = eVar.t; this.C = eVar.p; this.B = eVar.u; this.A = eVar.v; this.D = eVar.y; this.g = eVar.w; this.f = eVar.x; this.m = eVar.z; this.k = eVar.D; this.l = eVar.B; if (this.d.contains(null)) { StringBuilder sb = new StringBuilder("Null interceptor: "); sb.append(this.d); throw new IllegalStateException(sb.toString()); } if (this.b.contains(null)) { StringBuilder sb2 = new StringBuilder("Null network interceptor: "); sb2.append(this.b); throw new IllegalStateException(sb2.toString()); } } private static SSLSocketFactory d(X509TrustManager x509TrustManager) { try { SSLContext d = mi.c().d(); d.init(null, new TrustManager[]{x509TrustManager}, null); return d.getSocketFactory(); } catch (GeneralSecurityException e2) { throw km.e("No System TLS", e2); } } public final jo c(ke keVar) { return kg.d(this, keVar, false); } /* loaded from: classes.dex */ public static final class e { int B; public int D; Proxy c; js g; jg h; ProxySelector j; ku k; HostnameVerifier l; public SSLSocketFactory m; SocketFactory n; /* renamed from: o, reason: collision with root package name */ public mm f6447o; ju p; public jk q; jf r; jf s; jp t; boolean u; boolean v; int w; public int x; boolean y; public int z; final List a = new ArrayList(); final List f = new ArrayList(); jr b = new jr(); List e = ka.e; List d = ka.a; jx.a i = jx.c(jx.e); public e() { ProxySelector proxySelector = ProxySelector.getDefault(); this.j = proxySelector; if (proxySelector == null) { this.j = new mk(); } this.g = js.e; this.n = SocketFactory.getDefault(); this.l = mn.d; this.q = jk.e; this.s = jf.d; this.r = jf.d; this.t = new jp(); this.p = ju.e; this.u = true; this.v = true; this.y = true; this.w = 0; this.x = HwBuildEx.VersionCodes.CUR_DEVELOPMENT; this.z = HwBuildEx.VersionCodes.CUR_DEVELOPMENT; this.D = HwBuildEx.VersionCodes.CUR_DEVELOPMENT; this.B = 0; } public final ka b() { return new ka(this); } } public final List p() { return this.t; } public final boolean o() { return this.A; } public final boolean n() { return this.B; } public final List m() { return this.p; } public final jr l() { return this.n; } public final boolean k() { return this.D; } public final jk j() { return this.w; } public final jp i() { return this.z; } public final SSLSocketFactory h() { return this.x; } public final jf g() { return this.v; } public final HostnameVerifier f() { return this.u; } public final SocketFactory e() { return this.q; } public final Proxy d() { return this.f6446o; } public final ju c() { return this.C; } public final ProxySelector b() { return this.r; } public final js a() { return this.s; } }