package defpackage;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.text.TextUtils;
import com.google.android.gms.internal.measurement.zzaeh;
import com.google.android.gms.internal.measurement.zzd;
import j$.util.DesugarCollections;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/* JADX INFO: renamed from: ˏʜʙ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C1811 extends AbstractC1850 implements InterfaceC0434 {

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public final C0729 f7220;

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final C3310 f7221;

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public final C3310 f7222;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public final C3310 f7223;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public final C3310 f7224;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final C3310 f7225;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public final C3310 f7226;

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public final ᵷˇ f7227;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final C3310 f7228;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final C3310 f7229;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public final C3310 f7230;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public final C3310 f7231;

    public C1811(C2894 c2894) {
        super(c2894);
        this.f7228 = new C3310(0);
        this.f7229 = new C3310(0);
        this.f7230 = new C3310(0);
        this.f7223 = new C3310(0);
        this.f7225 = new C3310(0);
        this.f7231 = new C3310(0);
        this.f7224 = new C3310(0);
        this.f7222 = new C3310(0);
        this.f7221 = new C3310(0);
        this.f7226 = new C3310(0);
        this.f7220 = new C0729(this);
        this.f7227 = new ᵷˇ(this);
    }

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public static final C3310 m4953(C1498 c1498) {
        C3310 c3310 = new C3310(0);
        for (C0631 c0631 : c1498.m4287()) {
            c3310.put(c0631.m2289(), c0631.m2288());
        }
        return c3310;
    }

    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    public static final EnumC0174 m4954(int i) {
        int i2 = i - 1;
        if (i2 == 1) {
            return EnumC0174.f1599;
        }
        if (i2 == 2) {
            return EnumC0174.f1598;
        }
        if (i2 == 3) {
            return EnumC0174.f1600;
        }
        if (i2 != 4) {
            return null;
        }
        return EnumC0174.f1601;
    }

    /* JADX WARN: Code restructure failed: missing block: B:100:0x0402, code lost:
    
        r3 = null;
     */
    /* JADX WARN: Code restructure failed: missing block: B:101:0x0403, code lost:
    
        r5.put(r0, r3);
        r28 = r0;
        r5.put("property_name", r6.m8132());
     */
    /* JADX WARN: Code restructure failed: missing block: B:102:0x0415, code lost:
    
        if (r6.m8138() == false) goto L104;
     */
    /* JADX WARN: Code restructure failed: missing block: B:103:0x0417, code lost:
    
        r3 = java.lang.Boolean.valueOf(r6.m8139());
     */
    /* JADX WARN: Code restructure failed: missing block: B:104:0x0420, code lost:
    
        r3 = null;
     */
    /* JADX WARN: Code restructure failed: missing block: B:105:0x0421, code lost:
    
        r5.put("session_scoped", r3);
        r5.put("data", r8);
     */
    /* JADX WARN: Code restructure failed: missing block: B:107:0x0433, code lost:
    
        if (r9.m4625().insertWithOnConflict("property_filters", null, r5, 5) != (-1)) goto L112;
     */
    /* JADX WARN: Code restructure failed: missing block: B:108:0x0435, code lost:
    
        r0 = r14.f4729;
        defpackage.C1103.m3564(r0);
        r0.f13423.m4474(defpackage.C3485.m7979(r30), "Failed to insert property filter (got -1). appId");
     */
    /* JADX WARN: Code restructure failed: missing block: B:110:0x0446, code lost:
    
        r0 = move-exception;
     */
    /* JADX WARN: Code restructure failed: missing block: B:112:0x0448, code lost:
    
        r5 = r23;
        r3 = r26;
        r0 = r28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:113:0x0450, code lost:
    
        r1 = r14.f4729;
        defpackage.C1103.m3564(r1);
        r1.f13423.m4475("Error storing property filter. appId", defpackage.C3485.m7979(r30), r0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:114:0x0460, code lost:
    
        r9.m5026();
        r9.ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(r30);
        r0 = r9.m4625();
        r0.delete("property_filters", "app_id=? and audience_id=?", new java.lang.String[]{r30, java.lang.String.valueOf(r7)});
        r0.delete("event_filters", "app_id=? and audience_id=?", new java.lang.String[]{r30, java.lang.String.valueOf(r7)});
     */
    /* JADX WARN: Code restructure failed: missing block: B:115:0x0483, code lost:
    
        r1 = r24;
        r3 = r25;
        r0 = r27;
     */
    /* JADX WARN: Code restructure failed: missing block: B:157:0x0621, code lost:
    
        r24.endTransaction();
     */
    /* JADX WARN: Code restructure failed: missing block: B:158:0x0624, code lost:
    
        throw r0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:51:0x0262, code lost:
    
        r0 = r5.m2584().iterator();
     */
    /* JADX WARN: Code restructure failed: missing block: B:53:0x026e, code lost:
    
        if (r0.hasNext() == false) goto L187;
     */
    /* JADX WARN: Code restructure failed: missing block: B:55:0x027a, code lost:
    
        if (((defpackage.C3607) r0.next()).m8134() != false) goto L196;
     */
    /* JADX WARN: Code restructure failed: missing block: B:56:0x027c, code lost:
    
        r0 = r14.f4729;
        defpackage.C1103.m3564(r0);
        r0.f13424.m4475("Property filter with no ID. Audience definition ignored. appId, audienceId", defpackage.C3485.m7979(r30), java.lang.Integer.valueOf(r7));
     */
    /* JADX WARN: Code restructure failed: missing block: B:57:0x0291, code lost:
    
        r0 = r5.m2589().iterator();
     */
    /* JADX WARN: Code restructure failed: missing block: B:58:0x0299, code lost:
    
        r8 = r0.hasNext();
     */
    /* JADX WARN: Code restructure failed: missing block: B:59:0x029d, code lost:
    
        r23 = r0;
        r0 = "filter_id";
        r24 = r1;
        r25 = r3;
        r3 = "app_id";
     */
    /* JADX WARN: Code restructure failed: missing block: B:60:0x02af, code lost:
    
        if (r8 == false) goto L197;
     */
    /* JADX WARN: Code restructure failed: missing block: B:61:0x02b1, code lost:
    
        r8 = (defpackage.C4012) r23.next();
        r9.m5026();
        r9.ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(r30);
        ᵘᵞʿⁱ.ᵶᵥᵝ(r8);
     */
    /* JADX WARN: Code restructure failed: missing block: B:62:0x02cb, code lost:
    
        if (r8.m8809().isEmpty() == false) goto L70;
     */
    /* JADX WARN: Code restructure failed: missing block: B:63:0x02cd, code lost:
    
        r0 = r14.f4729;
        defpackage.C1103.m3564(r0);
        r0 = r0.f13424;
        r3 = defpackage.C3485.m7979(r30);
        r4 = java.lang.Integer.valueOf(r7);
     */
    /* JADX WARN: Code restructure failed: missing block: B:64:0x02e2, code lost:
    
        if (r8.m8811() == false) goto L68;
     */
    /* JADX WARN: Code restructure failed: missing block: B:65:0x02e4, code lost:
    
        r5 = java.lang.Integer.valueOf(r8.m8808());
     */
    /* JADX WARN: Code restructure failed: missing block: B:66:0x02ed, code lost:
    
        r0 = th;
     */
    /* JADX WARN: Code restructure failed: missing block: B:68:0x02f0, code lost:
    
        r5 = null;
     */
    /* JADX WARN: Code restructure failed: missing block: B:69:0x02f1, code lost:
    
        r0.m4477("Event filter had no event name. Audience definition ignored. appId, audienceId, filterId", r3, r4, java.lang.String.valueOf(r5));
        r27 = r6;
     */
    /* JADX WARN: Code restructure failed: missing block: B:70:0x02fc, code lost:
    
        r26 = r5;
        r5 = r8.m7714();
        r27 = r6;
        r6 = new android.content.ContentValues();
        r6.put("app_id", r30);
        r6.put("audience_id", java.lang.Integer.valueOf(r7));
     */
    /* JADX WARN: Code restructure failed: missing block: B:71:0x0317, code lost:
    
        if (r8.m8811() == false) goto L73;
     */
    /* JADX WARN: Code restructure failed: missing block: B:72:0x0319, code lost:
    
        r1 = java.lang.Integer.valueOf(r8.m8808());
     */
    /* JADX WARN: Code restructure failed: missing block: B:73:0x0322, code lost:
    
        r1 = null;
     */
    /* JADX WARN: Code restructure failed: missing block: B:74:0x0323, code lost:
    
        r6.put("filter_id", r1);
        r6.put("event_name", r8.m8809());
     */
    /* JADX WARN: Code restructure failed: missing block: B:75:0x0333, code lost:
    
        if (r8.m8819() == false) goto L77;
     */
    /* JADX WARN: Code restructure failed: missing block: B:76:0x0335, code lost:
    
        r0 = java.lang.Boolean.valueOf(r8.m8812());
     */
    /* JADX WARN: Code restructure failed: missing block: B:77:0x033e, code lost:
    
        r0 = null;
     */
    /* JADX WARN: Code restructure failed: missing block: B:78:0x033f, code lost:
    
        r6.put("session_scoped", r0);
        r6.put("data", r5);
     */
    /* JADX WARN: Code restructure failed: missing block: B:80:0x0351, code lost:
    
        if (r9.m4625().insertWithOnConflict("event_filters", null, r6, 5) != (-1)) goto L199;
     */
    /* JADX WARN: Code restructure failed: missing block: B:81:0x0353, code lost:
    
        r0 = r14.f4729;
        defpackage.C1103.m3564(r0);
        r0.f13423.m4474(defpackage.C3485.m7979(r30), "Failed to insert event filter (got -1). appId");
     */
    /* JADX WARN: Code restructure failed: missing block: B:83:0x0364, code lost:
    
        r0 = move-exception;
     */
    /* JADX WARN: Code restructure failed: missing block: B:85:0x0366, code lost:
    
        r0 = r23;
        r1 = r24;
        r3 = r25;
        r5 = r26;
        r6 = r27;
     */
    /* JADX WARN: Code restructure failed: missing block: B:86:0x0372, code lost:
    
        r1 = r14.f4729;
        defpackage.C1103.m3564(r1);
        r1.f13423.m4475("Error storing event filter. appId", defpackage.C3485.m7979(r30), r0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:87:0x0384, code lost:
    
        r27 = r6;
        r5 = r5.m2584().iterator();
     */
    /* JADX WARN: Code restructure failed: missing block: B:89:0x0394, code lost:
    
        if (r5.hasNext() == false) goto L202;
     */
    /* JADX WARN: Code restructure failed: missing block: B:90:0x0396, code lost:
    
        r6 = (defpackage.C3607) r5.next();
        r9.m5026();
        r9.ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(r30);
        ᵘᵞʿⁱ.ᵶᵥᵝ(r6);
     */
    /* JADX WARN: Code restructure failed: missing block: B:91:0x03b0, code lost:
    
        if (r6.m8132().isEmpty() == false) goto L97;
     */
    /* JADX WARN: Code restructure failed: missing block: B:92:0x03b2, code lost:
    
        r0 = r14.f4729;
        defpackage.C1103.m3564(r0);
        r0 = r0.f13424;
        r3 = defpackage.C3485.m7979(r30);
        r4 = java.lang.Integer.valueOf(r7);
     */
    /* JADX WARN: Code restructure failed: missing block: B:93:0x03c7, code lost:
    
        if (r6.m8134() == false) goto L95;
     */
    /* JADX WARN: Code restructure failed: missing block: B:94:0x03c9, code lost:
    
        r5 = java.lang.Integer.valueOf(r6.m8131());
     */
    /* JADX WARN: Code restructure failed: missing block: B:95:0x03d2, code lost:
    
        r5 = null;
     */
    /* JADX WARN: Code restructure failed: missing block: B:96:0x03d3, code lost:
    
        r0.m4477("Property filter had no property name. Audience definition ignored. appId, audienceId, filterId", r3, r4, java.lang.String.valueOf(r5));
     */
    /* JADX WARN: Code restructure failed: missing block: B:97:0x03dc, code lost:
    
        r8 = r6.m7714();
        r23 = r5;
        r5 = new android.content.ContentValues();
        r5.put(r3, r30);
        r26 = r3;
        r5.put("audience_id", java.lang.Integer.valueOf(r7));
     */
    /* JADX WARN: Code restructure failed: missing block: B:98:0x03f7, code lost:
    
        if (r6.m8134() == false) goto L100;
     */
    /* JADX WARN: Code restructure failed: missing block: B:99:0x03f9, code lost:
    
        r3 = java.lang.Integer.valueOf(r6.m8131());
     */
    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m4955(String str, String str2, String str3, byte[] bArr) throws Throwable {
        SQLiteDatabase sQLiteDatabase;
        C1844 c1844;
        byte[] bArrM7714;
        boolean z;
        m5026();
        ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        C1844 c18442 = (C1844) m4964(str, bArr).m9884();
        m4960(str, c18442);
        m4958(str, (C1498) c18442.m9869());
        C1498 c1498 = (C1498) c18442.m9869();
        C3310 c3310 = this.f7231;
        c3310.put(str, c1498);
        this.f7224.put(str, ((C1498) c18442.f17955).m4286());
        this.f7222.put(str, str2);
        this.f7221.put(str, str3);
        this.f7228.put(str, m4953((C1498) c18442.m9869()));
        C2894 c2894 = this.f18892;
        C1694 c1694 = c2894.f11109;
        C2894.m6882(c1694);
        ArrayList arrayList = new ArrayList(DesugarCollections.unmodifiableList(((C1498) c18442.f17955).m4294()));
        C1103 c1103 = (C1103) ((ᵜᵪʾ) c1694).ˌᴵ;
        int i = 0;
        while (i < arrayList.size()) {
            C2021 c2021 = (C2021) ((C0726) arrayList.get(i)).m9884();
            C3310 c33102 = c3310;
            if (((C0726) c2021.f17955).m2590() != 0) {
                int i2 = 0;
                while (i2 < ((C0726) c2021.f17955).m2590()) {
                    C4145 c4145 = (C4145) ((C0726) c2021.f17955).m2591(i2).m9884();
                    C4145 c41452 = (C4145) c4145.clone();
                    C2894 c28942 = c2894;
                    C1844 c18443 = c18442;
                    String str4 = ᵴᵧˈ.ᵔᵖᵹᵫ(((C4012) c4145.f17955).m8809(), ᵱˉˈ.ᵵᵽ, ᵱˉˈ.ᵮᵣᵗˈ);
                    if (str4 != null) {
                        c41452.m9868();
                        ((C4012) c41452.f17955).m8815(str4);
                        z = true;
                    } else {
                        z = false;
                    }
                    int i3 = 0;
                    while (i3 < ((C4012) c4145.f17955).m8813()) {
                        C3918 c3918M8816 = ((C4012) c4145.f17955).m8816(i3);
                        boolean z2 = z;
                        C4145 c41453 = c4145;
                        String str5 = ᵴᵧˈ.ᵔᵖᵹᵫ(c3918M8816.m8648(), ᵬʕˎʽ.ᵷᵺʾᵖ, ᵬʕˎʽ.ᵨᵣ);
                        if (str5 != null) {
                            C2589 c2589 = (C2589) c3918M8816.m9884();
                            c2589.m9868();
                            ((C3918) c2589.f17955).m8642(str5);
                            C3918 c3918 = (C3918) c2589.m9869();
                            c41452.m9868();
                            ((C4012) c41452.f17955).m8807(i3, c3918);
                            z = true;
                        } else {
                            z = z2;
                        }
                        i3++;
                        c4145 = c41453;
                    }
                    if (z) {
                        c2021.m9868();
                        ((C0726) c2021.f17955).m2585(i2, (C4012) c41452.m9869());
                        arrayList.set(i, (C0726) c2021.m9869());
                    }
                    i2++;
                    c2894 = c28942;
                    c18442 = c18443;
                }
            }
            C1844 c18444 = c18442;
            C2894 c28943 = c2894;
            if (((C0726) c2021.f17955).m2588() != 0) {
                for (int i4 = 0; i4 < ((C0726) c2021.f17955).m2588(); i4++) {
                    C3607 c3607M2587 = ((C0726) c2021.f17955).m2587(i4);
                    String str6 = ᵴᵧˈ.ᵔᵖᵹᵫ(c3607M2587.m8132(), ˑᵕʾ.ːˏᵟᵯ, ˑᵕʾ.ᵷᵺʾᵖ);
                    if (str6 != null) {
                        C4886 c4886 = (C4886) c3607M2587.m9884();
                        c4886.m9868();
                        ((C3607) c4886.f17955).m8133(str6);
                        c2021.m9868();
                        ((C0726) c2021.f17955).m2582(i4, (C3607) c4886.m9869());
                        arrayList.set(i, (C0726) c2021.m9869());
                    }
                }
            }
            i++;
            c3310 = c33102;
            c2894 = c28943;
            c18442 = c18444;
        }
        C1844 c18445 = c18442;
        C3310 c33103 = c3310;
        C2894 c28944 = c2894;
        c1694.m5026();
        c1694.ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        SQLiteDatabase sQLiteDatabaseM4625 = c1694.m4625();
        sQLiteDatabaseM4625.beginTransaction();
        try {
            c1694.m5026();
            c1694.ˈᵲᵢ();
            ᵘᵞʿⁱ.ˊᵫᵗ(str);
            SQLiteDatabase sQLiteDatabaseM46252 = c1694.m4625();
            sQLiteDatabaseM46252.delete("property_filters", "app_id=?", new String[]{str});
            sQLiteDatabaseM46252.delete("event_filters", "app_id=?", new String[]{str});
            int size = arrayList.size();
            int i5 = 0;
            while (i5 < size) {
                int i6 = i5 + 1;
                C0726 c0726 = (C0726) arrayList.get(i5);
                c1694.m5026();
                c1694.ˈᵲᵢ();
                ᵘᵞʿⁱ.ˊᵫᵗ(str);
                ᵘᵞʿⁱ.ᵶᵥᵝ(c0726);
                if (c0726.m2586()) {
                    int iM2583 = c0726.m2583();
                    Iterator it = c0726.m2589().iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        if (!((C4012) it.next()).m8811()) {
                            C3485 c3485 = c1103.f4729;
                            C1103.m3564(c3485);
                            c3485.f13424.m4475("Event filter with no ID. Audience definition ignored. appId, audienceId", C3485.m7979(str), Integer.valueOf(iM2583));
                            break;
                        }
                    }
                } else {
                    C3485 c34852 = c1103.f4729;
                    C1103.m3564(c34852);
                    c34852.f13424.m4474(C3485.m7979(str), "Audience with no ID. appId");
                }
                i5 = i6;
            }
            sQLiteDatabase = sQLiteDatabaseM4625;
            ArrayList arrayList2 = new ArrayList();
            int size2 = arrayList.size();
            int i7 = 0;
            while (i7 < size2) {
                Object obj = arrayList.get(i7);
                i7++;
                C0726 c07262 = (C0726) obj;
                arrayList2.add(c07262.m2586() ? Integer.valueOf(c07262.m2583()) : null);
            }
            ᵘᵞʿⁱ.ˊᵫᵗ(str);
            c1694.m5026();
            c1694.ˈᵲᵢ();
            SQLiteDatabase sQLiteDatabaseM46253 = c1694.m4625();
            try {
                long jM4613 = c1694.m4613("select count(1) from audience_filter_values where app_id=?", new String[]{str});
                int iMax = Math.max(0, Math.min(2000, c1103.f4726.m8310(str, AbstractC3818.f14482)));
                if (jM4613 > iMax) {
                    ArrayList arrayList3 = new ArrayList();
                    int i8 = 0;
                    while (true) {
                        if (i8 >= arrayList2.size()) {
                            String strJoin = TextUtils.join(",", arrayList3);
                            StringBuilder sb = new StringBuilder(String.valueOf(strJoin).length() + 2);
                            sb.append("(");
                            sb.append(strJoin);
                            sb.append(")");
                            String string = sb.toString();
                            StringBuilder sb2 = new StringBuilder(string.length() + 140);
                            sb2.append("audience_id in (select audience_id from audience_filter_values where app_id=? and audience_id not in ");
                            sb2.append(string);
                            sb2.append(" order by rowid desc limit -1 offset ?)");
                            sQLiteDatabaseM46253.delete("audience_filter_values", sb2.toString(), new String[]{str, Integer.toString(iMax)});
                            break;
                        }
                        Integer num = (Integer) arrayList2.get(i8);
                        if (num == null) {
                            break;
                        }
                        arrayList3.add(Integer.toString(num.intValue()));
                        i8++;
                    }
                }
            } catch (SQLiteException e) {
                C3485 c34853 = c1103.f4729;
                C1103.m3564(c34853);
                c34853.f13423.m4475("Database error querying filters. appId", C3485.m7979(str), e);
            }
            sQLiteDatabase.setTransactionSuccessful();
            sQLiteDatabase.endTransaction();
            try {
                c18445.m9868();
                c1844 = c18445;
            } catch (RuntimeException e2) {
                e = e2;
                c1844 = c18445;
            }
            try {
                ((C1498) c1844.f17955).m4293();
                bArrM7714 = ((C1498) c1844.m9869()).m7714();
            } catch (RuntimeException e3) {
                e = e3;
                C3485 c34854 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4729;
                C1103.m3564(c34854);
                c34854.f13424.m4475("Unable to serialize reduced-size config. Storing full config instead. appId", C3485.m7979(str), e);
                bArrM7714 = bArr;
            }
            C1694 c16942 = c28944.f11109;
            C2894.m6882(c16942);
            C1103 c11032 = (C1103) ((ᵜᵪʾ) c16942).ˌᴵ;
            ᵘᵞʿⁱ.ˊᵫᵗ(str);
            c16942.ˈᵲᵢ();
            c16942.m5026();
            ContentValues contentValues = new ContentValues();
            contentValues.put("remote_config", bArrM7714);
            contentValues.put("config_last_modified_time", str2);
            contentValues.put("e_tag", str3);
            try {
                if (c16942.m4625().update("apps", contentValues, "app_id = ?", new String[]{str}) == 0) {
                    C3485 c34855 = c11032.f4729;
                    C1103.m3564(c34855);
                    c34855.f13423.m4474(C3485.m7979(str), "Failed to update remote config (got 0). appId");
                }
            } catch (SQLiteException e4) {
                C3485 c34856 = c11032.f4729;
                C1103.m3564(c34856);
                c34856.f13423.m4475("Error storing remote config. appId", C3485.m7979(str), e4);
            }
            c1844.m9868();
            ((C1498) c1844.f17955).m4285();
            c33103.put(str, (C1498) c1844.m9869());
        } catch (Throwable th) {
            th = th;
            sQLiteDatabase = sQLiteDatabaseM4625;
        }
    }

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public final EnumC3695 m4956(String str, EnumC0174 enumC0174) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        C1699 c1699M4967 = m4967(str);
        if (c1699M4967 != null) {
            Iterator it = c1699M4967.m4652().iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                C5415 c5415 = (C5415) it.next();
                if (m4954(c5415.m11034()) == enumC0174) {
                    int iM11032 = c5415.m11032() - 1;
                    if (iM11032 == 1) {
                        return EnumC3695.f14084;
                    }
                    if (iM11032 == 2) {
                        return EnumC3695.f14083;
                    }
                }
            }
        }
        return EnumC3695.f14082;
    }

    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public final boolean m4957(String str) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        C3310 c3310 = this.f7229;
        return c3310.get(str) != null && ((Set) c3310.get(str)).contains("app_instance_id");
    }

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final void m4958(String str, C1498 c1498) {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        int iM4283 = c1498.m4283();
        C0729 c0729 = this.f7220;
        if (iM4283 == 0) {
            c0729.m5180(str);
            return;
        }
        C3485 c3485 = c1103.f4729;
        C1103.m3564(c3485);
        c3485.f13414.m4474(Integer.valueOf(c1498.m4283()), "EES programs found");
        int i = 0;
        C4413 c4413 = (C4413) c1498.m4279().get(0);
        try {
            C4555 c4555 = new C4555();
            C4055 c4055 = c4555.f17308;
            int i2 = 2;
            ((C1563) c4055.f15560).f6260.put("internal.remoteConfig", new CallableC1105(this, str, i2));
            ((C1563) c4055.f15560).f6260.put("internal.appMetadata", new CallableC1105(this, str, i));
            ((C1563) c4055.f15560).f6260.put("internal.logger", new CallableC2619(i2, this));
            c4555.m9643(c4413);
            c0729.m5182(str, c4555);
            C1103.m3564(c3485);
            C1623 c1623 = c3485.f13414;
            c1623.m4475("EES program loaded for appId, activities", str, Integer.valueOf(c4413.m9430().m8946()));
            for (C4967 c4967 : c4413.m9430().m8947()) {
                C1103.m3564(c3485);
                c1623.m4474(c4967.m10280(), "EES program activity");
            }
        } catch (zzd unused) {
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13423.m4474(str, "Failed to load EES program. appId");
        }
    }

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public final boolean m4959(String str) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        C3310 c3310 = this.f7229;
        if (c3310.get(str) != null) {
            return ((Set) c3310.get(str)).contains("os_version") || ((Set) c3310.get(str)).contains("device_info");
        }
        return false;
    }

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public final void m4960(String str, C1844 c1844) {
        ArrayList arrayList;
        HashSet hashSet = new HashSet();
        ArrayList arrayList2 = new ArrayList();
        int i = 0;
        C3310 c3310 = new C3310(0);
        C3310 c33102 = new C3310(0);
        C3310 c33103 = new C3310(0);
        Iterator it = DesugarCollections.unmodifiableList(((C1498) c1844.f17955).m4295()).iterator();
        while (it.hasNext()) {
            hashSet.add(((C0368) it.next()).m1696());
        }
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3691 c3691 = c1103.f4726;
        C3485 c3485 = c1103.f4729;
        C0511 c0511 = AbstractC3818.f14573;
        if (c3691.m8314(null, c0511)) {
            arrayList2.addAll(DesugarCollections.unmodifiableList(((C1498) c1844.f17955).m4277()));
        }
        while (i < ((C1498) c1844.f17955).m4291()) {
            C4585 c4585 = (C4585) ((C1498) c1844.f17955).m4292(i).m9884();
            if (c4585.m9661().isEmpty()) {
                C1103.m3564(c3485);
                c3485.f13424.m4476("EventConfig contained null event name");
                arrayList = arrayList2;
            } else {
                String strM9661 = c4585.m9661();
                arrayList = arrayList2;
                String str2 = ᵴᵧˈ.ᵔᵖᵹᵫ(c4585.m9661(), ᵱˉˈ.ᵵᵽ, ᵱˉˈ.ᵮᵣᵗˈ);
                if (!TextUtils.isEmpty(str2)) {
                    c4585.m9868();
                    ((C2202) c4585.f17955).m5785(str2);
                    c1844.m9868();
                    ((C1498) c1844.f17955).m4288(i, (C2202) c4585.m9869());
                }
                if (((C2202) c4585.f17955).m5778() && ((C2202) c4585.f17955).m5779()) {
                    c3310.put(strM9661, Boolean.TRUE);
                }
                if (((C2202) c4585.f17955).m5782() && ((C2202) c4585.f17955).m5781()) {
                    c33102.put(c4585.m9661(), Boolean.TRUE);
                }
                if (((C2202) c4585.f17955).m5783()) {
                    if (((C2202) c4585.f17955).m5784() < 2 || ((C2202) c4585.f17955).m5784() > 65535) {
                        C1103.m3564(c3485);
                        c3485.f13424.m4475("Invalid sampling rate. Event name, sample rate", c4585.m9661(), Integer.valueOf(((C2202) c4585.f17955).m5784()));
                    } else {
                        c33103.put(c4585.m9661(), Integer.valueOf(((C2202) c4585.f17955).m5784()));
                    }
                }
            }
            i++;
            arrayList2 = arrayList;
        }
        ArrayList arrayList3 = arrayList2;
        this.f7229.put(str, hashSet);
        if (c1103.f4726.m8314(null, c0511)) {
            this.f7225.put(str, arrayList3);
        }
        this.f7230.put(str, c3310);
        this.f7223.put(str, c33102);
        this.f7226.put(str, c33103);
    }

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final boolean m4961(String str, String str2) throws Throwable {
        Boolean bool;
        ˈᵲᵢ();
        m4962(str);
        if ("1".equals(mo1833(str, "measurement.upload.blacklist_internal")) && C3335.m7615(str2)) {
            return true;
        }
        if ("1".equals(mo1833(str, "measurement.upload.blacklist_public")) && C3335.m7606(str2)) {
            return true;
        }
        Map map = (Map) this.f7230.get(str);
        if (map == null || (bool = (Boolean) map.get(str2)) == null) {
            return false;
        }
        return bool.booleanValue();
    }

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public final void m4962(String str) throws Throwable {
        m5026();
        ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        C3310 c3310 = this.f7231;
        if (c3310.get(str) == null) {
            C1694 c1694 = this.f18892.f11109;
            C2894.m6882(c1694);
            C2994 c2994M4592 = c1694.m4592(str);
            C3310 c33102 = this.f7221;
            C3310 c33103 = this.f7222;
            C3310 c33104 = this.f7224;
            C3310 c33105 = this.f7228;
            if (c2994M4592 != null) {
                C1844 c1844 = (C1844) m4964(str, (byte[]) c2994M4592.f11535).m9884();
                m4960(str, c1844);
                c33105.put(str, m4953((C1498) c1844.m9869()));
                c3310.put(str, (C1498) c1844.m9869());
                m4958(str, (C1498) c1844.m9869());
                c33104.put(str, ((C1498) c1844.f17955).m4286());
                c33103.put(str, (String) c2994M4592.f11534);
                c33102.put(str, (String) c2994M4592.f11536);
                return;
            }
            c33105.put(str, null);
            this.f7230.put(str, null);
            this.f7229.put(str, null);
            this.f7223.put(str, null);
            this.f7225.put(str, null);
            c3310.put(str, null);
            c33104.put(str, null);
            c33103.put(str, null);
            c33102.put(str, null);
            this.f7226.put(str, null);
        }
    }

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public final int m4963(String str, String str2) throws Throwable {
        Integer num;
        ˈᵲᵢ();
        m4962(str);
        Map map = (Map) this.f7226.get(str);
        if (map == null || (num = (Integer) map.get(str2)) == null) {
            return 1;
        }
        return num.intValue();
    }

    @Override // defpackage.InterfaceC0434
    /* JADX INFO: renamed from: ˊᵫᵗ */
    public final String mo1833(String str, String str2) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        Map map = (Map) this.f7228.get(str);
        if (map != null) {
            return (String) map.get(str2);
        }
        return null;
    }

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public final C1498 m4964(String str, byte[] bArr) {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        if (bArr == null) {
            return C1498.m4274();
        }
        try {
            C1498 c1498 = (C1498) ((C1844) C1962.m5264(C1498.m4275(), bArr)).m9869();
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13414.m4475("Parsed config. version, gmp_app_id", c1498.m4284() ? Long.valueOf(c1498.m4281()) : null, c1498.m4282() ? c1498.m4289() : null);
            return c1498;
        } catch (zzaeh e) {
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13424.m4475("Unable to merge remote config. appId", C3485.m7979(str), e);
            return C1498.m4274();
        } catch (RuntimeException e2) {
            C3485 c34853 = c1103.f4729;
            C1103.m3564(c34853);
            c34853.f13424.m4475("Unable to merge remote config. appId", C3485.m7979(str), e2);
            return C1498.m4274();
        }
    }

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public final boolean m4965(String str, EnumC0174 enumC0174) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        C1699 c1699M4967 = m4967(str);
        if (c1699M4967 == null) {
            return false;
        }
        for (C5415 c5415 : c1699M4967.m4649()) {
            if (enumC0174 == m4954(c5415.m11034())) {
                return c5415.m11032() == 2;
            }
        }
        return false;
    }

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public final String m4966(String str) {
        ˈᵲᵢ();
        m4962(str);
        return (String) this.f7224.get(str);
    }

    @Override // defpackage.AbstractC1850
    /* JADX INFO: renamed from: ˑˊᵲ */
    public final void mo2842() {
    }

    /* JADX INFO: renamed from: ᵛˀˊ, reason: contains not printable characters */
    public final C1699 m4967(String str) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        C1498 c1498M4971 = m4971(str);
        if (c1498M4971 == null || !c1498M4971.m4276()) {
            return null;
        }
        return c1498M4971.m4290();
    }

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public final List m4968(String str) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        return (List) this.f7225.get(str);
    }

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public final boolean m4969(String str) throws Throwable {
        ˈᵲᵢ();
        m4962(str);
        C1699 c1699M4967 = m4967(str);
        if (c1699M4967 == null) {
            return false;
        }
        for (C5415 c5415 : c1699M4967.m4649()) {
            if (c5415.m11034() == 3 && c5415.m11033() == 3) {
                return true;
            }
        }
        return false;
    }

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public final boolean m4970(String str, String str2) throws Throwable {
        Boolean bool;
        ˈᵲᵢ();
        m4962(str);
        if ("ecommerce_purchase".equals(str2) || "purchase".equals(str2) || "refund".equals(str2)) {
            return true;
        }
        Map map = (Map) this.f7223.get(str);
        if (map == null || (bool = (Boolean) map.get(str2)) == null) {
            return false;
        }
        return bool.booleanValue();
    }

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public final C1498 m4971(String str) throws Throwable {
        m5026();
        ˈᵲᵢ();
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        m4962(str);
        return (C1498) this.f7231.get(str);
    }
}
