package g.m0;

import g.c0.r;
import g.h0.b.l;
import g.h0.c.e0;
import g.h0.c.m;
import g.s;
import g.u;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: compiled from: Indent.kt */
/* JADX INFO: loaded from: classes.dex */
@g.i
public class f extends e {

    /* JADX INFO: compiled from: Indent.kt */
    @g.i
    public static final class a extends m implements l<String, String> {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public static final a f4169b = new a();

        public a() {
            super(1);
        }

        @Override // g.h0.b.l
        public String invoke(String str) {
            String str2 = str;
            g.h0.c.l.f(str2, "line");
            return str2;
        }
    }

    /* JADX INFO: compiled from: Indent.kt */
    @g.i
    public static final class b extends m implements l<String, String> {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final /* synthetic */ String f4170b;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public b(String str) {
            super(1);
            this.f4170b = str;
        }

        @Override // g.h0.b.l
        public String invoke(String str) {
            String str2 = str;
            g.h0.c.l.f(str2, "line");
            return d.b.a.a.a.v(new StringBuilder(), this.f4170b, str2);
        }
    }

    public static String A(String str, String str2, String str3, boolean z, int i2) {
        int i3 = 0;
        if ((i2 & 4) != 0) {
            z = false;
        }
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str2, "oldValue");
        g.h0.c.l.f(str3, "newValue");
        int i4 = i(str, str2, 0, z);
        if (i4 < 0) {
            return str;
        }
        int length = str2.length();
        int i5 = length >= 1 ? length : 1;
        int length2 = str3.length() + (str.length() - length);
        if (length2 < 0) {
            throw new OutOfMemoryError();
        }
        StringBuilder sb = new StringBuilder(length2);
        do {
            sb.append((CharSequence) str, i3, i4);
            sb.append(str3);
            i3 = i4 + length;
            if (i4 >= str.length()) {
                break;
            }
            i4 = i(str, str2, i4 + i5, z);
        } while (i4 > 0);
        sb.append((CharSequence) str, i3, str.length());
        String string = sb.toString();
        g.h0.c.l.e(string, "stringBuilder.append(this, i, length).toString()");
        return string;
    }

    public static final void B(int i2) {
        if (!(i2 >= 0)) {
            throw new IllegalArgumentException(d.b.a.a.a.j("Limit must be non-negative, but was ", i2).toString());
        }
    }

    public static final List<String> C(CharSequence charSequence, String str, boolean z, int i2) {
        B(i2);
        int length = 0;
        int i3 = i(charSequence, str, 0, z);
        if (i3 != -1) {
            if (i2 != 1) {
                boolean z2 = i2 > 0;
                int i4 = 10;
                if (z2 && i2 <= 10) {
                    i4 = i2;
                }
                ArrayList arrayList = new ArrayList(i4);
                do {
                    arrayList.add(charSequence.subSequence(length, i3).toString());
                    length = str.length() + i3;
                    if (z2 && arrayList.size() == i2 - 1) {
                        break;
                    }
                    i3 = i(charSequence, str, length, z);
                } while (i3 != -1);
                arrayList.add(charSequence.subSequence(length, charSequence.length()).toString());
                return arrayList;
            }
        }
        return f.a.y.a.w0(charSequence.toString());
    }

    public static List D(CharSequence charSequence, char[] cArr, boolean z, int i2, int i3) {
        if ((i3 & 2) != 0) {
            z = false;
        }
        if ((i3 & 4) != 0) {
            i2 = 0;
        }
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(cArr, "delimiters");
        if (cArr.length == 1) {
            return C(charSequence, String.valueOf(cArr[0]), z, i2);
        }
        B(i2);
        g.m0.b bVar = new g.m0.b(charSequence, 0, i2, new g(cArr, z));
        g.h0.c.l.f(bVar, "<this>");
        g.l0.h hVar = new g.l0.h(bVar);
        ArrayList arrayList = new ArrayList(f.a.y.a.C(hVar, 10));
        Iterator it = hVar.iterator();
        while (it.hasNext()) {
            arrayList.add(K(charSequence, (g.j0.h) it.next()));
        }
        return arrayList;
    }

    public static List E(CharSequence charSequence, String[] strArr, boolean z, int i2, int i3) {
        boolean z2 = (i3 & 2) != 0 ? false : z;
        int i4 = (i3 & 4) != 0 ? 0 : i2;
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(strArr, "delimiters");
        if (strArr.length == 1) {
            String str = strArr[0];
            if (!(str.length() == 0)) {
                return C(charSequence, str, z2, i4);
            }
        }
        g.l0.d dVarU = u(charSequence, strArr, 0, z2, i4, 2);
        g.h0.c.l.f(dVarU, "<this>");
        g.l0.h hVar = new g.l0.h(dVarU);
        ArrayList arrayList = new ArrayList(f.a.y.a.C(hVar, 10));
        Iterator it = hVar.iterator();
        while (it.hasNext()) {
            arrayList.add(K(charSequence, (g.j0.h) it.next()));
        }
        return arrayList;
    }

    public static final boolean F(String str, String str2, int i2, boolean z) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str2, "prefix");
        return !z ? str.startsWith(str2, i2) : v(str, i2, str2, 0, str2.length(), z);
    }

    public static final boolean G(String str, String str2, boolean z) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str2, "prefix");
        return !z ? str.startsWith(str2) : v(str, 0, str2, 0, str2.length(), z);
    }

    public static boolean H(CharSequence charSequence, CharSequence charSequence2, boolean z, int i2) {
        boolean z2 = (i2 & 2) != 0 ? false : z;
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(charSequence2, "prefix");
        return (z2 || !(charSequence2 instanceof String)) ? x(charSequence, 0, charSequence2, 0, charSequence2.length(), z2) : J((String) charSequence, (String) charSequence2, false, 2);
    }

    public static /* synthetic */ boolean I(String str, String str2, int i2, boolean z, int i3) {
        if ((i3 & 4) != 0) {
            z = false;
        }
        return F(str, str2, i2, z);
    }

    public static /* synthetic */ boolean J(String str, String str2, boolean z, int i2) {
        if ((i2 & 2) != 0) {
            z = false;
        }
        return G(str, str2, z);
    }

    public static final String K(CharSequence charSequence, g.j0.h hVar) {
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(hVar, "range");
        return charSequence.subSequence(Integer.valueOf(hVar.f4123b).intValue(), Integer.valueOf(hVar.f4124e).intValue() + 1).toString();
    }

    public static String L(String str, String str2, String str3, int i2) {
        String str4 = (i2 & 2) != 0 ? str : null;
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str2, "delimiter");
        g.h0.c.l.f(str4, "missingDelimiterValue");
        int iM = m(str, str2, 0, false, 6);
        if (iM == -1) {
            return str4;
        }
        String strSubstring = str.substring(str2.length() + iM, str.length());
        g.h0.c.l.e(strSubstring, "this as java.lang.String…ing(startIndex, endIndex)");
        return strSubstring;
    }

    public static String M(String str, char c2, String str2, int i2) {
        String str3 = (i2 & 2) != 0 ? str : null;
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str3, "missingDelimiterValue");
        int iP = p(str, c2, 0, false, 6);
        if (iP == -1) {
            return str3;
        }
        String strSubstring = str.substring(iP + 1, str.length());
        g.h0.c.l.e(strSubstring, "this as java.lang.String…ing(startIndex, endIndex)");
        return strSubstring;
    }

    public static final Integer N(String str) {
        boolean z;
        int i2;
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str, "<this>");
        f.a.y.a.A(10);
        int length = str.length();
        if (length != 0) {
            int i3 = 0;
            char cCharAt = str.charAt(0);
            int i4 = -2147483647;
            int i5 = 1;
            if (g.h0.c.l.h(cCharAt, 48) >= 0) {
                z = false;
                i5 = 0;
            } else if (length != 1) {
                if (cCharAt == '-') {
                    i4 = Integer.MIN_VALUE;
                    z = true;
                } else if (cCharAt == '+') {
                    z = false;
                }
            }
            int i6 = -59652323;
            while (i5 < length) {
                int iDigit = Character.digit((int) str.charAt(i5), 10);
                if (iDigit >= 0 && ((i3 >= i6 || (i6 == -59652323 && i3 >= (i6 = i4 / 10))) && (i2 = i3 * 10) >= i4 + iDigit)) {
                    i3 = i2 - iDigit;
                    i5++;
                }
            }
            return z ? Integer.valueOf(i3) : Integer.valueOf(-i3);
        }
        return null;
    }

    public static final Long O(String str) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str, "<this>");
        f.a.y.a.A(10);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        int i2 = 0;
        char cCharAt = str.charAt(0);
        long j2 = -9223372036854775807L;
        boolean z = true;
        if (g.h0.c.l.h(cCharAt, 48) >= 0) {
            z = false;
        } else {
            if (length == 1) {
                return null;
            }
            if (cCharAt == '-') {
                j2 = Long.MIN_VALUE;
                i2 = 1;
            } else {
                if (cCharAt != '+') {
                    return null;
                }
                z = false;
                i2 = 1;
            }
        }
        long j3 = 0;
        long j4 = -256204778801521550L;
        long j5 = -256204778801521550L;
        while (i2 < length) {
            int iDigit = Character.digit((int) str.charAt(i2), 10);
            if (iDigit < 0) {
                return null;
            }
            if (j3 < j5) {
                if (j5 != j4) {
                    return null;
                }
                j5 = j2 / ((long) 10);
                if (j3 < j5) {
                    return null;
                }
            }
            long j6 = j3 * ((long) 10);
            long j7 = iDigit;
            if (j6 < j2 + j7) {
                return null;
            }
            j3 = j6 - j7;
            i2++;
            j4 = -256204778801521550L;
        }
        return z ? Long.valueOf(j3) : Long.valueOf(-j3);
    }

    public static final s P(String str, int i2) {
        g.h0.c.l.f(str, "<this>");
        f.a.y.a.A(i2);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        int i3 = 0;
        char cCharAt = str.charAt(0);
        int i4 = 1;
        if (g.h0.c.l.h(cCharAt, 48) >= 0) {
            i4 = 0;
        } else if (length == 1 || cCharAt != '+') {
            return null;
        }
        int iDivideUnsigned = 119304647;
        while (i4 < length) {
            int iDigit = Character.digit((int) str.charAt(i4), i2);
            if (iDigit < 0) {
                return null;
            }
            if (Integer.compareUnsigned(i3, iDivideUnsigned) > 0) {
                if (iDivideUnsigned == 119304647) {
                    iDivideUnsigned = Integer.divideUnsigned(-1, i2);
                    if (Integer.compareUnsigned(i3, iDivideUnsigned) > 0) {
                    }
                }
                return null;
            }
            int i5 = i3 * i2;
            int i6 = iDigit + i5;
            if (Integer.compareUnsigned(i6, i5) < 0) {
                return null;
            }
            i4++;
            i3 = i6;
        }
        return new s(i3);
    }

    public static final u Q(String str) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str, "<this>");
        f.a.y.a.A(10);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        int i2 = 0;
        char cCharAt = str.charAt(0);
        if (g.h0.c.l.h(cCharAt, 48) < 0) {
            if (length == 1 || cCharAt != '+') {
                return null;
            }
            i2 = 1;
        }
        long j2 = 10;
        long j3 = 0;
        long jDivideUnsigned = 512409557603043100L;
        while (i2 < length) {
            int iDigit = Character.digit((int) str.charAt(i2), 10);
            if (iDigit < 0) {
                return null;
            }
            if (Long.compareUnsigned(j3, jDivideUnsigned) > 0) {
                if (jDivideUnsigned != 512409557603043100L) {
                    return null;
                }
                jDivideUnsigned = Long.divideUnsigned(-1L, j2);
                if (Long.compareUnsigned(j3, jDivideUnsigned) > 0) {
                    return null;
                }
            }
            long j4 = j3 * j2;
            long j5 = (((long) iDigit) & 4294967295L) + j4;
            if (Long.compareUnsigned(j5, j4) < 0) {
                return null;
            }
            i2++;
            j3 = j5;
        }
        return new u(j3);
    }

    public static final CharSequence R(CharSequence charSequence) {
        g.h0.c.l.f(charSequence, "<this>");
        int length = charSequence.length() - 1;
        int i2 = 0;
        boolean z = false;
        while (i2 <= length) {
            boolean zQ0 = f.a.y.a.q0(charSequence.charAt(!z ? i2 : length));
            if (z) {
                if (!zQ0) {
                    break;
                }
                length--;
            } else if (zQ0) {
                i2++;
            } else {
                z = true;
            }
        }
        return charSequence.subSequence(i2, length + 1);
    }

    public static final String S(String str, char... cArr) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(cArr, "chars");
        int length = str.length() - 1;
        int i2 = 0;
        boolean z = false;
        while (i2 <= length) {
            char cCharAt = str.charAt(!z ? i2 : length);
            g.h0.c.l.f(cArr, "<this>");
            g.h0.c.l.f(cArr, "<this>");
            int length2 = cArr.length;
            int i3 = 0;
            while (true) {
                if (i3 >= length2) {
                    i3 = -1;
                    break;
                }
                if (cCharAt == cArr[i3]) {
                    break;
                }
                i3++;
            }
            boolean z2 = i3 >= 0;
            if (z) {
                if (!z2) {
                    break;
                }
                length--;
            } else if (z2) {
                i2++;
            } else {
                z = true;
            }
        }
        return str.subSequence(i2, length + 1).toString();
    }

    public static String T(String str, String str2, int i2) throws IOException {
        String strSubstring;
        String strInvoke;
        String str3 = (i2 & 1) != 0 ? "|" : null;
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str3, "marginPrefix");
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f("", "newIndent");
        g.h0.c.l.f(str3, "marginPrefix");
        if (!(!o(str3))) {
            throw new IllegalArgumentException("marginPrefix must be non-blank string.".toString());
        }
        List<String> listR = r(str);
        int size = (listR.size() * 0) + str.length();
        l<String, String> lVarG = g("");
        int iM = g.c0.g.m(listR);
        ArrayList arrayList = new ArrayList();
        int i3 = 0;
        for (Object obj : listR) {
            int i4 = i3 + 1;
            if (i3 < 0) {
                g.c0.g.D();
                throw null;
            }
            String str4 = (String) obj;
            if ((i3 == 0 || i3 == iM) && o(str4)) {
                str4 = null;
            } else {
                int length = str4.length();
                int i5 = 0;
                while (true) {
                    if (i5 >= length) {
                        i5 = -1;
                        break;
                    }
                    if (!f.a.y.a.q0(str4.charAt(i5))) {
                        break;
                    }
                    i5++;
                }
                if (i5 != -1 && I(str4, str3, i5, false, 4)) {
                    int length2 = str3.length() + i5;
                    g.h0.c.l.d(str4, "null cannot be cast to non-null type java.lang.String");
                    strSubstring = str4.substring(length2);
                    g.h0.c.l.e(strSubstring, "this as java.lang.String).substring(startIndex)");
                } else {
                    strSubstring = null;
                }
                if (strSubstring != null && (strInvoke = lVarG.invoke(strSubstring)) != null) {
                    str4 = strInvoke;
                }
            }
            if (str4 != null) {
                arrayList.add(str4);
            }
            i3 = i4;
        }
        StringBuilder sb = new StringBuilder(size);
        g.c0.g.q(arrayList, sb, "\n", null, null, 0, null, null, 124);
        String string = sb.toString();
        g.h0.c.l.e(string, "mapIndexedNotNull { inde…\"\\n\")\n        .toString()");
        return string;
    }

    public static boolean a(CharSequence charSequence, char c2, boolean z, int i2) {
        if ((i2 & 2) != 0) {
            z = false;
        }
        g.h0.c.l.f(charSequence, "<this>");
        return l(charSequence, c2, 0, z, 2) >= 0;
    }

    public static boolean b(CharSequence charSequence, CharSequence charSequence2, boolean z, int i2) {
        boolean z2 = (i2 & 2) != 0 ? false : z;
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(charSequence2, "other");
        if (charSequence2 instanceof String) {
            if (m(charSequence, (String) charSequence2, 0, z2, 2) < 0) {
                return false;
            }
        } else if (k(charSequence, charSequence2, 0, charSequence.length(), z2, false, 16) < 0) {
            return false;
        }
        return true;
    }

    public static boolean c(CharSequence charSequence, CharSequence charSequence2, boolean z, int i2) {
        boolean z2 = (i2 & 2) != 0 ? false : z;
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(charSequence2, "suffix");
        return (z2 || !(charSequence2 instanceof String)) ? x(charSequence, charSequence.length() - charSequence2.length(), charSequence2, 0, charSequence2.length(), z2) : d((String) charSequence, (String) charSequence2, false, 2);
    }

    public static boolean d(String str, String str2, boolean z, int i2) {
        if ((i2 & 2) != 0) {
            z = false;
        }
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str2, "suffix");
        return !z ? str.endsWith(str2) : v(str, str.length() - str2.length(), str2, 0, str2.length(), true);
    }

    public static final boolean e(String str, String str2, boolean z) {
        return str == null ? str2 == null : !z ? str.equals(str2) : str.equalsIgnoreCase(str2);
    }

    public static final Comparator<String> f(e0 e0Var) {
        g.h0.c.l.f(e0Var, "<this>");
        Comparator<String> comparator = String.CASE_INSENSITIVE_ORDER;
        g.h0.c.l.e(comparator, "CASE_INSENSITIVE_ORDER");
        return comparator;
    }

    public static final l<String, String> g(String str) {
        return str.length() == 0 ? a.f4169b : new b(str);
    }

    public static final int h(CharSequence charSequence) {
        g.h0.c.l.f(charSequence, "<this>");
        return charSequence.length() - 1;
    }

    public static final int i(CharSequence charSequence, String str, int i2, boolean z) {
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(str, "string");
        return (z || !(charSequence instanceof String)) ? k(charSequence, str, i2, charSequence.length(), z, false, 16) : ((String) charSequence).indexOf(str, i2);
    }

    public static final int j(CharSequence charSequence, CharSequence charSequence2, int i2, int i3, boolean z, boolean z2) {
        g.j0.f fVarB;
        if (z2) {
            int iH = h(charSequence);
            if (i2 > iH) {
                i2 = iH;
            }
            if (i3 < 0) {
                i3 = 0;
            }
            fVarB = g.j0.l.b(i2, i3);
        } else {
            if (i2 < 0) {
                i2 = 0;
            }
            int length = charSequence.length();
            if (i3 > length) {
                i3 = length;
            }
            fVarB = new g.j0.h(i2, i3);
        }
        if ((charSequence instanceof String) && (charSequence2 instanceof String)) {
            int i4 = fVarB.f4123b;
            int i5 = fVarB.f4124e;
            int i6 = fVarB.f4125f;
            if ((i6 <= 0 || i4 > i5) && (i6 >= 0 || i5 > i4)) {
                return -1;
            }
            while (!v((String) charSequence2, 0, (String) charSequence, i4, charSequence2.length(), z)) {
                if (i4 == i5) {
                    return -1;
                }
                i4 += i6;
            }
            return i4;
        }
        int i7 = fVarB.f4123b;
        int i8 = fVarB.f4124e;
        int i9 = fVarB.f4125f;
        if ((i9 <= 0 || i7 > i8) && (i9 >= 0 || i8 > i7)) {
            return -1;
        }
        while (!x(charSequence2, 0, charSequence, i7, charSequence2.length(), z)) {
            if (i7 == i8) {
                return -1;
            }
            i7 += i9;
        }
        return i7;
    }

    public static /* synthetic */ int k(CharSequence charSequence, CharSequence charSequence2, int i2, int i3, boolean z, boolean z2, int i4) {
        if ((i4 & 16) != 0) {
            z2 = false;
        }
        return j(charSequence, charSequence2, i2, i3, z, z2);
    }

    public static int l(CharSequence charSequence, char c2, int i2, boolean z, int i3) {
        if ((i3 & 2) != 0) {
            i2 = 0;
        }
        if ((i3 & 4) != 0) {
            z = false;
        }
        g.h0.c.l.f(charSequence, "<this>");
        return (z || !(charSequence instanceof String)) ? n(charSequence, new char[]{c2}, i2, z) : ((String) charSequence).indexOf(c2, i2);
    }

    public static /* synthetic */ int m(CharSequence charSequence, String str, int i2, boolean z, int i3) {
        if ((i3 & 2) != 0) {
            i2 = 0;
        }
        if ((i3 & 4) != 0) {
            z = false;
        }
        return i(charSequence, str, i2, z);
    }

    public static final int n(CharSequence charSequence, char[] cArr, int i2, boolean z) {
        boolean z2;
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(cArr, "chars");
        if (!z && cArr.length == 1 && (charSequence instanceof String)) {
            return ((String) charSequence).indexOf(f.a.y.a.S0(cArr), i2);
        }
        if (i2 < 0) {
            i2 = 0;
        }
        r rVarB = new g.j0.h(i2, h(charSequence)).iterator();
        while (((g.j0.g) rVarB).f4128f) {
            int iB = rVarB.b();
            char cCharAt = charSequence.charAt(iB);
            int length = cArr.length;
            int i3 = 0;
            while (true) {
                if (i3 >= length) {
                    z2 = false;
                    break;
                }
                if (f.a.y.a.T(cArr[i3], cCharAt, z)) {
                    z2 = true;
                    break;
                }
                i3++;
            }
            if (z2) {
                return iB;
            }
        }
        return -1;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:22:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final boolean o(java.lang.CharSequence r4) {
        /*
            java.lang.String r0 = "<this>"
            g.h0.c.l.f(r4, r0)
            int r1 = r4.length()
            r2 = 0
            r3 = 1
            if (r1 == 0) goto L47
            g.h0.c.l.f(r4, r0)
            g.j0.h r0 = new g.j0.h
            int r1 = r4.length()
            int r1 = r1 + (-1)
            r0.<init>(r2, r1)
            boolean r1 = r0 instanceof java.util.Collection
            if (r1 == 0) goto L29
            r1 = r0
            java.util.Collection r1 = (java.util.Collection) r1
            boolean r1 = r1.isEmpty()
            if (r1 == 0) goto L29
            goto L44
        L29:
            g.c0.r r0 = r0.iterator()
        L2d:
            r1 = r0
            g.j0.g r1 = (g.j0.g) r1
            boolean r1 = r1.f4128f
            if (r1 == 0) goto L44
            int r1 = r0.b()
            char r1 = r4.charAt(r1)
            boolean r1 = f.a.y.a.q0(r1)
            if (r1 != 0) goto L2d
            r4 = r2
            goto L45
        L44:
            r4 = r3
        L45:
            if (r4 == 0) goto L48
        L47:
            r2 = r3
        L48:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: g.m0.f.o(java.lang.CharSequence):boolean");
    }

    public static int p(CharSequence charSequence, char c2, int i2, boolean z, int i3) {
        boolean z2;
        if ((i3 & 2) != 0) {
            i2 = h(charSequence);
        }
        if ((i3 & 4) != 0) {
            z = false;
        }
        g.h0.c.l.f(charSequence, "<this>");
        if (!z && (charSequence instanceof String)) {
            return ((String) charSequence).lastIndexOf(c2, i2);
        }
        char[] cArr = {c2};
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(cArr, "chars");
        if (!z && (charSequence instanceof String)) {
            return ((String) charSequence).lastIndexOf(f.a.y.a.S0(cArr), i2);
        }
        int iH = h(charSequence);
        if (i2 > iH) {
            i2 = iH;
        }
        while (-1 < i2) {
            char cCharAt = charSequence.charAt(i2);
            int i4 = 0;
            while (true) {
                if (i4 >= 1) {
                    z2 = false;
                    break;
                }
                if (f.a.y.a.T(cArr[i4], cCharAt, z)) {
                    z2 = true;
                    break;
                }
                i4++;
            }
            if (z2) {
                return i2;
            }
            i2--;
        }
        return -1;
    }

    public static int q(CharSequence charSequence, String str, int i2, boolean z, int i3) {
        if ((i3 & 2) != 0) {
            i2 = h(charSequence);
        }
        int i4 = i2;
        if ((i3 & 4) != 0) {
            z = false;
        }
        boolean z2 = z;
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(str, "string");
        return (z2 || !(charSequence instanceof String)) ? j(charSequence, str, i4, 0, z2, true) : ((String) charSequence).lastIndexOf(str, i4);
    }

    public static final List<String> r(CharSequence charSequence) {
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(charSequence, "<this>");
        String[] strArr = {"\r\n", "\n", "\r"};
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(strArr, "delimiters");
        g.l0.d dVarU = u(charSequence, strArr, 0, false, 0, 2);
        i iVar = new i(charSequence);
        g.h0.c.l.f(dVarU, "<this>");
        g.h0.c.l.f(iVar, "transform");
        return f.a.y.a.j1(new g.l0.i(dVarU, iVar));
    }

    public static final Void s(String str) {
        g.h0.c.l.f(str, "input");
        throw new NumberFormatException("Invalid number format: '" + str + '\'');
    }

    public static final String t(String str, int i2, char c2) {
        CharSequence charSequenceSubSequence;
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str, "<this>");
        if (i2 < 0) {
            throw new IllegalArgumentException("Desired length " + i2 + " is less than zero.");
        }
        if (i2 <= str.length()) {
            charSequenceSubSequence = str.subSequence(0, str.length());
        } else {
            StringBuilder sb = new StringBuilder(i2);
            r rVarB = new g.j0.h(1, i2 - str.length()).iterator();
            while (((g.j0.g) rVarB).f4128f) {
                rVarB.b();
                sb.append(c2);
            }
            sb.append((CharSequence) str);
            charSequenceSubSequence = sb;
        }
        return charSequenceSubSequence.toString();
    }

    public static g.l0.d u(CharSequence charSequence, String[] strArr, int i2, boolean z, int i3, int i4) {
        if ((i4 & 2) != 0) {
            i2 = 0;
        }
        if ((i4 & 4) != 0) {
            z = false;
        }
        if ((i4 & 8) != 0) {
            i3 = 0;
        }
        B(i3);
        return new g.m0.b(charSequence, i2, i3, new h(g.c0.g.c(strArr), z));
    }

    public static final boolean v(String str, int i2, String str2, int i3, int i4, boolean z) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(str2, "other");
        return !z ? str.regionMatches(i2, str2, i3, i4) : str.regionMatches(z, i2, str2, i3, i4);
    }

    public static /* synthetic */ boolean w(String str, int i2, String str2, int i3, int i4, boolean z, int i5) {
        if ((i5 & 16) != 0) {
            z = false;
        }
        return v(str, i2, str2, i3, i4, z);
    }

    public static final boolean x(CharSequence charSequence, int i2, CharSequence charSequence2, int i3, int i4, boolean z) {
        g.h0.c.l.f(charSequence, "<this>");
        g.h0.c.l.f(charSequence2, "other");
        if (i3 < 0 || i2 < 0 || i2 > charSequence.length() - i4 || i3 > charSequence2.length() - i4) {
            return false;
        }
        for (int i5 = 0; i5 < i4; i5++) {
            if (!f.a.y.a.T(charSequence.charAt(i2 + i5), charSequence2.charAt(i3 + i5), z)) {
                return false;
            }
        }
        return true;
    }

    public static final String y(String str, CharSequence charSequence) {
        g.h0.c.l.f(str, "<this>");
        g.h0.c.l.f(charSequence, "prefix");
        if (!H(str, charSequence, false, 2)) {
            return str;
        }
        String strSubstring = str.substring(charSequence.length());
        g.h0.c.l.e(strSubstring, "this as java.lang.String).substring(startIndex)");
        return strSubstring;
    }

    public static final String z(CharSequence charSequence, int i2) {
        g.h0.c.l.f(charSequence, "<this>");
        if (!(i2 >= 0)) {
            throw new IllegalArgumentException(("Count 'n' must be non-negative, but was " + i2 + '.').toString());
        }
        if (i2 != 0) {
            if (i2 == 1) {
                return charSequence.toString();
            }
            int length = charSequence.length();
            if (length != 0) {
                if (length == 1) {
                    char cCharAt = charSequence.charAt(0);
                    char[] cArr = new char[i2];
                    for (int i3 = 0; i3 < i2; i3++) {
                        cArr[i3] = cCharAt;
                    }
                    return new String(cArr);
                }
                StringBuilder sb = new StringBuilder(charSequence.length() * i2);
                r rVarB = new g.j0.h(1, i2).iterator();
                while (((g.j0.g) rVarB).f4128f) {
                    rVarB.b();
                    sb.append(charSequence);
                }
                String string = sb.toString();
                g.h0.c.l.e(string, "{\n                    va…tring()\n                }");
                return string;
            }
        }
        return "";
    }
}
