QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 QBUrlUtils.java 源代码,内容仅作参考


package com.tencent.mtt.base.utils;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.http.NetUtils;
import com.tencent.common.manifest.AppManifest;
import com.tencent.common.manifest.annotation.Extension;
import com.tencent.common.utils.DecoderUtil;
import com.tencent.common.utils.QBKeyStore;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.TEACoding;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.wup.DomainListDataManager;
import com.tencent.mtt.browser.jsextension.open.IOpenJsApis;
import com.tencent.mtt.external.qrcode.common.ActionConstants2;
import com.tencent.mtt.hippy.qb.views.base.IWebViewController;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.video.browser.export.wc.m3u8.M3U8Constants;
import com.xiaomi.mipush.sdk.Constants;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.slf4j.Marker;
import qb.library.BuildConfig;

public class QBUrlUtils {

    public static IQBUrlUtilHelper f33329a;

    private static final Pattern f33330b = Pattern.compile("([a-zA-Z]+://)?(\\d){1,3}\\.(\\d){1,3}\\.(\\d){1,3}\\.(\\d){1,3}(:\\d{1,6})?(/(.*))?", 2);

    private static Pattern f33331c = null;

    private static Pattern f33332d = null;

    @Extension
    public interface IQBUrlUtilHelper {
        List<String> getAppBroadcastDomainList();

        List<String> getSearchSuffixDomainList();

        List<String> getShareQbDomainList();
    }

    public static boolean A(String str) {
        return UrlUtils.isHttpUrl(str) || UrlUtils.isHttpsUrl(str) || UrlUtils.isFileUrl(str) || UrlUtils.isFtpUrl(str) || str.startsWith("about:") || UrlUtils.isJavascript(str) || UrlUtils.isDataUrl(str);
    }

    public static String B(String str) {
        if (str == null) {
            return "";
        }
        try {
            byte[] a2 = new TEACoding(QBKeyStore.a(6)).a(str);
            return a2 != null ? new String(a2) : "";
        } catch (Exception unused) {
            return "";
        }
    }

    public static boolean C(String str) {
        return !TextUtils.isEmpty(str) && str.contains("mttwifi=");
    }

    public static boolean D(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        return str.startsWith("qb://home") || str.startsWith("qb://tab");
    }

    public static boolean E(String str) {
        String schema = UrlUtils.getSchema(str);
        if (TextUtils.isEmpty(schema) || !schema.equals(ActionConstants2.E)) {
            return false;
        }
        StatManager.b().c("AWNWF51_D-LIGHT-APP");
        return true;
    }

    public static boolean F(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("mttlogin://");
    }

    public static boolean G(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return UrlUtils.isFileUrl(str) || F(str);
    }

    public static boolean H(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://ext/read");
    }

    public static boolean I(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://ext/read/portal");
    }

    public static boolean J(String str) {
        return str != null && str.startsWith("qb://ext/read") && str.contains("bizid=2");
    }

    public static boolean K(String str) {
        return (str == null || !str.startsWith("qb://ext/read") || str.contains("bizid=2")) ? false : true;
    }

    public static boolean L(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://market/");
    }

    public static boolean M(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://ext/comic");
    }

    public static boolean N(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://ext/audiofm");
    }

    public static boolean O(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("https://v.html5.qq.com");
    }

    public static boolean P(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("https://live.html5.qq.com");
    }

    public static boolean Q(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://ext/novel");
    }

    public static boolean R(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("https://quan.qq.com") || str.startsWith("qb://ext/circle") || str.replace(NetUtils.SCHEME_HTTP, NetUtils.SCHEME_HTTPS).startsWith("https://quan.qq.com");
    }

    public static boolean S(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return str.startsWith("qb://ext/sports");
    }

    public static boolean T(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        return str.startsWith("qb://ext/nowliveroom") || str.startsWith("qb://nowlive");
    }

    public static boolean U(String str) {
        if (str == null) {
            return false;
        }
        try {
            String trim = str.trim();
            if (trim.indexOf(10) < 0 && trim.indexOf(32) < 0) {
                if (trim.toLowerCase().startsWith("www.") || trim.toLowerCase().startsWith("m.")) {
                    trim = NetUtils.SCHEME_HTTP + trim;
                }
                if (trim.startsWith(NetUtils.SCHEME_HTTP) || trim.startsWith(NetUtils.SCHEME_HTTPS) || trim.startsWith("ftp://")) {
                    return UrlUtils.toURL(trim) != null;
                }
                return false;
            }
            return false;
        } catch (Exception unused) {
            return false;
        }
    }

    public static boolean V(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("qb://filereader");
    }

    public static String W(String str) {
        try {
            if (!w(str)) {
                return null;
            }
            int indexOf = str.indexOf("?");
            if (indexOf != -1) {
                str = str.substring(0, indexOf);
            }
            return str;
        } catch (Exception unused) {
            return null;
        }
    }

    public static byte X(String str) {
        if (str == null) {
            return (byte) -1;
        }
        if (!str.startsWith("qb://home") && !str.startsWith("qb://tab")) {
            return (byte) -1;
        }
        try {
            String queryParameter = Uri.parse(str).getQueryParameter("opt");
            if ("0".equals(queryParameter)) {
                return (byte) 0;
            }
            if ("1".equals(queryParameter)) {
                return (byte) 1;
            }
            return ("2".equals(queryParameter) || "3".equals(queryParameter)) ? (byte) 2 : (byte) 1;
        } catch (Exception unused) {
            return (byte) 1;
        }
    }

    public static String Y(String str) {
        int indexOf = str.indexOf("qb://");
        return indexOf != -1 ? str.substring(indexOf) : x(str);
    }

    public static boolean Z(String str) {
        return (str == null || !str.startsWith("qb://ext/read") || str.contains("bizid=2")) ? false : true;
    }

    static IQBUrlUtilHelper a() {
        IQBUrlUtilHelper iQBUrlUtilHelper = f33329a;
        if (iQBUrlUtilHelper != null) {
            return iQBUrlUtilHelper;
        }
        if (iQBUrlUtilHelper == null) {
            f33329a = (IQBUrlUtilHelper) AppManifest.getInstance().queryExtension(IQBUrlUtilHelper.class, null);
        }
        return f33329a;
    }

    public static String a(String str, String str2) {
        Map<String, String> d2;
        String str3;
        return (TextUtils.isEmpty(str) || str2 == null || (d2 = d(str)) == null || (str3 = d2.get(str2)) == null) ? "" : str3;
    }

    public static String a(String str, boolean z) {
        if (str == null || str.length() == 0) {
            return null;
        }
        String trim = str.trim();
        if (n(trim) || UrlUtils.isJavascript(trim) || i(trim)) {
            return trim;
        }
        if (!b(trim, z)) {
            return null;
        }
        if (UrlUtils.hasValidProtocal(trim)) {
            return trim;
        }
        return NetUtils.SCHEME_HTTP + trim;
    }

    public static void a(Activity activity, String str) {
        if (t(str)) {
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.addCategory("android.intent.category.BROWSABLE");
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setData(Uri.parse(str));
            if (!str.startsWith("mqqapi://share/")) {
                intent.setFlags(268435456);
            }
            if (activity != null) {
                try {
                    activity.startActivity(intent);
                } catch (Exception unused) {
                }
            }
        }
    }

    public static boolean a(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("mttbrowser://");
    }

    public static boolean aa(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("qb://weapp");
    }

    public static boolean ab(String str) {
        HashMap<String, String> urlParam;
        if (TextUtils.isEmpty(str) || (urlParam = UrlUtils.getUrlParam(str)) == null) {
            return false;
        }
        return IOpenJsApis.TRUE.equals(urlParam.get("usesystemcore"));
    }

    public static boolean ac(String str) {
        return str.startsWith("qb://qlight");
    }

    private static boolean ad(String str) {
        c();
        return f33332d.matcher(str).matches();
    }

    private static boolean ae(String str) {
        e();
        return f33331c.matcher(str).matches();
    }

    public static String b(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        Map<String, String> d2 = d(str);
        if (TextUtils.isEmpty(d2.get(str2))) {
            return null;
        }
        String str3 = d2.get(str2);
        return (d2.containsKey("encoded") && "1".equals(d2.get("encoded"))) ? URLDecoder.decode(str3) : str3;
    }

    public static boolean b() {
        return TextUtils.equals("1", PublicSettingManager.a().getString("ANDROID_PUBLIC_PREFS_USE_NEW_URL_JUDGE_METHOD", "0"));
    }

    public static boolean b(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("mttbrowser-third://");
    }

    public static boolean b(String str, boolean z) {
        boolean b2 = b();
        System.currentTimeMillis();
        return b2 ? d(str, z) : c(str, z);
    }

    public static String c(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        Map<String, String> d2 = d(str);
        if (TextUtils.isEmpty(d2.get(str2))) {
            return null;
        }
        return d2.get(str2);
    }

    private static void c() {
        if (f33332d == null) {
            ArrayList<String> a2 = DomainListDataManager.a().a(412);
            if (a2 != null && a2.size() != 0) {
                StringBuilder sb = new StringBuilder();
                Iterator<String> it = a2.iterator();
                while (it.hasNext()) {
                    sb.append(it.next());
                }
                try {
                    f33332d = Pattern.compile(sb.toString());
                    return;
                } catch (Exception unused) {
                }
            }
            d();
        }
    }

    public static boolean c(String str) {
        return a(str) && "0".equalsIgnoreCase(d(str).get("ptLoginType"));
    }

    public static boolean c(String str, boolean z) {
        if (str != null && str.length() != 0 && str.length() <= 1048576 && !str.startsWith("data:")) {
            if (n(str)) {
                return true;
            }
            String lowerCase = str.trim().toLowerCase();
            if (z) {
                if (ae(lowerCase)) {
                    return true;
                }
                List<String> searchSuffixDomainList = a() != null ? a().getSearchSuffixDomainList() : null;
                if (searchSuffixDomainList != null && searchSuffixDomainList.size() > 0) {
                    StringBuilder sb = new StringBuilder("(?:");
                    Iterator<String> it = searchSuffixDomainList.iterator();
                    while (it.hasNext()) {
                        sb.append(it.next());
                        sb.append(HiAnalyticsConstant.REPORT_VAL_SEPARATOR);
                    }
                    sb.setLength(sb.length() - 1);
                    sb.append(")");
                    if (Pattern.compile("(.+?)(\\.)" + ((Object) sb) + "(|/(.*))\\??.*").matcher(lowerCase).matches()) {
                        return true;
                    }
                }
            } else if (UrlUtils.VALID_URL().matcher(lowerCase).find()) {
                return true;
            }
            if (UrlUtils.VALID_LOCAL_URL().matcher(lowerCase).find() || UrlUtils.VALID_IP_ADDRESS().matcher(lowerCase).find() || UrlUtils.VALID_IPV6_URL().matcher(lowerCase).find() || UrlUtils.VALID_MTT_URL().matcher(lowerCase).find() || UrlUtils.VALID_QB_URL().matcher(lowerCase).find() || UrlUtils.VALID_PAY_URL().matcher(lowerCase).find() || UrlUtils.VALID_GAME_URL().matcher(lowerCase).find()) {
                return true;
            }
        }
        return false;
    }

    public static String d(String str, String str2) {
        return TextUtils.isEmpty(str2) ? str : (str2.startsWith(M3U8Constants.COMMENT_PREFIX) || t(str2)) ? str2 : UrlUtils.resolveBase(str, str2);
    }

    public static Map<String, String> d(String str) {
        String deletePrefix = UrlUtils.deletePrefix(str);
        HashMap hashMap = new HashMap();
        if (TextUtils.isEmpty(deletePrefix)) {
            return hashMap;
        }
        for (String str2 : deletePrefix.split(Constants.ACCEPT_TIME_SEPARATOR_SP)) {
            String[] split = str2.split(ContainerUtils.KEY_VALUE_DELIMITER, 2);
            if (split.length == 2) {
                hashMap.put(split[0], split[1]);
            }
        }
        return hashMap;
    }

    private static void d() {
        f33332d = Pattern.compile("^(?!(\\.|:|/|%|,|-|_|\\?|$))([a-zA-Z:\\-]+://)?[\\u4e00-\\u9fa5a-zA-Z0-9a-zA-Z\\.\\-_]+(\\.)" + ((Object) new StringBuilder("(?:(?:aaa|aarp|abb|abbott|abogado|academy|accenture|accountant|accountants|aco|active|actor|ads|adult|aeg|aero|afl|agency|aig|airforce|airtel|allfinanz|alsace|amica|amsterdam|android|apartments|app|apple|aquarelle|aramco|archi|army|arpa|art|arte|asia|associates|attorney|auction|audio|auto|autos|axa|azure|a[cdefgilmoqrstuwxz])|(?:band|bank|bar|barcelona|barclaycard|barclays|bargains|bauhaus|bayern|bbc|bbva|bcn|beats|beer|bentley|berlin|best|bet|bharti|bible|bid|bike|bing|bingo|bio|biz|black|blackfriday|bloomberg|blue|bms|bmw|bnl|bnpparibas|boats|bom|bond|boo|boots|boutique|bradesco|bridgestone|broadway|broker|brother|brussels|budapest|build|builders|business|buzz|bzh|b[abdefghijmnorstvwyz])|(?:cab|cafe|cal|cam|camera|camp|cancerresearch|canon|capetown|capital|car|caravan|cards|care|career|careers|cars|cartier|casa|cash|casino|cat|catering|cba|cbn|ceb|center|ceo|cern|cfa|cfd|cha|chanel|channel|chat|cheap|chloe|christmas|chrome|chttp|church|cipriani|cisco|citic|city|cityeats|claims|cleaning|click|clinic|clothing|cloud|club|clubmed|coach|codes|coffee|college|cologne|com|commbank|community|company|computer|comsec|condos|construction|consulting|contractors|cooking|cool|coop|corsica|country|coupons|courses|credit|creditcard|creditunion|cricket|crown|crs|cruises|csc|cuisinella|cymru|cyou|c[acdfghiklmnoruvwxyz])|(?:dabur|dad|dance|date|dating|datsun|day|dclk|deals|degree|delivery|dell|delta|democrat|dental|dentist|desi|design|dev|diamonds|diet|digital|direct|directory|discount|dnp|docs|dog|doha|domains|doosan|download|drive|durban|dvag|d[ejkmoz])|(?:earth|eat|edu|education|email|emerck|energy|engineer|engineering|enterprises|epson|equipment|erni|esq|estate|eurovision|eus|events|everbank|exchange|expert|exposed|express|e[cegrstu])|(?:fage|fail|fairwinds|faith|family|fan|fans|farm|fashion|feedback|ferrero|film|final|finance|financial|firmdale|fish|fishing|fit|fitness|flights|florist|flowers|flsmidth|fly|foo|football|forex|forsale|forum|foundation|frl|frogans|fun|fund|furniture|futbol|fyi|f[ijkmor])|(?:gal|gallery|game|games|garden|gbiz|gdn|gea|gent|genting|ggee|gift|gifts|gives|giving|glass|gle|global|globo|gmail|gmo|gmx|gold|goldpoint|golf|goo|goog|google|gop|gov|grainger|graphics|gratis|green|gripe|group|gucci|guge|guide|guitars|guru|g[abdefghilmnpqrstuwy])|(?:hamburg|hangout|haus|healthcare|help|here|hermes|hiphop|hitachi|hiv|hockey|holdings|holiday|homedepot|homes|honda|horse|host|hosting|hoteles|hotmail|house|how|hsbc|hyundai|h[kmnrtu])|(?:ibm|icbc|ice|icu|ifm|iinet|immo|immobilien|industries|inf|infiniti|info|ing|ink|institute|insure|int|international|investments|ipiranga|irish|ist|istanbul|itau|itnfo|iwc|i[delmnoqrst])|(?:jaguar|java|jcb|jetzt|jewelry|jlc|jll|jobs|joburg|jprs|juegos|j[emop])|(?:kaufen|kddi|kia|kim|kinder|kitchen|kiwi|koeln|komatsu|krd|kred|kyoto|k[eghimnprwyz])|(?:lacaixa|lancaster|land|landrover|lasalle|lat|latrobe|law|lawyer|lds|lease|leclerc|legal|lexus|lgbt|liaison|lidl|life|lifestyle|lighting|limited|limo|linde|link|live|lixil|loan|loans|lol|london|lotte|lotto|love|ltd|ltda|lupin|luxe|luxury|l[abcikrstuvy])|(?:madrid|maif|maison|man|management|mango|market|marketing|markets|marriott|mba|media|meet|melbourne|meme|memorial|men|menu|meo|miami|microsoft|mil|mini|mma|mobi|moda|moe|moi|mom|monash|money|monster|montblanc|mormon|mortgage|moscow|motorcycles|mov|movie|movistar|mtn|mtpc|mtr|museum|mutuelle|m[acdeghklmnopqrstuvwxyz])|(?:nadex|nagoya|name|navy|nec|net|netbank|network|neustar|new|news|nexus|ngo|nhk|nico|ninja|nissan|nokia|nra|nrw|ntt|nyc|n[acefgilopruz])|(?:obi|office|okinawa|omega|one|ong|onl|online|ooo|oracle|orange|org|organic|osaka|otsuka|ovh|om)|(?:page|panerai|paris|partners|parts|party|pet|pharmacy|philips|photo|photography|photos|physio|piaget|pics|pictet|pictures|ping|pink|pizza|place|play|playstation|plumbing|plus|pohl|poker|porn|post|praxi|press|pro|prod|productions|prof|properties|property|protection|pub|p[aefghklmnrstwy])|(?:qpon|quebec|qa)|(?:racing|realtor|realty|recipes|red|redstone|rehab|reise|reisen|reit|ren|rent|rentals|repair|report|republican|rest|restaurant|review|reviews|rich|ricoh|rio|rip|rocher|rocks|rodeo|rsvp|ruhr|run|rwe|ryukyu|r[eosuw])|(?:saarland|sakura|sale|samsung|sandvik|sandvikcoromant|sanofi|sap|sapo|sarl|saxo|sbs|sca|scb|schmidt|scholarships|school|schule|schwarz|science|scor|scot|seat|security|seek|sener|services|seven|sew|sex|sexy|shiksha|shoes|shop|show|shriram|singles|site|ski|sky|skype|sncf|soccer|social|software|sohu|solar|solutions|sony|soy|space|spiegel|spreadbetting|srl|stada|starhub|statoil|stc|stcgroup|stockholm|store|stream|studio|study|style|sucks|supplies|supply|support|surf|surgery|suzuki|swatch|swiss|sydney|systems|s[abcdeghijklmnortuvxyz])|(?:tab|taipei|tatamotors|tatar|tattoo|tax|taxi|team|tech|technology|tel|telefonica|temasek|tennis|thd|theater|theatre|tickets|tienda|tips|tires|tirol|today|tokyo|tools|top|toray|toshiba|tours|town|toyota|toys|trade|trading|training|travel|trust|tui|t[cdfghjklmnortvwz])|(?:ubs|university|uno|uol|u[agksyz])|(?:vacations|vana|vegas|ventures|versicherung|vet|viajes|video|villas|vin|vip|virgin|vision|vista|vistaprint|viva|vlaanderen|vodka|vote|voting|voto|voyage|v[aceginu])|(?:wales|walter|wang|watch|webcam|website|wed|wedding|weir|whoswho|wien|wiki|williamhill|win|windows|wine|wme|work|works|world|wtc|wtf|w[fs])|(?:ελ|бел|дети|ком|мкд|мон|москва|онлайн|орг|рус|рф|сайт|срб|укр|қаз|հայ|קום|ارامكو|الاردن|الجزائر|السعودية|المغرب|امارات|ایران|بازار|بھارت|تونس|سودان|سورية|شبكة|عراق|عمان|فلسطين|قطر|كوم|مصر|مليسيا|موقع|कॉम|नेट|भारत|संगठन|ভারত|ਭਾਰਤ|ભારત|இந்தியா|இலங்கை|சிங்கப்பூர்|భారత్|ලංකා|คอม|ไทย|გე|みんな|グーグル|コム|世界|中信|中国|中國|中文网|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|在线|大拿|娱乐|工行|广东|慈善|我爱你|手机|政务|政府|新加坡|新闻|时尚|机构|淡马锡|游戏|点看|移动|组织机构|网址|网店|网络|谷歌|集团|飞利浦|餐厅|香港|닷넷|닷컴|삼성|한국|xbox|xerox|xin|xn\\-\\-11b4c3d|xn\\-\\-1qqw23a|xn\\-\\-30rr7y|xn\\-\\-3bst00m|xn\\-\\-3ds443g|xn\\-\\-3e0b707e|xn\\-\\-3pxu8k|xn\\-\\-42c2d9a|xn\\-\\-45brj9c|xn\\-\\-45q11c|xn\\-\\-4gbrim|xn\\-\\-55qw42g|xn\\-\\-55qx5d|xn\\-\\-6frz82g|xn\\-\\-6qq986b3xl|xn\\-\\-80adxhks|xn\\-\\-80ao21a|xn\\-\\-80asehdb|xn\\-\\-80aswg|xn\\-\\-90a3ac|xn\\-\\-90ais|xn\\-\\-9dbq2a|xn\\-\\-9et52u|xn\\-\\-b4w605ferd|xn\\-\\-c1avg|xn\\-\\-c2br7g|xn\\-\\-cg4bki|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-czr694b|xn\\-\\-czrs0t|xn\\-\\-czru2d|xn\\-\\-d1acj3b|xn\\-\\-d1alf|xn\\-\\-efvy88h|xn\\-\\-estv75g|xn\\-\\-fhbei|xn\\-\\-fiq228c5hs|xn\\-\\-fiq64b|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fjq720a|xn\\-\\-flw351e|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c|xn\\-\\-hxt814e|xn\\-\\-i1b6b1a6a2e|xn\\-\\-imr513n|xn\\-\\-io0a7i|xn\\-\\-j1aef|xn\\-\\-j1amh|xn\\-\\-j6w193g|xn\\-\\-kcrx77d1x4a|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-kput3i|xn\\-\\-l1acc|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgb9awbf|xn\\-\\-mgba3a3ejt|xn\\-\\-mgba3a4f16a|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbab2bd|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-mgbpl2fh|xn\\-\\-mgbtx2b|xn\\-\\-mgbx4cd0ab|xn\\-\\-mk1bu44c|xn\\-\\-mxtq1m|xn\\-\\-ngbc5azd|xn\\-\\-node|xn\\-\\-nqv7f|xn\\-\\-nqv7fs00ema|xn\\-\\-nyqy26a|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1acf|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-pssy2u|xn\\-\\-q9jyb4c|xn\\-\\-qcka1pmc|xn\\-\\-qxam|xn\\-\\-rhqv96g|xn\\-\\-s9brj9c|xn\\-\\-ses554g|xn\\-\\-t60b56a|xn\\-\\-tckwe|xn\\-\\-unup4y|xn\\-\\-vermgensberater\\-ctb|xn\\-\\-vermgensberatung\\-pwb|xn\\-\\-vhquv|xn\\-\\-vuq861b|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xhq521b|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-y9a3aq|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zfr164b|xperia|xxx|xyz)|(?:yachts|yamaxun|yandex|yodobashi|yoga|yokohama|youtube|y[et])|(?:zara|zip|zone|zuerich|z[amw]))")) + "(|/.*|\\..*|\\?.*|:\\d{1,6}.*|\\-.*|@.*)");
    }

    public static boolean d(String str, boolean z) {
        if (str != null && str.length() != 0 && str.length() <= 1048576 && !str.startsWith("data:")) {
            if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_95317697) && str.length() > 100) {
                str = str.substring(0, 100);
            }
            if (n(str)) {
                return true;
            }
            String lowerCase = str.trim().toLowerCase();
            if (z) {
                if (ad(lowerCase)) {
                    return true;
                }
                List<String> searchSuffixDomainList = a() != null ? a().getSearchSuffixDomainList() : null;
                if (searchSuffixDomainList != null && searchSuffixDomainList.size() > 0) {
                    StringBuilder sb = new StringBuilder("(?:");
                    Iterator<String> it = searchSuffixDomainList.iterator();
                    while (it.hasNext()) {
                        sb.append(it.next());
                        sb.append(HiAnalyticsConstant.REPORT_VAL_SEPARATOR);
                    }
                    sb.setLength(sb.length() - 1);
                    sb.append(")");
                    if (Pattern.compile("(.+?)(\\.)" + ((Object) sb) + "(|/(.*))\\??.*").matcher(lowerCase).matches()) {
                        return true;
                    }
                }
            } else if (UrlUtils.VALID_URL().matcher(lowerCase).find()) {
                return true;
            }
            if (UrlUtils.VALID_LOCAL_URL().matcher(lowerCase).find() || f33330b.matcher(lowerCase).matches() || UrlUtils.VALID_IPV6_URL().matcher(lowerCase).find() || UrlUtils.VALID_MTT_URL().matcher(lowerCase).find() || UrlUtils.VALID_QB_URL().matcher(lowerCase).find() || UrlUtils.VALID_PAY_URL().matcher(lowerCase).find() || UrlUtils.VALID_GAME_URL().matcher(lowerCase).find()) {
                return true;
            }
        }
        return false;
    }

    public static String e(String str, String str2) {
        HashMap<String, String> urlParam;
        if (TextUtils.isEmpty(str) || !str.startsWith("qb://ext/read")) {
            return str;
        }
        boolean z = true;
        if (str.contains("mttChannel") && (urlParam = UrlUtils.getUrlParam(str)) != null && urlParam.size() > 0) {
            z = TextUtils.isEmpty(urlParam.get("mttChannel"));
        }
        if (!z) {
            return str;
        }
        return str + (str.contains("?") ? ContainerUtils.FIELD_DELIMITER : "?") + "mttChannel=" + str2;
    }

    public static LinkedHashMap<String, String> e(String str) {
        String deletePrefix = UrlUtils.deletePrefix(str);
        LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<>();
        if (TextUtils.isEmpty(deletePrefix)) {
            return linkedHashMap;
        }
        for (String str2 : deletePrefix.split(Constants.ACCEPT_TIME_SEPARATOR_SP)) {
            String[] split = str2.split(ContainerUtils.KEY_VALUE_DELIMITER, 2);
            if (split.length == 2) {
                linkedHashMap.put(split[0], split[1]);
            }
        }
        return linkedHashMap;
    }

    private static synchronized void e() {
        synchronized (QBUrlUtils.class) {
            if (f33331c == null) {
                f33331c = Pattern.compile("(.+?)(\\.)" + ((Object) new StringBuilder("(?:ac|ad|ae|aero|af|ag|ah|ai|al|am|an|ao|app|aq|ar|as|asia|at|au|aw|az|ba|band|bb|bd|be|bf|bg|bh|bi|bid|biz|bj|black|blog|blue|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|camera|cc|cd|center|cf|cg|ch|ci|ck|cl|click|club|cm|cn|co|com|com\\.cn|coop|cq|cr|cu|cv|cx|cy|cz|date|de|design|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|engineer|es|et|eu|ev|fi|fj|fk|fm|fo|fr|fun|fund|fyi|ga|gb|gd|ge|gf|gg|gh|gi|gift|gl|gm|gn|gov|gov\\.cn|gp|gq|gr|group|gs|gt|gu|gw|gy|he|help|hk|hl|hm|hn|host|hr|ht|hu|icu|id|ie|il|im|in|info|int|io|iq|ir|is|it|je|jl|jm|jo|jp|js|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lawyer|lb|lc|li|link|live|lk|ln|loan|local|lol|love|lr|ls|lt|lu|lv|ly|ma|market|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mo|mobi|moe|mp|mq|mr|ms|mt|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|net\\.cn|news|nf|ng|ni|nl|nm|no|np|nr|nt|nu|nz|om|one|online|ooo|org|org\\.cn|pa|party|pe|pf|pg|ph|photo|php|pics|pink|pk|pl|pm|pn|pr|press|pro|pt|pub|pw|py|qa|re|red|ren|rip|ro|rocks|rs|ru|run|rw|sa|sb|sc|science|sd|se|sg|sh|shop|si|site|sj|sk|sl|sm|sn|so|social|software|space|sr|st|store|studio|su|sx|sy|sz|tc|td|team|tech|tel|tf|tg|th|tips|tj|tk|tl|tm|tn|to|today|top|tp|tr|trade|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|video|vip|vn|vu|wang|website|wenjing|wf|wiki|win|work|world|ws|wtf|xin|xn--kput3i|xxx|xyz|ye|yt|yu|za|zj|zm|zr|zw|中信|中国|中文网|企业|佛山|信息|健康|公司|公益|商城|商店|商标|在线|娱乐|广东|我爱你|手机|招聘|政务|游戏|网址|网店|网络|购物|集团|餐厅)")) + "(|/(.*))\\??.*");
            }
        }
    }

    public static boolean f(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("wtloginmqq://");
    }

    public static boolean g(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        if (str != null && str.length() > 7 && str.substring(0, 7).equalsIgnoreCase("mrvp://")) {
            return true;
        }
        if (v(str)) {
            String path = UrlUtils.getPath(str);
            if (!TextUtils.isEmpty(path) && path.contains("mrvp://")) {
                return true;
            }
        }
        return false;
    }

    public static boolean h(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("samsungapps://");
    }

    public static boolean i(String str) {
        if (str == null) {
            return false;
        }
        try {
            String lowerCase = str.toLowerCase();
            if (!h(lowerCase) && !lowerCase.startsWith(IWebViewController.BLANK_URL) && !lowerCase.startsWith("data:")) {
                if (!j(lowerCase)) {
                    return false;
                }
            }
            return true;
        } catch (ArrayIndexOutOfBoundsException unused) {
            return false;
        }
    }

    public static boolean j(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("qb://plugin/refresh");
    }

    public static String k(String str) {
        if (!TextUtils.isEmpty(str)) {
            Map<String, String> d2 = d(str);
            if (!TextUtils.isEmpty(d2.get("url"))) {
                String str2 = d2.get("url");
                return (d2.containsKey("encoded") && "1".equals(d2.get("encoded"))) ? URLDecoder.decode(str2) : str2;
            }
        }
        String l = l(UrlUtils.deletePrefix(str));
        return !TextUtils.isEmpty(l) ? l : "";
    }

    public static String l(String str) {
        return a(str, true);
    }

    public static boolean m(String str) {
        return !TextUtils.isEmpty(str) && str.toLowerCase().trim().startsWith("http://www.mobike.com/download/app.html?b=");
    }

    public static boolean n(String str) {
        if (TextUtils.isEmpty(str) || Build.VERSION.SDK_INT < 9) {
            return false;
        }
        String lowerCase = str.trim().toLowerCase();
        return lowerCase.startsWith("magnet:") || lowerCase.startsWith("ftp://") || lowerCase.startsWith("thunder://") || lowerCase.startsWith("ed2k://");
    }

    public static boolean o(String str) {
        if (!TextUtils.isEmpty(str) && str.length() <= 1048576 && !str.startsWith("data:")) {
            if (Pattern.compile("[\\w-]+\\.[\\w-]+\\S*|\\w+://\\S+", 2).matcher(str.toLowerCase()).find()) {
                return true;
            }
        }
        return false;
    }

    public static boolean p(String str) {
        return b(str, false);
    }

    public static String q(String str) {
        try {
            String host = UrlUtils.getHost(l(str));
            if (host != null) {
                return host.indexOf("qq.com") != -1 ? host.replaceAll("(?<=(\\D))\\d*(?=(\\.\\w*){3})", "") : host;
            }
            return null;
        } catch (Exception unused) {
            return null;
        }
    }

    public static String r(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        if (!G(str)) {
            return str;
        }
        String d2 = StringUtils.d(str);
        return (TextUtils.isEmpty(d2) && G(d2)) ? "" : d2;
    }

    public static boolean s(String str) {
        if (str != null) {
            String trim = str.toLowerCase().trim();
            if (trim.startsWith("qb://player/") || trim.startsWith("qb://addon/") || (trim.startsWith("qb://app/") && !trim.startsWith("qb://app/id"))) {
                return true;
            }
        }
        return false;
    }

    public static boolean t(String str) {
        return !TextUtils.isEmpty(str) && str.toLowerCase().trim().contains("mqqapi://");
    }

    public static String u(String str) {
        int lastIndexOf;
        int lastIndexOf2;
        String substring;
        String host = UrlUtils.getHost(str);
        if (host != null && !"".equals(host) && (lastIndexOf = host.lastIndexOf(46)) != -1) {
            String substring2 = host.substring(lastIndexOf + 1);
            String substring3 = host.substring(0, lastIndexOf);
            if (((substring2 != null && substring2.equalsIgnoreCase("cn")) || substring2.equalsIgnoreCase("hk")) && (lastIndexOf2 = substring3.lastIndexOf(46)) != -1 && (substring = substring3.substring(lastIndexOf2 + 1)) != null && substring.length() > 0 && (substring.equalsIgnoreCase("com") || substring.equalsIgnoreCase("edu") || substring.equalsIgnoreCase("gov"))) {
                substring2 = substring.concat(String.valueOf('.')).concat(substring2);
                substring3 = substring3.substring(0, lastIndexOf2);
            }
            int lastIndexOf3 = substring3.lastIndexOf(46);
            if (lastIndexOf3 != -1) {
                substring3 = substring3.substring(lastIndexOf3 + 1);
            }
            if (substring3 != null && substring3.length() > 0) {
                return substring3.concat(String.valueOf('.')).concat(substring2);
            }
        }
        return null;
    }

    public static boolean v(String str) {
        String u = u(str);
        if (TextUtils.isEmpty(u)) {
            return false;
        }
        return u.equals("qq.com");
    }

    public static boolean w(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        if (str != null && str.length() > 5 && str.substring(0, 5).equalsIgnoreCase("qb://")) {
            return true;
        }
        if (v(str)) {
            String path = UrlUtils.getPath(str);
            if (!TextUtils.isEmpty(path) && path.contains("qb://")) {
                return true;
            }
        }
        return !TextUtils.isEmpty(x(str));
    }

    public static String x(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        List<String> shareQbDomainList = a() != null ? a().getShareQbDomainList() : null;
        String str2 = (shareQbDomainList == null || shareQbDomainList.size() <= 0) ? "" : shareQbDomainList.get(0);
        List<String> appBroadcastDomainList = a() != null ? a().getAppBroadcastDomainList() : null;
        String str3 = (appBroadcastDomainList == null || appBroadcastDomainList.size() <= 0) ? "" : appBroadcastDomainList.get(0);
        if (TextUtils.isEmpty(str2)) {
            str2 = "sc.qq.com";
        }
        if (TextUtils.isEmpty(str3)) {
            str3 = "app.mb.qq.com";
        }
        if (str.contains(str2) && str.contains("qb://")) {
            return str.substring(str.indexOf("qb://"));
        }
        if (!str.contains(str3) || !str.contains("qb/")) {
            return "";
        }
        String substring = str.substring(str.indexOf("qb/") + 3);
        if (TextUtils.isEmpty(substring)) {
            return "";
        }
        try {
            return DecoderUtil.a(substring.replace(".", ContainerUtils.KEY_VALUE_DELIMITER).replace("!", Marker.ANY_NON_NULL_MARKER).replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "/"), "UTF-8");
        } catch (UnsupportedEncodingException unused) {
            return "";
        }
    }

    public static boolean y(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        return UrlUtils.isHttpUrl(str) || UrlUtils.isHttpsUrl(str) || UrlUtils.isBrokerUrl(str) || UrlUtils.isSmsUrl(str) || UrlUtils.isRtspUrl(str) || UrlUtils.isRtmpUrl(str) || w(str);
    }

    public static boolean z(String str) {
        return UrlUtils.isHttpUrl(str) || UrlUtils.isHttpsUrl(str) || w(str) || UrlUtils.isFileUrl(str) || UrlUtils.isFtpUrl(str) || str.startsWith("about:") || UrlUtils.isJavascript(str) || UrlUtils.isDataUrl(str);
    }
}