package ῲ.ⁱ.K.ῲ;

import android.os.Build;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import androidx.constraintlayout.motion.widget.MotionLayout;
import androidx.constraintlayout.widget.ConstraintAttribute;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import ඓ.K.K.K.C1293;
import ῲ.ⁱ.K.K.AbstractC2187;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.ⁱ.K.ῲ.䀟  reason: contains not printable characters */
/* compiled from: TimeCycleSplineSet */
public abstract class AbstractC2169 {

    /* renamed from: ᕣ  reason: contains not printable characters */
    public static float f7559 = 6.2831855f;

    /* renamed from: ʬ  reason: contains not printable characters */
    public int[] f7560 = new int[10];

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f7561;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public long f7562;

    /* renamed from: ῲ  reason: contains not printable characters */
    public int f7563 = 0;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public float[] f7564 = new float[3];

    /* renamed from: K  reason: contains not printable characters */
    public AbstractC2187 f7565;

    /* renamed from: 㳳  reason: contains not printable characters */
    public float f7566 = Float.NaN;

    /* renamed from: 㴹  reason: contains not printable characters */
    public String f7567;

    /* renamed from: 㸾  reason: contains not printable characters */
    public float[][] f7568 = ((float[][]) Array.newInstance(float.class, 10, 3));

    /* renamed from: 㿎  reason: contains not printable characters */
    public boolean f7569 = false;

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$ʬ  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2170 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5702(View view, float f, long j, C2129 r11) {
            int i = Build.VERSION.SDK_INT;
            view.setElevation(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$ඓ  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2171 extends AbstractC2169 {

        /* renamed from: 㑃  reason: contains not printable characters */
        public boolean f7570 = false;

        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5703(View view, float f, long j, C2129 r18) {
            if (view instanceof MotionLayout) {
                ((MotionLayout) view).setProgress(m5698(f, j, view, r18));
            } else if (this.f7570) {
                return false;
            } else {
                Method method = null;
                try {
                    method = view.getClass().getMethod("setProgress", Float.TYPE);
                } catch (NoSuchMethodException unused) {
                    this.f7570 = true;
                }
                if (method != null) {
                    try {
                        method.invoke(view, Float.valueOf(m5698(f, j, view, r18)));
                    } catch (IllegalAccessException e) {
                        Log.e("SplineSet", "unable to setProgress", e);
                    } catch (InvocationTargetException e2) {
                        Log.e("SplineSet", "unable to setProgress", e2);
                    }
                }
            }
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$ᕣ  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2172 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5704(View view, float f, long j, C2129 r11) {
            view.setTranslationX(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$ᨨ  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2173 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5705(View view, float f, long j, C2129 r11) {
            view.setScaleX(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$ⁱ  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2175 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5709(View view, float f, long j, C2129 r11) {
            view.setRotationX(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$K  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2176 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5710(View view, float f, long j, C2129 r11) {
            view.setAlpha(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$㑃  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2177 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5711(View view, float f, long j, C2129 r11) {
            view.setTranslationY(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$㳳  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2178 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5712(View view, float f, long j, C2129 r11) {
            view.setScaleY(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$㴹  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2179 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5713(View view, float f, long j, C2129 r11) {
            view.setRotation(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$㸾  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2180 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5714(View view, float f, long j, C2129 r5) {
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$㿎  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2181 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5715(View view, float f, long j, C2129 r11) {
            view.setRotationY(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$䁗  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2182 extends AbstractC2169 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5716(View view, float f, long j, C2129 r11) {
            int i = Build.VERSION.SDK_INT;
            view.setTranslationZ(m5698(f, j, view, r11));
            return this.f7569;
        }
    }

    public String toString() {
        String str = this.f7567;
        DecimalFormat decimalFormat = new DecimalFormat("##.##");
        for (int i = 0; i < this.f7561; i++) {
            StringBuilder r0 = C1293.m3402(str, "[");
            r0.append(this.f7560[i]);
            r0.append(" , ");
            r0.append(decimalFormat.format(this.f7568[i]));
            r0.append("] ");
            str = r0.toString();
        }
        return str;
    }

    /* renamed from: K  reason: contains not printable characters */
    public float m5698(float f, long j, View view, C2129 r23) {
        this.f7565.m5741((double) f, this.f7564);
        float[] fArr = this.f7564;
        float f2 = fArr[1];
        boolean z = false;
        int i = (f2 > 0.0f ? 1 : (f2 == 0.0f ? 0 : -1));
        if (i == 0) {
            this.f7569 = false;
            return fArr[2];
        }
        if (Float.isNaN(this.f7566)) {
            this.f7566 = r23.m5622(view, this.f7567, 0);
            if (Float.isNaN(this.f7566)) {
                this.f7566 = 0.0f;
            }
        }
        this.f7566 = (float) ((((((double) (j - this.f7562)) * 1.0E-9d) * ((double) f2)) + ((double) this.f7566)) % 1.0d);
        String str = this.f7567;
        float f3 = this.f7566;
        if (!r23.f7383.containsKey(view)) {
            HashMap<String, float[]> hashMap = new HashMap<>();
            hashMap.put(str, new float[]{f3});
            r23.f7383.put(view, hashMap);
        } else {
            HashMap<String, float[]> hashMap2 = r23.f7383.get(view);
            if (!hashMap2.containsKey(str)) {
                hashMap2.put(str, new float[]{f3});
                r23.f7383.put(view, hashMap2);
            } else {
                float[] fArr2 = hashMap2.get(str);
                if (fArr2.length <= 0) {
                    fArr2 = Arrays.copyOf(fArr2, 1);
                }
                fArr2[0] = f3;
                hashMap2.put(str, fArr2);
            }
        }
        this.f7562 = j;
        float f4 = this.f7564[0];
        float r2 = (m5697(this.f7566) * f4) + this.f7564[2];
        if (!(f4 == 0.0f && i == 0)) {
            z = true;
        }
        this.f7569 = z;
        return r2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract boolean m5701(View view, float f, long j, C2129 v);

    /* renamed from: ῲ.ⁱ.K.ῲ.䀟$ῲ  reason: contains not printable characters */
    /* compiled from: TimeCycleSplineSet */
    public static class C2174 extends AbstractC2169 {

        /* renamed from: Ԕ  reason: contains not printable characters */
        public SparseArray<float[]> f7571 = new SparseArray<>();

        /* renamed from: ؿ  reason: contains not printable characters */
        public float[] f7572;

        /* renamed from: 㑃  reason: contains not printable characters */
        public String f7573;

        /* renamed from: 㗗  reason: contains not printable characters */
        public float[] f7574;

        /* renamed from: 䁗  reason: contains not printable characters */
        public SparseArray<ConstraintAttribute> f7575;

        public C2174(String str, SparseArray<ConstraintAttribute> sparseArray) {
            this.f7573 = str.split(",")[1];
            this.f7575 = sparseArray;
        }

        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public void m5706(int i) {
            int size = this.f7575.size();
            int r1 = this.f7575.valueAt(0).m543();
            double[] dArr = new double[size];
            int i2 = r1 + 2;
            this.f7574 = new float[i2];
            this.f7572 = new float[r1];
            double[][] dArr2 = (double[][]) Array.newInstance(double.class, size, i2);
            for (int i3 = 0; i3 < size; i3++) {
                int keyAt = this.f7575.keyAt(i3);
                float[] valueAt = this.f7571.valueAt(i3);
                dArr[i3] = ((double) keyAt) * 0.01d;
                this.f7575.valueAt(i3).m547(this.f7574);
                int i4 = 0;
                while (true) {
                    float[] fArr = this.f7574;
                    if (i4 >= fArr.length) {
                        break;
                    }
                    dArr2[i3][i4] = (double) fArr[i4];
                    i4++;
                }
                dArr2[i3][r1] = (double) valueAt[0];
                dArr2[i3][r1 + 1] = (double) valueAt[1];
            }
            this.f7565 = AbstractC2187.m5736(i, dArr, dArr2);
        }

        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public void m5707(int i, float f, float f2, int i2, float f3) {
            throw new RuntimeException("don't call for custom attribute call setPoint(pos, ConstraintAttribute,...)");
        }

        @Override // ῲ.ⁱ.K.ῲ.AbstractC2169
        /* renamed from: K  reason: contains not printable characters */
        public boolean m5708(View view, float f, long j, C2129 r21) {
            this.f7565.m5741((double) f, this.f7574);
            float[] fArr = this.f7574;
            float f2 = fArr[fArr.length - 2];
            float f3 = fArr[fArr.length - 1];
            long j2 = j - this.f7562;
            if (Float.isNaN(this.f7566)) {
                this.f7566 = r21.m5622(view, this.f7573, 0);
                if (Float.isNaN(this.f7566)) {
                    this.f7566 = 0.0f;
                }
            }
            this.f7566 = (float) ((((((double) j2) * 1.0E-9d) * ((double) f2)) + ((double) this.f7566)) % 1.0d);
            this.f7562 = j;
            float r2 = m5697(this.f7566);
            this.f7569 = false;
            for (int i = 0; i < this.f7572.length; i++) {
                this.f7569 |= ((double) this.f7574[i]) != 0.0d;
                this.f7572[i] = (this.f7574[i] * r2) + f3;
            }
            this.f7575.valueAt(0).m545(view, this.f7572);
            if (f2 != 0.0f) {
                this.f7569 = true;
            }
            return this.f7569;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public float m5697(float f) {
        float abs;
        switch (this.f7563) {
            case 1:
                return Math.signum(f * f7559);
            case 2:
                abs = Math.abs(f);
                break;
            case 3:
                return (((f * 2.0f) + 1.0f) % 2.0f) - 1.0f;
            case 4:
                abs = ((f * 2.0f) + 1.0f) % 2.0f;
                break;
            case 5:
                return (float) Math.cos((double) (f * f7559));
            case 6:
                float abs2 = 1.0f - Math.abs(((f * 4.0f) % 4.0f) - 2.0f);
                abs = abs2 * abs2;
                break;
            default:
                return (float) Math.sin((double) (f * f7559));
        }
        return 1.0f - abs;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5700(int i, float f, float f2, int i2, float f3) {
        int[] iArr = this.f7560;
        int i3 = this.f7561;
        iArr[i3] = i;
        float[][] fArr = this.f7568;
        fArr[i3][0] = f;
        fArr[i3][1] = f2;
        fArr[i3][2] = f3;
        this.f7563 = Math.max(this.f7563, i2);
        this.f7561++;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5699(int i) {
        int i2 = this.f7561;
        if (i2 == 0) {
            StringBuilder r14 = C1293.m3416("Error no points added to ");
            r14.append(this.f7567);
            Log.e("SplineSet", r14.toString());
            return;
        }
        int[] iArr = this.f7560;
        float[][] fArr = this.f7568;
        int[] iArr2 = new int[(iArr.length + 10)];
        iArr2[0] = i2 - 1;
        iArr2[1] = 0;
        int i3 = 2;
        while (i3 > 0) {
            int i4 = i3 - 1;
            int i5 = iArr2[i4];
            i3 = i4 - 1;
            int i6 = iArr2[i3];
            if (i5 < i6) {
                int i7 = iArr[i6];
                int i8 = i5;
                int i9 = i8;
                while (i8 < i6) {
                    if (iArr[i8] <= i7) {
                        C2369.m6339(iArr, fArr, i9, i8);
                        i9++;
                    }
                    i8++;
                }
                C2369.m6339(iArr, fArr, i9, i6);
                int i10 = i3 + 1;
                iArr2[i3] = i9 - 1;
                int i11 = i10 + 1;
                iArr2[i10] = i5;
                int i12 = i11 + 1;
                iArr2[i11] = i6;
                i3 = i12 + 1;
                iArr2[i12] = i9 + 1;
            }
        }
        int i13 = 1;
        int i14 = 0;
        while (true) {
            int[] iArr3 = this.f7560;
            if (i13 >= iArr3.length) {
                break;
            }
            if (iArr3[i13] != iArr3[i13 - 1]) {
                i14++;
            }
            i13++;
        }
        if (i14 == 0) {
            i14 = 1;
        }
        double[] dArr = new double[i14];
        double[][] dArr2 = (double[][]) Array.newInstance(double.class, i14, 3);
        int i15 = 0;
        for (int i16 = 0; i16 < this.f7561; i16++) {
            if (i16 > 0) {
                int[] iArr4 = this.f7560;
                if (iArr4[i16] == iArr4[i16 - 1]) {
                }
            }
            dArr[i15] = ((double) this.f7560[i16]) * 0.01d;
            double[] dArr3 = dArr2[i15];
            float[][] fArr2 = this.f7568;
            dArr3[0] = (double) fArr2[i16][0];
            dArr2[i15][1] = (double) fArr2[i16][1];
            dArr2[i15][2] = (double) fArr2[i16][2];
            i15++;
        }
        this.f7565 = AbstractC2187.m5736(i, dArr, dArr2);
    }
}
