package o;

import android.graphics.Typeface;
import com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import okhttp3.internal.publicsuffix.PublicSuffixDatabase;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class BP implements InterfaceC1489ia0, InterfaceC2049oS, InterfaceC1769lX, InterfaceC3098zX, InterfaceC0912cZ, InterfaceC0092Do, S40, InterfaceC0256Jw, InterfaceC0320Mj {
    public static BP m;
    public static final /* synthetic */ BP n = new BP(28);

    /* renamed from: o, reason: collision with root package name */
    public static final /* synthetic */ BP f53o = new BP(29);
    public final /* synthetic */ int l;

    public /* synthetic */ BP(int i) {
        this.l = i;
    }

    public static final String h(byte[] bArr, byte[][] bArr2, int i) {
        int i2;
        boolean z;
        int i3;
        int i4;
        byte[] bArr3 = PublicSuffixDatabase.e;
        int length = bArr.length;
        int i5 = 0;
        while (i5 < length) {
            int i6 = (i5 + length) / 2;
            while (i6 > -1 && bArr[i6] != 10) {
                i6--;
            }
            int i7 = i6 + 1;
            int i8 = 1;
            while (true) {
                i2 = i7 + i8;
                if (bArr[i2] == 10) {
                    break;
                }
                i8++;
            }
            int i9 = i2 - i7;
            int i10 = i;
            boolean z2 = false;
            int i11 = 0;
            int i12 = 0;
            while (true) {
                if (z2) {
                    i3 = 46;
                    z = false;
                } else {
                    byte b = bArr2[i10][i11];
                    byte[] bArr4 = AbstractC2264qi0.a;
                    int i13 = b & 255;
                    z = z2;
                    i3 = i13;
                }
                byte b2 = bArr[i7 + i12];
                byte[] bArr5 = AbstractC2264qi0.a;
                i4 = i3 - (b2 & 255);
                if (i4 != 0) {
                    break;
                }
                i12++;
                i11++;
                if (i12 == i9) {
                    break;
                }
                if (bArr2[i10].length != i11) {
                    z2 = z;
                } else {
                    if (i10 == bArr2.length - 1) {
                        break;
                    }
                    i10++;
                    i11 = -1;
                    z2 = true;
                }
            }
            if (i4 >= 0) {
                if (i4 <= 0) {
                    int i14 = i9 - i12;
                    int length2 = bArr2[i10].length - i11;
                    int length3 = bArr2.length;
                    for (int i15 = i10 + 1; i15 < length3; i15++) {
                        length2 += bArr2[i15].length;
                    }
                    if (length2 >= i14) {
                        if (length2 <= i14) {
                            return new String(bArr, i7, i9, StandardCharsets.UTF_8);
                        }
                    }
                }
                i5 = i2 + 1;
            }
            length = i6;
        }
        return null;
    }

    public static final int k(int i, long j) {
        int i2 = AbstractC1309gg0.b;
        return ((int) (j >> (i * 15))) & 32767;
    }

    public static Typeface l(String str, OA oa, int i) {
        if (i == 0 && F3.c(oa, OA.n) && (str == null || str.length() == 0)) {
            return Typeface.DEFAULT;
        }
        int iU = AbstractC2001nt0.u(oa, i);
        return (str == null || str.length() == 0) ? Typeface.defaultFromStyle(iU) : Typeface.create(str, iU);
    }

    public static SV m(File file) {
        String str = SV.m;
        String string = file.toString();
        C0135Ff c0135Ff = AbstractC1153f.a;
        C0732af c0732af = new C0732af();
        c0732af.V(string);
        return AbstractC1153f.d(c0732af, false);
    }

    public static SV n(String str) {
        C0135Ff c0135Ff = AbstractC1153f.a;
        C0732af c0732af = new C0732af();
        c0732af.V(str);
        return AbstractC1153f.d(c0732af, false);
    }

    public static AbstractC2220q90 o() {
        return (AbstractC2220q90) AbstractC2884x90.b.get();
    }

    public static AbstractC2220q90 q(AbstractC2220q90 abstractC2220q90) {
        if (abstractC2220q90 instanceof Og0) {
            Og0 og0 = (Og0) abstractC2220q90;
            if (og0.t == AbstractC2539te.v()) {
                og0.r = null;
                return abstractC2220q90;
            }
        }
        if (abstractC2220q90 instanceof Pg0) {
            Pg0 pg0 = (Pg0) abstractC2220q90;
            if (pg0.i == AbstractC2539te.v()) {
                pg0.h = null;
                return abstractC2220q90;
            }
        }
        AbstractC2220q90 abstractC2220q90H = AbstractC2884x90.h(abstractC2220q90, null, false);
        abstractC2220q90H.j();
        return abstractC2220q90H;
    }

    public static Object r(NC nc, OC oc) {
        AbstractC2220q90 og0;
        if (oc == null) {
            return nc.a();
        }
        AbstractC2220q90 abstractC2220q90 = (AbstractC2220q90) AbstractC2884x90.b.get();
        if (abstractC2220q90 instanceof Og0) {
            Og0 og02 = (Og0) abstractC2220q90;
            if (og02.t == AbstractC2539te.v()) {
                OC oc2 = og02.r;
                OC oc3 = og02.s;
                try {
                    ((Og0) abstractC2220q90).r = AbstractC2884x90.l(oc, oc2, true);
                    ((Og0) abstractC2220q90).s = oc3;
                    return nc.a();
                } finally {
                    og02.r = oc2;
                    og02.s = oc3;
                }
            }
        }
        if (abstractC2220q90 == null || (abstractC2220q90 instanceof C1095eR)) {
            og0 = new Og0(abstractC2220q90 instanceof C1095eR ? (C1095eR) abstractC2220q90 : null, oc, null, true, false);
        } else {
            if (oc == null) {
                return nc.a();
            }
            og0 = abstractC2220q90.u(oc);
        }
        try {
            AbstractC2220q90 abstractC2220q90J = og0.j();
            try {
                Object objA = nc.a();
                AbstractC2220q90.q(abstractC2220q90J);
                og0.c();
                return objA;
            } catch (Throwable th) {
                AbstractC2220q90.q(abstractC2220q90J);
                throw th;
            }
        } catch (Throwable th2) {
            og0.c();
            throw th2;
        }
    }

    public static long s(int i, int i2, int i3, int i4) {
        return ((i2 & 32767) << 15) | (i & 32767) | ((i3 & 32767) << 30) | ((i4 & 32767) << 45) | Long.MIN_VALUE;
    }

    public static void t(AbstractC2220q90 abstractC2220q90, AbstractC2220q90 abstractC2220q902, OC oc) {
        if (abstractC2220q90 != abstractC2220q902) {
            abstractC2220q902.getClass();
            AbstractC2220q90.q(abstractC2220q90);
            abstractC2220q902.c();
        } else if (abstractC2220q90 instanceof Og0) {
            ((Og0) abstractC2220q90).r = oc;
        } else if (abstractC2220q90 instanceof Pg0) {
            ((Pg0) abstractC2220q90).h = oc;
        } else {
            throw new IllegalStateException(("Non-transparent snapshot was reused: " + abstractC2220q90).toString());
        }
    }

    @Override // o.InterfaceC2049oS
    public boolean a(LP lp) {
        return false;
    }

    @Override // o.InterfaceC2049oS
    public int b() {
        return 8;
    }

    @Override // o.InterfaceC2049oS
    public boolean c(C2420sK c2420sK) {
        N50 n50U = c2420sK.u();
        boolean z = false;
        if (n50U != null && n50U.f250o) {
            z = true;
        }
        return !z;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0054  */
    @Override // o.InterfaceC1489ia0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public java.lang.StackTraceElement[] d(java.lang.StackTraceElement[] r15) {
        /*
            r14 = this;
            int r0 = r14.l
            switch(r0) {
                case 0: goto L70;
                default: goto L5;
            }
        L5:
            java.util.HashMap r0 = new java.util.HashMap
            r0.<init>()
            int r1 = r15.length
            java.lang.StackTraceElement[] r1 = new java.lang.StackTraceElement[r1]
            r2 = 0
            r3 = 1
            r4 = r2
            r5 = r4
            r6 = r3
        L12:
            int r7 = r15.length
            if (r4 >= r7) goto L66
            r7 = r15[r4]
            java.lang.Object r8 = r0.get(r7)
            java.lang.Integer r8 = (java.lang.Integer) r8
            if (r8 == 0) goto L54
            int r9 = r8.intValue()
            int r10 = r4 - r9
            int r11 = r4 + r10
            int r12 = r15.length
            if (r11 <= r12) goto L2b
            goto L54
        L2b:
            r11 = r2
        L2c:
            if (r11 >= r10) goto L40
            int r12 = r9 + r11
            r12 = r15[r12]
            int r13 = r4 + r11
            r13 = r15[r13]
            boolean r12 = r12.equals(r13)
            if (r12 != 0) goto L3d
            goto L54
        L3d:
            int r11 = r11 + 1
            goto L2c
        L40:
            int r8 = r8.intValue()
            int r8 = r4 - r8
            r9 = 10
            if (r6 >= r9) goto L50
            java.lang.System.arraycopy(r15, r4, r1, r5, r8)
            int r5 = r5 + r8
            int r6 = r6 + 1
        L50:
            int r8 = r8 + (-1)
            int r8 = r8 + r4
            goto L5c
        L54:
            r6 = r15[r4]
            r1[r5] = r6
            int r5 = r5 + 1
            r6 = r3
            r8 = r4
        L5c:
            java.lang.Integer r4 = java.lang.Integer.valueOf(r4)
            r0.put(r7, r4)
            int r4 = r8 + 1
            goto L12
        L66:
            java.lang.StackTraceElement[] r0 = new java.lang.StackTraceElement[r5]
            java.lang.System.arraycopy(r1, r2, r0, r2, r5)
            int r1 = r15.length
            if (r5 >= r1) goto L6f
            r15 = r0
        L6f:
            return r15
        L70:
            int r0 = r15.length
            r1 = 1024(0x400, float:1.435E-42)
            if (r0 > r1) goto L76
            goto L84
        L76:
            java.lang.StackTraceElement[] r0 = new java.lang.StackTraceElement[r1]
            r1 = 0
            r2 = 512(0x200, float:7.17E-43)
            java.lang.System.arraycopy(r15, r1, r0, r1, r2)
            int r1 = r15.length
            int r1 = r1 - r2
            java.lang.System.arraycopy(r15, r1, r0, r2, r2)
            r15 = r0
        L84:
            return r15
        */
        throw new UnsupportedOperationException("Method not decompiled: o.BP.d(java.lang.StackTraceElement[]):java.lang.StackTraceElement[]");
    }

    @Override // o.InterfaceC2049oS
    public void e(C2420sK c2420sK, long j, C1275gF c1275gF, int i, boolean z) {
        C0312Mb c0312Mb = c2420sK.N;
        AbstractC2239qS abstractC2239qS = (AbstractC2239qS) c0312Mb.e;
        L20 l20 = AbstractC2239qS.U;
        ((AbstractC2239qS) c0312Mb.e).U0(AbstractC2239qS.Y, abstractC2239qS.M0(j), c1275gF, 1, z);
    }

    @Override // o.InterfaceC3098zX
    public Typeface g(OA oa, int i) {
        return l(null, oa, i);
    }

    @Override // o.InterfaceC0320Mj
    public /* synthetic */ Object i(U7 u7) {
        return AnalyticsConnectorRegistrar.lambda$getComponents$0(u7);
    }

    /* JADX WARN: Removed duplicated region for block: B:11:0x001b  */
    @Override // o.InterfaceC3098zX
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public android.graphics.Typeface j(o.HD r5, o.OA r6, int r7) {
        /*
            r4 = this;
            r5.getClass()
            int r5 = r6.l
            int r5 = r5 / 100
            java.lang.String r0 = "sans-serif"
            r1 = 2
            if (r5 < 0) goto L11
            if (r5 >= r1) goto L11
            java.lang.String r5 = "sans-serif-thin"
            goto L33
        L11:
            r2 = 4
            if (r1 > r5) goto L19
            if (r5 >= r2) goto L19
            java.lang.String r5 = "sans-serif-light"
            goto L33
        L19:
            if (r5 != r2) goto L1d
        L1b:
            r5 = r0
            goto L33
        L1d:
            r1 = 5
            if (r5 != r1) goto L23
            java.lang.String r5 = "sans-serif-medium"
            goto L33
        L23:
            r1 = 6
            r2 = 8
            if (r1 > r5) goto L2b
            if (r5 >= r2) goto L2b
            goto L1b
        L2b:
            if (r2 > r5) goto L1b
            r1 = 11
            if (r5 >= r1) goto L1b
            java.lang.String r5 = "sans-serif-black"
        L33:
            int r1 = r5.length()
            r2 = 0
            if (r1 != 0) goto L3b
            goto L5a
        L3b:
            android.graphics.Typeface r5 = l(r5, r6, r7)
            android.graphics.Typeface r1 = android.graphics.Typeface.DEFAULT
            int r3 = o.AbstractC2001nt0.u(r6, r7)
            android.graphics.Typeface r1 = android.graphics.Typeface.create(r1, r3)
            boolean r1 = o.F3.c(r5, r1)
            if (r1 != 0) goto L5a
            android.graphics.Typeface r1 = l(r2, r6, r7)
            boolean r1 = o.F3.c(r5, r1)
            if (r1 != 0) goto L5a
            r2 = r5
        L5a:
            if (r2 != 0) goto L61
            android.graphics.Typeface r5 = l(r0, r6, r7)
            return r5
        L61:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: o.BP.j(o.HD, o.OA, int):android.graphics.Typeface");
    }

    public boolean p(CharSequence charSequence) {
        return false;
    }

    public String toString() {
        switch (this.l) {
            case 16:
                return "SharingStarted.Lazily";
            default:
                return super.toString();
        }
    }

    public BP() {
        this.l = 27;
        List list = Collections.EMPTY_LIST;
    }

    @Override // o.InterfaceC0912cZ
    public void f(int i, Object obj) {
    }

    @Override // o.S40
    public void onScrollLimit(int i, int i2, int i3, boolean z) {
    }

    @Override // o.S40
    public void onScrollProgress(int i, int i2, int i3, int i4) {
    }
}
