discord-jadx/app/src/main/java/c/a/d/p0/b.java

134 lines
5.3 KiB
Java

package c.a.d.p0;
import android.net.Uri;
import d0.g0.i;
import d0.g0.t;
import d0.z.d.m;
import kotlin.text.Regex;
/* compiled from: RoutingPatterns.kt */
public final class b {
public static final Regex A;
public static final Regex B;
public static final Regex C;
public static final Regex D = new Regex("^/ra/([\\w-]+)$");
public static final Regex E;
public static final b F;
public static final String a;
public static final String b;
/* renamed from: c reason: collision with root package name */
public static final String f46c;
public static final String d;
public static final String e;
public static final String f;
public static final String g;
public static final String h;
public static final String i;
public static final String j;
public static final String k;
public static final Regex l;
public static final Regex m;
public static final Regex n;
public static final Regex o;
public static final Regex p;
public static final Regex q;
public static final Regex r;
/* renamed from: s reason: collision with root package name */
public static final Regex f47s;
public static final Regex t;
public static final Regex u;
public static final Regex v;
public static final Regex w;
/* renamed from: x reason: collision with root package name */
public static final Regex f48x;
/* renamed from: y reason: collision with root package name */
public static final Regex f49y;
/* renamed from: z reason: collision with root package name */
public static final Regex f50z;
static {
b bVar = new b();
F = bVar;
String b2 = bVar.b("https://discord.com");
a = b2;
String b3 = bVar.b("https://discordapp.com");
b = b3;
String b4 = bVar.b("https://discord.gift");
f46c = b4;
String b5 = bVar.b("https://discord.gg");
d = b5;
String b6 = bVar.b("https://discord.new");
e = b6;
String replace$default = t.replace$default(b2, ".", "\\.", false, 4, (Object) null);
f = replace$default;
String replace$default2 = t.replace$default(b3, ".", "\\.", false, 4, (Object) null);
g = replace$default2;
String str = "(?:" + replace$default + '|' + replace$default2 + ')';
h = str;
String replace$default3 = t.replace$default(b4, ".", "\\.", false, 4, (Object) null);
i = replace$default3;
String replace$default4 = t.replace$default(b5, ".", "\\.", false, 4, (Object) null);
j = replace$default4;
String replace$default5 = t.replace$default(b6, ".", "\\.", false, 4, (Object) null);
k = replace$default5;
i iVar = i.IGNORE_CASE;
l = new Regex("^(?:ptb|canary|www)." + str + '$', iVar);
m = new Regex("^/(?:(invite|gift|template)/)?([\\w-]+)/?$", iVar);
n = new Regex("^/(?:invite/)?([\\w-]+)/?$", iVar);
StringBuilder sb = new StringBuilder();
sb.append("(?:https?://(?:(?:" + str + "/invite)|");
sb.append("(?:" + replace$default4 + "))|");
sb.append("(?:^" + replace$default4 + "))/([\\w-]+)/?");
String sb2 = sb.toString();
m.checkNotNullExpressionValue(sb2, "StringBuilder()\n …?\")\n .toString()");
o = new Regex(sb2, iVar);
p = new Regex("^/(?:template/)?([\\w-]+)/?$", iVar);
StringBuilder sb3 = new StringBuilder();
sb3.append("(?:https?://(?:(?:" + str + "/template)|");
sb3.append("(?:" + replace$default5 + "))|");
sb3.append("(?:" + replace$default5 + "))/([\\w-]+)/?");
String sb4 = sb3.toString();
m.checkNotNullExpressionValue(sb4, "StringBuilder()\n …?\")\n .toString()");
q = new Regex(sb4, iVar);
StringBuilder sb5 = new StringBuilder();
sb5.append("(?:https?://)?(?:(?:" + str + "/gifts)|");
sb5.append("(?:" + replace$default3 + "))/([\\w-]+)/?");
String sb6 = sb5.toString();
m.checkNotNullExpressionValue(sb6, "StringBuilder()\n …?\")\n .toString()");
r = new Regex(sb6, iVar);
f47s = new Regex("^/connect(?:/(\\d+))?/?$", iVar);
t = new Regex("^/channels/((?:@me)|(?:\\d+))(?:/(\\d+))?(?:/(\\d+))?/?$", iVar);
u = new Regex("^/channels/@me/-1?/?$", iVar);
v = new Regex("^/lurk/(\\d+)(?:/(\\d+))?/?$", iVar);
w = new Regex("^/channels/@me/user/(\\d+)/?$", iVar);
f48x = new Regex("^/users/(\\d+)/?$", iVar);
f49y = new Regex("^/discovery/?$", iVar);
f50z = new Regex("^/settings(/\\w+)*/?$", iVar);
A = new Regex("^/feature(/\\w+)*/?$", iVar);
B = new Regex("^/query(/\\w+)*/?$", iVar);
C = new Regex("^/(?:oauth2|connect)/authorize/?$", iVar);
E = new Regex("^/guild/((?:@me)|(?:\\d+))/premiumguild/?$", iVar);
}
public final boolean a(String str) {
if (str == null) {
return false;
}
if (!m.areEqual(str, a) && !m.areEqual(str, b) && !m.areEqual(str, f46c) && !m.areEqual(str, e) && !m.areEqual(str, d)) {
return l.matches(str);
}
return true;
}
public final String b(String str) {
Uri parse = Uri.parse(str);
m.checkNotNullExpressionValue(parse, "Uri.parse(this)");
String host = parse.getHost();
return host != null ? host : "";
}
}