package com.google.firebase.firestore.util; import android.media.AudioTrack; import android.os.Handler; import android.os.Looper; import android.os.Process; import android.text.AndroidCharacter; import android.text.TextUtils; import android.widget.ExpandableListView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.Task; import com.google.common.primitives.UnsignedBytes; import com.google.firebase.firestore.FieldPath; import com.google.firebase.firestore.FirebaseFirestoreException; import io.grpc.Status; import io.grpc.StatusException; import io.grpc.StatusRuntimeException; import java.lang.reflect.Method; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; import java.util.SortedSet; import o.GuL; import o.OKK; import o.QwV; import o.xzZ; /* loaded from: classes2.dex */ public class Util { private static final Continuation VOID_ERROR_TRANSFORMER; private static int c; private static long e; private static final Random rand; private static final byte[] $$a = {0, -67, 121, 0}; private static final int $$b = 242; private static int $10 = 0; private static int $11 = 1; private static int b = 0; private static void f(byte b2, byte b3, byte b4, Object[] objArr) { int i = b3 + 4; int i2 = 121 - (b2 * 2); int i3 = b4 * 4; byte[] bArr = $$a; byte[] bArr2 = new byte[1 - i3]; int i4 = 0 - i3; int i5 = -1; if (bArr == null) { i2 = i4 + (-i); i = i; i5 = -1; } while (true) { int i6 = i5 + 1; bArr2[i6] = (byte) i2; if (i6 == i4) { objArr[0] = new String(bArr2, 0); return; } int i7 = i + 1; i2 += -bArr[i7]; i = i7; i5 = i6; } } static { c = 1; a(); rand = new SecureRandom(); VOID_ERROR_TRANSFORMER = new Continuation() { // from class: com.google.firebase.firestore.util.Util$$ExternalSyntheticLambda3 @Override // com.google.android.gms.tasks.Continuation public final Object then(Task task) { return Util.lambda$static$0(task); } }; int i = b + 107; c = i % 128; if (i % 2 == 0) { int i2 = 84 / 0; } } public static String autoId() { int i = 2 % 2; StringBuilder sb = new StringBuilder(); int i2 = 0; while (i2 < 20) { int i3 = c + 33; b = i3 % 128; int i4 = i3 % 2; sb.append("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(rand.nextInt(62))); i2++; int i5 = c + 107; b = i5 % 128; int i6 = i5 % 2; } return sb.toString(); } private static void d(char[] cArr, int i, Object[] objArr) { int i2 = 2 % 2; GuL guL = new GuL(); char[] a = GuL.a(e ^ (-7538262848231253921L), cArr, i); int i3 = 4; guL.a = 4; while (guL.a < a.length) { int i4 = $11 + 63; $10 = i4 % 128; int i5 = i4 % 2; guL.c = guL.a - i3; int i6 = guL.a; try { Object[] objArr2 = {Long.valueOf(a[guL.a] ^ a[guL.a % i3]), Long.valueOf(guL.c), Long.valueOf(e)}; Object obj = xzZ.y.get(428080616); if (obj == null) { Class cls = (Class) xzZ.c(AndroidCharacter.getMirror('0') + 160, (AudioTrack.getMinVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMinVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 5, (char) (1706 - (Process.myTid() >> 22))); byte b2 = $$a[0]; byte b3 = (byte) (b2 + 1); Object[] objArr3 = new Object[1]; f(b3, (byte) (-b3), b2, objArr3); obj = cls.getMethod((String) objArr3[0], Long.TYPE, Long.TYPE, Long.TYPE); xzZ.y.put(428080616, obj); } a[i6] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); Object[] objArr4 = {guL, guL}; Object obj2 = xzZ.y.get(-1875914398); if (obj2 == null) { Class cls2 = (Class) xzZ.c(391 - ExpandableListView.getPackedPositionChild(0L), TextUtils.lastIndexOf("", '0') + 6, (char) (AudioTrack.getMinVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMinVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1))); byte b4 = $$a[0]; byte b5 = b4; Object[] objArr5 = new Object[1]; f(b5, (byte) (b5 - 1), b4, objArr5); obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class); xzZ.y.put(-1875914398, obj2); } ((Method) obj2).invoke(null, objArr4); int i7 = $11 + 47; $10 = i7 % 128; int i8 = i7 % 2; i3 = 4; } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } objArr[0] = new String(a, 4, a.length - 4); } public static int compareLongs(long j, long j2) { int i = 2 % 2; int i2 = c; int i3 = i2 + 15; int i4 = i3 % 128; b = i4; int i5 = i3 % 2; if (j < j2) { int i6 = i2 + 53; b = i6 % 128; int i7 = i6 % 2; return -1; } if (j > j2) { int i8 = i2 + 27; b = i8 % 128; int i9 = i8 % 2; return 1; } int i10 = i4 + 71; c = i10 % 128; int i11 = i10 % 2; return 0; } public static int compareDoubles(double d, double d2) { int i = 2 % 2; int i2 = c + 81; b = i2 % 128; int i3 = i2 % 2; int b2 = OKK.b(d, d2); if (i3 != 0) { int i4 = 83 / 0; } return b2; } public static int compareMixed(double d, long j) { int i = 2 % 2; int i2 = b + 37; c = i2 % 128; int i3 = i2 % 2; if (Double.isNaN(d) || d < -9.223372036854776E18d) { return -1; } if (d >= 9.223372036854776E18d) { return 1; } long j2 = (long) d; int i4 = j2 >= j ? j2 > j ? 1 : 0 : -1; if (i4 != 0) { int i5 = b + 121; c = i5 % 128; if (i5 % 2 == 0) { int i6 = 62 / 0; } return i4; } return OKK.b(d, j); } public static > Comparator comparator() { int i = 2 % 2; Comparator comparator = new Comparator() { // from class: com.google.firebase.firestore.util.Util$$ExternalSyntheticLambda2 @Override // java.util.Comparator public final int compare(Object obj, Object obj2) { return ((Comparable) obj).compareTo((Comparable) obj2); } }; int i2 = c + 61; b = i2 % 128; int i3 = i2 % 2; return comparator; } public static FirebaseFirestoreException exceptionFromStatus(Status status) { int i = 2 % 2; StatusException asException = status.asException(); FirebaseFirestoreException firebaseFirestoreException = new FirebaseFirestoreException(asException.getMessage(), FirebaseFirestoreException.Code.fromValue(status.getCode().value()), asException); int i2 = c + 123; b = i2 % 128; int i3 = i2 % 2; return firebaseFirestoreException; } private static Exception convertStatusException(Exception exc) { int i = 2 % 2; int i2 = b + 57; int i3 = i2 % 128; c = i3; if (i2 % 2 == 0) { boolean z = exc instanceof StatusException; throw null; } if (!(exc instanceof StatusException)) { return exc instanceof StatusRuntimeException ? exceptionFromStatus(((StatusRuntimeException) exc).getStatus()) : exc; } int i4 = i3 + 51; b = i4 % 128; int i5 = i4 % 2; FirebaseFirestoreException exceptionFromStatus = exceptionFromStatus(((StatusException) exc).getStatus()); int i6 = b + 69; c = i6 % 128; if (i6 % 2 != 0) { return exceptionFromStatus; } throw null; } /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ Void lambda$static$0(Task task) throws Exception { int i = 2 % 2; int i2 = c + 121; b = i2 % 128; int i3 = i2 % 2; if (!task.isSuccessful()) { Exception convertStatusException = convertStatusException(task.getException()); if (convertStatusException instanceof FirebaseFirestoreException) { throw convertStatusException; } throw new FirebaseFirestoreException(convertStatusException.getMessage(), FirebaseFirestoreException.Code.UNKNOWN, convertStatusException); } int i4 = b + 77; c = i4 % 128; if (i4 % 2 != 0) { return (Void) task.getResult(); } Object obj = null; obj.hashCode(); throw null; } public static List collectUpdateArguments(int i, Object obj, Object obj2, Object... objArr) { int i2 = 2 % 2; int i3 = c + 65; b = i3 % 128; int i4 = i3 % 2; if (objArr.length % 2 == 1) { throw new IllegalArgumentException("Missing value in call to update(). There must be an even number of arguments that alternate between field names and values"); } ArrayList arrayList = new ArrayList(); arrayList.add(obj); arrayList.add(obj2); Collections.addAll(arrayList, objArr); for (int i5 = 0; i5 < arrayList.size(); i5 += 2) { Object obj3 = arrayList.get(i5); if (!(obj3 instanceof String)) { int i6 = b + 45; c = i6 % 128; if (i6 % 2 == 0) { boolean z = obj3 instanceof FieldPath; throw null; } if (!(obj3 instanceof FieldPath)) { StringBuilder sb = new StringBuilder("Excepted field name at argument position "); sb.append(i5 + i + 1); sb.append(" but got "); sb.append(obj3); sb.append(" in call to update. The arguments to update should alternate between field names and values"); throw new IllegalArgumentException(sb.toString()); } } } return arrayList; } public static String toDebugString(QwV qwV) { int i = 2 % 2; int g = qwV.g(); StringBuilder sb = new StringBuilder(g << 1); int i2 = b + 41; c = i2 % 128; int i3 = i2 % 2; int i4 = 0; while (i4 < g) { int i5 = b + 101; c = i5 % 128; int i6 = i5 % 2; byte b2 = qwV.b(i4); sb.append(Character.forDigit((b2 & UnsignedBytes.MAX_VALUE) >>> 4, 16)); sb.append(Character.forDigit(b2 & 15, 16)); i4++; int i7 = b + 3; c = i7 % 128; int i8 = i7 % 2; } return sb.toString(); } public static String typeName(Object obj) { int i = 2 % 2; if (obj != null) { return obj.getClass().getName(); } int i2 = b + 1; c = i2 % 128; int i3 = i2 % 2; Object[] objArr = new Object[1]; d(new char[]{2758, 2728, 8526, 35293, 21378, 546, 43306, 21492}, TextUtils.indexOf((CharSequence) "", '0', 0, 0) + 1, objArr); String intern = ((String) objArr[0]).intern(); int i4 = b + 111; c = i4 % 128; int i5 = i4 % 2; return intern; } public static void crashMainThread(final RuntimeException runtimeException) { int i = 2 % 2; new Handler(Looper.getMainLooper()).post(new Runnable(runtimeException) { // from class: com.google.firebase.firestore.util.Util$$ExternalSyntheticLambda1 public final RuntimeException f$0; @Override // java.lang.Runnable public final void run() { Util.lambda$crashMainThread$1(this.f$0); } { this.f$0 = runtimeException; } }); int i2 = b + 11; c = i2 % 128; int i3 = i2 % 2; } /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ void lambda$crashMainThread$1(RuntimeException runtimeException) { int i = 2 % 2; int i2 = c + 93; b = i2 % 128; if (i2 % 2 == 0) { throw runtimeException; } Object obj = null; obj.hashCode(); throw null; } public static int compareByteArrays(byte[] bArr, byte[] bArr2) { int i = 2 % 2; int i2 = b + 117; c = i2 % 128; int i3 = i2 % 2; int min = Math.min(bArr.length, bArr2.length); for (int i4 = 0; i4 < min; i4++) { int i5 = bArr[i4] & UnsignedBytes.MAX_VALUE; int i6 = bArr2[i4] & UnsignedBytes.MAX_VALUE; if (i5 < i6) { int i7 = c + 107; b = i7 % 128; int i8 = i7 % 2; return -1; } if (i5 > i6) { return 1; } } return compareIntegers(bArr.length, bArr2.length); } public static int compareByteStrings(QwV qwV, QwV qwV2) { int i = 2 % 2; int min = Math.min(qwV.g(), qwV2.g()); for (int i2 = 0; i2 < min; i2++) { int i3 = b + 5; c = i3 % 128; int i4 = i3 % 2; int b2 = qwV.b(i2) & UnsignedBytes.MAX_VALUE; int b3 = qwV2.b(i2) & UnsignedBytes.MAX_VALUE; if (b2 < b3) { int i5 = b + 69; c = i5 % 128; if (i5 % 2 != 0) { return -1; } throw null; } if (b2 > b3) { int i6 = c + 125; b = i6 % 128; int i7 = i6 % 2; return 1; } } return compareIntegers(qwV.g(), qwV2.g()); } public static StringBuilder repeatSequence(CharSequence charSequence, int i, CharSequence charSequence2) { int i2 = 2 % 2; StringBuilder sb = new StringBuilder(); if (i != 0) { int i3 = c + 101; b = i3 % 128; int i4 = i3 % 2; sb.append(charSequence); for (int i5 = 1; i5 < i; i5++) { sb.append(charSequence2); sb.append(charSequence); } } int i6 = c + 99; b = i6 % 128; if (i6 % 2 == 0) { return sb; } throw null; } public static > void diffCollections(SortedSet sortedSet, SortedSet sortedSet2, Consumer consumer, Consumer consumer2) { Comparator comparator; int i = 2 % 2; int i2 = b + 105; c = i2 % 128; int i3 = i2 % 2; Iterator it = sortedSet.iterator(); Iterator it2 = sortedSet2.iterator(); if (sortedSet.comparator() != null) { int i4 = b + 103; c = i4 % 128; int i5 = i4 % 2; comparator = sortedSet.comparator(); } else { comparator = new Comparator() { // from class: com.google.firebase.firestore.util.Util$$ExternalSyntheticLambda4 @Override // java.util.Comparator public final int compare(Object obj, Object obj2) { return Util.lambda$diffCollections$2((Comparable) obj, (Comparable) obj2); } }; int i6 = c + 21; b = i6 % 128; int i7 = i6 % 2; } diffCollections(it, it2, comparator, consumer, consumer2); } /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ int lambda$diffCollections$2(Comparable comparable, Comparable comparable2) { int i = 2 % 2; int i2 = b + 111; c = i2 % 128; int i3 = i2 % 2; int compareTo = comparable.compareTo(comparable2); int i4 = b + 109; c = i4 % 128; int i5 = i4 % 2; return compareTo; } /* JADX WARN: Code restructure failed: missing block: B:12:0x0022, code lost: if (r2 != null) goto L14; */ /* JADX WARN: Code restructure failed: missing block: B:13:0x0027, code lost: r5 = r10.compare(r1, r2); */ /* JADX WARN: Code restructure failed: missing block: B:14:0x002b, code lost: if (r5 < 0) goto L20; */ /* JADX WARN: Code restructure failed: missing block: B:15:0x002d, code lost: if (r5 > 0) goto L19; */ /* JADX WARN: Code restructure failed: missing block: B:16:0x002f, code lost: r5 = com.google.firebase.firestore.util.Util.b + 1; com.google.firebase.firestore.util.Util.c = r5 % 128; r5 = r5 % 2; r3 = false; */ /* JADX WARN: Code restructure failed: missing block: B:30:0x003c, code lost: r5 = com.google.firebase.firestore.util.Util.b + 61; com.google.firebase.firestore.util.Util.c = r5 % 128; r5 = r5 % 2; */ /* JADX WARN: Code restructure failed: missing block: B:31:0x0046, code lost: r4 = true; r3 = false; */ /* JADX WARN: Code restructure failed: missing block: B:32:0x0025, code lost: if (r2 != null) goto L14; */ /* JADX WARN: Code restructure failed: missing block: B:33:0x003a, code lost: if (r1 == null) goto L19; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void diffCollections(java.util.Iterator r8, java.util.Iterator r9, java.util.Comparator r10, com.google.firebase.firestore.util.Consumer r11, com.google.firebase.firestore.util.Consumer r12) { /* r0 = 2 int r1 = r0 % r0 java.lang.Object r1 = advanceIterator(r8) java.lang.Object r2 = advanceIterator(r9) Lb: if (r1 != 0) goto L10 if (r2 != 0) goto L10 return L10: r3 = 1 r4 = 0 if (r1 == 0) goto L3a int r5 = com.google.firebase.firestore.util.Util.b int r5 = r5 + 67 int r6 = r5 % 128 com.google.firebase.firestore.util.Util.c = r6 int r5 = r5 % r0 if (r5 != 0) goto L25 r5 = 24 int r5 = r5 / r4 if (r2 == 0) goto L3a goto L27 L25: if (r2 == 0) goto L3a L27: int r5 = r10.compare(r1, r2) if (r5 < 0) goto L46 if (r5 > 0) goto L3c int r5 = com.google.firebase.firestore.util.Util.b int r5 = r5 + r3 int r3 = r5 % 128 com.google.firebase.firestore.util.Util.c = r3 int r5 = r5 % 2 r3 = r4 goto L49 L3a: if (r1 != 0) goto L46 L3c: int r5 = com.google.firebase.firestore.util.Util.b int r5 = r5 + 61 int r6 = r5 % 128 com.google.firebase.firestore.util.Util.c = r6 int r5 = r5 % r0 goto L49 L46: r7 = r4 r4 = r3 r3 = r7 L49: if (r3 == 0) goto L53 r11.accept(r2) java.lang.Object r2 = advanceIterator(r9) goto Lb L53: if (r4 == 0) goto L5d r12.accept(r1) java.lang.Object r1 = advanceIterator(r8) goto Lb L5d: java.lang.Object r1 = advanceIterator(r8) java.lang.Object r2 = advanceIterator(r9) goto Lb */ throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.firestore.util.Util.diffCollections(java.util.Iterator, java.util.Iterator, java.util.Comparator, com.google.firebase.firestore.util.Consumer, com.google.firebase.firestore.util.Consumer):void"); } private static T advanceIterator(Iterator it) { int i = 2 % 2; int i2 = b + 87; c = i2 % 128; int i3 = i2 % 2; if (it.hasNext()) { T next = it.next(); int i4 = c + 113; b = i4 % 128; int i5 = i4 % 2; return next; } int i6 = b + 7; c = i6 % 128; if (i6 % 2 == 0) { int i7 = 5 % 5; } return null; } /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ int lambda$firstNEntries$4(Comparator comparator, Map.Entry entry, Map.Entry entry2) { int i = 2 % 2; int i2 = b + 97; c = i2 % 128; int i3 = i2 % 2; int compare = comparator.compare(entry.getValue(), entry2.getValue()); int i4 = c + 103; b = i4 % 128; if (i4 % 2 == 0) { return compare; } throw null; } /* JADX WARN: Multi-variable type inference failed */ public static Map firstNEntries(Map map, int i, final Comparator comparator) { int i2 = 2 % 2; if (map.size() > i) { ArrayList arrayList = new ArrayList(map.entrySet()); Collections.sort(arrayList, new Comparator(comparator) { // from class: com.google.firebase.firestore.util.Util$$ExternalSyntheticLambda5 public final Comparator f$0; @Override // java.util.Comparator public final int compare(Object obj, Object obj2) { return Util.lambda$firstNEntries$4(this.f$0, (Map.Entry) obj, (Map.Entry) obj2); } { this.f$0 = comparator; } }); HashMap hashMap = new HashMap(); int i3 = b + 59; c = i3 % 128; int i4 = i3 % 2; for (int i5 = 0; i5 < i; i5++) { hashMap.put(((Map.Entry) arrayList.get(i5)).getKey(), ((Map.Entry) arrayList.get(i5)).getValue()); } int i6 = b + 93; c = i6 % 128; if (i6 % 2 == 0) { int i7 = 74 / 0; } return hashMap; } int i8 = c + 113; b = i8 % 128; if (i8 % 2 == 0) { return map; } throw null; } static void a() { e = -2743914203836419911L; } public static Continuation voidErrorTransformer() { int i = 2 % 2; int i2 = c + 73; b = i2 % 128; if (i2 % 2 == 0) { return VOID_ERROR_TRANSFORMER; } throw null; } public static int compareIntegers(int i, int i2) { int i3 = 2 % 2; if (i < i2) { int i4 = b + 77; c = i4 % 128; if (i4 % 2 == 0) { int i5 = 24 / 0; } return -1; } if (i > i2) { int i6 = b + 123; c = i6 % 128; int i7 = i6 % 2; return 1; } int i8 = c + 65; b = i8 % 128; if (i8 % 2 == 0) { return 0; } Object obj = null; obj.hashCode(); throw null; } public static int compareBooleans(boolean z, boolean z2) { int i = 2 % 2; int i2 = b; int i3 = i2 + 17; int i4 = i3 % 128; c = i4; if (i3 % 2 == 0) { throw null; } if (z == z2) { int i5 = i4 + 91; b = i5 % 128; int i6 = i5 % 2; return 0; } if (!z) { return -1; } int i7 = i2 + 125; c = i7 % 128; int i8 = i7 % 2; return 1; } }