package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.zxing.ChecksumException; import com.google.zxing.FormatException; import com.google.zxing.NotFoundException; import com.google.zxing.ReaderException; import java.util.Arrays; import java.util.EnumMap; import java.util.Map; import org.bouncycastle.crypto.tls.CipherSuite; /* loaded from: classes2.dex */ public abstract class xue implements zIz { @Override // o.zIz public void c() { } public abstract WFF d(int i, C17416wdP c17416wdP, Map map) throws NotFoundException, ChecksumException, FormatException; @Override // o.zIz public WFF a(BKc bKc) throws NotFoundException, FormatException { return b(bKc, null); } @Override // o.zIz public WFF b(BKc bKc, Map map) throws NotFoundException, FormatException { try { return a(bKc, map); } catch (NotFoundException e) { if (map == null || !map.containsKey(CGg.TRY_HARDER) || !bKc.a.d.b()) { throw e; } BKc bKc2 = new BKc(bKc.a.d(bKc.a.d.e())); WFF a = a(bKc2, map); Map map2 = a.e; int i = 270; if (map2 != null && map2.containsKey(MoF.ORIENTATION)) { i = (((Integer) map2.get(MoF.ORIENTATION)).intValue() + 270) % 360; } a.b(MoF.ORIENTATION, Integer.valueOf(i)); qCz[] qczArr = a.c; if (qczArr != null) { int i2 = bKc2.a.d.c; for (int i3 = 0; i3 < qczArr.length; i3++) { qczArr[i3] = new qCz((i2 - qczArr[i3].e) - 1.0f, qczArr[i3].a); } } return a; } } private WFF a(BKc bKc, Map map) throws NotFoundException { Map map2; int i; int i2; BKc bKc2 = bKc; Map map3 = map; int i3 = bKc2.a.d.a; int i4 = bKc2.a.d.c; C17416wdP c17416wdP = new C17416wdP(i3); int i5 = 1; boolean z = map3 != null && map3.containsKey(CGg.TRY_HARDER); int max = Math.max(1, i4 >> (z ? 8 : 5)); int i6 = z ? i4 : 15; int i7 = i4 / 2; int i8 = 0; while (i8 < i6) { int i9 = i8 + 1; int i10 = i9 / 2; if ((i8 & 1) != 0) { i10 = -i10; } int i11 = (i10 * max) + i7; if (i11 < 0 || i11 >= i4) { break; } try { c17416wdP = bKc2.a.e(i11, c17416wdP); int i12 = 0; while (i12 < 2) { if (i12 == i5) { c17416wdP.c(); if (map3 != null && map3.containsKey(CGg.NEED_RESULT_POINT_CALLBACK)) { EnumMap enumMap = new EnumMap(CGg.class); enumMap.putAll(map3); enumMap.remove(CGg.NEED_RESULT_POINT_CALLBACK); map3 = enumMap; } } try { WFF d = d(i11, c17416wdP, map3); if (i12 == i5) { try { d.b(MoF.ORIENTATION, Integer.valueOf(CipherSuite.TLS_DHE_PSK_WITH_NULL_SHA256)); qCz[] qczArr = d.c; if (qczArr != null) { float f = i3; map2 = map3; try { i = i3; } catch (ReaderException unused) { i = i3; i2 = 1; i12++; i5 = i2; map3 = map2; i3 = i; } try { qczArr[0] = new qCz((f - qczArr[0].a) - 1.0f, qczArr[0].e); i2 = 1; try { qczArr[1] = new qCz((f - qczArr[1].a) - 1.0f, qczArr[1].e); } catch (ReaderException unused2) { continue; i12++; i5 = i2; map3 = map2; i3 = i; } } catch (ReaderException unused3) { i2 = 1; i12++; i5 = i2; map3 = map2; i3 = i; } } } catch (ReaderException unused4) { map2 = map3; } } return d; } catch (ReaderException unused5) { map2 = map3; i = i3; i2 = i5; } } } catch (NotFoundException unused6) { } bKc2 = bKc; i5 = i5; i8 = i9; i3 = i3; } throw NotFoundException.b(); } /* JADX INFO: Access modifiers changed from: protected */ public static void b(C17416wdP c17416wdP, int i, int[] iArr) throws NotFoundException { int length = iArr.length; Arrays.fill(iArr, 0, length, 0); int i2 = c17416wdP.d; if (i >= i2) { throw NotFoundException.b(); } boolean z = !((c17416wdP.a[i / 32] & (1 << (i & 31))) != 0); int i3 = 0; while (i < i2) { if (((c17416wdP.a[i / 32] & (1 << (i & 31))) != 0) != z) { iArr[i3] = iArr[i3] + 1; } else { i3++; if (i3 == length) { break; } iArr[i3] = 1; z = !z; } i++; } if (i3 != length) { if (i3 != length - 1 || i != i2) { throw NotFoundException.b(); } } } /* JADX INFO: Access modifiers changed from: protected */ public static void a(C17416wdP c17416wdP, int i, int[] iArr) throws NotFoundException { int length = iArr.length; boolean z = (c17416wdP.a[i / 32] & (1 << (i & 31))) != 0; while (i > 0 && length >= 0) { i--; if (((c17416wdP.a[i / 32] & (1 << (i & 31))) != 0) != z) { length--; z = !z; } } if (length >= 0) { throw NotFoundException.b(); } b(c17416wdP, i + 1, iArr); } public static float b(int[] iArr, int[] iArr2, float f) { int length = iArr.length; int i = 0; int i2 = 0; for (int i3 = 0; i3 < length; i3++) { i += iArr[i3]; i2 += iArr2[i3]; } if (i < i2) { return Float.POSITIVE_INFINITY; } float f2 = i; float f3 = f2 / i2; float f4 = BitmapDescriptorFactory.HUE_RED; for (int i4 = 0; i4 < length; i4++) { float f5 = iArr2[i4] * f3; float f6 = iArr[i4]; float f7 = f6 > f5 ? f6 - f5 : f5 - f6; if (f7 > f * f3) { return Float.POSITIVE_INFINITY; } f4 += f7; } return f4 / f2; } }