package com.l7tech.message;

import com.l7tech.common.mime.NoSuchPartException;
import com.l7tech.util.InvalidDocumentFormatException;
import com.l7tech.xml.SoapFaultDetail;
import com.l7tech.xml.soap.SoapFaultUtils;
import com.l7tech.xml.soap.SoapVersion;
import java.io.IOException;
import javax.xml.namespace.QName;
import org.xml.sax.SAXException;

class i implements SoapKnob {
   final g this$0;
   private static final String[] a;

   i(g var1) {
      this.this$0 = var1;
   }

   @Override
   public QName[] getPayloadNames() throws IOException, SAXException, NoSuchPartException {
      return this.this$0.b().getPayloadNames();
   }

   @Override
   public String getSoapAction() throws IOException, SAXException, NoSuchPartException {
      return this.this$0.b().getSoapAction();
   }

   @Override
   public boolean isFault() throws SAXException, IOException, InvalidDocumentFormatException {
      try {
         if (this.a() != null) {
            return true;
         }
      } catch (SAXException var1) {
         throw a(var1);
      }

      return false;
   }

   @Override
   public SoapFaultDetail getFaultDetail() throws InvalidDocumentFormatException, IOException, SAXException {
      try {
         if (!this.isFault()) {
            throw new IllegalStateException(a[0]);
         }
      } catch (InvalidDocumentFormatException var1) {
         throw a(var1);
      }

      return this.this$0.c;
   }

   @Override
   public void setFaultDetail(SoapFaultDetail 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 1
      // 01: ifnull 28
      // 04: aload 1
      // 05: invokeinterface com/l7tech/xml/SoapFaultDetail.getFaultActor ()Ljava/lang/String; 1
      // 0a: ifnull 28
      // 0d: goto 14
      // 10: invokestatic com/l7tech/message/i.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 13: athrow
      // 14: aload 1
      // 15: invokeinterface com/l7tech/xml/SoapFaultDetail.getFaultActor ()Ljava/lang/String; 1
      // 1a: invokevirtual java/lang/String.length ()I
      // 1d: bipush 1
      // 1e: if_icmpge 39
      // 21: goto 28
      // 24: invokestatic com/l7tech/message/i.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 27: athrow
      // 28: new java/lang/IllegalArgumentException
      // 2b: dup
      // 2c: getstatic com/l7tech/message/i.a [Ljava/lang/String;
      // 2f: bipush 1
      // 30: aaload
      // 31: invokespecial java/lang/IllegalArgumentException.<init> (Ljava/lang/String;)V
      // 34: athrow
      // 35: invokestatic com/l7tech/message/i.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 38: athrow
      // 39: aload 0
      // 3a: getfield com/l7tech/message/i.this$0 Lcom/l7tech/message/g;
      // 3d: aload 1
      // 3e: putfield com/l7tech/message/g.c Lcom/l7tech/xml/SoapFaultDetail;
      // 41: return
      // try (0 -> 5): 6 java/lang/IllegalStateException
      // try (2 -> 13): 14 java/lang/IllegalStateException
      // try (8 -> 23): 23 java/lang/IllegalStateException
   }

   @Override
   public boolean isSecurityHeaderPresent() throws NoSuchPartException, IOException, SAXException {
      return this.this$0.b().d;
   }

   @Override
   public void invalidate() {
      this.this$0.d = null;
      this.this$0.f = null;
      this.this$0.e = null;
   }

   @Override
   public SoapVersion getSoapVersion() throws IOException, SAXException {
      try {
         if (this.this$0.f == null) {
            this.this$0.a();
         }
      } catch (IOException var1) {
         throw a(var1);
      }

      return this.this$0.f;
   }

   @Override
   public String getSoapEnvelopeUri() throws IOException, SAXException {
      try {
         if (this.this$0.e == null) {
            this.this$0.a();
         }
      } catch (IOException var1) {
         throw a(var1);
      }

      return this.this$0.e;
   }

   private SoapFaultDetail a() throws SAXException, IOException, InvalidDocumentFormatException {
      try {
         if (this.this$0.c == null) {
            this.this$0.c = SoapFaultUtils.gatherSoapFaultDetail(this.this$0.getMessage().getXmlKnob().getDocumentReadOnly());
         }
      } catch (SAXException var1) {
         throw a(var1);
      }

      return this.this$0.c;
   }

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

   static {
      String[] var5 = new String[2];
      int var3 = 0;
      String var2 = "UMVIp>\u00118AV\u001a\u007f6\u00008I\u0005i^\u0018$8NDO}-:^IPVey\u0010}\\DS}y\u001dk\bKO}5TwZ\u0005Rp*Ty\bHSb*\u001dvO\u0005Ucy\u0011uXQC1?\u0015mDQ\u001ap:\u0000wZ";
      int var4 = "UMVIp>\u00118AV\u001a\u007f6\u00008I\u0005i^\u0018$8NDO}-:^IPVey\u0010}\\DS}y\u001dk\bKO}5TwZ\u0005Rp*Ty\bHSb*\u001dvO\u0005Ucy\u0011uXQC1?\u0015mDQ\u001ap:\u0000wZ"
         .length();
      char var1 = 27;
      int var0 = -1;

      while (true) {
         String var10002 = a(57, 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] ^ 77);
      }

      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 -> 33;
            case 1 -> 17;
            case 2 -> 28;
            case 3 -> 3;
            case 4 -> 40;
            case 5 -> 96;
            default -> 77;
         });
      }

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