package defpackage;

import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0005\u001a\u00020\u0004*\u000e\u0012\u0004\u0012\u00020\u0001\u0012\u0004\u0012\u00020\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0005\u0010\u0006"}, d2 = {"Lj77;", "Ltd4;", "Lua4;", "it", "Le6a;", "<anonymous>", "(Lj77;Ltd4;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "io.ktor.client.plugins.api.TransformResponseBodyHook$install$1", f = "KtorCallContexts.kt", i = {0, 0}, l = {105, 112}, m = "invokeSuspend", n = {"$this$intercept", "typeInfo"}, s = {"L$0", "L$1"})
final class ct9 extends SuspendLambda implements ir3<j77<td4, ua4>, td4, Continuation<? super e6a>, Object> {
    public fz9 a;
    public int b;
    public /* synthetic */ j77 c;
    public final /* synthetic */ mr3 d;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ct9(mr3 mr3Var, Continuation continuation) {
        super(3, continuation);
        this.d = mr3Var;
    }

    @Override // defpackage.ir3
    public final Object invoke(Object obj, Object obj2, Object obj3) {
        ct9 ct9Var = new ct9(this.d, (Continuation) obj3);
        ct9Var.c = (j77) obj;
        return ct9Var.invokeSuspend(e6a.a);
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        ct9 ct9Var;
        j77 j77Var;
        fz9 fz9Var;
        ck1 ck1Var = ck1.a;
        int i = this.b;
        e6a e6aVar = e6a.a;
        if (i == 0) {
            s38.b(obj);
            j77 j77Var2 = this.c;
            td4 td4Var = (td4) j77Var2.getD();
            fz9 fz9Var2 = td4Var.a;
            Object obj2 = td4Var.b;
            if (!(obj2 instanceof bn0)) {
                return e6aVar;
            }
            bt9 bt9Var = new bt9();
            rd4 rd4VarG = ((ua4) j77Var2.a).g();
            this.c = j77Var2;
            this.a = fz9Var2;
            this.b = 1;
            ct9Var = this;
            Object objInvoke = this.d.invoke(bt9Var, rd4VarG, obj2, fz9Var2, ct9Var);
            if (objInvoke != ck1Var) {
                j77Var = j77Var2;
                obj = objInvoke;
                fz9Var = fz9Var2;
            }
            return ck1Var;
        }
        if (i != 1) {
            if (i != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            s38.b(obj);
            return e6aVar;
        }
        fz9Var = this.a;
        j77Var = this.c;
        s38.b(obj);
        ct9Var = this;
        if (obj != null) {
            if (!(obj instanceof gq6) && !fz9Var.a.isInstance(obj)) {
                throw new IllegalStateException("transformResponseBody returned " + obj + " but expected value of type " + fz9Var);
            }
            td4 td4Var2 = new td4(fz9Var, obj);
            ct9Var.c = null;
            ct9Var.a = null;
            ct9Var.b = 2;
            if (j77Var.h(td4Var2, this) == ck1Var) {
                return ck1Var;
            }
        }
        return e6aVar;
    }
}
