package defpackage;

import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import java.util.ArrayList;
import kotlin.Metadata;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.reflect.KClass;
import kotlin.reflect.KType;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0005\u0018\u00002\u00020\u0001:\u0004\u0002\u0003\u0004\u0005¨\u0006\u0006"}, d2 = {"Lfe4;", "", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "d", "c", "b", "ktor-client-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class fe4 {
    public static final d b = new d();
    public static final dx c;
    public final ArrayList a = new ArrayList();

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0007\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lfe4$a;", "", "ktor-client-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    @f55
    public static final class a {
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lfe4$b;", "Ljg8;", "ktor-client-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class b implements jg8 {
        public final ta4 a;
        public int b;
        public ua4 c;

        public b(ta4 ta4Var) {
            cr4.g(ta4Var, "client");
            this.a = ta4Var;
        }

        /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
        @Override // defpackage.jg8
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Object a(fd4 fd4Var, ContinuationImpl continuationImpl) {
            ge4 ge4Var;
            b bVar;
            if (continuationImpl instanceof ge4) {
                ge4Var = (ge4) continuationImpl;
                int i = ge4Var.d;
                if ((i & Integer.MIN_VALUE) != 0) {
                    ge4Var.d = i - Integer.MIN_VALUE;
                } else {
                    ge4Var = new ge4(this, continuationImpl);
                }
            }
            Object objA = ge4Var.b;
            ck1 ck1Var = ck1.a;
            int i2 = ge4Var.d;
            if (i2 == 0) {
                s38.b(objA);
                ua4 ua4Var = this.c;
                if (ua4Var != null) {
                    bk1.b(ua4Var, null);
                }
                int i3 = this.b;
                if (i3 >= 20) {
                    throw new ig8("Max send count 20 exceeded. Consider increasing the property maxSendCount if more is required.");
                }
                this.b = i3 + 1;
                je4 je4Var = this.a.i;
                Object obj = fd4Var.d;
                ge4Var.a = this;
                ge4Var.d = 1;
                objA = je4Var.a(fd4Var, obj, ge4Var);
                if (objA == ck1Var) {
                    return ck1Var;
                }
                bVar = this;
            } else {
                if (i2 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                bVar = (b) ge4Var.a;
                s38.b(objA);
            }
            ua4 ua4Var2 = objA instanceof ua4 ? (ua4) objA : null;
            if (ua4Var2 != null) {
                bVar.c = ua4Var2;
                return ua4Var2;
            }
            throw new IllegalStateException(("Failed to execute send pipeline. Expected [HttpClientCall], but received " + objA).toString());
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lfe4$c;", "Ljg8;", "ktor-client-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class c implements jg8 {
        public final ir3 a;
        public final jg8 b;

        public c(ir3 ir3Var, jg8 jg8Var) {
            cr4.g(ir3Var, "interceptor");
            this.a = ir3Var;
            this.b = jg8Var;
        }

        @Override // defpackage.jg8
        public final Object a(fd4 fd4Var, ContinuationImpl continuationImpl) {
            return this.a.invoke(this.b, fd4Var, continuationImpl);
        }
    }

    @Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001¨\u0006\u0004"}, d2 = {"Lfe4$d;", "Lrb4;", "Lfe4$a;", "Lfe4;", "ktor-client-core"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class d implements rb4<a, fe4> {
        @Override // defpackage.rb4
        public final Object a(sq3 sq3Var) {
            sq3Var.invoke(new a());
            return new fe4();
        }

        @Override // defpackage.rb4
        public final void b(Object obj, ta4 ta4Var) {
            fe4 fe4Var = (fe4) obj;
            cr4.g(fe4Var, "plugin");
            cr4.g(ta4Var, "scope");
            ta4Var.e.g(md4.k, new he4(fe4Var, ta4Var, null));
        }

        @Override // defpackage.rb4
        /* JADX INFO: renamed from: getKey */
        public final dx getC() {
            return fe4.c;
        }
    }

    static {
        KType kTypeA;
        KClass orCreateKotlinClass = iw7.a.getOrCreateKotlinClass(fe4.class);
        try {
            kTypeA = iw7.a(fe4.class);
        } catch (Throwable unused) {
            kTypeA = null;
        }
        c = new dx("HttpSend", new fz9(orCreateKotlinClass, kTypeA));
    }
}
