package e1;

/* JADX INFO: loaded from: classes.dex */
public final class n {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public double f25435b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public double f25437d;

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

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public double f25440g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public double f25441h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public double f25442i;

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

    public n() {
        this.f25434a = Math.sqrt(1500.0d);
        this.f25435b = 0.5d;
        this.f25436c = false;
        this.f25442i = Double.MAX_VALUE;
        this.f25443j = new i();
    }

    public final void a(float f10) {
        if (f10 < 0.0f) {
            throw new IllegalArgumentException("Damping ratio must be non-negative");
        }
        this.f25435b = f10;
        this.f25436c = false;
    }

    public final void b(float f10) {
        if (f10 <= 0.0f) {
            throw new IllegalArgumentException("Spring stiffness constant must be positive.");
        }
        this.f25434a = Math.sqrt(f10);
        this.f25436c = false;
    }

    public final i c(double d10, double d11, long j10) {
        double dCos;
        double dPow;
        if (!this.f25436c) {
            if (this.f25442i == Double.MAX_VALUE) {
                throw new IllegalStateException("Error: Final position of the spring must be set before the animation starts");
            }
            double d12 = this.f25435b;
            if (d12 > 1.0d) {
                double d13 = this.f25434a;
                this.f25439f = (Math.sqrt((d12 * d12) - 1.0d) * d13) + ((-d12) * d13);
                double d14 = this.f25435b;
                double d15 = this.f25434a;
                this.f25440g = ((-d14) * d15) - (Math.sqrt((d14 * d14) - 1.0d) * d15);
            } else if (d12 >= 0.0d && d12 < 1.0d) {
                this.f25441h = Math.sqrt(1.0d - (d12 * d12)) * this.f25434a;
            }
            this.f25436c = true;
        }
        double d16 = j10 / 1000.0d;
        double d17 = d10 - this.f25442i;
        double d18 = this.f25435b;
        if (d18 > 1.0d) {
            double d19 = this.f25440g;
            double d20 = this.f25439f;
            double d21 = d17 - (((d19 * d17) - d11) / (d19 - d20));
            double d22 = ((d17 * d19) - d11) / (d19 - d20);
            dPow = (Math.pow(2.718281828459045d, this.f25439f * d16) * d22) + (Math.pow(2.718281828459045d, d19 * d16) * d21);
            double d23 = this.f25440g;
            double dPow2 = Math.pow(2.718281828459045d, d23 * d16) * d21 * d23;
            double d24 = this.f25439f;
            dCos = (Math.pow(2.718281828459045d, d24 * d16) * d22 * d24) + dPow2;
        } else if (d18 == 1.0d) {
            double d25 = this.f25434a;
            double d26 = (d25 * d17) + d11;
            double d27 = (d26 * d16) + d17;
            double dPow3 = Math.pow(2.718281828459045d, (-d25) * d16) * d27;
            double dPow4 = Math.pow(2.718281828459045d, (-this.f25434a) * d16) * d27;
            double d28 = this.f25434a;
            dCos = (Math.pow(2.718281828459045d, (-d28) * d16) * d26) + (dPow4 * (-d28));
            dPow = dPow3;
        } else {
            double d29 = 1.0d / this.f25441h;
            double d30 = this.f25434a;
            double d31 = ((d18 * d30 * d17) + d11) * d29;
            double dSin = ((Math.sin(this.f25441h * d16) * d31) + (Math.cos(this.f25441h * d16) * d17)) * Math.pow(2.718281828459045d, (-d18) * d30 * d16);
            double d32 = this.f25434a;
            double d33 = this.f25435b;
            double d34 = (-d32) * dSin * d33;
            double dPow5 = Math.pow(2.718281828459045d, (-d33) * d32 * d16);
            double d35 = this.f25441h;
            double dSin2 = Math.sin(d35 * d16) * (-d35) * d17;
            double d36 = this.f25441h;
            dCos = (((Math.cos(d36 * d16) * d31 * d36) + dSin2) * dPow5) + d34;
            dPow = dSin;
        }
        float f10 = (float) (dPow + this.f25442i);
        i iVar = this.f25443j;
        iVar.f25410a = f10;
        iVar.f25411b = (float) dCos;
        return iVar;
    }

    public n(float f10) {
        this.f25434a = Math.sqrt(1500.0d);
        this.f25435b = 0.5d;
        this.f25436c = false;
        this.f25443j = new i();
        this.f25442i = f10;
    }
}
