/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.http.GenericHttpClientFactory
 *  com.l7tech.common.mime.ByteArrayStashManager
 *  com.l7tech.common.mime.ContentTypeHeader
 *  com.l7tech.common.mime.NoSuchPartException
 *  com.l7tech.common.mime.PartInfo
 *  com.l7tech.common.mime.StashManager
 *  com.l7tech.gateway.common.audit.AssertionMessages
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.message.Message
 *  com.l7tech.message.XmlKnob
 *  com.l7tech.policy.AssertionResourceInfo
 *  com.l7tech.policy.MessageUrlResourceInfo
 *  com.l7tech.policy.SingleUrlResourceInfo
 *  com.l7tech.policy.assertion.Assertion
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.policy.assertion.MessageTargetable
 *  com.l7tech.policy.assertion.PolicyAssertionException
 *  com.l7tech.policy.assertion.TargetMessageType
 *  com.l7tech.policy.assertion.xml.XslTransformation
 *  com.l7tech.policy.variable.NoSuchVariableException
 *  com.l7tech.util.Config
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ConfigFactory$ConfigurationListener
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.Functions$Unary
 *  com.l7tech.util.InvalidDocumentFormatException
 *  com.l7tech.util.Resolver
 *  com.l7tech.util.ValidatedConfig
 *  com.l7tech.xml.ElementCursor
 *  com.l7tech.xml.InvalidXpathException
 *  com.l7tech.xml.xpath.CompiledXpath
 *  com.l7tech.xml.xpath.XpathExpression
 *  com.l7tech.xml.xpath.XpathResult
 *  com.l7tech.xml.xpath.XpathResultNodeSet
 *  com.l7tech.xml.xslt.CompiledStylesheet
 *  com.l7tech.xml.xslt.TransformInput
 *  com.l7tech.xml.xslt.TransformOutput
 *  org.jetbrains.annotations.NotNull
 *  org.jetbrains.annotations.Nullable
 *  org.springframework.beans.factory.BeanFactory
 */
package com.l7tech.server.policy.assertion.xml;

import com.l7tech.common.http.GenericHttpClientFactory;
import com.l7tech.common.mime.ByteArrayStashManager;
import com.l7tech.common.mime.ContentTypeHeader;
import com.l7tech.common.mime.NoSuchPartException;
import com.l7tech.common.mime.PartInfo;
import com.l7tech.common.mime.StashManager;
import com.l7tech.gateway.common.audit.AssertionMessages;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.message.Message;
import com.l7tech.message.XmlKnob;
import com.l7tech.policy.AssertionResourceInfo;
import com.l7tech.policy.MessageUrlResourceInfo;
import com.l7tech.policy.SingleUrlResourceInfo;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.MessageTargetable;
import com.l7tech.policy.assertion.PolicyAssertionException;
import com.l7tech.policy.assertion.TargetMessageType;
import com.l7tech.policy.assertion.xml.XslTransformation;
import com.l7tech.policy.variable.NoSuchVariableException;
import com.l7tech.server.ServerConfig;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.ServerPolicyException;
import com.l7tech.server.policy.assertion.AbstractServerAssertion;
import com.l7tech.server.policy.assertion.xml.a;
import com.l7tech.server.policy.assertion.xml.b;
import com.l7tech.server.policy.assertion.xml.g;
import com.l7tech.server.policy.assertion.xml.i;
import com.l7tech.server.policy.assertion.xml.k;
import com.l7tech.server.policy.assertion.xml.l;
import com.l7tech.server.policy.assertion.xml.m;
import com.l7tech.server.policy.assertion.xml.n;
import com.l7tech.server.policy.assertion.xml.o;
import com.l7tech.server.url.AbstractUrlObjectCache;
import com.l7tech.server.url.HttpObjectCache;
import com.l7tech.server.url.UrlResolver;
import com.l7tech.server.util.res.ResourceGetter;
import com.l7tech.util.Config;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.Functions;
import com.l7tech.util.InvalidDocumentFormatException;
import com.l7tech.util.Resolver;
import com.l7tech.util.ValidatedConfig;
import com.l7tech.xml.ElementCursor;
import com.l7tech.xml.InvalidXpathException;
import com.l7tech.xml.xpath.CompiledXpath;
import com.l7tech.xml.xpath.XpathExpression;
import com.l7tech.xml.xpath.XpathResult;
import com.l7tech.xml.xpath.XpathResultNodeSet;
import com.l7tech.xml.xslt.CompiledStylesheet;
import com.l7tech.xml.xslt.TransformInput;
import com.l7tech.xml.xslt.TransformOutput;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.lang.invoke.LambdaMetafactory;
import java.security.GeneralSecurityException;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPathExpressionException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.BeanFactory;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

/*
 * Exception performing whole class analysis ignored.
 */
public class ServerXslTransformation
extends AbstractServerAssertion<XslTransformation> {
    private static final SAXParserFactory d;
    static UrlResolver<CompiledStylesheet> e;
    private static final CompiledXpath f;
    private static final AbstractUrlObjectCache.UserObjectFactory<CompiledStylesheet> g;
    final ResourceGetter<CompiledStylesheet, XmlKnob> h;
    final boolean i;
    final String[] j;
    private static final String[] k;

    public ServerXslTransformation(XslTransformation xslTransformation, BeanFactory beanFactory) throws ServerPolicyException {
        AssertionResourceInfo assertionResourceInfo;
        k k2;
        i i2;
        block7: {
            boolean bl2;
            ServerXslTransformation serverXslTransformation;
            block6: {
                super(xslTransformation);
                this.j = xslTransformation.getVariablesUsed();
                i2 = new i(this);
                k2 = new k(this);
                MessageUrlResourceInfo messageUrlResourceInfo = null;
                assertionResourceInfo = xslTransformation.getResourceInfo();
                if (assertionResourceInfo instanceof MessageUrlResourceInfo) {
                    messageUrlResourceInfo = (MessageUrlResourceInfo)assertionResourceInfo;
                }
                try {
                    try {
                        serverXslTransformation = this;
                        if (messageUrlResourceInfo == null || !messageUrlResourceInfo.isAllowMessagesWithoutUrl()) break block6;
                    }
                    catch (ServerPolicyException serverPolicyException) {
                        throw ServerXslTransformation.a((Exception)((Object)serverPolicyException));
                    }
                    bl2 = true;
                    break block7;
                }
                catch (ServerPolicyException serverPolicyException) {
                    throw ServerXslTransformation.a((Exception)((Object)serverPolicyException));
                }
            }
            bl2 = serverXslTransformation.i = false;
        }
        if (assertionResourceInfo instanceof SingleUrlResourceInfo) {
            SingleUrlResourceInfo singleUrlResourceInfo = (SingleUrlResourceInfo)assertionResourceInfo;
            singleUrlResourceInfo.setUrl(this.c(singleUrlResourceInfo.getUrl()));
        }
        this.h = ResourceGetter.createResourceGetter((Assertion)xslTransformation, assertionResourceInfo, i2, k2, this.getCache(g, beanFactory), this.getAudit());
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    protected UrlResolver<CompiledStylesheet> getCache(AbstractUrlObjectCache.UserObjectFactory<CompiledStylesheet> userObjectFactory, BeanFactory beanFactory) {
        Class<ServerXslTransformation> clazz = ServerXslTransformation.class;
        synchronized (ServerXslTransformation.class) {
            if (e != null) {
                // ** MonitorExit[var3_3] (shouldn't be in output)
                return e;
            }
            String[] stringArray = k;
            GenericHttpClientFactory genericHttpClientFactory = (GenericHttpClientFactory)beanFactory.getBean(stringArray[0]);
            try {
                if (genericHttpClientFactory == null) {
                    throw new IllegalStateException(stringArray[31]);
                }
            }
            catch (IllegalStateException illegalStateException) {
                throw ServerXslTransformation.a(illegalStateException);
            }
            Config config = ServerXslTransformation.a((Config)ServerConfig.getInstance(), this.logger);
            stringArray = k;
            e = new HttpObjectCache<CompiledStylesheet>(stringArray[25], config.getIntProperty(stringArray[9], 10000), config.getIntProperty(stringArray[24], 300000), config.getIntProperty(stringArray[20], -1), genericHttpClientFactory, userObjectFactory, HttpObjectCache.WAIT_INITIAL, stringArray[28]);
            // ** MonitorExit[var3_3] (shouldn't be in output)
            return e;
        }
    }

    private static Config a(Config config, Logger logger) {
        ValidatedConfig validatedConfig = new ValidatedConfig(config, logger, (Resolver)new l());
        String[] stringArray = k;
        validatedConfig.setMinimumValue(stringArray[22], (Number)0);
        validatedConfig.setMaximumValue(stringArray[9], (Number)1000000);
        validatedConfig.setMinimumValue(stringArray[21], (Number)-1);
        return validatedConfig;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    @Override
    public AssertionStatus checkRequest(PolicyEnforcementContext policyEnforcementContext) throws IOException, PolicyAssertionException {
        Object object;
        Message message;
        String string = this.a();
        policyEnforcementContext.setVariable(string, new String[]{""});
        String[] stringArray = k;
        policyEnforcementContext.setVariable(string + stringArray[14], "");
        policyEnforcementContext.setVariable(string + stringArray[34], "");
        TargetMessageType targetMessageType = ((XslTransformation)this.assertion).getTarget();
        switch (targetMessageType) {
            case REQUEST: {
                this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_REQUEST);
                message = policyEnforcementContext.getRequest();
                break;
            }
            case RESPONSE: {
                this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_RESPONSE);
                message = policyEnforcementContext.getResponse();
                break;
            }
            case OTHER: {
                object = ((XslTransformation)this.assertion).getOtherTargetMessageVariable();
                try {
                    if (object == null) {
                        throw new PolicyAssertionException(this.assertion, k[30]);
                    }
                }
                catch (NoSuchVariableException noSuchVariableException) {
                    throw ServerXslTransformation.a((Exception)((Object)noSuchVariableException));
                }
                try {
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_OTHER, new String[]{object});
                    message = policyEnforcementContext.getTargetMessage((MessageTargetable)this.assertion, true);
                    break;
                }
                catch (NoSuchVariableException noSuchVariableException) {
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.NO_SUCH_VARIABLE, new String[]{noSuchVariableException.getVariable()}, noSuchVariableException);
                    return AssertionStatus.FAILED;
                }
            }
            default: {
                this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_CONFIG_ISSUE);
                return AssertionStatus.SERVER_ERROR;
            }
        }
        object = new LinkedHashSet();
        try {
            AssertionStatus assertionStatus = this.a(message, policyEnforcementContext, (LinkedHashSet<String>)object);
            return assertionStatus;
        }
        catch (SAXException sAXException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_MSG_NOT_XML);
            AssertionStatus assertionStatus = AssertionStatus.BAD_REQUEST;
            return assertionStatus;
        }
        finally {
            if (!((HashSet)object).isEmpty()) {
                String[] stringArray2 = ((HashSet)object).toArray(new String[((HashSet)object).size()]);
                policyEnforcementContext.setVariable(string, stringArray2);
                stringArray = k;
                policyEnforcementContext.setVariable(string + stringArray[17], stringArray2[0]);
                policyEnforcementContext.setVariable(string + stringArray[10], stringArray2[stringArray2.length - 1]);
            }
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private AssertionStatus a(Message message, PolicyEnforcementContext policyEnforcementContext, LinkedHashSet<String> linkedHashSet) throws IOException, PolicyAssertionException, SAXException {
        AssertionStatus assertionStatus;
        int n2 = ((XslTransformation)this.assertion).getWhichMimePart();
        if (n2 <= 0) {
            n2 = 0;
        }
        m m2 = new m(this, policyEnforcementContext);
        TransformInput transformInput = null;
        try {
            TransformOutput transformOutput;
            if (n2 == 0) {
                XmlKnob xmlKnob;
                try {
                    xmlKnob = message.getXmlKnob();
                }
                catch (SAXException sAXException) {
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_MSG_NOT_XML);
                    AssertionStatus assertionStatus2 = AssertionStatus.BAD_REQUEST;
                    try {
                        if (transformInput == null) return assertionStatus2;
                        transformInput.close();
                        return assertionStatus2;
                    }
                    catch (SAXException sAXException2) {
                        throw ServerXslTransformation.a(sAXException2);
                    }
                }
                transformInput = ServerXslTransformation.a(xmlKnob, m2);
                transformOutput = new a(this, message);
            } else {
                PartInfo partInfo;
                try {
                    partInfo = message.getMimeKnob().getPart(n2);
                }
                catch (NoSuchPartException noSuchPartException) {
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_NO_SUCH_PART, Integer.toString(n2));
                    AssertionStatus assertionStatus3 = AssertionStatus.BAD_REQUEST;
                    try {
                        if (transformInput == null) return assertionStatus3;
                        transformInput.close();
                        return assertionStatus3;
                    }
                    catch (SAXException sAXException) {
                        throw ServerXslTransformation.a(sAXException);
                    }
                }
                transformInput = this.a(partInfo, m2);
                transformOutput = new b(this, partInfo);
            }
            Map<String, Object> map = policyEnforcementContext.getVariableMap(this.j, this.getAudit());
            assertionStatus = this.a(transformInput, transformOutput, map, linkedHashSet);
        }
        catch (Throwable throwable) {
            try {
                if (transformInput == null) throw throwable;
                transformInput.close();
                throw throwable;
            }
            catch (SAXException sAXException) {
                throw ServerXslTransformation.a(sAXException);
            }
        }
        try {
            if (transformInput == null) return assertionStatus;
            transformInput.close();
            return assertionStatus;
        }
        catch (SAXException sAXException) {
            throw ServerXslTransformation.a(sAXException);
        }
    }

    private AssertionStatus a(TransformInput transformInput, TransformOutput transformOutput, Map<String, Object> map, LinkedHashSet<String> linkedHashSet) throws IOException, PolicyAssertionException {
        try {
            CompiledStylesheet compiledStylesheet;
            block18: {
                block19: {
                    compiledStylesheet = this.h.getResource(transformInput.getXmlKnob(), map);
                    try {
                        if (compiledStylesheet != null) break block18;
                        if (!this.i) break block19;
                    }
                    catch (ResourceGetter.InvalidMessageException invalidMessageException) {
                        throw ServerXslTransformation.a(invalidMessageException);
                    }
                    this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_NO_PI_OK);
                    return AssertionStatus.NONE;
                }
                String[] stringArray = new String[1];
                String[] stringArray2 = k;
                stringArray[0] = stringArray2[8];
                this.logAndAudit((AuditDetailMessage)AssertionMessages.EXCEPTION_WARNING_WITH_MORE_INFO, stringArray);
                return AssertionStatus.SERVER_ERROR;
            }
            compiledStylesheet.transform(transformInput, transformOutput, this.a(linkedHashSet));
            return AssertionStatus.NONE;
        }
        catch (ResourceGetter.InvalidMessageException invalidMessageException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_MSG_NOT_XML);
            return AssertionStatus.BAD_REQUEST;
        }
        catch (SAXException sAXException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_MSG_NOT_XML);
            return AssertionStatus.BAD_REQUEST;
        }
        catch (ResourceGetter.MalformedResourceUrlException malformedResourceUrlException) {
            String[] stringArray = new String[2];
            stringArray[0] = malformedResourceUrlException.getUrl();
            String[] stringArray3 = k;
            stringArray[1] = stringArray3[12];
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_CANT_READ_XSL, stringArray);
            return AssertionStatus.BAD_REQUEST;
        }
        catch (ResourceGetter.UrlNotPermittedException urlNotPermittedException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_BAD_URL, urlNotPermittedException.getUrl());
            return AssertionStatus.BAD_REQUEST;
        }
        catch (ResourceGetter.ResourceIOException resourceIOException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_CANT_READ_XSL, new String[]{resourceIOException.getUrl(), ExceptionUtils.getMessage((Throwable)resourceIOException)}, ExceptionUtils.getDebugException((Throwable)resourceIOException));
            return AssertionStatus.SERVER_ERROR;
        }
        catch (ResourceGetter.ResourceParseException resourceParseException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_BAD_EXT_XSL, new String[]{resourceParseException.getUrl(), ExceptionUtils.getMessage((Throwable)resourceParseException)}, ExceptionUtils.getDebugException((Throwable)resourceParseException));
            return AssertionStatus.SERVER_ERROR;
        }
        catch (GeneralSecurityException generalSecurityException) {
            String[] stringArray = new String[2];
            String[] stringArray4 = k;
            stringArray[0] = stringArray4[6];
            stringArray[1] = ExceptionUtils.getMessage((Throwable)generalSecurityException);
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_CANT_READ_XSL, stringArray);
            return AssertionStatus.SERVER_ERROR;
        }
        catch (ResourceGetter.UrlNotFoundException urlNotFoundException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_NO_PI);
            return AssertionStatus.BAD_REQUEST;
        }
        catch (TransformerException transformerException) {
            AssertionStatus assertionStatus;
            block22: {
                block21: {
                    block20: {
                        assertionStatus = AssertionStatus.SERVER_ERROR;
                        Throwable throwable = transformerException.getCause();
                        try {
                            try {
                                try {
                                    if (throwable != null && k[32].equals(throwable.getMessage())) break block20;
                                }
                                catch (ResourceGetter.InvalidMessageException invalidMessageException) {
                                    throw ServerXslTransformation.a(invalidMessageException);
                                }
                                if (throwable != null) break block21;
                            }
                            catch (ResourceGetter.InvalidMessageException invalidMessageException) {
                                throw ServerXslTransformation.a(invalidMessageException);
                            }
                            if (!k[33].equals(transformerException.getMessage())) break block21;
                        }
                        catch (ResourceGetter.InvalidMessageException invalidMessageException) {
                            throw ServerXslTransformation.a(invalidMessageException);
                        }
                    }
                    assertionStatus = AssertionStatus.FALSIFIED;
                    break block22;
                }
                String string = k[29] + ExceptionUtils.getMessage((Throwable)transformerException);
                this.logAndAudit((AuditDetailMessage)AssertionMessages.EXCEPTION_WARNING_WITH_MORE_INFO, new String[]{string}, ExceptionUtils.getDebugException((Throwable)transformerException));
            }
            return assertionStatus;
        }
    }

    private ErrorListener a(LinkedHashSet<String> linkedHashSet) {
        return new n(this, linkedHashSet);
    }

    private String a() {
        return ((XslTransformation)this.assertion).getMsgVarPrefix() + "." + XslTransformation.VARIABLE_NAME;
    }

    private String a(XmlKnob xmlKnob) throws SAXException, InvalidDocumentFormatException, IOException {
        block15: {
            if (!xmlKnob.isDomParsed()) {
                // empty if block
            }
            ElementCursor elementCursor = xmlKnob.getElementCursor();
            elementCursor.moveToRoot();
            XpathResult xpathResult = null;
            try {
                xpathResult = elementCursor.getXpathResult(f);
            }
            catch (XPathExpressionException xPathExpressionException) {
                try {
                    if (this.logger.isLoggable(Level.WARNING)) {
                        this.logger.log(Level.WARNING, k[27] + ExceptionUtils.getMessage((Throwable)xPathExpressionException), xPathExpressionException);
                    }
                }
                catch (XPathExpressionException xPathExpressionException2) {
                    throw ServerXslTransformation.a(xPathExpressionException2);
                }
            }
            if (xpathResult != null) {
                String string;
                XpathResultNodeSet xpathResultNodeSet;
                block16: {
                    xpathResultNodeSet = xpathResult.getNodeSet();
                    try {
                        try {
                            try {
                                if (xpathResultNodeSet == null || xpathResultNodeSet.isEmpty()) break block15;
                            }
                            catch (XPathExpressionException xPathExpressionException) {
                                throw ServerXslTransformation.a(xPathExpressionException);
                            }
                            if (xpathResultNodeSet.size() == 1) break block16;
                        }
                        catch (XPathExpressionException xPathExpressionException) {
                            throw ServerXslTransformation.a(xPathExpressionException);
                        }
                        this.logAndAudit((AuditDetailMessage)AssertionMessages.XSLT_MULTIPLE_PIS);
                        throw new InvalidDocumentFormatException();
                    }
                    catch (XPathExpressionException xPathExpressionException) {
                        throw ServerXslTransformation.a(xPathExpressionException);
                    }
                }
                String string2 = xpathResultNodeSet.getNodeValue(0);
                String string3 = this.a(string2);
                try {
                    string = string3 == null ? null : this.c(string3);
                }
                catch (XPathExpressionException xPathExpressionException) {
                    throw ServerXslTransformation.a(xPathExpressionException);
                }
                return string;
            }
        }
        return null;
    }

    @Nullable
    private String a(String string) throws SAXException {
        try {
            String[] stringArray = k;
            String string2 = stringArray[23] + string + stringArray[18];
            String[] stringArray2 = new String[]{null, null};
            this.a(string2, new o(this, stringArray2));
            String string3 = stringArray2[0];
            String string4 = stringArray2[1];
            if (!stringArray[15].equals(string4)) {
                this.logger.fine(stringArray[11]);
                return null;
            }
            return string3;
        }
        catch (ParserConfigurationException parserConfigurationException) {
            throw new RuntimeException(parserConfigurationException);
        }
        catch (IOException iOException) {
            throw new RuntimeException(iOException);
        }
    }

    void a(String string, DefaultHandler defaultHandler) throws IOException, SAXException, ParserConfigurationException {
        String[] stringArray = k;
        d.setFeature(stringArray[16], true);
        d.setFeature(stringArray[19], false);
        d.setFeature(stringArray[4], false);
        d.newSAXParser().parse((InputStream)new ByteArrayInputStream(string.getBytes()), defaultHandler);
    }

    private static TransformInput a(XmlKnob xmlKnob, Functions.Unary<Object, String> unary) throws IOException, SAXException {
        return new TransformInput(xmlKnob, null, unary);
    }

    private TransformInput a(PartInfo partInfo, Functions.Unary<Object, String> unary) throws IOException, SAXException {
        try {
            Message message = new Message((StashManager)new ByteArrayStashManager(), ContentTypeHeader.XML_DEFAULT, partInfo.getInputStream(false));
            return new TransformInput(message.getXmlKnob(), (Closeable)message, unary);
        }
        catch (NoSuchPartException noSuchPartException) {
            throw new IOException(k[37]);
        }
    }

    private static String b(@NotNull String string) {
        try {
            if (string == null) {
                ServerXslTransformation.b(0);
            }
        }
        catch (IllegalStateException illegalStateException) {
            throw ServerXslTransformation.a(illegalStateException);
        }
        try {
            if (string.endsWith(k[35])) {
                return k[1];
            }
        }
        catch (IllegalStateException illegalStateException) {
            throw ServerXslTransformation.a(illegalStateException);
        }
        return null;
    }

    private String c(@NotNull String string) {
        Object object;
        try {
            if (string == null) {
                ServerXslTransformation.b(1);
            }
        }
        catch (IllegalStateException illegalStateException) {
            throw ServerXslTransformation.a(illegalStateException);
        }
        try {
            object = k[39].equals(((XslTransformation)this.assertion).getXsltVersion()) ? string + k[36] : string;
        }
        catch (IllegalStateException illegalStateException) {
            throw ServerXslTransformation.a(illegalStateException);
        }
        return object;
    }

    private static /* synthetic */ void lambda$static$0(String string) {
        try {
            if (e != null) {
                ((HttpObjectCache)e).setMaxCacheAge(ConfigFactory.getIntProperty((String)k[24], (int)300000));
            }
        }
        catch (IllegalStateException illegalStateException) {
            throw ServerXslTransformation.a(illegalStateException);
        }
    }

    static /* synthetic */ void access$000(ServerXslTransformation serverXslTransformation, AuditDetailMessage auditDetailMessage, String[] stringArray) {
        serverXslTransformation.logAndAudit(auditDetailMessage, stringArray);
    }

    static /* synthetic */ void access$100(ServerXslTransformation serverXslTransformation, AuditDetailMessage auditDetailMessage, String[] stringArray) {
        serverXslTransformation.logAndAudit(auditDetailMessage, stringArray);
    }

    static /* synthetic */ void access$200(ServerXslTransformation serverXslTransformation, AuditDetailMessage auditDetailMessage, String[] stringArray) {
        serverXslTransformation.logAndAudit(auditDetailMessage, stringArray);
    }

    /*
     * Unable to fully structure code
     */
    static {
        block12: {
            block11: {
                var5 = new String[40];
                var3_1 = 0;
                var2_2 = "\u0002h\u0000\ty~I\u000fr\u0000?[qT\u0005n\r\u0003X2D>+n\u0013\fWwN\u001e<\u0012\u0016H2`$s\u00007O~LJl\u0015\u000b[\u007fE\u001ey\u0006Y\u001d7SM<\u001b\u001f\u001a7SD9\u0007YWgS\u001e<\u001a\u0016N2B\u000f<\u001a\fV~\u0015\ry\u0000!I~T<y\u0006\nS}N,n\u001b\u0014o`L7\u0002h\u0000\t\u0000=\u000f\u0012q\u0018WU`GEo\u0015\u0001\u0015tE\u000bh\u0001\u000b_a\u000f\u000fd\u0000\u001cH|A\u00061\u0004\u0018HsM\u000fh\u0011\u000b\u0017wN\u001eu\u0000\u0010_a>\ts\u0019VV%T\u000f\u007f\u001cVIwR\u001cy\u0006VJ}L\u0003\u007f\rV[aS\u000fn\u0000\u0010U|\u000f\u0012q\u0018ViwR\u001cy\u0006!I~t\u0018}\u001a\n\\}R\u0007}\u0000\u0010U|*\"H )i2U\u0018pNYO|A\bp\u0011YN}\u0000\tn\u0011\u0018Nw\u0000\u000brT*i^\u0000\ts\u001a\r_jT(\u001an\u001b\u001a_aS\u0003r\u0013TS|S\u001en\u0001\u001aN{O\u00044S\u0001W~\r\u0019h\r\u0015_aH\u000fy\u0000^\u0013$#r\u0000\u001cH|A\u0006<\u0007\u001cHdE\u0018<\u0011\u000bH}RP<\u001a\fV~\u0000\u0018y\u0007\u0016O`C\u000f\u0013\u0012o\u0018\rwsX)}\u0017\u0011_WN\u001en\u001d\u001cI\u0005Dp\u0015\nN@#{\u001a\u0016H{N\r<\f\u0014V?S\u001ee\u0018\u001cIzE\u000fhT\tH}C\u000fo\u0007\u0010Tu\u0000\u0003r\u0007\rHgC\u001eu\u001b\u0017\u001aeI\u001etT\u0017U|\r2O8YNkP\u000f\u000e?N8YSa\u0000\u0003r\u0002\u0018V{D\u000f\u0012o\u0018\rwsX)}\u0017\u0011_SG\u000f\u0006Dz\u001d\u000bIf\b\u001ey\f\r\u0015jS\u00064\u0002h\u0000\t\u0000=\u000f\u000bl\u0015\u001aRw\u000e\u0005n\u0013VB\u007fLEz\u0011\u0018NgR\u000fo[\u001dSaA\u0006p\u001b\u000e\u0017vO\th\r\t_?D\u000f\u007f\u0018\u0006Dz\u001d\u000bIf\u0003J3J5\u0002h\u0000\t\u0000=\u000f\u0012q\u0018WU`GEo\u0015\u0001\u0015tE\u000bh\u0001\u000b_a\u000f\u000fd\u0000\u001cH|A\u00061\u0013\u001cTwR\u000bpY\u001cTfI\u001eu\u0011\n\u0014\u0012o\u0018\rwsX9h\u0015\u0015_QA\tt\u00118]w\u0014\u0012o\u0018\rwsX9h\u0015\u0015_QA\tt\u00118]w\u0013\u0012o\u0018\rwsX)}\u0017\u0011_WN\u001en\u001d\u001cI\u0007Vx\u0001\u0014Wk\u0000\u000f\u0012o\u0018\rwsX)}\u0017\u0011_SG\u000f\u00052O8Tn\u0017\u000ey\u0017\u0016HsT\u000fK\u001d\rRJS\u0006h\"\u001cHaI\u0005r\u000e2L\u0015\rR2F\u000bu\u0018\u001c^(\u0000\u0015\u0012o\u0018=Uqm\u000bd0\u0016M|L\u0005}\u0010*ShE\u001d/n\u0006\u0016H2T\u0018}\u001a\n\\}R\u0007u\u001a\u001e\u001avO\ti\u0019\u001cTf\u001aJ\u001f>}\u0006\u001e_f\u0000\u0007y\u0007\n[uEJj\u0015\u000bSsB\u0006yT\u0017Uf\u0000\u0019y\u0000\u0019$sT\u0011NfP)p\u001d\u001cTff\u000b\u007f\u0000\u0016Hk\u0000\by\u0015\u0017\t\u001ey\u0006\u0014S|A\u001ey\u001f9h\r\u0015_aH\u000fy\u0000Y^{R\u000f\u007f\u0000\u001c^2T\u000fn\u0019\u0010TsT\u0003s\u001a\u0005Dp\u0015\nN\u0007Id\u0007\u0015N \u0010\u0007Id\u0007\u0015N \u0010-'U9<\u001abA\u0018hT\u0011[a\u0000\u000bp\u0006\u001c[vYJ~\u0011\u001cT2D\u000fo\u0000\u000bOqT\u0003j\u0011\u0015C2R\u000f}\u0010";
                var4_3 = "\u0002h\u0000\ty~I\u000fr\u0000?[qT\u0005n\r\u0003X2D>+n\u0013\fWwN\u001e<\u0012\u0016H2`$s\u00007O~LJl\u0015\u000b[\u007fE\u001ey\u0006Y\u001d7SM<\u001b\u001f\u001a7SD9\u0007YWgS\u001e<\u001a\u0016N2B\u000f<\u001a\fV~\u0015\ry\u0000!I~T<y\u0006\nS}N,n\u001b\u0014o`L7\u0002h\u0000\t\u0000=\u000f\u0012q\u0018WU`GEo\u0015\u0001\u0015tE\u000bh\u0001\u000b_a\u000f\u000fd\u0000\u001cH|A\u00061\u0004\u0018HsM\u000fh\u0011\u000b\u0017wN\u001eu\u0000\u0010_a>\ts\u0019VV%T\u000f\u007f\u001cVIwR\u001cy\u0006VJ}L\u0003\u007f\rV[aS\u000fn\u0000\u0010U|\u000f\u0012q\u0018ViwR\u001cy\u0006!I~t\u0018}\u001a\n\\}R\u0007}\u0000\u0010U|*\"H )i2U\u0018pNYO|A\bp\u0011YN}\u0000\tn\u0011\u0018Nw\u0000\u000brT*i^\u0000\ts\u001a\r_jT(\u001an\u001b\u001a_aS\u0003r\u0013TS|S\u001en\u0001\u001aN{O\u00044S\u0001W~\r\u0019h\r\u0015_aH\u000fy\u0000^\u0013$#r\u0000\u001cH|A\u0006<\u0007\u001cHdE\u0018<\u0011\u000bH}RP<\u001a\fV~\u0000\u0018y\u0007\u0016O`C\u000f\u0013\u0012o\u0018\rwsX)}\u0017\u0011_WN\u001en\u001d\u001cI\u0005Dp\u0015\nN@#{\u001a\u0016H{N\r<\f\u0014V?S\u001ee\u0018\u001cIzE\u000fhT\tH}C\u000fo\u0007\u0010Tu\u0000\u0003r\u0007\rHgC\u001eu\u001b\u0017\u001aeI\u001etT\u0017U|\r2O8YNkP\u000f\u000e?N8YSa\u0000\u0003r\u0002\u0018V{D\u000f\u0012o\u0018\rwsX)}\u0017\u0011_SG\u000f\u0006Dz\u001d\u000bIf\b\u001ey\f\r\u0015jS\u00064\u0002h\u0000\t\u0000=\u000f\u000bl\u0015\u001aRw\u000e\u0005n\u0013VB\u007fLEz\u0011\u0018NgR\u000fo[\u001dSaA\u0006p\u001b\u000e\u0017vO\th\r\t_?D\u000f\u007f\u0018\u0006Dz\u001d\u000bIf\u0003J3J5\u0002h\u0000\t\u0000=\u000f\u0012q\u0018WU`GEo\u0015\u0001\u0015tE\u000bh\u0001\u000b_a\u000f\u000fd\u0000\u001cH|A\u00061\u0013\u001cTwR\u000bpY\u001cTfI\u001eu\u0011\n\u0014\u0012o\u0018\rwsX9h\u0015\u0015_QA\tt\u00118]w\u0014\u0012o\u0018\rwsX9h\u0015\u0015_QA\tt\u00118]w\u0013\u0012o\u0018\rwsX)}\u0017\u0011_WN\u001en\u001d\u001cI\u0007Vx\u0001\u0014Wk\u0000\u000f\u0012o\u0018\rwsX)}\u0017\u0011_SG\u000f\u00052O8Tn\u0017\u000ey\u0017\u0016HsT\u000fK\u001d\rRJS\u0006h\"\u001cHaI\u0005r\u000e2L\u0015\rR2F\u000bu\u0018\u001c^(\u0000\u0015\u0012o\u0018=Uqm\u000bd0\u0016M|L\u0005}\u0010*ShE\u001d/n\u0006\u0016H2T\u0018}\u001a\n\\}R\u0007u\u001a\u001e\u001avO\ti\u0019\u001cTf\u001aJ\u001f>}\u0006\u001e_f\u0000\u0007y\u0007\n[uEJj\u0015\u000bSsB\u0006yT\u0017Uf\u0000\u0019y\u0000\u0019$sT\u0011NfP)p\u001d\u001cTff\u000b\u007f\u0000\u0016Hk\u0000\by\u0015\u0017\t\u001ey\u0006\u0014S|A\u001ey\u001f9h\r\u0015_aH\u000fy\u0000Y^{R\u000f\u007f\u0000\u001c^2T\u000fn\u0019\u0010TsT\u0003s\u001a\u0005Dp\u0015\nN\u0007Id\u0007\u0015N \u0010\u0007Id\u0007\u0015N \u0010-'U9<\u001abA\u0018hT\u0011[a\u0000\u000bp\u0006\u001c[vYJ~\u0011\u001cT2D\u000fo\u0000\u000bOqT\u0003j\u0011\u0015C2R\u000f}\u0010".length();
                var1_4 = 17;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = ServerXslTransformation.b(v0, ServerXslTransformation.d(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "=L:\blBk&Y\u0003z\u0010f";
                    var4_3 = "=L:\blBk&Y\u0003z\u0010f".length();
                    var1_4 = 9;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 30;
                        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++] = ServerXslTransformation.b(v0, ServerXslTransformation.d(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;
            }
        }
        ServerXslTransformation.k = var5;
        ServerXslTransformation.d = SAXParserFactory.newInstance();
        ServerXslTransformation.e = null;
        ServerXslTransformation.d.setNamespaceAware(false);
        ServerXslTransformation.d.setValidating(false);
        var6_7 = (ConfigFactory.ConfigurationListener)LambdaMetafactory.metafactory(null, null, null, (Ljava/lang/String;)V, lambda$static$0(java.lang.String ), (Ljava/lang/String;)V)();
        v5 = new String[1];
        var0_6 = ServerXslTransformation.k;
        v5[0] = var0_6[13];
        ConfigFactory.addListener((ConfigFactory.ConfigurationListener)var6_7, (String[])v5);
        try {
            ServerXslTransformation.f = new XpathExpression(var0_6[7]).compile();
        }
        catch (InvalidXpathException var6_8) {
            throw new RuntimeException(var6_8);
        }
        ServerXslTransformation.g = new g();
    }

    /*
     * Exception decompiling
     */
    private static /* synthetic */ void b(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 1[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 Exception a(Exception exception) {
        return exception;
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 86;
                    case 1 -> 32;
                    case 2 -> 72;
                    case 3 -> 69;
                    case 4 -> 6;
                    case 5 -> 46;
                    default -> 28;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

