package p138.p176.p177.p242.p265.p266;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Iterator;
import p037.p057.C1714;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p242.p258.p263.C4490;
import p138.p176.p177.p242.p258.p263.C4586;
import p138.p176.p177.p242.p258.p263.C4588;
import p138.p176.p177.p242.p258.p263.C4590;
import p138.p176.p177.p242.p258.p263.C4634;
import p138.p176.p177.p242.p258.p263.C4638;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.ʟ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4791 extends AbstractC4886 {

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public C4586 f14435;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final /* synthetic */ C4957 f14436;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C4791(C4957 c4957, String str, int i, C4586 c4586) {
        super(str, i);
        this.f14436 = c4957;
        this.f14435 = c4586;
    }

    @Override // p138.p176.p177.p242.p265.p266.AbstractC4886
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final int mo8030() {
        return this.f14435.zzd;
    }

    /* JADX WARN: Removed duplicated region for block: B:75:0x0180  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean m8031(Long l, Long l2, C4634 c4634, long j, C4909 c4909, boolean z) {
        Boolean boolM8215;
        Boolean boolM8213;
        String string;
        Boolean bool = false;
        boolean z2 = C4490.m7544() && this.f14436.f14588.f15015.m8183(this.f14695, C4915.f14888);
        long j2 = this.f14435.zzk ? c4909.f14813 : j;
        if (this.f14436.mo8165().m8044(2)) {
            this.f14436.mo8165().f14452.m8037("Evaluating filter. audience, filter, event", Integer.valueOf(this.f14696), this.f14435.m7613() ? Integer.valueOf(this.f14435.zzd) : null, this.f14436.m8161().m8110(this.f14435.zze));
            C4792 c4792 = this.f14436.mo8165().f14452;
            C4833 c4833M8157 = this.f14436.m8157();
            C4586 c4586 = this.f14435;
            if (c4833M8157 == null) {
                throw null;
            }
            if (c4586 == null) {
                string = "null";
            } else {
                StringBuilder sbM4889 = C2803.m4889("\nevent_filter {\n");
                if (c4586.m7613()) {
                    C4833.m8123(sbM4889, 0, "filter_id", Integer.valueOf(c4586.zzd));
                }
                C4833.m8123(sbM4889, 0, "event_name", c4833M8157.m8161().m8110(c4586.zze));
                String strM8118 = C4833.m8118(c4586.zzi, c4586.zzj, c4586.zzk);
                if (!strM8118.isEmpty()) {
                    C4833.m8123(sbM4889, 0, "filter_type", strM8118);
                }
                if (c4586.m7614()) {
                    C4590 c4590 = c4586.zzh;
                    if (c4590 == null) {
                        c4590 = C4590.zzi;
                    }
                    c4833M8157.m8135(sbM4889, 1, "event_count_filter", c4590);
                }
                if (c4586.zzf.size() > 0) {
                    sbM4889.append("  filters {\n");
                    Iterator<C4588> it = c4586.zzf.iterator();
                    while (it.hasNext()) {
                        c4833M8157.m8137(sbM4889, 2, it.next());
                    }
                }
                C4833.m8122(sbM4889, 1);
                sbM4889.append("}\n}\n");
                string = sbM4889.toString();
            }
            c4792.m8035("Filter definition", string);
        }
        if (this.f14435.m7613()) {
            C4586 c45862 = this.f14435;
            if (c45862.zzd <= 256) {
                boolean z3 = c45862.zzi || c45862.zzj || c45862.zzk;
                if (z && !z3) {
                    this.f14436.mo8165().f14452.m8036("Event filter already evaluated true and it is not associated with an enhanced audience. audience ID, filter ID", Integer.valueOf(this.f14696), this.f14435.m7613() ? Integer.valueOf(this.f14435.zzd) : null);
                    return true;
                }
                C4586 c45863 = this.f14435;
                String str = c4634.zze;
                if (c45863.m7614()) {
                    C4590 c45902 = c45863.zzh;
                    if (c45902 == null) {
                        c45902 = C4590.zzi;
                    }
                    Boolean boolM8211 = AbstractC4886.m8211(j2, c45902);
                    if (boolM8211 == null) {
                        bool = null;
                    } else if (boolM8211.booleanValue()) {
                    }
                } else {
                    HashSet hashSet = new HashSet();
                    Iterator<C4588> it2 = c45863.zzf.iterator();
                    while (true) {
                        if (it2.hasNext()) {
                            C4588 next = it2.next();
                            if (next.zzg.isEmpty()) {
                                this.f14436.mo8165().f14447.m8035("null or empty param name in filter. event", this.f14436.m8161().m8110(str));
                                break;
                            }
                            hashSet.add(next.zzg);
                        } else {
                            C1714 c1714 = new C1714();
                            Iterator<C4638> it3 = c4634.zzd.iterator();
                            while (true) {
                                if (it3.hasNext()) {
                                    C4638 next2 = it3.next();
                                    if (hashSet.contains(next2.zzd)) {
                                        if (!next2.m7678()) {
                                            if (!next2.m7680()) {
                                                if (!next2.m7676()) {
                                                    this.f14436.mo8165().f14447.m8036("Unknown value for param. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(next2.zzd));
                                                    break;
                                                }
                                                c1714.put(next2.zzd, next2.zze);
                                            } else {
                                                c1714.put(next2.zzd, next2.m7680() ? Double.valueOf(next2.zzh) : null);
                                            }
                                        } else {
                                            c1714.put(next2.zzd, next2.m7678() ? Long.valueOf(next2.zzf) : null);
                                        }
                                    }
                                } else {
                                    Iterator<C4588> it4 = c45863.zzf.iterator();
                                    while (true) {
                                        if (!it4.hasNext()) {
                                            bool = true;
                                            break;
                                        }
                                        C4588 next3 = it4.next();
                                        boolean z4 = ((next3.zzc & 4) != 0) && next3.zzf;
                                        String str2 = next3.zzg;
                                        if (str2.isEmpty()) {
                                            this.f14436.mo8165().f14447.m8035("Event has empty param name. event", this.f14436.m8161().m8110(str));
                                            break;
                                        }
                                        Object orDefault = c1714.getOrDefault(str2, null);
                                        if (orDefault instanceof Long) {
                                            if (!next3.m7618()) {
                                                this.f14436.mo8165().f14447.m8036("No number filter for long param. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(str2));
                                                break;
                                            }
                                            Boolean boolM82112 = AbstractC4886.m8211(((Long) orDefault).longValue(), next3.m7619());
                                            if (boolM82112 == null) {
                                                break;
                                            }
                                            if (boolM82112.booleanValue() == z4) {
                                                break;
                                            }
                                        } else if (orDefault instanceof Double) {
                                            if (!next3.m7618()) {
                                                this.f14436.mo8165().f14447.m8036("No number filter for double param. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(str2));
                                                break;
                                            }
                                            double dDoubleValue = ((Double) orDefault).doubleValue();
                                            try {
                                                boolM8215 = AbstractC4886.m8215(new BigDecimal(dDoubleValue), next3.m7619(), Math.ulp(dDoubleValue));
                                            } catch (NumberFormatException unused) {
                                                boolM8215 = null;
                                            }
                                            if (boolM8215 == null) {
                                                break;
                                            }
                                            if (boolM8215.booleanValue() == z4) {
                                                break;
                                            }
                                        } else if (orDefault instanceof String) {
                                            if (!next3.m7616()) {
                                                if (!next3.m7618()) {
                                                    this.f14436.mo8165().f14447.m8036("No filter for String param. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(str2));
                                                    break;
                                                }
                                                String str3 = (String) orDefault;
                                                if (!C4833.m8125(str3)) {
                                                    this.f14436.mo8165().f14447.m8036("Invalid param value for number filter. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(str2));
                                                    break;
                                                }
                                                boolM8213 = AbstractC4886.m8213(str3, next3.m7619());
                                            } else {
                                                boolM8213 = AbstractC4886.m8214((String) orDefault, next3.m7617(), this.f14436.mo8165());
                                            }
                                            if (boolM8213 == null) {
                                                break;
                                            }
                                            if (boolM8213.booleanValue() == z4) {
                                                break;
                                            }
                                        } else if (orDefault == null) {
                                            this.f14436.mo8165().f14452.m8036("Missing param for filter. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(str2));
                                        } else {
                                            this.f14436.mo8165().f14447.m8036("Unknown param type. event, param", this.f14436.m8161().m8110(str), this.f14436.m8161().m8113(str2));
                                        }
                                    }
                                    bool = null;
                                }
                            }
                        }
                    }
                    bool = null;
                }
                this.f14436.mo8165().f14452.m8035("Event filter result", bool != null ? bool : "null");
                if (bool == null) {
                    return false;
                }
                this.f14697 = true;
                if (!bool.booleanValue()) {
                    return true;
                }
                this.f14698 = true;
                if (!z3 || !c4634.m7656()) {
                    return true;
                }
                Long lValueOf = Long.valueOf(c4634.zzf);
                C4586 c45864 = this.f14435;
                if (c45864.zzj) {
                    if (z2 && c45864.m7614()) {
                        lValueOf = l;
                    }
                    this.f14700 = lValueOf;
                    return true;
                }
                if (z2 && c45864.m7614()) {
                    lValueOf = l2;
                }
                this.f14699 = lValueOf;
                return true;
            }
        }
        this.f14436.mo8165().f14447.m8036("Invalid event filter ID. appId, id", C4794.m8038(this.f14695), String.valueOf(this.f14435.m7613() ? Integer.valueOf(this.f14435.zzd) : null));
        return !this.f14436.f14588.f15015.m8183(this.f14695, C4915.f14885);
    }

    @Override // p138.p176.p177.p242.p265.p266.AbstractC4886
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final boolean mo8032() {
        return false;
    }

    @Override // p138.p176.p177.p242.p265.p266.AbstractC4886
    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final boolean mo8033() {
        return this.f14435.m7614();
    }
}
