package o; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import o.C14969gda; import o.gdL; /* renamed from: o.gel, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public class C15017gel extends C15014gei { public static final String c(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); int e = gdZ.e((CharSequence) str, str2, 0, false); if (e == -1) { return str3; } String substring = str.substring(0, e); C14957gcv.c((Object) substring, ""); return substring; } public static final String d(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); int e = gdZ.e((CharSequence) str, str2, 0, false); if (e == -1) { return str3; } String substring = str.substring(e + str2.length(), str.length()); C14957gcv.c((Object) substring, ""); return substring; } public static final String b(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); int e = gdZ.e(str, str2, 0, 6); if (e == -1) { return str3; } String substring = str.substring(0, e); C14957gcv.c((Object) substring, ""); return substring; } public static final String c(String str, String str2) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); String str3 = str; C14957gcv.e(str3, ""); int b = gdZ.b((CharSequence) str3, '.', str3.length() - 1); if (b == -1) { return str2; } String substring = str.substring(b + 1, str.length()); C14957gcv.c((Object) substring, ""); return substring; } public static final String e(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); int e = gdZ.e(str, str2, 0, 6); if (e == -1) { return str3; } String substring = str.substring(e + str2.length(), str.length()); C14957gcv.c((Object) substring, ""); return substring; } public static final CharSequence d(CharSequence charSequence, int i, int i2, CharSequence charSequence2) { C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); if (i2 < i) { StringBuilder sb = new StringBuilder("End index ("); sb.append(i2); sb.append(") is less than start index ("); sb.append(i); sb.append(")."); throw new IndexOutOfBoundsException(sb.toString()); } StringBuilder sb2 = new StringBuilder(); sb2.append(charSequence, 0, i); C14957gcv.c(sb2, ""); sb2.append(charSequence2); sb2.append(charSequence, i2, charSequence.length()); C14957gcv.c(sb2, ""); return sb2; } public static final String b(String str, CharSequence charSequence) { C14957gcv.e(str, ""); C14957gcv.e(charSequence, ""); if (!gdZ.e(str, charSequence)) { return str; } String substring = str.substring(charSequence.length()); C14957gcv.c((Object) substring, ""); return substring; } public static final String c(String str, CharSequence charSequence) { C14957gcv.e(str, ""); C14957gcv.e(charSequence, ""); if (!gdZ.d(str, charSequence)) { return str; } String substring = str.substring(0, str.length() - charSequence.length()); C14957gcv.c((Object) substring, ""); return substring; } public static final boolean a(CharSequence charSequence, int i, CharSequence charSequence2, int i2, int i3, boolean z) { C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); if (i2 < 0 || i < 0 || i > charSequence.length() - i3 || i2 > charSequence2.length() - i3) { return false; } for (int i4 = 0; i4 < i3; i4++) { if (!gdN.a(charSequence.charAt(i + i4), charSequence2.charAt(i2 + i4), z)) { return false; } } return true; } public static final boolean c(CharSequence charSequence) { C14957gcv.e(charSequence, ""); return charSequence.length() > 0 && gdN.a(charSequence.charAt(0), '-', false); } public static final boolean e(CharSequence charSequence, CharSequence charSequence2) { C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); if (!(charSequence instanceof String) || !(charSequence2 instanceof String)) { return gdZ.a(charSequence, 0, charSequence2, 0, charSequence2.length(), false); } return gdZ.e((String) charSequence, (String) charSequence2, false); } public static /* synthetic */ boolean d(CharSequence charSequence, CharSequence charSequence2) { C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); if (!(charSequence instanceof String) || !(charSequence2 instanceof String)) { return gdZ.a(charSequence, charSequence.length() - charSequence2.length(), charSequence2, 0, charSequence2.length(), false); } return gdZ.d((String) charSequence, (String) charSequence2, false); } public static final int c(CharSequence charSequence, char[] cArr, int i, boolean z) { C14957gcv.e(charSequence, ""); C14957gcv.e(cArr, ""); if (!z) { int length = cArr.length; if (charSequence instanceof String) { return ((String) charSequence).indexOf(C14875gap.d(cArr), i); } } if (i < 0) { i = 0; } C14957gcv.e(charSequence, ""); C14973gde c14973gde = new C14973gde(i, charSequence.length() - 1); C14972gdd c14972gdd = new C14972gdd(c14973gde.b, c14973gde.d, c14973gde.e); while (c14972gdd.hasNext()) { int a = c14972gdd.a(); char charAt = charSequence.charAt(a); int length2 = cArr.length; for (int i2 = 0; i2 <= 0; i2++) { if (gdN.a(cArr[i2], charAt, z)) { return a; } } } return -1; } private static final int c(CharSequence charSequence, CharSequence charSequence2, int i, int i2, boolean z, boolean z2) { C14973gde c14969gda; if (!z2) { if (i < 0) { i = 0; } int length = charSequence.length(); if (i2 > length) { i2 = length; } c14969gda = new C14973gde(i, i2); } else { C14957gcv.e(charSequence, ""); int length2 = charSequence.length() - 1; if (i > length2) { i = length2; } if (i2 < 0) { i2 = 0; } C14969gda.RVV rvv = C14969gda.a; c14969gda = new C14969gda(i, i2, -1); } if ((charSequence instanceof String) && (charSequence2 instanceof String)) { int i3 = c14969gda.b; int i4 = c14969gda.d; int i5 = c14969gda.e; if ((i5 > 0 && i3 <= i4) || (i5 < 0 && i4 <= i3)) { while (!gdZ.e((String) charSequence2, 0, (String) charSequence, i3, charSequence2.length(), z)) { if (i3 != i4) { i3 += i5; } } return i3; } } else { int i6 = c14969gda.b; int i7 = c14969gda.d; int i8 = c14969gda.e; if ((i8 > 0 && i6 <= i7) || (i8 < 0 && i7 <= i6)) { while (!gdZ.a(charSequence2, 0, charSequence, i6, charSequence2.length(), z)) { if (i6 != i7) { i6 += i8; } } return i6; } } return -1; } public static final int a(CharSequence charSequence, char c, int i, boolean z) { C14957gcv.e(charSequence, ""); if (!(charSequence instanceof String)) { return gdZ.c(charSequence, new char[]{c}, i, false); } return ((String) charSequence).indexOf(c, i); } public static final int e(CharSequence charSequence, String str, int i, boolean z) { C14957gcv.e(charSequence, ""); C14957gcv.e(str, ""); if (!z && (charSequence instanceof String)) { return ((String) charSequence).indexOf(str, i); } return c(charSequence, str, i, charSequence.length(), z, false); } public static final int b(CharSequence charSequence, char c, int i) { C14957gcv.e(charSequence, ""); boolean z = charSequence instanceof String; if (!z) { char[] cArr = {c}; C14957gcv.e(charSequence, ""); C14957gcv.e(cArr, ""); if (z) { return ((String) charSequence).lastIndexOf(C14875gap.d(cArr), i); } C14957gcv.e(charSequence, ""); int length = charSequence.length() - 1; if (i > length) { i = length; } while (i >= 0) { char charAt = charSequence.charAt(i); for (int i2 = 0; i2 <= 0; i2++) { if (gdN.a(cArr[i2], charAt, false)) { return i; } } i--; } return -1; } return ((String) charSequence).lastIndexOf(c, i); } public static /* synthetic */ int e(CharSequence charSequence, String str, int i, int i2) { C14957gcv.e(charSequence, ""); int length = charSequence.length() - 1; C14957gcv.e(charSequence, ""); C14957gcv.e(str, ""); if (!(charSequence instanceof String)) { return c(charSequence, str, length, 0, false, true); } return ((String) charSequence).lastIndexOf(str, length); } public static final boolean d(CharSequence charSequence, CharSequence charSequence2, boolean z) { C14957gcv.e(charSequence, ""); C14957gcv.e(charSequence2, ""); if (charSequence2 instanceof String) { if (gdZ.e(charSequence, (String) charSequence2, 0, z) >= 0) { return true; } } else if (c(charSequence, charSequence2, 0, charSequence.length(), z, false) >= 0) { return true; } return false; } private static final gdE e(CharSequence charSequence, String[] strArr, boolean z, int i) { C14957gcv.e(strArr, ""); List asList = Arrays.asList(strArr); C14957gcv.c(asList, ""); return new gdS(charSequence, 0, 0, new LWm(asList, false)); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gel$LWm */ /* loaded from: classes.dex */ public static final class LWm extends AbstractC14961gcz implements InterfaceC14937gcb> { private boolean a; private List d; /* JADX WARN: Multi-variable type inference failed */ @Override // o.InterfaceC14937gcb public final /* synthetic */ C13396fZU invoke(CharSequence charSequence, Integer num) { Object obj; C13396fZU c13396fZU; Object obj2; Object obj3; CharSequence charSequence2 = charSequence; int intValue = num.intValue(); C14957gcv.e(charSequence2, ""); List list = this.d; boolean z = this.a; if (!z && list.size() == 1) { List list2 = list; C14957gcv.e(list2, ""); if (!(list2 instanceof List)) { Iterator it = list2.iterator(); if (!it.hasNext()) { throw new NoSuchElementException("Collection is empty."); } Object next = it.next(); if (it.hasNext()) { throw new IllegalArgumentException("Collection has more than one element."); } obj3 = next; } else { List list3 = list2; C14957gcv.e(list3, ""); int size = list3.size(); if (size == 0) { throw new NoSuchElementException("List is empty."); } if (size == 1) { obj3 = list3.get(0); } else { throw new IllegalArgumentException("List has more than one element."); } } String str = (String) obj3; int e = gdZ.e(charSequence2, str, intValue, false); if (e >= 0) { c13396fZU = new C13396fZU(Integer.valueOf(e), str); } c13396fZU = null; } else { if (intValue < 0) { intValue = 0; } C14973gde c14973gde = new C14973gde(intValue, charSequence2.length()); if (charSequence2 instanceof String) { int i = c14973gde.b; int i2 = c14973gde.d; int i3 = c14973gde.e; if ((i3 > 0 && i <= i2) || (i3 < 0 && i2 <= i)) { while (true) { Iterator it2 = list.iterator(); while (true) { if (!it2.hasNext()) { obj2 = null; break; } obj2 = it2.next(); String str2 = (String) obj2; if (gdZ.e(str2, 0, (String) charSequence2, i, str2.length(), z)) { break; } } String str3 = (String) obj2; if (str3 == null) { if (i == i2) { break; } i += i3; } else { c13396fZU = new C13396fZU(Integer.valueOf(i), str3); break; } } } c13396fZU = null; } else { int i4 = c14973gde.b; int i5 = c14973gde.d; int i6 = c14973gde.e; if ((i6 > 0 && i4 <= i5) || (i6 < 0 && i5 <= i4)) { int i7 = i4; while (true) { Iterator it3 = list.iterator(); while (true) { if (!it3.hasNext()) { obj = null; break; } obj = it3.next(); String str4 = (String) obj; if (gdZ.a(str4, 0, charSequence2, i7, str4.length(), z)) { break; } } String str5 = (String) obj; if (str5 == null) { if (i7 == i5) { break; } i7 += i6; } else { c13396fZU = new C13396fZU(Integer.valueOf(i7), str5); break; } } } c13396fZU = null; } } if (c13396fZU != null) { return new C13396fZU<>(c13396fZU.d, Integer.valueOf(((String) c13396fZU.e).length())); } return null; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ LWm(List list, boolean z) { super(2); this.d = list; this.a = z; } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.gel$Sts */ /* loaded from: classes.dex */ public static final class Sts extends AbstractC14961gcz implements InterfaceC14894gbR { private CharSequence e; @Override // o.InterfaceC14894gbR public final /* synthetic */ String invoke(C14973gde c14973gde) { C14973gde c14973gde2 = c14973gde; C14957gcv.e(c14973gde2, ""); CharSequence charSequence = this.e; C14957gcv.e(charSequence, ""); C14957gcv.e(c14973gde2, ""); return charSequence.subSequence(c14973gde2.b, c14973gde2.d + 1).toString(); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ Sts(CharSequence charSequence) { super(1); this.e = charSequence; } } public static final List e(CharSequence charSequence, String[] strArr) { C14957gcv.e(charSequence, ""); C14957gcv.e(strArr, ""); int length = strArr.length; String str = strArr[0]; if (str.length() != 0) { return c(charSequence, str, false, 0); } gdE e = e(charSequence, strArr, false, 0); C14957gcv.e(e, ""); gdL.LWm lWm = new gdL.LWm(e); C14957gcv.e(lWm, ""); ArrayList arrayList = new ArrayList(10); for (C14973gde c14973gde : lWm) { C14957gcv.e(charSequence, ""); C14957gcv.e(c14973gde, ""); arrayList.add(charSequence.subSequence(c14973gde.b, c14973gde.d + 1).toString()); } return arrayList; } public static final List c(CharSequence charSequence, String str, boolean z, int i) { int e = gdZ.e(charSequence, str, 0, false); if (e != -1) { ArrayList arrayList = new ArrayList(10); int i2 = 0; do { arrayList.add(charSequence.subSequence(i2, e).toString()); i2 = str.length() + e; e = gdZ.e(charSequence, str, i2, false); } while (e != -1); arrayList.add(charSequence.subSequence(i2, charSequence.length()).toString()); return arrayList; } List singletonList = Collections.singletonList(charSequence.toString()); C14957gcv.c(singletonList, ""); return singletonList; } public static final gdE a(CharSequence charSequence) { C14957gcv.e(charSequence, ""); String[] strArr = {"\r\n", "\n", "\r"}; C14957gcv.e(charSequence, ""); C14957gcv.e(strArr, ""); gdE e = e(charSequence, strArr, false, 0); Sts sts = new Sts(charSequence); C14957gcv.e(e, ""); C14957gcv.e(sts, ""); return new gdO(e, sts); } public static final CharSequence b(CharSequence charSequence) { C14957gcv.e(charSequence, ""); int length = charSequence.length() - 1; int i = 0; boolean z = false; while (i <= length) { char charAt = charSequence.charAt(!z ? i : length); boolean z2 = Character.isWhitespace(charAt) || Character.isSpaceChar(charAt); if (z) { if (!z2) { break; } length--; } else if (z2) { i++; } else { z = true; } } return charSequence.subSequence(i, length + 1); } }