Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

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


package com.bytedance.sdk.openadsdk.core;

import android.os.Build;
import android.text.TextUtils;
import android.util.Pair;
import com.applovin.sdk.AppLovinErrorCodes;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.FilterWord;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.core.g.a.b;
import com.bytedance.sdk.openadsdk.core.model.q;
import com.bytedance.sdk.openadsdk.utils.ab;
import com.bytedance.sdk.openadsdk.utils.ac;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.facebook.share.internal.MessengerShareContentUtility;
import com.facebook.share.internal.ShareConstants;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.download.database.DownloadModel;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.safedk.android.internal.partials.PangleVideoBridge;
import com.unity3d.services.ads.adunit.AdUnitActivity;
import com.vungle.warren.model.AdvertisementDBAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import net.pubnative.lite.sdk.analytics.Reporting;
import net.pubnative.lite.sdk.models.APIAsset;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class b {
    private static int a(com.bykv.vk.openvk.component.video.api.c.b bVar, boolean z) {
        if (bVar == null) {
            return TTAdConstant.VIDEO_INFO_CODE;
        }
        if (TextUtils.isEmpty(bVar.k())) {
            return TTAdConstant.VIDEO_URL_CODE;
        }
        if (z || !TextUtils.isEmpty(bVar.j())) {
            return 200;
        }
        return TTAdConstant.VIDEO_COVER_URL_CODE;
    }

    private static int a(com.bytedance.sdk.openadsdk.core.model.c cVar) {
        if (cVar == null) {
            return TTAdConstant.DOWNLOAD_APP_INFO_CODE;
        }
        if (TextUtils.isEmpty(cVar.a())) {
            return TTAdConstant.DOWNLOAD_URL_CODE;
        }
        return 200;
    }

    private static int a(com.bytedance.sdk.openadsdk.core.model.j jVar) {
        if (jVar == null) {
            return 200;
        }
        if (TextUtils.isEmpty(jVar.a())) {
            return TTAdConstant.DEEPLINK_UNAVAILABLE_CODE;
        }
        if (TextUtils.isEmpty(jVar.b())) {
            return TTAdConstant.DEEPLINK_FALLBACK_CODE;
        }
        if (jVar.c() == 1 || jVar.c() == 2) {
            return 200;
        }
        return TTAdConstant.DEEPLINK_FALLBACK_TYPE_CODE;
    }

    private static int a(com.bytedance.sdk.openadsdk.core.model.q qVar) {
        int i;
        if (qVar == null) {
            return TTAdConstant.MATE_IS_NULL_CODE;
        }
        if (TextUtils.isEmpty(qVar.Y()) || qVar.Y().length() <= 1) {
            return TTAdConstant.AD_ID_IS_NULL_CODE;
        }
        if (qVar.be() == 0) {
            i = a(qVar.ab());
            if (i != 200) {
                return i;
            }
        } else {
            i = 200;
        }
        if (qVar.av()) {
            int aT = qVar.aT();
            if (aT < 0) {
                aT = qVar.D() != null ? qVar.D().getDurationSlotType() : qVar.aS();
            }
            String c = ab.c(aT);
            if (qVar.bd()) {
                c = "fullscreen_interstitial_ad";
            }
            if (TextUtils.isEmpty(qVar.aw())) {
                com.bytedance.sdk.openadsdk.b.c.b(qVar, c, "load_html_fail", (JSONObject) null);
                return TTAdConstant.MATE_IS_NULL_CODE;
            }
            com.bytedance.sdk.openadsdk.b.c.b(qVar, c, "load_html_success", (JSONObject) null);
        }
        int M = qVar.M();
        if (M == 2 || M == 3) {
            if (b(qVar) && TextUtils.isEmpty(qVar.P())) {
                return TTAdConstant.LANDING_PAGE_TYPE_CODE;
            }
        } else if (M == 4 && (i = a(qVar.aa())) != 200) {
            return i;
        }
        if (!qVar.at()) {
            int ad = qVar.ad();
            if (ad != 2 && ad != 3 && ad != 4) {
                if (ad != 5 && ad != 15) {
                    if (ad != 16) {
                    }
                }
                i = a(qVar.K(), qVar.at());
                if (i != 200) {
                    return i;
                }
            }
            i = a(qVar.Q());
            if (i != 200) {
            }
        }
        return i;
    }

    private static int a(List<com.bytedance.sdk.openadsdk.core.model.n> list) {
        if (list == null) {
            return TTAdConstant.IMAGE_LIST_CODE;
        }
        if (list.size() <= 0) {
            return TTAdConstant.IMAGE_LIST_SIZE_CODE;
        }
        for (com.bytedance.sdk.openadsdk.core.model.n nVar : list) {
            if (nVar == null) {
                return TTAdConstant.IMAGE_CODE;
            }
            if (TextUtils.isEmpty(nVar.a())) {
                return 412;
            }
        }
        return 200;
    }

    private static Pair<com.bytedance.sdk.openadsdk.core.g.a, b.a> a(String str, int i, int i2) {
        int i3;
        int i4;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (i2 == 1 || i2 == 5) {
            i3 = 0;
            i4 = 0;
        } else {
            i3 = ac.c(o.a());
            i4 = ac.d(o.a());
            if (i == 2) {
                i4 = i3;
                i3 = i4;
            }
        }
        com.bytedance.sdk.openadsdk.core.g.a.a.e eVar = new com.bytedance.sdk.openadsdk.core.g.a.a.e(o.a(), i3, i4);
        return new Pair<>(eVar.a(str, new ArrayList()), eVar.f);
    }

    public static Pair<com.bytedance.sdk.openadsdk.core.model.a, ArrayList<Integer>> a(JSONObject jSONObject, AdSlot adSlot, com.bytedance.sdk.openadsdk.core.model.s sVar) {
        if (jSONObject == null) {
            return null;
        }
        try {
            com.bytedance.sdk.openadsdk.core.model.a aVar = new com.bytedance.sdk.openadsdk.core.model.a();
            aVar.a(jSONObject.optString("request_id"));
            aVar.a(jSONObject.optInt("ret"));
            aVar.b(jSONObject.optString("message"));
            String optString = jSONObject.optString("gdid_encrypted");
            if (jSONObject.has("choose_ui_data")) {
                aVar.a(jSONObject.optJSONObject("choose_ui_data"));
                aVar.a(true);
            }
            String optString2 = jSONObject.optString("auction_price");
            if (aVar.b() != 0) {
                return null;
            }
            JSONArray optJSONArray = jSONObject.optJSONArray("creatives");
            ArrayList arrayList = new ArrayList();
            int i = 0;
            if (optJSONArray != null) {
                int length = optJSONArray.length();
                while (i < optJSONArray.length()) {
                    com.bytedance.sdk.openadsdk.core.model.q b2 = b(optJSONArray.optJSONObject(i), adSlot, sVar);
                    int a2 = a(b2);
                    if (a2 != 200) {
                        arrayList.add(Integer.valueOf(a2));
                    } else {
                        b2.i(optString2);
                        if (!TextUtils.isEmpty(optString)) {
                            b2.y(optString);
                        }
                        aVar.a(b2);
                    }
                    i++;
                }
                i = length;
            }
            a(i, aVar);
            return new Pair<>(aVar, arrayList);
        } catch (Throwable th) {
            com.bytedance.sdk.component.utils.l.e("AdInfoFactory", th.getMessage());
            return null;
        }
    }

    private static com.bykv.vk.openvk.component.video.api.c.b a(JSONObject jSONObject, com.bytedance.sdk.openadsdk.core.model.q qVar) {
        if (jSONObject == null) {
            return null;
        }
        com.bykv.vk.openvk.component.video.api.c.b bVar = new com.bykv.vk.openvk.component.video.api.c.b();
        bVar.b(jSONObject.optInt("cover_height"));
        bVar.c(jSONObject.optInt("cover_width"));
        bVar.a(jSONObject.optString("resolution"));
        bVar.a(jSONObject.optLong("size"));
        double optDouble = jSONObject.optDouble("video_duration", 0.0d);
        bVar.a(optDouble);
        jSONObject.optInt("replay_time", 1);
        bVar.j((optDouble > 15.0d || qVar.u() == 1 || !com.bytedance.sdk.openadsdk.core.model.q.c(qVar)) ? 1 : 1);
        bVar.b(jSONObject.optString("cover_url"));
        bVar.c(jSONObject.optString("video_url"));
        bVar.d(jSONObject.optString(CampaignEx.JSON_NATIVE_VIDEO_ENDCARD));
        bVar.e(jSONObject.optString("playable_download_url"));
        bVar.f(jSONObject.optString("file_hash"));
        bVar.h(jSONObject.optInt("if_playable_loading_show", 0));
        bVar.i(jSONObject.optInt("remove_loading_page_type", 0));
        bVar.a(jSONObject.optInt("fallback_endcard_judge", 0));
        bVar.e(jSONObject.optInt("video_preload_size", 307200));
        bVar.f(jSONObject.optInt("reward_video_cached_type", 0));
        bVar.g(jSONObject.optInt("execute_cached_type", 0));
        bVar.d(jSONObject.optDouble("endcard_render", 0.0d) != 1.0d ? 0 : 1);
        return bVar;
    }

    public static com.bytedance.sdk.openadsdk.core.model.q a(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        return b(jSONObject, null, null);
    }

    private static void a(int i, final com.bytedance.sdk.openadsdk.core.model.a aVar) {
        if (aVar == null || i < 2) {
            return;
        }
        final int size = i - (aVar.c() != null ? aVar.c().size() : 0);
        final boolean z = aVar.g() && aVar.h() == null;
        if (size > 0 || z) {
            com.bytedance.sdk.openadsdk.j.b.a();
            com.bytedance.sdk.openadsdk.j.b.a("choose_ad_parsing_error", false, new com.bytedance.sdk.openadsdk.j.a() {
                @Override
                public com.bytedance.sdk.openadsdk.j.a.a getLogStats() throws Exception {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("req_id", com.bytedance.sdk.openadsdk.core.model.a.this.a());
                    jSONObject.put("material_error", size);
                    jSONObject.put("choose_ui_error", z ? 1 : 0);
                    return com.bytedance.sdk.openadsdk.j.a.b.b().a("choose_ad_parsing_error").b(jSONObject.toString());
                }
            });
        }
    }

    private static void a(com.bytedance.sdk.openadsdk.core.g.a aVar, com.bytedance.sdk.openadsdk.core.model.q qVar) {
        aVar.a(qVar);
        int M = qVar.M();
        if (M != 2 && M != 3) {
            qVar.r(2);
        }
        qVar.d(1);
        qVar.a(aVar);
        if (!TextUtils.isEmpty(aVar.d())) {
            qVar.n(aVar.d());
        }
        if (!TextUtils.isEmpty(aVar.e())) {
            qVar.o(aVar.e());
        }
        qVar.l(aVar.f());
        qVar.a((com.bytedance.sdk.openadsdk.core.model.c) null);
        com.bykv.vk.openvk.component.video.api.c.b K = qVar.K();
        if (K == null) {
            K = new com.bykv.vk.openvk.component.video.api.c.b();
        }
        K.c(aVar.g());
        K.a(aVar.h());
        K.f((String) null);
        K.b((String) null);
        K.d((String) null);
        qVar.a(K);
        if (aVar.b() != null && !TextUtils.isEmpty(aVar.b().e())) {
            com.bytedance.sdk.openadsdk.core.model.n nVar = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar.a(aVar.b().e());
            nVar.a(aVar.b().b());
            nVar.b(aVar.b().c());
            qVar.a(nVar);
        } else if (qVar.N() == null) {
            com.bytedance.sdk.openadsdk.core.model.n nVar2 = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar2.a("https://sf16-fe-tos-sg.i18n-pglstatp.com/obj/ad-pattern-sg/static/images/2023620white.jpeg");
            nVar2.a(98);
            nVar2.b(98);
            qVar.a(nVar2);
        }
    }

    private static void a(com.bytedance.sdk.openadsdk.core.model.q qVar, String str) {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("reason_code", -1);
            jSONObject.put("error_code", -1);
            com.bytedance.sdk.openadsdk.b.c.b(qVar, str, "load_vast_fail", jSONObject);
        } catch (Exception unused) {
        }
    }

    private static void a(final com.bytedance.sdk.openadsdk.core.model.q qVar, final String str, final com.bytedance.sdk.openadsdk.core.g.a aVar, final long j, final b.a aVar2) {
        com.bytedance.sdk.openadsdk.b.c.a(new com.bytedance.sdk.component.g.h("vast_parser") {
            @Override
            public void run() {
                try {
                    JSONObject jSONObject = new JSONObject();
                    com.bytedance.sdk.openadsdk.core.g.a aVar3 = aVar;
                    String str2 = "load_vast_fail";
                    if (aVar3 != null) {
                        if (!TextUtils.isEmpty(aVar3.i()) && !TextUtils.isEmpty(aVar.f()) && aVar.h() > 0.0d) {
                            jSONObject.put(IronSourceConstants.EVENTS_DURATION, System.currentTimeMillis() - j);
                            b.a aVar4 = aVar2;
                            if (aVar4 != null) {
                                jSONObject.put("wrapper_count", aVar4.f2503b);
                                jSONObject.put("impression_links_null", aVar2.c);
                            }
                            str2 = "load_vast_success";
                        }
                        jSONObject.put("reason_code", -3);
                        jSONObject.put("error_code", -3);
                    } else {
                        jSONObject.put("reason_code", -2);
                        b.a aVar5 = aVar2;
                        if (aVar5 != null) {
                            jSONObject.put("error_code", aVar5.f2502a);
                        }
                    }
                    com.bytedance.sdk.openadsdk.b.c.b(qVar, str, str2, jSONObject);
                    com.bytedance.sdk.openadsdk.core.g.a aVar6 = aVar;
                    if (aVar6 == null || aVar6.b() == null || !TextUtils.isEmpty(aVar.b().f())) {
                        return;
                    }
                    JSONObject jSONObject2 = new JSONObject();
                    try {
                        jSONObject2.put("error_code", 1000);
                        jSONObject2.put("description", "1000:Image url is null");
                    } catch (Throwable unused) {
                    }
                    com.bytedance.sdk.openadsdk.b.c.b(qVar, str, "load_vast_icon_fail", jSONObject2);
                    aVar.a((com.bytedance.sdk.openadsdk.core.g.b) null);
                } catch (Exception unused2) {
                }
            }
        });
    }

    private static com.bytedance.sdk.openadsdk.core.model.d b(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        int optInt = jSONObject.optInt("splash_clickarea", 2);
        int optInt2 = jSONObject.optInt("splash_layout_id", 1);
        long optLong = jSONObject.optLong("load_wait_time", 0L);
        long j = optLong >= 0 ? optLong : 0L;
        com.bytedance.sdk.openadsdk.core.model.d dVar = new com.bytedance.sdk.openadsdk.core.model.d();
        dVar.a(optInt);
        dVar.b(optInt2);
        dVar.a(j);
        return dVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.q b(JSONObject jSONObject, AdSlot adSlot, com.bytedance.sdk.openadsdk.core.model.s sVar) {
        String optString;
        JSONArray optJSONArray;
        JSONObject optJSONObject;
        com.bykv.vk.openvk.component.video.api.c.b bVar;
        JSONObject optJSONObject2;
        com.bykv.vk.openvk.component.video.api.c.b bVar2;
        JSONObject optJSONObject3;
        JSONObject optJSONObject4;
        JSONObject optJSONObject5;
        int i;
        JSONObject optJSONObject6;
        int optInt;
        int aT;
        com.bytedance.sdk.openadsdk.core.g.a aVar;
        b.a aVar2;
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.q b2 = com.bytedance.sdk.openadsdk.core.model.q.b();
        b2.r(jSONObject.optInt("interaction_type"));
        b2.l(jSONObject.optString("target_url"));
        b2.q(jSONObject.optString("ad_id"));
        b2.r(jSONObject.optString("app_log_url"));
        b2.k(jSONObject.optString("source"));
        int i2 = 0;
        b2.v(jSONObject.optInt("dislike_control", 0));
        b2.m(jSONObject.optInt("play_bar_show_time", AppLovinErrorCodes.UNABLE_TO_PRECACHE_RESOURCES));
        b2.t(jSONObject.optString("gecko_id"));
        if (jSONObject.has("set_click_type")) {
            JSONObject optJSONObject7 = jSONObject.optJSONObject("set_click_type");
            b2.b(optJSONObject7.optDouble(APIAsset.CALL_TO_ACTION, 2.0d));
            b2.a(optJSONObject7.optDouble("other", 1.0d));
        }
        b2.d(jSONObject.optJSONObject(ShareConstants.MEDIA_EXTENSION));
        JSONObject optJSONObject8 = jSONObject.optJSONObject("icon");
        b2.d(jSONObject.optBoolean("screenshot", false));
        b2.k(jSONObject.optInt("play_bar_style", 0));
        b2.u(jSONObject.optString("market_url", ""));
        b2.i(jSONObject.optInt("video_adaptation", 0));
        b2.f(jSONObject.optInt("feed_video_opentype", 0));
        b2.b(jSONObject.optJSONObject("session_params"));
        b2.i(jSONObject.optString("auction_price", ""));
        b2.A(jSONObject.optInt("mrc_report", 0));
        if (jSONObject.optBoolean("isMrcReportFinish", false)) {
            b2.aA();
        }
        JSONObject optJSONObject9 = jSONObject.optJSONObject(Reporting.EventType.RENDER);
        if (optJSONObject9 != null) {
            b2.g(optJSONObject9.optInt("render_sequence", 0));
            b2.h(optJSONObject9.optInt("backup_render_control", 1));
            b2.B(optJSONObject9.optInt("reserve_time", 100));
            b2.C(optJSONObject9.optInt("render_thread", 0));
        }
        b2.d(jSONObject.optInt("render_control", sVar != null ? sVar.f : 1));
        if (optJSONObject8 != null) {
            com.bytedance.sdk.openadsdk.core.model.n nVar = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar.a(optJSONObject8.optString("url"));
            nVar.b(optJSONObject8.optInt(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY));
            nVar.a(optJSONObject8.optInt(ViewHierarchyConstants.DIMENSION_WIDTH_KEY));
            b2.a(nVar);
        }
        JSONObject optJSONObject10 = jSONObject.optJSONObject("reward_data");
        if (optJSONObject10 != null) {
            b2.c(optJSONObject10.optInt(CampaignEx.JSON_KEY_REWARD_AMOUNT, 0));
            b2.g(optJSONObject10.optString(CampaignEx.JSON_KEY_REWARD_NAME, ""));
        }
        JSONObject optJSONObject11 = jSONObject.optJSONObject("cover_image");
        if (optJSONObject11 != null) {
            com.bytedance.sdk.openadsdk.core.model.n nVar2 = new com.bytedance.sdk.openadsdk.core.model.n();
            nVar2.a(optJSONObject11.optString("url"));
            nVar2.b(optJSONObject11.optInt(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY));
            nVar2.a(optJSONObject11.optInt(ViewHierarchyConstants.DIMENSION_WIDTH_KEY));
            b2.b(nVar2);
        }
        JSONArray optJSONArray2 = jSONObject.optJSONArray("image");
        if (optJSONArray2 != null) {
            for (int i3 = 0; i3 < optJSONArray2.length(); i3++) {
                com.bytedance.sdk.openadsdk.core.model.n nVar3 = new com.bytedance.sdk.openadsdk.core.model.n();
                JSONObject optJSONObject12 = optJSONArray2.optJSONObject(i3);
                nVar3.a(optJSONObject12.optString("url"));
                nVar3.b(optJSONObject12.optInt(ViewHierarchyConstants.DIMENSION_HEIGHT_KEY));
                nVar3.a(optJSONObject12.optInt(ViewHierarchyConstants.DIMENSION_WIDTH_KEY));
                nVar3.a(optJSONObject12.optBoolean("image_preview"));
                nVar3.b(optJSONObject12.optString("image_key"));
                b2.c(nVar3);
            }
        }
        JSONArray optJSONArray3 = jSONObject.optJSONArray("show_url");
        if (optJSONArray3 != null) {
            for (int i4 = 0; i4 < optJSONArray3.length(); i4++) {
                b2.S().add(optJSONArray3.optString(i4));
            }
        }
        JSONArray optJSONArray4 = jSONObject.optJSONArray("click_url");
        if (optJSONArray4 != null) {
            for (int i5 = 0; i5 < optJSONArray4.length(); i5++) {
                b2.T().add(optJSONArray4.optString(i5));
            }
        }
        JSONArray optJSONArray5 = jSONObject.optJSONArray("play_start");
        if (optJSONArray5 != null) {
            for (int i6 = 0; i6 < optJSONArray5.length(); i6++) {
                b2.U().add(optJSONArray5.optString(i6));
            }
        }
        JSONObject optJSONObject13 = jSONObject.optJSONObject("click_area");
        if (optJSONObject13 != null) {
            com.bytedance.sdk.openadsdk.core.model.h hVar = new com.bytedance.sdk.openadsdk.core.model.h();
            hVar.f2593a = optJSONObject13.optBoolean("click_upper_content_area", true);
            hVar.f2594b = optJSONObject13.optBoolean("click_upper_non_content_area", true);
            hVar.c = optJSONObject13.optBoolean("click_lower_content_area", true);
            hVar.d = optJSONObject13.optBoolean("click_lower_non_content_area", true);
            hVar.e = optJSONObject13.optBoolean("click_button_area", true);
            hVar.f = optJSONObject13.optBoolean("click_video_area", true);
            b2.a(hVar);
        }
        JSONObject optJSONObject14 = jSONObject.optJSONObject("adslot");
        if (optJSONObject14 != null) {
            b2.a(c(optJSONObject14));
        } else {
            b2.a(adSlot);
        }
        if (adSlot != null) {
            Map<String, Object> requestExtraMap = adSlot.getRequestExtraMap();
            if (requestExtraMap != null && requestExtraMap.containsKey("admob_watermark")) {
                optString = String.valueOf(requestExtraMap.get("admob_watermark"));
            }
            b2.l(jSONObject.optInt("intercept_flag", 0));
            b2.m(jSONObject.optString("phone_num"));
            b2.n(jSONObject.optString("title"));
            b2.o(jSONObject.optString("description"));
            b2.p(jSONObject.optString("button_text"));
            b2.j(jSONObject.optInt("ad_logo", 1));
            b2.s(jSONObject.optString("ext"));
            b2.p(jSONObject.optInt("cover_click_area", 0));
            b2.s(jSONObject.optInt("image_mode"));
            b2.u(jSONObject.optInt(AdUnitActivity.EXTRA_ORIENTATION, 1));
            b2.a((float) jSONObject.optDouble("aspect_ratio", 100.0d));
            b2.p(jSONObject.optInt("cover_click_area", 0));
            JSONObject optJSONObject15 = jSONObject.optJSONObject(MBridgeConstans.DYNAMIC_VIEW_WX_APP);
            JSONObject optJSONObject16 = jSONObject.optJSONObject(CampaignEx.JSON_KEY_DEEP_LINK_URL);
            b2.a(e(optJSONObject15));
            b2.a(f(jSONObject.optJSONObject("interaction_method_params")));
            b2.a(h(optJSONObject16));
            b2.a(new com.bytedance.sdk.openadsdk.core.model.t(jSONObject));
            optJSONArray = jSONObject.optJSONArray("filter_words");
            if (optJSONArray != null) {
                for (int i7 = 0; i7 < optJSONArray.length(); i7++) {
                    FilterWord d = d(optJSONArray.optJSONObject(i7));
                    if (d != null && d.isValid()) {
                        b2.a(d);
                    }
                }
            }
            b2.t(jSONObject.optInt("count_down"));
            b2.b(jSONObject.optLong("expiration_time"));
            b2.G(jSONObject.optInt("video_encode_type", 0));
            b2.F(0);
            optJSONObject = jSONObject.optJSONObject("video");
            if (optJSONObject == null) {
                bVar = a(optJSONObject, b2);
                b2.b(bVar);
            } else {
                bVar = null;
            }
            optJSONObject2 = jSONObject.optJSONObject("h265_video");
            if (optJSONObject2 == null) {
                bVar2 = a(optJSONObject2, b2);
                b2.c(bVar2);
            } else {
                bVar2 = null;
            }
            if (Build.VERSION.SDK_INT >= 26 || b2.aL() == 0) {
                b2.a(bVar);
                b2.G(0);
            } else {
                if (bVar2 != null && bVar != null) {
                    if (TextUtils.isEmpty(bVar2.l())) {
                        bVar2.d(bVar.l());
                    }
                    if (TextUtils.isEmpty(bVar2.m())) {
                        bVar2.e(bVar.m());
                    }
                    bVar2.d(bVar.d());
                }
                if (bVar2 != null) {
                    b2.a(bVar2);
                } else {
                    b2.a(bVar);
                }
            }
            optJSONObject3 = jSONObject.optJSONObject("download_conf");
            if (optJSONObject3 != null) {
                b2.a(g(optJSONObject3));
            }
            b2.a(i(jSONObject.optJSONObject("media_ext")));
            optJSONObject4 = jSONObject.optJSONObject("tpl_info");
            if (optJSONObject4 != null) {
                q.a aVar3 = new q.a();
                aVar3.b(optJSONObject4.optString("id"));
                aVar3.c(optJSONObject4.optString(AdvertisementDBAdapter.AdvertisementColumns.COLUMN_MD5));
                aVar3.d(optJSONObject4.optString("url"));
                aVar3.e(optJSONObject4.optString("data"));
                aVar3.f(optJSONObject4.optString("diff_data"));
                String optString2 = optJSONObject4.optString("dynamic_creative");
                aVar3.g(optString2);
                aVar3.a(optJSONObject4.optString("version"));
                aVar3.h(optJSONObject4.optString("media_view"));
                try {
                    ArrayList arrayList = new ArrayList();
                    JSONArray optJSONArray6 = PangleVideoBridge.jsonObjectInit(optString2).optJSONArray("tag_ids");
                    if (optJSONArray6 != null) {
                        for (int i8 = 0; i8 < optJSONArray6.length(); i8++) {
                            arrayList.add(Integer.valueOf(optJSONArray6.optInt(i8)));
                        }
                    }
                    aVar3.a(arrayList);
                } catch (JSONException e) {
                    com.bytedance.sdk.component.utils.l.e("AdInfoFactory", e.getMessage());
                }
                b2.a(aVar3);
            }
            b2.j(jSONObject.optString("creative_extra"));
            b2.e(jSONObject.optInt("if_block_lp", 0));
            b2.n(jSONObject.optInt("cache_sort", 1));
            b2.o(jSONObject.optInt("if_sp_cache", 0));
            optJSONObject5 = jSONObject.optJSONObject("splash_control");
            if (optJSONObject5 != null) {
                b2.a(b(optJSONObject5));
            }
            b2.w(jSONObject.optInt("is_package_open", 1));
            b2.h(jSONObject.optString("ad_info", null));
            i = 2;
            b2.q(jSONObject.optInt("ua_policy", 2));
            b2.x(jSONObject.optInt("playable_duration_time", 20));
            b2.y(jSONObject.optInt("playable_endcard_close_time", -1));
            b2.z(jSONObject.optInt("endcard_close_time", -1));
            b2.a(jSONObject.optInt("interaction_method"));
            b2.v(jSONObject.optString("dsp_html"));
            optJSONObject6 = jSONObject.optJSONObject("loading_page");
            if (optJSONObject6 != null) {
                b2.D(optJSONObject6.optInt("loading_landingpage_type", 0));
                JSONArray optJSONArray7 = optJSONObject6.optJSONArray("landingpage_text");
                if (optJSONArray7 != null) {
                    ArrayList arrayList2 = new ArrayList();
                    for (int i9 = 0; i9 < optJSONArray7.length(); i9++) {
                        String optString3 = optJSONArray7.optString(i9);
                        if (!TextUtils.isEmpty(optString3)) {
                            arrayList2.add(optString3);
                        }
                    }
                    b2.a((String[]) arrayList2.toArray(new String[arrayList2.size()]));
                }
            }
            optInt = jSONObject.optInt("dsp_material_type", 0);
            optInt = (optInt >= 0 || optInt > 3) ? 0 : 0;
            if (optInt == 0) {
                if (jSONObject.optBoolean("is_vast", false)) {
                    optInt = 1;
                }
            }
            i = optInt;
            b2.I(i);
            if (i != 1 || i == 3) {
                aT = b2.aT();
                if (aT < 0) {
                    aT = b2.D() != null ? b2.D().getDurationSlotType() : b2.aS();
                }
                String c = ab.c(aT);
                if (jSONObject.has("vast_json")) {
                    String optString4 = jSONObject.optString("dsp_vast");
                    if (TextUtils.isEmpty(optString4)) {
                        a(b2, c);
                        return null;
                    }
                    long currentTimeMillis = System.currentTimeMillis();
                    Pair<com.bytedance.sdk.openadsdk.core.g.a, b.a> a2 = a(optString4, b2.ak(), aT);
                    if (a2 != null) {
                        aVar2 = (b.a) a2.second;
                        aVar = (com.bytedance.sdk.openadsdk.core.g.a) a2.first;
                    } else {
                        aVar = null;
                        aVar2 = null;
                    }
                    a(b2, c, aVar, currentTimeMillis, aVar2);
                } else {
                    aVar = com.bytedance.sdk.openadsdk.core.g.a.a(jSONObject.optJSONObject("vast_json"));
                }
                if (aVar != null) {
                    aVar.f(c);
                }
                if (aVar != null) {
                    return null;
                }
                a(aVar, b2);
            }
            b2.w(jSONObject.optString("deep_link_appname", ""));
            b2.H(jSONObject.optInt("landing_page_download_clicktype", 1));
            JSONObject optJSONObject17 = jSONObject.optJSONObject("dsp_style");
            if (optJSONObject17 != null) {
                b2.a(new com.bytedance.sdk.openadsdk.core.model.l(optJSONObject17));
            }
            JSONObject optJSONObject18 = jSONObject.optJSONObject("dsp_adchoices");
            if (optJSONObject18 != null) {
                b2.e(optJSONObject18.optString("adchoices_icon", ""));
                b2.f(optJSONObject18.optString("adchoices_url", ""));
            }
            String optString5 = jSONObject.optString("gdid_encrypted");
            if (!TextUtils.isEmpty(optString5)) {
                b2.y(optString5);
            }
            int optInt2 = jSONObject.optInt("jump_probability", 0);
            if (optInt2 >= 0 && optInt2 <= 100) {
                i2 = optInt2;
            }
            b2.J(i2);
            b2.bt();
            return b2;
        }
        optString = jSONObject.optString("identificationOverlayContent");
        b2.z(optString);
        b2.l(jSONObject.optInt("intercept_flag", 0));
        b2.m(jSONObject.optString("phone_num"));
        b2.n(jSONObject.optString("title"));
        b2.o(jSONObject.optString("description"));
        b2.p(jSONObject.optString("button_text"));
        b2.j(jSONObject.optInt("ad_logo", 1));
        b2.s(jSONObject.optString("ext"));
        b2.p(jSONObject.optInt("cover_click_area", 0));
        b2.s(jSONObject.optInt("image_mode"));
        b2.u(jSONObject.optInt(AdUnitActivity.EXTRA_ORIENTATION, 1));
        b2.a((float) jSONObject.optDouble("aspect_ratio", 100.0d));
        b2.p(jSONObject.optInt("cover_click_area", 0));
        JSONObject optJSONObject152 = jSONObject.optJSONObject(MBridgeConstans.DYNAMIC_VIEW_WX_APP);
        JSONObject optJSONObject162 = jSONObject.optJSONObject(CampaignEx.JSON_KEY_DEEP_LINK_URL);
        b2.a(e(optJSONObject152));
        b2.a(f(jSONObject.optJSONObject("interaction_method_params")));
        b2.a(h(optJSONObject162));
        b2.a(new com.bytedance.sdk.openadsdk.core.model.t(jSONObject));
        optJSONArray = jSONObject.optJSONArray("filter_words");
        if (optJSONArray != null) {
        }
        b2.t(jSONObject.optInt("count_down"));
        b2.b(jSONObject.optLong("expiration_time"));
        b2.G(jSONObject.optInt("video_encode_type", 0));
        b2.F(0);
        optJSONObject = jSONObject.optJSONObject("video");
        if (optJSONObject == null) {
        }
        optJSONObject2 = jSONObject.optJSONObject("h265_video");
        if (optJSONObject2 == null) {
        }
        if (Build.VERSION.SDK_INT >= 26) {
        }
        b2.a(bVar);
        b2.G(0);
        optJSONObject3 = jSONObject.optJSONObject("download_conf");
        if (optJSONObject3 != null) {
        }
        b2.a(i(jSONObject.optJSONObject("media_ext")));
        optJSONObject4 = jSONObject.optJSONObject("tpl_info");
        if (optJSONObject4 != null) {
        }
        b2.j(jSONObject.optString("creative_extra"));
        b2.e(jSONObject.optInt("if_block_lp", 0));
        b2.n(jSONObject.optInt("cache_sort", 1));
        b2.o(jSONObject.optInt("if_sp_cache", 0));
        optJSONObject5 = jSONObject.optJSONObject("splash_control");
        if (optJSONObject5 != null) {
        }
        b2.w(jSONObject.optInt("is_package_open", 1));
        b2.h(jSONObject.optString("ad_info", null));
        i = 2;
        b2.q(jSONObject.optInt("ua_policy", 2));
        b2.x(jSONObject.optInt("playable_duration_time", 20));
        b2.y(jSONObject.optInt("playable_endcard_close_time", -1));
        b2.z(jSONObject.optInt("endcard_close_time", -1));
        b2.a(jSONObject.optInt("interaction_method"));
        b2.v(jSONObject.optString("dsp_html"));
        optJSONObject6 = jSONObject.optJSONObject("loading_page");
        if (optJSONObject6 != null) {
        }
        optInt = jSONObject.optInt("dsp_material_type", 0);
        if (optInt >= 0) {
        }
        if (optInt == 0) {
        }
        i = optInt;
        b2.I(i);
        if (i != 1) {
        }
        aT = b2.aT();
        if (aT < 0) {
        }
        String c2 = ab.c(aT);
        if (jSONObject.has("vast_json")) {
        }
        if (aVar != null) {
        }
        if (aVar != null) {
        }
    }

    private static boolean b(com.bytedance.sdk.openadsdk.core.model.q qVar) {
        return (qVar.at() || qVar.av()) ? false : true;
    }

    private static AdSlot c(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        String optString = jSONObject.optString("mCodeId", "");
        int optInt = jSONObject.optInt("mImgAcceptedWidth", 0);
        int optInt2 = jSONObject.optInt("mImgAcceptedHeight", 0);
        int optInt3 = jSONObject.optInt("mAdCount", 6);
        boolean optBoolean = jSONObject.optBoolean("mSupportDeepLink", true);
        String optString2 = jSONObject.optString("mRewardName", "");
        int optInt4 = jSONObject.optInt("mRewardAmount", 0);
        String optString3 = jSONObject.optString("mMediaExtra", "");
        String optString4 = jSONObject.optString("mUserID", "");
        jSONObject.optInt("mOrientation", 2);
        int optInt5 = jSONObject.optInt("mNativeAdType", 0);
        boolean optBoolean2 = jSONObject.optBoolean("mIsAutoPlay", false);
        boolean optBoolean3 = jSONObject.optBoolean("mIsExpressAd", false);
        String optString5 = jSONObject.optString("mBidAdm", "");
        return new AdSlot.Builder().setCodeId(optString).setImageAcceptedSize(optInt, optInt2).setExpressViewAcceptedSize((float) jSONObject.optDouble("mExpressViewAcceptedWidth", 0.0d), (float) jSONObject.optDouble("mExpressViewAcceptedHeight", 0.0d)).setAdCount(optInt3).setSupportDeepLink(optBoolean).setRewardName(optString2).setRewardAmount(optInt4).setMediaExtra(optString3).setUserID(optString4).setNativeAdType(optInt5).setIsAutoPlay(optBoolean2).isExpressAd(optBoolean3).withBid(optString5).setDurationSlotType(jSONObject.optInt("mDurationSlotType", 0)).build();
    }

    private static FilterWord d(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        try {
            FilterWord filterWord = new FilterWord();
            filterWord.setId(jSONObject.optString("id"));
            filterWord.setName(jSONObject.optString("name"));
            filterWord.setIsSelected(jSONObject.optBoolean("is_selected"));
            JSONArray optJSONArray = jSONObject.optJSONArray("options");
            if (optJSONArray != null && optJSONArray.length() > 0) {
                for (int i = 0; i < optJSONArray.length(); i++) {
                    FilterWord d = d(optJSONArray.optJSONObject(i));
                    if (d != null && d.isValid()) {
                        filterWord.addOption(d);
                    }
                }
            }
            return filterWord;
        } catch (Throwable unused) {
            return null;
        }
    }

    private static com.bytedance.sdk.openadsdk.core.model.c e(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.c cVar = new com.bytedance.sdk.openadsdk.core.model.c();
        cVar.b(jSONObject.optString("app_name"));
        cVar.c(jSONObject.optString(CampaignEx.JSON_KEY_PACKAGE_NAME));
        cVar.a(jSONObject.optString(DownloadModel.DOWNLOAD_URL));
        cVar.a(jSONObject.optDouble(FirebaseAnalytics.Param.SCORE, -1.0d));
        cVar.a(jSONObject.optInt("comment_num", -1));
        cVar.b(jSONObject.optInt(CampaignEx.JSON_KEY_APP_SIZE, 0));
        return cVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.p f(JSONObject jSONObject) {
        com.bytedance.sdk.openadsdk.core.model.p pVar = new com.bytedance.sdk.openadsdk.core.model.p();
        if (jSONObject == null) {
            pVar.a(10L);
            pVar.b(20L);
            pVar.a("");
            return pVar;
        }
        pVar.a(jSONObject.optLong("onlylp_loading_maxtime", 10L));
        pVar.b(jSONObject.optLong("straight_lp_showtime", 20L));
        pVar.a(jSONObject.optString("loading_text", ""));
        return pVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.k g(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.k kVar = new com.bytedance.sdk.openadsdk.core.model.k();
        kVar.a(jSONObject.optInt("if_send_click", 0));
        return kVar;
    }

    private static com.bytedance.sdk.openadsdk.core.model.j h(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        com.bytedance.sdk.openadsdk.core.model.j jVar = new com.bytedance.sdk.openadsdk.core.model.j();
        jVar.a(jSONObject.optString("deeplink_url"));
        jVar.b(jSONObject.optString(MessengerShareContentUtility.FALLBACK_URL));
        jVar.a(jSONObject.optInt("fallback_type"));
        return jVar;
    }

    private static Map<String, Object> i(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        HashMap hashMap = new HashMap();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            if (!TextUtils.isEmpty(next)) {
                hashMap.put(next, jSONObject.opt(next));
            }
        }
        return hashMap;
    }
}