package e1;

import android.animation.ValueAnimator;
import android.os.Build;
import android.os.Looper;
import android.util.AndroidRuntimeException;
import android.view.Choreographer;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes.dex */
public final class m extends k {

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

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public float f25432t;

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

    public m(Object obj, o0.i iVar) {
        super(obj, iVar);
        this.f25431s = null;
        this.f25432t = Float.MAX_VALUE;
        this.f25433u = false;
    }

    /* JADX WARN: Type inference failed for: r1v14, types: [e1.c] */
    public final void c(float f10) {
        if (this.f25423f) {
            this.f25432t = f10;
            return;
        }
        if (this.f25431s == null) {
            this.f25431s = new n(f10);
        }
        n nVar = this.f25431s;
        double d10 = f10;
        nVar.f25442i = d10;
        double d11 = (float) d10;
        if (d11 > this.f25424g) {
            throw new UnsupportedOperationException("Final position of the spring cannot be greater than the max value.");
        }
        if (d11 < this.f25425h) {
            throw new UnsupportedOperationException("Final position of the spring cannot be less than the min value.");
        }
        double dAbs = Math.abs(this.f25427j * 0.75f);
        nVar.f25437d = dAbs;
        nVar.f25438e = dAbs * 62.5d;
        xyz.stream.utils.f fVar = k.a().f25404e;
        fVar.getClass();
        if (Thread.currentThread() != ((Looper) fVar.f36133c).getThread()) {
            throw new AndroidRuntimeException("Animations may only be started on the same thread as the animation handler");
        }
        boolean z10 = this.f25423f;
        if (z10 || z10) {
            return;
        }
        this.f25423f = true;
        if (!this.f25420c) {
            this.f25419b = this.f25422e.k(this.f25421d);
        }
        float f11 = this.f25419b;
        if (f11 > this.f25424g || f11 < this.f25425h) {
            throw new IllegalArgumentException("Starting value need to be in between min value and max value");
        }
        f fVarA = k.a();
        ArrayList arrayList = fVarA.f25401b;
        if (arrayList.size() == 0) {
            ((Choreographer) fVarA.f25404e.f36132b).postFrameCallback(new e(fVarA.f25403d));
            if (Build.VERSION.SDK_INT >= 33) {
                fVarA.f25406g = ValueAnimator.getDurationScale();
                if (fVarA.f25407h == null) {
                    fVarA.f25407h = new d(fVarA);
                }
                final d dVar = fVarA.f25407h;
                if (dVar.f25396a == null) {
                    ?? r12 = new ValueAnimator.DurationScaleChangeListener() { // from class: e1.c
                        @Override // android.animation.ValueAnimator.DurationScaleChangeListener
                        public final void onChanged(float f12) {
                            dVar.f25397b.f25406g = f12;
                        }
                    };
                    dVar.f25396a = r12;
                    ValueAnimator.registerDurationScaleChangeListener(r12);
                }
            }
        }
        if (arrayList.contains(this)) {
            return;
        }
        arrayList.add(this);
    }

    public final void d() {
        if (this.f25431s.f25435b <= 0.0d) {
            throw new UnsupportedOperationException("Spring animations can only come to an end when there is damping");
        }
        xyz.stream.utils.f fVar = k.a().f25404e;
        fVar.getClass();
        if (Thread.currentThread() != ((Looper) fVar.f36133c).getThread()) {
            throw new AndroidRuntimeException("Animations may only be started on the same thread as the animation handler");
        }
        if (this.f25423f) {
            this.f25433u = true;
        }
    }
}
