package n9; import java.util.Arrays; import java.util.List; import java.util.Objects; import javax.net.ssl.SSLSocket; /* loaded from: classes2.dex */ public final class n { /* renamed from: e, reason: collision with root package name */ private static final k[] f12475e; /* renamed from: f, reason: collision with root package name */ private static final k[] f12476f; /* renamed from: g, reason: collision with root package name */ public static final n f12477g; /* renamed from: h, reason: collision with root package name */ public static final n f12478h; /* renamed from: i, reason: collision with root package name */ public static final n f12479i; /* renamed from: j, reason: collision with root package name */ public static final n f12480j; /* renamed from: a, reason: collision with root package name */ final boolean f12481a; /* renamed from: b, reason: collision with root package name */ final boolean f12482b; /* renamed from: c, reason: collision with root package name */ final String[] f12483c; /* renamed from: d, reason: collision with root package name */ final String[] f12484d; static { k kVar = k.f12444n1; k kVar2 = k.f12447o1; k kVar3 = k.f12450p1; k kVar4 = k.Z0; k kVar5 = k.f12414d1; k kVar6 = k.f12405a1; k kVar7 = k.f12417e1; k kVar8 = k.f12435k1; k kVar9 = k.f12432j1; k[] kVarArr = {kVar, kVar2, kVar3, kVar4, kVar5, kVar6, kVar7, kVar8, kVar9}; f12475e = kVarArr; k[] kVarArr2 = {kVar, kVar2, kVar3, kVar4, kVar5, kVar6, kVar7, kVar8, kVar9, k.K0, k.L0, k.f12428i0, k.f12431j0, k.G, k.K, k.f12433k}; f12476f = kVarArr2; a c10 = new a(true).c(kVarArr); j0 j0Var = j0.TLS_1_3; j0 j0Var2 = j0.TLS_1_2; f12477g = c10.f(j0Var, j0Var2).d(true).a(); f12478h = new a(true).c(kVarArr2).f(j0Var, j0Var2).d(true).a(); f12479i = new a(true).c(kVarArr2).f(j0Var, j0Var2, j0.TLS_1_1, j0.TLS_1_0).d(true).a(); f12480j = new a(false).a(); } n(a aVar) { this.f12481a = aVar.f12485a; this.f12483c = aVar.f12486b; this.f12484d = aVar.f12487c; this.f12482b = aVar.f12488d; } private n e(SSLSocket sSLSocket, boolean z10) { String[] z11 = this.f12483c != null ? o9.e.z(k.f12406b, sSLSocket.getEnabledCipherSuites(), this.f12483c) : sSLSocket.getEnabledCipherSuites(); String[] z12 = this.f12484d != null ? o9.e.z(o9.e.f12835j, sSLSocket.getEnabledProtocols(), this.f12484d) : sSLSocket.getEnabledProtocols(); String[] supportedCipherSuites = sSLSocket.getSupportedCipherSuites(); int w10 = o9.e.w(k.f12406b, supportedCipherSuites, "TLS_FALLBACK_SCSV"); if (z10 && w10 != -1) { z11 = o9.e.i(z11, supportedCipherSuites[w10]); } return new a(this).b(z11).e(z12).a(); } void a(SSLSocket sSLSocket, boolean z10) { n e10 = e(sSLSocket, z10); String[] strArr = e10.f12484d; if (strArr != null) { sSLSocket.setEnabledProtocols(strArr); } String[] strArr2 = e10.f12483c; if (strArr2 != null) { sSLSocket.setEnabledCipherSuites(strArr2); } } public List b() { String[] strArr = this.f12483c; if (strArr != null) { return k.c(strArr); } return null; } public boolean c(SSLSocket sSLSocket) { if (!this.f12481a) { return false; } String[] strArr = this.f12484d; if (strArr != null && !o9.e.C(o9.e.f12835j, strArr, sSLSocket.getEnabledProtocols())) { return false; } String[] strArr2 = this.f12483c; return strArr2 == null || o9.e.C(k.f12406b, strArr2, sSLSocket.getEnabledCipherSuites()); } public boolean d() { return this.f12481a; } public boolean equals(Object obj) { if (!(obj instanceof n)) { return false; } if (obj == this) { return true; } n nVar = (n) obj; boolean z10 = this.f12481a; if (z10 != nVar.f12481a) { return false; } return !z10 || (Arrays.equals(this.f12483c, nVar.f12483c) && Arrays.equals(this.f12484d, nVar.f12484d) && this.f12482b == nVar.f12482b); } public boolean f() { return this.f12482b; } public List g() { String[] strArr = this.f12484d; if (strArr != null) { return j0.b(strArr); } return null; } public int hashCode() { if (this.f12481a) { return ((((527 + Arrays.hashCode(this.f12483c)) * 31) + Arrays.hashCode(this.f12484d)) * 31) + (!this.f12482b ? 1 : 0); } return 17; } public String toString() { if (!this.f12481a) { return "ConnectionSpec()"; } return "ConnectionSpec(cipherSuites=" + Objects.toString(b(), "[all enabled]") + ", tlsVersions=" + Objects.toString(g(), "[all enabled]") + ", supportsTlsExtensions=" + this.f12482b + ")"; } public static final class a { /* renamed from: a, reason: collision with root package name */ boolean f12485a; /* renamed from: b, reason: collision with root package name */ String[] f12486b; /* renamed from: c, reason: collision with root package name */ String[] f12487c; /* renamed from: d, reason: collision with root package name */ boolean f12488d; a(boolean z10) { this.f12485a = z10; } public n a() { return new n(this); } public a b(String... strArr) { if (!this.f12485a) { throw new IllegalStateException("no cipher suites for cleartext connections"); } if (strArr.length == 0) { throw new IllegalArgumentException("At least one cipher suite is required"); } this.f12486b = (String[]) strArr.clone(); return this; } public a c(k... kVarArr) { if (!this.f12485a) { throw new IllegalStateException("no cipher suites for cleartext connections"); } String[] strArr = new String[kVarArr.length]; for (int i10 = 0; i10 < kVarArr.length; i10++) { strArr[i10] = kVarArr[i10].f12473a; } return b(strArr); } public a d(boolean z10) { if (!this.f12485a) { throw new IllegalStateException("no TLS extensions for cleartext connections"); } this.f12488d = z10; return this; } public a e(String... strArr) { if (!this.f12485a) { throw new IllegalStateException("no TLS versions for cleartext connections"); } if (strArr.length == 0) { throw new IllegalArgumentException("At least one TLS version is required"); } this.f12487c = (String[]) strArr.clone(); return this; } public a f(j0... j0VarArr) { if (!this.f12485a) { throw new IllegalStateException("no TLS versions for cleartext connections"); } String[] strArr = new String[j0VarArr.length]; for (int i10 = 0; i10 < j0VarArr.length; i10++) { strArr[i10] = j0VarArr[i10].f12403a; } return e(strArr); } public a(n nVar) { this.f12485a = nVar.f12481a; this.f12486b = nVar.f12483c; this.f12487c = nVar.f12484d; this.f12488d = nVar.f12482b; } } }