package defpackage;

import androidx.media3.container.NalUnitUtil;
import java.util.List;
import kotlin.Metadata;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(k = 3, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@DebugMetadata(c = "kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt", f = "Channels.common.kt", i = {0, 0}, l = {209}, m = "toList", n = {"$this$toList_u24lambda_u242", "$this$consume$iv$iv"}, s = {"L$1", "L$2"})
final class dw0<E> extends ContinuationImpl {
    public List a;
    public List b;
    public bv7 c;
    public lv0 d;
    public /* synthetic */ Object e;
    public int f;

    /* JADX WARN: Multi-variable type inference failed */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        this.e = obj;
        int i = (this.f | Integer.MIN_VALUE) - Integer.MIN_VALUE;
        this.f = i;
        ck1 ck1Var = ck1.a;
        bv7 bv7Var = null;
        if (i == 0) {
            s38.b(obj);
            y41.s();
            try {
                throw null;
            } catch (Throwable th) {
                th = th;
            }
        } else {
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            lv0 lv0Var = this.d;
            bv7 bv7Var2 = this.c;
            List list = this.b;
            List list2 = this.a;
            try {
                s38.b(obj);
                while (((Boolean) obj).booleanValue()) {
                    list.add(lv0Var.next());
                    this.a = list2;
                    this.b = list;
                    this.c = bv7Var2;
                    this.d = lv0Var;
                    this.f = 1;
                    obj = lv0Var.b(this);
                    if (obj == ck1Var) {
                        return ck1Var;
                    }
                }
                bv7Var2.h(null);
                return y41.n(list2);
            } catch (Throwable th2) {
                th = th2;
                bv7Var = bv7Var2;
            }
        }
        try {
            throw th;
        } catch (Throwable th3) {
            yv0.a(bv7Var, th);
            throw th3;
        }
    }
}
