package o; import android.text.SpannableStringBuilder; import com.airbnb.deeplinkdispatch.UrlTreeKt; import java.util.Locale; /* loaded from: classes.dex */ public final class mju { private static mju a; private static mju b; static final InterfaceC16957sii c; private static final String d; private static final String j; public final InterfaceC16957sii e; private final int f; private final boolean g; /* loaded from: classes.dex */ public static final class Sts { boolean a = mju.d(Locale.getDefault()); InterfaceC16957sii b = mju.c; int c = 2; } static { InterfaceC16957sii interfaceC16957sii = Bww.d; c = interfaceC16957sii; d = Character.toString((char) 8206); j = Character.toString((char) 8207); b = new mju(false, 2, interfaceC16957sii); a = new mju(true, 2, interfaceC16957sii); } public static mju d() { Sts sts = new Sts(); if (sts.c == 2 && sts.b == c) { return sts.a ? a : b; } return new mju(sts.a, sts.c, sts.b); } private mju(boolean z, int i, InterfaceC16957sii interfaceC16957sii) { this.g = z; this.f = i; this.e = interfaceC16957sii; } public final CharSequence d(CharSequence charSequence, InterfaceC16957sii interfaceC16957sii) { String str; if (charSequence == null) { return null; } boolean b2 = interfaceC16957sii.b(charSequence, 0, charSequence.length()); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); String str2 = ""; if ((this.f & 2) != 0) { boolean b3 = (b2 ? Bww.g : Bww.b).b(charSequence, 0, charSequence.length()); if (this.g || !(b3 || d(charSequence) == 1)) { str = (!this.g || (b3 && d(charSequence) != -1)) ? "" : j; } else { str = d; } spannableStringBuilder.append((CharSequence) str); } if (b2 != this.g) { spannableStringBuilder.append(b2 ? (char) 8235 : (char) 8234); spannableStringBuilder.append(charSequence); spannableStringBuilder.append((char) 8236); } else { spannableStringBuilder.append(charSequence); } boolean b4 = (b2 ? Bww.g : Bww.b).b(charSequence, 0, charSequence.length()); if (!this.g && (b4 || e(charSequence) == 1)) { str2 = d; } else if (this.g && (!b4 || e(charSequence) == -1)) { str2 = j; } spannableStringBuilder.append((CharSequence) str2); return spannableStringBuilder; } static boolean d(Locale locale) { return C16959sjm.b(locale) == 1; } /* JADX WARN: Failed to find 'out' block for switch in B:33:0x0021. Please report as an issue. */ private static int e(CharSequence charSequence) { RVV rvv = new RVV(charSequence); rvv.a = rvv.b; int i = 0; while (true) { int i2 = i; while (rvv.a > 0) { byte c2 = rvv.c(); if (c2 != 0) { if (c2 == 1 || c2 == 2) { if (i2 == 0) { return 1; } if (i == 0) { break; } } else if (c2 != 9) { switch (c2) { case 14: case 15: if (i == i2) { return -1; } i2--; break; case 16: case 17: if (i == i2) { return 1; } i2--; break; case 18: i2++; break; default: if (i != 0) { break; } else { break; } break; } } else { continue; } } else { if (i2 == 0) { return -1; } if (i == 0) { break; } } } return 0; i = i2; } } /* JADX WARN: Code restructure failed: missing block: B:70:0x0092, code lost: if (r5 == '&') goto L31; */ /* JADX WARN: Code restructure failed: missing block: B:71:0x0094, code lost: r4 = r0.a; */ /* JADX WARN: Code restructure failed: missing block: B:72:0x0098, code lost: if (r4 >= r0.b) goto L96; */ /* JADX WARN: Code restructure failed: missing block: B:73:0x009a, code lost: r5 = r0.c; r0.a = r4 + 1; r4 = r5.charAt(r4); r0.d = r4; */ /* JADX WARN: Code restructure failed: missing block: B:74:0x00a8, code lost: if (r4 != ';') goto L97; */ /* JADX WARN: Failed to find 'out' block for switch in B:85:0x00df. Please report as an issue. */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static int d(java.lang.CharSequence r13) { /* Method dump skipped, instructions count: 268 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.mju.d(java.lang.CharSequence):int"); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class RVV { private static final byte[] i = new byte[1792]; int a; final int b; final CharSequence c; char d; final boolean e = false; static { for (int i2 = 0; i2 < 1792; i2++) { i[i2] = Character.getDirectionality(i2); } } RVV(CharSequence charSequence) { this.c = charSequence; this.b = charSequence.length(); } static byte a(char c) { return c < 1792 ? i[c] : Character.getDirectionality(c); } final byte c() { char charAt = this.c.charAt(this.a - 1); this.d = charAt; if (Character.isLowSurrogate(charAt)) { int codePointBefore = Character.codePointBefore(this.c, this.a); this.a -= Character.charCount(codePointBefore); return Character.getDirectionality(codePointBefore); } this.a--; char c = this.d; byte directionality = c < 1792 ? i[c] : Character.getDirectionality(c); if (!this.e) { return directionality; } char c2 = this.d; if (c2 == '>') { return e(); } return c2 == ';' ? a() : directionality; } private byte e() { char charAt; int i2 = this.a; while (true) { int i3 = this.a; if (i3 <= 0) { break; } CharSequence charSequence = this.c; int i4 = i3 - 1; this.a = i4; char charAt2 = charSequence.charAt(i4); this.d = charAt2; if (charAt2 != '<') { if (charAt2 == '>') { break; } if (charAt2 == '\"' || charAt2 == '\'') { do { int i5 = this.a; if (i5 > 0) { CharSequence charSequence2 = this.c; int i6 = i5 - 1; this.a = i6; charAt = charSequence2.charAt(i6); this.d = charAt; } } while (charAt != charAt2); } } else { return (byte) 12; } } this.a = i2; this.d = UrlTreeKt.configurablePathSegmentSuffixChar; return (byte) 13; } private byte a() { char charAt; int i2 = this.a; do { int i3 = this.a; if (i3 <= 0) { break; } CharSequence charSequence = this.c; int i4 = i3 - 1; this.a = i4; charAt = charSequence.charAt(i4); this.d = charAt; if (charAt == '&') { return (byte) 12; } } while (charAt != ';'); this.a = i2; this.d = ';'; return (byte) 13; } } }