package defpackage;

import android.graphics.Typeface;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.widget.TextView;
import com.google.android.gms.internal.play_billing.zzfv;
import java.lang.ref.WeakReference;
import java.util.Arrays;

/* JADX INFO: renamed from: ˁᵳˈ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0760 implements InterfaceC4978 {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public int f3417;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public Object f3418;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public int f3419;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public Object f3420;

    public C0760() {
        this.f3418 = new long[10];
        this.f3420 = new Object[10];
    }

    public C0760(int i, float[] fArr, float[] fArr2, int i2) {
        this.f3417 = i;
        ᵻᵪ.ᵱᵽʡᵚ(((long) fArr.length) * 2 == ((long) fArr2.length) * 3);
        this.f3418 = fArr;
        this.f3420 = fArr2;
        this.f3419 = i2;
    }

    public C0760(C0760 c0760) {
        float[] fArr = (float[]) c0760.f3418;
        this.f3417 = fArr.length / 3;
        this.f3418 = ᵺᵘ.ᵝᵶ(fArr);
        this.f3420 = ᵺᵘ.ᵝᵶ((float[]) c0760.f3420);
        int i = c0760.f3419;
        if (i == 1) {
            this.f3419 = 5;
        } else if (i != 2) {
            this.f3419 = 4;
        } else {
            this.f3419 = 6;
        }
    }

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public static int m2708(int i) {
        return (352 - (Integer.numberOfLeadingZeros(i) * 9)) >>> 6;
    }

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public static int m2709(long j) {
        return (640 - (Long.numberOfLeadingZeros(j) * 9)) >>> 6;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public synchronized void m2710(long j, Object obj) {
        if (this.f3419 > 0) {
            if (j <= ((long[]) this.f3418)[((this.f3417 + r0) - 1) % ((Object[]) this.f3420).length]) {
                m2723();
            }
        }
        m2734();
        int i = this.f3417;
        int i2 = this.f3419;
        Object[] objArr = (Object[]) this.f3420;
        int length = (i + i2) % objArr.length;
        ((long[]) this.f3418)[length] = j;
        objArr[length] = obj;
        this.f3419 = i2 + 1;
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public void m2711(int i, int i2) throws zzfv {
        m2720(i << 3);
        m2717(i2);
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public void m2712(long j) throws zzfv {
        int i = this.f3419;
        try {
            byte[] bArr = (byte[]) this.f3420;
            bArr[i] = (byte) j;
            bArr[i + 1] = (byte) (j >> 8);
            bArr[i + 2] = (byte) (j >> 16);
            bArr[i + 3] = (byte) (j >> 24);
            bArr[i + 4] = (byte) (j >> 32);
            bArr[i + 5] = (byte) (j >> 40);
            bArr[i + 6] = (byte) (j >> 48);
            bArr[i + 7] = (byte) (j >> 56);
            this.f3419 = i + 8;
        } catch (IndexOutOfBoundsException e) {
            throw new zzfv(i, this.f3417, 8, e);
        }
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public void m2713(int i, int i2) throws zzfv {
        m2720((i << 3) | i2);
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public Object m2714(boolean z, long j) {
        Object objM2731 = null;
        long j2 = Long.MAX_VALUE;
        while (this.f3419 > 0) {
            long j3 = j - ((long[]) this.f3418)[this.f3417];
            if (j3 < 0 && (z || (-j3) >= j2)) {
                break;
            }
            objM2731 = m2731();
            j2 = j3;
        }
        return objM2731;
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public void m2715(byte[] bArr, int i, int i2) throws zzfv {
        try {
            System.arraycopy(bArr, i, (byte[]) this.f3420, this.f3419, i2);
            this.f3419 += i2;
        } catch (IndexOutOfBoundsException e) {
            throw new zzfv(this.f3419, this.f3417, i2, e);
        }
    }

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public void m2716(int i, int i2) throws zzfv {
        m2720(i << 3);
        m2720(i2);
    }

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public void m2717(int i) throws zzfv {
        IndexOutOfBoundsException indexOutOfBoundsException;
        byte[] bArr;
        int i2;
        int i3;
        int i4;
        if (i >= 0) {
            m2720(i);
            return;
        }
        int i5 = this.f3419;
        try {
            bArr = (byte[]) this.f3420;
            long j = i;
            i2 = i5 + 1;
            try {
                bArr[i5] = (byte) (((int) j) | 128);
                int i6 = i5 + 2;
                try {
                    bArr[i2] = (byte) (((int) (j >>> 7)) | 128);
                    int i7 = i5 + 3;
                    bArr[i6] = (byte) (((int) (j >>> 14)) | 128);
                    i6 = i5 + 4;
                    bArr[i7] = (byte) (((int) (j >>> 21)) | 128);
                    i3 = i5 + 5;
                    bArr[i6] = (byte) (((int) (j >>> 28)) | 128);
                    i4 = i5 + 6;
                } catch (IndexOutOfBoundsException e) {
                    indexOutOfBoundsException = e;
                    i5 = i6;
                }
            } catch (IndexOutOfBoundsException e2) {
                i5 = i2;
                indexOutOfBoundsException = e2;
            }
        } catch (IndexOutOfBoundsException e3) {
            indexOutOfBoundsException = e3;
        }
        try {
            bArr[i3] = -1;
            int i8 = i5 + 7;
            bArr[i4] = -1;
            i4 = i5 + 8;
            bArr[i8] = -1;
            i2 = i5 + 9;
            bArr[i4] = -1;
            i5 += 10;
            bArr[i2] = 1;
            this.f3419 = i5;
        } catch (IndexOutOfBoundsException e4) {
            indexOutOfBoundsException = e4;
            i5 = i4;
            throw new zzfv(i5, this.f3417, 10, indexOutOfBoundsException);
        }
    }

    @Override // defpackage.InterfaceC4978
    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public void mo2718() {
        C4545 c4545 = (C4545) this.f3420;
        byte[] bArr = AbstractC0956.f4216;
        c4545.getClass();
        c4545.m9600(bArr.length, bArr);
    }

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public void m2719(long j, int i) throws zzfv {
        m2720(i << 3);
        m2724(j);
    }

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public void m2720(int i) throws zzfv {
        IndexOutOfBoundsException indexOutOfBoundsException;
        int i2 = this.f3419;
        int i3 = i & (-128);
        byte[] bArr = (byte[]) this.f3420;
        try {
        } catch (IndexOutOfBoundsException e) {
            indexOutOfBoundsException = e;
        }
        if (i3 == 0) {
            int i4 = i2 + 1;
            bArr[i2] = (byte) i;
            this.f3419 = i4;
            return;
        }
        int i5 = i2 + 1;
        bArr[i2] = (byte) (i | 128);
        int i6 = i >>> 7;
        try {
        } catch (IndexOutOfBoundsException e2) {
            i3 = i;
            indexOutOfBoundsException = e2;
        }
        if ((i6 & (-128)) == 0) {
            int i7 = i2 + 2;
            bArr[i5] = (byte) i6;
            this.f3419 = i7;
            return;
        }
        int i8 = i2 + 2;
        try {
            bArr[i5] = (byte) (i6 | 128);
            int i9 = i >>> 14;
            if ((i9 & (-128)) == 0) {
                int i10 = i2 + 3;
                bArr[i8] = (byte) i9;
                this.f3419 = i10;
                return;
            }
            int i11 = i2 + 3;
            try {
                bArr[i8] = (byte) (i9 | 128);
                int i12 = i >>> 21;
                if ((i12 & (-128)) == 0) {
                    int i13 = i2 + 4;
                    bArr[i11] = (byte) i12;
                    this.f3419 = i13;
                    return;
                } else {
                    i8 = i2 + 4;
                    bArr[i11] = (byte) (i12 | 128);
                    int i14 = i2 + 5;
                    bArr[i8] = (byte) (i >>> 28);
                    this.f3419 = i14;
                    return;
                }
            } catch (IndexOutOfBoundsException e3) {
                indexOutOfBoundsException = e3;
                i3 = i11;
            }
        } catch (IndexOutOfBoundsException e4) {
            indexOutOfBoundsException = e4;
            i3 = i8;
        }
        throw new zzfv(i3, this.f3417, 1, indexOutOfBoundsException);
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public void m2721(byte b) throws zzfv {
        IndexOutOfBoundsException indexOutOfBoundsException;
        int i = this.f3419;
        try {
            int i2 = i + 1;
            try {
                ((byte[]) this.f3420)[i] = b;
                this.f3419 = i2;
            } catch (IndexOutOfBoundsException e) {
                indexOutOfBoundsException = e;
                i = i2;
                throw new zzfv(i, this.f3417, 1, indexOutOfBoundsException);
            }
        } catch (IndexOutOfBoundsException e2) {
            indexOutOfBoundsException = e2;
        }
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public void m2722(int i) throws zzfv {
        int i2 = this.f3419;
        try {
            byte[] bArr = (byte[]) this.f3420;
            bArr[i2] = (byte) i;
            bArr[i2 + 1] = (byte) (i >> 8);
            bArr[i2 + 2] = (byte) (i >> 16);
            bArr[i2 + 3] = (byte) (i >> 24);
            this.f3419 = i2 + 4;
        } catch (IndexOutOfBoundsException e) {
            throw new zzfv(i2, this.f3417, 4, e);
        }
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public synchronized void m2723() {
        this.f3417 = 0;
        this.f3419 = 0;
        Arrays.fill((Object[]) this.f3420, (Object) null);
    }

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public void m2724(long j) throws zzfv {
        long j2 = j & (-128);
        int i = this.f3419;
        byte[] bArr = (byte[]) this.f3420;
        try {
            if (j2 == 0) {
                bArr[i] = (byte) j;
                this.f3419 = i + 1;
                return;
            }
            bArr[i] = (byte) (((int) j) | 128);
            int i2 = i + 1;
            long j3 = j >>> 7;
            long j4 = j3 & (-128);
            int i3 = (int) j3;
            if (j4 == 0) {
                bArr[i2] = (byte) i3;
                this.f3419 = i + 2;
                return;
            }
            bArr[i2] = (byte) (i3 | 128);
            int i4 = i + 2;
            long j5 = j >>> 14;
            long j6 = j5 & (-128);
            int i5 = (int) j5;
            if (j6 == 0) {
                bArr[i4] = (byte) i5;
                this.f3419 = i + 3;
                return;
            }
            bArr[i4] = (byte) (i5 | 128);
            int i6 = i + 3;
            long j7 = j >>> 21;
            long j8 = j7 & (-128);
            int i7 = (int) j7;
            if (j8 == 0) {
                bArr[i6] = (byte) i7;
                this.f3419 = i + 4;
                return;
            }
            bArr[i6] = (byte) (i7 | 128);
            int i8 = i + 4;
            long j9 = j >>> 28;
            long j10 = j9 & (-128);
            int i9 = (int) j9;
            if (j10 == 0) {
                bArr[i8] = (byte) i9;
                this.f3419 = i + 5;
                return;
            }
            bArr[i8] = (byte) (i9 | 128);
            int i10 = i + 5;
            long j11 = j >>> 35;
            long j12 = j11 & (-128);
            int i11 = (int) j11;
            if (j12 == 0) {
                bArr[i10] = (byte) i11;
                this.f3419 = i + 6;
                return;
            }
            bArr[i10] = (byte) (i11 | 128);
            int i12 = i + 6;
            long j13 = j >>> 42;
            long j14 = j13 & (-128);
            int i13 = (int) j13;
            if (j14 == 0) {
                bArr[i12] = (byte) i13;
                this.f3419 = i + 7;
                return;
            }
            bArr[i12] = (byte) (i13 | 128);
            int i14 = i + 7;
            long j15 = j >>> 49;
            long j16 = j15 & (-128);
            int i15 = (int) j15;
            if (j16 == 0) {
                bArr[i14] = (byte) i15;
                this.f3419 = i + 8;
                return;
            }
            bArr[i14] = (byte) (i15 | 128);
            int i16 = i + 8;
            long j17 = j >>> 56;
            int i17 = (int) j17;
            if (((-128) & j17) == 0) {
                bArr[i16] = (byte) i17;
                this.f3419 = i + 9;
            } else {
                bArr[i16] = (byte) (i17 | 128);
                bArr[i + 9] = (byte) (j >>> 63);
                this.f3419 = i + 10;
            }
        } catch (IndexOutOfBoundsException e) {
            throw new zzfv(i, this.f3417, 1, e);
        }
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public void m2725(int i, int i2) throws zzfv {
        m2720((i << 3) | 5);
        m2722(i2);
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public synchronized int m2726() {
        return this.f3419;
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public void m2727(long j, int i) throws zzfv {
        m2720((i << 3) | 1);
        m2712(j);
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public synchronized Object m2728(long j) {
        return m2714(true, j);
    }

    /* 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.C2744(r13, -2, r4 + r6);
     */
    /* JADX WARN: Code restructure failed: missing block: B:36:0x00b5, code lost:
    
        return defpackage.C2744.f10548;
     */
    @Override // defpackage.InterfaceC4978
    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C2744 mo2729(InterfaceC5206 interfaceC5206, long j) {
        long j2;
        long position = interfaceC5206.getPosition();
        int iMin = (int) Math.min(this.f3419, interfaceC5206.getLength() - position);
        C4545 c4545 = (C4545) this.f3420;
        c4545.m9603(iMin);
        interfaceC5206.mo4701(c4545.f17284, 0, iMin);
        int i = c4545.f17283;
        long j3 = -1;
        long j4 = -1;
        long j5 = -9223372036854775807L;
        while (true) {
            if (c4545.m9623() < 188) {
                j2 = -9223372036854775807L;
                break;
            }
            byte[] bArr = c4545.f17284;
            int i2 = c4545.f17282;
            while (true) {
                if (i2 >= i) {
                    j2 = -9223372036854775807L;
                    break;
                }
                j2 = -9223372036854775807L;
                if (bArr[i2] == 71) {
                    break;
                }
                i2++;
            }
            int i3 = i2 + 188;
            if (i3 > i) {
                break;
            }
            long j6 = ᵴᵧˈ.ᵱʡˏ(c4545, i2, this.f3417);
            if (j6 != j2) {
                long jM1133 = ((C0085) this.f3418).m1133(j6);
                if (jM1133 > j) {
                    return j5 == j2 ? new C2744(jM1133, -1, position) : new C2744(-9223372036854775807L, 0, position + j4);
                }
                j5 = jM1133;
                if (100000 + j5 > j) {
                    return new C2744(-9223372036854775807L, 0, position + ((long) i2));
                }
                j4 = i2;
            }
            c4545.m9624(i3);
            j3 = i3;
        }
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public void m2730(Typeface typeface) {
        int i;
        if (Build.VERSION.SDK_INT >= 28 && (i = this.f3417) != -1) {
            typeface = AbstractC0562.m2170(typeface, i, (this.f3419 & 2) != 0);
        }
        C2938 c2938 = (C2938) this.f3420;
        WeakReference weakReference = (WeakReference) this.f3418;
        if (c2938.f11304) {
            c2938.f11308 = typeface;
            TextView textView = (TextView) weakReference.get();
            if (textView != null) {
                boolean zIsAttachedToWindow = textView.isAttachedToWindow();
                int i2 = c2938.f11309;
                if (zIsAttachedToWindow) {
                    textView.post(new ᵰᵫᵴᵚ(textView, typeface, i2, 0));
                } else {
                    C2938.m7011(textView, typeface, i2);
                }
            }
        }
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public Object m2731() {
        ᵻᵪ.ˌᴵ(this.f3419 > 0);
        Object[] objArr = (Object[]) this.f3420;
        int i = this.f3417;
        Object obj = objArr[i];
        objArr[i] = null;
        this.f3417 = (i + 1) % objArr.length;
        this.f3419--;
        return obj;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public void m2732() {
        new Handler(Looper.getMainLooper()).post(new RunnableC2286(this));
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public synchronized Object m2733() {
        return this.f3419 == 0 ? null : m2731();
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public void m2734() {
        int length = ((Object[]) this.f3420).length;
        if (this.f3419 < length) {
            return;
        }
        int i = length * 2;
        long[] jArr = new long[i];
        Object[] objArr = new Object[i];
        int i2 = this.f3417;
        int i3 = length - i2;
        System.arraycopy((long[]) this.f3418, i2, jArr, 0, i3);
        System.arraycopy((Object[]) this.f3420, this.f3417, objArr, 0, i3);
        int i4 = this.f3417;
        if (i4 > 0) {
            System.arraycopy((long[]) this.f3418, 0, jArr, i3, i4);
            System.arraycopy((Object[]) this.f3420, 0, objArr, i3, this.f3417);
        }
        this.f3418 = jArr;
        this.f3420 = objArr;
        this.f3417 = 0;
    }
}
