package G0;

import androidx.compose.runtime.PausedComposition;
import androidx.compose.runtime.snapshots.Snapshot;

/* JADX INFO: loaded from: classes.dex */
public final class U implements y0 {

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

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

    public U(W w6, Object obj) {
        this.f1931a = w6;
        this.f1932b = obj;
    }

    public final M a() {
        W w6 = this.f1931a;
        I0.H h5 = (I0.H) w6.f1944m.d(this.f1932b);
        if (h5 != null) {
            return (M) w6.f1941f.d(h5);
        }
        return null;
    }

    @Override // G0.y0
    public final z0 apply() {
        M mA = a();
        W w6 = this.f1931a;
        if (mA != null) {
            w6.b(mA, false);
        }
        return w6.d(this.f1932b);
    }

    @Override // G0.y0
    public final void cancel() {
        M mA = a();
        if ((mA != null ? mA.f1907f : null) != null) {
            W.a(this.f1931a, this.f1932b);
        }
    }

    @Override // G0.y0
    public final boolean h(F.h0 h0Var) {
        M mA = a();
        PausedComposition pausedComposition = mA != null ? mA.f1907f : null;
        if (pausedComposition == null || pausedComposition.isComplete()) {
            return true;
        }
        Snapshot.Companion companion = Snapshot.Companion;
        W w6 = this.f1931a;
        Snapshot currentThreadSnapshot = companion.getCurrentThreadSnapshot();
        J4.c readObserver = currentThreadSnapshot != null ? currentThreadSnapshot.getReadObserver() : null;
        Snapshot snapshotMakeCurrentNonObservable = companion.makeCurrentNonObservable(currentThreadSnapshot);
        try {
            I0.H h5 = w6.f1936a;
            h5.f2190u = true;
            try {
                boolean zResume = pausedComposition.resume(h0Var);
                h5.f2190u = false;
                return zResume;
            } catch (Throwable th) {
                mA.getClass();
                throw th;
            }
        } finally {
            companion.restoreNonObservable(currentThreadSnapshot, snapshotMakeCurrentNonObservable, readObserver);
        }
    }

    @Override // G0.y0
    public final boolean isComplete() {
        PausedComposition pausedComposition;
        M mA = a();
        if (mA == null || (pausedComposition = mA.f1907f) == null) {
            return true;
        }
        return pausedComposition.isComplete();
    }
}
