package com.l7tech.external.assertions.oauth2.introspection.console;

import com.l7tech.console.panels.AssertionPropertiesOkCancelSupport;
import com.l7tech.console.panels.AssertionPropertiesOkCancelSupport.ValidationException;
import com.l7tech.console.util.Registry;
import com.l7tech.external.assertions.oauth2.introspection.OAuth2IntrospectionAdmin;
import com.l7tech.external.assertions.oauth2.introspection.OAuth2IntrospectionAssertion;
import com.l7tech.gui.util.InputValidator;
import java.awt.Window;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class OAuth2IntrospectionPropertiesDialog extends AssertionPropertiesOkCancelSupport<OAuth2IntrospectionAssertion> {
   private JPanel mainPane;
   private JTextField tokenTextField;
   private JTextField varPrefixTextField;
   private JTextField scopeTextField;
   private JCheckBox atLeastOneScopeCheckBox;
   private JTextField audienceTextField;
   private JCheckBox extractTokenFromRequestCheckBox;
   private JCheckBox atLeastOneAudienceCheckBox;
   private JCheckBox includeFullResponseCheckBox;
   private JComboBox<String> tokenIssuerComboBox;
   private final transient InputValidator inputValidator;
   static final long serialVersionUID = 564480528285023379L;
   private static final String[] c;

   public OAuth2IntrospectionPropertiesDialog(Window var1, OAuth2IntrospectionAssertion var2) {
      String[] var4 = c;
      super(OAuth2IntrospectionAssertion.class, var1, var4[11], true);
      this.$$$setupUI$$$();
      this.initComponents();
      this.extractTokenFromRequestCheckBox.addActionListener(var1x -> {
         try {
            if (this.extractTokenFromRequestCheckBox.isSelected()) {
               this.tokenTextField.setText("");
               this.tokenTextField.setEnabled(false);
               return;
            }
         } catch (ValidationException var2x) {
            throw var2x;
         }

         this.tokenTextField.setEnabled(true);
      });
      this.inputValidator = new InputValidator(this, this.getTitle());
      this.inputValidator.constrainTextFieldToBeNonEmpty(var4[4], this.tokenTextField, null);
      this.inputValidator.constrainTextFieldToBeNonEmpty(var4[15], this.varPrefixTextField, null);
      this.tokenIssuerComboBox.addItem(var4[13]);
      this.tokenIssuerComboBox.addItem(var4[6]);
      this.tokenIssuerComboBox.addActionListener(var1x -> {
         try {
            if (this.tokenIssuerComboBox.getSelectedItem() == null) {
               this.tokenIssuerComboBox.setSelectedItem(c[13]);
            }
         } catch (ValidationException var2x) {
            throw var2x;
         }
      });
      OAuth2IntrospectionAdmin var3 = (OAuth2IntrospectionAdmin)Registry.getDefault().getExtensionInterface(OAuth2IntrospectionAdmin.class, null);
      var3.getKnownTokenIssuerNames().forEach(var1x -> this.tokenIssuerComboBox.addItem(var1x));
      this.setData(var2);
   }

   public void setData(OAuth2IntrospectionAssertion param1) {
      // $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/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenTextField Ljavax/swing/JTextField;
      // 04: aload 1
      // 05: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getToken ()Ljava/lang/String;
      // 08: invokevirtual javax/swing/JTextField.setText (Ljava/lang/String;)V
      // 0b: aload 0
      // 0c: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.extractTokenFromRequestCheckBox Ljavax/swing/JCheckBox;
      // 0f: aload 1
      // 10: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getToken ()Ljava/lang/String;
      // 13: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.isEmpty (Ljava/lang/String;)Z
      // 16: invokevirtual javax/swing/JCheckBox.setSelected (Z)V
      // 19: aload 0
      // 1a: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenTextField Ljavax/swing/JTextField;
      // 1d: aload 0
      // 1e: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.extractTokenFromRequestCheckBox Ljavax/swing/JCheckBox;
      // 21: invokevirtual javax/swing/JCheckBox.isSelected ()Z
      // 24: ifne 2c
      // 27: bipush 1
      // 28: goto 2d
      // 2b: athrow
      // 2c: bipush 0
      // 2d: invokevirtual javax/swing/JTextField.setEnabled (Z)V
      // 30: aload 1
      // 31: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getTokenIssuerHint ()Ljava/lang/String;
      // 34: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.isEmpty (Ljava/lang/String;)Z
      // 37: ifeq 65
      // 3a: aload 1
      // 3b: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.isTrustGatewayAsIssuer ()Z
      // 3e: ifeq 56
      // 41: goto 45
      // 44: athrow
      // 45: aload 0
      // 46: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenIssuerComboBox Ljavax/swing/JComboBox;
      // 49: getstatic com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.c [Ljava/lang/String;
      // 4c: bipush 14
      // 4e: aaload
      // 4f: invokevirtual javax/swing/JComboBox.setSelectedItem (Ljava/lang/Object;)V
      // 52: goto 70
      // 55: athrow
      // 56: aload 0
      // 57: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenIssuerComboBox Ljavax/swing/JComboBox;
      // 5a: getstatic com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.c [Ljava/lang/String;
      // 5d: bipush 3
      // 5e: aaload
      // 5f: invokevirtual javax/swing/JComboBox.setSelectedItem (Ljava/lang/Object;)V
      // 62: goto 70
      // 65: aload 0
      // 66: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenIssuerComboBox Ljavax/swing/JComboBox;
      // 69: aload 1
      // 6a: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getTokenIssuerHint ()Ljava/lang/String;
      // 6d: invokevirtual javax/swing/JComboBox.setSelectedItem (Ljava/lang/Object;)V
      // 70: aload 0
      // 71: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.scopeTextField Ljavax/swing/JTextField;
      // 74: aload 1
      // 75: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getScope ()Ljava/lang/String;
      // 78: invokevirtual javax/swing/JTextField.setText (Ljava/lang/String;)V
      // 7b: aload 0
      // 7c: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.atLeastOneScopeCheckBox Ljavax/swing/JCheckBox;
      // 7f: aload 1
      // 80: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.isAtLeastOneScope ()Z
      // 83: invokevirtual javax/swing/JCheckBox.setSelected (Z)V
      // 86: aload 0
      // 87: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.audienceTextField Ljavax/swing/JTextField;
      // 8a: aload 1
      // 8b: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getAudience ()Ljava/lang/String;
      // 8e: invokevirtual javax/swing/JTextField.setText (Ljava/lang/String;)V
      // 91: aload 0
      // 92: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.atLeastOneAudienceCheckBox Ljavax/swing/JCheckBox;
      // 95: aload 1
      // 96: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.isAtLeastOneAudience ()Z
      // 99: invokevirtual javax/swing/JCheckBox.setSelected (Z)V
      // 9c: aload 0
      // 9d: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.varPrefixTextField Ljavax/swing/JTextField;
      // a0: aload 1
      // a1: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.getVarPrefix ()Ljava/lang/String;
      // a4: invokevirtual javax/swing/JTextField.setText (Ljava/lang/String;)V
      // a7: aload 0
      // a8: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.includeFullResponseCheckBox Ljavax/swing/JCheckBox;
      // ab: aload 1
      // ac: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.isIncludeFullResponseDetails ()Z
      // af: invokevirtual javax/swing/JCheckBox.setSelected (Z)V
      // b2: return
      // try (0 -> 19): 19 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
      // try (21 -> 29): 30 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
      // try (26 -> 38): 38 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
   }

   public OAuth2IntrospectionAssertion getData(OAuth2IntrospectionAssertion param1) throws ValidationException {
      // $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/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.inputValidator Lcom/l7tech/gui/util/InputValidator;
      // 04: invokevirtual com/l7tech/gui/util/InputValidator.validate ()Ljava/lang/String;
      // 07: astore 2
      // 08: aload 2
      // 09: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.isNotEmpty (Ljava/lang/String;)Z
      // 0c: ifeq 19
      // 0f: new com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
      // 12: dup
      // 13: aload 2
      // 14: invokespecial com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException.<init> (Ljava/lang/String;)V
      // 17: athrow
      // 18: athrow
      // 19: aload 1
      // 1a: aload 0
      // 1b: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenTextField Ljavax/swing/JTextField;
      // 1e: invokevirtual javax/swing/JTextField.getText ()Ljava/lang/String;
      // 21: invokevirtual java/lang/String.trim ()Ljava/lang/String;
      // 24: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.asNullable (Ljava/lang/String;)Ljava/lang/String;
      // 27: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setToken (Ljava/lang/String;)V
      // 2a: aload 0
      // 2b: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.tokenIssuerComboBox Ljavax/swing/JComboBox;
      // 2e: invokevirtual javax/swing/JComboBox.getSelectedItem ()Ljava/lang/Object;
      // 31: checkcast java/lang/String
      // 34: astore 3
      // 35: getstatic com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.c [Ljava/lang/String;
      // 38: bipush 6
      // 3a: aaload
      // 3b: aload 3
      // 3c: invokevirtual java/lang/String.equals (Ljava/lang/Object;)Z
      // 3f: ifeq 4b
      // 42: aload 1
      // 43: bipush 1
      // 44: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setTrustGatewayAsIssuer (Z)V
      // 47: goto 7e
      // 4a: athrow
      // 4b: getstatic com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.c [Ljava/lang/String;
      // 4e: bipush 13
      // 50: aaload
      // 51: aload 3
      // 52: invokevirtual java/lang/String.equals (Ljava/lang/Object;)Z
      // 55: ifne 60
      // 58: aload 3
      // 59: ifnonnull 6e
      // 5c: goto 60
      // 5f: athrow
      // 60: aload 1
      // 61: bipush 0
      // 62: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setTrustGatewayAsIssuer (Z)V
      // 65: aload 1
      // 66: aconst_null
      // 67: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setTokenIssuerHint (Ljava/lang/String;)V
      // 6a: goto 7e
      // 6d: athrow
      // 6e: aload 1
      // 6f: bipush 0
      // 70: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setTrustGatewayAsIssuer (Z)V
      // 73: aload 1
      // 74: aload 3
      // 75: invokevirtual java/lang/String.trim ()Ljava/lang/String;
      // 78: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.asNullable (Ljava/lang/String;)Ljava/lang/String;
      // 7b: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setTokenIssuerHint (Ljava/lang/String;)V
      // 7e: aload 1
      // 7f: aload 0
      // 80: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.scopeTextField Ljavax/swing/JTextField;
      // 83: invokevirtual javax/swing/JTextField.getText ()Ljava/lang/String;
      // 86: invokevirtual java/lang/String.trim ()Ljava/lang/String;
      // 89: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.asNullable (Ljava/lang/String;)Ljava/lang/String;
      // 8c: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setScope (Ljava/lang/String;)V
      // 8f: aload 1
      // 90: aload 0
      // 91: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.atLeastOneScopeCheckBox Ljavax/swing/JCheckBox;
      // 94: invokevirtual javax/swing/JCheckBox.isSelected ()Z
      // 97: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setAtLeastOneScope (Z)V
      // 9a: aload 1
      // 9b: aload 0
      // 9c: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.audienceTextField Ljavax/swing/JTextField;
      // 9f: invokevirtual javax/swing/JTextField.getText ()Ljava/lang/String;
      // a2: invokevirtual java/lang/String.trim ()Ljava/lang/String;
      // a5: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.asNullable (Ljava/lang/String;)Ljava/lang/String;
      // a8: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setAudience (Ljava/lang/String;)V
      // ab: aload 1
      // ac: aload 0
      // ad: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.atLeastOneAudienceCheckBox Ljavax/swing/JCheckBox;
      // b0: invokevirtual javax/swing/JCheckBox.isSelected ()Z
      // b3: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setAtLeastOneAudience (Z)V
      // b6: aload 1
      // b7: aload 0
      // b8: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.varPrefixTextField Ljavax/swing/JTextField;
      // bb: invokevirtual javax/swing/JTextField.getText ()Ljava/lang/String;
      // be: invokevirtual java/lang/String.trim ()Ljava/lang/String;
      // c1: invokestatic com/l7tech/external/assertions/oauth2/introspection/util/Util.asNullable (Ljava/lang/String;)Ljava/lang/String;
      // c4: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setVarPrefix (Ljava/lang/String;)V
      // c7: aload 1
      // c8: aload 0
      // c9: getfield com/l7tech/external/assertions/oauth2/introspection/console/OAuth2IntrospectionPropertiesDialog.includeFullResponseCheckBox Ljavax/swing/JCheckBox;
      // cc: invokevirtual javax/swing/JCheckBox.isSelected ()Z
      // cf: invokevirtual com/l7tech/external/assertions/oauth2/introspection/OAuth2IntrospectionAssertion.setIncludeFullResponseDetails (Z)V
      // d2: aload 1
      // d3: areturn
      // try (4 -> 12): 12 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
      // try (25 -> 35): 35 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
      // try (36 -> 44): 45 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
      // try (42 -> 53): 53 com/l7tech/console/panels/AssertionPropertiesOkCancelSupport$ValidationException
   }

   protected JPanel createPropertyPanel() {
      return this.mainPane;
   }

   static {
      String[] var5 = new String[18];
      int var3 = 0;
      String var2 = "8Mj-\u0003\u0007@Y<?\r\u0004L\u0017\u0019#>b|5\u001eC\u0017WJj5\u0007\u0007;\u0019xm6\u0018W\u0017\u0014xv6\u0005\u0007 \u0012\u007fo6\u0005T\u0017\f1~p4Ku\u0017\u0006yz*\u001f\tKHz?\nR\u001e\u00032\u0005#ct<\u0005\u0007\u0018mj-\u0003\u0015\u001b\u0007K@p:\nKL\u000e%in,\u0002U\u0017\u0013,L:\u0004W\u0017\u0011%in,\u0002U\u0017\u0013,^,\u000fN\u0017\u0019oz\u000f!mm0\nE\u001e\u0012,O+\u000eA\u001b\u000f\f6x?5\u000eF\u0001\u0003,p7\u000e(8Mj-\u0003\u0007@Y<?\r\u0004L\u0017\u0019,V7\u001fU\u001d\u0004|z:\u001fN\u001d\u0019,O+\u0004W\u0017\u0005xv<\u0018\f#ct<\u0005\u0007;\u0004\u007fj<\u0019\tKHz?\nR\u001e\u00032\u0007K@p:\nKL\u000f!mm0\nE\u001e\u0012,O+\u000eA\u001b\u000f";
      int var4 = "8Mj-\u0003\u0007@Y<?\r\u0004L\u0017\u0019#>b|5\u001eC\u0017WJj5\u0007\u0007;\u0019xm6\u0018W\u0017\u0014xv6\u0005\u0007 \u0012\u007fo6\u0005T\u0017\f1~p4Ku\u0017\u0006yz*\u001f\tKHz?\nR\u001e\u00032\u0005#ct<\u0005\u0007\u0018mj-\u0003\u0015\u001b\u0007K@p:\nKL\u000e%in,\u0002U\u0017\u0013,L:\u0004W\u0017\u0011%in,\u0002U\u0017\u0013,^,\u000fN\u0017\u0019oz\u000f!mm0\nE\u001e\u0012,O+\u000eA\u001b\u000f\f6x?5\u000eF\u0001\u0003,p7\u000e(8Mj-\u0003\u0007@Y<?\r\u0004L\u0017\u0019,V7\u001fU\u001d\u0004|z:\u001fN\u001d\u0019,O+\u0004W\u0017\u0005xv<\u0018\f#ct<\u0005\u0007;\u0004\u007fj<\u0019\tKHz?\nR\u001e\u00032\u0007K@p:\nKL\u000f!mm0\nE\u001e\u0012,O+\u000eA\u001b\u000f"
         .length();
      char var1 = 15;
      int var7 = -1;

      label24:
      while (true) {
         String var10000 = var2.substring(++var7, var7 + var1);
         byte var10001 = -1;

         while (true) {
            String var12 = a(c(var10000));
            switch (var10001) {
               case 0:
                  var5[var3++] = var12;
                  if ((var7 += var1) >= var4) {
                     c = var5;
                     return;
                  }

                  var1 = var2.charAt(var7);
                  break;
               default:
                  var5[var3++] = var12;
                  if ((var7 += var1) < var4) {
                     var1 = var2.charAt(var7);
                     continue label24;
                  }

                  var2 = "6x?5\u000eF\u0001\u0003,p7\u000e\u00068yk)\u001eS";
                  var4 = "6x?5\u000eF\u0001\u0003,p7\u000e\u00068yk)\u001eS".length();
                  var1 = '\f';
                  var7 = -1;
            }

            var10000 = var2.substring(++var7, var7 + var1);
            var10001 = 0;
         }
      }
   }

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

      return var10000;
   }

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

      for (int var1 = 0; var10000 > var1; var1++) {
         var10001[var1] = (char)(var10001[var1] ^ switch (var1 % 7) {
            case 0 -> 119;
            case 1 -> 12;
            case 2 -> 31;
            case 3 -> 89;
            case 4 -> 107;
            case 5 -> 39;
            default -> 114;
         });
      }

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