package com.bytedance.adsdk.ro.jnr;

import android.graphics.Rect;
import android.util.JsonReader;
import android.util.LongSparseArray;
import android.util.SparseArray;
import androidx.media3.exoplayer.upstream.CmcdConfiguration;
import androidx.media3.exoplayer.upstream.CmcdData;
import com.bytedance.adsdk.ro.lb.lb.jnr;
import com.bytedance.adsdk.ro.vt;
import com.bytedance.adsdk.ro.wsy;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
import xyz.stream.download.config.InnerConstant;

/* JADX INFO: loaded from: classes.dex */
public class lse {
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    public static com.bytedance.adsdk.ro.wsy fm(JsonReader jsonReader) throws IOException {
        int i10;
        byte b10;
        float fFm = com.bytedance.adsdk.ro.ajl.ajl.fm();
        LongSparseArray<com.bytedance.adsdk.ro.lb.lb.jnr> longSparseArray = new LongSparseArray<>();
        ArrayList arrayList = new ArrayList();
        HashMap map = new HashMap();
        HashMap map2 = new HashMap();
        HashMap map3 = new HashMap();
        ArrayList arrayList2 = new ArrayList();
        SparseArray<com.bytedance.adsdk.ro.lb.yz> sparseArray = new SparseArray<>();
        wsy.lb lbVar = new wsy.lb();
        wsy.fm fmVar = new wsy.fm();
        wsy.ro roVar = new wsy.ro();
        com.bytedance.adsdk.ro.wsy wsyVar = new com.bytedance.adsdk.ro.wsy();
        jsonReader.beginObject();
        float fNextDouble = 0.0f;
        float fNextDouble2 = 0.0f;
        float fNextDouble3 = 0.0f;
        String strNextString = null;
        int iNextInt = 0;
        int iNextInt2 = 0;
        while (jsonReader.hasNext()) {
            String strNextName = jsonReader.nextName();
            strNextName.getClass();
            byte b11 = -1;
            switch (strNextName.hashCode()) {
                case -1408207997:
                    i10 = iNextInt2;
                    if (strNextName.equals("assets")) {
                        b11 = 0;
                    }
                    break;
                case -1109732030:
                    i10 = iNextInt2;
                    if (strNextName.equals("layers")) {
                        b11 = 1;
                    }
                    break;
                case -865448777:
                    i10 = iNextInt2;
                    if (strNextName.equals("globalEvent")) {
                        b11 = 2;
                    }
                    break;
                case 104:
                    i10 = iNextInt2;
                    if (strNextName.equals(CmcdData.STREAMING_FORMAT_HLS)) {
                        b10 = 3;
                        b11 = b10;
                    }
                    break;
                case 118:
                    i10 = iNextInt2;
                    if (strNextName.equals("v")) {
                        b10 = 4;
                        b11 = b10;
                    }
                    break;
                case 119:
                    i10 = iNextInt2;
                    if (strNextName.equals("w")) {
                        b10 = 5;
                        b11 = b10;
                    }
                    break;
                case 3208:
                    i10 = iNextInt2;
                    if (strNextName.equals(CmcdConfiguration.KEY_DEADLINE)) {
                        b10 = 6;
                        b11 = b10;
                    }
                    break;
                case 3276:
                    i10 = iNextInt2;
                    if (strNextName.equals("fr")) {
                        b10 = 7;
                        b11 = b10;
                    }
                    break;
                case 3292:
                    i10 = iNextInt2;
                    if (strNextName.equals("gc")) {
                        b10 = 8;
                        b11 = b10;
                    }
                    break;
                case 3367:
                    i10 = iNextInt2;
                    if (strNextName.equals(IjkMediaPlayer.OnNativeInvokeListener.ARG_IP)) {
                        b10 = 9;
                        b11 = b10;
                    }
                    break;
                case 3553:
                    i10 = iNextInt2;
                    if (strNextName.equals("op")) {
                        b10 = 10;
                        b11 = b10;
                    }
                    break;
                case 94623709:
                    i10 = iNextInt2;
                    if (strNextName.equals("chars")) {
                        b10 = 11;
                        b11 = b10;
                    }
                    break;
                case 97615364:
                    i10 = iNextInt2;
                    if (strNextName.equals("fonts")) {
                        b10 = 12;
                        b11 = b10;
                    }
                    break;
                case 110364485:
                    i10 = iNextInt2;
                    if (strNextName.equals("timer")) {
                        b10 = 13;
                        b11 = b10;
                    }
                    break;
                case 839250809:
                    i10 = iNextInt2;
                    if (strNextName.equals("markers")) {
                        b10 = 14;
                        b11 = b10;
                    }
                    break;
                default:
                    i10 = iNextInt2;
                    break;
            }
            switch (b11) {
                case 0:
                    fm(jsonReader, wsyVar, map, map2);
                    break;
                case 1:
                    fm(jsonReader, wsyVar, arrayList, longSparseArray);
                    break;
                case 2:
                    fm(jsonReader, roVar);
                    break;
                case 3:
                    iNextInt2 = jsonReader.nextInt();
                    continue;
                case 4:
                    String[] strArrSplit = jsonReader.nextString().split("\\.");
                    if (!com.bytedance.adsdk.ro.ajl.ajl.fm(Integer.parseInt(strArrSplit[0]), Integer.parseInt(strArrSplit[1]), Integer.parseInt(strArrSplit[2]), 4, 4, 0)) {
                        wsyVar.fm("Lottie only supports bodymovin >= 4.4.0");
                    }
                    break;
                case 5:
                    iNextInt = jsonReader.nextInt();
                    break;
                case 6:
                    strNextString = jsonReader.nextString();
                    break;
                case 7:
                    fNextDouble3 = (float) jsonReader.nextDouble();
                    break;
                case 8:
                    fm(jsonReader, fmVar);
                    break;
                case 9:
                    fNextDouble = (float) jsonReader.nextDouble();
                    break;
                case 10:
                    fNextDouble2 = ((float) jsonReader.nextDouble()) - 0.01f;
                    break;
                case 11:
                    fm(jsonReader, wsyVar, sparseArray);
                    break;
                case 12:
                    fm(jsonReader, map3);
                    break;
                case 13:
                    fm(jsonReader, lbVar);
                    break;
                case 14:
                    fm(jsonReader, arrayList2);
                    break;
                default:
                    jsonReader.skipValue();
                    break;
            }
            iNextInt2 = i10;
        }
        jsonReader.endObject();
        wsyVar.fm(new Rect(0, 0, (int) (iNextInt * fFm), (int) (iNextInt2 * fFm)), fNextDouble, fNextDouble2, fNextDouble3, arrayList, longSparseArray, map, map2, sparseArray, map3, arrayList2, lbVar, strNextString, fmVar, roVar);
        return wsyVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0046  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static JSONArray lb(JsonReader jsonReader) {
        byte b10;
        JSONArray jSONArray = new JSONArray();
        try {
            jsonReader.beginArray();
            while (jsonReader.hasNext()) {
                JSONObject jSONObject = new JSONObject();
                jSONArray.put(jSONObject);
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String strNextName = jsonReader.nextName();
                    int iHashCode = strNextName.hashCode();
                    if (iHashCode != 3324) {
                        b10 = (iHashCode == 116753 && strNextName.equals("vid")) ? (byte) 0 : (byte) -1;
                    } else if (strNextName.equals("hd")) {
                        b10 = 1;
                    }
                    if (b10 == 0) {
                        jSONObject.put("vid", jsonReader.nextString());
                    } else if (b10 != 1) {
                        jsonReader.skipValue();
                    } else {
                        try {
                            jSONObject.put("hd", jsonReader.nextInt());
                        } catch (JSONException unused) {
                        }
                    }
                }
                jsonReader.endObject();
            }
            jsonReader.endArray();
        } catch (Exception unused2) {
        }
        return jSONArray;
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x003f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static void ro(JsonReader jsonReader, wsy.fm fmVar) {
        byte b10;
        try {
            jsonReader.beginObject();
            while (jsonReader.hasNext()) {
                String strNextName = jsonReader.nextName();
                int iHashCode = strNextName.hashCode();
                if (iHashCode != 3239) {
                    if (iHashCode != 3276) {
                        b10 = (iHashCode == 107027 && strNextName.equals("lel")) ? (byte) 2 : (byte) -1;
                    } else if (strNextName.equals("fr")) {
                        b10 = 0;
                    }
                } else if (strNextName.equals("el")) {
                    b10 = 1;
                }
                if (b10 == 0) {
                    fmVar.jnr = jsonReader.nextInt();
                } else if (b10 == 1) {
                    fmVar.ajl = jsonReader.nextString();
                } else if (b10 != 2) {
                    jsonReader.skipValue();
                } else {
                    fmVar.wsy = lb(jsonReader);
                }
            }
            jsonReader.endObject();
        } catch (IOException unused) {
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:44:0x0085  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static List<vt.fm> yz(JsonReader jsonReader) {
        byte b10;
        try {
            ArrayList arrayList = new ArrayList();
            while (jsonReader.hasNext()) {
                vt.fm fmVar = new vt.fm();
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String strNextName = jsonReader.nextName();
                    int iHashCode = strNextName.hashCode();
                    if (iHashCode != 99) {
                        if (iHashCode != 102) {
                            if (iHashCode != 108) {
                                if (iHashCode != 115) {
                                    if (iHashCode != 3153) {
                                        if (iHashCode != 3449) {
                                            b10 = (iHashCode == 96670 && strNextName.equals("ali")) ? (byte) 6 : (byte) -1;
                                        } else if (strNextName.equals("le")) {
                                            b10 = 1;
                                        }
                                    } else if (strNextName.equals(CmcdConfiguration.KEY_BUFFER_STARVATION)) {
                                        b10 = 5;
                                    }
                                } else if (strNextName.equals(CmcdData.STREAMING_FORMAT_SS)) {
                                    b10 = 2;
                                }
                            } else if (strNextName.equals(CmcdData.STREAM_TYPE_LIVE)) {
                                b10 = 0;
                            }
                        } else if (strNextName.equals("f")) {
                            b10 = 4;
                        }
                    } else if (strNextName.equals("c")) {
                        b10 = 3;
                    }
                    switch (b10) {
                        case 0:
                            fmVar.fm = jsonReader.nextInt();
                            break;
                        case 1:
                            fmVar.ro = jsonReader.nextInt();
                            break;
                        case 2:
                            fmVar.jnr = jsonReader.nextInt();
                            break;
                        case 3:
                            fmVar.f6290lb = jsonReader.nextString();
                            break;
                        case 4:
                            fmVar.yz = jsonReader.nextString();
                            break;
                        case 5:
                            fmVar.ajl = jsonReader.nextInt();
                            break;
                        case 6:
                            fmVar.wsy = jsonReader.nextString();
                            break;
                        default:
                            jsonReader.skipValue();
                            break;
                    }
                }
                jsonReader.endObject();
                arrayList.add(fmVar);
            }
            return arrayList;
        } catch (Exception unused) {
            return null;
        }
    }

    private static Map<String, Object> ro(JsonReader jsonReader) throws IOException {
        HashMap map = new HashMap();
        jsonReader.beginObject();
        while (jsonReader.hasNext()) {
            String strNextName = jsonReader.nextName();
            strNextName.getClass();
            if (strNextName.equals("lel")) {
                map.put("lel", lb(jsonReader));
            } else if (!strNextName.equals("lottie_back")) {
                jsonReader.skipValue();
            } else {
                JSONObject jSONObject = new JSONObject();
                map.put("lottie_back", jSONObject);
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String strNextName2 = jsonReader.nextName();
                    strNextName2.getClass();
                    if (!strNextName2.equals("hd")) {
                        jsonReader.skipValue();
                    } else {
                        try {
                            jSONObject.putOpt("hd", Integer.valueOf(jsonReader.nextInt()));
                            jSONObject.putOpt("vid", "lottie_back");
                        } catch (JSONException unused) {
                        }
                    }
                }
                jsonReader.endObject();
            }
        }
        jsonReader.endObject();
        Object objRemove = map.remove("lottie_back");
        if (objRemove instanceof JSONObject) {
            Object obj = map.get("lel");
            if (obj instanceof JSONArray) {
                ((JSONArray) obj).put(objRemove);
            } else {
                JSONArray jSONArray = new JSONArray();
                jSONArray.put(objRemove);
                map.put("lel", jSONArray);
            }
        }
        return map;
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0042  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static void fm(JsonReader jsonReader, wsy.ro roVar) {
        byte b10;
        try {
            jsonReader.beginObject();
            while (jsonReader.hasNext()) {
                String strNextName = jsonReader.nextName();
                int iHashCode = strNextName.hashCode();
                if (iHashCode != 3239) {
                    if (iHashCode != 107027) {
                        b10 = (iHashCode == 3237004 && strNextName.equals("inel")) ? (byte) 0 : (byte) -1;
                    } else if (strNextName.equals("lel")) {
                        b10 = 2;
                    }
                } else if (strNextName.equals("el")) {
                    b10 = 1;
                }
                if (b10 == 0) {
                    roVar.ro = new int[][]{new int[]{-1, -1}};
                    jsonReader.beginArray();
                    if (jsonReader.hasNext()) {
                        jsonReader.beginArray();
                        for (int i10 = 0; i10 < 2; i10++) {
                            if (jsonReader.hasNext()) {
                                roVar.ro[0][i10] = jsonReader.nextInt();
                            }
                        }
                        jsonReader.endArray();
                    }
                    jsonReader.endArray();
                } else if (b10 == 1) {
                    roVar.fm = jsonReader.nextString();
                } else if (b10 != 2) {
                    jsonReader.skipValue();
                } else {
                    roVar.f6295lb = lb(jsonReader);
                }
            }
            jsonReader.endObject();
        } catch (Exception unused) {
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x005d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static void fm(JsonReader jsonReader, wsy.fm fmVar) {
        byte b10;
        try {
            jsonReader.beginObject();
            while (jsonReader.hasNext()) {
                String strNextName = jsonReader.nextName();
                int iHashCode = strNextName.hashCode();
                if (iHashCode != 3139) {
                    if (iHashCode != 3232) {
                        if (iHashCode != 3571) {
                            if (iHashCode != 3666) {
                                b10 = (iHashCode == 98713 && strNextName.equals("cpf")) ? (byte) 4 : (byte) -1;
                            } else if (strNextName.equals("se")) {
                                b10 = 0;
                            }
                        } else if (strNextName.equals("pc")) {
                            b10 = 3;
                        }
                    } else if (strNextName.equals("ee")) {
                        b10 = 2;
                    }
                } else if (strNextName.equals("be")) {
                    b10 = 1;
                }
                if (b10 == 0) {
                    fmVar.fm = jsonReader.nextInt();
                } else if (b10 == 1) {
                    fmVar.ro = ro(jsonReader);
                } else if (b10 == 2) {
                    fmVar.f6293lb = ro(jsonReader);
                } else if (b10 == 3) {
                    fmVar.yz = jsonReader.nextInt();
                } else if (b10 != 4) {
                    jsonReader.skipValue();
                } else {
                    ro(jsonReader, fmVar);
                }
            }
            jsonReader.endObject();
        } catch (Exception unused) {
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:41:0x0079  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private static void fm(JsonReader jsonReader, wsy.lb lbVar) {
        byte b10;
        try {
            jsonReader.beginObject();
            while (jsonReader.hasNext()) {
                String strNextName = jsonReader.nextName();
                int iHashCode = strNextName.hashCode();
                if (iHashCode != 3123) {
                    if (iHashCode != 3239) {
                        if (iHashCode != 3355) {
                            if (iHashCode != 3418) {
                                if (iHashCode != 3704) {
                                    if (iHashCode != 107027) {
                                        b10 = (iHashCode == 3237004 && strNextName.equals("inel")) ? (byte) 4 : (byte) -1;
                                    } else if (strNextName.equals("lel")) {
                                        b10 = 6;
                                    }
                                } else if (strNextName.equals("tl")) {
                                    b10 = 2;
                                }
                            } else if (strNextName.equals("ke")) {
                                b10 = 0;
                            }
                        } else if (strNextName.equals(InnerConstant.Db.f36069id)) {
                            b10 = 1;
                        }
                    } else if (strNextName.equals("el")) {
                        b10 = 5;
                    }
                } else if (strNextName.equals("at")) {
                    b10 = 3;
                }
                switch (b10) {
                    case 0:
                        lbVar.fm = jsonReader.nextInt();
                        break;
                    case 1:
                        lbVar.ro = jsonReader.nextString();
                        break;
                    case 2:
                        lbVar.f6294lb = jsonReader.nextString();
                        break;
                    case 3:
                        lbVar.yz = jsonReader.nextString();
                        break;
                    case 4:
                        lbVar.jnr = new int[]{-1, -1};
                        jsonReader.beginArray();
                        for (int i10 = 0; i10 < 2; i10++) {
                            if (jsonReader.hasNext()) {
                                lbVar.jnr[i10] = jsonReader.nextInt();
                            }
                        }
                        jsonReader.endArray();
                        break;
                    case 5:
                        lbVar.ajl = jsonReader.nextString();
                        break;
                    case 6:
                        lbVar.wsy = lb(jsonReader);
                        break;
                    default:
                        jsonReader.skipValue();
                        break;
                }
            }
            jsonReader.endObject();
        } catch (Exception unused) {
        }
    }

    private static void fm(JsonReader jsonReader, com.bytedance.adsdk.ro.wsy wsyVar, List<com.bytedance.adsdk.ro.lb.lb.jnr> list, LongSparseArray<com.bytedance.adsdk.ro.lb.lb.jnr> longSparseArray) throws IOException {
        jsonReader.beginArray();
        while (jsonReader.hasNext()) {
            com.bytedance.adsdk.ro.lb.lb.jnr jnrVarFm = maa.fm(jsonReader, wsyVar);
            jnrVarFm.ku();
            jnr.fm fmVar = jnr.fm.PRE_COMP;
            list.add(jnrVarFm);
            longSparseArray.put(jnrVarFm.jnr(), jnrVarFm);
        }
        jsonReader.endArray();
    }

    private static void fm(JsonReader jsonReader, com.bytedance.adsdk.ro.wsy wsyVar, Map<String, List<com.bytedance.adsdk.ro.lb.lb.jnr>> map, Map<String, com.bytedance.adsdk.ro.vt> map2) throws IOException {
        jsonReader.beginArray();
        while (jsonReader.hasNext()) {
            ArrayList arrayList = new ArrayList();
            LongSparseArray longSparseArray = new LongSparseArray();
            jsonReader.beginObject();
            String strNextString = null;
            String strNextString2 = null;
            String strNextString3 = null;
            String strNextString4 = null;
            List<vt.fm> listYz = null;
            String strNextString5 = null;
            int[][] iArr = null;
            JSONArray jSONArrayLb = null;
            int iNextInt = 0;
            int iNextInt2 = 0;
            while (jsonReader.hasNext()) {
                String strNextName = jsonReader.nextName();
                strNextName.getClass();
                switch (strNextName) {
                    case "layers":
                        jsonReader.beginArray();
                        while (jsonReader.hasNext()) {
                            com.bytedance.adsdk.ro.lb.lb.jnr jnrVarFm = maa.fm(jsonReader, wsyVar);
                            longSparseArray.put(jnrVarFm.jnr(), jnrVarFm);
                            arrayList.add(jnrVarFm);
                        }
                        jsonReader.endArray();
                        break;
                    case "h":
                        iNextInt2 = jsonReader.nextInt();
                        break;
                    case "p":
                        strNextString2 = jsonReader.nextString();
                        break;
                    case "u":
                        strNextString3 = jsonReader.nextString();
                        break;
                    case "w":
                        iNextInt = jsonReader.nextInt();
                        break;
                    case "el":
                        strNextString5 = jsonReader.nextString();
                        break;
                    case "id":
                        strNextString = jsonReader.nextString();
                        break;
                    case "tc":
                        jsonReader.beginArray();
                        listYz = yz(jsonReader);
                        jsonReader.endArray();
                        break;
                    case "lel":
                        jSONArrayLb = lb(jsonReader);
                        break;
                    case "rel":
                        strNextString4 = jsonReader.nextString();
                        break;
                    case "inel":
                        iArr = new int[][]{new int[]{-1, -1}};
                        jsonReader.beginArray();
                        if (jsonReader.hasNext()) {
                            jsonReader.beginArray();
                            for (int i10 = 0; i10 < 2; i10++) {
                                if (jsonReader.hasNext()) {
                                    iArr[0][i10] = jsonReader.nextInt();
                                }
                            }
                            jsonReader.endArray();
                        }
                        jsonReader.endArray();
                        break;
                    default:
                        jsonReader.skipValue();
                        break;
                }
            }
            jsonReader.endObject();
            if (strNextString2 != null) {
                com.bytedance.adsdk.ro.vt vtVar = new com.bytedance.adsdk.ro.vt(iNextInt, iNextInt2, strNextString, strNextString2, strNextString3, strNextString4, listYz, strNextString5, iArr, jSONArrayLb);
                map2.put(vtVar.wu(), vtVar);
            } else {
                map.put(strNextString, arrayList);
            }
        }
        jsonReader.endArray();
    }

    private static void fm(JsonReader jsonReader, Map<String, com.bytedance.adsdk.ro.lb.lb> map) throws IOException {
        jsonReader.beginObject();
        while (jsonReader.hasNext()) {
            String strNextName = jsonReader.nextName();
            strNextName.getClass();
            if (!strNextName.equals("list")) {
                jsonReader.skipValue();
            } else {
                jsonReader.beginArray();
                while (jsonReader.hasNext()) {
                    com.bytedance.adsdk.ro.lb.lb lbVarFm = onz.fm(jsonReader);
                    map.put(lbVarFm.ro(), lbVarFm);
                }
                jsonReader.endArray();
            }
        }
        jsonReader.endObject();
    }

    private static void fm(JsonReader jsonReader, com.bytedance.adsdk.ro.wsy wsyVar, SparseArray<com.bytedance.adsdk.ro.lb.yz> sparseArray) throws IOException {
        jsonReader.beginArray();
        while (jsonReader.hasNext()) {
            com.bytedance.adsdk.ro.lb.yz yzVarFm = dsz.fm(jsonReader, wsyVar);
            sparseArray.put(yzVarFm.hashCode(), yzVarFm);
        }
        jsonReader.endArray();
    }

    private static void fm(JsonReader jsonReader, List<com.bytedance.adsdk.ro.lb.ajl> list) throws IOException {
        jsonReader.beginArray();
        while (jsonReader.hasNext()) {
            jsonReader.beginObject();
            float fNextDouble = 0.0f;
            String strNextString = null;
            float fNextDouble2 = 0.0f;
            while (jsonReader.hasNext()) {
                String strNextName = jsonReader.nextName();
                strNextName.getClass();
                switch (strNextName) {
                    case "cm":
                        strNextString = jsonReader.nextString();
                        break;
                    case "dr":
                        fNextDouble2 = (float) jsonReader.nextDouble();
                        break;
                    case "tm":
                        fNextDouble = (float) jsonReader.nextDouble();
                        break;
                    default:
                        jsonReader.skipValue();
                        break;
                }
            }
            jsonReader.endObject();
            list.add(new com.bytedance.adsdk.ro.lb.ajl(strNextString, fNextDouble, fNextDouble2));
        }
        jsonReader.endArray();
    }
}
