package p037.p109.p111;

import android.database.Cursor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import p037.p115.p116.InterfaceC2442;
import p037.p115.p116.p117.C2449;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: މ.ސ.ޏ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2424 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final String f7679;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final Map<String, C2425> f7680;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final Set<C2426> f7681;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final Set<C2428> f7682;

    /* JADX INFO: renamed from: މ.ސ.ޏ.ނ$֏, reason: contains not printable characters */
    public static class C2425 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final String f7683;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final String f7684;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final int f7685;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public final boolean f7686;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final int f7687;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final String f7688;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final int f7689;

        public C2425(String str, String str2, boolean z, int i, String str3, int i2) {
            this.f7683 = str;
            this.f7684 = str2;
            this.f7686 = z;
            this.f7687 = i;
            int i3 = 5;
            if (str2 != null) {
                String upperCase = str2.toUpperCase(Locale.US);
                if (upperCase.contains("INT")) {
                    i3 = 3;
                } else if (upperCase.contains("CHAR") || upperCase.contains("CLOB") || upperCase.contains("TEXT")) {
                    i3 = 2;
                } else if (!upperCase.contains("BLOB")) {
                    i3 = (upperCase.contains("REAL") || upperCase.contains("FLOA") || upperCase.contains("DOUB")) ? 4 : 1;
                }
            }
            this.f7685 = i3;
            this.f7688 = str3;
            this.f7689 = i2;
        }

        public boolean equals(Object obj) {
            String str;
            String str2;
            String str3;
            if (this == obj) {
                return true;
            }
            if (obj == null || C2425.class != obj.getClass()) {
                return false;
            }
            C2425 c2425 = (C2425) obj;
            if (this.f7687 != c2425.f7687 || !this.f7683.equals(c2425.f7683) || this.f7686 != c2425.f7686) {
                return false;
            }
            if (this.f7689 == 1 && c2425.f7689 == 2 && (str3 = this.f7688) != null && !str3.equals(c2425.f7688)) {
                return false;
            }
            if (this.f7689 == 2 && c2425.f7689 == 1 && (str2 = c2425.f7688) != null && !str2.equals(this.f7688)) {
                return false;
            }
            int i = this.f7689;
            return (i == 0 || i != c2425.f7689 || ((str = this.f7688) == null ? c2425.f7688 == null : str.equals(c2425.f7688))) && this.f7685 == c2425.f7685;
        }

        public int hashCode() {
            return (((((this.f7683.hashCode() * 31) + this.f7685) * 31) + (this.f7686 ? 1231 : 1237)) * 31) + this.f7687;
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("Column{name='");
            sbM4889.append(this.f7683);
            sbM4889.append('\'');
            sbM4889.append(", type='");
            sbM4889.append(this.f7684);
            sbM4889.append('\'');
            sbM4889.append(", affinity='");
            sbM4889.append(this.f7685);
            sbM4889.append('\'');
            sbM4889.append(", notNull=");
            sbM4889.append(this.f7686);
            sbM4889.append(", primaryKeyPosition=");
            sbM4889.append(this.f7687);
            sbM4889.append(", defaultValue='");
            sbM4889.append(this.f7688);
            sbM4889.append('\'');
            sbM4889.append('}');
            return sbM4889.toString();
        }
    }

    /* JADX INFO: renamed from: މ.ސ.ޏ.ނ$ؠ, reason: contains not printable characters */
    public static class C2426 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final String f7690;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final String f7691;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final String f7692;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public final List<String> f7693;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final List<String> f7694;

        public C2426(String str, String str2, String str3, List<String> list, List<String> list2) {
            this.f7690 = str;
            this.f7691 = str2;
            this.f7692 = str3;
            this.f7693 = Collections.unmodifiableList(list);
            this.f7694 = Collections.unmodifiableList(list2);
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || C2426.class != obj.getClass()) {
                return false;
            }
            C2426 c2426 = (C2426) obj;
            if (this.f7690.equals(c2426.f7690) && this.f7691.equals(c2426.f7691) && this.f7692.equals(c2426.f7692) && this.f7693.equals(c2426.f7693)) {
                return this.f7694.equals(c2426.f7694);
            }
            return false;
        }

        public int hashCode() {
            return this.f7694.hashCode() + ((this.f7693.hashCode() + ((this.f7692.hashCode() + ((this.f7691.hashCode() + (this.f7690.hashCode() * 31)) * 31)) * 31)) * 31);
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("ForeignKey{referenceTable='");
            sbM4889.append(this.f7690);
            sbM4889.append('\'');
            sbM4889.append(", onDelete='");
            sbM4889.append(this.f7691);
            sbM4889.append('\'');
            sbM4889.append(", onUpdate='");
            sbM4889.append(this.f7692);
            sbM4889.append('\'');
            sbM4889.append(", columnNames=");
            sbM4889.append(this.f7693);
            sbM4889.append(", referenceColumnNames=");
            sbM4889.append(this.f7694);
            sbM4889.append('}');
            return sbM4889.toString();
        }
    }

    /* JADX INFO: renamed from: މ.ސ.ޏ.ނ$ހ, reason: contains not printable characters */
    public static class C2427 implements Comparable<C2427> {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final int f7695;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final int f7696;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public final String f7697;

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public final String f7698;

        public C2427(int i, int i2, String str, String str2) {
            this.f7695 = i;
            this.f7696 = i2;
            this.f7697 = str;
            this.f7698 = str2;
        }

        @Override // java.lang.Comparable
        public int compareTo(C2427 c2427) {
            C2427 c24272 = c2427;
            int i = this.f7695 - c24272.f7695;
            return i == 0 ? this.f7696 - c24272.f7696 : i;
        }
    }

    /* JADX INFO: renamed from: މ.ސ.ޏ.ނ$ށ, reason: contains not printable characters */
    public static class C2428 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final String f7699;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final boolean f7700;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final List<String> f7701;

        public C2428(String str, boolean z, List<String> list) {
            this.f7699 = str;
            this.f7700 = z;
            this.f7701 = list;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || C2428.class != obj.getClass()) {
                return false;
            }
            C2428 c2428 = (C2428) obj;
            if (this.f7700 == c2428.f7700 && this.f7701.equals(c2428.f7701)) {
                return this.f7699.startsWith("index_") ? c2428.f7699.startsWith("index_") : this.f7699.equals(c2428.f7699);
            }
            return false;
        }

        public int hashCode() {
            return this.f7701.hashCode() + ((((this.f7699.startsWith("index_") ? -1184239155 : this.f7699.hashCode()) * 31) + (this.f7700 ? 1 : 0)) * 31);
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("Index{name='");
            sbM4889.append(this.f7699);
            sbM4889.append('\'');
            sbM4889.append(", unique=");
            sbM4889.append(this.f7700);
            sbM4889.append(", columns=");
            sbM4889.append(this.f7701);
            sbM4889.append('}');
            return sbM4889.toString();
        }
    }

    public C2424(String str, Map<String, C2425> map, Set<C2426> set, Set<C2428> set2) {
        this.f7679 = str;
        this.f7680 = Collections.unmodifiableMap(map);
        this.f7681 = Collections.unmodifiableSet(set);
        this.f7682 = set2 == null ? null : Collections.unmodifiableSet(set2);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static List<C2427> m4509(Cursor cursor) {
        int columnIndex = cursor.getColumnIndex("id");
        int columnIndex2 = cursor.getColumnIndex("seq");
        int columnIndex3 = cursor.getColumnIndex("from");
        int columnIndex4 = cursor.getColumnIndex("to");
        int count = cursor.getCount();
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < count; i++) {
            cursor.moveToPosition(i);
            arrayList.add(new C2427(cursor.getInt(columnIndex), cursor.getInt(columnIndex2), cursor.getString(columnIndex3), cursor.getString(columnIndex4)));
        }
        Collections.sort(arrayList);
        return arrayList;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C2428 m4510(InterfaceC2442 interfaceC2442, String str, boolean z) {
        Cursor cursorM4527 = ((C2449) interfaceC2442).m4527(C2803.m4880("PRAGMA index_xinfo(`", str, "`)"));
        try {
            int columnIndex = cursorM4527.getColumnIndex("seqno");
            int columnIndex2 = cursorM4527.getColumnIndex("cid");
            int columnIndex3 = cursorM4527.getColumnIndex("name");
            if (columnIndex != -1 && columnIndex2 != -1 && columnIndex3 != -1) {
                TreeMap treeMap = new TreeMap();
                while (cursorM4527.moveToNext()) {
                    if (cursorM4527.getInt(columnIndex2) >= 0) {
                        int i = cursorM4527.getInt(columnIndex);
                        treeMap.put(Integer.valueOf(i), cursorM4527.getString(columnIndex3));
                    }
                }
                ArrayList arrayList = new ArrayList(treeMap.size());
                arrayList.addAll(treeMap.values());
                return new C2428(str, z, arrayList);
            }
            return null;
        } finally {
            cursorM4527.close();
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C2424 m4511(InterfaceC2442 interfaceC2442, String str) {
        int i;
        int i2;
        List<C2427> list;
        int i3;
        C2449 c2449 = (C2449) interfaceC2442;
        Cursor cursorM4527 = c2449.m4527(C2803.m4880("PRAGMA table_info(`", str, "`)"));
        HashMap map = new HashMap();
        try {
            if (cursorM4527.getColumnCount() > 0) {
                int columnIndex = cursorM4527.getColumnIndex("name");
                int columnIndex2 = cursorM4527.getColumnIndex("type");
                int columnIndex3 = cursorM4527.getColumnIndex("notnull");
                int columnIndex4 = cursorM4527.getColumnIndex("pk");
                int columnIndex5 = cursorM4527.getColumnIndex("dflt_value");
                while (cursorM4527.moveToNext()) {
                    String string = cursorM4527.getString(columnIndex);
                    int i4 = columnIndex;
                    map.put(string, new C2425(string, cursorM4527.getString(columnIndex2), cursorM4527.getInt(columnIndex3) != 0, cursorM4527.getInt(columnIndex4), cursorM4527.getString(columnIndex5), 2));
                    columnIndex = i4;
                }
            }
            cursorM4527.close();
            HashSet hashSet = new HashSet();
            cursorM4527 = c2449.m4527("PRAGMA foreign_key_list(`" + str + "`)");
            try {
                int columnIndex6 = cursorM4527.getColumnIndex("id");
                int columnIndex7 = cursorM4527.getColumnIndex("seq");
                int columnIndex8 = cursorM4527.getColumnIndex("table");
                int columnIndex9 = cursorM4527.getColumnIndex("on_delete");
                int columnIndex10 = cursorM4527.getColumnIndex("on_update");
                List<C2427> listM4509 = m4509(cursorM4527);
                int count = cursorM4527.getCount();
                int i5 = 0;
                while (i5 < count) {
                    cursorM4527.moveToPosition(i5);
                    if (cursorM4527.getInt(columnIndex7) != 0) {
                        i = columnIndex6;
                        i2 = columnIndex7;
                        list = listM4509;
                        i3 = count;
                    } else {
                        int i6 = cursorM4527.getInt(columnIndex6);
                        i = columnIndex6;
                        ArrayList arrayList = new ArrayList();
                        i2 = columnIndex7;
                        ArrayList arrayList2 = new ArrayList();
                        for (C2427 c2427 : (ArrayList) listM4509) {
                            List<C2427> list2 = listM4509;
                            int i7 = count;
                            if (c2427.f7695 == i6) {
                                arrayList.add(c2427.f7697);
                                arrayList2.add(c2427.f7698);
                            }
                            listM4509 = list2;
                            count = i7;
                        }
                        list = listM4509;
                        i3 = count;
                        hashSet.add(new C2426(cursorM4527.getString(columnIndex8), cursorM4527.getString(columnIndex9), cursorM4527.getString(columnIndex10), arrayList, arrayList2));
                    }
                    i5++;
                    columnIndex6 = i;
                    columnIndex7 = i2;
                    listM4509 = list;
                    count = i3;
                }
                cursorM4527.close();
                cursorM4527 = c2449.m4527("PRAGMA index_list(`" + str + "`)");
                try {
                    int columnIndex11 = cursorM4527.getColumnIndex("name");
                    int columnIndex12 = cursorM4527.getColumnIndex("origin");
                    int columnIndex13 = cursorM4527.getColumnIndex("unique");
                    HashSet hashSet2 = null;
                    if (columnIndex11 == -1 || columnIndex12 == -1 || columnIndex13 == -1) {
                        break;
                    }
                    HashSet hashSet3 = new HashSet();
                    while (cursorM4527.moveToNext()) {
                        if ("c".equals(cursorM4527.getString(columnIndex12))) {
                            C2428 c2428M4510 = m4510(c2449, cursorM4527.getString(columnIndex11), cursorM4527.getInt(columnIndex13) == 1);
                            if (c2428M4510 == null) {
                                break;
                            }
                            hashSet3.add(c2428M4510);
                        }
                    }
                    cursorM4527.close();
                    hashSet2 = hashSet3;
                    return new C2424(str, map, hashSet, hashSet2);
                } finally {
                }
            } finally {
            }
        } finally {
        }
    }

    public boolean equals(Object obj) {
        Set<C2428> set;
        if (this == obj) {
            return true;
        }
        if (obj == null || C2424.class != obj.getClass()) {
            return false;
        }
        C2424 c2424 = (C2424) obj;
        String str = this.f7679;
        if (str == null ? c2424.f7679 != null : !str.equals(c2424.f7679)) {
            return false;
        }
        Map<String, C2425> map = this.f7680;
        if (map == null ? c2424.f7680 != null : !map.equals(c2424.f7680)) {
            return false;
        }
        Set<C2426> set2 = this.f7681;
        if (set2 == null ? c2424.f7681 != null : !set2.equals(c2424.f7681)) {
            return false;
        }
        Set<C2428> set3 = this.f7682;
        if (set3 == null || (set = c2424.f7682) == null) {
            return true;
        }
        return set3.equals(set);
    }

    public int hashCode() {
        String str = this.f7679;
        int iHashCode = (str != null ? str.hashCode() : 0) * 31;
        Map<String, C2425> map = this.f7680;
        int iHashCode2 = (iHashCode + (map != null ? map.hashCode() : 0)) * 31;
        Set<C2426> set = this.f7681;
        return iHashCode2 + (set != null ? set.hashCode() : 0);
    }

    public String toString() {
        StringBuilder sbM4889 = C2803.m4889("TableInfo{name='");
        sbM4889.append(this.f7679);
        sbM4889.append('\'');
        sbM4889.append(", columns=");
        sbM4889.append(this.f7680);
        sbM4889.append(", foreignKeys=");
        sbM4889.append(this.f7681);
        sbM4889.append(", indices=");
        sbM4889.append(this.f7682);
        sbM4889.append('}');
        return sbM4889.toString();
    }
}
