package zb;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultMetadataType;
import java.util.ArrayList;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class b extends j {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final int[][] f37127a = {new int[]{2, 1, 2, 2, 2, 2}, new int[]{2, 2, 2, 1, 2, 2}, new int[]{2, 2, 2, 2, 2, 1}, new int[]{1, 2, 1, 2, 2, 3}, new int[]{1, 2, 1, 3, 2, 2}, new int[]{1, 3, 1, 2, 2, 2}, new int[]{1, 2, 2, 2, 1, 3}, new int[]{1, 2, 2, 3, 1, 2}, new int[]{1, 3, 2, 2, 1, 2}, new int[]{2, 2, 1, 2, 1, 3}, new int[]{2, 2, 1, 3, 1, 2}, new int[]{2, 3, 1, 2, 1, 2}, new int[]{1, 1, 2, 2, 3, 2}, new int[]{1, 2, 2, 1, 3, 2}, new int[]{1, 2, 2, 2, 3, 1}, new int[]{1, 1, 3, 2, 2, 2}, new int[]{1, 2, 3, 1, 2, 2}, new int[]{1, 2, 3, 2, 2, 1}, new int[]{2, 2, 3, 2, 1, 1}, new int[]{2, 2, 1, 1, 3, 2}, new int[]{2, 2, 1, 2, 3, 1}, new int[]{2, 1, 3, 2, 1, 2}, new int[]{2, 2, 3, 1, 1, 2}, new int[]{3, 1, 2, 1, 3, 1}, new int[]{3, 1, 1, 2, 2, 2}, new int[]{3, 2, 1, 1, 2, 2}, new int[]{3, 2, 1, 2, 2, 1}, new int[]{3, 1, 2, 2, 1, 2}, new int[]{3, 2, 2, 1, 1, 2}, new int[]{3, 2, 2, 2, 1, 1}, new int[]{2, 1, 2, 1, 2, 3}, new int[]{2, 1, 2, 3, 2, 1}, new int[]{2, 3, 2, 1, 2, 1}, new int[]{1, 1, 1, 3, 2, 3}, new int[]{1, 3, 1, 1, 2, 3}, new int[]{1, 3, 1, 3, 2, 1}, new int[]{1, 1, 2, 3, 1, 3}, new int[]{1, 3, 2, 1, 1, 3}, new int[]{1, 3, 2, 3, 1, 1}, new int[]{2, 1, 1, 3, 1, 3}, new int[]{2, 3, 1, 1, 1, 3}, new int[]{2, 3, 1, 3, 1, 1}, new int[]{1, 1, 2, 1, 3, 3}, new int[]{1, 1, 2, 3, 3, 1}, new int[]{1, 3, 2, 1, 3, 1}, new int[]{1, 1, 3, 1, 2, 3}, new int[]{1, 1, 3, 3, 2, 1}, new int[]{1, 3, 3, 1, 2, 1}, new int[]{3, 1, 3, 1, 2, 1}, new int[]{2, 1, 1, 3, 3, 1}, new int[]{2, 3, 1, 1, 3, 1}, new int[]{2, 1, 3, 1, 1, 3}, new int[]{2, 1, 3, 3, 1, 1}, new int[]{2, 1, 3, 1, 3, 1}, new int[]{3, 1, 1, 1, 2, 3}, new int[]{3, 1, 1, 3, 2, 1}, new int[]{3, 3, 1, 1, 2, 1}, new int[]{3, 1, 2, 1, 1, 3}, new int[]{3, 1, 2, 3, 1, 1}, new int[]{3, 3, 2, 1, 1, 1}, new int[]{3, 1, 4, 1, 1, 1}, new int[]{2, 2, 1, 4, 1, 1}, new int[]{4, 3, 1, 1, 1, 1}, new int[]{1, 1, 1, 2, 2, 4}, new int[]{1, 1, 1, 4, 2, 2}, new int[]{1, 2, 1, 1, 2, 4}, new int[]{1, 2, 1, 4, 2, 1}, new int[]{1, 4, 1, 1, 2, 2}, new int[]{1, 4, 1, 2, 2, 1}, new int[]{1, 1, 2, 2, 1, 4}, new int[]{1, 1, 2, 4, 1, 2}, new int[]{1, 2, 2, 1, 1, 4}, new int[]{1, 2, 2, 4, 1, 1}, new int[]{1, 4, 2, 1, 1, 2}, new int[]{1, 4, 2, 2, 1, 1}, new int[]{2, 4, 1, 2, 1, 1}, new int[]{2, 2, 1, 1, 1, 4}, new int[]{4, 1, 3, 1, 1, 1}, new int[]{2, 4, 1, 1, 1, 2}, new int[]{1, 3, 4, 1, 1, 1}, new int[]{1, 1, 1, 2, 4, 2}, new int[]{1, 2, 1, 1, 4, 2}, new int[]{1, 2, 1, 2, 4, 1}, new int[]{1, 1, 4, 2, 1, 2}, new int[]{1, 2, 4, 1, 1, 2}, new int[]{1, 2, 4, 2, 1, 1}, new int[]{4, 1, 1, 2, 1, 2}, new int[]{4, 2, 1, 1, 1, 2}, new int[]{4, 2, 1, 2, 1, 1}, new int[]{2, 1, 2, 1, 4, 1}, new int[]{2, 1, 4, 1, 2, 1}, new int[]{4, 1, 2, 1, 2, 1}, new int[]{1, 1, 1, 1, 4, 3}, new int[]{1, 1, 1, 3, 4, 1}, new int[]{1, 3, 1, 1, 4, 1}, new int[]{1, 1, 4, 1, 1, 3}, new int[]{1, 1, 4, 3, 1, 1}, new int[]{4, 1, 1, 1, 1, 3}, new int[]{4, 1, 1, 3, 1, 1}, new int[]{1, 1, 3, 1, 4, 1}, new int[]{1, 1, 4, 1, 3, 1}, new int[]{3, 1, 1, 1, 4, 1}, new int[]{4, 1, 1, 1, 3, 1}, new int[]{2, 1, 1, 4, 1, 2}, new int[]{2, 1, 1, 2, 1, 4}, new int[]{2, 1, 1, 2, 3, 2}, new int[]{2, 3, 3, 1, 1, 1, 2}};

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Removed duplicated region for block: B:35:0x00a9  */
    /* JADX WARN: Removed duplicated region for block: B:69:0x012a A[FALL_THROUGH, PHI: r24 r25
      0x012a: PHI (r24v10 int) = (r24v1 int), (r24v6 int), (r24v6 int), (r24v6 int), (r24v1 int), (r24v12 int), (r24v12 int), (r24v12 int) binds: [B:103:0x018f, B:111:0x01a5, B:115:0x01b1, B:114:0x01ad, B:68:0x0127, B:76:0x013e, B:80:0x014a, B:79:0x0146] A[DONT_GENERATE, DONT_INLINE]
      0x012a: PHI (r25v13 int) = (r25v5 int), (r25v5 int), (r25v5 int), (r25v5 int), (r25v14 int), (r25v14 int), (r25v14 int), (r25v14 int) binds: [B:103:0x018f, B:111:0x01a5, B:115:0x01b1, B:114:0x01ad, B:68:0x0127, B:76:0x013e, B:80:0x014a, B:79:0x0146] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:91:0x0166 A[PHI: r25
      0x0166: PHI (r25v9 int) = (r25v5 int), (r25v14 int) binds: [B:103:0x018f, B:68:0x0127] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:93:0x016c A[PHI: r25
      0x016c: PHI (r25v8 int) = (r25v5 int), (r25v14 int) binds: [B:103:0x018f, B:68:0x0127] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:94:0x0170 A[PHI: r25
      0x0170: PHI (r25v7 int) = (r25v5 int), (r25v14 int) binds: [B:102:0x018d, B:67:0x0125] A[DONT_GENERATE, DONT_INLINE]] */
    @Override // zb.j
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final ob.f c(int i10, tb.a aVar, Map map) throws NotFoundException, ChecksumException, FormatException {
        int[][] iArr;
        float f10;
        char c6;
        char c10;
        boolean z10;
        int i11 = 1;
        boolean z11 = map != null && map.containsKey(DecodeHintType.f24322g);
        int i12 = aVar.f33004b;
        int iE = aVar.e(0);
        int i13 = 6;
        int[] iArr2 = new int[6];
        boolean z12 = false;
        int i14 = 0;
        int i15 = iE;
        while (iE < i12) {
            if (aVar.d(iE) != z12) {
                iArr2[i14] = iArr2[i14] + i11;
            } else {
                if (i14 == 5) {
                    int i16 = 103;
                    int i17 = -1;
                    float f11 = 0.25f;
                    while (true) {
                        iArr = f37127a;
                        f10 = 0.7f;
                        if (i16 > 105) {
                            break;
                        }
                        float fE = j.e(iArr2, iArr[i16], 0.7f);
                        if (fE < f11) {
                            f11 = fE;
                            i17 = i16;
                        }
                        i16++;
                    }
                    if (i17 >= 0 && aVar.h(Math.max(0, i15 - ((iE - i15) / 2)), i15)) {
                        int[] iArr3 = {i15, iE, i17};
                        int i18 = iArr3[2];
                        ArrayList arrayList = new ArrayList(20);
                        arrayList.add(Byte.valueOf((byte) i18));
                        switch (i18) {
                            case 103:
                                c6 = 'e';
                                break;
                            case 104:
                                c6 = 'd';
                                break;
                            case 105:
                                c6 = 'c';
                                break;
                            default:
                                throw FormatException.a();
                        }
                        StringBuilder sb = new StringBuilder(20);
                        int[] iArr4 = new int[i13];
                        int i19 = i11;
                        char c11 = c6;
                        boolean z13 = false;
                        boolean z14 = false;
                        boolean z15 = false;
                        boolean z16 = false;
                        int i20 = 0;
                        int i21 = 0;
                        int i22 = 0;
                        int i23 = 0;
                        int i24 = iArr3[0];
                        int i25 = iArr3[i11];
                        while (!z15) {
                            j.f(i25, aVar, iArr4);
                            int i26 = -1;
                            float f12 = 0.25f;
                            for (int i27 = 0; i27 < 107; i27++) {
                                float fE2 = j.e(iArr4, iArr[i27], f10);
                                if (fE2 < f12) {
                                    f12 = fE2;
                                    i26 = i27;
                                }
                            }
                            if (i26 < 0) {
                                throw NotFoundException.a();
                            }
                            arrayList.add(Byte.valueOf((byte) i26));
                            if (i26 != 106) {
                                i19 = 1;
                            }
                            if (i26 != 106) {
                                i21++;
                                i18 = (i21 * i26) + i18;
                            }
                            int i28 = i25;
                            for (int i29 = 0; i29 < i13; i29++) {
                                i28 += iArr4[i29];
                            }
                            switch (i26) {
                                case 103:
                                case 104:
                                case 105:
                                    throw FormatException.a();
                                default:
                                    switch (c11) {
                                        case 'c':
                                            c10 = 'd';
                                            if (i26 >= 100) {
                                                if (i26 != 106) {
                                                    i19 = 0;
                                                }
                                                if (i26 == 106) {
                                                    z10 = false;
                                                    z15 = true;
                                                    break;
                                                } else {
                                                    switch (i26) {
                                                        case 100:
                                                            c11 = 'd';
                                                            break;
                                                        case 101:
                                                            z10 = false;
                                                            c11 = 'e';
                                                            break;
                                                        case 102:
                                                            if (sb.length() == 0) {
                                                                i23 = 1;
                                                            } else if (sb.length() == 1) {
                                                                i23 = 2;
                                                            }
                                                            if (z11) {
                                                                if (sb.length() == 0) {
                                                                    sb.append("]C1");
                                                                } else {
                                                                    sb.append((char) 29);
                                                                }
                                                            }
                                                            break;
                                                    }
                                                }
                                            } else {
                                                if (i26 < 10) {
                                                    sb.append('0');
                                                }
                                                sb.append(i26);
                                            }
                                            z10 = false;
                                            break;
                                        case 'd':
                                            if (i26 < 96) {
                                                if (z14 == z13) {
                                                    sb.append((char) (i26 + 32));
                                                } else {
                                                    sb.append((char) (i26 + 160));
                                                }
                                                z10 = false;
                                                c10 = 'd';
                                                z14 = false;
                                            } else {
                                                if (i26 != 106) {
                                                    i19 = 0;
                                                }
                                                if (i26 != 106) {
                                                    switch (i26) {
                                                        case 97:
                                                            z10 = false;
                                                            i23 = 4;
                                                            break;
                                                        case 98:
                                                            z10 = true;
                                                            c11 = 'e';
                                                            break;
                                                        case 99:
                                                            z10 = false;
                                                            c11 = 'c';
                                                            break;
                                                        case 100:
                                                            if (z13 || !z14) {
                                                                if (z13 && z14) {
                                                                    z10 = false;
                                                                    z13 = false;
                                                                }
                                                                z10 = false;
                                                                z14 = true;
                                                            } else {
                                                                z10 = false;
                                                                z13 = true;
                                                            }
                                                            z14 = false;
                                                            break;
                                                        case 101:
                                                            z10 = false;
                                                            c11 = 'e';
                                                            break;
                                                        case 102:
                                                            if (sb.length() == 0) {
                                                                i23 = 1;
                                                            } else if (sb.length() == 1) {
                                                                i23 = 2;
                                                            }
                                                            if (z11) {
                                                                if (sb.length() == 0) {
                                                                    sb.append("]C1");
                                                                } else {
                                                                    sb.append((char) 29);
                                                                }
                                                                break;
                                                            }
                                                        default:
                                                            z10 = false;
                                                            break;
                                                    }
                                                } else {
                                                    z10 = false;
                                                    z15 = true;
                                                }
                                                c10 = 'd';
                                            }
                                            break;
                                        case 'e':
                                            if (i26 >= 64) {
                                                if (i26 >= 96) {
                                                    if (i26 != 106) {
                                                        i19 = 0;
                                                    }
                                                    if (i26 != 106) {
                                                        switch (i26) {
                                                            case 98:
                                                                z10 = true;
                                                                c11 = 'd';
                                                                break;
                                                            case 100:
                                                                z10 = false;
                                                                c11 = 'd';
                                                                break;
                                                            case 101:
                                                                if (z13 || !z14) {
                                                                    if (z13 && z14) {
                                                                        z10 = false;
                                                                        z13 = false;
                                                                    }
                                                                    z10 = false;
                                                                    z14 = true;
                                                                } else {
                                                                    z10 = false;
                                                                    z13 = true;
                                                                }
                                                                z14 = false;
                                                                break;
                                                            case 102:
                                                                if (sb.length() == 0) {
                                                                    i23 = 1;
                                                                } else if (sb.length() == 1) {
                                                                    i23 = 2;
                                                                }
                                                                if (z11) {
                                                                    if (sb.length() == 0) {
                                                                        sb.append("]C1");
                                                                    } else {
                                                                        sb.append((char) 29);
                                                                    }
                                                                    break;
                                                                }
                                                        }
                                                    }
                                                    c10 = 'd';
                                                    break;
                                                } else if (z14 == z13) {
                                                    sb.append((char) (i26 - 64));
                                                } else {
                                                    sb.append((char) (i26 + 64));
                                                }
                                            } else if (z14 == z13) {
                                                sb.append((char) (i26 + 32));
                                            } else {
                                                sb.append((char) (i26 + 160));
                                            }
                                            z10 = false;
                                            c10 = 'd';
                                            z14 = false;
                                            break;
                                        default:
                                            c10 = 'd';
                                            z10 = false;
                                            break;
                                    }
                                    if (z16) {
                                        c11 = c11 == 'e' ? c10 : 'e';
                                    }
                                    z16 = z10;
                                    i24 = i25;
                                    i25 = i28;
                                    i13 = 6;
                                    f10 = 0.7f;
                                    i22 = i20;
                                    i20 = i26;
                                    break;
                            }
                            while (!z15) {
                            }
                        }
                        int i30 = i25 - i24;
                        int iF = aVar.f(i25);
                        if (!aVar.h(iF, Math.min(aVar.f33004b, ((iF - i24) / 2) + iF))) {
                            throw NotFoundException.a();
                        }
                        int i31 = i22;
                        if ((i18 - (i21 * i31)) % 103 != i31) {
                            throw ChecksumException.a();
                        }
                        int length = sb.length();
                        if (length == 0) {
                            throw NotFoundException.a();
                        }
                        if (length > 0 && i19 != 0) {
                            if (c11 == 'c') {
                                sb.delete(length - 2, length);
                            } else {
                                sb.delete(length - 1, length);
                            }
                        }
                        float f13 = (iArr3[1] + iArr3[0]) / 2.0f;
                        float f14 = (i30 / 2.0f) + i24;
                        int size = arrayList.size();
                        byte[] bArr = new byte[size];
                        for (int i32 = 0; i32 < size; i32++) {
                            bArr[i32] = ((Byte) arrayList.get(i32)).byteValue();
                        }
                        float f15 = i10;
                        ob.f fVar = new ob.f(sb.toString(), bArr, new ob.g[]{new ob.g(f13, f15), new ob.g(f14, f15)}, BarcodeFormat.f24306e);
                        fVar.b(ResultMetadataType.f24344m, "]C" + i23);
                        return fVar;
                    }
                    i15 += iArr2[0] + iArr2[1];
                    int i33 = i14 - 1;
                    System.arraycopy(iArr2, 2, iArr2, 0, i33);
                    iArr2[i33] = 0;
                    iArr2[i14] = 0;
                    i14--;
                } else {
                    i14++;
                }
                i11 = 1;
                iArr2[i14] = 1;
                z12 = !z12;
            }
            iE++;
            i13 = 6;
        }
        throw NotFoundException.a();
    }
}
