mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 08:32:38 -06:00
854 lines
46 KiB
Java
854 lines
46 KiB
Java
package androidx.navigation;
|
|
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import androidx.navigation.NavDeepLink;
|
|
import io.sentry.SentryOptions;
|
|
import io.sentry.protocol.OperatingSystem;
|
|
import io.sentry.protocol.Request;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.ListIterator;
|
|
import java.util.Map;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import kotlin.Lazy;
|
|
import kotlin.LazyKt;
|
|
import kotlin.LazyThreadSafetyMode;
|
|
import kotlin.Metadata;
|
|
import kotlin.Pair;
|
|
import kotlin.TuplesKt;
|
|
import kotlin.Unit;
|
|
import kotlin.collections.CollectionsKt;
|
|
import kotlin.jvm.JvmStatic;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.Regex;
|
|
import kotlin.text.StringsKt;
|
|
|
|
/* compiled from: NavDeepLink.kt */
|
|
@Metadata(d1 = {"\u0000\u008a\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0010!\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0002\b\u0012\n\u0002\u0010%\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0011\u0018\u0000 m2\u00020\u0001:\u0004lmnoB\u000f\b\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B%\b\u0000\u0012\b\u0010\u0005\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0007\u001a\u0004\u0018\u00010\u0003¢\u0006\u0002\u0010\bJ*\u0010;\u001a\u00020<2\u0006\u0010\u0002\u001a\u00020\u00032\f\u0010=\u001a\b\u0012\u0004\u0012\u00020\u00030\u00102\n\u0010>\u001a\u00060?j\u0002`@H\u0002J\u0017\u0010A\u001a\u00020B2\b\u0010C\u001a\u0004\u0018\u00010DH\u0000¢\u0006\u0002\bEJ\u0013\u0010F\u001a\u00020\"2\b\u0010G\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J(\u0010H\u001a\u0004\u0018\u00010I2\u0006\u0010J\u001a\u00020D2\u0014\u0010K\u001a\u0010\u0012\u0004\u0012\u00020\u0003\u0012\u0006\u0012\u0004\u0018\u00010M0LH\u0007J-\u0010N\u001a\u00020I2\b\u0010J\u001a\u0004\u0018\u00010D2\u0014\u0010K\u001a\u0010\u0012\u0004\u0012\u00020\u0003\u0012\u0006\u0012\u0004\u0018\u00010M0LH\u0000¢\u0006\u0002\bOJ.\u0010P\u001a\u00020\"2\u0006\u0010Q\u001a\u00020R2\u0006\u0010S\u001a\u00020I2\u0014\u0010K\u001a\u0010\u0012\u0004\u0012\u00020\u0003\u0012\u0006\u0012\u0004\u0018\u00010M0LH\u0002J.\u0010T\u001a\u00020\"2\u0006\u0010J\u001a\u00020D2\u0006\u0010S\u001a\u00020I2\u0014\u0010K\u001a\u0010\u0012\u0004\u0012\u00020\u0003\u0012\u0006\u0012\u0004\u0018\u00010M0LH\u0002J0\u0010U\u001a\u00020<2\b\u0010V\u001a\u0004\u0018\u00010\u00032\u0006\u0010S\u001a\u00020I2\u0014\u0010K\u001a\u0010\u0012\u0004\u0012\u00020\u0003\u0012\u0006\u0012\u0004\u0018\u00010M0LH\u0002J\u0010\u0010W\u001a\u00020B2\u0006\u0010\u0007\u001a\u00020\u0003H\u0007J\b\u0010X\u001a\u00020BH\u0016J\u0012\u0010Y\u001a\u00020\"2\b\u0010\u0006\u001a\u0004\u0018\u00010\u0003H\u0002J\u0012\u0010Z\u001a\u00020\"2\b\u0010\u0007\u001a\u0004\u0018\u00010\u0003H\u0002J\u0012\u0010[\u001a\u00020\"2\b\u0010\u0002\u001a\u0004\u0018\u00010DH\u0002J\u0015\u0010\\\u001a\u00020\"2\u0006\u0010\u0002\u001a\u00020DH\u0000¢\u0006\u0002\b]J\u0015\u0010\\\u001a\u00020\"2\u0006\u0010^\u001a\u00020_H\u0000¢\u0006\u0002\b]J*\u0010`\u001a\u00020\"2\u0006\u0010S\u001a\u00020I2\u0006\u0010a\u001a\u00020\u00032\u0006\u0010b\u001a\u00020\u00032\b\u0010c\u001a\u0004\u0018\u00010MH\u0002J,\u0010d\u001a\u00020\"2\u0006\u0010S\u001a\u00020I2\u0006\u0010a\u001a\u00020\u00032\b\u0010b\u001a\u0004\u0018\u00010\u00032\b\u0010c\u001a\u0004\u0018\u00010MH\u0002J\u001c\u0010e\u001a\u0016\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u0010\u0012\u0004\u0012\u00020\u0003\u0018\u00010\u0015H\u0002J>\u0010f\u001a\u00020\"2\u000e\u0010g\u001a\n\u0012\u0004\u0012\u00020\u0003\u0018\u00010\f2\u0006\u0010h\u001a\u0002062\u0006\u0010S\u001a\u00020I2\u0014\u0010K\u001a\u0010\u0012\u0004\u0012\u00020\u0003\u0012\u0006\u0012\u0004\u0018\u00010M0LH\u0002J\b\u0010i\u001a\u00020<H\u0002J\b\u0010j\u001a\u00020<H\u0002J\u0014\u0010k\u001a\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020605H\u0002R\u0013\u0010\u0006\u001a\u0004\u0018\u00010\u0003¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u001a\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\u00030\f8@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\r\u0010\u000eR!\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00030\u00108BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0011\u0010\u000eR/\u0010\u0014\u001a\u0016\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u0010\u0012\u0004\u0012\u00020\u0003\u0018\u00010\u00158BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0018\u0010\u0013\u001a\u0004\b\u0016\u0010\u0017R\u001d\u0010\u0019\u001a\u0004\u0018\u00010\u001a8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001d\u0010\u0013\u001a\u0004\b\u001b\u0010\u001cR\u001d\u0010\u001e\u001a\u0004\u0018\u00010\u00038BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b \u0010\u0013\u001a\u0004\b\u001f\u0010\nR&\u0010#\u001a\u00020\"2\u0006\u0010!\u001a\u00020\"8G@@X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b#\u0010$\"\u0004\b%\u0010&R\u001b\u0010'\u001a\u00020\"8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b(\u0010\u0013\u001a\u0004\b'\u0010$R\u000e\u0010)\u001a\u00020\"X\u0082\u000e¢\u0006\u0002\n\u0000R\u0013\u0010\u0007\u001a\u0004\u0018\u00010\u0003¢\u0006\b\n\u0000\u001a\u0004\b*\u0010\nR\u001d\u0010+\u001a\u0004\u0018\u00010\u001a8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b-\u0010\u0013\u001a\u0004\b,\u0010\u001cR\u0010\u0010.\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010/\u001a\b\u0012\u0004\u0012\u00020\u00030\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u001d\u00100\u001a\u0004\u0018\u00010\u001a8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b2\u0010\u0013\u001a\u0004\b1\u0010\u001cR\u0010\u00103\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R'\u00104\u001a\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u000206058BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b9\u0010\u0013\u001a\u0004\b7\u00108R\u0013\u0010\u0005\u001a\u0004\u0018\u00010\u0003¢\u0006\b\n\u0000\u001a\u0004\b:\u0010\n¨\u0006p"}, d2 = {"Landroidx/navigation/NavDeepLink;", "", "uri", "", "(Ljava/lang/String;)V", "uriPattern", "action", "mimeType", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "getAction", "()Ljava/lang/String;", "argumentsNames", "", "getArgumentsNames$navigation_common_release", "()Ljava/util/List;", "fragArgs", "", "getFragArgs", "fragArgs$delegate", "Lkotlin/Lazy;", "fragArgsAndRegex", "Lkotlin/Pair;", "getFragArgsAndRegex", "()Lkotlin/Pair;", "fragArgsAndRegex$delegate", "fragPattern", "Ljava/util/regex/Pattern;", "getFragPattern", "()Ljava/util/regex/Pattern;", "fragPattern$delegate", "fragRegex", "getFragRegex", "fragRegex$delegate", "<set-?>", "", "isExactDeepLink", "()Z", "setExactDeepLink$navigation_common_release", "(Z)V", "isParameterizedQuery", "isParameterizedQuery$delegate", "isSingleQueryParamValueOnly", "getMimeType", "mimeTypePattern", "getMimeTypePattern", "mimeTypePattern$delegate", "mimeTypeRegex", "pathArgs", "pathPattern", "getPathPattern", "pathPattern$delegate", "pathRegex", "queryArgsMap", "", "Landroidx/navigation/NavDeepLink$ParamQuery;", "getQueryArgsMap", "()Ljava/util/Map;", "queryArgsMap$delegate", "getUriPattern", "buildRegex", "", "args", "uriRegex", "Ljava/lang/StringBuilder;", "Lkotlin/text/StringBuilder;", "calculateMatchingPathSegments", "", "requestedLink", "Landroid/net/Uri;", "calculateMatchingPathSegments$navigation_common_release", "equals", "other", "getMatchingArguments", "Landroid/os/Bundle;", "deepLink", "arguments", "", "Landroidx/navigation/NavArgument;", "getMatchingPathAndQueryArgs", "getMatchingPathAndQueryArgs$navigation_common_release", "getMatchingPathArguments", "matcher", "Ljava/util/regex/Matcher;", "bundle", "getMatchingQueryArguments", "getMatchingUriFragment", Request.JsonKeys.FRAGMENT, "getMimeTypeMatchRating", "hashCode", "matchAction", "matchMimeType", "matchUri", "matches", "matches$navigation_common_release", "deepLinkRequest", "Landroidx/navigation/NavDeepLinkRequest;", "parseArgument", "name", "value", "argument", "parseArgumentForRepeatedParam", "parseFragment", "parseInputParams", "inputParams", "storedParam", "parseMime", "parsePath", "parseQuery", "Builder", "Companion", "MimeType", "ParamQuery", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public final class NavDeepLink {
|
|
private final String action;
|
|
|
|
/* renamed from: fragArgs$delegate, reason: from kotlin metadata */
|
|
private final Lazy fragArgs;
|
|
|
|
/* renamed from: fragArgsAndRegex$delegate, reason: from kotlin metadata */
|
|
private final Lazy fragArgsAndRegex;
|
|
|
|
/* renamed from: fragPattern$delegate, reason: from kotlin metadata */
|
|
private final Lazy fragPattern;
|
|
|
|
/* renamed from: fragRegex$delegate, reason: from kotlin metadata */
|
|
private final Lazy fragRegex;
|
|
private boolean isExactDeepLink;
|
|
|
|
/* renamed from: isParameterizedQuery$delegate, reason: from kotlin metadata */
|
|
private final Lazy isParameterizedQuery;
|
|
private boolean isSingleQueryParamValueOnly;
|
|
private final String mimeType;
|
|
|
|
/* renamed from: mimeTypePattern$delegate, reason: from kotlin metadata */
|
|
private final Lazy mimeTypePattern;
|
|
private String mimeTypeRegex;
|
|
private final List<String> pathArgs;
|
|
|
|
/* renamed from: pathPattern$delegate, reason: from kotlin metadata */
|
|
private final Lazy pathPattern;
|
|
private String pathRegex;
|
|
|
|
/* renamed from: queryArgsMap$delegate, reason: from kotlin metadata */
|
|
private final Lazy queryArgsMap;
|
|
private final String uriPattern;
|
|
private static final Companion Companion = new Companion(null);
|
|
private static final Pattern SCHEME_PATTERN = Pattern.compile("^[a-zA-Z]+[+\\w\\-.]*:");
|
|
private static final Pattern FILL_IN_PATTERN = Pattern.compile("\\{(.+?)\\}");
|
|
|
|
public final String getAction() {
|
|
return this.action;
|
|
}
|
|
|
|
public final String getMimeType() {
|
|
return this.mimeType;
|
|
}
|
|
|
|
public final String getUriPattern() {
|
|
return this.uriPattern;
|
|
}
|
|
|
|
/* renamed from: isExactDeepLink, reason: from getter */
|
|
public final boolean getIsExactDeepLink() {
|
|
return this.isExactDeepLink;
|
|
}
|
|
|
|
public final void setExactDeepLink$navigation_common_release(boolean z) {
|
|
this.isExactDeepLink = z;
|
|
}
|
|
|
|
public NavDeepLink(String str, String str2, String str3) {
|
|
this.uriPattern = str;
|
|
this.action = str2;
|
|
this.mimeType = str3;
|
|
this.pathArgs = new ArrayList();
|
|
this.pathPattern = LazyKt.lazy(new Function0<Pattern>() { // from class: androidx.navigation.NavDeepLink$pathPattern$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final Pattern invoke() {
|
|
String str4;
|
|
str4 = NavDeepLink.this.pathRegex;
|
|
if (str4 != null) {
|
|
return Pattern.compile(str4, 2);
|
|
}
|
|
return null;
|
|
}
|
|
});
|
|
this.isParameterizedQuery = LazyKt.lazy(new Function0<Boolean>() { // from class: androidx.navigation.NavDeepLink$isParameterizedQuery$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final Boolean invoke() {
|
|
return Boolean.valueOf((NavDeepLink.this.getUriPattern() == null || Uri.parse(NavDeepLink.this.getUriPattern()).getQuery() == null) ? false : true);
|
|
}
|
|
});
|
|
this.queryArgsMap = LazyKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new Function0<Map<String, ParamQuery>>() { // from class: androidx.navigation.NavDeepLink$queryArgsMap$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final Map<String, NavDeepLink.ParamQuery> invoke() {
|
|
Map<String, NavDeepLink.ParamQuery> parseQuery;
|
|
parseQuery = NavDeepLink.this.parseQuery();
|
|
return parseQuery;
|
|
}
|
|
});
|
|
this.fragArgsAndRegex = LazyKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new Function0<Pair<? extends List<String>, ? extends String>>() { // from class: androidx.navigation.NavDeepLink$fragArgsAndRegex$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final Pair<? extends List<String>, ? extends String> invoke() {
|
|
Pair<? extends List<String>, ? extends String> parseFragment;
|
|
parseFragment = NavDeepLink.this.parseFragment();
|
|
return parseFragment;
|
|
}
|
|
});
|
|
this.fragArgs = LazyKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new Function0<List<String>>() { // from class: androidx.navigation.NavDeepLink$fragArgs$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final List<String> invoke() {
|
|
Pair fragArgsAndRegex;
|
|
List<String> list;
|
|
fragArgsAndRegex = NavDeepLink.this.getFragArgsAndRegex();
|
|
return (fragArgsAndRegex == null || (list = (List) fragArgsAndRegex.getFirst()) == null) ? new ArrayList() : list;
|
|
}
|
|
});
|
|
this.fragRegex = LazyKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new Function0<String>() { // from class: androidx.navigation.NavDeepLink$fragRegex$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final String invoke() {
|
|
Pair fragArgsAndRegex;
|
|
fragArgsAndRegex = NavDeepLink.this.getFragArgsAndRegex();
|
|
if (fragArgsAndRegex != null) {
|
|
return (String) fragArgsAndRegex.getSecond();
|
|
}
|
|
return null;
|
|
}
|
|
});
|
|
this.fragPattern = LazyKt.lazy(new Function0<Pattern>() { // from class: androidx.navigation.NavDeepLink$fragPattern$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final Pattern invoke() {
|
|
String fragRegex;
|
|
fragRegex = NavDeepLink.this.getFragRegex();
|
|
if (fragRegex != null) {
|
|
return Pattern.compile(fragRegex, 2);
|
|
}
|
|
return null;
|
|
}
|
|
});
|
|
this.mimeTypePattern = LazyKt.lazy(new Function0<Pattern>() { // from class: androidx.navigation.NavDeepLink$mimeTypePattern$2
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final Pattern invoke() {
|
|
String str4;
|
|
str4 = NavDeepLink.this.mimeTypeRegex;
|
|
if (str4 != null) {
|
|
return Pattern.compile(str4);
|
|
}
|
|
return null;
|
|
}
|
|
});
|
|
parsePath();
|
|
parseMime();
|
|
}
|
|
|
|
private final Pattern getPathPattern() {
|
|
return (Pattern) this.pathPattern.getValue();
|
|
}
|
|
|
|
private final boolean isParameterizedQuery() {
|
|
return ((Boolean) this.isParameterizedQuery.getValue()).booleanValue();
|
|
}
|
|
|
|
private final Map<String, ParamQuery> getQueryArgsMap() {
|
|
return (Map) this.queryArgsMap.getValue();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final Pair<List<String>, String> getFragArgsAndRegex() {
|
|
return (Pair) this.fragArgsAndRegex.getValue();
|
|
}
|
|
|
|
private final List<String> getFragArgs() {
|
|
return (List) this.fragArgs.getValue();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final String getFragRegex() {
|
|
return (String) this.fragRegex.getValue();
|
|
}
|
|
|
|
private final Pattern getFragPattern() {
|
|
return (Pattern) this.fragPattern.getValue();
|
|
}
|
|
|
|
private final Pattern getMimeTypePattern() {
|
|
return (Pattern) this.mimeTypePattern.getValue();
|
|
}
|
|
|
|
public final List<String> getArgumentsNames$navigation_common_release() {
|
|
List<String> list = this.pathArgs;
|
|
Collection<ParamQuery> values = getQueryArgsMap().values();
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator<T> it = values.iterator();
|
|
while (it.hasNext()) {
|
|
CollectionsKt.addAll(arrayList, ((ParamQuery) it.next()).getArguments());
|
|
}
|
|
return CollectionsKt.plus((Collection) CollectionsKt.plus((Collection) list, (Iterable) arrayList), (Iterable) getFragArgs());
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public NavDeepLink(String uri) {
|
|
this(uri, null, null);
|
|
Intrinsics.checkNotNullParameter(uri, "uri");
|
|
}
|
|
|
|
private final void buildRegex(String uri, List<String> args, StringBuilder uriRegex) {
|
|
Matcher matcher = FILL_IN_PATTERN.matcher(uri);
|
|
int i = 0;
|
|
while (matcher.find()) {
|
|
String group = matcher.group(1);
|
|
Intrinsics.checkNotNull(group, "null cannot be cast to non-null type kotlin.String");
|
|
args.add(group);
|
|
if (matcher.start() > i) {
|
|
String substring = uri.substring(i, matcher.start());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
|
|
uriRegex.append(Pattern.quote(substring));
|
|
}
|
|
uriRegex.append("([^/]+?)");
|
|
i = matcher.end();
|
|
}
|
|
if (i < uri.length()) {
|
|
String substring2 = uri.substring(i);
|
|
Intrinsics.checkNotNullExpressionValue(substring2, "this as java.lang.String).substring(startIndex)");
|
|
uriRegex.append(Pattern.quote(substring2));
|
|
}
|
|
}
|
|
|
|
public final boolean matches$navigation_common_release(Uri uri) {
|
|
Intrinsics.checkNotNullParameter(uri, "uri");
|
|
return matches$navigation_common_release(new NavDeepLinkRequest(uri, null, null));
|
|
}
|
|
|
|
public final boolean matches$navigation_common_release(NavDeepLinkRequest deepLinkRequest) {
|
|
Intrinsics.checkNotNullParameter(deepLinkRequest, "deepLinkRequest");
|
|
if (matchUri(deepLinkRequest.getUri()) && matchAction(deepLinkRequest.getAction())) {
|
|
return matchMimeType(deepLinkRequest.getMimeType());
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private final boolean matchUri(Uri uri) {
|
|
if ((uri == null) != (getPathPattern() != null)) {
|
|
if (uri == null) {
|
|
return true;
|
|
}
|
|
Pattern pathPattern = getPathPattern();
|
|
Intrinsics.checkNotNull(pathPattern);
|
|
if (pathPattern.matcher(uri.toString()).matches()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private final boolean matchAction(String action) {
|
|
boolean z = action == null;
|
|
String str = this.action;
|
|
return z != (str != null) && (action == null || Intrinsics.areEqual(str, action));
|
|
}
|
|
|
|
private final boolean matchMimeType(String mimeType) {
|
|
if ((mimeType == null) != (this.mimeType != null)) {
|
|
if (mimeType == null) {
|
|
return true;
|
|
}
|
|
Pattern mimeTypePattern = getMimeTypePattern();
|
|
Intrinsics.checkNotNull(mimeTypePattern);
|
|
if (mimeTypePattern.matcher(mimeType).matches()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final int getMimeTypeMatchRating(String mimeType) {
|
|
Intrinsics.checkNotNullParameter(mimeType, "mimeType");
|
|
if (this.mimeType != null) {
|
|
Pattern mimeTypePattern = getMimeTypePattern();
|
|
Intrinsics.checkNotNull(mimeTypePattern);
|
|
if (mimeTypePattern.matcher(mimeType).matches()) {
|
|
return new MimeType(this.mimeType).compareTo(new MimeType(mimeType));
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public final Bundle getMatchingArguments(Uri deepLink, Map<String, NavArgument> arguments) {
|
|
Intrinsics.checkNotNullParameter(deepLink, "deepLink");
|
|
Intrinsics.checkNotNullParameter(arguments, "arguments");
|
|
Pattern pathPattern = getPathPattern();
|
|
Matcher matcher = pathPattern != null ? pathPattern.matcher(deepLink.toString()) : null;
|
|
if (matcher == null || !matcher.matches()) {
|
|
return null;
|
|
}
|
|
final Bundle bundle = new Bundle();
|
|
if (!getMatchingPathArguments(matcher, bundle, arguments)) {
|
|
return null;
|
|
}
|
|
if (isParameterizedQuery() && !getMatchingQueryArguments(deepLink, bundle, arguments)) {
|
|
return null;
|
|
}
|
|
getMatchingUriFragment(deepLink.getFragment(), bundle, arguments);
|
|
if (!NavArgumentKt.missingRequiredArguments(arguments, new Function1<String, Boolean>() { // from class: androidx.navigation.NavDeepLink$getMatchingArguments$missingRequiredArguments$1
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(1);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public final Boolean invoke(String argName) {
|
|
Intrinsics.checkNotNullParameter(argName, "argName");
|
|
return Boolean.valueOf(!bundle.containsKey(argName));
|
|
}
|
|
}).isEmpty()) {
|
|
return null;
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
public final Bundle getMatchingPathAndQueryArgs$navigation_common_release(Uri deepLink, Map<String, NavArgument> arguments) {
|
|
Intrinsics.checkNotNullParameter(arguments, "arguments");
|
|
Bundle bundle = new Bundle();
|
|
if (deepLink == null) {
|
|
return bundle;
|
|
}
|
|
Pattern pathPattern = getPathPattern();
|
|
Matcher matcher = pathPattern != null ? pathPattern.matcher(deepLink.toString()) : null;
|
|
if (matcher == null || !matcher.matches()) {
|
|
return bundle;
|
|
}
|
|
getMatchingPathArguments(matcher, bundle, arguments);
|
|
if (isParameterizedQuery()) {
|
|
getMatchingQueryArguments(deepLink, bundle, arguments);
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
private final void getMatchingUriFragment(String fragment, Bundle bundle, Map<String, NavArgument> arguments) {
|
|
Pattern fragPattern = getFragPattern();
|
|
Matcher matcher = fragPattern != null ? fragPattern.matcher(String.valueOf(fragment)) : null;
|
|
if (matcher != null && matcher.matches()) {
|
|
List<String> fragArgs = getFragArgs();
|
|
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(fragArgs, 10));
|
|
int i = 0;
|
|
for (Object obj : fragArgs) {
|
|
int i2 = i + 1;
|
|
if (i < 0) {
|
|
CollectionsKt.throwIndexOverflow();
|
|
}
|
|
String str = (String) obj;
|
|
String value = Uri.decode(matcher.group(i2));
|
|
NavArgument navArgument = arguments.get(str);
|
|
try {
|
|
Intrinsics.checkNotNullExpressionValue(value, "value");
|
|
if (parseArgument(bundle, str, value, navArgument)) {
|
|
return;
|
|
}
|
|
arrayList.add(Unit.INSTANCE);
|
|
i = i2;
|
|
} catch (IllegalArgumentException unused) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private final boolean getMatchingPathArguments(Matcher matcher, Bundle bundle, Map<String, NavArgument> arguments) {
|
|
List<String> list = this.pathArgs;
|
|
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(list, 10));
|
|
int i = 0;
|
|
for (Object obj : list) {
|
|
int i2 = i + 1;
|
|
if (i < 0) {
|
|
CollectionsKt.throwIndexOverflow();
|
|
}
|
|
String str = (String) obj;
|
|
String value = Uri.decode(matcher.group(i2));
|
|
NavArgument navArgument = arguments.get(str);
|
|
try {
|
|
Intrinsics.checkNotNullExpressionValue(value, "value");
|
|
if (parseArgument(bundle, str, value, navArgument)) {
|
|
return false;
|
|
}
|
|
arrayList.add(Unit.INSTANCE);
|
|
i = i2;
|
|
} catch (IllegalArgumentException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private final boolean getMatchingQueryArguments(Uri deepLink, Bundle bundle, Map<String, NavArgument> arguments) {
|
|
String query;
|
|
for (Map.Entry<String, ParamQuery> entry : getQueryArgsMap().entrySet()) {
|
|
String key = entry.getKey();
|
|
ParamQuery value = entry.getValue();
|
|
List<String> queryParameters = deepLink.getQueryParameters(key);
|
|
if (this.isSingleQueryParamValueOnly && (query = deepLink.getQuery()) != null && !Intrinsics.areEqual(query, deepLink.toString())) {
|
|
queryParameters = CollectionsKt.listOf(query);
|
|
}
|
|
if (!parseInputParams(queryParameters, value, bundle, arguments)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private final boolean parseInputParams(List<String> inputParams, ParamQuery storedParam, Bundle bundle, Map<String, NavArgument> arguments) {
|
|
if (inputParams == null) {
|
|
return true;
|
|
}
|
|
for (String str : inputParams) {
|
|
String paramRegex = storedParam.getParamRegex();
|
|
Matcher matcher = paramRegex != null ? Pattern.compile(paramRegex, 32).matcher(str) : null;
|
|
if (matcher == null || !matcher.matches()) {
|
|
return false;
|
|
}
|
|
Bundle bundle2 = new Bundle();
|
|
try {
|
|
List<String> arguments2 = storedParam.getArguments();
|
|
ArrayList arrayList = new ArrayList(CollectionsKt.collectionSizeOrDefault(arguments2, 10));
|
|
int i = 0;
|
|
for (Object obj : arguments2) {
|
|
int i2 = i + 1;
|
|
if (i < 0) {
|
|
CollectionsKt.throwIndexOverflow();
|
|
}
|
|
String str2 = (String) obj;
|
|
String group = matcher.group(i2);
|
|
if (group == null) {
|
|
group = "";
|
|
} else {
|
|
Intrinsics.checkNotNullExpressionValue(group, "argMatcher.group(index + 1) ?: \"\"");
|
|
}
|
|
NavArgument navArgument = arguments.get(str2);
|
|
if (parseArgumentForRepeatedParam(bundle, str2, group, navArgument) && !Intrinsics.areEqual(group, '{' + str2 + '}') && parseArgument(bundle2, str2, group, navArgument)) {
|
|
return false;
|
|
}
|
|
arrayList.add(Unit.INSTANCE);
|
|
i = i2;
|
|
}
|
|
ArrayList arrayList2 = arrayList;
|
|
bundle.putAll(bundle2);
|
|
} catch (IllegalArgumentException unused) {
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public final int calculateMatchingPathSegments$navigation_common_release(Uri requestedLink) {
|
|
if (requestedLink == null || this.uriPattern == null) {
|
|
return 0;
|
|
}
|
|
List<String> requestedPathSegments = requestedLink.getPathSegments();
|
|
List<String> uriPathSegments = Uri.parse(this.uriPattern).getPathSegments();
|
|
Intrinsics.checkNotNullExpressionValue(requestedPathSegments, "requestedPathSegments");
|
|
Intrinsics.checkNotNullExpressionValue(uriPathSegments, "uriPathSegments");
|
|
return CollectionsKt.intersect(requestedPathSegments, uriPathSegments).size();
|
|
}
|
|
|
|
private final boolean parseArgument(Bundle bundle, String name, String value, NavArgument argument) {
|
|
if (argument != null) {
|
|
argument.getType().parseAndPut(bundle, name, value);
|
|
return false;
|
|
}
|
|
bundle.putString(name, value);
|
|
return false;
|
|
}
|
|
|
|
private final boolean parseArgumentForRepeatedParam(Bundle bundle, String name, String value, NavArgument argument) {
|
|
if (!bundle.containsKey(name)) {
|
|
return true;
|
|
}
|
|
if (argument == null) {
|
|
return false;
|
|
}
|
|
NavType<Object> type = argument.getType();
|
|
type.parseAndPut(bundle, name, value, type.get(bundle, name));
|
|
return false;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* compiled from: NavDeepLink.kt */
|
|
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u000e\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0005J\u000e\u0010\u0010\u001a\u00020\u00052\u0006\u0010\u0011\u001a\u00020\u0012J\u0006\u0010\u0013\u001a\u00020\u0012R\u0017\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007R\u001c\u0010\b\u001a\u0004\u0018\u00010\u0005X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\t\u0010\n\"\u0004\b\u000b\u0010\f¨\u0006\u0014"}, d2 = {"Landroidx/navigation/NavDeepLink$ParamQuery;", "", "()V", "arguments", "", "", "getArguments", "()Ljava/util/List;", "paramRegex", "getParamRegex", "()Ljava/lang/String;", "setParamRegex", "(Ljava/lang/String;)V", "addArgumentName", "", "name", "getArgumentName", "index", "", "size", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class ParamQuery {
|
|
private final List<String> arguments = new ArrayList();
|
|
private String paramRegex;
|
|
|
|
public final List<String> getArguments() {
|
|
return this.arguments;
|
|
}
|
|
|
|
public final String getParamRegex() {
|
|
return this.paramRegex;
|
|
}
|
|
|
|
public final void setParamRegex(String str) {
|
|
this.paramRegex = str;
|
|
}
|
|
|
|
public final void addArgumentName(String name) {
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
this.arguments.add(name);
|
|
}
|
|
|
|
public final String getArgumentName(int index) {
|
|
return this.arguments.get(index);
|
|
}
|
|
|
|
public final int size() {
|
|
return this.arguments.size();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* compiled from: NavDeepLink.kt */
|
|
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u000f\n\u0000\n\u0002\u0010\u000e\n\u0002\b\t\n\u0002\u0010\b\n\u0002\b\u0002\b\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0011\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u0000H\u0096\u0002R\u001a\u0010\u0005\u001a\u00020\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\u0004R\u001a\u0010\t\u001a\u00020\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u0007\"\u0004\b\u000b\u0010\u0004¨\u0006\u000f"}, d2 = {"Landroidx/navigation/NavDeepLink$MimeType;", "", "mimeType", "", "(Ljava/lang/String;)V", "subType", "getSubType", "()Ljava/lang/String;", "setSubType", "type", "getType", "setType", "compareTo", "", "other", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class MimeType implements Comparable<MimeType> {
|
|
private String subType;
|
|
private String type;
|
|
|
|
public final String getSubType() {
|
|
return this.subType;
|
|
}
|
|
|
|
public final String getType() {
|
|
return this.type;
|
|
}
|
|
|
|
public final void setSubType(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<set-?>");
|
|
this.subType = str;
|
|
}
|
|
|
|
public final void setType(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<set-?>");
|
|
this.type = str;
|
|
}
|
|
|
|
public MimeType(String mimeType) {
|
|
List emptyList;
|
|
Intrinsics.checkNotNullParameter(mimeType, "mimeType");
|
|
List<String> split = new Regex("/").split(mimeType, 0);
|
|
if (!split.isEmpty()) {
|
|
ListIterator<String> listIterator = split.listIterator(split.size());
|
|
while (listIterator.hasPrevious()) {
|
|
if (listIterator.previous().length() != 0) {
|
|
emptyList = CollectionsKt.take(split, listIterator.nextIndex() + 1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
emptyList = CollectionsKt.emptyList();
|
|
this.type = (String) emptyList.get(0);
|
|
this.subType = (String) emptyList.get(1);
|
|
}
|
|
|
|
@Override // java.lang.Comparable
|
|
public int compareTo(MimeType other) {
|
|
Intrinsics.checkNotNullParameter(other, "other");
|
|
int i = Intrinsics.areEqual(this.type, other.type) ? 2 : 0;
|
|
return Intrinsics.areEqual(this.subType, other.subType) ? i + 1 : i;
|
|
}
|
|
}
|
|
|
|
public boolean equals(Object other) {
|
|
if (other == null || !(other instanceof NavDeepLink)) {
|
|
return false;
|
|
}
|
|
NavDeepLink navDeepLink = (NavDeepLink) other;
|
|
return Intrinsics.areEqual(this.uriPattern, navDeepLink.uriPattern) && Intrinsics.areEqual(this.action, navDeepLink.action) && Intrinsics.areEqual(this.mimeType, navDeepLink.mimeType);
|
|
}
|
|
|
|
public int hashCode() {
|
|
String str = this.uriPattern;
|
|
int hashCode = (str != null ? str.hashCode() : 0) * 31;
|
|
String str2 = this.action;
|
|
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
|
|
String str3 = this.mimeType;
|
|
return hashCode2 + (str3 != null ? str3.hashCode() : 0);
|
|
}
|
|
|
|
/* compiled from: NavDeepLink.kt */
|
|
@Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u0000 \f2\u00020\u0001:\u0001\fB\u0007\b\u0017¢\u0006\u0002\u0010\u0002J\u0006\u0010\u0007\u001a\u00020\bJ\u000e\u0010\t\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0004J\u000e\u0010\n\u001a\u00020\u00002\u0006\u0010\u0005\u001a\u00020\u0004J\u000e\u0010\u000b\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0004R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Landroidx/navigation/NavDeepLink$Builder;", "", "()V", "action", "", "mimeType", "uriPattern", OperatingSystem.JsonKeys.BUILD, "Landroidx/navigation/NavDeepLink;", "setAction", "setMimeType", "setUriPattern", "Companion", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class Builder {
|
|
|
|
/* renamed from: Companion, reason: from kotlin metadata */
|
|
public static final Companion INSTANCE = new Companion(null);
|
|
private String action;
|
|
private String mimeType;
|
|
private String uriPattern;
|
|
|
|
@JvmStatic
|
|
public static final Builder fromAction(String str) {
|
|
return INSTANCE.fromAction(str);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final Builder fromMimeType(String str) {
|
|
return INSTANCE.fromMimeType(str);
|
|
}
|
|
|
|
@JvmStatic
|
|
public static final Builder fromUriPattern(String str) {
|
|
return INSTANCE.fromUriPattern(str);
|
|
}
|
|
|
|
public final Builder setMimeType(String mimeType) {
|
|
Intrinsics.checkNotNullParameter(mimeType, "mimeType");
|
|
this.mimeType = mimeType;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setUriPattern(String uriPattern) {
|
|
Intrinsics.checkNotNullParameter(uriPattern, "uriPattern");
|
|
this.uriPattern = uriPattern;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setAction(String action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
if (action.length() <= 0) {
|
|
throw new IllegalArgumentException("The NavDeepLink cannot have an empty action.".toString());
|
|
}
|
|
this.action = action;
|
|
return this;
|
|
}
|
|
|
|
public final NavDeepLink build() {
|
|
return new NavDeepLink(this.uriPattern, this.action, this.mimeType);
|
|
}
|
|
|
|
/* compiled from: NavDeepLink.kt */
|
|
@Metadata(d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\b\u0080\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007J\u0010\u0010\u0007\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u0006H\u0007J\u0010\u0010\t\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u0006H\u0007¨\u0006\u000b"}, d2 = {"Landroidx/navigation/NavDeepLink$Builder$Companion;", "", "()V", "fromAction", "Landroidx/navigation/NavDeepLink$Builder;", "action", "", "fromMimeType", "mimeType", "fromUriPattern", "uriPattern", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
@JvmStatic
|
|
public final Builder fromUriPattern(String uriPattern) {
|
|
Intrinsics.checkNotNullParameter(uriPattern, "uriPattern");
|
|
Builder builder = new Builder();
|
|
builder.setUriPattern(uriPattern);
|
|
return builder;
|
|
}
|
|
|
|
@JvmStatic
|
|
public final Builder fromAction(String action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
if (action.length() <= 0) {
|
|
throw new IllegalArgumentException("The NavDeepLink cannot have an empty action.".toString());
|
|
}
|
|
Builder builder = new Builder();
|
|
builder.setAction(action);
|
|
return builder;
|
|
}
|
|
|
|
@JvmStatic
|
|
public final Builder fromMimeType(String mimeType) {
|
|
Intrinsics.checkNotNullParameter(mimeType, "mimeType");
|
|
Builder builder = new Builder();
|
|
builder.setMimeType(mimeType);
|
|
return builder;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: NavDeepLink.kt */
|
|
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0082\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0006\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0007"}, d2 = {"Landroidx/navigation/NavDeepLink$Companion;", "", "()V", "FILL_IN_PATTERN", "Ljava/util/regex/Pattern;", "kotlin.jvm.PlatformType", "SCHEME_PATTERN", "navigation-common_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
private static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
|
|
private final void parsePath() {
|
|
if (this.uriPattern == null) {
|
|
return;
|
|
}
|
|
StringBuilder sb = new StringBuilder("^");
|
|
if (!SCHEME_PATTERN.matcher(this.uriPattern).find()) {
|
|
sb.append("http[s]?://");
|
|
}
|
|
Matcher matcher = Pattern.compile("(\\?|\\#|$)").matcher(this.uriPattern);
|
|
matcher.find();
|
|
boolean z = false;
|
|
String substring = this.uriPattern.substring(0, matcher.start());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
|
|
buildRegex(substring, this.pathArgs, sb);
|
|
StringBuilder sb2 = sb;
|
|
if (!StringsKt.contains$default((CharSequence) sb2, (CharSequence) SentryOptions.DEFAULT_PROPAGATION_TARGETS, false, 2, (Object) null) && !StringsKt.contains$default((CharSequence) sb2, (CharSequence) "([^/]+?)", false, 2, (Object) null)) {
|
|
z = true;
|
|
}
|
|
this.isExactDeepLink = z;
|
|
sb.append("($|(\\?(.)*)|(\\#(.)*))");
|
|
String sb3 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb3, "uriRegex.toString()");
|
|
this.pathRegex = StringsKt.replace$default(sb3, SentryOptions.DEFAULT_PROPAGATION_TARGETS, "\\E.*\\Q", false, 4, (Object) null);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final Map<String, ParamQuery> parseQuery() {
|
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
|
if (!isParameterizedQuery()) {
|
|
return linkedHashMap;
|
|
}
|
|
Uri parse = Uri.parse(this.uriPattern);
|
|
for (String paramName : parse.getQueryParameterNames()) {
|
|
StringBuilder sb = new StringBuilder();
|
|
List<String> queryParams = parse.getQueryParameters(paramName);
|
|
if (queryParams.size() > 1) {
|
|
throw new IllegalArgumentException(("Query parameter " + paramName + " must only be present once in " + this.uriPattern + ". To support repeated query parameters, use an array type for your argument and the pattern provided in your URI will be used to parse each query parameter instance.").toString());
|
|
}
|
|
Intrinsics.checkNotNullExpressionValue(queryParams, "queryParams");
|
|
String queryParam = (String) CollectionsKt.firstOrNull((List) queryParams);
|
|
if (queryParam == null) {
|
|
this.isSingleQueryParamValueOnly = true;
|
|
queryParam = paramName;
|
|
}
|
|
Matcher matcher = FILL_IN_PATTERN.matcher(queryParam);
|
|
ParamQuery paramQuery = new ParamQuery();
|
|
int i = 0;
|
|
while (matcher.find()) {
|
|
String group = matcher.group(1);
|
|
Intrinsics.checkNotNull(group, "null cannot be cast to non-null type kotlin.String");
|
|
paramQuery.addArgumentName(group);
|
|
Intrinsics.checkNotNullExpressionValue(queryParam, "queryParam");
|
|
String substring = queryParam.substring(i, matcher.start());
|
|
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
|
|
sb.append(Pattern.quote(substring));
|
|
sb.append("(.+?)?");
|
|
i = matcher.end();
|
|
}
|
|
if (i < queryParam.length()) {
|
|
Intrinsics.checkNotNullExpressionValue(queryParam, "queryParam");
|
|
String substring2 = queryParam.substring(i);
|
|
Intrinsics.checkNotNullExpressionValue(substring2, "this as java.lang.String).substring(startIndex)");
|
|
sb.append(Pattern.quote(substring2));
|
|
}
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "argRegex.toString()");
|
|
paramQuery.setParamRegex(StringsKt.replace$default(sb2, SentryOptions.DEFAULT_PROPAGATION_TARGETS, "\\E.*\\Q", false, 4, (Object) null));
|
|
Intrinsics.checkNotNullExpressionValue(paramName, "paramName");
|
|
linkedHashMap.put(paramName, paramQuery);
|
|
}
|
|
return linkedHashMap;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final Pair<List<String>, String> parseFragment() {
|
|
String str = this.uriPattern;
|
|
if (str == null || Uri.parse(str).getFragment() == null) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
String fragment = Uri.parse(this.uriPattern).getFragment();
|
|
StringBuilder sb = new StringBuilder();
|
|
Intrinsics.checkNotNull(fragment);
|
|
buildRegex(fragment, arrayList, sb);
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "fragRegex.toString()");
|
|
return TuplesKt.to(arrayList, sb2);
|
|
}
|
|
|
|
private final void parseMime() {
|
|
if (this.mimeType == null) {
|
|
return;
|
|
}
|
|
if (!Pattern.compile("^[\\s\\S]+/[\\s\\S]+$").matcher(this.mimeType).matches()) {
|
|
throw new IllegalArgumentException(("The given mimeType " + this.mimeType + " does not match to required \"type/subtype\" format").toString());
|
|
}
|
|
MimeType mimeType = new MimeType(this.mimeType);
|
|
this.mimeTypeRegex = StringsKt.replace$default("^(" + mimeType.getType() + "|[*]+)/(" + mimeType.getSubType() + "|[*]+)$", "*|[*]", "[\\s\\S]", false, 4, (Object) null);
|
|
}
|
|
}
|