package M2;

import androidx.compose.runtime.MutableState;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class Q1 extends C4.j implements J4.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f4519a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ X2.f f4520b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f4521c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ MutableState f4522d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ MutableState f4523e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ MutableState f4524f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ MutableState f4525j;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public Q1(X2.f fVar, int i6, MutableState mutableState, MutableState mutableState2, MutableState mutableState3, MutableState mutableState4, A4.d dVar) {
        super(2, dVar);
        this.f4520b = fVar;
        this.f4521c = i6;
        this.f4522d = mutableState;
        this.f4523e = mutableState2;
        this.f4524f = mutableState3;
        this.f4525j = mutableState4;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new Q1(this.f4520b, this.f4521c, this.f4522d, this.f4523e, this.f4524f, this.f4525j, dVar);
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((Q1) create((V4.C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        B4.a aVar = B4.a.f492a;
        int i6 = this.f4519a;
        MutableState mutableState = this.f4525j;
        try {
            try {
                if (i6 == 0) {
                    AbstractC2467b.l(obj);
                    String str = ((L1) this.f4522d.getValue()) == L1.f4394a ? "movie" : "tv";
                    X2.f fVar = this.f4520b;
                    int i7 = this.f4521c;
                    this.f4519a = 1;
                    fVar.getClass();
                    c5.e eVar = V4.N.f8259a;
                    obj = V4.E.H(c5.d.f13466b, new X2.a(str, i7, fVar, "en", false, null), this);
                    if (obj == aVar) {
                        return aVar;
                    }
                } else {
                    if (i6 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    AbstractC2467b.l(obj);
                }
                this.f4523e.setValue((X2.g) obj);
                this.f4524f.setValue(Integer.valueOf(this.f4521c));
            } catch (Exception e6) {
                a5.c cVar = K2.p.f4116a;
                String message = e6.getMessage();
                if (message == null) {
                    message = "Fetch failed: ".concat(e6.getClass().getSimpleName());
                }
                K2.p.a(message, (10 & 2) != 0 ? "" : "Could not resolve a playable download URL for this link.", K2.r.f4127b, (10 & 8) != 0 ? androidx.media3.common.C.DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS : 4000L);
            }
            mutableState.setValue(Boolean.FALSE);
            return C3137A.f25453a;
        } catch (Throwable th) {
            mutableState.setValue(Boolean.FALSE);
            throw th;
        }
    }
}
