package g7;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.Spanned;
import com.google.android.gms.internal.ads.ad0;
import com.google.android.gms.internal.ads.co0;
import com.google.android.gms.internal.ads.dr0;
import com.google.android.gms.internal.ads.f8;
import com.google.android.gms.internal.ads.ih1;
import com.google.android.gms.internal.ads.l8;
import com.google.android.gms.internal.ads.nj2;
import com.google.android.gms.internal.ads.oj2;
import com.google.android.gms.internal.ads.p01;
import com.google.android.gms.internal.ads.u3;
import com.google.android.gms.internal.ads.vd0;
import com.google.android.gms.internal.ads.zzguf;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Iterator;

/* JADX INFO: loaded from: classes2.dex */
public final class h implements co0, dr0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f26297a = 2;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f26300d;

    public /* synthetic */ h(int i10, long j10, nj2 nj2Var) {
        this.f26300d = nj2Var;
        this.f26299c = i10;
        this.f26298b = j10;
    }

    @Override // com.google.android.gms.internal.ads.co0
    /* JADX INFO: renamed from: zza */
    public final void mo2zza(Object obj) {
        int i10 = this.f26297a;
        int i11 = this.f26299c;
        switch (i10) {
            case 1:
                l8 l8Var = (l8) this.f26300d;
                f8 f8Var = (f8) obj;
                l8Var.f13530g.getClass();
                zzguf zzgufVar = f8Var.f11093a;
                ArrayList<? extends Parcelable> arrayList = new ArrayList<>(zzgufVar.size());
                Iterator<E> it = zzgufVar.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        Bundle bundle = new Bundle();
                        bundle.putParcelableArrayList("c", arrayList);
                        bundle.putLong("d", f8Var.f11095c);
                        Parcel parcelObtain = Parcel.obtain();
                        parcelObtain.writeBundle(bundle);
                        byte[] bArrMarshall = parcelObtain.marshall();
                        parcelObtain.recycle();
                        int length = bArrMarshall.length;
                        p01 p01Var = l8Var.f13526c;
                        p01Var.w(length, bArrMarshall);
                        u3 u3Var = l8Var.f13524a;
                        u3Var.a(p01Var, length);
                        long j10 = f8Var.f11094b;
                        long j11 = this.f26298b;
                        if (j10 == -9223372036854775807L) {
                            ih1.b1(l8Var.f13530g.f19337j == Long.MAX_VALUE);
                        } else {
                            long j12 = l8Var.f13530g.f19337j;
                            j11 = j12 == Long.MAX_VALUE ? j11 + j10 : j10 + j12;
                        }
                        u3Var.zze(j11, i11 | 1, length, 0, null);
                    } else {
                        ad0 ad0Var = (ad0) it.next();
                        ad0Var.getClass();
                        Bundle bundle2 = new Bundle();
                        CharSequence charSequence = ad0Var.zza;
                        if (charSequence != null) {
                            bundle2.putCharSequence(ad0.f8642m, charSequence);
                            if (charSequence instanceof Spanned) {
                                ArrayList<? extends Parcelable> arrayListA = vd0.a((Spanned) charSequence);
                                if (!arrayListA.isEmpty()) {
                                    bundle2.putParcelableArrayList(ad0.f8643n, arrayListA);
                                }
                            }
                        }
                        bundle2.putSerializable(ad0.f8644o, ad0Var.zzb);
                        bundle2.putSerializable(ad0.f8645p, ad0Var.zzc);
                        bundle2.putFloat(ad0.f8647r, ad0Var.f8656a);
                        bundle2.putInt(ad0.f8648s, ad0Var.f8657b);
                        bundle2.putInt(ad0.f8649t, ad0Var.f8658c);
                        bundle2.putFloat(ad0.f8650u, ad0Var.f8659d);
                        bundle2.putInt(ad0.f8651v, ad0Var.f8660e);
                        bundle2.putInt(ad0.f8652w, ad0Var.f8663h);
                        bundle2.putFloat(ad0.f8653x, ad0Var.f8664i);
                        bundle2.putFloat(ad0.f8654y, ad0Var.f8661f);
                        bundle2.putFloat(ad0.f8655z, ad0Var.f8662g);
                        bundle2.putBoolean(ad0.B, false);
                        bundle2.putInt(ad0.A, -16777216);
                        bundle2.putInt(ad0.C, ad0Var.f8665j);
                        bundle2.putFloat(ad0.D, ad0Var.f8666k);
                        bundle2.putInt(ad0.E, ad0Var.f8667l);
                        Bitmap bitmap = ad0Var.zzd;
                        if (bitmap != null) {
                            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                            ih1.b1(bitmap.compress(Bitmap.CompressFormat.PNG, 0, byteArrayOutputStream));
                            bundle2.putByteArray(ad0.f8646q, byteArrayOutputStream.toByteArray());
                        }
                        arrayList.add(bundle2);
                    }
                    break;
                }
                break;
            default:
                ((oj2) obj).d(i11);
                break;
        }
    }

    public /* synthetic */ h(l8 l8Var, long j10, int i10) {
        this.f26300d = l8Var;
        this.f26298b = j10;
        this.f26299c = i10;
    }
}
