package com.google.android.gms.internal.ads;

import android.os.Bundle;
import android.util.JsonReader;
import androidx.annotation.Nullable;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public final class db1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final List f10363a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final za1 f10364b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final ArrayList f10365c;

    @Nullable
    public final Bundle zzd;

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v10 */
    /* JADX WARN: Type inference failed for: r0v4, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r0v5, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r0v7 */
    /* JADX WARN: Type inference failed for: r0v8, types: [java.util.ArrayList] */
    /* JADX WARN: Type inference failed for: r0v9 */
    public db1(JsonReader jsonReader, @Nullable Bundle bundle) throws IllegalStateException, JSONException, IOException, NumberFormatException, AssertionError {
        this.zzd = bundle;
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.B2)).booleanValue() && bundle != null) {
            com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.n(m7.n.C.f30472k, bundle, zzdxh.SERVER_RESPONSE_PARSE_START.a());
        }
        ?? EmptyList = Collections.emptyList();
        ArrayList arrayList = new ArrayList();
        jsonReader.beginObject();
        za1 za1Var = null;
        while (jsonReader.hasNext()) {
            String strNextName = jsonReader.nextName();
            if ("responses".equals(strNextName)) {
                jsonReader.beginArray();
                jsonReader.beginObject();
                while (jsonReader.hasNext()) {
                    String strNextName2 = jsonReader.nextName();
                    if ("ad_configs".equals(strNextName2)) {
                        EmptyList = new ArrayList();
                        jsonReader.beginArray();
                        while (jsonReader.hasNext()) {
                            EmptyList.add(new wa1(jsonReader));
                        }
                        jsonReader.endArray();
                    } else if (strNextName2.equals("common")) {
                        za1Var = new za1(jsonReader);
                        if (((Boolean) n7.y.f31093e.f31096c.b(ao.C2)).booleanValue() && bundle != null) {
                            bundle.putLong(zzdxh.NORMALIZATION_AD_RESPONSE_START.a(), za1Var.f19197r);
                            bundle.putLong(zzdxh.NORMALIZATION_AD_RESPONSE_END.a(), za1Var.f19198s);
                        }
                    } else {
                        jsonReader.skipValue();
                    }
                }
                jsonReader.endObject();
                jsonReader.endArray();
            } else if (strNextName.equals("actions")) {
                jsonReader.beginArray();
                while (jsonReader.hasNext()) {
                    jsonReader.beginObject();
                    String strNextString = null;
                    JSONObject jSONObjectB = null;
                    while (jsonReader.hasNext()) {
                        String strNextName3 = jsonReader.nextName();
                        if ("name".equals(strNextName3)) {
                            strNextString = jsonReader.nextString();
                        } else if ("info".equals(strNextName3)) {
                            jSONObjectB = p7.y.b(jsonReader);
                        } else {
                            jsonReader.skipValue();
                        }
                    }
                    if (strNextString != null) {
                        arrayList.add(new cb1(strNextString, jSONObjectB));
                    }
                    jsonReader.endObject();
                }
                jsonReader.endArray();
            }
        }
        this.f10365c = arrayList;
        this.f10363a = EmptyList;
        this.f10364b = za1Var == null ? new za1(new JsonReader(new StringReader("{}"))) : za1Var;
    }

    public static db1 zza(Reader reader, @Nullable Bundle bundle) throws zzfiv {
        try {
            try {
                return new db1(new JsonReader(reader), bundle);
            } finally {
                hb.a.d(reader);
            }
        } catch (IOException | AssertionError | IllegalStateException | NumberFormatException | JSONException e10) {
            throw new zzfiv("unable to parse ServerResponse", e10);
        }
    }
}
