package d3;

import androidx.compose.runtime.MutableState;
import androidx.media3.common.Tracks;
import androidx.media3.exoplayer.ExoPlayer;
import j$.time.format.DateTimeFormatter;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: renamed from: d3.q1, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1918q1 extends C4.j implements J4.e {

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C1918q1(ExoPlayer exoPlayer, MutableState mutableState, MutableState mutableState2, A4.d dVar) {
        super(2, dVar);
        this.f15925a = exoPlayer;
        this.f15926b = mutableState;
        this.f15927c = mutableState2;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C1918q1(this.f15925a, this.f15926b, this.f15927c, dVar);
    }

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

    /* JADX WARN: Multi-variable type inference failed */
    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        B4.a aVar = B4.a.f492a;
        AbstractC2467b.l(obj);
        DateTimeFormatter dateTimeFormatter = v2.f16084a;
        MutableState mutableState = this.f15926b;
        Integer num = (Integer) mutableState.getValue();
        C3137A c3137a = C3137A.f25453a;
        if (num != null) {
            int iIntValue = num.intValue();
            F3.O<Tracks.Group> groups = this.f15925a.getCurrentTracks().getGroups();
            kotlin.jvm.internal.o.g(groups, "getGroups(...)");
            int i6 = 0;
            int i7 = -1;
            for (Tracks.Group group : groups) {
                if (group.getType() == 3) {
                    int i8 = group.length;
                    for (int i9 = 0; i9 < i8; i9++) {
                        if (group.isTrackSupported(i9)) {
                            if (group.isTrackSelected(i9) && i7 == -1) {
                                i7 = i6;
                            }
                            i6++;
                        }
                    }
                }
            }
            if (iIntValue >= 0 ? i7 == iIntValue : i7 < 0) {
                this.f15927c.setValue(Boolean.TRUE);
                mutableState.setValue(null);
            }
        }
        return c3137a;
    }
}
