package com.google.zxing.client.result;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import com.seewo.sdk.model.SDKKeyboardCode;
import java.util.HashMap;

/* JADX INFO: loaded from: classes.dex */
public final class ExpandedProductResultParser extends ResultParser {
    private static String findAIvalue(int i2, String str) {
        if (str.charAt(i2) != '(') {
            return null;
        }
        String strSubstring = str.substring(i2 + 1);
        StringBuilder sb = new StringBuilder();
        for (int i3 = 0; i3 < strSubstring.length(); i3++) {
            char cCharAt = strSubstring.charAt(i3);
            if (cCharAt == ')') {
                return sb.toString();
            }
            if (cCharAt < '0' || cCharAt > '9') {
                return null;
            }
            sb.append(cCharAt);
        }
        return sb.toString();
    }

    private static String findValue(int i2, String str) {
        StringBuilder sb = new StringBuilder();
        String strSubstring = str.substring(i2);
        for (int i3 = 0; i3 < strSubstring.length(); i3++) {
            char cCharAt = strSubstring.charAt(i3);
            if (cCharAt != '(') {
                sb.append(cCharAt);
            } else {
                if (findAIvalue(i3, strSubstring) != null) {
                    break;
                }
                sb.append('(');
            }
        }
        return sb.toString();
    }

    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    @Override // com.google.zxing.client.result.ResultParser
    public ExpandedProductParsedResult parse(Result result) {
        ExpandedProductParsedResult expandedProductParsedResult = null;
        if (result.getBarcodeFormat() != BarcodeFormat.RSS_EXPANDED) {
            return null;
        }
        String massagedText = ResultParser.getMassagedText(result);
        HashMap map = new HashMap();
        String str = null;
        String str2 = null;
        String str3 = null;
        String str4 = null;
        String str5 = null;
        String str6 = null;
        String str7 = null;
        String str8 = null;
        String str9 = null;
        String strSubstring = null;
        String strSubstring2 = null;
        String strSubstring3 = null;
        String strSubstring4 = null;
        int i2 = 0;
        while (i2 < massagedText.length()) {
            String strFindAIvalue = findAIvalue(i2, massagedText);
            if (strFindAIvalue == null) {
                return expandedProductParsedResult;
            }
            byte b2 = 2;
            int length = i2 + strFindAIvalue.length() + 2;
            String strFindValue = findValue(length, massagedText);
            int length2 = length + strFindValue.length();
            int iHashCode = strFindAIvalue.hashCode();
            String str10 = strSubstring2;
            String str11 = strSubstring;
            if (iHashCode == 1536) {
                b2 = strFindAIvalue.equals("00") ? (byte) 0 : (byte) -1;
            } else if (iHashCode == 1537) {
                b2 = strFindAIvalue.equals("01") ? (byte) 1 : (byte) -1;
            } else if (iHashCode != 1567) {
                if (iHashCode == 1568) {
                    b2 = strFindAIvalue.equals("11") ? (byte) 3 : (byte) -1;
                } else if (iHashCode == 1570) {
                    b2 = strFindAIvalue.equals("13") ? (byte) 4 : (byte) -1;
                } else if (iHashCode == 1572) {
                    b2 = strFindAIvalue.equals("15") ? (byte) 5 : (byte) -1;
                } else if (iHashCode != 1574) {
                    switch (iHashCode) {
                        case 1567966:
                            b2 = !strFindAIvalue.equals("3100") ? (byte) -1 : (byte) 7;
                            break;
                        case 1567967:
                            b2 = !strFindAIvalue.equals("3101") ? (byte) -1 : (byte) 8;
                            break;
                        case 1567968:
                            b2 = !strFindAIvalue.equals("3102") ? (byte) -1 : (byte) 9;
                            break;
                        case 1567969:
                            b2 = !strFindAIvalue.equals("3103") ? (byte) -1 : (byte) 10;
                            break;
                        case 1567970:
                            b2 = !strFindAIvalue.equals("3104") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_H;
                            break;
                        case 1567971:
                            b2 = !strFindAIvalue.equals("3105") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_I;
                            break;
                        case 1567972:
                            b2 = !strFindAIvalue.equals("3106") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_J;
                            break;
                        case 1567973:
                            b2 = !strFindAIvalue.equals("3107") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_K;
                            break;
                        case 1567974:
                            b2 = !strFindAIvalue.equals("3108") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_L;
                            break;
                        case 1567975:
                            b2 = !strFindAIvalue.equals("3109") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_M;
                            break;
                        default:
                            switch (iHashCode) {
                                case 1568927:
                                    b2 = !strFindAIvalue.equals("3200") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_N;
                                    break;
                                case 1568928:
                                    b2 = !strFindAIvalue.equals("3201") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_O;
                                    break;
                                case 1568929:
                                    b2 = !strFindAIvalue.equals("3202") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_P;
                                    break;
                                case 1568930:
                                    b2 = !strFindAIvalue.equals("3203") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_Q;
                                    break;
                                case 1568931:
                                    b2 = !strFindAIvalue.equals("3204") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_R;
                                    break;
                                case 1568932:
                                    b2 = !strFindAIvalue.equals("3205") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_S;
                                    break;
                                case 1568933:
                                    b2 = !strFindAIvalue.equals("3206") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_T;
                                    break;
                                case 1568934:
                                    b2 = !strFindAIvalue.equals("3207") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_U;
                                    break;
                                case 1568935:
                                    b2 = !strFindAIvalue.equals("3208") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_V;
                                    break;
                                case 1568936:
                                    b2 = !strFindAIvalue.equals("3209") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_W;
                                    break;
                                default:
                                    switch (iHashCode) {
                                        case 1575716:
                                            b2 = !strFindAIvalue.equals("3920") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_X;
                                            break;
                                        case 1575717:
                                            b2 = !strFindAIvalue.equals("3921") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_Y;
                                            break;
                                        case 1575718:
                                            b2 = !strFindAIvalue.equals("3922") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_Z;
                                            break;
                                        case 1575719:
                                            b2 = !strFindAIvalue.equals("3923") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_1;
                                            break;
                                        default:
                                            switch (iHashCode) {
                                                case 1575747:
                                                    b2 = !strFindAIvalue.equals("3930") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_2;
                                                    break;
                                                case 1575748:
                                                    b2 = !strFindAIvalue.equals("3931") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_3;
                                                    break;
                                                case 1575749:
                                                    b2 = !strFindAIvalue.equals("3932") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_4;
                                                    break;
                                                case 1575750:
                                                    b2 = !strFindAIvalue.equals("3933") ? (byte) -1 : SDKKeyboardCode.FUNCTION_KEY_BOARD_5;
                                                    break;
                                                default:
                                                    b2 = -1;
                                                    break;
                                            }
                                            break;
                                    }
                                    break;
                            }
                            break;
                    }
                } else {
                    b2 = strFindAIvalue.equals("17") ? (byte) 6 : (byte) -1;
                }
            } else if (!strFindAIvalue.equals("10")) {
                b2 = -1;
            }
            switch (b2) {
                case 0:
                    str2 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 1:
                    str = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 2:
                    str3 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 3:
                    str4 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 4:
                    str5 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 5:
                    str6 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 6:
                    str7 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                case 16:
                    strSubstring = strFindAIvalue.substring(3);
                    str9 = ExpandedProductParsedResult.KILOGRAM;
                    str8 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    expandedProductParsedResult = null;
                    break;
                case 17:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                case 24:
                case 25:
                case 26:
                    strSubstring = strFindAIvalue.substring(3);
                    str9 = ExpandedProductParsedResult.POUND;
                    str8 = strFindValue;
                    i2 = length2;
                    strSubstring2 = str10;
                    expandedProductParsedResult = null;
                    break;
                case 27:
                case 28:
                case 29:
                case 30:
                    strSubstring3 = strFindAIvalue.substring(3);
                    strSubstring2 = strFindValue;
                    i2 = length2;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                case 31:
                case 32:
                case 33:
                case 34:
                    if (strFindValue.length() < 4) {
                        return null;
                    }
                    strSubstring2 = strFindValue.substring(3);
                    strSubstring4 = strFindValue.substring(0, 3);
                    strSubstring3 = strFindAIvalue.substring(3);
                    i2 = length2;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
                default:
                    map.put(strFindAIvalue, strFindValue);
                    i2 = length2;
                    strSubstring2 = str10;
                    strSubstring = str11;
                    expandedProductParsedResult = null;
                    break;
            }
        }
        return new ExpandedProductParsedResult(massagedText, str, str2, str3, str4, str5, str6, str7, str8, str9, strSubstring, strSubstring2, strSubstring3, strSubstring4, map);
    }
}
