package o0; import android.database.Cursor; import com.google.android.gms.measurement.api.AppMeasurementSdk; 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; /* loaded from: classes.dex */ public class f { /* renamed from: a, reason: collision with root package name */ public final String f12600a; /* renamed from: b, reason: collision with root package name */ public final Map f12601b; /* renamed from: c, reason: collision with root package name */ public final Set f12602c; /* renamed from: d, reason: collision with root package name */ public final Set f12603d; public static class a { /* renamed from: a, reason: collision with root package name */ public final String f12604a; /* renamed from: b, reason: collision with root package name */ public final String f12605b; /* renamed from: c, reason: collision with root package name */ public final int f12606c; /* renamed from: d, reason: collision with root package name */ public final boolean f12607d; /* renamed from: e, reason: collision with root package name */ public final int f12608e; /* renamed from: f, reason: collision with root package name */ public final String f12609f; /* renamed from: g, reason: collision with root package name */ private final int f12610g; public a(String str, String str2, boolean z10, int i10, String str3, int i11) { this.f12604a = str; this.f12605b = str2; this.f12607d = z10; this.f12608e = i10; this.f12606c = a(str2); this.f12609f = str3; this.f12610g = i11; } private static int a(String str) { if (str == null) { return 5; } String upperCase = str.toUpperCase(Locale.US); if (upperCase.contains("INT")) { return 3; } if (upperCase.contains("CHAR") || upperCase.contains("CLOB") || upperCase.contains("TEXT")) { return 2; } if (upperCase.contains("BLOB")) { return 5; } return (upperCase.contains("REAL") || upperCase.contains("FLOA") || upperCase.contains("DOUB")) ? 4 : 1; } public boolean equals(Object obj) { String str; String str2; String str3; if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } a aVar = (a) obj; if (this.f12608e != aVar.f12608e || !this.f12604a.equals(aVar.f12604a) || this.f12607d != aVar.f12607d) { return false; } if (this.f12610g == 1 && aVar.f12610g == 2 && (str3 = this.f12609f) != null && !str3.equals(aVar.f12609f)) { return false; } if (this.f12610g == 2 && aVar.f12610g == 1 && (str2 = aVar.f12609f) != null && !str2.equals(this.f12609f)) { return false; } int i10 = this.f12610g; return (i10 == 0 || i10 != aVar.f12610g || ((str = this.f12609f) == null ? aVar.f12609f == null : str.equals(aVar.f12609f))) && this.f12606c == aVar.f12606c; } public int hashCode() { return (((((this.f12604a.hashCode() * 31) + this.f12606c) * 31) + (this.f12607d ? 1231 : 1237)) * 31) + this.f12608e; } public String toString() { return "Column{name='" + this.f12604a + "', type='" + this.f12605b + "', affinity='" + this.f12606c + "', notNull=" + this.f12607d + ", primaryKeyPosition=" + this.f12608e + ", defaultValue='" + this.f12609f + "'}"; } } public static class b { /* renamed from: a, reason: collision with root package name */ public final String f12611a; /* renamed from: b, reason: collision with root package name */ public final String f12612b; /* renamed from: c, reason: collision with root package name */ public final String f12613c; /* renamed from: d, reason: collision with root package name */ public final List f12614d; /* renamed from: e, reason: collision with root package name */ public final List f12615e; public b(String str, String str2, String str3, List list, List list2) { this.f12611a = str; this.f12612b = str2; this.f12613c = str3; this.f12614d = Collections.unmodifiableList(list); this.f12615e = Collections.unmodifiableList(list2); } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } b bVar = (b) obj; if (this.f12611a.equals(bVar.f12611a) && this.f12612b.equals(bVar.f12612b) && this.f12613c.equals(bVar.f12613c) && this.f12614d.equals(bVar.f12614d)) { return this.f12615e.equals(bVar.f12615e); } return false; } public int hashCode() { return (((((((this.f12611a.hashCode() * 31) + this.f12612b.hashCode()) * 31) + this.f12613c.hashCode()) * 31) + this.f12614d.hashCode()) * 31) + this.f12615e.hashCode(); } public String toString() { return "ForeignKey{referenceTable='" + this.f12611a + "', onDelete='" + this.f12612b + "', onUpdate='" + this.f12613c + "', columnNames=" + this.f12614d + ", referenceColumnNames=" + this.f12615e + '}'; } } static class c implements Comparable { /* renamed from: a, reason: collision with root package name */ final int f12616a; /* renamed from: b, reason: collision with root package name */ final int f12617b; /* renamed from: c, reason: collision with root package name */ final String f12618c; /* renamed from: d, reason: collision with root package name */ final String f12619d; c(int i10, int i11, String str, String str2) { this.f12616a = i10; this.f12617b = i11; this.f12618c = str; this.f12619d = str2; } @Override // java.lang.Comparable /* renamed from: a, reason: merged with bridge method [inline-methods] */ public int compareTo(c cVar) { int i10 = this.f12616a - cVar.f12616a; return i10 == 0 ? this.f12617b - cVar.f12617b : i10; } } public static class d { /* renamed from: a, reason: collision with root package name */ public final String f12620a; /* renamed from: b, reason: collision with root package name */ public final boolean f12621b; /* renamed from: c, reason: collision with root package name */ public final List f12622c; public d(String str, boolean z10, List list) { this.f12620a = str; this.f12621b = z10; this.f12622c = list; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } d dVar = (d) obj; if (this.f12621b == dVar.f12621b && this.f12622c.equals(dVar.f12622c)) { return this.f12620a.startsWith("index_") ? dVar.f12620a.startsWith("index_") : this.f12620a.equals(dVar.f12620a); } return false; } public int hashCode() { return ((((this.f12620a.startsWith("index_") ? -1184239155 : this.f12620a.hashCode()) * 31) + (this.f12621b ? 1 : 0)) * 31) + this.f12622c.hashCode(); } public String toString() { return "Index{name='" + this.f12620a + "', unique=" + this.f12621b + ", columns=" + this.f12622c + '}'; } } public f(String str, Map map, Set set, Set set2) { this.f12600a = str; this.f12601b = Collections.unmodifiableMap(map); this.f12602c = Collections.unmodifiableSet(set); this.f12603d = set2 == null ? null : Collections.unmodifiableSet(set2); } public static f a(p0.b bVar, String str) { return new f(str, b(bVar, str), d(bVar, str), f(bVar, str)); } private static Map b(p0.b bVar, String str) { Cursor c02 = bVar.c0("PRAGMA table_info(`" + str + "`)"); HashMap hashMap = new HashMap(); try { if (c02.getColumnCount() > 0) { int columnIndex = c02.getColumnIndex("name"); int columnIndex2 = c02.getColumnIndex("type"); int columnIndex3 = c02.getColumnIndex("notnull"); int columnIndex4 = c02.getColumnIndex("pk"); int columnIndex5 = c02.getColumnIndex("dflt_value"); while (c02.moveToNext()) { String string = c02.getString(columnIndex); hashMap.put(string, new a(string, c02.getString(columnIndex2), c02.getInt(columnIndex3) != 0, c02.getInt(columnIndex4), c02.getString(columnIndex5), 2)); } } return hashMap; } finally { c02.close(); } } private static List c(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 i10 = 0; i10 < count; i10++) { cursor.moveToPosition(i10); arrayList.add(new c(cursor.getInt(columnIndex), cursor.getInt(columnIndex2), cursor.getString(columnIndex3), cursor.getString(columnIndex4))); } Collections.sort(arrayList); return arrayList; } private static Set d(p0.b bVar, String str) { HashSet hashSet = new HashSet(); Cursor c02 = bVar.c0("PRAGMA foreign_key_list(`" + str + "`)"); try { int columnIndex = c02.getColumnIndex("id"); int columnIndex2 = c02.getColumnIndex("seq"); int columnIndex3 = c02.getColumnIndex("table"); int columnIndex4 = c02.getColumnIndex("on_delete"); int columnIndex5 = c02.getColumnIndex("on_update"); List c10 = c(c02); int count = c02.getCount(); for (int i10 = 0; i10 < count; i10++) { c02.moveToPosition(i10); if (c02.getInt(columnIndex2) == 0) { int i11 = c02.getInt(columnIndex); ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); for (c cVar : c10) { if (cVar.f12616a == i11) { arrayList.add(cVar.f12618c); arrayList2.add(cVar.f12619d); } } hashSet.add(new b(c02.getString(columnIndex3), c02.getString(columnIndex4), c02.getString(columnIndex5), arrayList, arrayList2)); } } return hashSet; } finally { c02.close(); } } private static d e(p0.b bVar, String str, boolean z10) { Cursor c02 = bVar.c0("PRAGMA index_xinfo(`" + str + "`)"); try { int columnIndex = c02.getColumnIndex("seqno"); int columnIndex2 = c02.getColumnIndex("cid"); int columnIndex3 = c02.getColumnIndex("name"); if (columnIndex != -1 && columnIndex2 != -1 && columnIndex3 != -1) { TreeMap treeMap = new TreeMap(); while (c02.moveToNext()) { if (c02.getInt(columnIndex2) >= 0) { treeMap.put(Integer.valueOf(c02.getInt(columnIndex)), c02.getString(columnIndex3)); } } ArrayList arrayList = new ArrayList(treeMap.size()); arrayList.addAll(treeMap.values()); return new d(str, z10, arrayList); } c02.close(); return null; } finally { c02.close(); } } private static Set f(p0.b bVar, String str) { Cursor c02 = bVar.c0("PRAGMA index_list(`" + str + "`)"); try { int columnIndex = c02.getColumnIndex("name"); int columnIndex2 = c02.getColumnIndex(AppMeasurementSdk.ConditionalUserProperty.ORIGIN); int columnIndex3 = c02.getColumnIndex("unique"); if (columnIndex != -1 && columnIndex2 != -1 && columnIndex3 != -1) { HashSet hashSet = new HashSet(); while (c02.moveToNext()) { if ("c".equals(c02.getString(columnIndex2))) { String string = c02.getString(columnIndex); boolean z10 = true; if (c02.getInt(columnIndex3) != 1) { z10 = false; } d e10 = e(bVar, string, z10); if (e10 == null) { return null; } hashSet.add(e10); } } return hashSet; } return null; } finally { c02.close(); } } public boolean equals(Object obj) { Set set; if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } f fVar = (f) obj; String str = this.f12600a; if (str == null ? fVar.f12600a != null : !str.equals(fVar.f12600a)) { return false; } Map map = this.f12601b; if (map == null ? fVar.f12601b != null : !map.equals(fVar.f12601b)) { return false; } Set set2 = this.f12602c; if (set2 == null ? fVar.f12602c != null : !set2.equals(fVar.f12602c)) { return false; } Set set3 = this.f12603d; if (set3 == null || (set = fVar.f12603d) == null) { return true; } return set3.equals(set); } public int hashCode() { String str = this.f12600a; int hashCode = (str != null ? str.hashCode() : 0) * 31; Map map = this.f12601b; int hashCode2 = (hashCode + (map != null ? map.hashCode() : 0)) * 31; Set set = this.f12602c; return hashCode2 + (set != null ? set.hashCode() : 0); } public String toString() { return "TableInfo{name='" + this.f12600a + "', columns=" + this.f12601b + ", foreignKeys=" + this.f12602c + ", indices=" + this.f12603d + '}'; } }