discord-jadx/app/src/main/java/f0/w.java

1106 lines
44 KiB
Java

package f0;
import d0.d0.f;
import d0.g0.t;
import d0.t.o;
import d0.z.d.m;
import f0.f0.c;
import g0.e;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.ranges.IntProgression;
import kotlin.text.Regex;
/* compiled from: HttpUrl.kt */
public final class w {
public static final char[] a = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static final b b = new b(null);
/* renamed from: c reason: collision with root package name */
public final boolean f2774c;
public final String d;
public final String e;
public final String f;
public final String g;
public final int h;
public final List<String> i;
public final List<String> j;
public final String k;
public final String l;
/* compiled from: HttpUrl.kt */
public static final class a {
public static final C0311a a = new C0311a(null);
public String b;
/* renamed from: c reason: collision with root package name */
public String f2775c = "";
public String d = "";
public String e;
public int f = -1;
public final List<String> g;
public List<String> h;
public String i;
/* compiled from: HttpUrl.kt */
/* renamed from: f0.w$a$a reason: collision with other inner class name */
public static final class C0311a {
public C0311a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
public a() {
ArrayList arrayList = new ArrayList();
this.g = arrayList;
arrayList.add("");
}
public final a a(String str, String str2) {
m.checkParameterIsNotNull(str, "encodedName");
if (this.h == null) {
this.h = new ArrayList();
}
List<String> list = this.h;
if (list == null) {
m.throwNpe();
}
b bVar = w.b;
list.add(b.a(bVar, str, 0, 0, " \"'<>#&=", true, false, true, false, null, 211));
List<String> list2 = this.h;
if (list2 == null) {
m.throwNpe();
}
list2.add(str2 != null ? b.a(bVar, str2, 0, 0, " \"'<>#&=", true, false, true, false, null, 211) : null);
return this;
}
public final w b() {
ArrayList arrayList;
String str = this.b;
if (str != null) {
b bVar = w.b;
String d = b.d(bVar, this.f2775c, 0, 0, false, 7);
String d2 = b.d(bVar, this.d, 0, 0, false, 7);
String str2 = this.e;
if (str2 != null) {
int c2 = c();
List<String> list = this.g;
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(list, 10));
for (String str3 : list) {
arrayList2.add(b.d(w.b, str3, 0, 0, false, 7));
}
List<String> list2 = this.h;
if (list2 != null) {
arrayList = new ArrayList(o.collectionSizeOrDefault(list2, 10));
for (String str4 : list2) {
arrayList.add(str4 != null ? b.d(w.b, str4, 0, 0, true, 3) : null);
}
} else {
arrayList = null;
}
String str5 = this.i;
return new w(str, d, d2, str2, c2, arrayList2, arrayList, str5 != null ? b.d(w.b, str5, 0, 0, false, 7) : null, toString());
}
throw new IllegalStateException("host == null");
}
throw new IllegalStateException("scheme == null");
}
public final int c() {
int i = this.f;
if (i != -1) {
return i;
}
String str = this.b;
if (str == null) {
m.throwNpe();
}
m.checkParameterIsNotNull(str, "scheme");
int hashCode = str.hashCode();
if (hashCode != 3213448) {
if (hashCode == 99617003 && str.equals("https")) {
return 443;
}
} else if (str.equals("http")) {
return 80;
}
return -1;
}
public final a d(String str) {
List<String> list;
if (str != null) {
b bVar = w.b;
String a2 = b.a(bVar, str, 0, 0, " \"'<>#", true, false, true, false, null, 211);
if (a2 != null) {
list = bVar.e(a2);
this.h = list;
return this;
}
}
list = null;
this.h = list;
return this;
}
/* JADX WARNING: Code restructure failed: missing block: B:25:0x006e, code lost:
if (r15 == ':') goto L_0x0072;
*/
/* JADX WARNING: Removed duplicated region for block: B:110:0x0274 */
/* JADX WARNING: Removed duplicated region for block: B:111:0x0276 */
/* JADX WARNING: Removed duplicated region for block: B:113:0x0279 */
/* JADX WARNING: Removed duplicated region for block: B:114:0x027d */
/* JADX WARNING: Removed duplicated region for block: B:137:0x0329 */
/* JADX WARNING: Unknown variable types count: 1 */
public final a e(w wVar, String str) {
int i;
char c2;
char c3;
int i2;
int i3;
a aVar;
int i4;
String str2;
int i5;
a aVar2;
int i6;
?? r14;
int i7;
String str3;
a aVar3;
String str4;
int i8;
String str5;
a aVar4;
String str6;
String str7;
String str8;
int i9;
int i10;
a aVar5;
int i11;
int i12;
int i13;
int g;
int i14;
int i15;
int i16;
int i17;
int i18;
int i19;
boolean z2;
char charAt;
String str9 = str;
m.checkParameterIsNotNull(str9, "input");
byte[] bArr = c.a;
int o = c.o(str9, 0, str.length());
int p = c.p(str9, o, str.length());
char c4 = ':';
char c5 = 65535;
if (p - o >= 2) {
char charAt2 = str9.charAt(o);
char c6 = 'Z';
char c7 = 'z';
if ((charAt2 >= 'a' && charAt2 <= 'z') || (charAt2 >= 'A' && charAt2 <= 'Z')) {
i = o;
while (true) {
i++;
if (i >= p) {
break;
}
char charAt3 = str9.charAt(i);
if (('a' <= charAt3 && c7 >= charAt3) || (('A' <= charAt3 && c6 >= charAt3) || (('0' <= charAt3 && '9' >= charAt3) || charAt3 == '+' || charAt3 == '-' || charAt3 == '.'))) {
c6 = 'Z';
c7 = 'z';
}
}
}
}
i = -1;
if (i != -1) {
if (t.startsWith(str9, "https:", o, true)) {
this.b = "https";
o += 6;
} else if (t.startsWith(str9, "http:", o, true)) {
this.b = "http";
o += 5;
} else {
StringBuilder L = c.d.b.a.a.L("Expected URL scheme 'http' or 'https' but was '");
String substring = str9.substring(0, i);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
L.append(substring);
L.append("'");
throw new IllegalArgumentException(L.toString());
}
} else if (wVar != null) {
this.b = wVar.d;
} else {
throw new IllegalArgumentException("Expected URL scheme 'http' or 'https' but no colon was found");
}
int i20 = 0;
int i21 = o;
while (true) {
c2 = '/';
c3 = '\\';
if (i21 >= p || !((charAt = str9.charAt(i21)) == '\\' || charAt == '/')) {
break;
}
i20++;
i21++;
}
char c8 = '?';
if (i20 >= 2 || wVar == null || (!m.areEqual(wVar.d, this.b))) {
int i22 = o + i20;
char c9 = '#';
boolean z3 = false;
boolean z4 = false;
while (true) {
g = c.g(str9, "@/\\?#", i22, p);
char charAt4 = g != p ? str9.charAt(g) : 65535;
if (charAt4 == c5 || charAt4 == c9 || charAt4 == c2 || charAt4 == c3 || charAt4 == c8) {
break;
}
if (charAt4 != '@') {
i18 = p;
} else {
if (!z3) {
int f = c.f(str9, c4, i22, g);
b bVar = w.b;
i19 = g;
String a2 = b.a(bVar, str, i22, f, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 240);
if (z4) {
a2 = this.f2775c + "%40" + a2;
}
this.f2775c = a2;
if (f != i19) {
this.d = b.a(bVar, str, f + 1, i19, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 240);
z2 = true;
} else {
z2 = z3;
}
z4 = true;
i18 = p;
} else {
i19 = g;
StringBuilder sb = new StringBuilder();
sb.append(this.d);
sb.append("%40");
i18 = p;
sb.append(b.a(w.b, str, i22, i19, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 240));
this.d = sb.toString();
z2 = z3;
}
i22 = i19 + 1;
z3 = z2;
}
c9 = '#';
c8 = '?';
c3 = '\\';
c2 = '/';
c5 = 65535;
c4 = ':';
p = i18;
}
i2 = p;
int i23 = i22;
while (true) {
if (i23 < g) {
char charAt5 = str9.charAt(i23);
if (charAt5 == ':') {
i14 = i23;
break;
}
if (charAt5 == '[') {
do {
i23++;
if (i23 >= g) {
break;
}
} while (str9.charAt(i23) != ']');
}
i23++;
} else {
i14 = g;
break;
}
}
int i24 = i14 + 1;
char c10 = '\"';
if (i24 < g) {
b bVar2 = w.b;
this.e = c.q.a.k.a.c0(b.d(bVar2, str, i22, i14, false, 4));
i15 = i22;
try {
i17 = Integer.parseInt(b.a(bVar2, str, i24, g, "", false, false, false, false, null, 248));
if (1 <= i17 && 65535 >= i17) {
i16 = 1;
this.f = i17;
if (!(i17 == -1)) {
c10 = '\"';
i3 = i16;
} else {
StringBuilder L2 = c.d.b.a.a.L("Invalid URL port: \"");
String substring2 = str9.substring(i24, g);
m.checkExpressionValueIsNotNull(substring2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
L2.append(substring2);
L2.append('\"');
throw new IllegalArgumentException(L2.toString().toString());
}
}
} catch (NumberFormatException unused) {
}
i16 = 1;
i17 = -1;
this.f = i17;
if (!(i17 == -1)) {
}
} else {
i15 = i22;
b bVar3 = w.b;
this.e = c.q.a.k.a.c0(b.d(bVar3, str, i15, i14, false, 4));
String str10 = this.b;
if (str10 == null) {
m.throwNpe();
}
this.f = bVar3.b(str10);
i3 = 1;
}
if (this.e != null) {
o = g;
} else {
StringBuilder L3 = c.d.b.a.a.L("Invalid URL host: \"");
String substring3 = str9.substring(i15, i14);
m.checkExpressionValueIsNotNull(substring3, "(this as java.lang.Strin…ing(startIndex, endIndex)");
L3.append(substring3);
L3.append(c10);
throw new IllegalArgumentException(L3.toString().toString());
}
} else {
this.f2775c = wVar.e();
this.d = wVar.a();
this.e = wVar.g;
this.f = wVar.h;
this.g.clear();
this.g.addAll(wVar.c());
if (o == p || str9.charAt(o) == '#') {
d(wVar.d());
}
i3 = 1;
i2 = p;
}
int g2 = c.g(str9, "?#", o, i2);
if (o == g2) {
aVar = this;
i4 = i2;
str2 = str9;
} else {
char charAt6 = str9.charAt(o);
if (charAt6 != '/' && charAt6 != '\\') {
List<String> list = this.g;
list.set(list.size() - i3, "");
aVar3 = this;
aVar2 = aVar3;
r14 = i3;
i6 = g2;
i5 = i2;
str3 = "";
str5 = str9;
str4 = str5;
str2 = str4;
i8 = o;
i7 = i6;
while (true) {
if (i8 < i7) {
int g3 = c.g(str4, "/\\", i8, i7);
boolean z5 = g3 < i7;
String a3 = b.a(w.b, str4, i8, g3, " \"<>^`{}|/\\?#", true, false, false, false, null, 240);
if (!(m.areEqual(a3, ".") || t.equals(a3, "%2e", r14))) {
if (m.areEqual(a3, "..") || t.equals(a3, "%2e.", r14) || t.equals(a3, ".%2e", r14) || t.equals(a3, "%2e%2e", r14)) {
aVar4 = aVar3;
List<String> list2 = aVar4.g;
if (list2.remove(list2.size() - r14).length() == 0) {
boolean isEmpty = aVar4.g.isEmpty();
char c11 = r14 == true ? 1 : 0;
char c12 = isEmpty ? 1 : 0;
char c13 = r14 == true ? 1 : 0;
char c14 = r14 == true ? 1 : 0;
if (c12 ^ c11) {
List<String> list3 = aVar4.g;
str6 = str3;
list3.set(list3.size() - r14, str6);
}
}
str6 = str3;
aVar4.g.add(str6);
} else {
aVar4 = aVar3;
str6 = str3;
List<String> list4 = aVar4.g;
int size = list4.size();
int i25 = r14 == true ? 1 : 0;
int i26 = r14 == true ? 1 : 0;
int i27 = r14 == true ? 1 : 0;
if (list4.get(size - i25).length() == 0) {
List<String> list5 = aVar4.g;
list5.set(list5.size() - r14, a3);
} else {
aVar4.g.add(a3);
}
if (z5) {
aVar4.g.add(str6);
}
}
} else {
aVar4 = aVar3;
str6 = str3;
}
if (z5) {
str7 = str6;
str8 = str2;
int i28 = r14 == true ? 1 : 0;
Object[] objArr = r14 == true ? 1 : 0;
Object[] objArr2 = r14 == true ? 1 : 0;
i9 = i28;
i10 = i6;
aVar5 = aVar2;
i11 = i5;
str9 = str4;
i12 = i7;
i13 = g3;
break;
}
str3 = str6;
aVar3 = aVar4;
str4 = str4;
i7 = i7;
i8 = g3;
}
str9 = str5;
g2 = i6;
aVar = aVar2;
i4 = i5;
break;
}
} else {
this.g.clear();
this.g.add("");
aVar5 = this;
aVar4 = aVar5;
i10 = g2;
i11 = i2;
str7 = "";
i13 = o;
i12 = i10;
str8 = str9;
i9 = i3;
str5 = str8;
}
i8 = i13 + i9;
r14 = i9;
i6 = i10;
str3 = str7;
aVar2 = aVar5;
aVar3 = aVar4;
str4 = str9;
i5 = i11;
str2 = str8;
i7 = i12;
while (true) {
if (i8 < i7) {
}
str9 = str5;
g2 = i6;
aVar = aVar2;
i4 = i5;
str3 = str6;
aVar3 = aVar4;
str4 = str4;
i7 = i7;
i8 = g3;
}
}
if (g2 < i4 && str2.charAt(g2) == '?') {
int f2 = c.f(str2, '#', g2, i4);
b bVar4 = w.b;
aVar.h = bVar4.e(b.a(bVar4, str9, g2 + 1, f2, " \"'<>#", true, false, true, false, null, 208));
g2 = f2;
}
if (g2 < i4 && str2.charAt(g2) == '#') {
aVar.i = b.a(w.b, str9, g2 + 1, i4, "", true, false, false, true, null, 176);
}
return aVar;
}
/* JADX WARNING: Code restructure failed: missing block: B:14:0x0033, code lost:
if ((r9.d.length() > 0) != false) goto L_0x0035;
*/
/* JADX WARNING: Code restructure failed: missing block: B:47:0x00b8, code lost:
if (r1 != r5) goto L_0x00ba;
*/
public String toString() {
StringBuilder sb = new StringBuilder();
String str = this.b;
if (str != null) {
sb.append(str);
sb.append("://");
} else {
sb.append("//");
}
boolean z2 = true;
if (!(this.f2775c.length() > 0)) {
}
sb.append(this.f2775c);
if (this.d.length() <= 0) {
z2 = false;
}
if (z2) {
sb.append(':');
sb.append(this.d);
}
sb.append('@');
String str2 = this.e;
if (str2 != null) {
if (str2 == null) {
m.throwNpe();
}
if (d0.g0.w.contains$default((CharSequence) str2, ':', false, 2, (Object) null)) {
sb.append('[');
sb.append(this.e);
sb.append(']');
} else {
sb.append(this.e);
}
}
int i = -1;
if (!(this.f == -1 && this.b == null)) {
int c2 = c();
String str3 = this.b;
if (str3 != null) {
if (str3 == null) {
m.throwNpe();
}
m.checkParameterIsNotNull(str3, "scheme");
int hashCode = str3.hashCode();
if (hashCode != 3213448) {
if (hashCode == 99617003 && str3.equals("https")) {
i = 443;
}
} else if (str3.equals("http")) {
i = 80;
}
}
sb.append(':');
sb.append(c2);
}
List<String> list = this.g;
m.checkParameterIsNotNull(list, "$this$toPathString");
m.checkParameterIsNotNull(sb, "out");
int size = list.size();
for (int i2 = 0; i2 < size; i2++) {
sb.append('/');
sb.append(list.get(i2));
}
if (this.h != null) {
sb.append('?');
List<String> list2 = this.h;
if (list2 == null) {
m.throwNpe();
}
m.checkParameterIsNotNull(list2, "$this$toQueryString");
m.checkParameterIsNotNull(sb, "out");
IntProgression step = f.step(f.until(0, list2.size()), 2);
int first = step.getFirst();
int last = step.getLast();
int step2 = step.getStep();
if (step2 < 0 ? first >= last : first <= last) {
while (true) {
String str4 = list2.get(first);
String str5 = list2.get(first + 1);
if (first > 0) {
sb.append('&');
}
sb.append(str4);
if (str5 != null) {
sb.append('=');
sb.append(str5);
}
if (first == last) {
break;
}
first += step2;
}
}
}
if (this.i != null) {
sb.append('#');
sb.append(this.i);
}
String sb2 = sb.toString();
m.checkExpressionValueIsNotNull(sb2, "StringBuilder().apply(builderAction).toString()");
return sb2;
}
}
/* compiled from: HttpUrl.kt */
public static final class b {
public b(DefaultConstructorMarker defaultConstructorMarker) {
}
public static String a(b bVar, String str, int i, int i2, String str2, boolean z2, boolean z3, boolean z4, boolean z5, Charset charset, int i3) {
String str3;
boolean z6;
String str4;
int i4 = (i3 & 1) != 0 ? 0 : i;
int length = (i3 & 2) != 0 ? str.length() : i2;
boolean z7 = (i3 & 8) != 0 ? false : z2;
boolean z8 = (i3 & 16) != 0 ? false : z3;
boolean z9 = (i3 & 32) != 0 ? false : z4;
boolean z10 = (i3 & 64) != 0 ? false : z5;
Charset charset2 = (i3 & 128) != 0 ? null : charset;
m.checkParameterIsNotNull(str, "$this$canonicalize");
m.checkParameterIsNotNull(str2, "encodeSet");
int i5 = i4;
while (i5 < length) {
int codePointAt = str.codePointAt(i5);
int i6 = 2;
if (codePointAt < 32 || codePointAt == 127 || (codePointAt >= 128 && !z10)) {
str3 = "(this as java.lang.Strin…ing(startIndex, endIndex)";
} else {
str3 = "(this as java.lang.Strin…ing(startIndex, endIndex)";
if (!d0.g0.w.contains$default((CharSequence) str2, (char) codePointAt, false, 2, (Object) null) && ((codePointAt != 37 || (z7 && (!z8 || bVar.c(str, i5, length)))) && (codePointAt != 43 || !z9))) {
i5 += Character.charCount(codePointAt);
}
}
e eVar = new e();
eVar.c0(str, i4, i5);
e eVar2 = null;
while (i5 < length) {
int codePointAt2 = str.codePointAt(i5);
if (!z7 || !(codePointAt2 == 9 || codePointAt2 == 10 || codePointAt2 == 12 || codePointAt2 == 13)) {
if (codePointAt2 != 43 || !z9) {
if (codePointAt2 < 32 || codePointAt2 == 127 || (codePointAt2 >= 128 && !z10)) {
z6 = z9;
} else {
z6 = z9;
if (!d0.g0.w.contains$default((CharSequence) str2, (char) codePointAt2, false, i6, (Object) null) && (codePointAt2 != 37 || (z7 && (!z8 || bVar.c(str, i5, length))))) {
eVar.e0(codePointAt2);
str4 = str3;
i5 += Character.charCount(codePointAt2);
i6 = 2;
z9 = z6;
str3 = str4;
}
}
if (eVar2 == null) {
eVar2 = new e();
}
if (charset2 == null || m.areEqual(charset2, StandardCharsets.UTF_8)) {
str4 = str3;
eVar2.e0(codePointAt2);
} else {
int charCount = Character.charCount(codePointAt2) + i5;
m.checkParameterIsNotNull(str, "string");
m.checkParameterIsNotNull(charset2, "charset");
boolean z11 = true;
if (i5 >= 0) {
if (charCount >= i5) {
if (charCount > str.length()) {
z11 = false;
}
if (!z11) {
StringBuilder M = c.d.b.a.a.M("endIndex > string.length: ", charCount, " > ");
M.append(str.length());
throw new IllegalArgumentException(M.toString().toString());
} else if (m.areEqual(charset2, d0.g0.c.a)) {
eVar2.c0(str, i5, charCount);
str4 = str3;
} else {
String substring = str.substring(i5, charCount);
str4 = str3;
m.checkExpressionValueIsNotNull(substring, str4);
if (substring != null) {
byte[] bytes = substring.getBytes(charset2);
m.checkExpressionValueIsNotNull(bytes, "(this as java.lang.String).getBytes(charset)");
eVar2.S(bytes, 0, bytes.length);
} else {
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
}
} else {
throw new IllegalArgumentException(c.d.b.a.a.n("endIndex < beginIndex: ", charCount, " < ", i5).toString());
}
} else {
throw new IllegalArgumentException(c.d.b.a.a.k("beginIndex < 0: ", i5).toString());
}
}
while (!eVar2.v()) {
int readByte = eVar2.readByte() & 255;
eVar.T(37);
char[] cArr = w.a;
eVar.T(cArr[(readByte >> 4) & 15]);
eVar.T(cArr[readByte & 15]);
}
i5 += Character.charCount(codePointAt2);
i6 = 2;
z9 = z6;
str3 = str4;
} else {
eVar.b0(z7 ? "+" : "%2B");
}
}
z6 = z9;
str4 = str3;
i5 += Character.charCount(codePointAt2);
i6 = 2;
z9 = z6;
str3 = str4;
}
return eVar.G();
}
String substring2 = str.substring(i4, length);
m.checkExpressionValueIsNotNull(substring2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
return substring2;
}
public static String d(b bVar, String str, int i, int i2, boolean z2, int i3) {
int i4;
if ((i3 & 1) != 0) {
i = 0;
}
if ((i3 & 2) != 0) {
i2 = str.length();
}
if ((i3 & 4) != 0) {
z2 = false;
}
m.checkParameterIsNotNull(str, "$this$percentDecode");
int i5 = i;
while (i5 < i2) {
char charAt = str.charAt(i5);
if (charAt == '%' || (charAt == '+' && z2)) {
e eVar = new e();
eVar.c0(str, i, i5);
while (i5 < i2) {
int codePointAt = str.codePointAt(i5);
if (codePointAt == 37 && (i4 = i5 + 2) < i2) {
int r = c.r(str.charAt(i5 + 1));
int r2 = c.r(str.charAt(i4));
if (!(r == -1 || r2 == -1)) {
eVar.T((r << 4) + r2);
i5 = Character.charCount(codePointAt) + i4;
}
} else if (codePointAt == 43 && z2) {
eVar.T(32);
i5++;
}
eVar.e0(codePointAt);
i5 += Character.charCount(codePointAt);
}
return eVar.G();
}
i5++;
}
String substring = str.substring(i, i2);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
return substring;
}
public final int b(String str) {
m.checkParameterIsNotNull(str, "scheme");
int hashCode = str.hashCode();
if (hashCode != 3213448) {
if (hashCode == 99617003 && str.equals("https")) {
return 443;
}
} else if (str.equals("http")) {
return 80;
}
return -1;
}
public final boolean c(String str, int i, int i2) {
int i3 = i + 2;
return i3 < i2 && str.charAt(i) == '%' && c.r(str.charAt(i + 1)) != -1 && c.r(str.charAt(i3)) != -1;
}
public final List<String> e(String str) {
m.checkParameterIsNotNull(str, "$this$toQueryNamesAndValues");
ArrayList arrayList = new ArrayList();
int i = 0;
while (i <= str.length()) {
int indexOf$default = d0.g0.w.indexOf$default((CharSequence) str, '&', i, false, 4, (Object) null);
if (indexOf$default == -1) {
indexOf$default = str.length();
}
int indexOf$default2 = d0.g0.w.indexOf$default((CharSequence) str, '=', i, false, 4, (Object) null);
if (indexOf$default2 == -1 || indexOf$default2 > indexOf$default) {
String substring = str.substring(i, indexOf$default);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
arrayList.add(substring);
arrayList.add(null);
} else {
String substring2 = str.substring(i, indexOf$default2);
m.checkExpressionValueIsNotNull(substring2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
arrayList.add(substring2);
String substring3 = str.substring(indexOf$default2 + 1, indexOf$default);
m.checkExpressionValueIsNotNull(substring3, "(this as java.lang.Strin…ing(startIndex, endIndex)");
arrayList.add(substring3);
}
i = indexOf$default + 1;
}
return arrayList;
}
}
public w(String str, String str2, String str3, String str4, int i, List<String> list, List<String> list2, String str5, String str6) {
m.checkParameterIsNotNull(str, "scheme");
m.checkParameterIsNotNull(str2, "username");
m.checkParameterIsNotNull(str3, "password");
m.checkParameterIsNotNull(str4, "host");
m.checkParameterIsNotNull(list, "pathSegments");
m.checkParameterIsNotNull(str6, "url");
this.d = str;
this.e = str2;
this.f = str3;
this.g = str4;
this.h = i;
this.i = list;
this.j = list2;
this.k = str5;
this.l = str6;
this.f2774c = m.areEqual(str, "https");
}
public final String a() {
if (this.f.length() == 0) {
return "";
}
int indexOf$default = d0.g0.w.indexOf$default((CharSequence) this.l, ':', this.d.length() + 3, false, 4, (Object) null) + 1;
int indexOf$default2 = d0.g0.w.indexOf$default((CharSequence) this.l, '@', 0, false, 6, (Object) null);
String str = this.l;
if (str != null) {
String substring = str.substring(indexOf$default, indexOf$default2);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
return substring;
}
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
public final String b() {
int indexOf$default = d0.g0.w.indexOf$default((CharSequence) this.l, '/', this.d.length() + 3, false, 4, (Object) null);
String str = this.l;
int g = c.g(str, "?#", indexOf$default, str.length());
String str2 = this.l;
if (str2 != null) {
String substring = str2.substring(indexOf$default, g);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
return substring;
}
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
public final List<String> c() {
int indexOf$default = d0.g0.w.indexOf$default((CharSequence) this.l, '/', this.d.length() + 3, false, 4, (Object) null);
String str = this.l;
int g = c.g(str, "?#", indexOf$default, str.length());
ArrayList arrayList = new ArrayList();
while (indexOf$default < g) {
int i = indexOf$default + 1;
int f = c.f(this.l, '/', i, g);
String str2 = this.l;
if (str2 != null) {
String substring = str2.substring(i, f);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
arrayList.add(substring);
indexOf$default = f;
} else {
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
}
return arrayList;
}
public final String d() {
if (this.j == null) {
return null;
}
int indexOf$default = d0.g0.w.indexOf$default((CharSequence) this.l, '?', 0, false, 6, (Object) null) + 1;
String str = this.l;
int f = c.f(str, '#', indexOf$default, str.length());
String str2 = this.l;
if (str2 != null) {
String substring = str2.substring(indexOf$default, f);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
return substring;
}
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
public final String e() {
if (this.e.length() == 0) {
return "";
}
int length = this.d.length() + 3;
String str = this.l;
int g = c.g(str, ":@", length, str.length());
String str2 = this.l;
if (str2 != null) {
String substring = str2.substring(length, g);
m.checkExpressionValueIsNotNull(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
return substring;
}
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
public boolean equals(Object obj) {
return (obj instanceof w) && m.areEqual(((w) obj).l, this.l);
}
/* JADX WARNING: Removed duplicated region for block: B:12:0x0053 */
/* JADX WARNING: Removed duplicated region for block: B:15:0x0070 */
/* JADX WARNING: Removed duplicated region for block: B:16:0x0072 */
public final a f() {
int i;
String str;
a aVar = new a();
aVar.b = this.d;
String e = e();
m.checkParameterIsNotNull(e, "<set-?>");
aVar.f2775c = e;
String a2 = a();
m.checkParameterIsNotNull(a2, "<set-?>");
aVar.d = a2;
aVar.e = this.g;
int i2 = this.h;
String str2 = this.d;
m.checkParameterIsNotNull(str2, "scheme");
int hashCode = str2.hashCode();
int i3 = -1;
if (hashCode != 3213448) {
if (hashCode == 99617003 && str2.equals("https")) {
i = 443;
if (i2 != i) {
i3 = this.h;
}
aVar.f = i3;
aVar.g.clear();
aVar.g.addAll(c());
aVar.d(d());
if (this.k == null) {
str = null;
} else {
int indexOf$default = d0.g0.w.indexOf$default((CharSequence) this.l, '#', 0, false, 6, (Object) null) + 1;
String str3 = this.l;
if (str3 != null) {
str = str3.substring(indexOf$default);
m.checkExpressionValueIsNotNull(str, "(this as java.lang.String).substring(startIndex)");
} else {
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
}
}
aVar.i = str;
return aVar;
}
} else if (str2.equals("http")) {
i = 80;
if (i2 != i) {
}
aVar.f = i3;
aVar.g.clear();
aVar.g.addAll(c());
aVar.d(d());
if (this.k == null) {
}
aVar.i = str;
return aVar;
}
i = -1;
if (i2 != i) {
}
aVar.f = i3;
aVar.g.clear();
aVar.g.addAll(c());
aVar.d(d());
if (this.k == null) {
}
aVar.i = str;
return aVar;
}
public final a g(String str) {
m.checkParameterIsNotNull(str, "link");
try {
a aVar = new a();
aVar.e(this, str);
return aVar;
} catch (IllegalArgumentException unused) {
return null;
}
}
public final String h() {
a g = g("/...");
if (g == null) {
m.throwNpe();
}
Objects.requireNonNull(g);
m.checkParameterIsNotNull("", "username");
b bVar = b;
g.f2775c = b.a(bVar, "", 0, 0, " \"':;<=>@[]^`{}|/\\?#", false, false, false, false, null, 251);
m.checkParameterIsNotNull("", "password");
g.d = b.a(bVar, "", 0, 0, " \"':;<=>@[]^`{}|/\\?#", false, false, false, false, null, 251);
return g.b().l;
}
public int hashCode() {
return this.l.hashCode();
}
public final URI i() {
a f = f();
String str = f.e;
String str2 = null;
f.e = str != null ? new Regex("[\"<>^`{|}]").replace(str, "") : null;
int size = f.g.size();
for (int i = 0; i < size; i++) {
List<String> list = f.g;
list.set(i, b.a(b, list.get(i), 0, 0, "[]", true, true, false, false, null, 227));
}
List<String> list2 = f.h;
if (list2 != null) {
int size2 = list2.size();
for (int i2 = 0; i2 < size2; i2++) {
String str3 = list2.get(i2);
list2.set(i2, str3 != null ? b.a(b, str3, 0, 0, "\\^`{|}", true, true, true, false, null, 195) : null);
}
}
String str4 = f.i;
if (str4 != null) {
str2 = b.a(b, str4, 0, 0, " \"#<>\\^`{|}", true, true, false, true, null, 163);
}
f.i = str2;
String aVar = f.toString();
try {
return new URI(aVar);
} catch (URISyntaxException e) {
try {
URI create = URI.create(new Regex("[\\u0000-\\u001F\\u007F-\\u009F\\p{javaWhitespace}]").replace(aVar, ""));
m.checkExpressionValueIsNotNull(create, "URI.create(stripped)");
return create;
} catch (Exception unused) {
throw new RuntimeException(e);
}
}
}
public String toString() {
return this.l;
}
}