package ῲ.ⁱ.K.ῲ;

import android.annotation.TargetApi;
import android.os.Build;
import android.util.Log;
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.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import ඓ.K.K.K.C1293;
import ῲ.ⁱ.K.K.AbstractC2187;
import ῲ.ⁱ.K.K.C2192;

/* renamed from: ῲ.ⁱ.K.ῲ.ⁱ  reason: contains not printable characters */
/* compiled from: KeyCycleOscillator */
public abstract class AbstractC2140 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public String f7480;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f7481 = 0;

    /* renamed from: ῲ  reason: contains not printable characters */
    public ConstraintAttribute f7482;

    /* renamed from: K  reason: contains not printable characters */
    public C2154 f7483;

    /* renamed from: 㴹  reason: contains not printable characters */
    public ArrayList<C2143> f7484 = new ArrayList<>();

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f7485 = 0;

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ʬ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2141 extends AbstractC2140 {

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

        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5662(View view, float f) {
            this.f7486[0] = m5660(f);
            this.f7482.m545(view, this.f7486);
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$Ԕ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2142 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5663(View view, float f) {
            view.setTranslationY(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ؿ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2143 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public float f7487;

        /* renamed from: ῲ  reason: contains not printable characters */
        public float f7488;

        /* renamed from: K  reason: contains not printable characters */
        public int f7489;

        /* renamed from: 㸾  reason: contains not printable characters */
        public float f7490;

        public C2143(int i, float f, float f2, float f3) {
            this.f7489 = i;
            this.f7488 = f3;
            this.f7487 = f2;
            this.f7490 = f;
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ඓ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2144 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5664(View view, float f) {
            int i = Build.VERSION.SDK_INT;
            view.setElevation(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ᕣ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2145 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5665(View view, float f) {
            view.setScaleX(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ᨨ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2146 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5666(View view, float f) {
            view.setRotationX(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ῲ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2147 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5667(View view, float f) {
            view.setAlpha(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$ⁱ  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2148 extends AbstractC2140 {

        /* renamed from: ⁱ  reason: contains not printable characters */
        public boolean f7491 = false;

        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5668(View view, float f) {
            if (view instanceof MotionLayout) {
                ((MotionLayout) view).setProgress(m5660(f));
            } else if (!this.f7491) {
                Method method = null;
                try {
                    method = view.getClass().getMethod("setProgress", Float.TYPE);
                } catch (NoSuchMethodException unused) {
                    this.f7491 = true;
                }
                if (method != null) {
                    try {
                        method.invoke(view, Float.valueOf(m5660(f)));
                    } catch (IllegalAccessException e) {
                        Log.e("KeyCycleOscillator", "unable to setProgress", e);
                    } catch (InvocationTargetException e2) {
                        Log.e("KeyCycleOscillator", "unable to setProgress", e2);
                    }
                }
            }
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$K  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public class C2149 implements Comparator<C2143> {
        public C2149(AbstractC2140 r1) {
        }

        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
        @Override // java.util.Comparator
        public int compare(C2143 r1, C2143 r2) {
            return Integer.compare(r1.f7489, r2.f7489);
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$㑃  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2150 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5669(View view, float f) {
            view.setScaleY(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$㗗  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2151 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5670(View view, float f) {
            int i = Build.VERSION.SDK_INT;
            view.setTranslationZ(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$㳳  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2152 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5671(View view, float f) {
            view.setRotationY(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$㴹  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2153 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5672(View view, float f) {
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$㸾  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2154 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public double[] f7492;

        /* renamed from: ඓ  reason: contains not printable characters */
        public float[] f7493;

        /* renamed from: ῲ  reason: contains not printable characters */
        public float[] f7494;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public double[] f7495;

        /* renamed from: K  reason: contains not printable characters */
        public C2192 f7496 = new C2192();

        /* renamed from: 㴹  reason: contains not printable characters */
        public AbstractC2187 f7497;

        /* renamed from: 㸾  reason: contains not printable characters */
        public float[] f7498;

        /* renamed from: 㿎  reason: contains not printable characters */
        public double[] f7499;

        public C2154(int i, int i2, int i3) {
            new HashMap();
            this.f7496.f7646 = i;
            this.f7494 = new float[i3];
            this.f7492 = new double[i3];
            this.f7498 = new float[i3];
            this.f7493 = new float[i3];
            float[] fArr = new float[i3];
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$㿎  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2155 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5673(View view, float f) {
            view.setRotation(m5660(f));
        }
    }

    /* renamed from: ῲ.ⁱ.K.ῲ.ⁱ$䁗  reason: contains not printable characters */
    /* compiled from: KeyCycleOscillator */
    public static class C2156 extends AbstractC2140 {
        @Override // ῲ.ⁱ.K.ῲ.AbstractC2140
        /* renamed from: K  reason: contains not printable characters */
        public void m5674(View view, float f) {
            view.setTranslationX(m5660(f));
        }
    }

    public String toString() {
        String str = this.f7480;
        DecimalFormat decimalFormat = new DecimalFormat("##.##");
        Iterator<C2143> it2 = this.f7484.iterator();
        while (it2.hasNext()) {
            C2143 next = it2.next();
            StringBuilder r0 = C1293.m3402(str, "[");
            r0.append(next.f7489);
            r0.append(" , ");
            r0.append(decimalFormat.format((double) next.f7488));
            r0.append("] ");
            str = r0.toString();
        }
        return str;
    }

    @TargetApi(19)
    /* renamed from: ʬ  reason: contains not printable characters */
    public void m5658(float f) {
        int i;
        int size = this.f7484.size();
        if (size != 0) {
            Collections.sort(this.f7484, new C2149(this));
            double[] dArr = new double[size];
            double[][] dArr2 = (double[][]) Array.newInstance(double.class, size, 2);
            this.f7483 = new C2154(this.f7485, this.f7481, size);
            Iterator<C2143> it2 = this.f7484.iterator();
            int i2 = 0;
            while (it2.hasNext()) {
                C2143 next = it2.next();
                float f2 = next.f7490;
                dArr[i2] = ((double) f2) * 0.01d;
                double[] dArr3 = dArr2[i2];
                float f3 = next.f7488;
                dArr3[0] = (double) f3;
                double[] dArr4 = dArr2[i2];
                float f4 = next.f7487;
                dArr4[1] = (double) f4;
                C2154 r9 = this.f7483;
                r9.f7492[i2] = ((double) next.f7489) / 100.0d;
                r9.f7498[i2] = f2;
                r9.f7493[i2] = f4;
                r9.f7494[i2] = f3;
                i2++;
            }
            C2154 r2 = this.f7483;
            double[][] dArr5 = (double[][]) Array.newInstance(double.class, r2.f7492.length, 2);
            float[] fArr = r2.f7494;
            r2.f7495 = new double[(fArr.length + 1)];
            r2.f7499 = new double[(fArr.length + 1)];
            if (r2.f7492[0] > 0.0d) {
                r2.f7496.m5769(0.0d, r2.f7498[0]);
            }
            double[] dArr6 = r2.f7492;
            int length = dArr6.length - 1;
            if (dArr6[length] < 1.0d) {
                r2.f7496.m5769(1.0d, r2.f7498[length]);
            }
            for (int i3 = 0; i3 < dArr5.length; i3++) {
                dArr5[i3][0] = (double) r2.f7493[i3];
                int i4 = 0;
                while (true) {
                    float[] fArr2 = r2.f7494;
                    if (i4 >= fArr2.length) {
                        break;
                    }
                    dArr5[i4][1] = (double) fArr2[i4];
                    i4++;
                }
                r2.f7496.m5769(r2.f7492[i3], r2.f7498[i3]);
            }
            C2192 r4 = r2.f7496;
            double d = 0.0d;
            int i5 = 0;
            while (true) {
                float[] fArr3 = r4.f7645;
                if (i5 >= fArr3.length) {
                    break;
                }
                d += (double) fArr3[i5];
                i5++;
            }
            double d2 = 0.0d;
            int i6 = 1;
            while (true) {
                float[] fArr4 = r4.f7645;
                if (i6 >= fArr4.length) {
                    break;
                }
                int i7 = i6 - 1;
                double[] dArr7 = r4.f7644;
                d2 = ((dArr7[i6] - dArr7[i7]) * ((double) ((fArr4[i7] + fArr4[i6]) / 2.0f))) + d2;
                i6++;
            }
            int i8 = 0;
            while (true) {
                float[] fArr5 = r4.f7645;
                if (i8 >= fArr5.length) {
                    break;
                }
                fArr5[i8] = (float) (((double) fArr5[i8]) * (d / d2));
                i8++;
            }
            r4.f7642[0] = 0.0d;
            int i9 = 1;
            while (true) {
                float[] fArr6 = r4.f7645;
                if (i9 >= fArr6.length) {
                    break;
                }
                int i10 = i9 - 1;
                double[] dArr8 = r4.f7644;
                double d3 = dArr8[i9] - dArr8[i10];
                double[] dArr9 = r4.f7642;
                dArr9[i9] = (d3 * ((double) ((fArr6[i10] + fArr6[i9]) / 2.0f))) + dArr9[i10];
                i9++;
            }
            double[] dArr10 = r2.f7492;
            if (dArr10.length > 1) {
                i = 0;
                r2.f7497 = AbstractC2187.m5736(0, dArr10, dArr5);
            } else {
                i = 0;
                r2.f7497 = null;
            }
            AbstractC2187.m5736(i, dArr, dArr2);
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public float m5659(float f) {
        double d;
        double d2;
        double d3;
        C2154 r2 = this.f7483;
        AbstractC2187 r3 = r2.f7497;
        double d4 = 0.0d;
        if (r3 != null) {
            double d5 = (double) f;
            r3.m5738(d5, r2.f7499);
            r2.f7497.m5740(d5, r2.f7495);
        } else {
            double[] dArr = r2.f7499;
            dArr[0] = 0.0d;
            dArr[1] = 0.0d;
        }
        double d6 = (double) f;
        double r10 = r2.f7496.m5766(d6);
        C2192 r1 = r2.f7496;
        double d7 = 2.0d;
        switch (r1.f7646) {
            case 1:
                break;
            case 2:
                d2 = r1.m5768(d6) * 4.0d;
                d = Math.signum((((r1.m5767(d6) * 4.0d) + 3.0d) % 4.0d) - 2.0d);
                d4 = d2 * d;
                break;
            case 3:
                d3 = r1.m5768(d6);
                d4 = d3 * d7;
                break;
            case 4:
                d3 = -r1.m5768(d6);
                d4 = d3 * d7;
                break;
            case 5:
                d7 = r1.m5768(d6) * (-r1.f7643);
                d3 = Math.sin(r1.m5767(d6) * r1.f7643);
                d4 = d3 * d7;
                break;
            case 6:
                d2 = r1.m5768(d6) * 4.0d;
                d = (((r1.m5767(d6) * 4.0d) + 2.0d) % 4.0d) - 2.0d;
                d4 = d2 * d;
                break;
            default:
                d7 = r1.m5768(d6) * r1.f7643;
                d3 = Math.cos(r1.m5767(d6) * r1.f7643);
                d4 = d3 * d7;
                break;
        }
        double[] dArr2 = r2.f7499;
        double d8 = dArr2[0];
        return (float) ((d4 * r2.f7495[1]) + (r10 * dArr2[1]) + d8);
    }

    /* renamed from: K  reason: contains not printable characters */
    public float m5660(float f) {
        C2154 r0 = this.f7483;
        AbstractC2187 r1 = r0.f7497;
        if (r1 != null) {
            r1.m5740((double) f, r0.f7495);
        } else {
            double[] dArr = r0.f7495;
            dArr[0] = (double) r0.f7493[0];
            dArr[1] = (double) r0.f7494[0];
        }
        return (float) ((r0.f7496.m5766((double) f) * r0.f7495[1]) + r0.f7495[0]);
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m5661(View view, float f);
}
