package p058t;

import android.view.View;
import android.view.animation.Interpolator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import p043o.AbstractC1504a;
import p043o.C1505b;
import p043o.C1506c;
import p055s.AbstractC1605b;
import p055s.AbstractC1607c;
import p055s.AbstractC1609d;
import p055s.C1603a;

/* renamed from: t.g */
/* loaded from: classes.dex */
public class C1638g {

    /* renamed from: a */
    public boolean f3757a;

    /* renamed from: b */
    public C1647k f3758b;

    /* renamed from: c */
    public C1647k f3759c;

    /* renamed from: d */
    public C1637f f3760d;

    /* renamed from: e */
    public C1637f f3761e;

    /* renamed from: f */
    public AbstractC1504a[] f3762f;

    /* renamed from: g */
    public AbstractC1504a f3763g;

    /* renamed from: h */
    public float f3764h;

    /* renamed from: i */
    public float f3765i;

    /* renamed from: j */
    public int[] f3766j;

    /* renamed from: k */
    public double[] f3767k;

    /* renamed from: l */
    public double[] f3768l;

    /* renamed from: m */
    public String[] f3769m;

    /* renamed from: n */
    public float[] f3770n;

    /* renamed from: o */
    public ArrayList<C1647k> f3771o;

    /* renamed from: p */
    public HashMap<String, AbstractC1609d> f3772p;

    /* renamed from: q */
    public HashMap<String, AbstractC1607c> f3773q;

    /* renamed from: r */
    public HashMap<String, AbstractC1605b> f3774r;

    /* renamed from: s */
    public C1636e[] f3775s;

    /* renamed from: t */
    public int f3776t;

    /* renamed from: u */
    public View f3777u;

    /* renamed from: v */
    public int f3778v;

    /* renamed from: w */
    public float f3779w;

    /* renamed from: x */
    public Interpolator f3780x;

    /* renamed from: y */
    public boolean f3781y;

    /* renamed from: a */
    public final float m754a(float f, float[] fArr) {
        float f2 = 0.0f;
        if (fArr != null) {
            fArr[0] = 1.0f;
        } else {
            float f3 = this.f3765i;
            if (f3 != 1.0d) {
                float f4 = this.f3764h;
                if (f < f4) {
                    f = 0.0f;
                }
                if (f > f4 && f < 1.0d) {
                    f = Math.min((f - f4) * f3, 1.0f);
                }
            }
        }
        C1505b c1505b = this.f3758b.f3849d;
        Iterator<C1647k> it = this.f3771o.iterator();
        float f5 = Float.NaN;
        while (it.hasNext()) {
            C1647k next = it.next();
            C1505b c1505b2 = next.f3849d;
            if (c1505b2 != null) {
                float f6 = next.f3851f;
                if (f6 < f) {
                    c1505b = c1505b2;
                    f2 = f6;
                } else if (Float.isNaN(f5)) {
                    f5 = next.f3851f;
                }
            }
        }
        if (c1505b != null) {
            float f7 = (Float.isNaN(f5) ? 1.0f : f5) - f2;
            double d = (f - f2) / f7;
            f = (((float) c1505b.m1142a(d)) * f7) + f2;
            if (fArr != null) {
                fArr[0] = (float) c1505b.m1141b(d);
            }
        }
        return f;
    }

    /* renamed from: b */
    public void m753b(double d, float[] fArr, float[] fArr2) {
        double[] dArr = new double[4];
        double[] dArr2 = new double[4];
        this.f3762f[0].m1145b(d, dArr);
        this.f3762f[0].m1143d(d, dArr2);
        Arrays.fill(fArr2, 0.0f);
        this.f3758b.m709b(d, this.f3766j, dArr, fArr, dArr2, fArr2);
    }

    /* renamed from: c */
    public boolean m752c(View view, float f, long j, C1506c c1506c) {
        AbstractC1609d.C1610a c1610a;
        boolean z;
        char c;
        double d;
        View view2;
        float m754a = m754a(f, null);
        int i = this.f3778v;
        if (i != AbstractC1635d.f3754a) {
            float f2 = 1.0f / i;
            float floor = ((float) Math.floor(m754a / f2)) * f2;
            float f3 = (m754a % f2) / f2;
            if (!Float.isNaN(this.f3779w)) {
                f3 = (f3 + this.f3779w) % 1.0f;
            }
            Interpolator interpolator = this.f3780x;
            m754a = ((interpolator != null ? interpolator.getInterpolation(f3) : ((double) f3) > 0.5d ? 1.0f : 0.0f) * f2) + floor;
        }
        float f4 = m754a;
        HashMap<String, AbstractC1607c> hashMap = this.f3773q;
        if (hashMap != null) {
            for (AbstractC1607c abstractC1607c : hashMap.values()) {
                abstractC1607c.mo799b(view, f4);
            }
        }
        HashMap<String, AbstractC1609d> hashMap2 = this.f3772p;
        if (hashMap2 != null) {
            AbstractC1609d.C1610a c1610a2 = null;
            boolean z2 = false;
            for (AbstractC1609d abstractC1609d : hashMap2.values()) {
                if (abstractC1609d instanceof AbstractC1609d.C1610a) {
                    c1610a2 = (AbstractC1609d.C1610a) abstractC1609d;
                } else {
                    z2 |= abstractC1609d.mo796b(view, f4, j, c1506c);
                }
            }
            z = z2;
            c1610a = c1610a2;
        } else {
            c1610a = null;
            z = false;
        }
        AbstractC1504a[] abstractC1504aArr = this.f3762f;
        if (abstractC1504aArr != null) {
            double d2 = f4;
            abstractC1504aArr[0].m1145b(d2, this.f3767k);
            this.f3762f[0].m1143d(d2, this.f3768l);
            AbstractC1504a abstractC1504a = this.f3763g;
            if (abstractC1504a != null) {
                double[] dArr = this.f3767k;
                if (dArr.length > 0) {
                    abstractC1504a.m1145b(d2, dArr);
                    this.f3763g.m1143d(d2, this.f3768l);
                }
            }
            if (this.f3781y) {
                d = d2;
            } else {
                d = d2;
                this.f3758b.m708c(f4, view, this.f3766j, this.f3767k, this.f3768l, null, this.f3757a);
                this.f3757a = false;
            }
            if (this.f3776t != AbstractC1635d.f3754a) {
                if (this.f3777u == null) {
                    this.f3777u = ((View) view.getParent()).findViewById(this.f3776t);
                }
                if (this.f3777u != null) {
                    float top = (view2.getTop() + this.f3777u.getBottom()) / 2.0f;
                    float left = (this.f3777u.getLeft() + this.f3777u.getRight()) / 2.0f;
                    if (view.getRight() - view.getLeft() > 0 && view.getBottom() - view.getTop() > 0) {
                        view.setPivotX(left - view.getLeft());
                        view.setPivotY(top - view.getTop());
                    }
                }
            }
            HashMap<String, AbstractC1607c> hashMap3 = this.f3773q;
            if (hashMap3 != null) {
                for (AbstractC1607c abstractC1607c2 : hashMap3.values()) {
                    if (abstractC1607c2 instanceof AbstractC1607c.C1608a) {
                        double[] dArr2 = this.f3768l;
                        if (dArr2.length > 1) {
                            ((AbstractC1607c.C1608a) abstractC1607c2).m798c(view, f4, dArr2[0], dArr2[1]);
                        }
                    }
                }
            }
            if (c1610a != null) {
                double[] dArr3 = this.f3768l;
                c = 1;
                z |= c1610a.m795c(view, c1506c, f4, j, dArr3[0], dArr3[1]);
            } else {
                c = 1;
            }
            int i2 = 1;
            while (true) {
                AbstractC1504a[] abstractC1504aArr2 = this.f3762f;
                if (i2 >= abstractC1504aArr2.length) {
                    break;
                }
                abstractC1504aArr2[i2].m1144c(d, this.f3770n);
                C1603a.m802b(this.f3758b.f3863r.get(this.f3769m[i2 - 1]), view, this.f3770n);
                i2++;
            }
            C1637f c1637f = this.f3760d;
            if (c1637f.f3755d == 0) {
                if (f4 > 0.0f) {
                    if (f4 >= 1.0f) {
                        c1637f = this.f3761e;
                    } else if (this.f3761e.f3756e != c1637f.f3756e) {
                        view.setVisibility(0);
                    }
                }
                view.setVisibility(c1637f.f3756e);
            }
            if (this.f3775s != null) {
                int i3 = 0;
                while (true) {
                    C1636e[] c1636eArr = this.f3775s;
                    if (i3 >= c1636eArr.length) {
                        break;
                    }
                    c1636eArr[i3].m755a(f4, view);
                    i3++;
                }
            }
        } else {
            c = 1;
            C1647k c1647k = this.f3758b;
            float f5 = c1647k.f3853h;
            C1647k c1647k2 = this.f3759c;
            float f6 = f5 + ((c1647k2.f3853h - f5) * f4);
            float f7 = c1647k.f3854i;
            float f8 = f7 + ((c1647k2.f3854i - f7) * f4);
            float f9 = c1647k.f3855j;
            float f10 = c1647k2.f3855j;
            float f11 = c1647k.f3856k;
            float f12 = c1647k2.f3856k;
            float f13 = f6 + 0.5f;
            int i4 = (int) f13;
            float f14 = f8 + 0.5f;
            int i5 = (int) f14;
            int i6 = (int) (f13 + ((f10 - f9) * f4) + f9);
            int i7 = (int) (f14 + ((f12 - f11) * f4) + f11);
            int i8 = i6 - i4;
            int i9 = i7 - i5;
            if (f10 != f9 || f12 != f11 || this.f3757a) {
                view.measure(View.MeasureSpec.makeMeasureSpec(i8, 1073741824), View.MeasureSpec.makeMeasureSpec(i9, 1073741824));
                this.f3757a = false;
            }
            view.layout(i4, i5, i6, i7);
        }
        HashMap<String, AbstractC1605b> hashMap4 = this.f3774r;
        if (hashMap4 != null) {
            for (AbstractC1605b abstractC1605b : hashMap4.values()) {
                if (abstractC1605b instanceof AbstractC1605b.C1606a) {
                    double[] dArr4 = this.f3768l;
                    ((AbstractC1605b.C1606a) abstractC1605b).m800c(view, f4, dArr4[0], dArr4[c]);
                } else {
                    abstractC1605b.mo801b(view, f4);
                }
            }
        }
        return z;
    }

    public String toString() {
        return " start: x: " + this.f3758b.f3853h + " y: " + this.f3758b.f3854i + " end: x: " + this.f3759c.f3853h + " y: " + this.f3759c.f3854i;
    }
}