package defpackage;

import j$.util.DesugarCollections;
import j$.util.DesugarTimeZone;
import java.io.InterruptedIOException;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;

/* JADX INFO: renamed from: ˉˎᵴ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC1190 {

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static final TimeZone f5068 = DesugarTimeZone.getTimeZone("GMT");

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static final String f5067 = AbstractC3801.m8479(AbstractC3801.m8474(C3423.class.getName(), "okhttp3."), "Client");

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static final void m3664(Socket socket) {
        try {
            socket.close();
        } catch (AssertionError e) {
            throw e;
        } catch (RuntimeException e2) {
            if (!ᵥˈᵛ.ˊᵫᵗ(e2.getMessage(), "bio == null")) {
                throw e2;
            }
        } catch (Exception unused) {
        }
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public static final String m3665(C1695 c1695, boolean z) {
        int i = c1695.f6697;
        String str = c1695.f6700;
        if (AbstractC3801.m8469(str, ":", false)) {
            str = "[" + str + ']';
        }
        if (!z) {
            String str2 = c1695.f6698;
            if (i == (str2.equals("http") ? 80 : str2.equals("https") ? 443 : -1)) {
                return str;
            }
        }
        return str + ':' + i;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public static final String m3666(String str, Object... objArr) {
        Locale locale = Locale.US;
        Object[] objArrCopyOf = Arrays.copyOf(objArr, objArr.length);
        return String.format(locale, str, Arrays.copyOf(objArrCopyOf, objArrCopyOf.length));
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public static final Charset m3667(InterfaceC2322 interfaceC2322, Charset charset) {
        int iMo5348 = interfaceC2322.mo5348(AbstractC1701.f6715);
        if (iMo5348 == -1) {
            return charset;
        }
        if (iMo5348 == 0) {
            return AbstractC4490.f17115;
        }
        if (iMo5348 == 1) {
            return AbstractC4490.f17112;
        }
        if (iMo5348 == 2) {
            Charset charset2 = AbstractC4490.f17115;
            Charset charset3 = AbstractC4490.f17114;
            if (charset3 != null) {
                return charset3;
            }
            Charset charsetForName = Charset.forName("UTF-32LE");
            AbstractC4490.f17114 = charsetForName;
            return charsetForName;
        }
        if (iMo5348 == 3) {
            return AbstractC4490.f17113;
        }
        if (iMo5348 != 4) {
            throw new AssertionError();
        }
        Charset charset4 = AbstractC4490.f17115;
        Charset charset5 = AbstractC4490.f17117;
        if (charset5 != null) {
            return charset5;
        }
        Charset charsetForName2 = Charset.forName("UTF-32BE");
        AbstractC4490.f17117 = charsetForName2;
        return charsetForName2;
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public static final List m3668(Object[] objArr) {
        return (objArr == null || objArr.length == 0) ? C2808.f10794 : objArr.length == 1 ? Collections.singletonList(objArr[0]) : DesugarCollections.unmodifiableList(Arrays.asList((Object[]) objArr.clone()));
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static final boolean m3669(C1695 c1695, C1695 c16952) {
        return ᵥˈᵛ.ˊᵫᵗ(c1695.f6700, c16952.f6700) && c1695.f6697 == c16952.f6697 && ᵥˈᵛ.ˊᵫᵗ(c1695.f6698, c16952.f6698);
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public static final C0661 m3670(List list) {
        ArrayList arrayList = new ArrayList(20);
        Iterator it = list.iterator();
        while (it.hasNext()) {
            C5511 c5511 = (C5511) it.next();
            C1054 c1054 = c5511.f20817;
            C1054 c10542 = c5511.f20815;
            String strM3463 = c1054.m3463();
            String strM34632 = c10542.m3463();
            arrayList.add(strM3463);
            arrayList.add(AbstractC3801.m8464(strM34632).toString());
        }
        return new C0661((String[]) arrayList.toArray(new String[0]));
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public static final long m3671(C1120 c1120) {
        String strM2425 = c1120.f4792.m2425("Content-Length");
        if (strM2425 == null) {
            return -1L;
        }
        byte[] bArr = AbstractC1701.f6716;
        try {
            return Long.parseLong(strM2425);
        } catch (NumberFormatException unused) {
            return -1L;
        }
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public static final List m3672(List list) {
        return list.isEmpty() ? C2808.f10794 : list.size() == 1 ? Collections.singletonList(list.get(0)) : DesugarCollections.unmodifiableList(Arrays.asList(list.toArray()));
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public static final boolean m3673(InterfaceC3906 interfaceC3906, int i) {
        long jNanoTime = System.nanoTime();
        long jMo5523 = interfaceC3906.mo1491().mo5524() ? interfaceC3906.mo1491().mo5523() - jNanoTime : Long.MAX_VALUE;
        interfaceC3906.mo1491().mo3056(Math.min(jMo5523, TimeUnit.MILLISECONDS.toNanos(i)) + jNanoTime);
        try {
            C4903 c4903 = new C4903();
            while (interfaceC3906.mo1490(c4903, 8192L) != -1) {
                c4903.m10199();
            }
            if (jMo5523 == Long.MAX_VALUE) {
                interfaceC3906.mo1491().mo5525();
                return true;
            }
            interfaceC3906.mo1491().mo3056(jNanoTime + jMo5523);
            return true;
        } catch (InterruptedIOException unused) {
            if (jMo5523 == Long.MAX_VALUE) {
                interfaceC3906.mo1491().mo5525();
                return false;
            }
            interfaceC3906.mo1491().mo3056(jNanoTime + jMo5523);
            return false;
        } catch (Throwable th) {
            if (jMo5523 == Long.MAX_VALUE) {
                interfaceC3906.mo1491().mo5525();
            } else {
                interfaceC3906.mo1491().mo3056(jNanoTime + jMo5523);
            }
            throw th;
        }
    }
}
