package defpackage;

import android.graphics.Typeface;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.widget.TextView;
import java.lang.ref.WeakReference;
import java.util.Arrays;

/* renamed from: ᵫᵘˁ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3959 implements InterfaceC1612 {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public int f14935;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public int f14936;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public Object f14937;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public Object f14938;

    public C3959() {
        this.f14938 = new long[10];
        this.f14937 = new Object[10];
    }

    public C3959(int i, float[] fArr, float[] fArr2, int i2) {
        this.f14936 = i;
        ᵛᵾˏ.ᵯٴᵦ(((long) fArr.length) * 2 == ((long) fArr2.length) * 3);
        this.f14938 = fArr;
        this.f14937 = fArr2;
        this.f14935 = i2;
    }

    public C3959(C3959 c3959) {
        float[] fArr = (float[]) c3959.f14938;
        this.f14936 = fArr.length / 3;
        this.f14938 = ˉˇʨ.ᵶᵷᵕ(fArr);
        this.f14937 = ˉˇʨ.ᵶᵷᵕ((float[]) c3959.f14937);
        int i = c3959.f14935;
        if (i == 1) {
            this.f14935 = 5;
        } else if (i != 2) {
            this.f14935 = 4;
        } else {
            this.f14935 = 6;
        }
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public void m8750() {
        int length = ((Object[]) this.f14937).length;
        if (this.f14935 < length) {
            return;
        }
        int i = length * 2;
        long[] jArr = new long[i];
        Object[] objArr = new Object[i];
        int i2 = this.f14936;
        int i3 = length - i2;
        System.arraycopy((long[]) this.f14938, i2, jArr, 0, i3);
        System.arraycopy((Object[]) this.f14937, this.f14936, objArr, 0, i3);
        int i4 = this.f14936;
        if (i4 > 0) {
            System.arraycopy((long[]) this.f14938, 0, jArr, i3, i4);
            System.arraycopy((Object[]) this.f14937, 0, objArr, i3, this.f14936);
        }
        this.f14938 = jArr;
        this.f14937 = objArr;
        this.f14936 = 0;
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public synchronized int m8751() {
        return this.f14935;
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public void m8752(Typeface typeface) {
        int i;
        if (Build.VERSION.SDK_INT >= 28 && (i = this.f14936) != -1) {
            typeface = AbstractC3502.m7998(typeface, i, (this.f14935 & 2) != 0);
        }
        C2956 c2956 = (C2956) this.f14937;
        WeakReference weakReference = (WeakReference) this.f14938;
        if (c2956.f11449) {
            c2956.f11443 = typeface;
            TextView textView = (TextView) weakReference.get();
            if (textView != null) {
                boolean zIsAttachedToWindow = textView.isAttachedToWindow();
                int i2 = c2956.f11452;
                if (zIsAttachedToWindow) {
                    textView.post(new ᵦᵦᵰᵳ(textView, typeface, i2, 0));
                } else {
                    C2956.m7233(textView, typeface, i2);
                }
            }
        }
    }

    @Override // defpackage.InterfaceC1612
    /* renamed from: ˏˋٴ */
    public void mo4627() {
        C3493 c3493 = (C3493) this.f14937;
        byte[] bArr = AbstractC3558.f13330;
        c3493.getClass();
        c3493.m7975(bArr.length, bArr);
    }

    /* JADX WARN: Code restructure failed: missing block: B:32:0x00a8, code lost:
    
        if (r13 == r16) goto L35;
     */
    /* JADX WARN: Code restructure failed: missing block: B:34:0x00b2, code lost:
    
        return new defpackage.C5257(r13, -2, r4 + r6);
     */
    /* JADX WARN: Code restructure failed: missing block: B:36:0x00b5, code lost:
    
        return defpackage.C5257.f19690;
     */
    @Override // defpackage.InterfaceC1612
    /* renamed from: ˏᵙ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public defpackage.C5257 mo4628(defpackage.InterfaceC1383 r19, long r20) {
        /*
            r18 = this;
            r0 = r18
            long r4 = r19.getPosition()
            int r1 = r0.f14935
            long r1 = (long) r1
            long r6 = r19.getLength()
            long r6 = r6 - r4
            long r1 = java.lang.Math.min(r1, r6)
            int r1 = (int) r1
            java.lang.Object r2 = r0.f14937
            ᵥˁˋˁ r2 = (defpackage.C3493) r2
            r2.m7939(r1)
            byte[] r3 = r2.f13082
            r6 = 0
            r7 = r19
            r7.mo4249(r3, r6, r1)
            int r1 = r2.f13081
            r6 = -1
            r10 = r6
            r13 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
        L2c:
            int r3 = r2.m7959()
            r12 = 188(0xbc, float:2.63E-43)
            if (r3 < r12) goto La1
            byte[] r3 = r2.f13082
            int r12 = r2.f13083
        L38:
            if (r12 >= r1) goto L48
            r15 = r3[r12]
            r16 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
            r8 = 71
            if (r15 == r8) goto L4d
            int r12 = r12 + 1
            goto L38
        L48:
            r16 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
        L4d:
            int r3 = r12 + 188
            if (r3 <= r1) goto L52
            goto La6
        L52:
            int r6 = r0.f14936
            long r6 = ˏᵭᵔᵬ.ˌʾˀ(r2, r12, r6)
            int r8 = (r6 > r16 ? 1 : (r6 == r16 ? 0 : -1))
            if (r8 == 0) goto L9c
            java.lang.Object r8 = r0.f14938
            ˉᵻᵗ r8 = (defpackage.C1240) r8
            long r6 = r8.m3776(r6)
            int r8 = (r6 > r20 ? 1 : (r6 == r20 ? 0 : -1))
            if (r8 <= 0) goto L82
            int r0 = (r13 > r16 ? 1 : (r13 == r16 ? 0 : -1))
            if (r0 != 0) goto L74
            ᵼˉʓ r0 = new ᵼˉʓ
            r3 = -1
            r1 = r6
            r0.<init>(r1, r3, r4)
            return r0
        L74:
            long r16 = r4 + r10
            ᵼˉʓ r12 = new ᵼˉʓ
            r15 = 0
            r13 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
            r12.<init>(r13, r15, r16)
            return r12
        L82:
            r13 = r6
            r6 = 100000(0x186a0, double:4.94066E-319)
            long r6 = r6 + r13
            int r6 = (r6 > r20 ? 1 : (r6 == r20 ? 0 : -1))
            if (r6 <= 0) goto L9a
            long r0 = (long) r12
            long r10 = r4 + r0
            ᵼˉʓ r6 = new ᵼˉʓ
            r9 = 0
            r7 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
            r6.<init>(r7, r9, r10)
            return r6
        L9a:
            long r6 = (long) r12
            r10 = r6
        L9c:
            r2.m7955(r3)
            long r6 = (long) r3
            goto L2c
        La1:
            r16 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
        La6:
            int r0 = (r13 > r16 ? 1 : (r13 == r16 ? 0 : -1))
            if (r0 == 0) goto Lb3
            long r16 = r4 + r6
            ᵼˉʓ r12 = new ᵼˉʓ
            r15 = -2
            r12.<init>(r13, r15, r16)
            return r12
        Lb3:
            ᵼˉʓ r0 = defpackage.C5257.f19690
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3959.mo4628(ˊᵬᐧ, long):ᵼˉʓ");
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public synchronized Object m8753() {
        return this.f14935 == 0 ? null : m8757();
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public synchronized void m8754(long j, Object obj) {
        if (this.f14935 > 0) {
            if (j <= ((long[]) this.f14938)[((this.f14936 + r0) - 1) % ((Object[]) this.f14937).length]) {
                m8759();
            }
        }
        m8750();
        int i = this.f14936;
        int i2 = this.f14935;
        Object[] objArr = (Object[]) this.f14937;
        int length = (i + i2) % objArr.length;
        ((long[]) this.f14938)[length] = j;
        objArr[length] = obj;
        this.f14935 = i2 + 1;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public void m8755() {
        new Handler(Looper.getMainLooper()).post(new RunnableC4243(this));
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public synchronized Object m8756(long j) {
        return m8758(true, j);
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public Object m8757() {
        ᵛᵾˏ.ᵿʗᵝʽ(this.f14935 > 0);
        Object[] objArr = (Object[]) this.f14937;
        int i = this.f14936;
        Object obj = objArr[i];
        objArr[i] = null;
        this.f14936 = (i + 1) % objArr.length;
        this.f14935--;
        return obj;
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public Object m8758(boolean z, long j) {
        Object objM8757 = null;
        long j2 = Long.MAX_VALUE;
        while (this.f14935 > 0) {
            long j3 = j - ((long[]) this.f14938)[this.f14936];
            if (j3 < 0 && (z || (-j3) >= j2)) {
                break;
            }
            objM8757 = m8757();
            j2 = j3;
        }
        return objM8757;
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public synchronized void m8759() {
        this.f14936 = 0;
        this.f14935 = 0;
        Arrays.fill((Object[]) this.f14937, (Object) null);
    }
}
