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

import android.text.TextUtils;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public class hi {
    private int ajl;
    private int dsz;
    private JSONObject duv;

    /* JADX INFO: renamed from: ef, reason: collision with root package name */
    private String f7172ef;
    private int fm;
    private ha gof;
    private ro gqi;
    private int jnr;
    private boolean ku;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private int f7173lb;
    private int onz;
    private JSONObject wsy;
    private int yz;
    private int ro = 10;
    private int wu = 1;
    private fm vt = new fm();
    private int fhx = 1;
    private String irt = "Next Ad";
    private String qhl = "Next ad in %1$ds";

    public static class fm {
        private int fm;
        private int jnr;

        /* JADX INFO: renamed from: lb, reason: collision with root package name */
        private int f7174lb;
        private int ro;
        private int yz;

        public int fm() {
            return this.yz;
        }

        public int jnr() {
            return this.jnr;
        }

        public int lb() {
            return this.fm;
        }

        public int ro() {
            return this.f7174lb;
        }

        public int yz() {
            return this.ro;
        }

        public static fm fm(JSONObject jSONObject) {
            fm fmVar = new fm();
            if (jSONObject == null) {
                return fmVar;
            }
            fmVar.fm = Math.max(0, jSONObject.optInt("padding_left", 0));
            fmVar.ro = Math.max(0, jSONObject.optInt("padding_right", 0));
            fmVar.f7174lb = Math.max(0, jSONObject.optInt("padding_top", 0));
            fmVar.yz = Math.max(0, jSONObject.optInt("padding_bottom", 0));
            fmVar.jnr = Math.max(0, jSONObject.optInt("card_spacing", 0));
            return fmVar;
        }
    }

    public static class ro {
        private int fm;
        private float jnr;

        /* JADX INFO: renamed from: lb, reason: collision with root package name */
        private String f7175lb;
        private String ro;
        private float yz;

        public int fm() {
            return this.fm;
        }

        public float jnr() {
            return this.jnr;
        }

        public String lb() {
            return this.f7175lb;
        }

        public String ro() {
            return this.ro;
        }

        public float yz() {
            return this.yz;
        }

        public static ro fm(JSONObject jSONObject) {
            ro roVar = new ro();
            if (jSONObject == null) {
                return roVar;
            }
            roVar.fm = jSONObject.optInt("progress_type", 0);
            roVar.ro = jSONObject.optString("progress_color");
            roVar.f7175lb = jSONObject.optString("progress_background_color");
            roVar.yz = jSONObject.optInt("progress_size", 0);
            roVar.jnr = jSONObject.optInt("bar_radius", 0);
            return roVar;
        }
    }

    public fm ajl() {
        return this.vt;
    }

    public boolean dsz() {
        return this.ku;
    }

    public JSONObject duv() {
        return this.duv;
    }

    public int ef() {
        return this.ajl;
    }

    public boolean fhx() {
        return this.fm == 1;
    }

    public boolean fm() {
        return this.fhx == 1;
    }

    public int irt() {
        return this.ro;
    }

    public int jnr() {
        return this.onz;
    }

    public boolean ku() {
        return this.yz == 1;
    }

    public JSONObject lb() {
        ha haVar = this.gof;
        if (haVar == null) {
            return null;
        }
        return haVar.jnr();
    }

    public boolean onz() {
        return this.f7173lb == 1;
    }

    public ro qhl() {
        return this.gqi;
    }

    public JSONObject ro() {
        ha haVar = this.gof;
        if (haVar == null) {
            return null;
        }
        try {
            String strYz = haVar.yz();
            if (!TextUtils.isEmpty(strYz)) {
                return new JSONObject(strYz);
            }
            String strFm = com.bytedance.sdk.openadsdk.core.dsz.fm.ro.fm().fm("guide", this.gof.fm(), this.gof.ro());
            if (TextUtils.isEmpty(strFm)) {
                return null;
            }
            return new JSONObject(strFm);
        } catch (JSONException unused) {
            return null;
        }
    }

    public boolean vt() {
        return this.jnr == 1;
    }

    public String wsy() {
        return this.f7172ef;
    }

    public int wu() {
        return this.wu;
    }

    public int yz() {
        return this.dsz;
    }

    public static hi fm(String str) {
        hi hiVar = new hi();
        if (str == null) {
            return hiVar;
        }
        try {
            JSONObject jSONObject = new JSONObject(str);
            hiVar.fm = jSONObject.optInt("auto_switch");
            hiVar.ro = jSONObject.optInt("playable_preload_count");
            hiVar.f7173lb = jSONObject.optInt("disable_on_interaction");
            hiVar.yz = jSONObject.optInt("ceiling_type");
            hiVar.jnr = jSONObject.optInt("can_loop");
            hiVar.ajl = jSONObject.optInt("multi_skip_time", -1);
            hiVar.wu = jSONObject.optInt("load_more_strategy");
            hiVar.fhx = jSONObject.optInt("report_show_by_percent", 1);
            JSONObject jSONObjectOptJSONObject = jSONObject.optJSONObject("gesture_tpl_info");
            hiVar.wsy = jSONObjectOptJSONObject;
            if (jSONObjectOptJSONObject != null) {
                ha haVarFm = ha.fm(jSONObjectOptJSONObject);
                hiVar.gof = haVarFm;
                if (haVarFm != null && !TextUtils.isEmpty(haVarFm.lb())) {
                    com.bytedance.sdk.openadsdk.core.dsz.fm.ro.fm().fm(new com.bytedance.sdk.openadsdk.core.dsz.wu.fm().fm(hiVar.gof.fm()).ro(hiVar.gof.ro()).lb(hiVar.gof.lb()).yz(hiVar.gof.yz()), "guide");
                }
                int iOptInt = hiVar.wsy.optInt("delay_show_time", 5);
                hiVar.dsz = iOptInt;
                if (iOptInt < 0) {
                    hiVar.dsz = 5;
                }
                int iOptInt2 = hiVar.wsy.optInt("dismiss_after_idle_time", 3);
                hiVar.onz = iOptInt2;
                if (iOptInt2 <= 0) {
                    hiVar.onz = 3;
                }
            }
            hiVar.f7172ef = jSONObject.optString("agg_endcard_url");
            hiVar.ku = jSONObject.optBoolean("has_more");
            hiVar.duv = jSONObject.optJSONObject("session_params");
            hiVar.vt = fm.fm(jSONObject.optJSONObject("layout_config"));
            hiVar.gqi = ro.fm(jSONObject.optJSONObject("progress_config"));
        } catch (JSONException unused) {
        }
        return hiVar;
    }
}
