package com.l7tech.common.io;

import com.l7tech.util.ExceptionUtils;
import java.net.Socket;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;

class ah extends SSLSocketFactoryWrapper {
   final String[] val$desiredTlsVersions;
   final String[] val$desiredTlsCipherSuites;
   private static final String b;

   ah(SSLSocketFactory var1, String[] var2, String[] var3) {
      super(var1);
      this.val$desiredTlsVersions = var2;
      this.val$desiredTlsCipherSuites = var3;
   }

   @Override
   protected Socket notifySocket(Socket var1) {
      if (var1 instanceof SSLSocket var2) {
         label33: {
            IllegalArgumentException var3;
            try {
               if (this.val$desiredTlsVersions == null) {
                  break label33;
               }

               try {
                  var2.setEnabledProtocols(SslSocketUtil.filterUnsupportedTlsVersions(this.val$desiredTlsVersions, var2.getSupportedProtocols()));
                  break label33;
               } catch (IllegalArgumentException var5) {
                  var3 = var5;
               }
            } catch (UnsupportedTlsVersionsException var6) {
               throw a(var6);
            }

            throw new UnsupportedTlsVersionsException(b + ExceptionUtils.getMessage(var3), var3);
         }

         try {
            if (this.val$desiredTlsCipherSuites != null) {
               var2.setEnabledCipherSuites(SslSocketUtil.filterUnsupportedCiphers(this.val$desiredTlsCipherSuites, var2.getSupportedCipherSuites()));
            }
         } catch (IllegalArgumentException var4) {
            throw a(var4);
         }
      }

      return var1;
   }

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

   static {
      String var10002 = a(97, a("NOor?q(x[*E\u001aDakZxb?x/=Vy18x5=^|p?{ \u007fSo1?yaiWo15b3oZdevt.sYcv#e iVe\u007fl7"));
      byte var10001 = -1;
      b = var10002;
   }

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

      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 -> 124;
            case 1 -> 94;
            case 2 -> 107;
            case 3 -> 112;
            case 4 -> 55;
            case 5 -> 118;
            default -> 32;
         });
      }

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