package K4;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import r4.AbstractC0983h;

/* JADX INFO: loaded from: classes.dex */
public final class h {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public boolean f1121a = true;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f1122b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Object f1123c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Serializable f1124d;

    public i a() {
        return new i(this.f1121a, this.f1122b, (String[]) this.f1123c, (String[]) this.f1124d);
    }

    public void b(g... gVarArr) {
        AbstractC0983h.e("cipherSuites", gVarArr);
        if (!this.f1121a) {
            throw new IllegalArgumentException("no cipher suites for cleartext connections");
        }
        ArrayList arrayList = new ArrayList(gVarArr.length);
        for (g gVar : gVarArr) {
            arrayList.add(gVar.f1120a);
        }
        Object[] array = arrayList.toArray(new String[0]);
        if (array == null) {
            throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
        }
        String[] strArr = (String[]) array;
        c((String[]) Arrays.copyOf(strArr, strArr.length));
    }

    public void c(String... strArr) {
        AbstractC0983h.e("cipherSuites", strArr);
        if (!this.f1121a) {
            throw new IllegalArgumentException("no cipher suites for cleartext connections");
        }
        if (strArr.length == 0) {
            throw new IllegalArgumentException("At least one cipher suite is required");
        }
        this.f1123c = (String[]) strArr.clone();
    }

    public void d(y... yVarArr) {
        if (!this.f1121a) {
            throw new IllegalArgumentException("no TLS versions for cleartext connections");
        }
        ArrayList arrayList = new ArrayList(yVarArr.length);
        for (y yVar : yVarArr) {
            arrayList.add(yVar.f1244k);
        }
        Object[] array = arrayList.toArray(new String[0]);
        if (array == null) {
            throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
        }
        String[] strArr = (String[]) array;
        e((String[]) Arrays.copyOf(strArr, strArr.length));
    }

    /* JADX WARN: Type inference failed for: r2v4, types: [java.io.Serializable, java.lang.String[]] */
    public void e(String... strArr) {
        AbstractC0983h.e("tlsVersions", strArr);
        if (!this.f1121a) {
            throw new IllegalArgumentException("no TLS versions for cleartext connections");
        }
        if (strArr.length == 0) {
            throw new IllegalArgumentException("At least one TLS version is required");
        }
        this.f1124d = (String[]) strArr.clone();
    }
}
