package com.google.android.gms.ads.nonagon.signalgeneration;

import android.net.Uri;
import android.os.Parcel;
import android.os.RemoteException;
import com.google.android.gms.internal.ads.ao;
import com.google.android.gms.internal.ads.re1;
import com.google.android.gms.internal.ads.wy;
import com.google.android.gms.internal.ads.yy;
import com.google.android.gms.internal.ads.zu1;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public final class e implements zu1 {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ yy f8017b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ boolean f8018c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ p f8019d;

    public e(p pVar, yy yyVar, boolean z10, int i10) {
        this.f8016a = i10;
        if (i10 != 1) {
            this.f8017b = yyVar;
            this.f8018c = z10;
            Objects.requireNonNull(pVar);
            this.f8019d = pVar;
            return;
        }
        this.f8017b = yyVar;
        this.f8018c = z10;
        Objects.requireNonNull(pVar);
        this.f8019d = pVar;
    }

    @Override // com.google.android.gms.internal.ads.zu1
    public final void zza(Throwable th) {
        int i10 = this.f8016a;
        yy yyVar = this.f8017b;
        switch (i10) {
            case 0:
                try {
                    String message = th.getMessage();
                    StringBuilder sb = new StringBuilder(String.valueOf(message).length() + 16);
                    sb.append("Internal error: ");
                    sb.append(message);
                    String string = sb.toString();
                    wy wyVar = (wy) yyVar;
                    Parcel parcelO = wyVar.O();
                    parcelO.writeString(string);
                    wyVar.O0(2, parcelO);
                } catch (RemoteException unused) {
                    return;
                }
                break;
            default:
                try {
                    String message2 = th.getMessage();
                    StringBuilder sb2 = new StringBuilder(String.valueOf(message2).length() + 16);
                    sb2.append("Internal error: ");
                    sb2.append(message2);
                    String string2 = sb2.toString();
                    wy wyVar2 = (wy) yyVar;
                    Parcel parcelO2 = wyVar2.O();
                    parcelO2.writeString(string2);
                    wyVar2.O0(2, parcelO2);
                } catch (RemoteException unused2) {
                    return;
                }
                break;
        }
    }

    @Override // com.google.android.gms.internal.ads.zu1
    /* JADX INFO: renamed from: zzb */
    public final void mo3zzb(Object obj) {
        ArrayList arrayList;
        ArrayList arrayList2;
        int i10 = this.f8016a;
        boolean z10 = this.f8018c;
        yy yyVar = this.f8017b;
        p pVar = this.f8019d;
        switch (i10) {
            case 0:
                ArrayList<Uri> arrayList3 = (ArrayList) obj;
                try {
                    wy wyVar = (wy) yyVar;
                    Parcel parcelO = wyVar.O();
                    parcelO.writeTypedList(arrayList3);
                    wyVar.O0(1, parcelO);
                    if (pVar.f8103m || z10) {
                        for (Uri uri : arrayList3) {
                            boolean zV2 = p.V2(uri, pVar.f8085b0, pVar.f8087c0);
                            re1 re1Var = pVar.f8102l;
                            if (zV2) {
                                re1Var.zzb(p.X2(uri, pVar.Y, "1").toString(), null, null, null);
                            } else {
                                if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8951l8)).booleanValue()) {
                                    re1Var.zzb(uri.toString(), null, null, null);
                                }
                            }
                            break;
                        }
                    }
                } catch (RemoteException unused) {
                    return;
                }
                break;
            default:
                List<Uri> list = (List) obj;
                try {
                    pVar.getClass();
                    Iterator it = list.iterator();
                    while (true) {
                        boolean zHasNext = it.hasNext();
                        arrayList = pVar.f8083a0;
                        arrayList2 = pVar.Z;
                        if (zHasNext) {
                            if (p.V2((Uri) it.next(), arrayList2, arrayList)) {
                                pVar.V.getAndIncrement();
                            }
                        }
                    }
                    wy wyVar2 = (wy) yyVar;
                    Parcel parcelO2 = wyVar2.O();
                    parcelO2.writeTypedList(list);
                    wyVar2.O0(1, parcelO2);
                    if (pVar.Q || z10) {
                        for (Uri uri2 : list) {
                            boolean zV22 = p.V2(uri2, arrayList2, arrayList);
                            re1 re1Var2 = pVar.f8102l;
                            if (zV22) {
                                re1Var2.zzb(p.X2(uri2, pVar.Y, "1").toString(), null, null, null);
                            } else {
                                if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8951l8)).booleanValue()) {
                                    re1Var2.zzb(uri2.toString(), null, null, null);
                                }
                            }
                            break;
                        }
                    }
                } catch (RemoteException unused2) {
                    return;
                }
                break;
        }
    }
}
