package okhttp3; import androidx.autofill.HintConstants; import com.google.common.base.Ascii; import io.sentry.protocol.OperatingSystem; import io.sentry.protocol.Request; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import kotlin.Deprecated; import kotlin.DeprecationLevel; import kotlin.Metadata; import kotlin.ReplaceWith; import kotlin.collections.CollectionsKt; import kotlin.collections.SetsKt; import kotlin.jvm.JvmStatic; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.ranges.IntProgression; import kotlin.ranges.RangesKt; import kotlin.text.Regex; import kotlin.text.StringsKt; import kotlin.text.Typography; import okhttp3.internal.HostnamesKt; import okhttp3.internal.Util; import okhttp3.internal.publicsuffix.PublicSuffixDatabase; import okio.Buffer; /* compiled from: HttpUrl.kt */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\b\n\u0000\n\u0002\u0010 \n\u0002\b\r\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\"\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0002\b\u0013\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u0000 J2\u00020\u0001:\u0002IJBa\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0003\u0012\u0006\u0010\u0006\u001a\u00020\u0003\u0012\u0006\u0010\u0007\u001a\u00020\b\u0012\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00030\n\u0012\u0010\u0010\u000b\u001a\f\u0012\u0006\u0012\u0004\u0018\u00010\u0003\u0018\u00010\n\u0012\b\u0010\f\u001a\u0004\u0018\u00010\u0003\u0012\u0006\u0010\r\u001a\u00020\u0003¢\u0006\u0002\u0010\u000eJ\u000f\u0010\u000f\u001a\u0004\u0018\u00010\u0003H\u0007¢\u0006\u0002\b!J\r\u0010\u0011\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\"J\r\u0010\u0012\u001a\u00020\u0003H\u0007¢\u0006\u0002\b#J\u0013\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00030\nH\u0007¢\u0006\u0002\b$J\u000f\u0010\u0015\u001a\u0004\u0018\u00010\u0003H\u0007¢\u0006\u0002\b%J\r\u0010\u0016\u001a\u00020\u0003H\u0007¢\u0006\u0002\b&J\u0013\u0010'\u001a\u00020\u00182\b\u0010(\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\u000f\u0010\f\u001a\u0004\u0018\u00010\u0003H\u0007¢\u0006\u0002\b)J\b\u0010*\u001a\u00020\bH\u0016J\r\u0010\u0006\u001a\u00020\u0003H\u0007¢\u0006\u0002\b+J\u0006\u0010,\u001a\u00020-J\u0010\u0010,\u001a\u0004\u0018\u00010-2\u0006\u0010.\u001a\u00020\u0003J\r\u0010\u0005\u001a\u00020\u0003H\u0007¢\u0006\u0002\b/J\u0013\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00030\nH\u0007¢\u0006\u0002\b0J\r\u0010\u001a\u001a\u00020\bH\u0007¢\u0006\u0002\b1J\r\u0010\u0007\u001a\u00020\bH\u0007¢\u0006\u0002\b2J\u000f\u0010\u001c\u001a\u0004\u0018\u00010\u0003H\u0007¢\u0006\u0002\b3J\u0010\u00104\u001a\u0004\u0018\u00010\u00032\u0006\u00105\u001a\u00020\u0003J\u000e\u00106\u001a\u00020\u00032\u0006\u00107\u001a\u00020\bJ\u0013\u0010\u001d\u001a\b\u0012\u0004\u0012\u00020\u00030\u001eH\u0007¢\u0006\u0002\b8J\u0010\u00109\u001a\u0004\u0018\u00010\u00032\u0006\u00107\u001a\u00020\bJ\u0016\u0010:\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00030\n2\u0006\u00105\u001a\u00020\u0003J\r\u0010 \u001a\u00020\bH\u0007¢\u0006\u0002\b;J\u0006\u0010<\u001a\u00020\u0003J\u0010\u0010=\u001a\u0004\u0018\u00010\u00002\u0006\u0010.\u001a\u00020\u0003J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b>J\b\u0010?\u001a\u00020\u0003H\u0016J\r\u0010@\u001a\u00020AH\u0007¢\u0006\u0002\bBJ\r\u0010C\u001a\u00020DH\u0007¢\u0006\u0002\b\rJ\b\u0010E\u001a\u0004\u0018\u00010\u0003J\r\u0010B\u001a\u00020AH\u0007¢\u0006\u0002\bFJ\r\u0010\r\u001a\u00020DH\u0007¢\u0006\u0002\bGJ\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\bHR\u0013\u0010\u000f\u001a\u0004\u0018\u00010\u00038G¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0010R\u0011\u0010\u0011\u001a\u00020\u00038G¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u0010R\u0011\u0010\u0012\u001a\u00020\u00038G¢\u0006\u0006\u001a\u0004\b\u0012\u0010\u0010R\u0017\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00030\n8G¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0014R\u0013\u0010\u0015\u001a\u0004\u0018\u00010\u00038G¢\u0006\u0006\u001a\u0004\b\u0015\u0010\u0010R\u0011\u0010\u0016\u001a\u00020\u00038G¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0010R\u0015\u0010\f\u001a\u0004\u0018\u00010\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\u0010R\u0013\u0010\u0006\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0010R\u0011\u0010\u0017\u001a\u00020\u0018¢\u0006\b\n\u0000\u001a\u0004\b\u0017\u0010\u0019R\u0013\u0010\u0005\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0010R\u0019\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00030\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\u0014R\u0011\u0010\u001a\u001a\u00020\b8G¢\u0006\u0006\u001a\u0004\b\u001a\u0010\u001bR\u0013\u0010\u0007\u001a\u00020\b8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u001bR\u0013\u0010\u001c\u001a\u0004\u0018\u00010\u00038G¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u0010R\u0018\u0010\u000b\u001a\f\u0012\u0006\u0012\u0004\u0018\u00010\u0003\u0018\u00010\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u0017\u0010\u001d\u001a\b\u0012\u0004\u0012\u00020\u00030\u001e8G¢\u0006\u0006\u001a\u0004\b\u001d\u0010\u001fR\u0011\u0010 \u001a\u00020\b8G¢\u0006\u0006\u001a\u0004\b \u0010\u001bR\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0010R\u000e\u0010\r\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0010¨\u0006K"}, d2 = {"Lokhttp3/HttpUrl;", "", "scheme", "", "username", HintConstants.AUTOFILL_HINT_PASSWORD, "host", "port", "", "pathSegments", "", "queryNamesAndValues", Request.JsonKeys.FRAGMENT, Request.JsonKeys.URL, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/util/List;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;)V", "encodedFragment", "()Ljava/lang/String;", "encodedPassword", "encodedPath", "encodedPathSegments", "()Ljava/util/List;", "encodedQuery", "encodedUsername", "isHttps", "", "()Z", "pathSize", "()I", "query", "queryParameterNames", "", "()Ljava/util/Set;", "querySize", "-deprecated_encodedFragment", "-deprecated_encodedPassword", "-deprecated_encodedPath", "-deprecated_encodedPathSegments", "-deprecated_encodedQuery", "-deprecated_encodedUsername", "equals", "other", "-deprecated_fragment", "hashCode", "-deprecated_host", "newBuilder", "Lokhttp3/HttpUrl$Builder;", "link", "-deprecated_password", "-deprecated_pathSegments", "-deprecated_pathSize", "-deprecated_port", "-deprecated_query", "queryParameter", "name", "queryParameterName", "index", "-deprecated_queryParameterNames", "queryParameterValue", "queryParameterValues", "-deprecated_querySize", "redact", "resolve", "-deprecated_scheme", "toString", "toUri", "Ljava/net/URI;", "uri", "toUrl", "Ljava/net/URL;", "topPrivateDomain", "-deprecated_uri", "-deprecated_url", "-deprecated_username", "Builder", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0}) /* loaded from: classes3.dex */ public final class HttpUrl { public static final String FORM_ENCODE_SET = " \"':;<=>@[]^`{}|/\\?#&!$(),~"; public static final String FRAGMENT_ENCODE_SET = ""; public static final String FRAGMENT_ENCODE_SET_URI = " \"#<>\\^`{|}"; public static final String PASSWORD_ENCODE_SET = " \"':;<=>@[]^`{}|/\\?#"; public static final String PATH_SEGMENT_ENCODE_SET = " \"<>^`{}|/\\?#"; public static final String PATH_SEGMENT_ENCODE_SET_URI = "[]"; public static final String QUERY_COMPONENT_ENCODE_SET = " !\"#$&'(),/:;<=>?@[]\\^`{|}~"; public static final String QUERY_COMPONENT_ENCODE_SET_URI = "\\^`{|}"; public static final String QUERY_COMPONENT_REENCODE_SET = " \"'<>#&="; public static final String QUERY_ENCODE_SET = " \"'<>#"; public static final String USERNAME_ENCODE_SET = " \"':;<=>@[]^`{}|/\\?#"; private final String fragment; private final String host; private final boolean isHttps; private final String password; private final List pathSegments; private final int port; private final List queryNamesAndValues; private final String scheme; private final String url; private final String username; /* renamed from: Companion, reason: from kotlin metadata */ public static final Companion INSTANCE = new Companion(null); private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; @JvmStatic public static final int defaultPort(String str) { return INSTANCE.defaultPort(str); } @JvmStatic public static final HttpUrl get(String str) { return INSTANCE.get(str); } @JvmStatic public static final HttpUrl get(URI uri) { return INSTANCE.get(uri); } @JvmStatic public static final HttpUrl get(URL url) { return INSTANCE.get(url); } @JvmStatic public static final HttpUrl parse(String str) { return INSTANCE.parse(str); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = Request.JsonKeys.FRAGMENT, imports = {})) /* renamed from: -deprecated_fragment, reason: not valid java name and from getter */ public final String getFragment() { return this.fragment; } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "host", imports = {})) /* renamed from: -deprecated_host, reason: not valid java name and from getter */ public final String getHost() { return this.host; } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = HintConstants.AUTOFILL_HINT_PASSWORD, imports = {})) /* renamed from: -deprecated_password, reason: not valid java name and from getter */ public final String getPassword() { return this.password; } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "pathSegments", imports = {})) /* renamed from: -deprecated_pathSegments, reason: not valid java name */ public final List m7330deprecated_pathSegments() { return this.pathSegments; } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "port", imports = {})) /* renamed from: -deprecated_port, reason: not valid java name and from getter */ public final int getPort() { return this.port; } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "scheme", imports = {})) /* renamed from: -deprecated_scheme, reason: not valid java name and from getter */ public final String getScheme() { return this.scheme; } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "username", imports = {})) /* renamed from: -deprecated_username, reason: not valid java name and from getter */ public final String getUsername() { return this.username; } public final String fragment() { return this.fragment; } public final String host() { return this.host; } /* renamed from: isHttps, reason: from getter */ public final boolean getIsHttps() { return this.isHttps; } public final String password() { return this.password; } public final List pathSegments() { return this.pathSegments; } public final int port() { return this.port; } public final String scheme() { return this.scheme; } /* renamed from: toString, reason: from getter */ public String getUrl() { return this.url; } public final String username() { return this.username; } public HttpUrl(String scheme, String username, String password, String host, int i, List pathSegments, List list, String str, String url) { Intrinsics.checkNotNullParameter(scheme, "scheme"); Intrinsics.checkNotNullParameter(username, "username"); Intrinsics.checkNotNullParameter(password, "password"); Intrinsics.checkNotNullParameter(host, "host"); Intrinsics.checkNotNullParameter(pathSegments, "pathSegments"); Intrinsics.checkNotNullParameter(url, "url"); this.scheme = scheme; this.username = username; this.password = password; this.host = host; this.port = i; this.pathSegments = pathSegments; this.queryNamesAndValues = list; this.fragment = str; this.url = url; this.isHttps = Intrinsics.areEqual(scheme, "https"); } public final URL url() { try { return new URL(this.url); } catch (MalformedURLException e) { throw new RuntimeException(e); } } public final URI uri() { String builder = newBuilder().reencodeForUri$okhttp().toString(); try { return new URI(builder); } catch (URISyntaxException e) { try { URI create = URI.create(new Regex("[\\u0000-\\u001F\\u007F-\\u009F\\p{javaWhitespace}]").replace(builder, "")); Intrinsics.checkNotNullExpressionValue(create, "try {\n val stripp…e) // Unexpected!\n }"); return create; } catch (Exception unused) { throw new RuntimeException(e); } } } public final String encodedUsername() { if (this.username.length() == 0) { return ""; } int length = this.scheme.length() + 3; String str = this.url; int delimiterOffset = Util.delimiterOffset(str, ":@", length, str.length()); String str2 = this.url; if (str2 == null) { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } String substring = str2.substring(length, delimiterOffset); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); return substring; } public final String encodedPassword() { if (this.password.length() == 0) { return ""; } int indexOf$default = StringsKt.indexOf$default((CharSequence) this.url, ':', this.scheme.length() + 3, false, 4, (Object) null) + 1; int indexOf$default2 = StringsKt.indexOf$default((CharSequence) this.url, '@', 0, false, 6, (Object) null); String str = this.url; if (str == null) { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } String substring = str.substring(indexOf$default, indexOf$default2); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); return substring; } public final int pathSize() { return this.pathSegments.size(); } public final String encodedPath() { int indexOf$default = StringsKt.indexOf$default((CharSequence) this.url, '/', this.scheme.length() + 3, false, 4, (Object) null); String str = this.url; int delimiterOffset = Util.delimiterOffset(str, "?#", indexOf$default, str.length()); String str2 = this.url; if (str2 == null) { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } String substring = str2.substring(indexOf$default, delimiterOffset); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); return substring; } public final List encodedPathSegments() { int indexOf$default = StringsKt.indexOf$default((CharSequence) this.url, '/', this.scheme.length() + 3, false, 4, (Object) null); String str = this.url; int delimiterOffset = Util.delimiterOffset(str, "?#", indexOf$default, str.length()); ArrayList arrayList = new ArrayList(); while (indexOf$default < delimiterOffset) { int i = indexOf$default + 1; int delimiterOffset2 = Util.delimiterOffset(this.url, '/', i, delimiterOffset); String str2 = this.url; if (str2 == null) { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } String substring = str2.substring(i, delimiterOffset2); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); arrayList.add(substring); indexOf$default = delimiterOffset2; } return arrayList; } public final String encodedQuery() { if (this.queryNamesAndValues == null) { return null; } int indexOf$default = StringsKt.indexOf$default((CharSequence) this.url, '?', 0, false, 6, (Object) null) + 1; String str = this.url; int delimiterOffset = Util.delimiterOffset(str, '#', indexOf$default, str.length()); String str2 = this.url; if (str2 == null) { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } String substring = str2.substring(indexOf$default, delimiterOffset); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); return substring; } public final String query() { if (this.queryNamesAndValues == null) { return null; } StringBuilder sb = new StringBuilder(); INSTANCE.toQueryString$okhttp(this.queryNamesAndValues, sb); return sb.toString(); } public final int querySize() { List list = this.queryNamesAndValues; if (list != null) { return list.size() / 2; } return 0; } public final String queryParameter(String name) { Intrinsics.checkNotNullParameter(name, "name"); List list = this.queryNamesAndValues; if (list == null) { return null; } IntProgression step = RangesKt.step(RangesKt.until(0, list.size()), 2); int first = step.getFirst(); int last = step.getLast(); int step2 = step.getStep(); if (step2 < 0 ? first >= last : first <= last) { while (!Intrinsics.areEqual(name, this.queryNamesAndValues.get(first))) { if (first != last) { first += step2; } } return this.queryNamesAndValues.get(first + 1); } return null; } public final Set queryParameterNames() { if (this.queryNamesAndValues == null) { return SetsKt.emptySet(); } LinkedHashSet linkedHashSet = new LinkedHashSet(); IntProgression step = RangesKt.step(RangesKt.until(0, this.queryNamesAndValues.size()), 2); int first = step.getFirst(); int last = step.getLast(); int step2 = step.getStep(); if (step2 < 0 ? first >= last : first <= last) { while (true) { String str = this.queryNamesAndValues.get(first); Intrinsics.checkNotNull(str); linkedHashSet.add(str); if (first == last) { break; } first += step2; } } Set unmodifiableSet = Collections.unmodifiableSet(linkedHashSet); Intrinsics.checkNotNullExpressionValue(unmodifiableSet, "Collections.unmodifiableSet(result)"); return unmodifiableSet; } public final List queryParameterValues(String name) { Intrinsics.checkNotNullParameter(name, "name"); if (this.queryNamesAndValues == null) { return CollectionsKt.emptyList(); } ArrayList arrayList = new ArrayList(); IntProgression step = RangesKt.step(RangesKt.until(0, this.queryNamesAndValues.size()), 2); int first = step.getFirst(); int last = step.getLast(); int step2 = step.getStep(); if (step2 < 0 ? first >= last : first <= last) { while (true) { if (Intrinsics.areEqual(name, this.queryNamesAndValues.get(first))) { arrayList.add(this.queryNamesAndValues.get(first + 1)); } if (first == last) { break; } first += step2; } } List unmodifiableList = Collections.unmodifiableList(arrayList); Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiableList(result)"); return unmodifiableList; } public final String queryParameterName(int index) { List list = this.queryNamesAndValues; if (list == null) { throw new IndexOutOfBoundsException(); } String str = list.get(index * 2); Intrinsics.checkNotNull(str); return str; } public final String queryParameterValue(int index) { List list = this.queryNamesAndValues; if (list == null) { throw new IndexOutOfBoundsException(); } return list.get((index * 2) + 1); } public final String encodedFragment() { if (this.fragment == null) { return null; } int indexOf$default = StringsKt.indexOf$default((CharSequence) this.url, '#', 0, false, 6, (Object) null) + 1; String str = this.url; if (str == null) { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } String substring = str.substring(indexOf$default); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.String).substring(startIndex)"); return substring; } public final String redact() { Builder newBuilder = newBuilder("/..."); Intrinsics.checkNotNull(newBuilder); return newBuilder.username("").password("").build().getUrl(); } public final HttpUrl resolve(String link) { Intrinsics.checkNotNullParameter(link, "link"); Builder newBuilder = newBuilder(link); if (newBuilder != null) { return newBuilder.build(); } return null; } public final Builder newBuilder() { Builder builder = new Builder(); builder.setScheme$okhttp(this.scheme); builder.setEncodedUsername$okhttp(encodedUsername()); builder.setEncodedPassword$okhttp(encodedPassword()); builder.setHost$okhttp(this.host); builder.setPort$okhttp(this.port != INSTANCE.defaultPort(this.scheme) ? this.port : -1); builder.getEncodedPathSegments$okhttp().clear(); builder.getEncodedPathSegments$okhttp().addAll(encodedPathSegments()); builder.encodedQuery(encodedQuery()); builder.setEncodedFragment$okhttp(encodedFragment()); return builder; } public final Builder newBuilder(String link) { Intrinsics.checkNotNullParameter(link, "link"); try { return new Builder().parse$okhttp(this, link); } catch (IllegalArgumentException unused) { return null; } } public boolean equals(Object other) { return (other instanceof HttpUrl) && Intrinsics.areEqual(((HttpUrl) other).url, this.url); } public int hashCode() { return this.url.hashCode(); } public final String topPrivateDomain() { if (Util.canParseAsIpAddress(this.host)) { return null; } return PublicSuffixDatabase.INSTANCE.get().getEffectiveTldPlusOne(this.host); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to toUrl()", replaceWith = @ReplaceWith(expression = "toUrl()", imports = {})) /* renamed from: -deprecated_url, reason: not valid java name */ public final URL m7338deprecated_url() { return url(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to toUri()", replaceWith = @ReplaceWith(expression = "toUri()", imports = {})) /* renamed from: -deprecated_uri, reason: not valid java name */ public final URI m7337deprecated_uri() { return uri(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "encodedUsername", imports = {})) /* renamed from: -deprecated_encodedUsername, reason: not valid java name */ public final String m7326deprecated_encodedUsername() { return encodedUsername(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "encodedPassword", imports = {})) /* renamed from: -deprecated_encodedPassword, reason: not valid java name */ public final String m7322deprecated_encodedPassword() { return encodedPassword(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "pathSize", imports = {})) /* renamed from: -deprecated_pathSize, reason: not valid java name */ public final int m7331deprecated_pathSize() { return pathSize(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "encodedPath", imports = {})) /* renamed from: -deprecated_encodedPath, reason: not valid java name */ public final String m7323deprecated_encodedPath() { return encodedPath(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "encodedPathSegments", imports = {})) /* renamed from: -deprecated_encodedPathSegments, reason: not valid java name */ public final List m7324deprecated_encodedPathSegments() { return encodedPathSegments(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "encodedQuery", imports = {})) /* renamed from: -deprecated_encodedQuery, reason: not valid java name */ public final String m7325deprecated_encodedQuery() { return encodedQuery(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "query", imports = {})) /* renamed from: -deprecated_query, reason: not valid java name */ public final String m7333deprecated_query() { return query(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "querySize", imports = {})) /* renamed from: -deprecated_querySize, reason: not valid java name */ public final int m7335deprecated_querySize() { return querySize(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "queryParameterNames", imports = {})) /* renamed from: -deprecated_queryParameterNames, reason: not valid java name */ public final Set m7334deprecated_queryParameterNames() { return queryParameterNames(); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "encodedFragment", imports = {})) /* renamed from: -deprecated_encodedFragment, reason: not valid java name */ public final String m7321deprecated_encodedFragment() { return encodedFragment(); } /* compiled from: HttpUrl.kt */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0010!\n\u0002\b\r\n\u0002\u0010\b\n\u0002\b\u0012\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0010\u0002\n\u0002\b\u0017\u0018\u0000 V2\u00020\u0001:\u0001VB\u0005¢\u0006\u0002\u0010\u0002J\u000e\u0010#\u001a\u00020\u00002\u0006\u0010$\u001a\u00020\u0004J\u000e\u0010%\u001a\u00020\u00002\u0006\u0010\f\u001a\u00020\u0004J\u0018\u0010&\u001a\u00020\u00002\u0006\u0010'\u001a\u00020\u00042\b\u0010(\u001a\u0004\u0018\u00010\u0004J\u000e\u0010)\u001a\u00020\u00002\u0006\u0010*\u001a\u00020\u0004J\u000e\u0010+\u001a\u00020\u00002\u0006\u0010,\u001a\u00020\u0004J\u0018\u0010+\u001a\u00020\u00002\u0006\u0010,\u001a\u00020\u00042\u0006\u0010-\u001a\u00020.H\u0002J\u0018\u0010/\u001a\u00020\u00002\u0006\u00100\u001a\u00020\u00042\b\u00101\u001a\u0004\u0018\u00010\u0004J\u0006\u00102\u001a\u000203J\b\u00104\u001a\u00020\u001bH\u0002J\u0010\u0010\u0003\u001a\u00020\u00002\b\u0010\u0003\u001a\u0004\u0018\u00010\u0004J\u000e\u0010\t\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\u0004J\u000e\u00105\u001a\u00020\u00002\u0006\u00105\u001a\u00020\u0004J\u0010\u00106\u001a\u00020\u00002\b\u00106\u001a\u0004\u0018\u00010\u0004J\u000e\u0010\u0014\u001a\u00020\u00002\u0006\u0010\u0014\u001a\u00020\u0004J\u0010\u00107\u001a\u00020\u00002\b\u00107\u001a\u0004\u0018\u00010\u0004J\u000e\u0010\u0017\u001a\u00020\u00002\u0006\u0010\u0017\u001a\u00020\u0004J\u0010\u00108\u001a\u00020.2\u0006\u00109\u001a\u00020\u0004H\u0002J\u0010\u0010:\u001a\u00020.2\u0006\u00109\u001a\u00020\u0004H\u0002J\u001f\u0010;\u001a\u00020\u00002\b\u0010<\u001a\u0004\u0018\u0001032\u0006\u00109\u001a\u00020\u0004H\u0000¢\u0006\u0002\b=J\u000e\u0010>\u001a\u00020\u00002\u0006\u0010>\u001a\u00020\u0004J\b\u0010?\u001a\u00020@H\u0002J\u000e\u0010\u001a\u001a\u00020\u00002\u0006\u0010\u001a\u001a\u00020\u001bJ0\u0010A\u001a\u00020@2\u0006\u00109\u001a\u00020\u00042\u0006\u0010B\u001a\u00020\u001b2\u0006\u0010C\u001a\u00020\u001b2\u0006\u0010D\u001a\u00020.2\u0006\u0010-\u001a\u00020.H\u0002J\u0010\u0010E\u001a\u00020\u00002\b\u0010E\u001a\u0004\u0018\u00010\u0004J\r\u0010F\u001a\u00020\u0000H\u0000¢\u0006\u0002\bGJ\u0010\u0010H\u001a\u00020@2\u0006\u0010I\u001a\u00020\u0004H\u0002J\u000e\u0010J\u001a\u00020\u00002\u0006\u0010'\u001a\u00020\u0004J\u000e\u0010K\u001a\u00020\u00002\u0006\u00100\u001a\u00020\u0004J\u000e\u0010L\u001a\u00020\u00002\u0006\u0010M\u001a\u00020\u001bJ \u0010N\u001a\u00020@2\u0006\u00109\u001a\u00020\u00042\u0006\u0010O\u001a\u00020\u001b2\u0006\u0010C\u001a\u00020\u001bH\u0002J\u000e\u0010 \u001a\u00020\u00002\u0006\u0010 \u001a\u00020\u0004J\u0016\u0010P\u001a\u00020\u00002\u0006\u0010M\u001a\u00020\u001b2\u0006\u0010$\u001a\u00020\u0004J\u0018\u0010Q\u001a\u00020\u00002\u0006\u0010'\u001a\u00020\u00042\b\u0010(\u001a\u0004\u0018\u00010\u0004J\u0016\u0010R\u001a\u00020\u00002\u0006\u0010M\u001a\u00020\u001b2\u0006\u0010*\u001a\u00020\u0004J\u0018\u0010S\u001a\u00020\u00002\u0006\u00100\u001a\u00020\u00042\b\u00101\u001a\u0004\u0018\u00010\u0004J\b\u0010T\u001a\u00020\u0004H\u0016J\u000e\u0010U\u001a\u00020\u00002\u0006\u0010U\u001a\u00020\u0004R\u001c\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u001a\u0010\t\u001a\u00020\u0004X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u0006\"\u0004\b\u000b\u0010\bR\u001a\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u00040\rX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000fR$\u0010\u0010\u001a\f\u0012\u0006\u0012\u0004\u0018\u00010\u0004\u0018\u00010\rX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0011\u0010\u000f\"\u0004\b\u0012\u0010\u0013R\u001a\u0010\u0014\u001a\u00020\u0004X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0015\u0010\u0006\"\u0004\b\u0016\u0010\bR\u001c\u0010\u0017\u001a\u0004\u0018\u00010\u0004X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0018\u0010\u0006\"\u0004\b\u0019\u0010\bR\u001a\u0010\u001a\u001a\u00020\u001bX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001c\u0010\u001d\"\u0004\b\u001e\u0010\u001fR\u001c\u0010 \u001a\u0004\u0018\u00010\u0004X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b!\u0010\u0006\"\u0004\b\"\u0010\b¨\u0006W"}, d2 = {"Lokhttp3/HttpUrl$Builder;", "", "()V", "encodedFragment", "", "getEncodedFragment$okhttp", "()Ljava/lang/String;", "setEncodedFragment$okhttp", "(Ljava/lang/String;)V", "encodedPassword", "getEncodedPassword$okhttp", "setEncodedPassword$okhttp", "encodedPathSegments", "", "getEncodedPathSegments$okhttp", "()Ljava/util/List;", "encodedQueryNamesAndValues", "getEncodedQueryNamesAndValues$okhttp", "setEncodedQueryNamesAndValues$okhttp", "(Ljava/util/List;)V", "encodedUsername", "getEncodedUsername$okhttp", "setEncodedUsername$okhttp", "host", "getHost$okhttp", "setHost$okhttp", "port", "", "getPort$okhttp", "()I", "setPort$okhttp", "(I)V", "scheme", "getScheme$okhttp", "setScheme$okhttp", "addEncodedPathSegment", "encodedPathSegment", "addEncodedPathSegments", "addEncodedQueryParameter", "encodedName", "encodedValue", "addPathSegment", "pathSegment", "addPathSegments", "pathSegments", "alreadyEncoded", "", "addQueryParameter", "name", "value", OperatingSystem.JsonKeys.BUILD, "Lokhttp3/HttpUrl;", "effectivePort", "encodedPath", "encodedQuery", Request.JsonKeys.FRAGMENT, "isDot", "input", "isDotDot", "parse", "base", "parse$okhttp", HintConstants.AUTOFILL_HINT_PASSWORD, "pop", "", "push", "pos", "limit", "addTrailingSlash", "query", "reencodeForUri", "reencodeForUri$okhttp", "removeAllCanonicalQueryParameters", "canonicalName", "removeAllEncodedQueryParameters", "removeAllQueryParameters", "removePathSegment", "index", "resolvePath", "startPos", "setEncodedPathSegment", "setEncodedQueryParameter", "setPathSegment", "setQueryParameter", "toString", "username", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0}) /* loaded from: classes3.dex */ public static final class Builder { /* renamed from: Companion, reason: from kotlin metadata */ public static final Companion INSTANCE = new Companion(null); public static final String INVALID_HOST = "Invalid URL host"; private String encodedFragment; private final List encodedPathSegments; private List encodedQueryNamesAndValues; private String host; private String scheme; private String encodedUsername = ""; private String encodedPassword = ""; private int port = -1; /* renamed from: getEncodedFragment$okhttp, reason: from getter */ public final String getEncodedFragment() { return this.encodedFragment; } /* renamed from: getEncodedPassword$okhttp, reason: from getter */ public final String getEncodedPassword() { return this.encodedPassword; } public final List getEncodedPathSegments$okhttp() { return this.encodedPathSegments; } public final List getEncodedQueryNamesAndValues$okhttp() { return this.encodedQueryNamesAndValues; } /* renamed from: getEncodedUsername$okhttp, reason: from getter */ public final String getEncodedUsername() { return this.encodedUsername; } /* renamed from: getHost$okhttp, reason: from getter */ public final String getHost() { return this.host; } /* renamed from: getPort$okhttp, reason: from getter */ public final int getPort() { return this.port; } /* renamed from: getScheme$okhttp, reason: from getter */ public final String getScheme() { return this.scheme; } public final void setEncodedFragment$okhttp(String str) { this.encodedFragment = str; } public final void setEncodedPassword$okhttp(String str) { Intrinsics.checkNotNullParameter(str, ""); this.encodedPassword = str; } public final void setEncodedQueryNamesAndValues$okhttp(List list) { this.encodedQueryNamesAndValues = list; } public final void setEncodedUsername$okhttp(String str) { Intrinsics.checkNotNullParameter(str, ""); this.encodedUsername = str; } public final void setHost$okhttp(String str) { this.host = str; } public final void setPort$okhttp(int i) { this.port = i; } public final void setScheme$okhttp(String str) { this.scheme = str; } public Builder() { ArrayList arrayList = new ArrayList(); this.encodedPathSegments = arrayList; arrayList.add(""); } public final Builder scheme(String scheme) { Intrinsics.checkNotNullParameter(scheme, "scheme"); if (StringsKt.equals(scheme, "http", true)) { this.scheme = "http"; } else { if (!StringsKt.equals(scheme, "https", true)) { throw new IllegalArgumentException("unexpected scheme: " + scheme); } this.scheme = "https"; } return this; } public final Builder username(String username) { Intrinsics.checkNotNullParameter(username, "username"); this.encodedUsername = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, username, 0, 0, " \"':;<=>@[]^`{}|/\\?#", false, false, false, false, null, 251, null); return this; } public final Builder encodedUsername(String encodedUsername) { Intrinsics.checkNotNullParameter(encodedUsername, "encodedUsername"); this.encodedUsername = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedUsername, 0, 0, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 243, null); return this; } public final Builder password(String password) { Intrinsics.checkNotNullParameter(password, "password"); this.encodedPassword = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, password, 0, 0, " \"':;<=>@[]^`{}|/\\?#", false, false, false, false, null, 251, null); return this; } public final Builder encodedPassword(String encodedPassword) { Intrinsics.checkNotNullParameter(encodedPassword, "encodedPassword"); this.encodedPassword = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedPassword, 0, 0, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 243, null); return this; } public final Builder host(String host) { Intrinsics.checkNotNullParameter(host, "host"); String canonicalHost = HostnamesKt.toCanonicalHost(Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, host, 0, 0, false, 7, null)); if (canonicalHost == null) { throw new IllegalArgumentException("unexpected host: " + host); } this.host = canonicalHost; return this; } public final Builder port(int port) { if (!(1 <= port && 65535 >= port)) { throw new IllegalArgumentException(("unexpected port: " + port).toString()); } this.port = port; return this; } private final int effectivePort() { int i = this.port; if (i != -1) { return i; } Companion companion = HttpUrl.INSTANCE; String str = this.scheme; Intrinsics.checkNotNull(str); return companion.defaultPort(str); } public final Builder addPathSegment(String pathSegment) { Intrinsics.checkNotNullParameter(pathSegment, "pathSegment"); push(pathSegment, 0, pathSegment.length(), false, false); return this; } public final Builder addPathSegments(String pathSegments) { Intrinsics.checkNotNullParameter(pathSegments, "pathSegments"); return addPathSegments(pathSegments, false); } public final Builder addEncodedPathSegment(String encodedPathSegment) { Intrinsics.checkNotNullParameter(encodedPathSegment, "encodedPathSegment"); push(encodedPathSegment, 0, encodedPathSegment.length(), false, true); return this; } public final Builder addEncodedPathSegments(String encodedPathSegments) { Intrinsics.checkNotNullParameter(encodedPathSegments, "encodedPathSegments"); return addPathSegments(encodedPathSegments, true); } private final Builder addPathSegments(String pathSegments, boolean alreadyEncoded) { int i = 0; do { int delimiterOffset = Util.delimiterOffset(pathSegments, "/\\", i, pathSegments.length()); push(pathSegments, i, delimiterOffset, delimiterOffset < pathSegments.length(), alreadyEncoded); i = delimiterOffset + 1; } while (i <= pathSegments.length()); return this; } public final Builder setPathSegment(int index, String pathSegment) { Intrinsics.checkNotNullParameter(pathSegment, "pathSegment"); String canonicalize$okhttp$default = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, pathSegment, 0, 0, HttpUrl.PATH_SEGMENT_ENCODE_SET, false, false, false, false, null, 251, null); if (!((isDot(canonicalize$okhttp$default) || isDotDot(canonicalize$okhttp$default)) ? false : true)) { throw new IllegalArgumentException(("unexpected path segment: " + pathSegment).toString()); } this.encodedPathSegments.set(index, canonicalize$okhttp$default); return this; } public final Builder setEncodedPathSegment(int index, String encodedPathSegment) { Intrinsics.checkNotNullParameter(encodedPathSegment, "encodedPathSegment"); String canonicalize$okhttp$default = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedPathSegment, 0, 0, HttpUrl.PATH_SEGMENT_ENCODE_SET, true, false, false, false, null, 243, null); this.encodedPathSegments.set(index, canonicalize$okhttp$default); if ((isDot(canonicalize$okhttp$default) || isDotDot(canonicalize$okhttp$default)) ? false : true) { return this; } throw new IllegalArgumentException(("unexpected path segment: " + encodedPathSegment).toString()); } public final Builder removePathSegment(int index) { this.encodedPathSegments.remove(index); if (this.encodedPathSegments.isEmpty()) { this.encodedPathSegments.add(""); } return this; } public final Builder encodedPath(String encodedPath) { Intrinsics.checkNotNullParameter(encodedPath, "encodedPath"); if (!StringsKt.startsWith$default(encodedPath, "/", false, 2, (Object) null)) { throw new IllegalArgumentException(("unexpected encodedPath: " + encodedPath).toString()); } resolvePath(encodedPath, 0, encodedPath.length()); return this; } public final Builder query(String query) { String canonicalize$okhttp$default; this.encodedQueryNamesAndValues = (query == null || (canonicalize$okhttp$default = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, query, 0, 0, HttpUrl.QUERY_ENCODE_SET, false, false, true, false, null, 219, null)) == null) ? null : HttpUrl.INSTANCE.toQueryNamesAndValues$okhttp(canonicalize$okhttp$default); return this; } public final Builder encodedQuery(String encodedQuery) { String canonicalize$okhttp$default; this.encodedQueryNamesAndValues = (encodedQuery == null || (canonicalize$okhttp$default = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedQuery, 0, 0, HttpUrl.QUERY_ENCODE_SET, true, false, true, false, null, 211, null)) == null) ? null : HttpUrl.INSTANCE.toQueryNamesAndValues$okhttp(canonicalize$okhttp$default); return this; } public final Builder addQueryParameter(String name, String value) { Intrinsics.checkNotNullParameter(name, "name"); if (this.encodedQueryNamesAndValues == null) { this.encodedQueryNamesAndValues = new ArrayList(); } List list = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list); list.add(Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, name, 0, 0, HttpUrl.QUERY_COMPONENT_ENCODE_SET, false, false, true, false, null, 219, null)); List list2 = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list2); list2.add(value != null ? Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, value, 0, 0, HttpUrl.QUERY_COMPONENT_ENCODE_SET, false, false, true, false, null, 219, null) : null); return this; } public final Builder addEncodedQueryParameter(String encodedName, String encodedValue) { Intrinsics.checkNotNullParameter(encodedName, "encodedName"); if (this.encodedQueryNamesAndValues == null) { this.encodedQueryNamesAndValues = new ArrayList(); } List list = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list); list.add(Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedName, 0, 0, HttpUrl.QUERY_COMPONENT_REENCODE_SET, true, false, true, false, null, 211, null)); List list2 = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list2); list2.add(encodedValue != null ? Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedValue, 0, 0, HttpUrl.QUERY_COMPONENT_REENCODE_SET, true, false, true, false, null, 211, null) : null); return this; } public final Builder setQueryParameter(String name, String value) { Intrinsics.checkNotNullParameter(name, "name"); removeAllQueryParameters(name); addQueryParameter(name, value); return this; } public final Builder setEncodedQueryParameter(String encodedName, String encodedValue) { Intrinsics.checkNotNullParameter(encodedName, "encodedName"); removeAllEncodedQueryParameters(encodedName); addEncodedQueryParameter(encodedName, encodedValue); return this; } public final Builder removeAllQueryParameters(String name) { Intrinsics.checkNotNullParameter(name, "name"); if (this.encodedQueryNamesAndValues == null) { return this; } removeAllCanonicalQueryParameters(Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, name, 0, 0, HttpUrl.QUERY_COMPONENT_ENCODE_SET, false, false, true, false, null, 219, null)); return this; } public final Builder removeAllEncodedQueryParameters(String encodedName) { Intrinsics.checkNotNullParameter(encodedName, "encodedName"); if (this.encodedQueryNamesAndValues == null) { return this; } removeAllCanonicalQueryParameters(Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedName, 0, 0, HttpUrl.QUERY_COMPONENT_REENCODE_SET, true, false, true, false, null, 211, null)); return this; } private final void removeAllCanonicalQueryParameters(String canonicalName) { List list = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list); IntProgression step = RangesKt.step(RangesKt.downTo(list.size() - 2, 0), 2); int first = step.getFirst(); int last = step.getLast(); int step2 = step.getStep(); if (step2 >= 0) { if (first > last) { return; } } else if (first < last) { return; } while (true) { List list2 = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list2); if (Intrinsics.areEqual(canonicalName, list2.get(first))) { List list3 = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list3); list3.remove(first + 1); List list4 = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list4); list4.remove(first); List list5 = this.encodedQueryNamesAndValues; Intrinsics.checkNotNull(list5); if (list5.isEmpty()) { this.encodedQueryNamesAndValues = null; return; } } if (first == last) { return; } else { first += step2; } } } public final Builder fragment(String fragment) { this.encodedFragment = fragment != null ? Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, fragment, 0, 0, "", false, false, false, true, null, 187, null) : null; return this; } public final Builder encodedFragment(String encodedFragment) { this.encodedFragment = encodedFragment != null ? Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, encodedFragment, 0, 0, "", true, false, false, true, null, 179, null) : null; return this; } public final Builder reencodeForUri$okhttp() { String str = this.host; this.host = str != null ? new Regex("[\"<>^`{|}]").replace(str, "") : null; int size = this.encodedPathSegments.size(); for (int i = 0; i < size; i++) { this.encodedPathSegments.set(i, Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, this.encodedPathSegments.get(i), 0, 0, HttpUrl.PATH_SEGMENT_ENCODE_SET_URI, true, true, false, false, null, 227, null)); } List list = this.encodedQueryNamesAndValues; if (list != null) { int size2 = list.size(); for (int i2 = 0; i2 < size2; i2++) { String str2 = list.get(i2); list.set(i2, str2 != null ? Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, str2, 0, 0, HttpUrl.QUERY_COMPONENT_ENCODE_SET_URI, true, true, true, false, null, 195, null) : null); } } String str3 = this.encodedFragment; this.encodedFragment = str3 != null ? Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, str3, 0, 0, HttpUrl.FRAGMENT_ENCODE_SET_URI, true, true, false, true, null, 163, null) : null; return this; } public final HttpUrl build() { ArrayList arrayList; String str = this.scheme; if (str == null) { throw new IllegalStateException("scheme == null"); } String percentDecode$okhttp$default = Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, this.encodedUsername, 0, 0, false, 7, null); String percentDecode$okhttp$default2 = Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, this.encodedPassword, 0, 0, false, 7, null); String str2 = this.host; if (str2 == null) { throw new IllegalStateException("host == null"); } int effectivePort = effectivePort(); List list = this.encodedPathSegments; ArrayList arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10)); Iterator it = list.iterator(); while (it.hasNext()) { arrayList2.add(Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, (String) it.next(), 0, 0, false, 7, null)); } ArrayList arrayList3 = arrayList2; List list2 = this.encodedQueryNamesAndValues; if (list2 != null) { List list3 = list2; ArrayList arrayList4 = new ArrayList(CollectionsKt.collectionSizeOrDefault(list3, 10)); for (String str3 : list3) { arrayList4.add(str3 != null ? Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, str3, 0, 0, true, 3, null) : null); } arrayList = arrayList4; } else { arrayList = null; } String str4 = this.encodedFragment; return new HttpUrl(str, percentDecode$okhttp$default, percentDecode$okhttp$default2, str2, effectivePort, arrayList3, arrayList, str4 != null ? Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, str4, 0, 0, false, 7, null) : null, toString()); } /* JADX WARN: Code restructure failed: missing block: B:30:0x008d, code lost: if (r1 != r3.defaultPort(r4)) goto L29; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public java.lang.String toString() { /* r6 = this; java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() java.lang.String r1 = r6.scheme if (r1 == 0) goto L12 r0.append(r1) java.lang.String r1 = "://" r0.append(r1) goto L17 L12: java.lang.String r1 = "//" r0.append(r1) L17: java.lang.String r1 = r6.encodedUsername java.lang.CharSequence r1 = (java.lang.CharSequence) r1 int r1 = r1.length() r2 = 58 if (r1 <= 0) goto L24 goto L2e L24: java.lang.String r1 = r6.encodedPassword java.lang.CharSequence r1 = (java.lang.CharSequence) r1 int r1 = r1.length() if (r1 <= 0) goto L4a L2e: java.lang.String r1 = r6.encodedUsername r0.append(r1) java.lang.String r1 = r6.encodedPassword java.lang.CharSequence r1 = (java.lang.CharSequence) r1 int r1 = r1.length() if (r1 <= 0) goto L45 r0.append(r2) java.lang.String r1 = r6.encodedPassword r0.append(r1) L45: r1 = 64 r0.append(r1) L4a: java.lang.String r1 = r6.host if (r1 == 0) goto L71 kotlin.jvm.internal.Intrinsics.checkNotNull(r1) java.lang.CharSequence r1 = (java.lang.CharSequence) r1 r3 = 2 r4 = 0 r5 = 0 boolean r1 = kotlin.text.StringsKt.contains$default(r1, r2, r5, r3, r4) if (r1 == 0) goto L6c r1 = 91 r0.append(r1) java.lang.String r1 = r6.host r0.append(r1) r1 = 93 r0.append(r1) goto L71 L6c: java.lang.String r1 = r6.host r0.append(r1) L71: int r1 = r6.port r3 = -1 if (r1 != r3) goto L7a java.lang.String r1 = r6.scheme if (r1 == 0) goto L95 L7a: int r1 = r6.effectivePort() java.lang.String r3 = r6.scheme if (r3 == 0) goto L8f okhttp3.HttpUrl$Companion r3 = okhttp3.HttpUrl.INSTANCE java.lang.String r4 = r6.scheme kotlin.jvm.internal.Intrinsics.checkNotNull(r4) int r3 = r3.defaultPort(r4) if (r1 == r3) goto L95 L8f: r0.append(r2) r0.append(r1) L95: okhttp3.HttpUrl$Companion r1 = okhttp3.HttpUrl.INSTANCE java.util.List r2 = r6.encodedPathSegments r1.toPathString$okhttp(r2, r0) java.util.List r1 = r6.encodedQueryNamesAndValues if (r1 == 0) goto Laf r1 = 63 r0.append(r1) okhttp3.HttpUrl$Companion r1 = okhttp3.HttpUrl.INSTANCE java.util.List r2 = r6.encodedQueryNamesAndValues kotlin.jvm.internal.Intrinsics.checkNotNull(r2) r1.toQueryString$okhttp(r2, r0) Laf: java.lang.String r1 = r6.encodedFragment if (r1 == 0) goto Lbd r1 = 35 r0.append(r1) java.lang.String r6 = r6.encodedFragment r0.append(r6) Lbd: java.lang.String r6 = r0.toString() java.lang.String r0 = "StringBuilder().apply(builderAction).toString()" kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r6, r0) return r6 */ throw new UnsupportedOperationException("Method not decompiled: okhttp3.HttpUrl.Builder.toString():java.lang.String"); } public final Builder parse$okhttp(HttpUrl base, String input) { int delimiterOffset; int i; int i2; String str; boolean z; int i3; String str2; int i4; boolean z2; boolean z3; Intrinsics.checkNotNullParameter(input, "input"); int indexOfFirstNonAsciiWhitespace$default = Util.indexOfFirstNonAsciiWhitespace$default(input, 0, 0, 3, null); int indexOfLastNonAsciiWhitespace$default = Util.indexOfLastNonAsciiWhitespace$default(input, indexOfFirstNonAsciiWhitespace$default, 0, 2, null); Companion companion = INSTANCE; int schemeDelimiterOffset = companion.schemeDelimiterOffset(input, indexOfFirstNonAsciiWhitespace$default, indexOfLastNonAsciiWhitespace$default); String str3 = "(this as java.lang.Strin…ing(startIndex, endIndex)"; boolean z4 = true; char c = 65535; if (schemeDelimiterOffset != -1) { if (StringsKt.startsWith(input, "https:", indexOfFirstNonAsciiWhitespace$default, true)) { this.scheme = "https"; indexOfFirstNonAsciiWhitespace$default += 6; } else { if (!StringsKt.startsWith(input, "http:", indexOfFirstNonAsciiWhitespace$default, true)) { StringBuilder sb = new StringBuilder("Expected URL scheme 'http' or 'https' but was '"); String substring = input.substring(0, schemeDelimiterOffset); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); throw new IllegalArgumentException(sb.append(substring).append("'").toString()); } this.scheme = "http"; indexOfFirstNonAsciiWhitespace$default += 5; } } else if (base != null) { this.scheme = base.scheme(); } else { throw new IllegalArgumentException("Expected URL scheme 'http' or 'https' but no colon was found"); } int slashCount = companion.slashCount(input, indexOfFirstNonAsciiWhitespace$default, indexOfLastNonAsciiWhitespace$default); char c2 = '?'; char c3 = '#'; if (slashCount < 2 && base != null && !(!Intrinsics.areEqual(base.scheme(), this.scheme))) { this.encodedUsername = base.encodedUsername(); this.encodedPassword = base.encodedPassword(); this.host = base.host(); this.port = base.port(); this.encodedPathSegments.clear(); this.encodedPathSegments.addAll(base.encodedPathSegments()); if (indexOfFirstNonAsciiWhitespace$default == indexOfLastNonAsciiWhitespace$default || input.charAt(indexOfFirstNonAsciiWhitespace$default) == '#') { encodedQuery(base.encodedQuery()); } i = indexOfLastNonAsciiWhitespace$default; } else { int i5 = indexOfFirstNonAsciiWhitespace$default + slashCount; boolean z5 = false; boolean z6 = false; while (true) { delimiterOffset = Util.delimiterOffset(input, "@/\\?#", i5, indexOfLastNonAsciiWhitespace$default); char charAt = delimiterOffset != indexOfLastNonAsciiWhitespace$default ? input.charAt(delimiterOffset) : c; if (charAt == c || charAt == c3 || charAt == '/' || charAt == '\\' || charAt == c2) { break; } if (charAt != '@') { z = z4; str2 = str3; i3 = indexOfLastNonAsciiWhitespace$default; } else { if (!z5) { int delimiterOffset2 = Util.delimiterOffset(input, ':', i5, delimiterOffset); z = z4; i3 = indexOfLastNonAsciiWhitespace$default; String str4 = str3; String canonicalize$okhttp$default = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, i5, delimiterOffset2, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 240, null); if (z6) { canonicalize$okhttp$default = this.encodedUsername + "%40" + canonicalize$okhttp$default; } this.encodedUsername = canonicalize$okhttp$default; if (delimiterOffset2 != delimiterOffset) { this.encodedPassword = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, delimiterOffset2 + 1, delimiterOffset, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 240, null); z3 = z; } else { z3 = z5; } z5 = z3; str2 = str4; z2 = z; i4 = delimiterOffset; } else { z = z4; i3 = indexOfLastNonAsciiWhitespace$default; str2 = str3; i4 = delimiterOffset; this.encodedPassword += "%40" + Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, i5, delimiterOffset, " \"':;<=>@[]^`{}|/\\?#", true, false, false, false, null, 240, null); z2 = z6; } i5 = i4 + 1; z6 = z2; } z4 = z; indexOfLastNonAsciiWhitespace$default = i3; str3 = str2; c3 = '#'; c2 = '?'; c = 65535; } boolean z7 = z4; String str5 = str3; i = indexOfLastNonAsciiWhitespace$default; Companion companion2 = INSTANCE; int portColonOffset = companion2.portColonOffset(input, i5, delimiterOffset); int i6 = portColonOffset + 1; if (i6 < delimiterOffset) { i2 = i5; this.host = HostnamesKt.toCanonicalHost(Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, input, i5, portColonOffset, false, 4, null)); int parsePort = companion2.parsePort(input, i6, delimiterOffset); this.port = parsePort; if (!(parsePort != -1 ? z7 : false)) { StringBuilder sb2 = new StringBuilder("Invalid URL port: \""); String substring2 = input.substring(i6, delimiterOffset); Intrinsics.checkNotNullExpressionValue(substring2, str5); throw new IllegalArgumentException(sb2.append(substring2).append(Typography.quote).toString().toString()); } str = str5; } else { i2 = i5; str = str5; this.host = HostnamesKt.toCanonicalHost(Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, input, i2, portColonOffset, false, 4, null)); Companion companion3 = HttpUrl.INSTANCE; String str6 = this.scheme; Intrinsics.checkNotNull(str6); this.port = companion3.defaultPort(str6); } if (!(this.host != null ? z7 : false)) { StringBuilder sb3 = new StringBuilder("Invalid URL host: \""); String substring3 = input.substring(i2, portColonOffset); Intrinsics.checkNotNullExpressionValue(substring3, str); throw new IllegalArgumentException(sb3.append(substring3).append(Typography.quote).toString().toString()); } indexOfFirstNonAsciiWhitespace$default = delimiterOffset; } int i7 = i; int delimiterOffset3 = Util.delimiterOffset(input, "?#", indexOfFirstNonAsciiWhitespace$default, i7); resolvePath(input, indexOfFirstNonAsciiWhitespace$default, delimiterOffset3); if (delimiterOffset3 < i7 && input.charAt(delimiterOffset3) == '?') { int delimiterOffset4 = Util.delimiterOffset(input, '#', delimiterOffset3, i7); this.encodedQueryNamesAndValues = HttpUrl.INSTANCE.toQueryNamesAndValues$okhttp(Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, delimiterOffset3 + 1, delimiterOffset4, HttpUrl.QUERY_ENCODE_SET, true, false, true, false, null, 208, null)); delimiterOffset3 = delimiterOffset4; } if (delimiterOffset3 < i7 && input.charAt(delimiterOffset3) == '#') { this.encodedFragment = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, delimiterOffset3 + 1, i7, "", true, false, false, true, null, 176, null); } return this; } private final void resolvePath(String input, int startPos, int limit) { if (startPos == limit) { return; } char charAt = input.charAt(startPos); if (charAt == '/' || charAt == '\\') { this.encodedPathSegments.clear(); this.encodedPathSegments.add(""); startPos++; } else { List list = this.encodedPathSegments; list.set(list.size() - 1, ""); } while (true) { int i = startPos; if (i >= limit) { return; } startPos = Util.delimiterOffset(input, "/\\", i, limit); boolean z = startPos < limit; push(input, i, startPos, z, true); if (z) { startPos++; } } } private final void push(String input, int pos, int limit, boolean addTrailingSlash, boolean alreadyEncoded) { String canonicalize$okhttp$default = Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, pos, limit, HttpUrl.PATH_SEGMENT_ENCODE_SET, alreadyEncoded, false, false, false, null, 240, null); if (isDot(canonicalize$okhttp$default)) { return; } if (isDotDot(canonicalize$okhttp$default)) { pop(); return; } if (this.encodedPathSegments.get(r2.size() - 1).length() == 0) { this.encodedPathSegments.set(r2.size() - 1, canonicalize$okhttp$default); } else { this.encodedPathSegments.add(canonicalize$okhttp$default); } if (addTrailingSlash) { this.encodedPathSegments.add(""); } } private final boolean isDot(String input) { return Intrinsics.areEqual(input, ".") || StringsKt.equals(input, "%2e", true); } private final boolean isDotDot(String input) { return Intrinsics.areEqual(input, "..") || StringsKt.equals(input, "%2e.", true) || StringsKt.equals(input, ".%2e", true) || StringsKt.equals(input, "%2e%2e", true); } private final void pop() { if (this.encodedPathSegments.remove(r0.size() - 1).length() == 0 && (!this.encodedPathSegments.isEmpty())) { this.encodedPathSegments.set(r2.size() - 1, ""); } else { this.encodedPathSegments.add(""); } } /* compiled from: HttpUrl.kt */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0007\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J \u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\u0006H\u0002J \u0010\n\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\u0006H\u0002J \u0010\u000b\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\u0006H\u0002J\u001c\u0010\f\u001a\u00020\u0006*\u00020\u00042\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\u0006H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lokhttp3/HttpUrl$Builder$Companion;", "", "()V", "INVALID_HOST", "", "parsePort", "", "input", "pos", "limit", "portColonOffset", "schemeDelimiterOffset", "slashCount", "okhttp"}, k = 1, mv = {1, 4, 0}) /* loaded from: classes3.dex */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } /* JADX INFO: Access modifiers changed from: private */ public final int schemeDelimiterOffset(String input, int pos, int limit) { if (limit - pos < 2) { return -1; } char charAt = input.charAt(pos); if ((Intrinsics.compare((int) charAt, 97) < 0 || Intrinsics.compare((int) charAt, 122) > 0) && (Intrinsics.compare((int) charAt, 65) < 0 || Intrinsics.compare((int) charAt, 90) > 0)) { return -1; } while (true) { pos++; if (pos >= limit) { return -1; } char charAt2 = input.charAt(pos); if ('a' > charAt2 || 'z' < charAt2) { if ('A' > charAt2 || 'Z' < charAt2) { if ('0' > charAt2 || '9' < charAt2) { if (charAt2 != '+' && charAt2 != '-' && charAt2 != '.') { if (charAt2 == ':') { return pos; } return -1; } } } } } } /* JADX INFO: Access modifiers changed from: private */ public final int slashCount(String str, int i, int i2) { int i3 = 0; while (i < i2) { char charAt = str.charAt(i); if (charAt != '\\' && charAt != '/') { break; } i3++; i++; } return i3; } /* JADX INFO: Access modifiers changed from: private */ public final int portColonOffset(String input, int pos, int limit) { while (pos < limit) { char charAt = input.charAt(pos); if (charAt == ':') { return pos; } if (charAt != '[') { pos++; } do { pos++; if (pos < limit) { } pos++; } while (input.charAt(pos) != ']'); pos++; } return limit; } /* JADX INFO: Access modifiers changed from: private */ public final int parsePort(String input, int pos, int limit) { try { int parseInt = Integer.parseInt(Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, input, pos, limit, "", false, false, false, false, null, 248, null)); if (1 <= parseInt && 65535 >= parseInt) { return parseInt; } return -1; } catch (NumberFormatException unused) { return -1; } } } } /* compiled from: HttpUrl.kt */ @Metadata(bv = {1, 0, 3}, d1 = {"\u0000p\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0019\n\u0002\b\t\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u0004H\u0007J\u0017\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0007¢\u0006\u0002\b\u0018J\u0017\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0019\u001a\u00020\u001aH\u0007¢\u0006\u0002\b\u0018J\u0015\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0019\u001a\u00020\u0004H\u0007¢\u0006\u0002\b\u0018J\u0017\u0010\u001b\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0019\u001a\u00020\u0004H\u0007¢\u0006\u0002\b\u001cJa\u0010\u001d\u001a\u00020\u0004*\u00020\u00042\b\b\u0002\u0010\u001e\u001a\u00020\u00122\b\b\u0002\u0010\u001f\u001a\u00020\u00122\u0006\u0010 \u001a\u00020\u00042\b\b\u0002\u0010!\u001a\u00020\"2\b\b\u0002\u0010#\u001a\u00020\"2\b\b\u0002\u0010$\u001a\u00020\"2\b\b\u0002\u0010%\u001a\u00020\"2\n\b\u0002\u0010&\u001a\u0004\u0018\u00010'H\u0000¢\u0006\u0002\b(J\u001c\u0010)\u001a\u00020\"*\u00020\u00042\u0006\u0010\u001e\u001a\u00020\u00122\u0006\u0010\u001f\u001a\u00020\u0012H\u0002J/\u0010*\u001a\u00020\u0004*\u00020\u00042\b\b\u0002\u0010\u001e\u001a\u00020\u00122\b\b\u0002\u0010\u001f\u001a\u00020\u00122\b\b\u0002\u0010$\u001a\u00020\"H\u0000¢\u0006\u0002\b+J\u0011\u0010,\u001a\u00020\u0015*\u00020\u0004H\u0007¢\u0006\u0002\b\u0014J\u0013\u0010-\u001a\u0004\u0018\u00010\u0015*\u00020\u0017H\u0007¢\u0006\u0002\b\u0014J\u0013\u0010-\u001a\u0004\u0018\u00010\u0015*\u00020\u001aH\u0007¢\u0006\u0002\b\u0014J\u0013\u0010-\u001a\u0004\u0018\u00010\u0015*\u00020\u0004H\u0007¢\u0006\u0002\b\u001bJ#\u0010.\u001a\u00020/*\b\u0012\u0004\u0012\u00020\u0004002\n\u00101\u001a\u000602j\u0002`3H\u0000¢\u0006\u0002\b4J\u0019\u00105\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u000406*\u00020\u0004H\u0000¢\u0006\u0002\b7J%\u00108\u001a\u00020/*\n\u0012\u0006\u0012\u0004\u0018\u00010\u0004002\n\u00101\u001a\u000602j\u0002`3H\u0000¢\u0006\u0002\b9JV\u0010:\u001a\u00020/*\u00020;2\u0006\u0010<\u001a\u00020\u00042\u0006\u0010\u001e\u001a\u00020\u00122\u0006\u0010\u001f\u001a\u00020\u00122\u0006\u0010 \u001a\u00020\u00042\u0006\u0010!\u001a\u00020\"2\u0006\u0010#\u001a\u00020\"2\u0006\u0010$\u001a\u00020\"2\u0006\u0010%\u001a\u00020\"2\b\u0010&\u001a\u0004\u0018\u00010'H\u0002J,\u0010=\u001a\u00020/*\u00020;2\u0006\u0010>\u001a\u00020\u00042\u0006\u0010\u001e\u001a\u00020\u00122\u0006\u0010\u001f\u001a\u00020\u00122\u0006\u0010$\u001a\u00020\"H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000¨\u0006?"}, d2 = {"Lokhttp3/HttpUrl$Companion;", "", "()V", "FORM_ENCODE_SET", "", "FRAGMENT_ENCODE_SET", "FRAGMENT_ENCODE_SET_URI", "HEX_DIGITS", "", "PASSWORD_ENCODE_SET", "PATH_SEGMENT_ENCODE_SET", "PATH_SEGMENT_ENCODE_SET_URI", "QUERY_COMPONENT_ENCODE_SET", "QUERY_COMPONENT_ENCODE_SET_URI", "QUERY_COMPONENT_REENCODE_SET", "QUERY_ENCODE_SET", "USERNAME_ENCODE_SET", "defaultPort", "", "scheme", "get", "Lokhttp3/HttpUrl;", "uri", "Ljava/net/URI;", "-deprecated_get", Request.JsonKeys.URL, "Ljava/net/URL;", "parse", "-deprecated_parse", "canonicalize", "pos", "limit", "encodeSet", "alreadyEncoded", "", "strict", "plusIsSpace", "unicodeAllowed", "charset", "Ljava/nio/charset/Charset;", "canonicalize$okhttp", "isPercentEncoded", "percentDecode", "percentDecode$okhttp", "toHttpUrl", "toHttpUrlOrNull", "toPathString", "", "", "out", "Ljava/lang/StringBuilder;", "Lkotlin/text/StringBuilder;", "toPathString$okhttp", "toQueryNamesAndValues", "", "toQueryNamesAndValues$okhttp", "toQueryString", "toQueryString$okhttp", "writeCanonicalized", "Lokio/Buffer;", "input", "writePercentDecoded", "encoded", "okhttp"}, k = 1, mv = {1, 4, 0}) /* loaded from: classes3.dex */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } @JvmStatic public final int defaultPort(String scheme) { Intrinsics.checkNotNullParameter(scheme, "scheme"); int hashCode = scheme.hashCode(); if (hashCode == 3213448) { if (scheme.equals("http")) { return 80; } } else if (hashCode == 99617003 && scheme.equals("https")) { return 443; } return -1; } public final void toPathString$okhttp(List toPathString, StringBuilder out) { Intrinsics.checkNotNullParameter(toPathString, "$this$toPathString"); Intrinsics.checkNotNullParameter(out, "out"); int size = toPathString.size(); for (int i = 0; i < size; i++) { out.append('/'); out.append(toPathString.get(i)); } } public final void toQueryString$okhttp(List toQueryString, StringBuilder out) { Intrinsics.checkNotNullParameter(toQueryString, "$this$toQueryString"); Intrinsics.checkNotNullParameter(out, "out"); IntProgression step = RangesKt.step(RangesKt.until(0, toQueryString.size()), 2); int first = step.getFirst(); int last = step.getLast(); int step2 = step.getStep(); if (step2 >= 0) { if (first > last) { return; } } else if (first < last) { return; } while (true) { String str = toQueryString.get(first); String str2 = toQueryString.get(first + 1); if (first > 0) { out.append(Typography.amp); } out.append(str); if (str2 != null) { out.append('='); out.append(str2); } if (first == last) { return; } else { first += step2; } } } public final List toQueryNamesAndValues$okhttp(String toQueryNamesAndValues) { Intrinsics.checkNotNullParameter(toQueryNamesAndValues, "$this$toQueryNamesAndValues"); ArrayList arrayList = new ArrayList(); int i = 0; while (i <= toQueryNamesAndValues.length()) { String str = toQueryNamesAndValues; int indexOf$default = StringsKt.indexOf$default((CharSequence) str, Typography.amp, i, false, 4, (Object) null); if (indexOf$default == -1) { indexOf$default = toQueryNamesAndValues.length(); } int i2 = indexOf$default; int indexOf$default2 = StringsKt.indexOf$default((CharSequence) str, '=', i, false, 4, (Object) null); if (indexOf$default2 == -1 || indexOf$default2 > i2) { String substring = toQueryNamesAndValues.substring(i, i2); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); arrayList.add(substring); arrayList.add(null); } else { String substring2 = toQueryNamesAndValues.substring(i, indexOf$default2); Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.Strin…ing(startIndex, endIndex)"); arrayList.add(substring2); String substring3 = toQueryNamesAndValues.substring(indexOf$default2 + 1, i2); Intrinsics.checkNotNullExpressionValue(substring3, "(this as java.lang.Strin…ing(startIndex, endIndex)"); arrayList.add(substring3); } i = i2 + 1; } return arrayList; } @JvmStatic public final HttpUrl get(String toHttpUrl) { Intrinsics.checkNotNullParameter(toHttpUrl, "$this$toHttpUrl"); return new Builder().parse$okhttp(null, toHttpUrl).build(); } @JvmStatic public final HttpUrl parse(String toHttpUrlOrNull) { Intrinsics.checkNotNullParameter(toHttpUrlOrNull, "$this$toHttpUrlOrNull"); try { Companion companion = this; return get(toHttpUrlOrNull); } catch (IllegalArgumentException unused) { return null; } } @JvmStatic public final HttpUrl get(URL toHttpUrlOrNull) { Intrinsics.checkNotNullParameter(toHttpUrlOrNull, "$this$toHttpUrlOrNull"); String url = toHttpUrlOrNull.toString(); Intrinsics.checkNotNullExpressionValue(url, "toString()"); return parse(url); } @JvmStatic public final HttpUrl get(URI toHttpUrlOrNull) { Intrinsics.checkNotNullParameter(toHttpUrlOrNull, "$this$toHttpUrlOrNull"); String uri = toHttpUrlOrNull.toString(); Intrinsics.checkNotNullExpressionValue(uri, "toString()"); return parse(uri); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "url.toHttpUrl()", imports = {"okhttp3.HttpUrl.Companion.toHttpUrl"})) /* renamed from: -deprecated_get, reason: not valid java name */ public final HttpUrl m7340deprecated_get(String url) { Intrinsics.checkNotNullParameter(url, "url"); return get(url); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "url.toHttpUrlOrNull()", imports = {"okhttp3.HttpUrl.Companion.toHttpUrlOrNull"})) /* renamed from: -deprecated_parse, reason: not valid java name */ public final HttpUrl m7343deprecated_parse(String url) { Intrinsics.checkNotNullParameter(url, "url"); return parse(url); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "url.toHttpUrlOrNull()", imports = {"okhttp3.HttpUrl.Companion.toHttpUrlOrNull"})) /* renamed from: -deprecated_get, reason: not valid java name */ public final HttpUrl m7342deprecated_get(URL url) { Intrinsics.checkNotNullParameter(url, "url"); return get(url); } @Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "uri.toHttpUrlOrNull()", imports = {"okhttp3.HttpUrl.Companion.toHttpUrlOrNull"})) /* renamed from: -deprecated_get, reason: not valid java name */ public final HttpUrl m7341deprecated_get(URI uri) { Intrinsics.checkNotNullParameter(uri, "uri"); return get(uri); } public static /* synthetic */ String percentDecode$okhttp$default(Companion companion, String str, int i, int i2, boolean z, int i3, Object obj) { if ((i3 & 1) != 0) { i = 0; } if ((i3 & 2) != 0) { i2 = str.length(); } if ((i3 & 4) != 0) { z = false; } return companion.percentDecode$okhttp(str, i, i2, z); } public final String percentDecode$okhttp(String percentDecode, int i, int i2, boolean z) { Intrinsics.checkNotNullParameter(percentDecode, "$this$percentDecode"); for (int i3 = i; i3 < i2; i3++) { char charAt = percentDecode.charAt(i3); if (charAt == '%' || (charAt == '+' && z)) { Buffer buffer = new Buffer(); buffer.writeUtf8(percentDecode, i, i3); writePercentDecoded(buffer, percentDecode, i3, i2, z); return buffer.readUtf8(); } } String substring = percentDecode.substring(i, i2); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); return substring; } private final void writePercentDecoded(Buffer buffer, String str, int i, int i2, boolean z) { int i3; while (i < i2) { if (str != null) { int codePointAt = str.codePointAt(i); if (codePointAt == 37 && (i3 = i + 2) < i2) { int parseHexDigit = Util.parseHexDigit(str.charAt(i + 1)); int parseHexDigit2 = Util.parseHexDigit(str.charAt(i3)); if (parseHexDigit != -1 && parseHexDigit2 != -1) { buffer.writeByte((parseHexDigit << 4) + parseHexDigit2); i = i3 + Character.charCount(codePointAt); } buffer.writeUtf8CodePoint(codePointAt); i += Character.charCount(codePointAt); } else { if (codePointAt == 43 && z) { buffer.writeByte(32); i++; } buffer.writeUtf8CodePoint(codePointAt); i += Character.charCount(codePointAt); } } else { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } } } private final boolean isPercentEncoded(String str, int i, int i2) { int i3 = i + 2; return i3 < i2 && str.charAt(i) == '%' && Util.parseHexDigit(str.charAt(i + 1)) != -1 && Util.parseHexDigit(str.charAt(i3)) != -1; } public static /* synthetic */ String canonicalize$okhttp$default(Companion companion, String str, int i, int i2, String str2, boolean z, boolean z2, boolean z3, boolean z4, Charset charset, int i3, Object obj) { Charset charset2; int i4 = (i3 & 1) != 0 ? 0 : i; int length = (i3 & 2) != 0 ? str.length() : i2; boolean z5 = (i3 & 8) != 0 ? false : z; boolean z6 = (i3 & 16) != 0 ? false : z2; boolean z7 = (i3 & 32) != 0 ? false : z3; boolean z8 = (i3 & 64) != 0 ? false : z4; if ((i3 & 128) != 0) { charset2 = null; } else { charset2 = charset; } return companion.canonicalize$okhttp(str, i4, length, str2, z5, z6, z7, z8, charset2); } public final String canonicalize$okhttp(String canonicalize, int i, int i2, String encodeSet, boolean z, boolean z2, boolean z3, boolean z4, Charset charset) { Intrinsics.checkNotNullParameter(canonicalize, "$this$canonicalize"); Intrinsics.checkNotNullParameter(encodeSet, "encodeSet"); int i3 = i; while (i3 < i2) { int codePointAt = canonicalize.codePointAt(i3); if (codePointAt < 32 || codePointAt == 127 || ((codePointAt >= 128 && !z4) || StringsKt.contains$default((CharSequence) encodeSet, (char) codePointAt, false, 2, (Object) null) || ((codePointAt == 37 && (!z || (z2 && !isPercentEncoded(canonicalize, i3, i2)))) || (codePointAt == 43 && z3)))) { Buffer buffer = new Buffer(); buffer.writeUtf8(canonicalize, i, i3); writeCanonicalized(buffer, canonicalize, i3, i2, encodeSet, z, z2, z3, z4, charset); return buffer.readUtf8(); } i3 += Character.charCount(codePointAt); } String substring = canonicalize.substring(i, i2); Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)"); return substring; } private final void writeCanonicalized(Buffer buffer, String str, int i, int i2, String str2, boolean z, boolean z2, boolean z3, boolean z4, Charset charset) { int i3 = i; Buffer buffer2 = null; while (i3 < i2) { if (str != null) { int codePointAt = str.codePointAt(i3); if (!z || (codePointAt != 9 && codePointAt != 10 && codePointAt != 12 && codePointAt != 13)) { if (codePointAt == 43 && z3) { buffer.writeUtf8(z ? "+" : "%2B"); } else if (codePointAt < 32 || codePointAt == 127 || ((codePointAt >= 128 && !z4) || StringsKt.contains$default((CharSequence) str2, (char) codePointAt, false, 2, (Object) null) || (codePointAt == 37 && (!z || (z2 && !isPercentEncoded(str, i3, i2)))))) { if (buffer2 == null) { buffer2 = new Buffer(); } if (charset == null || Intrinsics.areEqual(charset, StandardCharsets.UTF_8)) { buffer2.writeUtf8CodePoint(codePointAt); } else { buffer2.writeString(str, i3, Character.charCount(codePointAt) + i3, charset); } while (!buffer2.exhausted()) { byte readByte = buffer2.readByte(); buffer.writeByte(37); buffer.writeByte((int) HttpUrl.HEX_DIGITS[((readByte & 255) >> 4) & 15]); buffer.writeByte((int) HttpUrl.HEX_DIGITS[readByte & Ascii.SI]); } } else { buffer.writeUtf8CodePoint(codePointAt); } } i3 += Character.charCount(codePointAt); } else { throw new NullPointerException("null cannot be cast to non-null type java.lang.String"); } } } } }