package d3;

import V2.P2;
import android.content.Context;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.State;
import androidx.media3.exoplayer.ExoPlayer;
import com.debridstream.tv.PlayerViewModel;
import j$.time.format.DateTimeFormatter;
import m3.AbstractC2467b;
import okhttp3.OkHttpClient;
import w4.C3137A;

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

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Context f15441b;

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

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

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

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

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ J4.a f15446j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final /* synthetic */ State f15447k;
    public final /* synthetic */ State l;

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

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final /* synthetic */ N2.r f15449n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final /* synthetic */ OkHttpClient f15450o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public final /* synthetic */ State f15451p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final /* synthetic */ State f15452q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ State f15453r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ State f15454s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final /* synthetic */ State f15455t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ State f15456u;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public X1(Context context, PlayerViewModel playerViewModel, ExoPlayer exoPlayer, String str, boolean z6, J4.a aVar, State state, State state2, MutableState mutableState, N2.r rVar, OkHttpClient okHttpClient, State state3, State state4, State state5, State state6, State state7, State state8, A4.d dVar) {
        super(2, dVar);
        this.f15441b = context;
        this.f15442c = playerViewModel;
        this.f15443d = exoPlayer;
        this.f15444e = str;
        this.f15445f = z6;
        this.f15446j = aVar;
        this.f15447k = state;
        this.l = state2;
        this.f15448m = mutableState;
        this.f15449n = rVar;
        this.f15450o = okHttpClient;
        this.f15451p = state3;
        this.f15452q = state4;
        this.f15453r = state5;
        this.f15454s = state6;
        this.f15455t = state7;
        this.f15456u = state8;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new X1(this.f15441b, this.f15442c, this.f15443d, this.f15444e, this.f15445f, this.f15446j, this.f15447k, this.l, this.f15448m, this.f15449n, this.f15450o, this.f15451p, this.f15452q, this.f15453r, this.f15454s, this.f15455t, this.f15456u, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:28:0x00a9, code lost:
    
        if (V4.E.H(r0, r8, r23) == r6) goto L29;
     */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r10v0, types: [androidx.compose.runtime.MutableState, androidx.compose.runtime.State] */
    /* JADX WARN: Type inference failed for: r10v1 */
    /* JADX WARN: Type inference failed for: r10v3 */
    /* JADX WARN: Type inference failed for: r10v4 */
    /* JADX WARN: Type inference failed for: r10v5 */
    /* JADX WARN: Type inference failed for: r1v1 */
    /* JADX WARN: Type inference failed for: r1v10 */
    /* JADX WARN: Type inference failed for: r1v2, types: [androidx.compose.runtime.MutableState] */
    /* JADX WARN: Type inference failed for: r1v6 */
    /* JADX WARN: Type inference failed for: r1v7, types: [androidx.compose.runtime.MutableState] */
    /* JADX WARN: Type inference failed for: r1v9 */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        ?? r12;
        ?? r13;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f15440a;
        C3137A c3137a = C3137A.f25453a;
        PlayerViewModel playerViewModel = this.f15442c;
        Context context = this.f15441b;
        ExoPlayer exoPlayer = this.f15443d;
        ?? r10 = this.f15448m;
        try {
            if (i6 == 0) {
                AbstractC2467b.l(obj);
                Context applicationContext = context.getApplicationContext();
                kotlin.jvm.internal.o.g(applicationContext, "getApplicationContext(...)");
                this.f15440a = 1;
                if (v2.g0(applicationContext, playerViewModel, exoPlayer, true, this.f15444e, this) != aVar) {
                }
                return aVar;
            }
            if (i6 != 1) {
                if (i6 != 2) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                AbstractC2467b.l(obj);
                r13 = r10;
                r10 = r10;
                DateTimeFormatter dateTimeFormatter = v2.f16084a;
                r13.setValue(Boolean.FALSE);
                return c3137a;
            }
            AbstractC2467b.l(obj);
            DateTimeFormatter dateTimeFormatter2 = v2.f16084a;
            C1921s c1921s = (C1921s) this.f15447k.getValue();
            P2 p22 = (P2) this.l.getValue();
            if (c1921s == null || p22 == null || !p22.f7480c) {
                if (this.f15445f) {
                    v2.E0(exoPlayer);
                    this.f15446j.invoke();
                }
            } else if (!((Boolean) r10.getValue()).booleanValue()) {
                r10.setValue(Boolean.TRUE);
                c5.e eVar = V4.N.f8259a;
                c5.d dVar = c5.d.f13466b;
                r12 = r10;
                ExoPlayer exoPlayer2 = exoPlayer;
                try {
                    W1 w12 = new W1(context, exoPlayer2, playerViewModel, c1921s, p22, this.f15449n, this.f15450o, this.f15451p, this.f15452q, this.f15453r, this.f15454s, this.f15455t, this.f15456u, null);
                    this.f15440a = 2;
                    r13 = r12;
                    r10 = exoPlayer2;
                } catch (Throwable th) {
                    th = th;
                    DateTimeFormatter dateTimeFormatter3 = v2.f16084a;
                    r12.setValue(Boolean.FALSE);
                    throw th;
                }
            }
            return c3137a;
        } catch (Throwable th2) {
            th = th2;
            r12 = r10;
        }
    }
}
