package com.google.zxing.oned;

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.Result;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitArray;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public final class Code128Reader extends OneDReader
{
  private static final int CODE_CODE_A = 101;
  private static final int CODE_CODE_B = 100;
  private static final int CODE_CODE_C = 99;
  private static final int CODE_FNC_1 = 102;
  private static final int CODE_FNC_2 = 97;
  private static final int CODE_FNC_3 = 96;
  private static final int CODE_FNC_4_A = 101;
  private static final int CODE_FNC_4_B = 100;
  static final int[][] CODE_PATTERNS = { { 2, 1, 2, 2, 2, 2 }, { 2, 2, 2, 1, 2, 2 }, { 2, 2, 2, 2, 2, 1 }, { 1, 2, 1, 2, 2, 3 }, { 1, 2, 1, 3, 2, 2 }, { 1, 3, 1, 2, 2, 2 }, { 1, 2, 2, 2, 1, 3 }, { 1, 2, 2, 3, 1, 2 }, { 1, 3, 2, 2, 1, 2 }, { 2, 2, 1, 2, 1, 3 }, { 2, 2, 1, 3, 1, 2 }, { 2, 3, 1, 2, 1, 2 }, { 1, 1, 2, 2, 3, 2 }, { 1, 2, 2, 1, 3, 2 }, { 1, 2, 2, 2, 3, 1 }, { 1, 1, 3, 2, 2, 2 }, { 1, 2, 3, 1, 2, 2 }, { 1, 2, 3, 2, 2, 1 }, { 2, 2, 3, 2, 1, 1 }, { 2, 2, 1, 1, 3, 2 }, { 2, 2, 1, 2, 3, 1 }, { 2, 1, 3, 2, 1, 2 }, { 2, 2, 3, 1, 1, 2 }, { 3, 1, 2, 1, 3, 1 }, { 3, 1, 1, 2, 2, 2 }, { 3, 2, 1, 1, 2, 2 }, { 3, 2, 1, 2, 2, 1 }, { 3, 1, 2, 2, 1, 2 }, { 3, 2, 2, 1, 1, 2 }, { 3, 2, 2, 2, 1, 1 }, { 2, 1, 2, 1, 2, 3 }, {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1 }, { 1, 1, 1, 2, 4, 2 }, { 1, 2, 1, 1, 4, 2 }, { 1, 2, 1, 2, 4, 1 }, { 1, 1, 4, 2, 1, 2 }, { 1, 2, 4, 1, 1, 2 }, { 1, 2, 4, 2, 1, 1 }, { 4, 1, 1, 2, 1, 2 }, { 4, 2, 1, 1, 1, 2 }, { 4, 2, 1, 2, 1, 1 }, { 2, 1, 2, 1, 4, 1 }, { 2, 1, 4, 1, 2, 1 }, { 4, 1, 2, 1, 2, 1 }, { 1, 1, 1, 1, 4, 3 }, { 1, 1, 1, 3, 4, 1 }, { 1, 3, 1, 1, 4, 1 }, { 1, 1, 4, 1, 1, 3 }, { 1, 1, 4, 3, 1, 1 }, { 4, 1, 1, 1, 1, 3 }, { 4, 1, 1, 3, 1, 1 }, { 1, 1, 3, 1, 4, 1 }, { 1, 1, 4, 1, 3, 1 }, { 3, 1, 1, 1, 4, 1 }, { 4, 1, 1, 1, 3, 1 }, { 2, 1, 1, 4, 1, 2 }, { 2, 1, 1, 2, 1, 4 }, { 2, 1, 1, 2, 3, 2 }, { 2, 3, 3, 1, 1, 1, 2 } };
  private static final int CODE_SHIFT = 98;
  private static final int CODE_START_A = 103;
  private static final int CODE_START_B = 104;
  private static final int CODE_START_C = 105;
  private static final int CODE_STOP = 106;
  private static final float MAX_AVG_VARIANCE = 0.25F;
  private static final float MAX_INDIVIDUAL_VARIANCE = 0.7F;

  private static int decodeCode(BitArray paramBitArray, int[] paramArrayOfInt, int paramInt)
    throws NotFoundException
  {
    recordPattern(paramBitArray, paramInt, paramArrayOfInt);
    float f1 = 0.25F;
    int i = -1;
    for (int j = 0; ; j++)
    {
      if (j >= CODE_PATTERNS.length)
      {
        if (i < 0)
          break;
        return i;
      }
      float f2 = patternMatchVariance(paramArrayOfInt, CODE_PATTERNS[j], 0.7F);
      if (f2 < f1)
      {
        f1 = f2;
        i = j;
      }
    }
    throw NotFoundException.getNotFoundInstance();
  }

  private static int[] findStartPattern(BitArray paramBitArray)
    throws NotFoundException
  {
    int i = paramBitArray.getSize();
    int j = paramBitArray.getNextSet(0);
    int k = 0;
    int[] arrayOfInt = new int[6];
    int m = j;
    int n = 0;
    int i1 = arrayOfInt.length;
    for (int i2 = j; ; i2++)
    {
      if (i2 >= i)
        throw NotFoundException.getNotFoundInstance();
      if ((n ^ paramBitArray.get(i2)) == 0)
        break;
      arrayOfInt[k] = (1 + arrayOfInt[k]);
    }
    if (k == i1 - 1)
    {
      float f1 = 0.25F;
      int i3 = -1;
      for (int i4 = 103; ; i4++)
      {
        if (i4 > 105)
        {
          if ((i3 < 0) || (!paramBitArray.isRange(Math.max(0, m - (i2 - m) / 2), m, false)))
            break;
          return new int[] { m, i2, i3 };
        }
        float f2 = patternMatchVariance(arrayOfInt, CODE_PATTERNS[i4], 0.7F);
        if (f2 < f1)
        {
          f1 = f2;
          i3 = i4;
        }
      }
      m += arrayOfInt[0] + arrayOfInt[1];
      System.arraycopy(arrayOfInt, 2, arrayOfInt, 0, i1 - 2);
      arrayOfInt[(i1 - 2)] = 0;
      arrayOfInt[(i1 - 1)] = 0;
      k--;
      label228: arrayOfInt[k] = 1;
      if (n == 0)
        break label250;
    }
    label250: for (n = 0; ; n = 1)
    {
      break;
      k++;
      break label228;
    }
  }

  public Result decodeRow(int paramInt, BitArray paramBitArray, Map<DecodeHintType, ?> paramMap)
    throws NotFoundException, FormatException, ChecksumException
  {
    if ((paramMap != null) && (paramMap.containsKey(DecodeHintType.ASSUME_GS1)));
    int[] arrayOfInt1;
    int j;
    ArrayList localArrayList;
    for (int i = 1; ; i = 0)
    {
      arrayOfInt1 = findStartPattern(paramBitArray);
      j = arrayOfInt1[2];
      localArrayList = new ArrayList(20);
      localArrayList.add(Byte.valueOf((byte)j));
      switch (j)
      {
      default:
        throw FormatException.getFormatInstance();
      case 103:
      case 104:
      case 105:
      }
    }
    int k = 101;
    int m = 0;
    int n = 0;
    StringBuilder localStringBuilder = new StringBuilder(20);
    int i1 = arrayOfInt1[0];
    int i2 = arrayOfInt1[1];
    int[] arrayOfInt2 = new int[6];
    int i3 = 0;
    int i4 = 0;
    int i5 = j;
    int i6 = 0;
    int i7 = 1;
    int i8 = 0;
    int i9 = 0;
    int i13;
    int i10;
    int i12;
    label294: 
    do
    {
      if (m != 0)
      {
        i13 = i2 - i1;
        int i14 = paramBitArray.getNextUnset(i2);
        if (paramBitArray.isRange(i14, Math.min(paramBitArray.getSize(), i14 + (i14 - i1) / 2), false))
          break label1162;
        throw NotFoundException.getNotFoundInstance();
        k = 100;
        break;
        k = 99;
        break;
      }
      i10 = n;
      i3 = i4;
      i4 = decodeCode(paramBitArray, arrayOfInt2, i2);
      localArrayList.add(Byte.valueOf((byte)i4));
      if (i4 != 106)
        i7 = 1;
      if (i4 != 106)
      {
        i6++;
        i5 += i6 * i4;
      }
      i1 = i2;
      int i11 = arrayOfInt2.length;
      i12 = 0;
      if (i12 < i11)
        break label379;
      switch (i4)
      {
      default:
        n = 0;
        switch (k)
        {
        default:
        case 101:
        case 100:
        case 99:
        }
        break;
      case 103:
      case 104:
      case 105:
      }
    }
    while (i10 == 0);
    if (k == 101);
    for (k = 100; ; k = 101)
    {
      break;
      label379: i2 += arrayOfInt2[i12];
      i12++;
      break label294;
      throw FormatException.getFormatInstance();
      if (i4 < 64)
      {
        if (i9 == i8)
          localStringBuilder.append((char)(i4 + 32));
        while (true)
        {
          n = 0;
          i9 = 0;
          break;
          localStringBuilder.append((char)(128 + (i4 + 32)));
        }
      }
      if (i4 < 96)
      {
        if (i9 == i8)
          localStringBuilder.append((char)(i4 - 64));
        while (true)
        {
          n = 0;
          i9 = 0;
          break;
          localStringBuilder.append((char)(i4 + 64));
        }
      }
      if (i4 != 106)
        i7 = 0;
      n = 0;
      switch (i4)
      {
      case 96:
      case 97:
      case 103:
      case 104:
      case 105:
      default:
        n = 0;
        break;
      case 98:
        n = 1;
        k = 100;
        break;
      case 102:
        n = 0;
        if (i == 0)
          break;
        if (localStringBuilder.length() == 0)
        {
          localStringBuilder.append("]C1");
          n = 0;
          break;
        }
        localStringBuilder.append('\035');
        n = 0;
        break;
      case 101:
        if ((i8 == 0) && (i9 != 0))
        {
          i8 = 1;
          n = 0;
          i9 = 0;
          break;
        }
        if ((i8 != 0) && (i9 != 0))
        {
          n = 0;
          i9 = 0;
          i8 = 0;
          break;
        }
        i9 = 1;
        n = 0;
        break;
      case 100:
        k = 100;
        n = 0;
        break;
      case 99:
        k = 99;
        n = 0;
        break;
      case 106:
        m = 1;
        n = 0;
        break;
        if (i4 < 96)
        {
          if (i9 == i8)
            localStringBuilder.append((char)(i4 + 32));
          while (true)
          {
            n = 0;
            i9 = 0;
            break;
            localStringBuilder.append((char)(128 + (i4 + 32)));
          }
        }
        if (i4 != 106)
          i7 = 0;
        n = 0;
        switch (i4)
        {
        case 96:
        case 97:
        case 103:
        case 104:
        case 105:
        default:
          n = 0;
          break;
        case 98:
          n = 1;
          k = 101;
          break;
        case 102:
          n = 0;
          if (i == 0)
            break;
          if (localStringBuilder.length() == 0)
          {
            localStringBuilder.append("]C1");
            n = 0;
            break;
          }
          localStringBuilder.append('\035');
          n = 0;
          break;
        case 100:
          if ((i8 == 0) && (i9 != 0))
          {
            i8 = 1;
            n = 0;
            i9 = 0;
            break;
          }
          if ((i8 != 0) && (i9 != 0))
          {
            n = 0;
            i9 = 0;
            i8 = 0;
            break;
          }
          i9 = 1;
          n = 0;
          break;
        case 101:
          k = 101;
          n = 0;
          break;
        case 99:
          k = 99;
          n = 0;
          break;
        case 106:
          m = 1;
          n = 0;
          break;
          if (i4 < 100)
          {
            if (i4 < 10)
              localStringBuilder.append('0');
            localStringBuilder.append(i4);
            n = 0;
            break;
          }
          if (i4 != 106)
            i7 = 0;
          switch (i4)
          {
          case 103:
          case 104:
          case 105:
          default:
            n = 0;
            break;
          case 100:
            k = 100;
            n = 0;
            break;
          case 102:
            n = 0;
            if (i == 0)
              break;
            if (localStringBuilder.length() == 0)
            {
              localStringBuilder.append("]C1");
              n = 0;
              break;
            }
            localStringBuilder.append('\035');
            n = 0;
            break;
          case 101:
            k = 101;
            n = 0;
            break;
          case 106:
            m = 1;
            n = 0;
            break;
          }
          break;
        }
        break;
      }
    }
    label1162: if ((i5 - i6 * i3) % 103 != i3)
      throw ChecksumException.getChecksumInstance();
    int i15 = localStringBuilder.length();
    if (i15 == 0)
      throw NotFoundException.getNotFoundInstance();
    float f1;
    float f2;
    int i16;
    byte[] arrayOfByte;
    if ((i15 > 0) && (i7 != 0))
    {
      if (k == 99)
        localStringBuilder.delete(i15 - 2, i15);
    }
    else
    {
      f1 = (arrayOfInt1[1] + arrayOfInt1[0]) / 2.0F;
      f2 = i1 + i13 / 2.0F;
      i16 = localArrayList.size();
      arrayOfByte = new byte[i16];
    }
    for (int i17 = 0; ; i17++)
    {
      if (i17 >= i16)
      {
        String str = localStringBuilder.toString();
        ResultPoint[] arrayOfResultPoint = new ResultPoint[2];
        ResultPoint localResultPoint1 = new ResultPoint(f1, paramInt);
        arrayOfResultPoint[0] = localResultPoint1;
        ResultPoint localResultPoint2 = new ResultPoint(f2, paramInt);
        arrayOfResultPoint[1] = localResultPoint2;
        Result localResult = new Result(str, arrayOfByte, arrayOfResultPoint, BarcodeFormat.CODE_128);
        return localResult;
        localStringBuilder.delete(i15 - 1, i15);
        break;
      }
      arrayOfByte[i17] = ((Byte)localArrayList.get(i17)).byteValue();
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.zxing.oned.Code128Reader
 * JD-Core Version:    0.6.2
 */