package k1;

import kotlin.Pair;

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

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

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

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

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

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

    public h(i iVar, c cVar, float f10, float f11) {
        nb.g.i(cVar, "cubic");
        this.f28988e = iVar;
        this.f28984a = cVar;
        if (f11 < f10) {
            throw new IllegalArgumentException("endOutlineProgress is expected to be equal or greater than startOutlineProgress".toString());
        }
        this.f28985b = iVar.f28989a.a(cVar);
        this.f28986c = f10;
        this.f28987d = f11;
    }

    /* JADX WARN: Type inference failed for: r5v3, types: [k1.a] */
    public final Pair a(float f10) {
        float f11 = this.f28986c;
        float f12 = this.f28987d;
        if (f11 > f12) {
            throw new IllegalArgumentException("Cannot coerce value to an empty range: maximum " + f12 + " is less than minimum " + f11 + '.');
        }
        if (f10 < f11) {
            f10 = f11;
        } else if (f10 > f12) {
            f10 = f12;
        }
        float f13 = (f10 - f11) / (f12 - f11);
        i iVar = this.f28988e;
        final e1.i iVar2 = iVar.f28989a;
        final float f14 = f13 * this.f28985b;
        iVar2.getClass();
        final c cVar = this.f28984a;
        nb.g.i(cVar, "c");
        float[] fArr = cVar.f28977a;
        final float fA = o.a(fArr[0] - iVar2.f25410a, fArr[1] - iVar2.f25411b);
        ?? r52 = new Object() { // from class: k1.a
            public final float a(float f15) {
                c cVar2 = cVar;
                nb.g.i(cVar2, "$c");
                e1.i iVar3 = iVar2;
                nb.g.i(iVar3, "this$0");
                long jC = cVar2.c(f15);
                return Math.abs(o.d(o.a(o6.b.t(jC) - iVar3.f25410a, o6.b.u(jC) - iVar3.f25411b) - fA, o.f29011c) - f14);
            }
        };
        float f15 = 1.0f;
        float f16 = 0.0f;
        while (f15 - f16 > 1.0E-5f) {
            float f17 = 2;
            float f18 = 3;
            float f19 = ((f17 * f16) + f15) / f18;
            float f20 = ((f17 * f15) + f16) / f18;
            if (r52.a(f19) < r52.a(f20)) {
                f15 = f20;
            } else {
                f16 = f19;
            }
        }
        float f21 = (f16 + f15) / 2;
        if (0.0f > f21 || f21 > 1.0f) {
            throw new IllegalArgumentException("Cubic cut point is expected to be between 0 and 1".toString());
        }
        Pair pairD = cVar.d(f21);
        return new Pair(new h(iVar, (c) pairD.getFirst(), this.f28986c, f10), new h(iVar, (c) pairD.getSecond(), f10, this.f28987d));
    }

    public final String toString() {
        return "MeasuredCubic(outlineProgress=[" + this.f28986c + " .. " + this.f28987d + "], size=" + this.f28985b + ", cubic=" + this.f28984a + ')';
    }
}
