package l6;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import z5.w;

/* loaded from: classes.dex */
public class i implements Parcelable {

    /* renamed from: p, reason: collision with root package name */
    private b f27505p;

    /* renamed from: q, reason: collision with root package name */
    private static final z5.d[] f27504q = z5.d.values();
    public static final Parcelable.Creator<i> CREATOR = new a();

    /* loaded from: classes.dex */
    class a implements Parcelable.Creator {
        a() {
        }

        @Override // android.os.Parcelable.Creator
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public i createFromParcel(Parcel parcel) {
            return new i(parcel);
        }

        @Override // android.os.Parcelable.Creator
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public i[] newArray(int i10) {
            return new i[i10];
        }
    }

    /* loaded from: classes.dex */
    public static class b {

        /* renamed from: a, reason: collision with root package name */
        private final String f27506a;

        /* renamed from: b, reason: collision with root package name */
        private final z5.d f27507b;

        /* renamed from: c, reason: collision with root package name */
        private final List f27508c;

        /* renamed from: d, reason: collision with root package name */
        private List f27509d;

        public b(String str, z5.d dVar, List list, List list2) {
            this.f27506a = str;
            this.f27507b = dVar;
            this.f27508c = list;
            this.f27509d = list2;
        }

        private static List e(a6.i iVar, List list) {
            if (list == null) {
                return null;
            }
            ArrayList arrayList = new ArrayList(list.size());
            Iterator it = list.iterator();
            while (it.hasNext()) {
                b bVar = (b) it.next();
                arrayList.add(new a6.g(iVar, bVar.b(), bVar.a(), bVar.d(), e(iVar, bVar.c())));
            }
            return arrayList;
        }

        public z5.d a() {
            return this.f27507b;
        }

        public String b() {
            return this.f27506a;
        }

        public List c() {
            return this.f27509d;
        }

        public List d() {
            return this.f27508c;
        }

        public a6.g f(a6.i iVar) {
            return new a6.g(iVar, b(), a(), d(), e(iVar, c()));
        }
    }

    public i(b bVar) {
        this.f27505p = bVar;
    }

    public b a() {
        return this.f27505p;
    }

    public a6.g b(a6.i iVar) {
        return this.f27505p.f(iVar);
    }

    @Override // android.os.Parcelable
    public int describeContents() {
        return 0;
    }

    @Override // android.os.Parcelable
    public void writeToParcel(Parcel parcel, int i10) {
        String b10 = this.f27505p.b();
        boolean z10 = !TextUtils.isEmpty(b10);
        l6.b.b(parcel, z10);
        if (z10) {
            parcel.writeString(b10);
        }
        parcel.writeInt(this.f27505p.a().ordinal());
        List d10 = this.f27505p.d();
        parcel.writeInt(d10.size());
        if (!d10.isEmpty()) {
            for (int i11 = 0; i11 < d10.size(); i11++) {
                parcel.writeParcelable(new m((w) d10.get(i11)), i10);
            }
        }
        List c10 = this.f27505p.c();
        boolean z11 = (c10 == null || c10.isEmpty()) ? false : true;
        l6.b.b(parcel, z11);
        if (z11) {
            parcel.writeInt(c10.size());
            for (int i12 = 0; i12 < c10.size(); i12++) {
                parcel.writeParcelable(new i((b) c10.get(i12)), i10);
            }
        }
    }

    protected i(Parcel parcel) {
        ArrayList arrayList = null;
        String readString = l6.b.a(parcel) ? parcel.readString() : null;
        z5.d dVar = f27504q[parcel.readInt()];
        int readInt = parcel.readInt();
        ArrayList arrayList2 = new ArrayList(readInt);
        ClassLoader classLoader = getClass().getClassLoader();
        for (int i10 = 0; i10 < readInt; i10++) {
            arrayList2.add((a6.j) ((m) parcel.readParcelable(classLoader)).a());
        }
        if (l6.b.a(parcel)) {
            int readInt2 = parcel.readInt();
            ArrayList arrayList3 = new ArrayList(readInt2);
            for (int i11 = 0; i11 < readInt2; i11++) {
                arrayList3.add(((i) parcel.readParcelable(classLoader)).a());
            }
            arrayList = arrayList3;
        }
        this.f27505p = new b(readString, dVar, arrayList2, arrayList);
    }
}
