package defpackage;

import androidx.media3.container.NalUnitUtil;
import defpackage.fx4;
import java.util.concurrent.CancellationException;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugProbesKt;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0002\n\u0000¨\u0006\u0000"}, d2 = {"kotlinx-coroutines-core"}, k = 2, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class bk1 {
    public static final ng1 a(gj1 gj1Var) {
        if (gj1Var.cb(fx4.b.a) == null) {
            gj1Var = gj1Var.bx(kx4.a());
        }
        return new ng1(gj1Var);
    }

    public static final void b(ak1 ak1Var, CancellationException cancellationException) {
        fx4 fx4Var = (fx4) ak1Var.getB().cb(fx4.b.a);
        if (fx4Var != null) {
            fx4Var.h(cancellationException);
        } else {
            throw new IllegalStateException(("Scope cannot be cancelled because it does not have a job: " + ak1Var).toString());
        }
    }

    public static final Object c(gr3 gr3Var, Continuation continuation) {
        ic8 ic8Var = new ic8(continuation, continuation.getB());
        Object objA = s5a.a(ic8Var, ic8Var, gr3Var);
        if (objA == ck1.a) {
            DebugProbesKt.probeCoroutineSuspended(continuation);
        }
        return objA;
    }

    public static final boolean d(ak1 ak1Var) {
        fx4 fx4Var = (fx4) ak1Var.getB().cb(fx4.b.a);
        if (fx4Var != null) {
            return fx4Var.isActive();
        }
        return true;
    }
}
