137 lines
5.3 KiB
Java
137 lines
5.3 KiB
Java
package com.airbnb.deeplinkdispatch;
|
|
|
|
import com.airbnb.deeplinkdispatch.base.MatchIndex;
|
|
import java.util.Arrays;
|
|
import o.C14861gab;
|
|
import o.C14957gcv;
|
|
import o.gdP;
|
|
import o.gdV;
|
|
import o.gdW;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class UrlTreeKt {
|
|
private static final int MAX_CODE_STRING_BYTE_SIZE = 65535;
|
|
private static final gdW allowedPlaceholderRegex;
|
|
public static final String componentParamPrefix = "{";
|
|
public static final char componentParamPrefixChar = '{';
|
|
public static final String componentParamSuffix = "}";
|
|
public static final char componentParamSuffixChar = '}';
|
|
public static final String configurablePathSegmentPrefix = "<";
|
|
public static final char configurablePathSegmentPrefixChar = '<';
|
|
public static final String configurablePathSegmentSuffix = ">";
|
|
public static final char configurablePathSegmentSuffixChar = '>';
|
|
|
|
static {
|
|
StringBuilder sb = new StringBuilder("(?<=\\");
|
|
sb.append(MatchIndex.ALLOWED_VALUES_DELIMITER[0]);
|
|
sb.append(")(.*)(?=\\");
|
|
sb.append(MatchIndex.ALLOWED_VALUES_DELIMITER[1]);
|
|
sb.append(')');
|
|
allowedPlaceholderRegex = new gdW(sb.toString());
|
|
}
|
|
|
|
public static final String orderPlaceholderValues(String str) {
|
|
C14957gcv.e(str, "");
|
|
gdW gdw = allowedPlaceholderRegex;
|
|
String str2 = str;
|
|
UrlTreeKt$orderPlaceholderValues$1 urlTreeKt$orderPlaceholderValues$1 = UrlTreeKt$orderPlaceholderValues$1.INSTANCE;
|
|
C14957gcv.e(str2, "");
|
|
C14957gcv.e(urlTreeKt$orderPlaceholderValues$1, "");
|
|
gdV e = gdW.e(gdw, str2);
|
|
if (e == null) {
|
|
return str2.toString();
|
|
}
|
|
int length = str2.length();
|
|
StringBuilder sb = new StringBuilder(length);
|
|
int i = 0;
|
|
do {
|
|
sb.append((CharSequence) str2, i, e.e().b);
|
|
sb.append(urlTreeKt$orderPlaceholderValues$1.invoke((UrlTreeKt$orderPlaceholderValues$1) e));
|
|
i = e.e().d + 1;
|
|
e = e.d();
|
|
if (i >= length) {
|
|
break;
|
|
}
|
|
} while (e != null);
|
|
if (i < length) {
|
|
sb.append((CharSequence) str2, i, length);
|
|
}
|
|
String obj = sb.toString();
|
|
C14957gcv.c((Object) obj, "");
|
|
return obj;
|
|
}
|
|
|
|
public static final byte[] matchByteArray(UriMatch uriMatch) {
|
|
byte[] copyOf;
|
|
if (uriMatch != null) {
|
|
byte[] bytes = uriMatch.getUriTemplate().getBytes(gdP.a);
|
|
C14957gcv.c(bytes, "");
|
|
byte[] copyOf2 = Arrays.copyOf(bytes, bytes.length);
|
|
C14957gcv.c(copyOf2, "");
|
|
C14957gcv.e(copyOf2, "");
|
|
byte[] bytes2 = uriMatch.getAnnotatedClassFullyQualifiedName().getBytes(gdP.a);
|
|
C14957gcv.c(bytes2, "");
|
|
byte[] copyOf3 = Arrays.copyOf(bytes2, bytes2.length);
|
|
C14957gcv.c(copyOf3, "");
|
|
C14957gcv.e(copyOf3, "");
|
|
String annotatedMethod = uriMatch.getAnnotatedMethod();
|
|
if (annotatedMethod == null) {
|
|
copyOf = null;
|
|
} else {
|
|
byte[] bytes3 = annotatedMethod.getBytes(gdP.a);
|
|
C14957gcv.c(bytes3, "");
|
|
copyOf = Arrays.copyOf(bytes3, bytes3.length);
|
|
C14957gcv.c(copyOf, "");
|
|
C14957gcv.e(copyOf, "");
|
|
}
|
|
if (copyOf == null) {
|
|
copyOf = new byte[0];
|
|
C14957gcv.e(copyOf, "");
|
|
}
|
|
byte[] bArr = new byte[copyOf2.length + 5 + copyOf3.length + 1 + copyOf.length];
|
|
C14957gcv.e(bArr, "");
|
|
bArr[0] = uriMatch.getType().m11getFlagValuew2LRezQ();
|
|
m18writeUShortAtHFnTLD8(bArr, 1, (short) copyOf2.length);
|
|
int length = copyOf2.length;
|
|
C14957gcv.e(copyOf2, "");
|
|
C14957gcv.e(bArr, "");
|
|
System.arraycopy(copyOf2, 0, bArr, 3, length);
|
|
int length2 = copyOf2.length;
|
|
m18writeUShortAtHFnTLD8(bArr, length2 + 3, (short) copyOf3.length);
|
|
int i = length2 + 5;
|
|
int length3 = copyOf3.length;
|
|
C14957gcv.e(copyOf3, "");
|
|
C14957gcv.e(bArr, "");
|
|
System.arraycopy(copyOf3, 0, bArr, i, length3);
|
|
int length4 = i + copyOf3.length;
|
|
bArr[length4] = (byte) copyOf.length;
|
|
if (!new C14861gab(copyOf).isEmpty()) {
|
|
int length5 = copyOf.length;
|
|
C14957gcv.e(copyOf, "");
|
|
C14957gcv.e(bArr, "");
|
|
System.arraycopy(copyOf, 0, bArr, length4 + 1, length5);
|
|
}
|
|
return bArr;
|
|
}
|
|
byte[] bArr2 = new byte[0];
|
|
C14957gcv.e(bArr2, "");
|
|
return bArr2;
|
|
}
|
|
|
|
/* renamed from: writeUIntAt-GxOs86I, reason: not valid java name */
|
|
public static final void m17writeUIntAtGxOs86I(byte[] bArr, int i, int i2) {
|
|
C14957gcv.e(bArr, "");
|
|
bArr[i] = (byte) (i2 >>> 24);
|
|
bArr[i + 1] = (byte) (i2 >>> 16);
|
|
bArr[i + 2] = (byte) (i2 >>> 8);
|
|
bArr[i + 3] = (byte) i2;
|
|
}
|
|
|
|
/* renamed from: writeUShortAt-HFnTLD8, reason: not valid java name */
|
|
public static final void m18writeUShortAtHFnTLD8(byte[] bArr, int i, short s) {
|
|
C14957gcv.e(bArr, "");
|
|
bArr[i] = (byte) ((s & 65535) >>> 8);
|
|
bArr[i + 1] = (byte) s;
|
|
}
|
|
}
|