package com.l7tech.security.xml.transform;

import com.l7tech.common.mime.ContentTypeHeader;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

class a extends FilterInputStream {
   boolean a = false;
   byte b;
   private static final String[] c;

   private a(ContentTypeHeader var1, InputStream var2) throws IOException {
      super(var2);
      if (var1.isText()) {
         this.a = true;
      }
   }

   @Override
   public int read() throws IOException {
      throw new IOException(c[0]);
   }

   @Override
   public int read(byte[] param1, int param2, int param3) throws IOException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: aload 0
      // 01: getfield com/l7tech/security/xml/transform/a.a Z
      // 04: ifeq d9
      // 07: iload 3
      // 08: bipush 2
      // 09: if_icmpge 24
      // 0c: goto 13
      // 0f: invokestatic com/l7tech/security/xml/transform/a.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 12: athrow
      // 13: new java/io/IOException
      // 16: dup
      // 17: getstatic com/l7tech/security/xml/transform/a.c [Ljava/lang/String;
      // 1a: bipush 1
      // 1b: aaload
      // 1c: invokespecial java/io/IOException.<init> (Ljava/lang/String;)V
      // 1f: athrow
      // 20: invokestatic com/l7tech/security/xml/transform/a.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 23: athrow
      // 24: aload 0
      // 25: getfield com/l7tech/security/xml/transform/a.b B
      // 28: istore 4
      // 2a: aload 0
      // 2b: aload 1
      // 2c: iload 2
      // 2d: iload 3
      // 2e: getstatic com/l7tech/security/xml/transform/AttachmentContentOnlyTransform.CRLF [B
      // 31: arraylength
      // 32: idiv
      // 33: invokespecial java/io/FilterInputStream.read ([BII)I
      // 36: istore 5
      // 38: iload 5
      // 3a: ifle d6
      // 3d: aload 1
      // 3e: arraylength
      // 3f: invokestatic com/l7tech/util/BufferPool.getBuffer (I)[B
      // 42: astore 6
      // 44: aload 1
      // 45: iload 2
      // 46: aload 6
      // 48: bipush 0
      // 49: iload 5
      // 4b: invokestatic java/lang/System.arraycopy (Ljava/lang/Object;ILjava/lang/Object;II)V
      // 4e: bipush 0
      // 4f: istore 7
      // 51: bipush 0
      // 52: istore 8
      // 54: iload 8
      // 56: iload 5
      // 58: if_icmpge c1
      // 5b: aload 6
      // 5d: iload 2
      // 5e: iload 8
      // 60: iadd
      // 61: baload
      // 62: istore 9
      // 64: iload 4
      // 66: bipush 13
      // 68: if_icmpeq ac
      // 6b: iload 9
      // 6d: bipush 10
      // 6f: if_icmpne ac
      // 72: goto 79
      // 75: invokestatic com/l7tech/security/xml/transform/a.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 78: athrow
      // 79: getstatic com/l7tech/security/xml/transform/AttachmentContentOnlyTransform.CRLF [B
      // 7c: astore 10
      // 7e: aload 10
      // 80: arraylength
      // 81: istore 11
      // 83: bipush 0
      // 84: istore 12
      // 86: iload 12
      // 88: iload 11
      // 8a: if_icmpge a5
      // 8d: aload 10
      // 8f: iload 12
      // 91: baload
      // 92: istore 13
      // 94: aload 1
      // 95: iload 2
      // 96: iload 7
      // 98: iinc 7 1
      // 9b: iadd
      // 9c: iload 13
      // 9e: bastore
      // 9f: iinc 12 1
      // a2: goto 86
      // a5: bipush 10
      // a7: istore 4
      // a9: goto bb
      // ac: aload 1
      // ad: iload 2
      // ae: iload 7
      // b0: iinc 7 1
      // b3: iadd
      // b4: iload 9
      // b6: bastore
      // b7: iload 9
      // b9: istore 4
      // bb: iinc 8 1
      // be: goto 54
      // c1: aload 6
      // c3: invokestatic com/l7tech/util/BufferPool.returnBuffer ([B)Z
      // c6: pop
      // c7: aload 0
      // c8: aload 1
      // c9: iload 2
      // ca: iload 7
      // cc: bipush 1
      // cd: isub
      // ce: iadd
      // cf: baload
      // d0: putfield com/l7tech/security/xml/transform/a.b B
      // d3: iload 7
      // d5: ireturn
      // d6: iload 5
      // d8: ireturn
      // d9: aload 0
      // da: aload 1
      // db: iload 2
      // dc: iload 3
      // dd: invokespecial java/io/FilterInputStream.read ([BII)I
      // e0: ireturn
      // try (0 -> 6): 7 java/io/IOException
      // try (3 -> 16): 16 java/io/IOException
      // try (55 -> 61): 62 java/io/IOException
   }

   private static IOException a(IOException var0) {
      return var0;
   }

   static {
      String[] var5 = new String[2];
      int var3 = 0;
      String var2 = "h 8\u0003S8zt*-G\bd*j*+\u0013\u001eut\u001fh 8\u0003[~<:ykG\u0019h.\u007f6y\t\u0014ezi0)\u0017\u0014c.\u007f!w";
      int var4 = "h 8\u0003S8zt*-G\bd*j*+\u0013\u001eut\u001fh 8\u0003[~<:ykG\u0019h.\u007f6y\t\u0014ezi0)\u0017\u0014c.\u007f!w".length();
      char var1 = 21;
      int var0 = -1;

      while (true) {
         String var10002 = a(41, a(var2.substring(++var0, var0 + var1)));
         byte var10001 = -1;
         var5[var3++] = var10002;
         if ((var0 += var1) >= var4) {
            c = var5;
            return;
         }

         var1 = var2.charAt(var0);
      }
   }

   private static char[] a(String var0) {
      char[] var10000 = var0.toCharArray();
      if (var10000.length < 2) {
         var10000[0] = (char)(var10000[0] ^ 115);
      }

      return var10000;
   }

   private static String a(int var0, char[] var1) {
      int var10003 = var1.length;
      int var10002 = var0;
      char[] var10001 = var1;
      int var10000 = var10003;

      for (int var2 = 0; var10000 > var2; var2++) {
         var10001[var2] = (char)(var10001[var2] ^ var10002 ^ switch (var2 % 7) {
            case 0 -> 51;
            case 1 -> 108;
            case 2 -> 112;
            case 3 -> 78;
            case 4 -> 82;
            case 5 -> 56;
            default -> 115;
         });
      }

      return new String(var10001).intern();
   }
}
