package p447.p448.p455;

import java.io.Closeable;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.Socket;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import okhttp3.internal.http2.ConnectionShutdownException;
import p138.p139.p143.p144.C2803;
import p402.C6549;
import p402.InterfaceC6540;
import p402.p411.p412.InterfaceC6603;
import p402.p411.p413.C6635;
import p402.p411.p413.C6645;
import p402.p411.p413.C6646;
import p447.p448.C6943;
import p447.p448.p451.AbstractC6950;
import p447.p448.p451.C6952;
import p447.p448.p451.C6953;
import p447.p448.p455.C7032;
import p447.p448.p457.C7069;
import p461.C7103;
import p461.C7108;
import p461.InterfaceC7106;
import p461.InterfaceC7107;

/* JADX INFO: renamed from: ސ.ޣ.އ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@InterfaceC6540
public final class C7011 implements Closeable {

    /* JADX INFO: renamed from: ޟ, reason: contains not printable characters */
    public static final C7048 f20416;

    /* JADX INFO: renamed from: ޠ, reason: contains not printable characters */
    public static final C7014 f20417 = new C7014(null);

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final boolean f20418;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final AbstractC7015 f20419;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final Map<Integer, C7036> f20420;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final String f20421;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public int f20422;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public int f20423;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public boolean f20424;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final C6953 f20425;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final C6952 f20426;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final C6952 f20427;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final C6952 f20428;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public final InterfaceC7045 f20429;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public long f20430;

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public long f20431;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public long f20432;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public long f20433;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public long f20434;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public long f20435;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public final C7048 f20436;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public C7048 f20437;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public long f20438;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public long f20439;

    /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
    public long f20440;

    /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
    public long f20441;

    /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
    public final Socket f20442;

    /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
    public final C7041 f20443;

    /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
    public final C7018 f20444;

    /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
    public final Set<Integer> f20445;

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$֏, reason: contains not printable characters */
    public static final class C7012 extends AbstractC6950 {

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final /* synthetic */ C7011 f20446;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final /* synthetic */ long f20447;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C7012(String str, String str2, C7011 c7011, long j) {
            super(str2, false, 2, null);
            this.f20446 = c7011;
            this.f20447 = j;
        }

        @Override // p447.p448.p451.AbstractC6950
        /* JADX INFO: renamed from: ֏ */
        public long mo10183() {
            boolean z;
            synchronized (this.f20446) {
                if (this.f20446.f20431 < this.f20446.f20430) {
                    z = true;
                } else {
                    this.f20446.f20430++;
                    z = false;
                }
            }
            if (z) {
                C7011.m10295(this.f20446, (IOException) null);
                return -1L;
            }
            this.f20446.m10305(false, 1, 0);
            return this.f20447;
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ؠ, reason: contains not printable characters */
    public static final class C7013 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public Socket f20448;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public String f20449;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public InterfaceC7107 f20450;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public InterfaceC7106 f20451;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public AbstractC7015 f20452;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public InterfaceC7045 f20453;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public int f20454;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public boolean f20455;

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public final C6953 f20456;

        public C7013(boolean z, C6953 c6953) {
            if (c6953 == null) {
                C6635.m9824("taskRunner");
                throw null;
            }
            this.f20455 = z;
            this.f20456 = c6953;
            this.f20452 = AbstractC7015.f20457;
            this.f20453 = InterfaceC7045.f20552;
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ހ, reason: contains not printable characters */
    public static final class C7014 {
        public C7014() {
        }

        public /* synthetic */ C7014(DefaultConstructorMarker defaultConstructorMarker) {
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ށ, reason: contains not printable characters */
    @InterfaceC6540
    public static abstract class AbstractC7015 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public static final AbstractC7015 f20457;

        /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ށ$֏, reason: contains not printable characters */
        public static final class C7016 extends AbstractC7015 {
            @Override // p447.p448.p455.C7011.AbstractC7015
            /* JADX INFO: renamed from: ֏ */
            public void mo10234(C7036 c7036) {
                if (c7036 != null) {
                    c7036.m10329(EnumC7003.REFUSED_STREAM, (IOException) null);
                } else {
                    C6635.m9824("stream");
                    throw null;
                }
            }
        }

        /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ށ$ؠ, reason: contains not printable characters */
        public static final class C7017 {
            public C7017() {
            }

            public /* synthetic */ C7017(DefaultConstructorMarker defaultConstructorMarker) {
            }
        }

        static {
            new C7017(null);
            f20457 = new C7016();
        }

        /* JADX INFO: renamed from: ֏ */
        public void mo10233(C7011 c7011, C7048 c7048) {
            if (c7011 == null) {
                C6635.m9824("connection");
                throw null;
            }
            if (c7048 != null) {
                return;
            }
            C6635.m9824("settings");
            throw null;
        }

        /* JADX INFO: renamed from: ֏ */
        public abstract void mo10234(C7036 c7036);
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ނ, reason: contains not printable characters */
    @InterfaceC6540
    public final class C7018 implements C7032.InterfaceC7035, InterfaceC6603<C6549> {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final C7032 f20458;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final /* synthetic */ C7011 f20459;

        /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ނ$֏, reason: contains not printable characters */
        public static final class C7019 extends AbstractC6950 {

            /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
            public final /* synthetic */ C7018 f20460;

            /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
            public final /* synthetic */ C6646 f20461;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C7019(String str, boolean z, String str2, boolean z2, C7018 c7018, boolean z3, C6646 c6646, C7048 c7048, C6645 c6645, C6646 c66462) {
                super(str2, z2);
                this.f20460 = c7018;
                this.f20461 = c6646;
            }

            /* JADX WARN: Multi-variable type inference failed */
            @Override // p447.p448.p451.AbstractC6950
            /* JADX INFO: renamed from: ֏ */
            public long mo10183() {
                C7011 c7011 = this.f20460.f20459;
                c7011.f20419.mo10233(c7011, (C7048) this.f20461.f19405);
                return -1L;
            }
        }

        /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ނ$ؠ, reason: contains not printable characters */
        public static final class C7020 extends AbstractC6950 {

            /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
            public final /* synthetic */ C7036 f20462;

            /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
            public final /* synthetic */ C7018 f20463;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C7020(String str, boolean z, String str2, boolean z2, C7036 c7036, C7018 c7018, C7036 c70362, int i, List list, boolean z3) {
                super(str2, z2);
                this.f20462 = c7036;
                this.f20463 = c7018;
            }

            @Override // p447.p448.p451.AbstractC6950
            /* JADX INFO: renamed from: ֏ */
            public long mo10183() {
                try {
                    this.f20463.f20459.f20419.mo10234(this.f20462);
                    return -1L;
                } catch (IOException e) {
                    if (C7069.f20588 == null) {
                        throw null;
                    }
                    C7069 c7069 = C7069.f20586;
                    StringBuilder sbM4889 = C2803.m4889("Http2Connection.Listener failure for ");
                    sbM4889.append(this.f20463.f20459.f20421);
                    c7069.m10381(sbM4889.toString(), 4, e);
                    try {
                        this.f20462.m10329(EnumC7003.PROTOCOL_ERROR, e);
                        return -1L;
                    } catch (IOException unused) {
                        return -1L;
                    }
                }
            }
        }

        /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ނ$ހ, reason: contains not printable characters */
        public static final class C7021 extends AbstractC6950 {

            /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
            public final /* synthetic */ C7018 f20464;

            /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
            public final /* synthetic */ int f20465;

            /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
            public final /* synthetic */ int f20466;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C7021(String str, boolean z, String str2, boolean z2, C7018 c7018, int i, int i2) {
                super(str2, z2);
                this.f20464 = c7018;
                this.f20465 = i;
                this.f20466 = i2;
            }

            @Override // p447.p448.p451.AbstractC6950
            /* JADX INFO: renamed from: ֏ */
            public long mo10183() {
                this.f20464.f20459.m10305(true, this.f20465, this.f20466);
                return -1L;
            }
        }

        /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ނ$ށ, reason: contains not printable characters */
        public static final class C7022 extends AbstractC6950 {

            /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
            public final /* synthetic */ C7018 f20467;

            /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
            public final /* synthetic */ boolean f20468;

            /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
            public final /* synthetic */ C7048 f20469;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            public C7022(String str, boolean z, String str2, boolean z2, C7018 c7018, boolean z3, C7048 c7048) {
                super(str2, z2);
                this.f20467 = c7018;
                this.f20468 = z3;
                this.f20469 = c7048;
            }

            @Override // p447.p448.p451.AbstractC6950
            /* JADX INFO: renamed from: ֏ */
            public long mo10183() throws Throwable {
                this.f20467.m10320(this.f20468, this.f20469);
                return -1L;
            }
        }

        public C7018(C7011 c7011, C7032 c7032) {
            if (c7032 == null) {
                C6635.m9824("reader");
                throw null;
            }
            this.f20459 = c7011;
            this.f20458 = c7032;
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10310() {
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10311(int i, int i2, int i3, boolean z) {
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10312(int i, int i2, List<C7005> list) {
            if (list != null) {
                this.f20459.m10300(i2, list);
            } else {
                C6635.m9824("requestHeaders");
                throw null;
            }
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10313(int i, long j) {
            if (i != 0) {
                C7036 c7036M10296 = this.f20459.m10296(i);
                if (c7036M10296 != null) {
                    synchronized (c7036M10296) {
                        c7036M10296.f20516 += j;
                        if (j > 0) {
                            c7036M10296.notifyAll();
                        }
                    }
                    return;
                }
                return;
            }
            synchronized (this.f20459) {
                this.f20459.f20441 += j;
                C7011 c7011 = this.f20459;
                if (c7011 == null) {
                    throw new TypeCastException("null cannot be cast to non-null type java.lang.Object");
                }
                c7011.notifyAll();
            }
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10314(int i, EnumC7003 enumC7003) {
            if (enumC7003 == null) {
                C6635.m9824("errorCode");
                throw null;
            }
            if (!this.f20459.m10306(i)) {
                C7036 c7036M10307 = this.f20459.m10307(i);
                if (c7036M10307 != null) {
                    c7036M10307.m10331(enumC7003);
                    return;
                }
                return;
            }
            C7011 c7011 = this.f20459;
            C6952 c6952 = c7011.f20427;
            String str = c7011.f20421 + '[' + i + "] onReset";
            c6952.m10185(new C7029(str, true, str, true, c7011, i, enumC7003), 0L);
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10315(int i, EnumC7003 enumC7003, C7108 c7108) {
            int i2;
            C7036[] c7036Arr;
            if (enumC7003 == null) {
                C6635.m9824("errorCode");
                throw null;
            }
            if (c7108 == null) {
                C6635.m9824("debugData");
                throw null;
            }
            c7108.mo10450();
            synchronized (this.f20459) {
                Object[] array = this.f20459.f20420.values().toArray(new C7036[0]);
                if (array == null) {
                    throw new TypeCastException("null cannot be cast to non-null type kotlin.Array<T>");
                }
                c7036Arr = (C7036[]) array;
                this.f20459.f20424 = true;
            }
            for (C7036 c7036 : c7036Arr) {
                if (c7036.f20525 > i && c7036.m10335()) {
                    c7036.m10331(EnumC7003.REFUSED_STREAM);
                    this.f20459.m10307(c7036.f20525);
                }
            }
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10316(boolean z, int i, int i2) {
            if (!z) {
                C6952 c6952 = this.f20459.f20426;
                String strM4884 = C2803.m4884(new StringBuilder(), this.f20459.f20421, " ping");
                c6952.m10185(new C7021(strM4884, true, strM4884, true, this, i, i2), 0L);
                return;
            }
            synchronized (this.f20459) {
                if (i == 1) {
                    this.f20459.f20431++;
                } else if (i == 2) {
                    this.f20459.f20433++;
                } else if (i == 3) {
                    this.f20459.f20434++;
                    C7011 c7011 = this.f20459;
                    if (c7011 == null) {
                        throw new TypeCastException("null cannot be cast to non-null type java.lang.Object");
                    }
                    c7011.notifyAll();
                }
            }
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10317(boolean z, int i, int i2, List<C7005> list) {
            if (list == null) {
                C6635.m9824("headerBlock");
                throw null;
            }
            if (this.f20459.m10306(i)) {
                C7011 c7011 = this.f20459;
                C6952 c6952 = c7011.f20427;
                String str = c7011.f20421 + '[' + i + "] onHeaders";
                c6952.m10185(new C7028(str, true, str, true, c7011, i, list, z), 0L);
                return;
            }
            synchronized (this.f20459) {
                C7036 c7036M10296 = this.f20459.m10296(i);
                if (c7036M10296 != null) {
                    c7036M10296.m10327(C6943.m10162(list), z);
                    return;
                }
                if (this.f20459.f20424) {
                    return;
                }
                if (i <= this.f20459.f20422) {
                    return;
                }
                if (i % 2 == this.f20459.f20423 % 2) {
                    return;
                }
                C7036 c7036 = new C7036(i, this.f20459, false, z, C6943.m10162(list));
                this.f20459.f20422 = i;
                this.f20459.f20420.put(Integer.valueOf(i), c7036);
                C6952 c6952M10194 = this.f20459.f20425.m10194();
                String str2 = this.f20459.f20421 + '[' + i + "] onStream";
                c6952M10194.m10185(new C7020(str2, true, str2, true, c7036, this, c7036M10296, i, list, z), 0L);
            }
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10318(boolean z, int i, InterfaceC7107 interfaceC7107, int i2) {
            if (interfaceC7107 == null) {
                C6635.m9824("source");
                throw null;
            }
            if (this.f20459.m10306(i)) {
                C7011 c7011 = this.f20459;
                if (c7011 == null) {
                    throw null;
                }
                C7103 c7103 = new C7103();
                long j = i2;
                interfaceC7107.mo10431(j);
                interfaceC7107.mo10207(c7103, j);
                C6952 c6952 = c7011.f20427;
                String str = c7011.f20421 + '[' + i + "] onData";
                c6952.m10185(new C7027(str, true, str, true, c7011, i, c7103, i2, z), 0L);
                return;
            }
            C7036 c7036M10296 = this.f20459.m10296(i);
            if (c7036M10296 == null) {
                this.f20459.m10301(i, EnumC7003.PROTOCOL_ERROR);
                long j2 = i2;
                this.f20459.m10309(j2);
                interfaceC7107.skip(j2);
                return;
            }
            if (!C6943.f20196 || !Thread.holdsLock(c7036M10296)) {
                c7036M10296.f20519.m10340(interfaceC7107, i2);
                if (z) {
                    c7036M10296.m10327(C6943.f20191, true);
                    return;
                }
                return;
            }
            StringBuilder sbM4889 = C2803.m4889("Thread ");
            Thread threadCurrentThread = Thread.currentThread();
            C6635.m9823((Object) threadCurrentThread, "Thread.currentThread()");
            sbM4889.append(threadCurrentThread.getName());
            sbM4889.append(" MUST NOT hold lock on ");
            sbM4889.append(c7036M10296);
            throw new AssertionError(sbM4889.toString());
        }

        @Override // p447.p448.p455.C7032.InterfaceC7035
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo10319(boolean z, C7048 c7048) {
            if (c7048 == null) {
                C6635.m9824("settings");
                throw null;
            }
            C6952 c6952 = this.f20459.f20426;
            String strM4884 = C2803.m4884(new StringBuilder(), this.f20459.f20421, " applyAndAckSettings");
            c6952.m10185(new C7022(strM4884, true, strM4884, true, this, z, c7048), 0L);
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r2v0, types: [T, ސ.ޣ.އ.ތ] */
        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final void m10320(boolean z, C7048 c7048) throws Throwable {
            C7041 c7041;
            T t;
            if (c7048 == 0) {
                C6635.m9824("settings");
                throw null;
            }
            C6645 c6645 = new C6645();
            C6646 c6646 = new C6646();
            C6646 c66462 = new C6646();
            C7041 c70412 = this.f20459.f20443;
            synchronized (c70412) {
                try {
                    try {
                        synchronized (this.f20459) {
                            try {
                                C7048 c70482 = this.f20459.f20437;
                                if (z) {
                                    c66462.f19405 = c7048;
                                } else {
                                    ?? c70483 = new C7048();
                                    c70483.m10363(c70482);
                                    c70483.m10363(c7048);
                                    c66462.f19405 = c70483;
                                }
                                long jM10361 = ((long) ((C7048) c66462.f19405).m10361()) - ((long) c70482.m10361());
                                c6645.f19404 = jM10361;
                                if (jM10361 == 0 || this.f20459.f20420.isEmpty()) {
                                    t = 0;
                                } else {
                                    Object[] array = this.f20459.f20420.values().toArray(new C7036[0]);
                                    if (array == null) {
                                        throw new TypeCastException("null cannot be cast to non-null type kotlin.Array<T>");
                                    }
                                    t = (C7036[]) array;
                                }
                                c6646.f19405 = t;
                                C7011 c7011 = this.f20459;
                                C7048 c70484 = (C7048) c66462.f19405;
                                try {
                                    if (c70484 == null) {
                                        C6635.m9824("<set-?>");
                                        throw null;
                                    }
                                    c7011.f20437 = c70484;
                                    C6952 c6952 = this.f20459.f20428;
                                    String str = this.f20459.f20421 + " onSettings";
                                    c7041 = c70412;
                                    c6952.m10185(new C7019(str, true, str, true, this, z, c66462, c7048, c6645, c6646), 0L);
                                    try {
                                        this.f20459.f20443.m10350((C7048) c66462.f19405);
                                    } catch (IOException e) {
                                        C7011.m10295(this.f20459, e);
                                    }
                                    C7036[] c7036Arr = (C7036[]) c6646.f19405;
                                    if (c7036Arr != null) {
                                        if (c7036Arr == null) {
                                            C6635.m9822();
                                            throw null;
                                        }
                                        for (C7036 c7036 : c7036Arr) {
                                            synchronized (c7036) {
                                                long j = c6645.f19404;
                                                c7036.f20516 += j;
                                                if (j > 0) {
                                                    c7036.notifyAll();
                                                }
                                            }
                                        }
                                    }
                                } catch (Throwable th) {
                                    th = th;
                                    throw th;
                                }
                            } catch (Throwable th2) {
                                th = th2;
                            }
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        throw th;
                    }
                } catch (Throwable th4) {
                    th = th4;
                    c7041 = c70412;
                }
            }
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r0v0, types: [ސ.ޣ.އ.֏] */
        /* JADX WARN: Type inference failed for: r0v3 */
        /* JADX WARN: Type inference failed for: r0v7, types: [ގ.ވ] */
        /* JADX WARN: Type inference fix 'apply assigned field type' failed
        java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$UnknownArg
        	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
        	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
        	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
        	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
        	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
        	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
        	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
         */
        @Override // p402.p411.p412.InterfaceC6603
        /* JADX INFO: renamed from: ނ */
        public C6549 mo1543() throws Throwable {
            Throwable th;
            EnumC7003 enumC7003;
            EnumC7003 enumC70032;
            EnumC7003 enumC70033 = EnumC7003.INTERNAL_ERROR;
            IOException e = null;
            try {
                try {
                    this.f20458.m10322(this);
                    while (this.f20458.m10324(false, (C7032.InterfaceC7035) this)) {
                    }
                    EnumC7003 enumC70034 = EnumC7003.NO_ERROR;
                    try {
                        enumC70032 = EnumC7003.CANCEL;
                        enumC7003 = enumC70034;
                    } catch (IOException e2) {
                        e = e2;
                        EnumC7003 enumC70035 = EnumC7003.PROTOCOL_ERROR;
                        enumC70032 = EnumC7003.PROTOCOL_ERROR;
                        enumC7003 = enumC70035;
                    }
                } catch (Throwable th2) {
                    th = th2;
                    this.f20459.m10304(enumC7003, enumC70033, e);
                    C6943.m10164(this.f20458);
                    throw th;
                }
            } catch (IOException e3) {
                e = e3;
            } catch (Throwable th3) {
                th = th3;
                enumC7003 = enumC70033;
                this.f20459.m10304(enumC7003, enumC70033, e);
                C6943.m10164(this.f20458);
                throw th;
            }
            this.f20459.m10304(enumC7003, enumC70032, e);
            C6943.m10164(this.f20458);
            enumC70033 = C6549.f19328;
            return enumC70033;
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ރ, reason: contains not printable characters */
    public static final class C7023 extends AbstractC6950 {

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final /* synthetic */ C7011 f20470;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final /* synthetic */ int f20471;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final /* synthetic */ List f20472;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C7023(String str, boolean z, String str2, boolean z2, C7011 c7011, int i, List list) {
            super(str2, z2);
            this.f20470 = c7011;
            this.f20471 = i;
            this.f20472 = list;
        }

        @Override // p447.p448.p451.AbstractC6950
        /* JADX INFO: renamed from: ֏ */
        public long mo10183() {
            if (!this.f20470.f20429.mo10358(this.f20471, this.f20472)) {
                return -1L;
            }
            try {
                this.f20470.f20443.m10348(this.f20471, EnumC7003.CANCEL);
                synchronized (this.f20470) {
                    this.f20470.f20445.remove(Integer.valueOf(this.f20471));
                }
                return -1L;
            } catch (IOException unused) {
                return -1L;
            }
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ބ, reason: contains not printable characters */
    public static final class C7024 extends AbstractC6950 {

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final /* synthetic */ C7011 f20473;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C7024(String str, boolean z, String str2, boolean z2, C7011 c7011) {
            super(str2, z2);
            this.f20473 = c7011;
        }

        @Override // p447.p448.p451.AbstractC6950
        /* JADX INFO: renamed from: ֏ */
        public long mo10183() {
            this.f20473.m10305(false, 2, 0);
            return -1L;
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ޅ, reason: contains not printable characters */
    public static final class C7025 extends AbstractC6950 {

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final /* synthetic */ C7011 f20474;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final /* synthetic */ int f20475;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final /* synthetic */ EnumC7003 f20476;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C7025(String str, boolean z, String str2, boolean z2, C7011 c7011, int i, EnumC7003 enumC7003) {
            super(str2, z2);
            this.f20474 = c7011;
            this.f20475 = i;
            this.f20476 = enumC7003;
        }

        @Override // p447.p448.p451.AbstractC6950
        /* JADX INFO: renamed from: ֏ */
        public long mo10183() {
            try {
                C7011 c7011 = this.f20474;
                int i = this.f20475;
                EnumC7003 enumC7003 = this.f20476;
                if (enumC7003 != null) {
                    c7011.f20443.m10348(i, enumC7003);
                    return -1L;
                }
                C6635.m9824("statusCode");
                throw null;
            } catch (IOException e) {
                C7011.m10295(this.f20474, e);
                return -1L;
            }
        }
    }

    /* JADX INFO: renamed from: ސ.ޣ.އ.ނ$ކ, reason: contains not printable characters */
    public static final class C7026 extends AbstractC6950 {

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final /* synthetic */ C7011 f20477;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final /* synthetic */ int f20478;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final /* synthetic */ long f20479;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C7026(String str, boolean z, String str2, boolean z2, C7011 c7011, int i, long j) {
            super(str2, z2);
            this.f20477 = c7011;
            this.f20478 = i;
            this.f20479 = j;
        }

        @Override // p447.p448.p451.AbstractC6950
        /* JADX INFO: renamed from: ֏ */
        public long mo10183() {
            try {
                this.f20477.f20443.m10347(this.f20478, this.f20479);
                return -1L;
            } catch (IOException e) {
                C7011.m10295(this.f20477, e);
                return -1L;
            }
        }
    }

    static {
        C7048 c7048 = new C7048();
        c7048.m10362(7, 65535);
        c7048.m10362(5, 16384);
        f20416 = c7048;
    }

    public C7011(C7013 c7013) {
        if (c7013 == null) {
            C6635.m9824("builder");
            throw null;
        }
        this.f20418 = c7013.f20455;
        this.f20419 = c7013.f20452;
        this.f20420 = new LinkedHashMap();
        String str = c7013.f20449;
        if (str == null) {
            C6635.m9826("connectionName");
            throw null;
        }
        this.f20421 = str;
        this.f20423 = c7013.f20455 ? 3 : 2;
        C6953 c6953 = c7013.f20456;
        this.f20425 = c6953;
        this.f20426 = c6953.m10194();
        this.f20427 = this.f20425.m10194();
        this.f20428 = this.f20425.m10194();
        this.f20429 = c7013.f20453;
        C7048 c7048 = new C7048();
        if (c7013.f20455) {
            c7048.m10362(7, 16777216);
        }
        this.f20436 = c7048;
        this.f20437 = f20416;
        this.f20441 = r1.m10361();
        Socket socket = c7013.f20448;
        if (socket == null) {
            C6635.m9826("socket");
            throw null;
        }
        this.f20442 = socket;
        InterfaceC7106 interfaceC7106 = c7013.f20451;
        if (interfaceC7106 == null) {
            C6635.m9826("sink");
            throw null;
        }
        this.f20443 = new C7041(interfaceC7106, this.f20418);
        InterfaceC7107 interfaceC7107 = c7013.f20450;
        if (interfaceC7107 == null) {
            C6635.m9826("source");
            throw null;
        }
        this.f20444 = new C7018(this, new C7032(interfaceC7107, this.f20418));
        this.f20445 = new LinkedHashSet();
        int i = c7013.f20454;
        if (i != 0) {
            long nanos = TimeUnit.MILLISECONDS.toNanos(i);
            C6952 c6952 = this.f20426;
            String strM4884 = C2803.m4884(new StringBuilder(), this.f20421, " ping");
            c6952.m10185(new C7012(strM4884, strM4884, this, nanos), nanos);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final /* synthetic */ void m10295(C7011 c7011, IOException iOException) {
        if (c7011 == null) {
            throw null;
        }
        EnumC7003 enumC7003 = EnumC7003.PROTOCOL_ERROR;
        c7011.m10304(enumC7003, enumC7003, iOException);
    }

    @Override // java.io.Closeable, java.lang.AutoCloseable
    public void close() {
        m10304(EnumC7003.NO_ERROR, EnumC7003.CANCEL, (IOException) null);
    }

    public final void flush() {
        this.f20443.flush();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final synchronized C7036 m10296(int i) {
        return this.f20420.get(Integer.valueOf(i));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C7036 m10297(int i, List<C7005> list, boolean z) {
        int i2;
        C7036 c7036;
        boolean z2;
        boolean z3 = !z;
        synchronized (this.f20443) {
            synchronized (this) {
                try {
                    if (this.f20423 > 1073741823) {
                        m10303(EnumC7003.REFUSED_STREAM);
                    }
                    if (this.f20424) {
                        throw new ConnectionShutdownException();
                    }
                    i2 = this.f20423;
                    this.f20423 += 2;
                    c7036 = new C7036(i2, this, z3, false, null);
                    z2 = !z || this.f20440 >= this.f20441 || c7036.f20515 >= c7036.f20516;
                    if (c7036.m10336()) {
                        this.f20420.put(Integer.valueOf(i2), c7036);
                    }
                } finally {
                }
            }
            if (i == 0) {
                this.f20443.m10352(z3, i2, list);
            } else {
                if (!(true ^ this.f20418)) {
                    throw new IllegalArgumentException("client streams shouldn't have associated stream IDs".toString());
                }
                this.f20443.m10346(i, i2, list);
            }
        }
        if (z2) {
            this.f20443.flush();
        }
        return c7036;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10298() {
        synchronized (this) {
            if (this.f20433 < this.f20432) {
                return;
            }
            this.f20432++;
            this.f20435 = System.nanoTime() + ((long) 1000000000);
            C6952 c6952 = this.f20426;
            String strM4884 = C2803.m4884(new StringBuilder(), this.f20421, " ping");
            c6952.m10185(new C7024(strM4884, true, strM4884, true, this), 0L);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10299(int i, long j) {
        C6952 c6952 = this.f20426;
        String str = this.f20421 + '[' + i + "] windowUpdate";
        c6952.m10185(new C7026(str, true, str, true, this, i, j), 0L);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10300(int i, List<C7005> list) {
        if (list == null) {
            C6635.m9824("requestHeaders");
            throw null;
        }
        synchronized (this) {
            if (this.f20445.contains(Integer.valueOf(i))) {
                m10301(i, EnumC7003.PROTOCOL_ERROR);
                return;
            }
            this.f20445.add(Integer.valueOf(i));
            C6952 c6952 = this.f20427;
            String str = this.f20421 + '[' + i + "] onRequest";
            c6952.m10185(new C7023(str, true, str, true, this, i, list), 0L);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10301(int i, EnumC7003 enumC7003) {
        if (enumC7003 == null) {
            C6635.m9824("errorCode");
            throw null;
        }
        C6952 c6952 = this.f20426;
        String str = this.f20421 + '[' + i + "] writeSynReset";
        c6952.m10185(new C7025(str, true, str, true, this, i, enumC7003), 0L);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10302(int i, boolean z, C7103 c7103, long j) {
        int iMin;
        if (j == 0) {
            this.f20443.m10353(z, i, c7103, 0);
            return;
        }
        while (j > 0) {
            synchronized (this) {
                while (this.f20440 >= this.f20441) {
                    try {
                        if (!this.f20420.containsKey(Integer.valueOf(i))) {
                            throw new IOException("stream closed");
                        }
                        wait();
                    } catch (InterruptedException unused) {
                        Thread.currentThread().interrupt();
                        throw new InterruptedIOException();
                    }
                }
                iMin = Math.min((int) Math.min(j, this.f20441 - this.f20440), this.f20443.f20540);
                this.f20440 += (long) iMin;
            }
            j -= (long) iMin;
            this.f20443.m10353(z && j == 0, i, c7103, iMin);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10303(EnumC7003 enumC7003) {
        if (enumC7003 == null) {
            C6635.m9824("statusCode");
            throw null;
        }
        synchronized (this.f20443) {
            synchronized (this) {
                if (this.f20424) {
                    return;
                }
                this.f20424 = true;
                this.f20443.m10349(this.f20422, enumC7003, C6943.f20190);
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10304(EnumC7003 enumC7003, EnumC7003 enumC70032, IOException iOException) {
        int i;
        C7036[] c7036Arr = null;
        if (enumC7003 == null) {
            C6635.m9824("connectionCode");
            throw null;
        }
        if (enumC70032 == null) {
            C6635.m9824("streamCode");
            throw null;
        }
        if (C6943.f20196 && Thread.holdsLock(this)) {
            StringBuilder sbM4889 = C2803.m4889("Thread ");
            Thread threadCurrentThread = Thread.currentThread();
            C6635.m9823((Object) threadCurrentThread, "Thread.currentThread()");
            sbM4889.append(threadCurrentThread.getName());
            sbM4889.append(" MUST NOT hold lock on ");
            sbM4889.append(this);
            throw new AssertionError(sbM4889.toString());
        }
        try {
            m10303(enumC7003);
        } catch (IOException unused) {
        }
        synchronized (this) {
            if (!this.f20420.isEmpty()) {
                Object[] array = this.f20420.values().toArray(new C7036[0]);
                if (array == null) {
                    throw new TypeCastException("null cannot be cast to non-null type kotlin.Array<T>");
                }
                c7036Arr = (C7036[]) array;
                this.f20420.clear();
            }
        }
        if (c7036Arr != null) {
            for (C7036 c7036 : c7036Arr) {
                try {
                    c7036.m10329(enumC70032, iOException);
                } catch (IOException unused2) {
                }
            }
        }
        try {
            this.f20443.close();
        } catch (IOException unused3) {
        }
        try {
            this.f20442.close();
        } catch (IOException unused4) {
        }
        this.f20426.m10188();
        this.f20427.m10188();
        this.f20428.m10188();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m10305(boolean z, int i, int i2) {
        try {
            this.f20443.m10351(z, i, i2);
        } catch (IOException e) {
            EnumC7003 enumC7003 = EnumC7003.PROTOCOL_ERROR;
            m10304(enumC7003, enumC7003, e);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final boolean m10306(int i) {
        return i != 0 && (i & 1) == 0;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final synchronized C7036 m10307(int i) {
        C7036 c7036Remove;
        c7036Remove = this.f20420.remove(Integer.valueOf(i));
        notifyAll();
        return c7036Remove;
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final synchronized boolean m10308(long j) {
        if (this.f20424) {
            return false;
        }
        if (this.f20433 < this.f20432) {
            if (j >= this.f20435) {
                return false;
            }
        }
        return true;
    }

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final synchronized void m10309(long j) {
        long j2 = this.f20438 + j;
        this.f20438 = j2;
        long j3 = j2 - this.f20439;
        if (j3 >= this.f20436.m10361() / 2) {
            m10299(0, j3);
            this.f20439 += j3;
        }
    }
}
