package d3;

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

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

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public /* synthetic */ Object f15075b;

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public E1(A4.d dVar, MutableState mutableState, MutableState mutableState2, MutableState mutableState3, ExoPlayer exoPlayer) {
        super(2, dVar);
        this.f15076c = exoPlayer;
        this.f15077d = mutableState;
        this.f15078e = mutableState2;
        this.f15079f = mutableState3;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        E1 e12 = new E1(dVar, this.f15077d, this.f15078e, this.f15079f, this.f15076c);
        e12.f15075b = obj;
        return e12;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((E1) 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) {
        V4.C c6;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f15074a;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            c6 = (V4.C) this.f15075b;
        } else {
            if (i6 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            c6 = (V4.C) this.f15075b;
            AbstractC2467b.l(obj);
        }
        while (V4.E.v(c6)) {
            ExoPlayer exoPlayer = this.f15076c;
            long currentPosition = exoPlayer.getCurrentPosition();
            if (currentPosition < 0) {
                currentPosition = 0;
            }
            Long l = new Long(exoPlayer.getDuration());
            if (l.longValue() <= 0) {
                l = null;
            }
            long jLongValue = l != null ? l.longValue() : 0L;
            DateTimeFormatter dateTimeFormatter = v2.f16084a;
            MutableState mutableState = this.f15077d;
            if (currentPosition != ((Number) mutableState.getValue()).longValue()) {
                mutableState.setValue(Long.valueOf(currentPosition));
            }
            MutableState mutableState2 = this.f15078e;
            if (jLongValue != v2.J(mutableState2)) {
                mutableState2.setValue(Long.valueOf(jLongValue));
            }
            MutableState mutableState3 = this.f15079f;
            Long l6 = (Long) mutableState3.getValue();
            if (l6 != null) {
                if (Math.abs(exoPlayer.getCurrentPosition() - l6.longValue()) < 500) {
                    mutableState3.setValue(null);
                }
            }
            this.f15075b = c6;
            this.f15074a = 1;
            if (V4.E.l(250L, this) == aVar) {
                return aVar;
            }
        }
        return C3137A.f25453a;
    }
}
