TikTok.apk(点击下载) / C57772Pm.java


package X;

import android.text.TextUtils;
import android.webkit.WebResourceResponse;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.ad.preload.AdLandPagePreloadServiceImpl;
import com.ss.android.ugc.aweme.ad.preload.IAdLandPagePreloadService;
import com.ss.android.ugc.aweme.global.config.settings.pojo.AdLandingPageConfig;
import com.ss.android.ugc.aweme.global.config.settings.pojo.IESSettingsProxy;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
import kotlin.g.b.m;
import org.json.JSONObject;

/* renamed from: X.2Pm  reason: invalid class name and case insensitive filesystem */
public final class C57772Pm extends AnonymousClass3LV {
    public static String LIZLLL;
    public static long LJ;
    public static String LJFF;
    public static final CopyOnWriteArrayList<AnonymousClass2JZ> LJI = new CopyOnWriteArrayList<>();
    public static final CopyOnWriteArrayList<AnonymousClass2JZ> LJII = new CopyOnWriteArrayList<>();
    public static int LJIIIIZZ;
    public static int LJIIIZ;
    public static boolean LJIIJ;
    public static boolean LJIIJJI;
    public static int LJIIL;
    public static final AnonymousClass2JY LJIILIIL = new AnonymousClass2JY((byte) 0);
    public String LIZ;
    public String LIZIZ;
    public String LIZJ;

    static {
        Covode.recordClassIndex(111093);
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public C57772Pm(String str, String str2, String str3) {
        super(true);
        C21090sc.LIZ(str, str3);
        this.LIZ = str;
        this.LIZIZ = str2;
        this.LIZJ = str3;
    }

    @Override // X.AbstractC82163Lh, X.AnonymousClass3LV
    public final WebResourceResponse LIZ(String str) {
        String str2;
        JSONObject LIZIZ2;
        C57792Po r5 = new C57792Po(this, str);
        String str3 = this.LIZIZ;
        WebResourceResponse webResourceResponse = null;
        String str4 = null;
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str3)) {
            r5.LIZ();
            return null;
        }
        C23360wH r2 = new C23360wH();
        r2.element = null;
        IAdLandPagePreloadService LJFF2 = AdLandPagePreloadServiceImpl.LJFF();
        if (LJFF2 != null) {
            r2.element = (T) LJFF2.LJI(this.LIZJ);
            str2 = C55752Hs.LIZIZ(r2.element, str3);
        } else {
            str2 = null;
        }
        if (TextUtils.isEmpty(str2)) {
            r5.LIZ();
            return null;
        }
        C57782Pn r12 = new C57782Pn(this, str, str2, r2, str3);
        IAdLandPagePreloadService LJFF3 = AdLandPagePreloadServiceImpl.LJFF();
        boolean z = true;
        if (!(LJFF3 == null || (LIZIZ2 = LJFF3.LIZIZ(str2)) == null)) {
            String LIZ2 = C53812Ag.LIZ(str);
            if (!LIZIZ2.has(LIZ2)) {
                if (!(str == null || str.length() == 0)) {
                    String LIZ3 = LJIILIIL.LIZ(str);
                    if (LIZ3.length() != str.length()) {
                        LIZ2 = C53812Ag.LIZ(LIZ3);
                    }
                }
            }
            JSONObject optJSONObject = LIZIZ2.optJSONObject(LIZ2);
            if (optJSONObject != null) {
                System.currentTimeMillis();
                File file = new File(str2, optJSONObject.optString("fileName"));
                if (file.exists()) {
                    JSONObject optJSONObject2 = optJSONObject.optJSONObject("respHeader");
                    if (optJSONObject2 != null) {
                        str4 = optJSONObject2.optString("content-type");
                    }
                    webResourceResponse = LIZ(str4, "", new FileInputStream(file));
                }
                if (webResourceResponse != null) {
                    r12.LIZ(webResourceResponse.getMimeType(), String.valueOf(file.length()));
                } else {
                    r5.LIZ();
                }
                return webResourceResponse;
            }
        }
        System.currentTimeMillis();
        if (str != null) {
            String LIZ4 = LJIILIIL.LIZ(str);
            String LIZJ2 = LIZJ(LIZ4);
            if (AdLandPagePreloadServiceImpl.LJFF() == null) {
                z = false;
            }
            if (!TextUtils.isEmpty(LIZJ2) || !z) {
                try {
                    File file2 = new File(str2, C53812Ag.LIZ(LIZ4));
                    WebResourceResponse LIZ5 = file2.exists() ? LIZ(LIZJ2, "", new FileInputStream(file2)) : null;
                    if (LIZ5 != null) {
                        r12.LIZ(LIZ5.getMimeType(), String.valueOf(file2.length()));
                    } else {
                        r5.LIZ();
                    }
                    return LIZ5;
                } catch (Throwable unused) {
                    r5.LIZ();
                    return null;
                }
            } else {
                r5.LIZ();
                return null;
            }
        } else {
            r5.LIZ();
            return null;
        }
    }

    @Override // X.AnonymousClass3LV
    public final String LIZ() {
        return "";
    }

    @Override // X.AnonymousClass3LV
    public final InputStream LIZIZ(String str) {
        return null;
    }

    @Override // X.AnonymousClass3LV
    public final String LIZJ(String str) {
        if (str != null && AnonymousClass1ZS.LIZJ(str, ".shtml", false)) {
            return "text/html";
        }
        if (str != null && AnonymousClass1ZS.LIZJ(str, ".do", false)) {
            return "text/html";
        }
        String LIZJ2 = super.LIZJ(str);
        m.LIZIZ(LIZJ2, "");
        return LIZJ2;
    }

    public final boolean LIZLLL(String str) {
        if (!AnonymousClass1ZS.LIZ((CharSequence) LJIILIIL.LIZ(str), (CharSequence) ".", false)) {
            return false;
        }
        int LIZ2 = AnonymousClass1ZS.LIZ((CharSequence) str, ".");
        Objects.requireNonNull(str, "null cannot be cast to non-null type java.lang.String");
        String substring = str.substring(LIZ2);
        m.LIZIZ(substring, "");
        return !(AnonymousClass1ZS.LIZ(substring, "/", false));
    }

    /* JADX WARNING: Removed duplicated region for block: B:13:0x0049  */
    /* JADX WARNING: Removed duplicated region for block: B:9:0x003b  */
    public final boolean LJ(String str) {
        List<String> list;
        ArrayList arrayList;
        Iterator it;
        String LIZ2 = LJIILIIL.LIZ(str);
        IESSettingsProxy iESSettingsProxy = C38141f1.LIZ.LIZIZ;
        m.LIZIZ(iESSettingsProxy, "");
        try {
            AdLandingPageConfig adLandingPageConfig = iESSettingsProxy.getAdLandingPageConfig();
            m.LIZIZ(adLandingPageConfig, "");
            list = adLandingPageConfig.getResourceExcludeUrl();
            if (list != null) {
                arrayList = (ArrayList) list;
                if (list != null) {
                    arrayList = (ArrayList) list;
                }
                it = arrayList.iterator();
                while (it.hasNext()) {
                    String str2 = (String) it.next();
                    m.LIZIZ(str2, "");
                    if (AnonymousClass1ZS.LIZ((CharSequence) LIZ2, (CharSequence) str2, false)) {
                        return true;
                    }
                }
                return false;
            }
        } catch (AnonymousClass2O8 e) {
            e.printStackTrace();
            list = null;
        }
        arrayList = AnonymousClass1ZP.LIZLLL("jsonp", "callback", "analytics.tiktok.com/i18n/pixel", "google-analytics.com/analytics", "connect.facebook.net", "www.googletagmanager.com");
        if (list != null) {
        }
        it = arrayList.iterator();
        while (it.hasNext()) {
        }
        return false;
    }

    /* JADX WARNING: Removed duplicated region for block: B:11:0x0040  */
    public final boolean LJFF(String str) {
        ArrayList arrayList;
        Iterator it;
        String LIZ2 = LJIILIIL.LIZ(str);
        IESSettingsProxy iESSettingsProxy = C38141f1.LIZ.LIZIZ;
        m.LIZIZ(iESSettingsProxy, "");
        try {
            AdLandingPageConfig adLandingPageConfig = iESSettingsProxy.getAdLandingPageConfig();
            m.LIZIZ(adLandingPageConfig, "");
            List<String> parsePathRegex = adLandingPageConfig.getParsePathRegex();
            if (parsePathRegex != null) {
                arrayList = (ArrayList) parsePathRegex;
                it = arrayList.iterator();
                while (it.hasNext()) {
                    String str2 = (String) it.next();
                    m.LIZIZ(str2, "");
                    if (new C23710wq(str2).containsMatchIn(LIZ2)) {
                        return true;
                    }
                }
                return false;
            }
        } catch (AnonymousClass2O8 e) {
            e.printStackTrace();
        }
        arrayList = AnonymousClass1ZP.LIZLLL("^https?:\\/\\/www\\.google-analytics\\.com/(?:ga|urchin|analytics)\\.js", "^https?:\\/\\/www\\.googletagmanager\\.com\\/(gtag\\/js|gtm\\.js)", "^https?:\\/\\/analytics\\.tiktok\\.com\\/i18n\\/pixel", "https?:\\/\\/connect\\.facebook\\.net\\/(.*)\\/fbevents\\.js", "https?:\\/\\/mc\\.yandex\\.ru\\/");
        it = arrayList.iterator();
        while (it.hasNext()) {
        }
        return false;
    }
}