package com.airbnb.deeplinkdispatch; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import com.airbnb.deeplinkdispatch.DeepLinkEntry; import com.airbnb.deeplinkdispatch.base.Utils; import com.airbnb.deeplinkdispatch.handler.DeepLinkParamType; import com.airbnb.deeplinkdispatch.handler.DeeplinkParam; import com.airbnb.deeplinkdispatch.handler.TypeConverter; import com.airbnb.deeplinkdispatch.handler.TypeConverters; import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; import kotlin.NoWhenBranchMatchedException; import o.AbstractC14961gcz; import o.C0198BcN; import o.C13396fZU; import o.C14866gag; import o.C14881gav; import o.C14929gcJ; import o.C14953gcr; import o.C14957gcv; import o.EkX; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC14939gcd; import o.InterfaceC14981gdm; import o.fZZ; import org.jmrtd.PassportService; /* loaded from: classes.dex */ public class BaseDeepLinkDelegate { public static final Companion Companion = new Companion(null); protected static final String TAG = "DeepLinkDelegate"; private final InterfaceC13393fZL allDeepLinkEntries$delegate; private final Map configurablePathSegmentReplacements; private final ErrorHandler errorHandler; private final List registries; private final InterfaceC14939gcd typeConversionErrorNonNullable; private final InterfaceC14939gcd typeConversionErrorNullable; private final InterfaceC14890gbN typeConverters; /* JADX WARN: Multi-variable type inference failed */ public BaseDeepLinkDelegate(List list, Map map, InterfaceC14890gbN interfaceC14890gbN, ErrorHandler errorHandler, InterfaceC14939gcd interfaceC14939gcd, InterfaceC14939gcd interfaceC14939gcd2) { C14957gcv.e(list, ""); C14957gcv.e(map, ""); C14957gcv.e(interfaceC14890gbN, ""); C14957gcv.e(interfaceC14939gcd, ""); C14957gcv.e(interfaceC14939gcd2, ""); this.registries = list; this.typeConverters = interfaceC14890gbN; this.errorHandler = errorHandler; this.typeConversionErrorNullable = interfaceC14939gcd; this.typeConversionErrorNonNullable = interfaceC14939gcd2; Map byteArrayMap = Utils.toByteArrayMap(map); this.configurablePathSegmentReplacements = byteArrayMap; UtilsKt.validateConfigurablePathSegmentReplacements(list, byteArrayMap); BaseDeepLinkDelegate$allDeepLinkEntries$2 baseDeepLinkDelegate$allDeepLinkEntries$2 = new BaseDeepLinkDelegate$allDeepLinkEntries$2(this); C14957gcv.e(baseDeepLinkDelegate$allDeepLinkEntries$2, ""); this.allDeepLinkEntries$delegate = new fZZ(baseDeepLinkDelegate$allDeepLinkEntries$2); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate$1, reason: invalid class name */ /* loaded from: classes.dex */ public static final class AnonymousClass1 extends AbstractC14961gcz implements InterfaceC14890gbN { public static final AnonymousClass1 INSTANCE = new AnonymousClass1(); /* JADX WARN: Can't rename method to resolve collision */ @Override // o.InterfaceC14890gbN public final TypeConverters invoke() { return new TypeConverters(); } AnonymousClass1() { super(0); } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate$3, reason: invalid class name */ /* loaded from: classes.dex */ public static final class AnonymousClass3 extends AbstractC14961gcz implements InterfaceC14939gcd { public static final AnonymousClass3 INSTANCE = new AnonymousClass3(); @Override // o.InterfaceC14939gcd public final Integer invoke(DeepLinkUri deepLinkUri, Type type, String str) { C14957gcv.e(deepLinkUri, ""); C14957gcv.e(type, ""); C14957gcv.e(str, ""); return 0; } AnonymousClass3() { super(3); } } public static /* synthetic */ DeepLinkResult dispatchFrom$default(BaseDeepLinkDelegate baseDeepLinkDelegate, Activity activity, Intent intent, int i, Object obj) { if (obj != null) { throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: dispatchFrom"); } if ((i & 2) != 0) { intent = activity.getIntent(); C14957gcv.c(intent, ""); } return baseDeepLinkDelegate.dispatchFrom(activity, intent); } public final DeepLinkResult dispatchFrom(Activity activity, Intent intent) { DeepLinkResult createResult; C14957gcv.e(activity, ""); C14957gcv.e(intent, ""); Uri data = intent.getData(); if (data == null) { createResult = null; } else { String obj = data.toString(); C14957gcv.c((Object) obj, ""); createResult = createResult(activity, intent, findEntry(obj)); } if (createResult == null) { createResult = createResult(activity, intent, null); } dispatchResult(createResult, activity); notifyListener(activity, !createResult.isSuccessful(), data, createResult.getDeepLinkMatchResult() != null ? createResult.getDeepLinkMatchResult().getDeeplinkEntry().getUriTemplate() : null, createResult.getError()); return createResult; } private final void notifyListener(Context context, boolean z, Uri uri, String str, String str2) { String str3; Intent intent = new Intent(); intent.setAction(DeepLinkHandler.ACTION); if (uri == null || (str3 = uri.toString()) == null) { str3 = ""; } intent.putExtra(DeepLinkHandler.EXTRA_URI, str3); if (str == null) { str = ""; } intent.putExtra(DeepLinkHandler.EXTRA_URI_TEMPLATE, str); intent.putExtra(DeepLinkHandler.EXTRA_SUCCESSFUL, !z); if (z) { intent.putExtra(DeepLinkHandler.EXTRA_ERROR_MESSAGE, str2); } C0198BcN.d(context).zE_(intent); } private final void dispatchResult(DeepLinkResult deepLinkResult, Activity activity) { Intent intent; if (deepLinkResult.isSuccessful()) { DeepLinkMatchResult deepLinkMatchResult = deepLinkResult.getDeepLinkMatchResult(); C14866gag c14866gag = null; DeepLinkEntry deeplinkEntry = deepLinkMatchResult == null ? null : deepLinkMatchResult.getDeeplinkEntry(); if (deeplinkEntry instanceof DeepLinkEntry.MethodDeeplinkEntry) { EkX taskStackBuilder = deepLinkResult.getMethodResult().getTaskStackBuilder(); if (taskStackBuilder != null) { taskStackBuilder.c(); c14866gag = C14866gag.c; } if (c14866gag != null || (intent = deepLinkResult.getMethodResult().getIntent()) == null) { return; } activity.startActivity(intent); return; } if (deeplinkEntry instanceof DeepLinkEntry.ActivityDeeplinkEntry) { Intent intent2 = deepLinkResult.getMethodResult().getIntent(); if (intent2 != null) { activity.startActivity(intent2); return; } return; } if (deeplinkEntry instanceof DeepLinkEntry.HandlerDeepLinkEntry) { callDeeplinkHandler(activity, deepLinkResult); } } } private final void callDeeplinkHandler(Context context, DeepLinkResult deepLinkResult) { DeepLinkHandlerResult deepLinkHandlerResult = deepLinkResult.getDeepLinkHandlerResult(); if (deepLinkHandlerResult != null) { deepLinkHandlerResult.getDeepLinkHandler().handleDeepLink(context, deepLinkHandlerResult.getDeepLinkHandlerArgs()); } } private final com.airbnb.deeplinkdispatch.handler.DeepLinkHandler deepLinkHandlerInstance(Class cls) { Object obj; Object obj2 = null; try { obj = cls.getField("INSTANCE").get(null); } catch (NoSuchFieldException unused) { Constructor[] constructors = cls.getConstructors(); C14957gcv.c(constructors, ""); Constructor[] constructorArr = constructors; C14957gcv.e(constructorArr, ""); Constructor constructor = constructorArr.length == 1 ? constructorArr[0] : null; if (constructor != null) { TypeVariable>[] typeParameters = constructor.getTypeParameters(); C14957gcv.c(typeParameters, ""); if (!(!(typeParameters.length == 0))) { obj2 = constructor.newInstance(new Object[0]); } } if (obj2 == null) { throw new IllegalStateException("Handler class must have single zero argument constructor.".toString()); } obj = obj2; } if (obj != null) { return (com.airbnb.deeplinkdispatch.handler.DeepLinkHandler) obj; } throw new NullPointerException("null cannot be cast to non-null type com.airbnb.deeplinkdispatch.handler.DeepLinkHandler"); } private final Object getDeepLinkArgs(Class cls, Map map, DeepLinkUri deepLinkUri) { Object newInstance; if (C14957gcv.b(cls, Object.class)) { newInstance = new Object(); } else { Constructor[] constructors = cls.getConstructors(); C14957gcv.c(constructors, ""); Constructor[] constructorArr = constructors; C14957gcv.e(constructorArr, ""); int i = 0; Constructor constructor = constructorArr.length == 1 ? constructorArr[0] : null; if (constructor == null) { throw new IllegalStateException("Handler parameter class can only have one constructor.".toString()); } Annotation[][] parameterAnnotations = constructor.getParameterAnnotations(); C14957gcv.c(parameterAnnotations, ""); Annotation[][] annotationArr = parameterAnnotations; C14957gcv.e(annotationArr, ""); Annotation[][] annotationArr2 = annotationArr; int i2 = 0; for (Annotation[] annotationArr3 : annotationArr2) { i2 += annotationArr3.length; } ArrayList arrayList = new ArrayList(i2); int length = annotationArr2.length; for (int i3 = 0; i3 < length; i3++) { Annotation[] annotationArr4 = annotationArr[i3]; ArrayList arrayList2 = arrayList; C14957gcv.e(arrayList2, ""); C14957gcv.e(annotationArr4, ""); C14957gcv.e(annotationArr4, ""); List asList = Arrays.asList(annotationArr4); C14957gcv.c(asList, ""); arrayList2.addAll(asList); } ArrayList arrayList3 = arrayList; C14957gcv.e(arrayList3, ""); List list = (List) C14881gav.b((Iterable) arrayList3, new ArrayList()); ArrayList arrayList4 = new ArrayList(); for (Object obj : list) { Annotation annotation = (Annotation) obj; C14957gcv.e(annotation, ""); Class annotationType = annotation.annotationType(); C14957gcv.c(annotationType, ""); C14957gcv.e(annotationType, ""); InterfaceC14981gdm c = C14929gcJ.c(annotationType); C14957gcv.d(c, ""); if (C14957gcv.b(c, C14929gcJ.c(DeeplinkParam.class))) { arrayList4.add(obj); } } ArrayList arrayList5 = arrayList4; C14957gcv.e(arrayList5, ""); ArrayList arrayList6 = new ArrayList(arrayList5.size()); Iterator it = arrayList5.iterator(); while (it.hasNext()) { arrayList6.add((DeeplinkParam) ((Annotation) it.next())); } ArrayList arrayList7 = arrayList6; Type[] genericParameterTypes = constructor.getGenericParameterTypes(); if (arrayList7.size() != genericParameterTypes.length) { StringBuilder sb = new StringBuilder("There are "); sb.append(arrayList7.size()); sb.append(" annotations but "); sb.append(genericParameterTypes.length); sb.append(" parameters!"); throw new IllegalStateException(sb.toString().toString()); } ArrayList arrayList8 = arrayList7; C14957gcv.c(genericParameterTypes, ""); C14957gcv.e(arrayList8, ""); C14957gcv.e(genericParameterTypes, ""); int length2 = genericParameterTypes.length; C14957gcv.e(arrayList8, ""); ArrayList arrayList9 = new ArrayList(Math.min(arrayList8.size(), length2)); for (Object obj2 : arrayList8) { if (i >= length2) { break; } arrayList9.add(new C13396fZU(obj2, genericParameterTypes[i])); i++; } Object[] createParamArray = createParamArray(arrayList9, map, deepLinkUri); newInstance = constructor.newInstance(Arrays.copyOf(createParamArray, createParamArray.length)); } C14957gcv.c(newInstance, ""); return newInstance; } private final Object[] createParamArray(List> list, Map map, DeepLinkUri deepLinkUri) { Object mapNotNullableType; List> list2 = list; C14957gcv.e(list2, ""); ArrayList arrayList = new ArrayList(list2 instanceof Collection ? list2.size() : 10); Iterator it = list2.iterator(); while (it.hasNext()) { C13396fZU c13396fZU = (C13396fZU) it.next(); DeeplinkParam deeplinkParam = (DeeplinkParam) c13396fZU.d; Type type = (Type) c13396fZU.e; int i = WhenMappings.$EnumSwitchMapping$0[deeplinkParam.type().ordinal()]; if (i == 1) { String str = map.get(deeplinkParam.name()); if (str != null) { mapNotNullableType = mapNotNullableType(str, type, deepLinkUri); } else { throw new IllegalStateException(C14957gcv.c("Non existent non nullable element for name: ", (Object) deeplinkParam.name()).toString()); } } else { if (i != 2) { throw new NoWhenBranchMatchedException(); } mapNotNullableType = mapNullableType(map.get(deeplinkParam.name()), type, deepLinkUri); } arrayList.add(mapNotNullableType); } Object[] array = arrayList.toArray(new Object[0]); if (array != null) { return array; } throw new NullPointerException("null cannot be cast to non-null type kotlin.Array"); } private final Object mapNullableType(String str, Type type, DeepLinkUri deepLinkUri) { if (str == null) { return null; } try { TypeConverter typeConverter = this.typeConverters.invoke().get(type); Object convert = typeConverter != null ? typeConverter.convert(str) : null; if (convert != null) { return convert; } if (C14957gcv.b(type, Boolean.class)) { return Boolean.valueOf(Boolean.parseBoolean(str)); } if (C14957gcv.b(type, Integer.class)) { return Integer.valueOf(Integer.parseInt(str)); } if (C14957gcv.b(type, Long.class)) { return Long.valueOf(Long.parseLong(str)); } if (C14957gcv.b(type, Short.class)) { return Short.valueOf(Short.parseShort(str)); } if (C14957gcv.b(type, Byte.class)) { return Byte.valueOf(Byte.parseByte(str)); } if (C14957gcv.b(type, Double.class)) { return Double.valueOf(Double.parseDouble(str)); } if (C14957gcv.b(type, Float.class)) { return Float.valueOf(Float.parseFloat(str)); } if (C14957gcv.b(type, String.class)) { return str; } StringBuilder sb = new StringBuilder("Missing type converter for type "); sb.append(type); sb.append("! You must register a custom type converter via the DeepLinkDelegate constructor element for all but simple data types."); throw new IllegalStateException(sb.toString().toString()); } catch (NumberFormatException unused) { return this.typeConversionErrorNullable.invoke(deepLinkUri, type, str); } } private final Object mapNotNullableType(String str, Type type, DeepLinkUri deepLinkUri) { try { TypeConverter typeConverter = this.typeConverters.invoke().get(type); Object convert = typeConverter == null ? null : typeConverter.convert(str); if (convert != null) { return convert; } if (C14957gcv.b(type, Boolean.TYPE)) { return Boolean.valueOf(Boolean.parseBoolean(str)); } if (C14957gcv.b(type, Integer.TYPE)) { return Integer.valueOf(Integer.parseInt(str)); } if (C14957gcv.b(type, Long.TYPE)) { return Long.valueOf(Long.parseLong(str)); } if (C14957gcv.b(type, Short.TYPE)) { return Short.valueOf(Short.parseShort(str)); } if (C14957gcv.b(type, Byte.TYPE)) { return Byte.valueOf(Byte.parseByte(str)); } if (C14957gcv.b(type, Double.TYPE)) { return Double.valueOf(Double.parseDouble(str)); } if (C14957gcv.b(type, Float.TYPE)) { return Float.valueOf(Float.parseFloat(str)); } if (C14957gcv.b(type, String.class)) { return str; } StringBuilder sb = new StringBuilder("Missing type converter for type "); sb.append(type); sb.append("! You must register a custom type converter via the DeepLinkDelegate constructor element for all but simple data types."); throw new IllegalStateException(sb.toString().toString()); } catch (NumberFormatException unused) { return this.typeConversionErrorNonNullable.invoke(deepLinkUri, type, str); } } public final DeepLinkResult createResult(Activity activity, Intent intent, DeepLinkMatchResult deepLinkMatchResult) { DeepLinkResult deepLinkResult; C14957gcv.e(activity, ""); C14957gcv.e(intent, ""); Uri data = intent.getData(); if (data == null) { return new DeepLinkResult(false, null, "No Uri in given activity's intent.", null, deepLinkMatchResult, null, null, null, 234, null); } DeepLinkUri parse = DeepLinkUri.parse(data.toString()); if (deepLinkMatchResult == null) { return new DeepLinkResult(false, null, "DeepLinkEntry cannot be null", null, null, null, null, null, 250, null); } C14957gcv.c(parse, ""); Map queryAndPathParameters = queryAndPathParameters(deepLinkMatchResult, parse); Bundle createIntentBundle = createIntentBundle(intent, data, queryAndPathParameters); try { IntermediateDeepLinkResult processResultForType = processResultForType(deepLinkMatchResult.getDeeplinkEntry(), queryAndPathParameters, activity, createIntentBundle); Intent intent2 = processResultForType.getIntent(); if (intent2 == null) { deepLinkResult = null; } else { if (intent2.getAction() == null) { intent2.setAction(intent.getAction()); } if (intent2.getData() == null) { intent2.setData(intent.getData()); } intent2.putExtras(UtilsKt.filter(createIntentBundle, new BaseDeepLinkDelegate$createResult$1$1(intent2))); intent2.putExtra("is_deep_link_flag", true); intent2.putExtra("android.intent.extra.REFERRER", data); if (activity.getCallingActivity() != null) { intent2.setFlags(33554432); } deepLinkResult = new DeepLinkResult(true, data.toString(), null, null, deepLinkMatchResult, new DeepLinkMethodResult(intent2, processResultForType.getTaskStackBuilder()), queryAndPathParameters, processResultForType.getDeepLinkHandlerResult(), 12, null); } return deepLinkResult == null ? new DeepLinkResult(false, data.toString(), "Destination Intent is null!", null, deepLinkMatchResult, new DeepLinkMethodResult(processResultForType.getIntent(), processResultForType.getTaskStackBuilder()), null, processResultForType.getDeepLinkHandlerResult(), 72, null) : deepLinkResult; } catch (DeeplLinkMethodError e) { String obj = data.toString(); String message = e.getMessage(); return new DeepLinkResult(false, obj, message == null ? "" : message, e, deepLinkMatchResult, null, null, null, PassportService.DEFAULT_MAX_BLOCKSIZE, null); } } private final Bundle createIntentBundle(Intent intent, Uri uri, Map map) { Bundle bundle; if (intent.getExtras() != null) { bundle = new Bundle(intent.getExtras()); } else { bundle = new Bundle(); } for (Map.Entry entry : map.entrySet()) { bundle.putString(entry.getKey(), entry.getValue()); } bundle.putString("deep_link_uri", uri.toString()); return bundle; } private final IntermediateDeepLinkResult processResultForType(DeepLinkEntry deepLinkEntry, Map map, Activity activity, Bundle bundle) { Class clazz = deepLinkEntry.getClazz(); if (deepLinkEntry instanceof DeepLinkEntry.ActivityDeeplinkEntry) { return new IntermediateDeepLinkResult(new Intent(activity, clazz), null, null); } if (deepLinkEntry instanceof DeepLinkEntry.MethodDeeplinkEntry) { try { try { try { Method method = clazz.getMethod(((DeepLinkEntry.MethodDeeplinkEntry) deepLinkEntry).getMethod(), Context.class); C14957gcv.c(method, ""); return intentFromDeeplinkMethod(method, method.invoke(clazz, activity)); } catch (NoSuchMethodException e) { throw new DeeplLinkMethodError(C14957gcv.c("Deep link to non-existent method: ", (Object) ((DeepLinkEntry.MethodDeeplinkEntry) deepLinkEntry).getMethod()), e); } } catch (NoSuchMethodException unused) { Method method2 = clazz.getMethod(((DeepLinkEntry.MethodDeeplinkEntry) deepLinkEntry).getMethod(), Context.class, Bundle.class); C14957gcv.c(method2, ""); return intentFromDeeplinkMethod(method2, method2.invoke(clazz, activity, bundle)); } } catch (IllegalAccessException e2) { throw new DeeplLinkMethodError(C14957gcv.c("Could not deep link to method: ", (Object) ((DeepLinkEntry.MethodDeeplinkEntry) deepLinkEntry).getMethod()), e2); } catch (InvocationTargetException e3) { throw new DeeplLinkMethodError(C14957gcv.c("Could not deep link to method: ", (Object) ((DeepLinkEntry.MethodDeeplinkEntry) deepLinkEntry).getMethod()), e3); } } if (deepLinkEntry instanceof DeepLinkEntry.HandlerDeepLinkEntry) { return new IntermediateDeepLinkResult(new Intent(activity, clazz), null, new DeepLinkHandlerResult(deepLinkHandlerInstance(deepLinkEntry.getClazz()), deepLinkHandlerArgs(deepLinkEntry, map))); } throw new NoWhenBranchMatchedException(); } private final Object deepLinkHandlerArgs(DeepLinkEntry deepLinkEntry, Map map) { Class argsClazz = argsClazz(deepLinkEntry.getClazz()); if (argsClazz == null) { ErrorHandler errorHandler = this.errorHandler; if (errorHandler != null) { errorHandler.unableToDetermineHandlerArgsType(deepLinkEntry.getUriTemplate(), deepLinkEntry.getClassName()); } argsClazz = Object.class; } DeepLinkUri parseTemplate = DeepLinkUri.parseTemplate(deepLinkEntry.getUriTemplate()); C14957gcv.c(parseTemplate, ""); return getDeepLinkArgs(argsClazz, map, parseTemplate); } /* JADX WARN: Code restructure failed: missing block: B:52:0x0066, code lost: if (r3 == false) goto L19; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private final java.lang.Class argsClazz(java.lang.Class r11) { /* r10 = this; java.lang.reflect.Type[] r0 = r11.getGenericInterfaces() java.lang.String r1 = "" o.C14957gcv.c(r0, r1) java.lang.Object[] r0 = (java.lang.Object[]) r0 java.util.ArrayList r2 = new java.util.ArrayList r2.() java.util.Collection r2 = (java.util.Collection) r2 int r3 = r0.length r4 = 0 r5 = r4 L15: if (r5 >= r3) goto L23 r6 = r0[r5] int r5 = r5 + 1 boolean r7 = r6 instanceof java.lang.reflect.ParameterizedType if (r7 == 0) goto L15 r2.add(r6) goto L15 L23: java.util.List r2 = (java.util.List) r2 java.lang.Iterable r2 = (java.lang.Iterable) r2 java.util.Iterator r0 = r2.iterator() r2 = 0 r5 = r2 r3 = r4 L2e: boolean r6 = r0.hasNext() java.lang.String r7 = "null cannot be cast to non-null type java.lang.Class<*>" if (r6 == 0) goto L66 java.lang.Object r6 = r0.next() r8 = r6 java.lang.reflect.ParameterizedType r8 = (java.lang.reflect.ParameterizedType) r8 java.lang.reflect.Type r8 = r8.getRawType() if (r8 == 0) goto L60 java.lang.Class r8 = (java.lang.Class) r8 java.lang.String r8 = r8.getCanonicalName() o.C14957gcv.c(r8, r1) java.lang.Class r9 = com.airbnb.deeplinkdispatch.handler.DeepLinkHandler.class java.lang.String r9 = r9.getName() o.C14957gcv.c(r9, r1) boolean r8 = o.gdZ.e(r8, r9, r4) if (r8 == 0) goto L2e if (r3 != 0) goto L68 r3 = 1 r5 = r6 goto L2e L60: java.lang.NullPointerException r11 = new java.lang.NullPointerException r11.(r7) throw r11 L66: if (r3 != 0) goto L69 L68: r5 = r2 L69: java.lang.reflect.ParameterizedType r5 = (java.lang.reflect.ParameterizedType) r5 if (r5 == 0) goto L77 java.lang.reflect.Type[] r0 = r5.getActualTypeArguments() if (r0 == 0) goto L77 java.lang.Class r2 = r10.getDeepLinkArgClassFromTypeArguments(r0) L77: if (r2 != 0) goto Lb0 java.lang.reflect.Type r0 = r11.getGenericSuperclass() boolean r0 = r0 instanceof java.lang.reflect.ParameterizedType if (r0 == 0) goto L9d java.lang.reflect.Type r11 = r11.getGenericSuperclass() if (r11 == 0) goto L95 java.lang.reflect.ParameterizedType r11 = (java.lang.reflect.ParameterizedType) r11 java.lang.reflect.Type[] r11 = r11.getActualTypeArguments() o.C14957gcv.c(r11, r1) java.lang.Class r2 = r10.getDeepLinkArgClassFromTypeArguments(r11) goto Lb0 L95: java.lang.NullPointerException r11 = new java.lang.NullPointerException java.lang.String r0 = "null cannot be cast to non-null type java.lang.reflect.ParameterizedType" r11.(r0) throw r11 L9d: java.lang.reflect.Type r11 = r11.getGenericSuperclass() if (r11 == 0) goto Laa java.lang.Class r11 = (java.lang.Class) r11 java.lang.Class r2 = r10.argsClazz(r11) goto Lb0 Laa: java.lang.NullPointerException r11 = new java.lang.NullPointerException r11.(r7) throw r11 Lb0: return r2 */ throw new UnsupportedOperationException("Method not decompiled: com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.argsClazz(java.lang.Class):java.lang.Class"); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class IntermediateDeepLinkResult { private final DeepLinkHandlerResult deepLinkHandlerResult; private final Intent intent; private final EkX taskStackBuilder; public IntermediateDeepLinkResult(Intent intent, EkX ekX, DeepLinkHandlerResult deepLinkHandlerResult) { this.intent = intent; this.taskStackBuilder = ekX; this.deepLinkHandlerResult = deepLinkHandlerResult; } public final String toString() { StringBuilder sb = new StringBuilder("IntermediateDeepLinkResult(intent="); sb.append(this.intent); sb.append(", taskStackBuilder="); sb.append(this.taskStackBuilder); sb.append(", deepLinkHandlerResult="); sb.append(this.deepLinkHandlerResult); sb.append(')'); return sb.toString(); } public final int hashCode() { Intent intent = this.intent; int hashCode = intent == null ? 0 : intent.hashCode(); EkX ekX = this.taskStackBuilder; int hashCode2 = ekX == null ? 0 : ekX.hashCode(); DeepLinkHandlerResult deepLinkHandlerResult = this.deepLinkHandlerResult; return (((hashCode * 31) + hashCode2) * 31) + (deepLinkHandlerResult != null ? deepLinkHandlerResult.hashCode() : 0); } public final EkX getTaskStackBuilder() { return this.taskStackBuilder; } public final Intent getIntent() { return this.intent; } public final DeepLinkHandlerResult getDeepLinkHandlerResult() { return this.deepLinkHandlerResult; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof IntermediateDeepLinkResult)) { return false; } IntermediateDeepLinkResult intermediateDeepLinkResult = (IntermediateDeepLinkResult) obj; return C14957gcv.b(this.intent, intermediateDeepLinkResult.intent) && C14957gcv.b(this.taskStackBuilder, intermediateDeepLinkResult.taskStackBuilder) && C14957gcv.b(this.deepLinkHandlerResult, intermediateDeepLinkResult.deepLinkHandlerResult); } public final IntermediateDeepLinkResult copy(Intent intent, EkX ekX, DeepLinkHandlerResult deepLinkHandlerResult) { return new IntermediateDeepLinkResult(intent, ekX, deepLinkHandlerResult); } public final DeepLinkHandlerResult component3() { return this.deepLinkHandlerResult; } public final EkX component2() { return this.taskStackBuilder; } public final Intent component1() { return this.intent; } /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ IntermediateDeepLinkResult copy$default(IntermediateDeepLinkResult intermediateDeepLinkResult, Intent intent, EkX ekX, DeepLinkHandlerResult deepLinkHandlerResult, int i, Object obj) { if ((i & 1) != 0) { intent = intermediateDeepLinkResult.intent; } if ((i & 2) != 0) { ekX = intermediateDeepLinkResult.taskStackBuilder; } if ((i & 4) != 0) { deepLinkHandlerResult = intermediateDeepLinkResult.deepLinkHandlerResult; } return intermediateDeepLinkResult.copy(intent, ekX, deepLinkHandlerResult); } } private final IntermediateDeepLinkResult intentFromDeeplinkMethod(Method method, Object obj) { Class returnType = method.getReturnType(); if (C14957gcv.b(returnType, EkX.class)) { String name = method.getName(); C14957gcv.c((Object) name, ""); return intentFromTaskStackBuilder((EkX) obj, name); } if (C14957gcv.b(returnType, DeepLinkMethodResult.class)) { String name2 = method.getName(); C14957gcv.c((Object) name2, ""); return intentFromDeepLinkMethodResult((DeepLinkMethodResult) obj, name2); } return new IntermediateDeepLinkResult((Intent) obj, null, null); } private final IntermediateDeepLinkResult intentFromDeepLinkMethodResult(DeepLinkMethodResult deepLinkMethodResult, String str) { if ((deepLinkMethodResult == null ? null : deepLinkMethodResult.getTaskStackBuilder()) != null) { return intentFromTaskStackBuilder(deepLinkMethodResult.getTaskStackBuilder(), str); } return new IntermediateDeepLinkResult(deepLinkMethodResult == null ? null : deepLinkMethodResult.getIntent(), null, null); } /* JADX WARN: Multi-variable type inference failed */ private final IntermediateDeepLinkResult intentFromTaskStackBuilder(EkX ekX, String str) { Intent intent; Throwable th = null; Object[] objArr = 0; if (ekX != null && ekX.d.size() == 0) { StringBuilder sb = new StringBuilder("Could not deep link to method: "); sb.append(str); sb.append(" intents length == 0"); throw new DeeplLinkMethodError(sb.toString(), th, 2, objArr == true ? 1 : 0); } if (ekX == null) { intent = null; } else { intent = ekX.d.get(ekX.d.size() - 1); } return new IntermediateDeepLinkResult(intent, ekX, null); } /* loaded from: classes.dex */ public static final class DeeplLinkMethodError extends IllegalStateException { private final Throwable cause; public /* synthetic */ DeeplLinkMethodError(String str, Throwable th, int i, C14953gcr c14953gcr) { this(str, (i & 2) != 0 ? null : th); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public DeeplLinkMethodError(String str, Throwable th) { super(str, th); C14957gcv.e(str, ""); this.cause = th; } @Override // java.lang.Throwable public final Throwable getCause() { return this.cause; } } private final Map queryAndPathParameters(DeepLinkMatchResult deepLinkMatchResult, DeepLinkUri deepLinkUri) { LinkedHashMap linkedHashMap = new LinkedHashMap(); linkedHashMap.putAll(deepLinkMatchResult.getParameters(deepLinkUri)); for (String str : deepLinkUri.queryParameterNames()) { for (String str2 : deepLinkUri.queryParameterValues(str)) { if (linkedHashMap.containsKey(str)) { C14957gcv.c("Duplicate parameter name in path and query param: ", (Object) str); } C14957gcv.c((Object) str, ""); C14957gcv.c((Object) str2, ""); linkedHashMap.put(str, str2); } } return linkedHashMap; } public final DeepLinkMatchResult findEntry(String str) { C14957gcv.e(str, ""); DeepLinkUri parse = DeepLinkUri.parse(str); List list = this.registries; ArrayList arrayList = new ArrayList(); Iterator it = list.iterator(); while (it.hasNext()) { DeepLinkMatchResult idxMatch = ((BaseRegistry) it.next()).idxMatch(parse, this.configurablePathSegmentReplacements); if (idxMatch != null) { arrayList.add(idxMatch); } } ArrayList arrayList2 = arrayList; int size = arrayList2.size(); if (size == 0) { return null; } if (size == 1) { return (DeepLinkMatchResult) C14881gav.e((List) arrayList2); } List c = C14881gav.c(C14881gav.b(arrayList2), 2); if (((DeepLinkMatchResult) C14881gav.e((List) c)).compareTo((DeepLinkMatchResult) C14881gav.d((List) c)) == 0) { ErrorHandler errorHandler = this.errorHandler; if (errorHandler != null) { errorHandler.duplicateMatch(str, c); } Objects.toString(C14881gav.e((List) c)); Objects.toString(C14881gav.d((List) c)); } return (DeepLinkMatchResult) C14881gav.e((List) c); } public final boolean supportsUri(String str) { DeepLinkUri parse = DeepLinkUri.parse(str); List list = this.registries; if ((list instanceof Collection) && list.isEmpty()) { return false; } Iterator it = list.iterator(); while (it.hasNext()) { if (((BaseRegistry) it.next()).supports(parse, this.configurablePathSegmentReplacements)) { return true; } } return false; } public final List getAllDeepLinkEntries() { return (List) this.allDeepLinkEntries$delegate.e(); } /* loaded from: classes.dex */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(C14953gcr c14953gcr) { this(); } } private final Class getDeepLinkArgClassFromTypeArguments(Type[] typeArr) { Object obj; ArrayList arrayList = new ArrayList(); int length = typeArr.length; int i = 0; while (i < length) { Type type = typeArr[i]; i++; if (type instanceof Class) { arrayList.add(type); } } Iterator it = arrayList.iterator(); boolean z = false; Object obj2 = null; while (true) { if (it.hasNext()) { Object next = it.next(); Class cls = (Class) next; if (!C14957gcv.b(cls, Object.class)) { Constructor[] constructors = cls.getConstructors(); C14957gcv.c(constructors, ""); Constructor[] constructorArr = constructors; int length2 = constructorArr.length; int i2 = 0; while (i2 < length2) { Constructor constructor = constructorArr[i2]; i2++; Annotation[][] parameterAnnotations = constructor.getParameterAnnotations(); C14957gcv.c(parameterAnnotations, ""); Annotation[][] annotationArr = parameterAnnotations; int length3 = annotationArr.length; int i3 = 0; while (i3 < length3) { Annotation[] annotationArr2 = annotationArr[i3]; i3++; Annotation[] annotationArr3 = annotationArr2; C14957gcv.c(annotationArr3, ""); int length4 = annotationArr3.length; int i4 = 0; while (i4 < length4) { Annotation annotation = annotationArr3[i4]; i4++; C14957gcv.e(annotation, ""); Class annotationType = annotation.annotationType(); C14957gcv.c(annotationType, ""); C14957gcv.e(annotationType, ""); InterfaceC14981gdm c = C14929gcJ.c(annotationType); C14957gcv.d(c, ""); if (C14957gcv.b(c, C14929gcJ.c(DeeplinkParam.class))) { } } } } } if (z) { break; } z = true; obj2 = next; } else if (z) { obj = obj2; } } obj = null; return (Class) obj; } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public /* synthetic */ BaseDeepLinkDelegate(java.util.List r8, java.util.Map r9, com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.AnonymousClass1 r10, com.airbnb.deeplinkdispatch.ErrorHandler r11, com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.AnonymousClass2 r12, com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.AnonymousClass3 r13, int r14, o.C14953gcr r15) { /* r7 = this; r15 = r14 & 2 if (r15 == 0) goto Ld o.gaM r9 = o.C14854gaM.c java.lang.String r15 = "" o.C14957gcv.d(r9, r15) java.util.Map r9 = (java.util.Map) r9 Ld: r2 = r9 r9 = r14 & 4 if (r9 == 0) goto L17 com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate$1 r9 = com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.AnonymousClass1.INSTANCE r10 = r9 o.gbN r10 = (o.InterfaceC14890gbN) r10 L17: r3 = r10 r9 = r14 & 8 if (r9 == 0) goto L1d r11 = 0 L1d: r4 = r11 r9 = r14 & 16 if (r9 == 0) goto L27 com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate$2 r9 = com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.AnonymousClass2.INSTANCE r12 = r9 o.gcd r12 = (o.InterfaceC14939gcd) r12 L27: r5 = r12 r9 = r14 & 32 if (r9 == 0) goto L31 com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate$3 r9 = com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.AnonymousClass3.INSTANCE r13 = r9 o.gcd r13 = (o.InterfaceC14939gcd) r13 L31: r6 = r13 r0 = r7 r1 = r8 r0.(r1, r2, r3, r4, r5, r6) return */ throw new UnsupportedOperationException("Method not decompiled: com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate.(java.util.List, java.util.Map, o.gbN, com.airbnb.deeplinkdispatch.ErrorHandler, o.gcd, o.gcd, int, o.gcr):void"); } public final List getRegistries() { return this.registries; } public final DeepLinkResult dispatchFrom(Activity activity) { C14957gcv.e(activity, ""); return dispatchFrom$default(this, activity, null, 2, null); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public BaseDeepLinkDelegate(List list, Map map, InterfaceC14890gbN interfaceC14890gbN, ErrorHandler errorHandler, InterfaceC14939gcd interfaceC14939gcd) { this(list, map, interfaceC14890gbN, errorHandler, interfaceC14939gcd, null, 32, null); C14957gcv.e(list, ""); C14957gcv.e(map, ""); C14957gcv.e(interfaceC14890gbN, ""); C14957gcv.e(interfaceC14939gcd, ""); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public BaseDeepLinkDelegate(List list, Map map, InterfaceC14890gbN interfaceC14890gbN, ErrorHandler errorHandler) { this(list, map, interfaceC14890gbN, errorHandler, null, null, 48, null); C14957gcv.e(list, ""); C14957gcv.e(map, ""); C14957gcv.e(interfaceC14890gbN, ""); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.airbnb.deeplinkdispatch.BaseDeepLinkDelegate$2, reason: invalid class name */ /* loaded from: classes.dex */ public static final class AnonymousClass2 extends AbstractC14961gcz implements InterfaceC14939gcd { public static final AnonymousClass2 INSTANCE = new AnonymousClass2(); @Override // o.InterfaceC14939gcd public final Void invoke(DeepLinkUri deepLinkUri, Type type, String str) { C14957gcv.e(deepLinkUri, ""); C14957gcv.e(type, ""); C14957gcv.e(str, ""); return null; } AnonymousClass2() { super(3); } } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public BaseDeepLinkDelegate(List list, Map map, InterfaceC14890gbN interfaceC14890gbN) { this(list, map, interfaceC14890gbN, null, null, null, 56, null); C14957gcv.e(list, ""); C14957gcv.e(map, ""); C14957gcv.e(interfaceC14890gbN, ""); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public BaseDeepLinkDelegate(List list, Map map) { this(list, map, null, null, null, null, 60, null); C14957gcv.e(list, ""); C14957gcv.e(map, ""); } /* loaded from: classes.dex */ public final /* synthetic */ class WhenMappings { public static final int[] $EnumSwitchMapping$0; static { int[] iArr = new int[DeepLinkParamType.values().length]; iArr[DeepLinkParamType.Path.ordinal()] = 1; iArr[DeepLinkParamType.Query.ordinal()] = 2; $EnumSwitchMapping$0 = iArr; } } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public BaseDeepLinkDelegate(List list) { this(list, null, null, null, null, null, 62, null); C14957gcv.e(list, ""); } }