package com.l7tech.security.xml.processor;

import com.l7tech.security.token.EncryptedElement;
import com.l7tech.security.token.SecurityToken;
import com.l7tech.security.token.SignatureConfirmation;
import com.l7tech.security.token.SignedElement;
import com.l7tech.security.token.SignedPart;
import com.l7tech.security.token.SigningSecurityToken;
import com.l7tech.security.token.XmlSecurityToken;
import com.l7tech.security.xml.SecurityActor;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;

class m implements ProcessorResult {
   final WssProcessorImpl this$0;
   private static final String[] a;

   m(WssProcessorImpl var1) {
      this.this$0 = var1;
   }

   @Override
   public SignedElement[] getElementsThatWereSigned() {
      return this.this$0.h.toArray(new SignedElement[this.this$0.h.size()]);
   }

   @Override
   public EncryptedElement[] getElementsThatWereEncrypted() {
      return this.this$0.i.toArray(new EncryptedElement[this.this$0.i.size()]);
   }

   @Override
   public SignedPart[] getPartsThatWereSigned() {
      return this.this$0.j.toArray(new SignedPart[this.this$0.j.size()]);
   }

   @Override
   public XmlSecurityToken[] getXmlSecurityTokens() {
      return this.this$0.k.toArray(new XmlSecurityToken[this.this$0.k.size()]);
   }

   @Override
   public WssTimestamp getTimestamp() {
      return this.this$0.y;
   }

   @Override
   public String getSecurityNS() {
      try {
         return this.this$0.z != null ? this.this$0.z.getNamespaceURI() : null;
      } catch (IllegalArgumentException var1) {
         throw a(var1);
      }
   }

   @Override
   public String getWSUNS() {
      // $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/processor/m.this$0 Lcom/l7tech/security/xml/processor/WssProcessorImpl;
      // 04: getfield com/l7tech/security/xml/processor/WssProcessorImpl.y Lcom/l7tech/security/xml/processor/TimestampImpl;
      // 07: ifnull 32
      // 0a: aload 0
      // 0b: getfield com/l7tech/security/xml/processor/m.this$0 Lcom/l7tech/security/xml/processor/WssProcessorImpl;
      // 0e: getfield com/l7tech/security/xml/processor/WssProcessorImpl.y Lcom/l7tech/security/xml/processor/TimestampImpl;
      // 11: invokevirtual com/l7tech/security/xml/processor/TimestampImpl.asElement ()Lorg/w3c/dom/Element;
      // 14: ifnull 32
      // 17: goto 1e
      // 1a: invokestatic com/l7tech/security/xml/processor/m.a (Ljava/lang/IllegalArgumentException;)Ljava/lang/IllegalArgumentException;
      // 1d: athrow
      // 1e: aload 0
      // 1f: getfield com/l7tech/security/xml/processor/m.this$0 Lcom/l7tech/security/xml/processor/WssProcessorImpl;
      // 22: getfield com/l7tech/security/xml/processor/WssProcessorImpl.y Lcom/l7tech/security/xml/processor/TimestampImpl;
      // 25: invokevirtual com/l7tech/security/xml/processor/TimestampImpl.asElement ()Lorg/w3c/dom/Element;
      // 28: invokeinterface org/w3c/dom/Element.getNamespaceURI ()Ljava/lang/String; 1
      // 2d: areturn
      // 2e: invokestatic com/l7tech/security/xml/processor/m.a (Ljava/lang/IllegalArgumentException;)Ljava/lang/IllegalArgumentException;
      // 31: athrow
      // 32: aload 0
      // 33: getfield com/l7tech/security/xml/processor/m.this$0 Lcom/l7tech/security/xml/processor/WssProcessorImpl;
      // 36: getfield com/l7tech/security/xml/processor/WssProcessorImpl.k Ljava/util/Collection;
      // 39: ifnull e5
      // 3c: aload 0
      // 3d: getfield com/l7tech/security/xml/processor/m.this$0 Lcom/l7tech/security/xml/processor/WssProcessorImpl;
      // 40: getfield com/l7tech/security/xml/processor/WssProcessorImpl.k Ljava/util/Collection;
      // 43: invokeinterface java/util/Collection.isEmpty ()Z 1
      // 48: ifne e5
      // 4b: goto 52
      // 4e: invokestatic com/l7tech/security/xml/processor/m.a (Ljava/lang/IllegalArgumentException;)Ljava/lang/IllegalArgumentException;
      // 51: athrow
      // 52: aload 0
      // 53: getfield com/l7tech/security/xml/processor/m.this$0 Lcom/l7tech/security/xml/processor/WssProcessorImpl;
      // 56: getfield com/l7tech/security/xml/processor/WssProcessorImpl.k Ljava/util/Collection;
      // 59: invokeinterface java/util/Collection.iterator ()Ljava/util/Iterator; 1
      // 5e: astore 1
      // 5f: aload 1
      // 60: invokeinterface java/util/Iterator.hasNext ()Z 1
      // 65: ifeq e5
      // 68: aload 1
      // 69: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 6e: checkcast com/l7tech/security/token/XmlSecurityToken
      // 71: astore 2
      // 72: aload 2
      // 73: invokeinterface com/l7tech/security/token/XmlSecurityToken.asElement ()Lorg/w3c/dom/Element; 1
      // 78: invokeinterface org/w3c/dom/Element.getAttributes ()Lorg/w3c/dom/NamedNodeMap; 1
      // 7d: astore 3
      // 7e: bipush 0
      // 7f: istore 4
      // 81: iload 4
      // 83: aload 3
      // 84: invokeinterface org/w3c/dom/NamedNodeMap.getLength ()I 1
      // 89: if_icmpge e2
      // 8c: aload 3
      // 8d: iload 4
      // 8f: invokeinterface org/w3c/dom/NamedNodeMap.item (I)Lorg/w3c/dom/Node; 2
      // 94: checkcast org/w3c/dom/Attr
      // 97: astore 5
      // 99: getstatic com/l7tech/security/xml/processor/m.a [Ljava/lang/String;
      // 9c: bipush 0
      // 9d: aaload
      // 9e: aload 5
      // a0: invokeinterface org/w3c/dom/Attr.getLocalName ()Ljava/lang/String; 1
      // a5: invokevirtual java/lang/String.equals (Ljava/lang/Object;)Z
      // a8: ifeq dc
      // ab: aload 5
      // ad: invokeinterface org/w3c/dom/Attr.getNamespaceURI ()Ljava/lang/String; 1
      // b2: ifnull dc
      // b5: goto bc
      // b8: invokestatic com/l7tech/security/xml/processor/m.a (Ljava/lang/IllegalArgumentException;)Ljava/lang/IllegalArgumentException;
      // bb: athrow
      // bc: aload 5
      // be: invokeinterface org/w3c/dom/Attr.getNamespaceURI ()Ljava/lang/String; 1
      // c3: invokevirtual java/lang/String.length ()I
      // c6: ifle dc
      // c9: goto d0
      // cc: invokestatic com/l7tech/security/xml/processor/m.a (Ljava/lang/IllegalArgumentException;)Ljava/lang/IllegalArgumentException;
      // cf: athrow
      // d0: aload 5
      // d2: invokeinterface org/w3c/dom/Attr.getNamespaceURI ()Ljava/lang/String; 1
      // d7: areturn
      // d8: invokestatic com/l7tech/security/xml/processor/m.a (Ljava/lang/IllegalArgumentException;)Ljava/lang/IllegalArgumentException;
      // db: athrow
      // dc: iinc 4 1
      // df: goto 81
      // e2: goto 5f
      // e5: aconst_null
      // e6: areturn
      // try (0 -> 9): 10 java/lang/IllegalArgumentException
      // try (4 -> 18): 18 java/lang/IllegalArgumentException
      // try (20 -> 29): 30 java/lang/IllegalArgumentException
      // try (59 -> 69): 70 java/lang/IllegalArgumentException
      // try (66 -> 76): 77 java/lang/IllegalArgumentException
      // try (72 -> 82): 82 java/lang/IllegalArgumentException
   }

   @Override
   public String getWsscNS() {
      try {
         return !this.this$0.l.isEmpty() ? this.this$0.l.iterator().next().asElement().getNamespaceURI() : null;
      } catch (IllegalArgumentException var1) {
         throw a(var1);
      }
   }

   @Override
   public SecurityActor getProcessedActor() {
      return this.this$0.G;
   }

   @Override
   public String getProcessedActorUri() {
      return this.this$0.H;
   }

   @Override
   public List<String> getValidatedSignatureValues() {
      return this.this$0.validatedSignatureValues;
   }

   @Override
   public SignatureConfirmation getSignatureConfirmation() {
      return this.this$0.m;
   }

   @Override
   public String getLastKeyEncryptionAlgorithm() {
      return this.this$0.K;
   }

   @Override
   public boolean isWsse11Seen() {
      return this.this$0.L;
   }

   @Override
   public boolean isDerivedKeySeen() {
      return this.this$0.M;
   }

   @Override
   public SigningSecurityToken[] getSigningTokens(Element var1) {
      try {
         if (var1 == null) {
            throw new IllegalArgumentException();
         }
      } catch (IllegalArgumentException var11) {
         throw a(var11);
      }

      ArrayList var2 = new ArrayList();

      try {
         if (this.this$0.w != var1.getOwnerDocument()) {
            throw new IllegalArgumentException(a[1]);
         }
      } catch (IllegalArgumentException var10) {
         throw a(var10);
      }

      for (SecurityToken var4 : this.this$0.k) {
         if (var4 instanceof SigningSecurityToken var5) {
            SignedElement[] var6 = var5.getSignedElements();

            for (int var7 = var6.length - 1; var7 >= 0; var7--) {
               SignedElement var8 = var6[var7];

               try {
                  if (var1 == var8.asElement()) {
                     var2.add(var5);
                  }
               } catch (IllegalArgumentException var9) {
                  throw a(var9);
               }
            }
         }
      }

      return var2.toArray(new SigningSecurityToken[var2.size()]);
   }

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

   static {
      String[] var5 = new String[2];
      int var3 = 0;
      String var2 = "RYFOUo0\u0011zK~Pc-E?CtXuc_pS;_c/^q@;IicEwB;Ng.T?Ct^s.TqS;\\ucAmHxXu0^m\u0007iXu6]k\u0006";
      int var4 = "RYFOUo0\u0011zK~Pc-E?CtXuc_pS;_c/^q@;IicEwB;Ng.T?Ct^s.TqS;\\ucAmHxXu0^m\u0007iXu6]k\u0006".length();
      char var1 = 2;
      int var0 = -1;

      while (true) {
         String var10002 = a(97, a(var2.substring(++var0, var0 + var1)));
         byte var10001 = -1;
         var5[var3++] = var10002;
         if ((var0 += var1) >= var4) {
            a = 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] ^ 70);
      }

      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 -> 122;
            case 1 -> 92;
            case 2 -> 103;
            case 3 -> 34;
            case 4 -> 80;
            case 5 -> 126;
            default -> 70;
         });
      }

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