/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.SslSocketUtil
 *  com.l7tech.common.mime.ContentTypeHeader
 *  com.l7tech.common.mime.StashManager
 *  com.l7tech.gateway.common.transport.SsgConnector
 *  com.l7tech.message.HeadersKnob
 *  com.l7tech.message.HttpRequestKnob
 *  com.l7tech.message.HttpResponseKnob
 *  com.l7tech.message.HttpServletRequestKnob
 *  com.l7tech.message.HttpServletResponseKnob
 *  com.l7tech.message.Message
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.ObjectNotFoundException
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.policy.variable.NoSuchVariableException
 *  com.l7tech.util.ResourceUtils
 *  jakarta.servlet.ServletException
 *  jakarta.servlet.ServletRequest
 *  jakarta.servlet.http.HttpServletRequest
 *  jakarta.servlet.http.HttpServletResponse
 *  jakarta.websocket.ClientEndpointConfig
 *  jakarta.websocket.ClientEndpointConfig$Builder
 *  jakarta.websocket.ClientEndpointConfig$Configurator
 *  jakarta.websocket.CloseReason
 *  jakarta.websocket.DeploymentException
 *  jakarta.websocket.Endpoint
 *  jakarta.websocket.Session
 *  jakarta.websocket.server.ServerEndpointConfig
 *  org.jetbrains.annotations.NotNull
 *  org.jetbrains.annotations.Nullable
 */
package com.l7tech.server.transport.http.websocket;

import com.l7tech.common.io.SslSocketUtil;
import com.l7tech.common.mime.ContentTypeHeader;
import com.l7tech.common.mime.StashManager;
import com.l7tech.gateway.common.transport.SsgConnector;
import com.l7tech.message.HeadersKnob;
import com.l7tech.message.HttpRequestKnob;
import com.l7tech.message.HttpResponseKnob;
import com.l7tech.message.HttpServletRequestKnob;
import com.l7tech.message.HttpServletResponseKnob;
import com.l7tech.message.Message;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.ObjectNotFoundException;
import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.variable.NoSuchVariableException;
import com.l7tech.server.DefaultKey;
import com.l7tech.server.MessageProcessor;
import com.l7tech.server.StashManagerFactory;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.message.PolicyEnforcementContextFactory;
import com.l7tech.server.security.SSLContextFactory;
import com.l7tech.server.security.keystore.SsgKeyStoreManager;
import com.l7tech.server.transport.http.DefaultHttpCiphers;
import com.l7tech.server.transport.http.HttpTransportModule;
import com.l7tech.server.transport.http.websocket.SsgServerEndpointConfig;
import com.l7tech.server.transport.http.websocket.SsgWebSocketExpectedRethrowRuntimeException;
import com.l7tech.server.transport.http.websocket.SsgWebSocketExpectedRuntimeException;
import com.l7tech.server.transport.http.websocket.SsgWebSocketManager;
import com.l7tech.server.transport.http.websocket.b;
import com.l7tech.server.transport.http.websocket.c;
import com.l7tech.server.transport.http.websocket.d;
import com.l7tech.server.transport.http.websocket.e;
import com.l7tech.server.transport.http.websocket.g;
import com.l7tech.server.transport.http.websocket.h;
import com.l7tech.server.util.ServletUtils;
import com.l7tech.util.ResourceUtils;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.websocket.ClientEndpointConfig;
import jakarta.websocket.CloseReason;
import jakarta.websocket.DeploymentException;
import jakarta.websocket.Endpoint;
import jakarta.websocket.Session;
import jakarta.websocket.server.ServerEndpointConfig;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*
 * Exception performing whole class analysis ignored.
 */
public class SsgWebSocketUpgradeProcessor {
    private static final Logger a;
    private final DefaultKey b;
    private final MessageProcessor c;
    private final SecureRandom d;
    private final SsgKeyStoreManager e;
    private final StashManagerFactory f;
    private final TrustManager g;
    private ClientEndpointConfig h;
    private PolicyEnforcementContext i;
    static final /* synthetic */ boolean j;
    private static final String[] k;

    SsgWebSocketUpgradeProcessor(DefaultKey defaultKey, MessageProcessor messageProcessor, SecureRandom secureRandom, SsgKeyStoreManager ssgKeyStoreManager, StashManagerFactory stashManagerFactory, TrustManager trustManager) {
        this.b = defaultKey;
        this.e = ssgKeyStoreManager;
        this.c = messageProcessor;
        this.d = secureRandom;
        this.f = stashManagerFactory;
        this.g = trustManager;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public void handleUpgrade(@NotNull ServerEndpointConfig serverEndpointConfig, @NotNull SsgServerEndpointConfig ssgServerEndpointConfig, @NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws ServletException, IOException {
        HttpServletResponseKnob httpServletResponseKnob;
        String[] stringArray;
        try {
            if (serverEndpointConfig == null) {
                SsgWebSocketUpgradeProcessor.a(0);
            }
        }
        catch (ServletException servletException) {
            throw SsgWebSocketUpgradeProcessor.a(servletException);
        }
        try {
            if (ssgServerEndpointConfig == null) {
                SsgWebSocketUpgradeProcessor.a(1);
            }
        }
        catch (ServletException servletException) {
            throw SsgWebSocketUpgradeProcessor.a(servletException);
        }
        try {
            if (httpServletRequest == null) {
                SsgWebSocketUpgradeProcessor.a(2);
            }
        }
        catch (ServletException servletException) {
            throw SsgWebSocketUpgradeProcessor.a(servletException);
        }
        try {
            if (httpServletResponse == null) {
                SsgWebSocketUpgradeProcessor.a(3);
            }
        }
        catch (ServletException servletException) {
            throw SsgWebSocketUpgradeProcessor.a(servletException);
        }
        PolicyEnforcementContext policyEnforcementContext = this.a(serverEndpointConfig, ssgServerEndpointConfig, httpServletRequest, httpServletResponse);
        Message message = policyEnforcementContext.getResponse();
        AssertionStatus assertionStatus = policyEnforcementContext.getPolicyResult();
        PolicyEnforcementContext policyEnforcementContext2 = null;
        try {
            this.a(policyEnforcementContext, serverEndpointConfig);
            stringArray = k;
            if (Boolean.parseBoolean(this.a(policyEnforcementContext, stringArray[60]))) {
                policyEnforcementContext2 = this.a(httpServletRequest.isSecure(), serverEndpointConfig.getPath(), policyEnforcementContext.getPolicyResult(), message);
                assertionStatus = policyEnforcementContext2.getPolicyResult();
            }
            httpServletResponseKnob = (HttpServletResponseKnob)message.getHttpResponseKnob();
            try {
                if (httpServletResponseKnob.getStatus() != 0) {
                    this.a(message, httpServletResponseKnob, httpServletResponse);
                }
            }
            catch (ServletException servletException) {
                throw SsgWebSocketUpgradeProcessor.a(servletException);
            }
        }
        catch (Throwable throwable) {
            ResourceUtils.closeQuietly((Closeable)policyEnforcementContext);
            ResourceUtils.closeQuietly(policyEnforcementContext2);
            throw throwable;
        }
        ResourceUtils.closeQuietly((Closeable)policyEnforcementContext);
        ResourceUtils.closeQuietly((Closeable)policyEnforcementContext2);
        ServletUtils.loadHeaders(httpServletResponse, message);
        httpServletResponseKnob = policyEnforcementContext.getRequest();
        httpServletResponseKnob.getHeadersKnob();
        stringArray = k;
        serverEndpointConfig.getUserProperties().put(stringArray[23], httpServletResponseKnob);
        serverEndpointConfig.getUserProperties().put(stringArray[67], message);
        SsgWebSocketManager.getInstance().checkAssertionStatus(assertionStatus, serverEndpointConfig.getPath());
    }

    private PolicyEnforcementContext a(@NotNull ServerEndpointConfig serverEndpointConfig, @NotNull SsgServerEndpointConfig ssgServerEndpointConfig, @NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws ServletException {
        try {
            if (serverEndpointConfig == null) {
                SsgWebSocketUpgradeProcessor.a(4);
            }
        }
        catch (Throwable throwable) {
            throw SsgWebSocketUpgradeProcessor.a(throwable);
        }
        try {
            if (ssgServerEndpointConfig == null) {
                SsgWebSocketUpgradeProcessor.a(5);
            }
        }
        catch (Throwable throwable) {
            throw SsgWebSocketUpgradeProcessor.a(throwable);
        }
        try {
            if (httpServletRequest == null) {
                SsgWebSocketUpgradeProcessor.a(6);
            }
        }
        catch (Throwable throwable) {
            throw SsgWebSocketUpgradeProcessor.a(throwable);
        }
        try {
            if (httpServletResponse == null) {
                SsgWebSocketUpgradeProcessor.a(7);
            }
        }
        catch (Throwable throwable) {
            throw SsgWebSocketUpgradeProcessor.a(throwable);
        }
        e e10 = new e(PolicyEnforcementContextFactory.createPolicyEnforcementContext(null, null, true), serverEndpointConfig, ssgServerEndpointConfig);
        Message message = e10.getRequest();
        Message message2 = e10.getResponse();
        SsgConnector ssgConnector = HttpTransportModule.getConnector((ServletRequest)httpServletRequest);
        String[] stringArray = k;
        serverEndpointConfig.getUserProperties().put(stringArray[15], ssgConnector);
        try (StashManager stashManager = this.f.createStashManager();){
            long l2 = ssgConnector.getLongProperty(SsgConnector.PROP_REQUEST_SIZE_LIMIT, Message.getMaxBytes());
            try {
                message.initialize(stashManager, this.a(httpServletRequest), (InputStream)httpServletRequest.getInputStream(), l2);
                message.attachHttpRequestKnob((HttpRequestKnob)new HttpServletRequestKnob(httpServletRequest));
                message2.attachHttpResponseKnob((HttpResponseKnob)new HttpServletResponseKnob(httpServletResponse));
                ServletUtils.loadHeaders(httpServletRequest, message);
                e10.setVariable(stringArray[54], stringArray[49]);
                e10.setVariable(stringArray[9], stringArray[36]);
                if (a.isLoggable(Level.FINE)) {
                    a.fine(stringArray[61]);
                }
            }
            catch (Throwable throwable) {
                throw SsgWebSocketUpgradeProcessor.a(throwable);
            }
            this.c.processMessage(e10);
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw ssgWebSocketExpectedRuntimeException;
        }
        catch (Exception exception) {
            throw new ServletException(k[62], (Throwable)exception);
        }
        return e10;
    }

    private PolicyEnforcementContext a(boolean bl2, @NotNull String string, @NotNull AssertionStatus assertionStatus, @NotNull Message message) throws ServletException {
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(8);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (assertionStatus == null) {
                SsgWebSocketUpgradeProcessor.a(9);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (message == null) {
                SsgWebSocketUpgradeProcessor.a(10);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        PolicyEnforcementContext policyEnforcementContext = this.a(message);
        policyEnforcementContext.setPolicyResult(assertionStatus);
        Message message2 = policyEnforcementContext.getRequest();
        try {
            try {
                message2.attachHttpRequestKnob((HttpRequestKnob)new b(bl2, string));
                policyEnforcementContext.setVariable(k[42], k[7]);
                policyEnforcementContext.setVariable(k[43], k[50]);
                if (a.isLoggable(Level.FINE)) {
                    a.fine(k[47]);
                }
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            this.c.processMessage(policyEnforcementContext);
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw ssgWebSocketExpectedRuntimeException;
        }
        catch (Exception exception) {
            throw new ServletException(k[46], (Throwable)exception);
        }
        return policyEnforcementContext;
    }

    private void a(@NotNull Message message, @NotNull HttpServletResponseKnob httpServletResponseKnob, @NotNull HttpServletResponse httpServletResponse) {
        try {
            if (message == null) {
                SsgWebSocketUpgradeProcessor.a(11);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (httpServletResponseKnob == null) {
                SsgWebSocketUpgradeProcessor.a(12);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (httpServletResponse == null) {
                SsgWebSocketUpgradeProcessor.a(13);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            httpServletResponse.setStatus(httpServletResponseKnob.getStatus());
            if (httpServletResponseKnob.hasChallenge()) {
                httpServletResponseKnob.beginChallenge();
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        ServletUtils.loadHeaders(httpServletResponse, message);
        throw new SsgWebSocketExpectedRuntimeException();
    }

    private void a(@NotNull PolicyEnforcementContext policyEnforcementContext, @NotNull ServerEndpointConfig serverEndpointConfig) throws ServletException {
        block14: {
            try {
                if (policyEnforcementContext == null) {
                    SsgWebSocketUpgradeProcessor.a(14);
                }
            }
            catch (DeploymentException deploymentException) {
                throw SsgWebSocketUpgradeProcessor.a(deploymentException);
            }
            try {
                if (serverEndpointConfig == null) {
                    SsgWebSocketUpgradeProcessor.a(15);
                }
            }
            catch (DeploymentException deploymentException) {
                throw SsgWebSocketUpgradeProcessor.a(deploymentException);
            }
            String[] stringArray = k;
            String string = this.a(policyEnforcementContext, stringArray[5]);
            try {
                String string2;
                if (string == null) break block14;
                URI uRI = new URI(string);
                c c10 = new c(this, policyEnforcementContext);
                if (string.startsWith(stringArray[32])) {
                    boolean bl2 = Boolean.parseBoolean(this.a(policyEnforcementContext, stringArray[59]));
                    string2 = this.a(policyEnforcementContext, stringArray[40]);
                    String string3 = this.a(policyEnforcementContext, stringArray[10]);
                    SSLContext sSLContext = this.a(bl2, string2, string3);
                    String[] stringArray2 = this.a(this.a(policyEnforcementContext, stringArray[24]));
                    String[] stringArray3 = this.b(this.a(policyEnforcementContext, stringArray[64]));
                    g g2 = new g(this, new h(sSLContext, stringArray2, stringArray3), sSLContext.getProvider(), sSLContext.getProtocol());
                    this.h = ClientEndpointConfig.Builder.create().sslContext((SSLContext)g2).configurator((ClientEndpointConfig.Configurator)c10).build();
                } else {
                    this.h = ClientEndpointConfig.Builder.create().configurator((ClientEndpointConfig.Configurator)c10).build();
                }
                try {
                    if (a.isLoggable(Level.FINE)) {
                        a.fine(k[14] + String.valueOf(uRI));
                    }
                }
                catch (DeploymentException deploymentException) {
                    throw SsgWebSocketUpgradeProcessor.a(deploymentException);
                }
                d d10 = new d(serverEndpointConfig);
                string2 = SsgWebSocketManager.getInstance().getServerContainer().connectToServer((Endpoint)d10, this.h, uRI);
                stringArray = k;
                serverEndpointConfig.getUserProperties().put(stringArray[28], string2);
            }
            catch (ObjectNotFoundException | DeploymentException | IllegalArgumentException throwable) {
                throw new SsgWebSocketExpectedRethrowRuntimeException(k[58] + string, throwable);
            }
            catch (Exception exception) {
                throw new ServletException((Throwable)exception);
            }
        }
    }

    @Nullable
    private String a(@NotNull PolicyEnforcementContext policyEnforcementContext, @NotNull String string) {
        try {
            if (policyEnforcementContext == null) {
                SsgWebSocketUpgradeProcessor.a(16);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(17);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        return this.a(policyEnforcementContext, string, (String)null);
    }

    @Nullable
    private String a(@NotNull PolicyEnforcementContext policyEnforcementContext, @NotNull String string, @Nullable String string2) {
        try {
            if (policyEnforcementContext == null) {
                SsgWebSocketUpgradeProcessor.a(18);
            }
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw SsgWebSocketUpgradeProcessor.a(noSuchVariableException);
        }
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(19);
            }
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw SsgWebSocketUpgradeProcessor.a(noSuchVariableException);
        }
        try {
            String string3;
            Object object = policyEnforcementContext.getVariable(string);
            try {
                string3 = object == null ? null : object.toString();
            }
            catch (NoSuchVariableException noSuchVariableException) {
                throw SsgWebSocketUpgradeProcessor.a(noSuchVariableException);
            }
            return string3;
        }
        catch (NoSuchVariableException noSuchVariableException) {
            return string2;
        }
    }

    @Nullable
    private List<String> a(@NotNull PolicyEnforcementContext policyEnforcementContext, @NotNull String string, @Nullable List<String> list) {
        try {
            if (policyEnforcementContext == null) {
                SsgWebSocketUpgradeProcessor.a(20);
            }
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw SsgWebSocketUpgradeProcessor.a(noSuchVariableException);
        }
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(21);
            }
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw SsgWebSocketUpgradeProcessor.a(noSuchVariableException);
        }
        try {
            List<String> list2;
            Object object = policyEnforcementContext.getVariable(string);
            try {
                list2 = object == null ? list : Arrays.asList(object.toString().split(","));
            }
            catch (NoSuchVariableException noSuchVariableException) {
                throw SsgWebSocketUpgradeProcessor.a(noSuchVariableException);
            }
            return list2;
        }
        catch (NoSuchVariableException noSuchVariableException) {
            return list;
        }
    }

    private ContentTypeHeader a(HttpServletRequest httpServletRequest) {
        ContentTypeHeader contentTypeHeader;
        block5: {
            block4: {
                String string = httpServletRequest.getContentType();
                try {
                    try {
                        if (string == null || string.length() <= 0) break block4;
                    }
                    catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                        throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                    }
                    contentTypeHeader = ContentTypeHeader.create((String)string);
                    break block5;
                }
                catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                    throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                }
            }
            contentTypeHeader = ContentTypeHeader.XML_DEFAULT;
        }
        return contentTypeHeader;
    }

    private void a(@NotNull Map<String, List<String>> map, @NotNull PolicyEnforcementContext policyEnforcementContext) {
        try {
            if (map == null) {
                SsgWebSocketUpgradeProcessor.a(22);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (policyEnforcementContext == null) {
                SsgWebSocketUpgradeProcessor.a(23);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        String[] stringArray = k;
        List<String> list = this.a(policyEnforcementContext, stringArray[44], SsgWebSocketManager.q);
        policyEnforcementContext.getRequest().getHeadersKnob().getHeaders(stringArray[27], false).stream().filter(header -> {
            boolean bl2;
            block6: {
                try {
                    try {
                        if (j || list != null) break block6;
                    }
                    catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                        throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                    }
                    throw new AssertionError();
                }
                catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                    throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                }
            }
            try {
                bl2 = !list.contains(((String)header.getKey()).toLowerCase());
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            return bl2;
        }).forEach(header -> this.a(map, (String)header.getKey(), header.getValue().toString()));
    }

    private void b(@NotNull Map<String, List<String>> map, @NotNull PolicyEnforcementContext policyEnforcementContext) {
        try {
            if (map == null) {
                SsgWebSocketUpgradeProcessor.a(24);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (policyEnforcementContext == null) {
                SsgWebSocketUpgradeProcessor.a(25);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        String[] stringArray = k;
        List<String> list = this.a(policyEnforcementContext, stringArray[41], SsgWebSocketManager.q);
        HeadersKnob headersKnob = policyEnforcementContext.getResponse().getHeadersKnob();
        for (Map.Entry<String, List<String>> entry : map.entrySet()) {
            block13: {
                try {
                    try {
                        if (j || list != null) break block13;
                    }
                    catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                        throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                    }
                    throw new AssertionError();
                }
                catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                    throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                }
            }
            try {
                if (list.contains(entry.getKey().toLowerCase())) continue;
                headersKnob.addHeader(entry.getKey(), (Object)String.join((CharSequence)",", (Iterable<? extends CharSequence>)entry.getValue()), k[18]);
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
        }
    }

    private void a(@NotNull Map<String, List<String>> map, @NotNull String string, @NotNull String string2) {
        try {
            if (map == null) {
                SsgWebSocketUpgradeProcessor.a(26);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(27);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (string2 == null) {
                SsgWebSocketUpgradeProcessor.a(28);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        List<String> list = map.get(string);
        if (list == null) {
            list = new ArrayList<String>();
        }
        list.add(string2);
        map.put(string, list);
    }

    SSLContext a(boolean bl2, @Nullable String string, @Nullable String string2) throws IOException, KeyStoreException, FindException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException {
        return new SSLContextFactory(this.b, this.e, this.g, this.d).create(bl2, string, string2);
    }

    String[] a(@Nullable String string) throws IllegalArgumentException {
        try {
            if (string == null) {
                return SsgWebSocketManager.o;
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw SsgWebSocketUpgradeProcessor.a(illegalArgumentException);
        }
        String[] stringArray = SslSocketUtil.filterSelectedTLSVersion((String)string, Arrays.stream(SsgWebSocketManager.p).collect(Collectors.toSet()));
        try {
            if (stringArray.length == 0) {
                throw new IllegalArgumentException(k[66] + string);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw SsgWebSocketUpgradeProcessor.a(illegalArgumentException);
        }
        return stringArray;
    }

    String[] b(@Nullable String string) throws IllegalArgumentException {
        return Objects.requireNonNullElseGet(string, DefaultHttpCiphers::getDefaultEnabledOutboundCipherSuites).split(k[56]);
    }

    public static void onClose(@NotNull Session session, @Nullable Session session2, @NotNull CloseReason closeReason, @NotNull String string) {
        try {
            if (session == null) {
                SsgWebSocketUpgradeProcessor.a(29);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (closeReason == null) {
                SsgWebSocketUpgradeProcessor.a(30);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(31);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        SsgWebSocketUpgradeProcessor.a(session, session2, closeReason, closeReason, string);
    }

    static void a(@NotNull Session session, @Nullable Session session2, @NotNull CloseReason closeReason, @NotNull CloseReason closeReason2, @NotNull String string) {
        String string2;
        block23: {
            try {
                if (session == null) {
                    SsgWebSocketUpgradeProcessor.a(32);
                }
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            try {
                if (closeReason == null) {
                    SsgWebSocketUpgradeProcessor.a(33);
                }
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            try {
                if (closeReason2 == null) {
                    SsgWebSocketUpgradeProcessor.a(34);
                }
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            try {
                if (string == null) {
                    SsgWebSocketUpgradeProcessor.a(35);
                }
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            string2 = null;
            if (session.isOpen()) {
                string2 = (String)session.getUserProperties().get(k[2]);
            }
            try {
                if (session.isOpen()) {
                    SsgWebSocketUpgradeProcessor.a(session, closeReason, string);
                }
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
            try {
                try {
                    if (session2 == null || !session2.isOpen()) break block23;
                }
                catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                    throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
                }
                SsgWebSocketUpgradeProcessor.a(session2, closeReason2, string);
            }
            catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
                throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
            }
        }
        try {
            if (string2 != null) {
                SsgWebSocketManager.getInstance().removeHandshake(string2);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
    }

    private static void a(@NotNull Session session, @NotNull CloseReason closeReason, @NotNull String string) {
        try {
            if (session == null) {
                SsgWebSocketUpgradeProcessor.a(36);
            }
        }
        catch (IOException iOException) {
            throw SsgWebSocketUpgradeProcessor.a(iOException);
        }
        try {
            if (closeReason == null) {
                SsgWebSocketUpgradeProcessor.a(37);
            }
        }
        catch (IOException iOException) {
            throw SsgWebSocketUpgradeProcessor.a(iOException);
        }
        try {
            if (string == null) {
                SsgWebSocketUpgradeProcessor.a(38);
            }
        }
        catch (IOException iOException) {
            throw SsgWebSocketUpgradeProcessor.a(iOException);
        }
        try {
            session.close(closeReason);
        }
        catch (IOException iOException) {
            try {
                a.log(Level.WARNING, k[63], new Object[]{string, iOException.getMessage()});
                if (a.isLoggable(Level.FINE)) {
                    a.log(Level.FINE, iOException, () -> {
                        String[] stringArray = k;
                        return stringArray[48] + string + stringArray[26] + closeReason.getReasonPhrase();
                    });
                }
            }
            catch (IOException iOException2) {
                throw SsgWebSocketUpgradeProcessor.a(iOException2);
            }
        }
    }

    ClientEndpointConfig a() {
        return this.h;
    }

    PolicyEnforcementContext a(@NotNull Message message) {
        try {
            if (message == null) {
                SsgWebSocketUpgradeProcessor.a(39);
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        try {
            if (this.i != null) {
                return this.i;
            }
        }
        catch (SsgWebSocketExpectedRuntimeException ssgWebSocketExpectedRuntimeException) {
            throw SsgWebSocketUpgradeProcessor.a(ssgWebSocketExpectedRuntimeException);
        }
        return PolicyEnforcementContextFactory.createPolicyEnforcementContext(null, message, true);
    }

    public void setResponseFromGatewayPec(PolicyEnforcementContext policyEnforcementContext) {
        this.i = policyEnforcementContext;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block12: {
            block11: {
                var5 = new String[71];
                var3_1 = 0;
                var2_2 = "wr$hB3Mu6\u0013\u0010k7\u0013{a,Nr&\u000f_T0Ww1\u0010H\u00161 y\"L\u007f6\u001elZ&\u000fR\u0001\u0015wr%hC5N~1$hB3Mu6\u0013F_,@\tz!\u0012ET\"F~7&l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN7\u001f\u000eh \u0004{]&VI \u0007xT0V\tT+#}V1C\u007f \u000fh \u0004{]&VI \u0005}^-Q~\u001dl \u0014~^ I~1Xb_\u0016R|7\u0017iTmFr7\u0013nE*MuXl \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN6\u0013N]*Gu15hC7K},\u0015lE&cn1\u001eh_7Kx$\u0002d^-ri \u0010hC1G\u007f\u000e\u0013tb7Mi ?i\u0012h \u0002_T0Rt+\u0005hy&C\u007f \u0004~\u0013i \u0005b]5G\u007f\u0016\u0013\u007fG*A~\u0015\u0017yY\u0017x*\u0018cT VO*3uE&Pu$\u001a^T1T~7\u0019X*\u0018cT Vr+\u0011-E,\u0002h \u0004{T1\u0002n7\u001f-\u0014H\u00161 r,Lu \u0015y^1\u000f^+\u0002dE:\n}7\u001fh_'Nb\f\u0012\u0005m$\u001axT\u000bS\u0011\"]\u0011\u000bGz!\u0013\u007f\u0006i \u0017~^-\u0019| \u0002_T0Rt+\u0005hw1Mv\u0002\u0017yT4Cb\u0015\u0013n\u0004u$\u001bhGx*\u001b\"]tV~&\u001e\"B&Pm \u0004\"E1Cu6\u0006bC7\rs1\u0002}\u001e4Gy6\u0019nZ&V4\u0016\u0005jf&@H*\u0015fT7wk\"\u0004lU&ri*\u0015hB0Mi\u001cH\u00161 b\"T~![B_nwk\"\u0004lU&\u000fI \u0007xT0V/l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PO)\u0005]C,Vt&\u0019aB\u0007t+5a^0G\u00105e5a^0G;7\u0013lB,L!e\u000bS\u0011\"]\u0011\u000bGz!\u0013\u007f\u0017H\u00161 b&Qh,\u0019c\u001c\u0017M6\u0000\u000eyT1Lz)!v \u0005~P$GK7\u0019nT0QI \u0005}^-Q~\u0003\u0004b\\\u0004Co \u0001lH\u0012| \u0002N^-V~=\u0002[P1Kz'\u001ah\u0007x*\u0018yT;V\u0003l6\u0005\u000bh1\u0019}d3Ei$\u0012h\u0003h \u0015\u0011h \u0002_T2W~6\u0002ET\"F~7\u0005\u0010I \u0007xT0VO*1lE&Uz<\u001bx)\u0019~T\u0011Gz6\u0019ce,gc1\u0013\u007f_\"NH \u0004{T1\u0005x)\u0019~T\bi \u0005}^-Q~Tl \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN6\u0013N]*Gu15hC7K},\u0015lE&cn1\u001eh_7Kx$\u0002d^-ri,\u0000lE&i~<7aX\"Q!l \u0014~^ I~1Xb_\u0016R|7\u0017iTmJ~$\u0012hC0vt\n\u001bdE\u000fl \u0014~^ I~1XhG&Lo\u001dl \u0014~^ I~1Xb_\u0016R|7\u0017iTmFr7\u0013nE*Mu!l \u0014~^ I~1Xb_\u0016R|7\u0017iTmJ~$\u0012hC0vt\n\u001bdE\u0007h \u0005~X,L6X*\u0003aUcLt1V}C,A~6\u0005-f&@H*\u0015fT7\u0002x*\u0018cT Vr*\u0018-D3Ei$\u0012h\u00111Gj0\u0013~E\u0012V \u0005~P$G;5\u0004bR&Qh,\u0018j.^7\u0004bCcGu&\u0019x_7Gi \u0012-F+Kw Vn],Qr+\u0011-E+G;2\u0013oB,Ap \u0002-\tT+#}V1C\u007f \u0013I \u0005}^-Q~\u0003\u0004b\\\u0004Co \u0001lH\rk \u0004^T0Qr*\u0018^T \rs$\u0018i]&wk\"\u0004lU&\u001ev \u0005~P$GK7\u0019nT0QI \u0007xT0VO*1lE&Uz<\u000fl \u0014~^ I~1XhG&Lo>Z7\u0011x\\&Loe\u0010bCcbU*\u0002CD/N;5\u0017\u007fP.Go \u0004-\u0016fQ<e\u0019k\u0011fQ5`\u0005-\\6Qoe\u0018bEc@~e\u0018x]/\u0007G6\\!m0\b\u0003k \u0015,^7\u0004bCcAt+\u0018hR7Ku\"Vy^cGc1\u0013\u007f_\"N;'\u0017nZ&L\u007fe\u0005hC5GieEl \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN6\u0013N]*Gu15hC7K},\u0015lE&cn1\u001eh_7Kx$\u0002d^-0l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAn6\u0002b\\*X~\u0017\u0013~A,Lh 0\u007f^.ez1\u0013zP:\u0012V \u0005~P$G;5\u0004bR&Qh,\u0018j6X*\u0003aUcLt1V}C,A~6\u0005-f&@H*\u0015fT7\u0002x*\u0018cT Vr*\u0018-D3Ei$\u0012h\u00111Gj0\u0013~E,^7\u0004bCcGu&\u0019x_7Gi \u0012-F+Kw Vn],Qr+\u0011-E+G;>Fp\u001dcY*82l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PO)\u0005NX3J~7%xX7Gh\u0013h6\u0011ZT!qt&\u001dhE\u0010Gh6\u001fb_\u001dN+\u0005xA3Mi1\u0013i\u0011\u0017nHe&\u007f^7Mx*\u001a%Bj\u0018;\u001dH\u00161 b\"T~![B_nwk\"\u0004lU&\u000fI \u0005}^-Q~\u0003p \u000f";
                var4_3 = "wr$hB3Mu6\u0013\u0010k7\u0013{a,Nr&\u000f_T0Ww1\u0010H\u00161 y\"L\u007f6\u001elZ&\u000fR\u0001\u0015wr%hC5N~1$hB3Mu6\u0013F_,@\tz!\u0012ET\"F~7&l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN7\u001f\u000eh \u0004{]&VI \u0007xT0V\tT+#}V1C\u007f \u000fh \u0004{]&VI \u0005}^-Q~\u001dl \u0014~^ I~1Xb_\u0016R|7\u0017iTmFr7\u0013nE*MuXl \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN6\u0013N]*Gu15hC7K},\u0015lE&cn1\u001eh_7Kx$\u0002d^-ri \u0010hC1G\u007f\u000e\u0013tb7Mi ?i\u0012h \u0002_T0Rt+\u0005hy&C\u007f \u0004~\u0013i \u0005b]5G\u007f\u0016\u0013\u007fG*A~\u0015\u0017yY\u0017x*\u0018cT VO*3uE&Pu$\u001a^T1T~7\u0019X*\u0018cT Vr+\u0011-E,\u0002h \u0004{T1\u0002n7\u001f-\u0014H\u00161 r,Lu \u0015y^1\u000f^+\u0002dE:\n}7\u001fh_'Nb\f\u0012\u0005m$\u001axT\u000bS\u0011\"]\u0011\u000bGz!\u0013\u007f\u0006i \u0017~^-\u0019| \u0002_T0Rt+\u0005hw1Mv\u0002\u0017yT4Cb\u0015\u0013n\u0004u$\u001bhGx*\u001b\"]tV~&\u001e\"B&Pm \u0004\"E1Cu6\u0006bC7\rs1\u0002}\u001e4Gy6\u0019nZ&V4\u0016\u0005jf&@H*\u0015fT7wk\"\u0004lU&ri*\u0015hB0Mi\u001cH\u00161 b\"T~![B_nwk\"\u0004lU&\u000fI \u0007xT0V/l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PO)\u0005]C,Vt&\u0019aB\u0007t+5a^0G\u00105e5a^0G;7\u0013lB,L!e\u000bS\u0011\"]\u0011\u000bGz!\u0013\u007f\u0017H\u00161 b&Qh,\u0019c\u001c\u0017M6\u0000\u000eyT1Lz)!v \u0005~P$GK7\u0019nT0QI \u0005}^-Q~\u0003\u0004b\\\u0004Co \u0001lH\u0012| \u0002N^-V~=\u0002[P1Kz'\u001ah\u0007x*\u0018yT;V\u0003l6\u0005\u000bh1\u0019}d3Ei$\u0012h\u0003h \u0015\u0011h \u0002_T2W~6\u0002ET\"F~7\u0005\u0010I \u0007xT0VO*1lE&Uz<\u001bx)\u0019~T\u0011Gz6\u0019ce,gc1\u0013\u007f_\"NH \u0004{T1\u0005x)\u0019~T\bi \u0005}^-Q~Tl \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN6\u0013N]*Gu15hC7K},\u0015lE&cn1\u001eh_7Kx$\u0002d^-ri,\u0000lE&i~<7aX\"Q!l \u0014~^ I~1Xb_\u0016R|7\u0017iTmJ~$\u0012hC0vt\n\u001bdE\u000fl \u0014~^ I~1XhG&Lo\u001dl \u0014~^ I~1Xb_\u0016R|7\u0017iTmFr7\u0013nE*Mu!l \u0014~^ I~1Xb_\u0016R|7\u0017iTmJ~$\u0012hC0vt\n\u001bdE\u0007h \u0005~X,L6X*\u0003aUcLt1V}C,A~6\u0005-f&@H*\u0015fT7\u0002x*\u0018cT Vr*\u0018-D3Ei$\u0012h\u00111Gj0\u0013~E\u0012V \u0005~P$G;5\u0004bR&Qh,\u0018j.^7\u0004bCcGu&\u0019x_7Gi \u0012-F+Kw Vn],Qr+\u0011-E+G;2\u0013oB,Ap \u0002-\tT+#}V1C\u007f \u0013I \u0005}^-Q~\u0003\u0004b\\\u0004Co \u0001lH\rk \u0004^T0Qr*\u0018^T \rs$\u0018i]&wk\"\u0004lU&\u001ev \u0005~P$GK7\u0019nT0QI \u0007xT0VO*1lE&Uz<\u000fl \u0014~^ I~1XhG&Lo>Z7\u0011x\\&Loe\u0010bCcbU*\u0002CD/N;5\u0017\u007fP.Go \u0004-\u0016fQ<e\u0019k\u0011fQ5`\u0005-\\6Qoe\u0018bEc@~e\u0018x]/\u0007G6\\!m0\b\u0003k \u0015,^7\u0004bCcAt+\u0018hR7Ku\"Vy^cGc1\u0013\u007f_\"N;'\u0017nZ&L\u007fe\u0005hC5GieEl \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PN6\u0013N]*Gu15hC7K},\u0015lE&cn1\u001eh_7Kx$\u0002d^-0l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAn6\u0002b\\*X~\u0017\u0013~A,Lh 0\u007f^.ez1\u0013zP:\u0012V \u0005~P$G;5\u0004bR&Qh,\u0018j6X*\u0003aUcLt1V}C,A~6\u0005-f&@H*\u0015fT7\u0002x*\u0018cT Vr*\u0018-D3Ei$\u0012h\u00111Gj0\u0013~E,^7\u0004bCcGu&\u0019x_7Gi \u0012-F+Kw Vn],Qr+\u0011-E+G;>Fp\u001dcY*82l \u0014~^ I~1Xb_\u0016R|7\u0017iTmAt+\u0018hR7vt\u0016\u0013\u007fG&PO)\u0005NX3J~7%xX7Gh\u0013h6\u0011ZT!qt&\u001dhE\u0010Gh6\u001fb_\u001dN+\u0005xA3Mi1\u0013i\u0011\u0017nHe&\u007f^7Mx*\u001a%Bj\u0018;\u001dH\u00161 b\"T~![B_nwk\"\u0004lU&\u000fI \u0005}^-Q~\u0003p \u000f".length();
                var1_4 = 10;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 43;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block11;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = SsgWebSocketUpgradeProcessor.a(v0, SsgWebSocketUpgradeProcessor.c(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u001eMz\u00049\\<\u000b\u0015Dt\u00139|*\u0017[t\u000e";
                    var4_3 = "\u001eMz\u00049\\<\u000b\u0015Dt\u00139|*\u0017[t\u000e".length();
                    var1_4 = 7;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 70;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block11;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = SsgWebSocketUpgradeProcessor.a(v0, SsgWebSocketUpgradeProcessor.c(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block12;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        SsgWebSocketUpgradeProcessor.k = var5;
        try {
            v5 = SsgWebSocketUpgradeProcessor.class.desiredAssertionStatus() == false;
        }
        catch (SsgWebSocketExpectedRuntimeException v6) {
            throw SsgWebSocketUpgradeProcessor.a(v6);
        }
        SsgWebSocketUpgradeProcessor.j = v5;
        SsgWebSocketUpgradeProcessor.a = Logger.getLogger(SsgWebSocketUpgradeProcessor.class.getName());
    }

    /*
     * Exception decompiling
     */
    private static /* synthetic */ void a(int var0) {
        /*
         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
         * 
         * org.benf.cfr.reader.util.ConfusedCFRException: Tried to end blocks [0[TRYBLOCK]], but top level block is 2[SWITCH]
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.processEndingBlocks(Op04StructuredStatement.java:435)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement.buildNestedBlocks(Op04StructuredStatement.java:484)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op03SimpleStatement.createInitialStructuredBlock(Op03SimpleStatement.java:736)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:850)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1050)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
         *     at org.benf.cfr.reader.Main.main(Main.java:54)
         */
        throw new IllegalStateException("Decompilation failed");
    }

    private static Throwable a(Throwable throwable) {
        return throwable;
    }

    private static char[] c(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 9);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 48;
                    case 1 -> 110;
                    case 2 -> 93;
                    case 3 -> 38;
                    case 4 -> 26;
                    case 5 -> 104;
                    default -> 9;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

