package defpackage;

import j$.util.Objects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.net.ssl.SSLSocket;

/* JADX INFO: renamed from: ᵻᵙ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C5209 {

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public static final C5209 f19623;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public static final C5209 f19624;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public static final C5209 f19625;

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final boolean f19626;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final String[] f19627;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final boolean f19628;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final String[] f19629;

    static {
        C1722 c1722 = C1722.f6890;
        C1722 c17222 = C1722.f6889;
        C1722 c17223 = C1722.f6893;
        C1722 c17224 = C1722.f6899;
        C1722 c17225 = C1722.f6892;
        C1722 c17226 = C1722.f6895;
        C1722 c17227 = C1722.f6898;
        C1722 c17228 = C1722.f6900;
        C1722 c17229 = C1722.f6896;
        List listM3123 = AbstractC0892.m3123(c1722, c17222, c17223, c17224, c17225, c17226, c17227, c17228, c17229);
        List listM31232 = AbstractC0892.m3123(c1722, c17222, c17223, c17224, c17225, c17226, c17227, c17228, c17229, C1722.f6901, C1722.f6903, C1722.f6891, C1722.f6905, C1722.f6906, C1722.f6902, C1722.f6897);
        C2531 c2531 = new C2531();
        C1722[] c1722Arr = (C1722[]) listM3123.toArray(new C1722[0]);
        c2531.m6250((C1722[]) Arrays.copyOf(c1722Arr, c1722Arr.length));
        EnumC2325 enumC2325 = EnumC2325.f9146;
        EnumC2325 enumC23252 = EnumC2325.f9145;
        c2531.m6251(enumC2325, enumC23252);
        c2531.f9795 = true;
        c2531.m6252();
        C2531 c25312 = new C2531();
        C1722[] c1722Arr2 = (C1722[]) listM31232.toArray(new C1722[0]);
        c25312.m6250((C1722[]) Arrays.copyOf(c1722Arr2, c1722Arr2.length));
        c25312.m6251(enumC2325, enumC23252);
        c25312.f9795 = true;
        f19623 = c25312.m6252();
        C2531 c25313 = new C2531();
        C1722[] c1722Arr3 = (C1722[]) listM31232.toArray(new C1722[0]);
        c25313.m6250((C1722[]) Arrays.copyOf(c1722Arr3, c1722Arr3.length));
        c25313.m6251(enumC2325, enumC23252, EnumC2325.f9147, EnumC2325.f9148);
        c25313.f9795 = true;
        f19625 = c25313.m6252();
        f19624 = new C5209(false, false, null, null);
    }

    public C5209(boolean z, boolean z2, String[] strArr, String[] strArr2) {
        this.f19628 = z;
        this.f19626 = z2;
        this.f19627 = strArr;
        this.f19629 = strArr2;
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof C5209)) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        C5209 c5209 = (C5209) obj;
        boolean z = c5209.f19628;
        boolean z2 = this.f19628;
        if (z2 != z) {
            return false;
        }
        if (z2) {
            return Arrays.equals(this.f19627, c5209.f19627) && Arrays.equals(this.f19629, c5209.f19629) && this.f19626 == c5209.f19626;
        }
        return true;
    }

    public final int hashCode() {
        if (!this.f19628) {
            return 17;
        }
        String[] strArr = this.f19627;
        int iHashCode = (527 + (strArr != null ? Arrays.hashCode(strArr) : 0)) * 31;
        String[] strArr2 = this.f19629;
        return ((iHashCode + (strArr2 != null ? Arrays.hashCode(strArr2) : 0)) * 31) + (!this.f19626 ? 1 : 0);
    }

    public final String toString() {
        if (!this.f19628) {
            return "ConnectionSpec()";
        }
        return "ConnectionSpec(cipherSuites=" + Objects.toString(m10744(), "[all enabled]") + ", tlsVersions=" + Objects.toString(m10745(), "[all enabled]") + ", supportsTlsExtensions=" + this.f19626 + ')';
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final ArrayList m10744() {
        String[] strArr = this.f19627;
        if (strArr == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList(strArr.length);
        for (String str : strArr) {
            arrayList.add(C1722.f6888.ᵪᵹᵥᵻ(str));
        }
        return arrayList;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final ArrayList m10745() {
        String[] strArr = this.f19629;
        if (strArr == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList(strArr.length);
        for (String str : strArr) {
            arrayList.add(ᵲᵧˇ.ˊᵫᵗ(str));
        }
        return arrayList;
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m10746(SSLSocket sSLSocket, boolean z) {
        String[] enabledCipherSuites = sSLSocket.getEnabledCipherSuites();
        String[] strArr = this.f19627;
        if (strArr != null) {
            enabledCipherSuites = AbstractC1701.m4665(strArr, enabledCipherSuites, C1722.f6894);
        }
        String[] strArr2 = this.f19629;
        String[] strArrM4665 = strArr2 != null ? AbstractC1701.m4665(sSLSocket.getEnabledProtocols(), strArr2, C2199.f8737) : sSLSocket.getEnabledProtocols();
        String[] supportedCipherSuites = sSLSocket.getSupportedCipherSuites();
        C4170 c4170 = C1722.f6894;
        byte[] bArr = AbstractC1701.f6716;
        int length = supportedCipherSuites.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                i = -1;
                break;
            } else if (c4170.compare(supportedCipherSuites[i], "TLS_FALLBACK_SCSV") == 0) {
                break;
            } else {
                i++;
            }
        }
        if (z && i != -1) {
            String str = supportedCipherSuites[i];
            enabledCipherSuites = (String[]) Arrays.copyOf(enabledCipherSuites, enabledCipherSuites.length + 1);
            enabledCipherSuites[enabledCipherSuites.length - 1] = str;
        }
        String[] strArr3 = (String[]) Arrays.copyOf(enabledCipherSuites, enabledCipherSuites.length);
        boolean z2 = this.f19628;
        if (!z2) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("no cipher suites for cleartext connections");
            return;
        }
        if (strArr3.length == 0) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("At least one cipher suite is required");
            return;
        }
        String[] strArr4 = (String[]) Arrays.copyOf(strArr3, strArr3.length);
        String[] strArr5 = (String[]) Arrays.copyOf(strArrM4665, strArrM4665.length);
        if (!z2) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("no TLS versions for cleartext connections");
            return;
        }
        if (strArr5.length == 0) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("At least one TLS version is required");
            return;
        }
        C5209 c5209 = new C5209(z2, this.f19626, strArr4, (String[]) Arrays.copyOf(strArr5, strArr5.length));
        if (c5209.m10745() != null) {
            sSLSocket.setEnabledProtocols(c5209.f19629);
        }
        if (c5209.m10744() != null) {
            sSLSocket.setEnabledCipherSuites(c5209.f19627);
        }
    }
}
