package q;

import androidx.compose.runtime.MutableFloatState;
import androidx.compose.runtime.MutableLongState;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.PrimitiveSnapshotStateKt;
import androidx.compose.runtime.SnapshotLongStateKt;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.compose.runtime.State;
import androidx.compose.runtime.snapshots.SnapshotStateList;

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

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final G0 f23475a;

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public C2764a0 f23479e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public C2799s0 f23480f;

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final MutableFloatState f23482k;
    public boolean l;

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

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public AbstractC2798s f23484n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final MutableLongState f23485o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public boolean f23486p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final C2790n0 f23487q;

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

    /* JADX WARN: Type inference failed for: r12v10, types: [java.lang.Object, java.util.Map] */
    public y0(A0 a02, Object obj, AbstractC2798s abstractC2798s, G0 g0) {
        this.f23488r = a02;
        this.f23475a = g0;
        Object objInvoke = null;
        MutableState mutableStateMutableStateOf$default = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(obj, null, 2, null);
        this.f23476b = mutableStateMutableStateOf$default;
        MutableState mutableStateMutableStateOf$default2 = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(AbstractC2771e.o(0.0f, 0.0f, null, 7), null, 2, null);
        this.f23477c = mutableStateMutableStateOf$default2;
        this.f23478d = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(new C2799s0((InterfaceC2752C) mutableStateMutableStateOf$default2.getValue(), g0, obj, mutableStateMutableStateOf$default.getValue(), abstractC2798s), null, 2, null);
        this.f23481j = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(Boolean.TRUE, null, 2, null);
        this.f23482k = PrimitiveSnapshotStateKt.mutableFloatStateOf(-1.0f);
        this.f23483m = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(obj, null, 2, null);
        this.f23484n = abstractC2798s;
        this.f23485o = SnapshotLongStateKt.mutableLongStateOf(b().b());
        Float f6 = (Float) U0.f23243a.get(g0);
        if (f6 != null) {
            float fFloatValue = f6.floatValue();
            AbstractC2798s abstractC2798s2 = (AbstractC2798s) g0.f23171a.invoke(obj);
            int iB = abstractC2798s2.b();
            for (int i6 = 0; i6 < iB; i6++) {
                abstractC2798s2.e(fFloatValue, i6);
            }
            objInvoke = this.f23475a.f23172b.invoke(abstractC2798s2);
        }
        this.f23487q = AbstractC2771e.o(0.0f, 0.0f, objInvoke, 3);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final C2799s0 b() {
        return (C2799s0) this.f23478d.getValue();
    }

    public final void c(long j4) {
        if (this.f23482k.getFloatValue() == -1.0f) {
            this.f23486p = true;
            if (kotlin.jvm.internal.o.c(b().f23425c, b().f23426d)) {
                d(b().f23425c);
            } else {
                d(b().f(j4));
                this.f23484n = b().d(j4);
            }
        }
    }

    public final void d(Object obj) {
        this.f23483m.setValue(obj);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void e(Object obj, boolean z6) {
        C2799s0 c2799s0 = this.f23480f;
        Object obj2 = c2799s0 != null ? c2799s0.f23425c : null;
        MutableState mutableState = this.f23476b;
        boolean zC = kotlin.jvm.internal.o.c(obj2, mutableState.getValue());
        MutableLongState mutableLongState = this.f23485o;
        MutableState mutableState2 = this.f23478d;
        InterfaceC2752C interfaceC2752C = this.f23487q;
        if (zC) {
            mutableState2.setValue(new C2799s0(interfaceC2752C, this.f23475a, obj, obj, this.f23484n.c()));
            this.l = true;
            mutableLongState.setLongValue(b().b());
            return;
        }
        MutableState mutableState3 = this.f23477c;
        if (!z6 || this.f23486p || (((InterfaceC2752C) mutableState3.getValue()) instanceof C2790n0)) {
            interfaceC2752C = (InterfaceC2752C) mutableState3.getValue();
        }
        A0 a02 = this.f23488r;
        mutableState2.setValue(new C2799s0(a02.e() <= 0 ? interfaceC2752C : new C2792o0(interfaceC2752C, a02.e()), this.f23475a, obj, mutableState.getValue(), this.f23484n));
        mutableLongState.setLongValue(b().b());
        this.l = false;
        Boolean bool = Boolean.TRUE;
        MutableState mutableState4 = a02.f23141h;
        mutableState4.setValue(bool);
        if (a02.g()) {
            SnapshotStateList snapshotStateList = a02.f23142i;
            int size = snapshotStateList.size();
            long jMax = 0;
            for (int i6 = 0; i6 < size; i6++) {
                y0 y0Var = (y0) snapshotStateList.get(i6);
                jMax = Math.max(jMax, y0Var.f23485o.getLongValue());
                y0Var.c(0L);
            }
            mutableState4.setValue(Boolean.FALSE);
        }
    }

    public final void f(Object obj, Object obj2, InterfaceC2752C interfaceC2752C) {
        this.f23476b.setValue(obj2);
        this.f23477c.setValue(interfaceC2752C);
        if (kotlin.jvm.internal.o.c(b().f23426d, obj) && kotlin.jvm.internal.o.c(b().f23425c, obj2)) {
            return;
        }
        e(obj, false);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void g(Object obj, InterfaceC2752C interfaceC2752C) {
        if (this.l) {
            C2799s0 c2799s0 = this.f23480f;
            if (kotlin.jvm.internal.o.c(obj, c2799s0 != null ? c2799s0.f23425c : null)) {
                return;
            }
        }
        MutableState mutableState = this.f23476b;
        boolean zC = kotlin.jvm.internal.o.c(mutableState.getValue(), obj);
        MutableFloatState mutableFloatState = this.f23482k;
        if (zC && mutableFloatState.getFloatValue() == -1.0f) {
            return;
        }
        mutableState.setValue(obj);
        this.f23477c.setValue(interfaceC2752C);
        Object value = mutableFloatState.getFloatValue() == -3.0f ? obj : this.f23483m.getValue();
        MutableState mutableState2 = this.f23481j;
        e(value, !((Boolean) mutableState2.getValue()).booleanValue());
        mutableState2.setValue(Boolean.valueOf(mutableFloatState.getFloatValue() == -3.0f));
        if (mutableFloatState.getFloatValue() >= 0.0f) {
            d(b().f((long) (mutableFloatState.getFloatValue() * b().b())));
        } else if (mutableFloatState.getFloatValue() == -3.0f) {
            d(obj);
        }
        this.l = false;
        mutableFloatState.setFloatValue(-1.0f);
    }

    @Override // androidx.compose.runtime.State
    public final Object getValue() {
        return this.f23483m.getValue();
    }

    public final String toString() {
        return "current value: " + this.f23483m.getValue() + ", target: " + this.f23476b.getValue() + ", spec: " + ((InterfaceC2752C) this.f23477c.getValue());
    }
}
