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

import com.google.android.gms.internal.measurement.zzfo;
import com.google.android.gms.internal.measurement.zzfy;
import defpackage.ts;
import java.util.HashSet;
import java.util.Iterator;

/* JADX INFO: loaded from: classes2.dex */
final class zzx extends zzaa {
    private zzfo.zzb zzg;
    private final /* synthetic */ zzt zzh;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public zzx(zzt zztVar, String str, int i, zzfo.zzb zzbVar) {
        super(str, i);
        this.zzh = zztVar;
        this.zzg = zzbVar;
    }

    @Override // com.google.android.gms.measurement.internal.zzaa
    public final int zza() {
        return this.zzg.zzb();
    }

    @Override // com.google.android.gms.measurement.internal.zzaa
    public final boolean zzb() {
        return this.zzg.zzk();
    }

    @Override // com.google.android.gms.measurement.internal.zzaa
    public final boolean zzc() {
        return false;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:46:0x010a  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean zza(Long l, Long l2, zzfy.zzf zzfVar, long j, zzbb zzbbVar, boolean z) {
        Boolean boolZza;
        Object[] objArr = com.google.android.gms.internal.measurement.zzoe.zza() && this.zzh.zze().zzf(this.zza, zzbh.zzbp);
        long j2 = this.zzg.zzj() ? zzbbVar.zze : j;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        bool = null;
        Boolean bool = null;
        if (this.zzh.zzj().zza(2)) {
            this.zzh.zzj().zzp().zza("Evaluating filter. audience, filter, event", Integer.valueOf(this.zzb), this.zzg.zzl() ? Integer.valueOf(this.zzg.zzb()) : null, this.zzh.zzi().zza(this.zzg.zzf()));
            this.zzh.zzj().zzp().zza("Filter definition", this.zzh.g_().zza(this.zzg));
        }
        if (!this.zzg.zzl() || this.zzg.zzb() > 256) {
            this.zzh.zzj().zzu().zza("Invalid event filter ID. appId, id", zzgo.zza(this.zza), String.valueOf(this.zzg.zzl() ? Integer.valueOf(this.zzg.zzb()) : null));
            return false;
        }
        Object[] objArr2 = this.zzg.zzh() || this.zzg.zzi() || this.zzg.zzj();
        if (z && objArr2 != true) {
            this.zzh.zzj().zzp().zza("Event filter already evaluated true and it is not associated with an enhanced audience. audience ID, filter ID", Integer.valueOf(this.zzb), this.zzg.zzl() ? Integer.valueOf(this.zzg.zzb()) : null);
            return true;
        }
        zzfo.zzb zzbVar = this.zzg;
        String strZzg = zzfVar.zzg();
        if (!zzbVar.zzk()) {
            HashSet hashSet = new HashSet();
            Iterator<zzfo.zzc> it = zzbVar.zzg().iterator();
            while (true) {
                if (!it.hasNext()) {
                    ts tsVar = new ts(0);
                    Iterator<zzfy.zzh> it2 = zzfVar.zzh().iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            Iterator<zzfo.zzc> it3 = zzbVar.zzg().iterator();
                            while (true) {
                                if (!it3.hasNext()) {
                                    bool = Boolean.TRUE;
                                    break;
                                }
                                zzfo.zzc next = it3.next();
                                boolean z2 = next.zzg() && next.zzf();
                                String strZze = next.zze();
                                if (strZze.isEmpty()) {
                                    this.zzh.zzj().zzu().zza("Event has empty param name. event", this.zzh.zzi().zza(strZzg));
                                    break;
                                }
                                Object obj = tsVar.get(strZze);
                                if (obj instanceof Long) {
                                    if (!next.zzh()) {
                                        this.zzh.zzj().zzu().zza("No number filter for long param. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(strZze));
                                        break;
                                    }
                                    Boolean boolZza2 = zzaa.zza(((Long) obj).longValue(), next.zzc());
                                    if (boolZza2 == null) {
                                        break;
                                    }
                                    if (boolZza2.booleanValue() == z2) {
                                        bool = Boolean.FALSE;
                                        break;
                                    }
                                } else if (obj instanceof Double) {
                                    if (!next.zzh()) {
                                        this.zzh.zzj().zzu().zza("No number filter for double param. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(strZze));
                                        break;
                                    }
                                    Boolean boolZza3 = zzaa.zza(((Double) obj).doubleValue(), next.zzc());
                                    if (boolZza3 == null) {
                                        break;
                                    }
                                    if (boolZza3.booleanValue() == z2) {
                                        bool = Boolean.FALSE;
                                        break;
                                    }
                                } else if (obj instanceof String) {
                                    if (!next.zzj()) {
                                        if (!next.zzh()) {
                                            this.zzh.zzj().zzu().zza("No filter for String param. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(strZze));
                                            break;
                                        }
                                        String str = (String) obj;
                                        if (!zzoo.zzb(str)) {
                                            this.zzh.zzj().zzu().zza("Invalid param value for number filter. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(strZze));
                                            break;
                                        }
                                        boolZza = zzaa.zza(str, next.zzc());
                                    } else {
                                        boolZza = zzaa.zza((String) obj, next.zzd(), this.zzh.zzj());
                                    }
                                    if (boolZza == null) {
                                        break;
                                    }
                                    if (boolZza.booleanValue() == z2) {
                                        bool = Boolean.FALSE;
                                        break;
                                    }
                                } else if (obj == null) {
                                    this.zzh.zzj().zzp().zza("Missing param for filter. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(strZze));
                                    bool = Boolean.FALSE;
                                } else {
                                    this.zzh.zzj().zzu().zza("Unknown param type. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(strZze));
                                }
                            }
                        } else {
                            zzfy.zzh next2 = it2.next();
                            if (hashSet.contains(next2.zzg())) {
                                if (!next2.zzl()) {
                                    if (!next2.zzj()) {
                                        if (!next2.zzn()) {
                                            this.zzh.zzj().zzu().zza("Unknown value for param. event, param", this.zzh.zzi().zza(strZzg), this.zzh.zzi().zzb(next2.zzg()));
                                            break;
                                        }
                                        tsVar.put(next2.zzg(), next2.zzh());
                                    } else {
                                        tsVar.put(next2.zzg(), next2.zzj() ? Double.valueOf(next2.zza()) : null);
                                    }
                                } else {
                                    tsVar.put(next2.zzg(), next2.zzl() ? Long.valueOf(next2.zzd()) : null);
                                }
                            }
                        }
                    }
                } else {
                    zzfo.zzc next3 = it.next();
                    if (next3.zze().isEmpty()) {
                        this.zzh.zzj().zzu().zza("null or empty param name in filter. event", this.zzh.zzi().zza(strZzg));
                        break;
                    }
                    hashSet.add(next3.zze());
                }
            }
        } else {
            Boolean boolZza4 = zzaa.zza(j2, zzbVar.zze());
            if (boolZza4 != null) {
                if (!boolZza4.booleanValue()) {
                    bool = Boolean.FALSE;
                }
            }
        }
        this.zzh.zzj().zzp().zza("Event filter result", bool == null ? "null" : bool);
        if (bool == null) {
            return false;
        }
        Boolean bool2 = Boolean.TRUE;
        this.zzc = bool2;
        if (bool.booleanValue()) {
            this.zzd = bool2;
            if (objArr2 != false && zzfVar.zzk()) {
                Long lValueOf = Long.valueOf(zzfVar.zzd());
                if (this.zzg.zzi()) {
                    if (objArr == false || !this.zzg.zzk()) {
                        l = lValueOf;
                    }
                    this.zzf = l;
                    return true;
                }
                if (objArr != false && this.zzg.zzk()) {
                    lValueOf = l2;
                }
                this.zze = lValueOf;
            }
        }
        return true;
    }
}
