package ak3; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import androidx.activity.ComponentActivity; import em3.q; import g62.j; import g62.k; import java.util.List; import java.util.Set; import jp.naver.line.android.activity.linepay.LinePayLaunchActivity; import jp.naver.line.android.urlscheme.SchemeServiceReferrer; import km0.b; import kotlin.Unit; import n7.h; import ql3.u; import rb.a; import sm3.r; import zj3.e; import zj3.g; import zj3.h; import zq0.c; public final class q0 extends g implements k { /* renamed from: b reason: collision with root package name */ public static final Set<e> f5354b = h.o(e.a.f199588b, new e.c("/kyc/did/entry", false), new e.c("/nv/readNfc", false), new e.c("/startActivity", false), new e.c("/payByCreditCardHistory", false), new e.c("transfer", false), new e.c("transferrequest", false), new e.c("godutch", false), new e.c("nv/accounts/create", false), new e.c("nv/invitations/create", false), new e.c("payment", false), new e.c("nv/coupon", false), new e.c("scanBarcode", false), new e.c("issueLineCard", false), new e.c("splitbill", false), new e.c("splitbill/create", false), new e.c("splitbill/detail", false), new e.c("splitbill/accept", false), new e.c("splitbill/update", false), new e.c("invitationToIpass", false), new e.c("codes", false), new e.c(c.PATH_WEB_APP, false), new e.c("depositAccountList", false), new e.c("withdrawalAccountList", false), new e.c("identification", false), new e.c("issueLineCard", false), new e.c("googlePayAuth", false)); public q0() { super(f5354b); } @Override // zj3.g, g62.k public boolean a(Uri uri) { q.f(uri, "uri"); return q.b("pay", uri.getHost()); } @Override // g62.k public j b(Context context, Uri uri, SchemeServiceReferrer schemeServiceReferrer) { List<String> pathSegments = uri.getPathSegments(); q.e(pathSegments, "it"); SchemeServiceReferrer.Chat chat = null; if (!(!pathSegments.isEmpty())) { pathSegments = null; } if (pathSegments == null) { return null; } String str = pathSegments.get(0); q.e(str, "pathSegments[SEGMENT_INDEX_FEATURE]"); if (!((fm0.e) a.d(context, fm0.e.f72501z0)).A(str) || pathSegments.size() < 2) { return null; } String str2 = uri.getPathSegments().get(1); q.e(str2, "uri.pathSegments[SEGMENT_INDEX_APP_ID]"); String str3 = str2; String a14 = k.a.a(uri, (pathSegments.size() - 1) - 1); if (schemeServiceReferrer instanceof SchemeServiceReferrer.Chat) { chat = (SchemeServiceReferrer.Chat) schemeServiceReferrer; } return new j(uri, "pay", str3, a14, chat); } @Override // zj3.g public boolean c() { return false; } @Override // zj3.g public zj3.h d(Context context, Uri uri, SchemeServiceReferrer schemeServiceReferrer) { Intent intent; q.f(context, "context"); q.f(uri, "uri"); q.f(schemeServiceReferrer, "referrer"); if (!r.r(uri.getQueryParameter(c.QUERY_KEY_LP_USAGE), "STANDALONE", true) || !(context instanceof Activity)) { fm0.e eVar = (fm0.e) a.d(context, fm0.e.f72501z0); if (q.b(uri.getPath(), "/nv/readNfc")) { String query = uri.getQuery(); if (query == null) { return zj3.h.f199602a; } String substring = query.substring(5); q.e(substring, "this as java.lang.String).substring(startIndex)"); intent = eVar.j(c.QUERY_KEY_CODE, substring); } else if ((schemeServiceReferrer instanceof SchemeServiceReferrer.Liff) && q.b(uri.getPath(), "/startActivity")) { String queryParameter = uri.getQueryParameter("targetActivity"); if (queryParameter == null) { return zj3.h.f199602a; } String queryParameter2 = uri.getQueryParameter("targetPackage"); if (queryParameter2 == null) { return zj3.h.f199602a; } Set<String> queryParameterNames = uri.getQueryParameterNames(); q.e(queryParameterNames, "uri.queryParameterNames"); Set<String> N0 = u.N0(queryParameterNames); N0.remove("targetActivity"); N0.remove("targetPackage"); boolean z14 = false; try { z14 = context.getPackageManager().getPackageInfo(queryParameter2, 0).applicationInfo.enabled; } catch (Exception unused) { } if (z14) { Unit unit = null; Activity activity = context instanceof Activity ? (Activity) context : null; if (activity != null) { Intent intent2 = new Intent(); intent2.setClassName(queryParameter2, queryParameter); for (String str : N0) { intent2.putExtra(str, uri.getQueryParameter(str)); } activity.startActivityForResult(intent2, 1); unit = Unit.INSTANCE; } if (unit == null) { return zj3.h.f199602a; } h.a aVar = zj3.h.f199602a; return h.b.f199604b; } intent = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + queryParameter2)); } else if ((schemeServiceReferrer instanceof SchemeServiceReferrer.Chat) && q.b(uri.getPath(), "/payByCreditCardHistory")) { intent = eVar.p(context, LinePayLaunchActivity.C8(context, e(uri), schemeServiceReferrer)); } else if (q.b(uri.getPath(), "/kyc/did/entry") && (context instanceof ComponentActivity)) { ((b) a.d(context, b.A1)).e((ComponentActivity) context, uri); h.a aVar2 = zj3.h.f199602a; return h.b.f199604b; } else if (!q.b(uri.getPath(), "/kyc/profilechange/entry") || !(context instanceof ComponentActivity)) { intent = LinePayLaunchActivity.C8(context, e(uri), schemeServiceReferrer); } else { ((e62.c) a.d(context, e62.c.f66936t0)).a((ComponentActivity) context, uri, LinePayLaunchActivity.C8(context, e(uri), schemeServiceReferrer)); h.a aVar3 = zj3.h.f199602a; return h.b.f199604b; } if (schemeServiceReferrer == SchemeServiceReferrer.AppShortcut.f98244c || q.b(uri.getQueryParameter(c.QUERY_KEY_MYCODE_SHORT_FROM), c.MYCODE_SHORT_CUT)) { intent.addFlags(268468224); eVar.G0("from.shortcut"); } else if (schemeServiceReferrer == SchemeServiceReferrer.WalletTab.f98265c) { eVar.G0("from.walletTab"); } else if (!(schemeServiceReferrer instanceof SchemeServiceReferrer.Liff) && !(schemeServiceReferrer instanceof SchemeServiceReferrer.Channel)) { intent.addFlags(67108864); } context.startActivity(intent); h.a aVar4 = zj3.h.f199602a; return h.b.f199604b; } if (schemeServiceReferrer instanceof SchemeServiceReferrer.Chat) { ((Activity) context).getIntent().putExtra("chatId", ((SchemeServiceReferrer.Chat) schemeServiceReferrer).f98246c); } ((fm0.e) a.d(context, fm0.e.f72501z0)).q((Activity) context, uri.toString()); h.a aVar5 = zj3.h.f199602a; return h.b.f199604b; } public final String e(Uri uri) { String path = uri.getPath(); if (path == null) { path = ""; } StringBuilder sb4 = new StringBuilder(path); String encodedQuery = uri.getEncodedQuery(); boolean z14 = false; String str = null; if (!(!(encodedQuery == null || r.u(encodedQuery)))) { encodedQuery = null; } if (encodedQuery != null) { sb4.append('?' + encodedQuery); } String encodedFragment = uri.getEncodedFragment(); if (encodedFragment == null || r.u(encodedFragment)) { z14 = true; } if (!z14) { str = encodedFragment; } if (str != null) { sb4.append('#' + str); } return sb4.toString(); } }