package com.bytedance.sdk.openadsdk.core.settings;

import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public class ro {
    public boolean ai;
    public int ajl;
    public int dsz;
    public int duv;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    public int f7280ef;
    public int fhx;
    public String fm;
    public int gof;
    public int gqi;
    public boolean gzf;

    /* JADX INFO: renamed from: ha, reason: collision with root package name */
    public JSONObject f7281ha;
    public int hi;
    public int hlt;
    public int irt;
    public int jnr;
    public int ku;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    public int f7282lb;
    public List<String> lse;
    public int maa;
    public int mq;
    public int nt;
    public boolean ol;
    public int onz;
    public int qhl;
    public int ro;
    public boolean sds;
    public int vt;
    public int wbw;
    public int wey;
    public int wsy;
    public int wu;
    public int yz;

    public ro(JSONObject jSONObject) {
        this.ro = 1;
        this.f7282lb = 1;
        this.yz = 2;
        this.jnr = 1;
        this.ajl = 100;
        this.wsy = 0;
        this.wu = 2;
        this.f7280ef = 1;
        this.vt = 3;
        this.ku = 30;
        this.duv = 30;
        this.dsz = 1;
        this.onz = 1;
        this.fhx = 2;
        this.irt = 5000;
        this.qhl = 2;
        this.gof = 3500;
        this.gqi = 0;
        this.wey = 5;
        this.sds = false;
        this.maa = 0;
        this.hlt = 2;
        this.hi = 0;
        this.nt = 0;
        this.mq = 5;
        this.gzf = true;
        this.ai = false;
        this.ol = false;
        this.wbw = -1;
        new JSONObject();
        this.f7281ha = jSONObject;
        if (jSONObject == null) {
            return;
        }
        this.fm = jSONObject.optString("code_id");
        this.ro = jSONObject.optInt("auto_play", 1);
        this.wbw = jSONObject.optInt("endcard_close_time", -1);
        this.f7282lb = jSONObject.optInt("voice_control", 1);
        this.yz = jSONObject.optInt("rv_preload", 2);
        this.jnr = jSONObject.optInt("nv_preload", 1);
        this.ajl = Math.min(100, Math.max(0, jSONObject.optInt("proportion_watching", 100)));
        this.wsy = jSONObject.optInt("skip_time_displayed", 0);
        this.wu = jSONObject.optInt("video_skip_result", 2);
        this.f7280ef = jSONObject.optInt("reg_creative_control", 1);
        this.vt = jSONObject.optInt("play_bar_show_time", 3);
        int iOptInt = jSONObject.optInt("rv_skip_time", 30);
        this.ku = iOptInt;
        if (iOptInt < 0) {
            this.ku = 30;
        }
        this.dsz = jSONObject.optInt("voice_control", 1);
        this.onz = jSONObject.optInt("if_show_win", 1);
        this.fhx = jSONObject.optInt("sp_preload", 2);
        this.irt = jSONObject.optInt("stop_time", 5000);
        this.qhl = jSONObject.optInt("native_playable_delay", 2);
        this.gof = jSONObject.optInt("time_out_control", -1);
        this.gqi = jSONObject.optInt("playable_reward_type", 0);
        this.maa = jSONObject.optInt("reward_is_callback", 0);
        int iOptInt2 = jSONObject.optInt("iv_skip_time", 5);
        this.wey = iOptInt2;
        if (iOptInt2 < 0) {
            this.wey = 5;
        }
        fm(jSONObject.optJSONArray("parent_tpl_ids"));
        this.hlt = jSONObject.optInt("slot_type", 2);
        this.sds = jSONObject.optBoolean("close_on_click", false);
        this.hi = jSONObject.optInt("allow_system_back", 0);
        this.nt = jSONObject.optInt("splash_skip_time", 0);
        this.mq = jSONObject.optInt("splash_image_count_down_time", 5);
        this.ai = jSONObject.optBoolean("splash_count_down_time_off", false);
        this.ol = jSONObject.optBoolean("splash_close_on_click", false);
        this.gzf = jSONObject.optBoolean("allow_mediaview_click", true);
        if (!fm(this.f7282lb)) {
            this.f7282lb = 1;
        }
        if (!fm(this.dsz)) {
            this.dsz = 1;
        }
        this.duv = jSONObject.optInt("multi_rv_skip_time", 30);
    }

    private static boolean fm(int i10) {
        return i10 == 1 || i10 == 2;
    }

    public void fm(JSONArray jSONArray) {
        if (jSONArray == null || jSONArray.length() == 0) {
            return;
        }
        this.lse = new ArrayList();
        for (int i10 = 0; i10 < jSONArray.length(); i10++) {
            try {
                this.lse.add(jSONArray.get(i10).toString());
            } catch (Exception unused) {
                return;
            }
        }
    }

    public ro(String str, int i10) {
        this.ro = 1;
        this.f7282lb = 1;
        this.yz = 2;
        this.jnr = 1;
        this.ajl = 100;
        this.wsy = 0;
        this.wu = 2;
        this.f7280ef = 1;
        this.vt = 3;
        this.ku = 30;
        this.duv = 30;
        this.dsz = 1;
        this.onz = 1;
        this.fhx = 2;
        this.irt = 5000;
        this.qhl = 2;
        this.gof = 3500;
        this.gqi = 0;
        this.wey = 5;
        this.sds = false;
        this.maa = 0;
        this.hlt = 2;
        this.hi = 0;
        this.nt = 0;
        this.mq = 5;
        this.gzf = true;
        this.ai = false;
        this.ol = false;
        this.wbw = -1;
        this.f7281ha = new JSONObject();
        this.fm = str;
        this.f7282lb = i10;
    }
}
