package mapped;

import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSScript;

@ObfuscatedName("dt")
public class Script extends DualNode implements RSScript {
   @ObfuscatedName("at")
   @ObfuscatedSignature(
      descriptor = "Llk;"
   )
   static EvictingDualNodeHashTable Script_cached;
   @ObfuscatedName("ah")
   String field974;
   @ObfuscatedName("ar")
   int[] opcodes;
   @ObfuscatedName("ao")
   int[] intOperands;
   @ObfuscatedName("ab")
   String[] stringOperands;
   @ObfuscatedName("au")
   @ObfuscatedGetter(
      intValue = 565206857
   )
   int localIntCount;
   @ObfuscatedName("aa")
   @ObfuscatedGetter(
      intValue = -632319623
   )
   int localStringCount;
   @ObfuscatedName("ac")
   @ObfuscatedGetter(
      intValue = -1783875249
   )
   int intArgumentCount;
   @ObfuscatedName("al")
   @ObfuscatedGetter(
      intValue = 1750348567
   )
   int stringArgumentCount;
   @ObfuscatedName("az")
   @ObfuscatedSignature(
      descriptor = "[Ltz;"
   )
   IterableNodeHashTable[] switches;

   static {
      Script_cached = new EvictingDualNodeHashTable(128);
   }

   @ObfuscatedName("ab")
   @ObfuscatedSignature(
      descriptor = "(II)[Ltz;",
      garbageValue = "714760120"
   )
   IterableNodeHashTable[] method2222(int var1) {
      return new IterableNodeHashTable[var1];
   }

   public int[] getInstructions() {
      return this.opcodes;
   }

   public int[] getIntOperands() {
      return this.intOperands;
   }

   public int getIntArgumentCount() {
      return this.intArgumentCount;
   }

   public int getStringArgumentCount() {
      return this.stringArgumentCount;
   }

   @ObfuscatedName("ar")
   @ObfuscatedSignature(
      descriptor = "(Ljava/lang/CharSequence;IZI)Z",
      garbageValue = "1142322479"
   )
   static boolean method2228_base(CharSequence var0, int var1, boolean var2) {
      if(var1 >= 2 && var1 <= 36) {
         boolean var3 = false;
         boolean var4 = false;
         int var5 = 0;
         int var6 = var0.length();

         for(int var7 = 0; var7 < var6; ++var7) {
            char var8 = var0.charAt(var7);
            if(var7 == 0) {
               if(var8 == '-') {
                  var3 = true;
                  continue;
               }

               if(var8 == '+') {
                  continue;
               }
            }

            int var10;
            if(var8 >= '0' && var8 <= '9') {
               var10 = var8 - '0';
            } else if(var8 >= 'A' && var8 <= 'Z') {
               var10 = var8 - '7';
            } else {
               if(var8 < 'a' || var8 > 'z') {
                  return false;
               }

               var10 = var8 - 'W';
            }

            if(var10 >= var1) {
               return false;
            }

            if(var3) {
               var10 = -var10;
            }

            int var9 = var5 * var1 + var10;
            if(var9 / var1 != var5) {
               return false;
            }

            var5 = var9;
            var4 = true;
         }

         return var4;
      } else {
         throw new IllegalArgumentException("" + var1);
      }
   }
}
