/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.audit.Audit
 *  com.l7tech.policy.MessageUrlResourceInfo
 *  com.l7tech.util.SyspropUtil
 *  com.l7tech.util.TextUtils
 *  org.jetbrains.annotations.NotNull
 */
package com.l7tech.server.util.res;

import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.policy.MessageUrlResourceInfo;
import com.l7tech.server.url.UrlResolver;
import com.l7tech.server.util.res.ResourceGetter;
import com.l7tech.server.util.res.UrlFinder;
import com.l7tech.server.util.res.c;
import com.l7tech.util.SyspropUtil;
import com.l7tech.util.TextUtils;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.text.ParseException;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.jetbrains.annotations.NotNull;

/*
 * Exception performing whole class analysis ignored.
 */
class d<R, M>
extends c<R, M> {
    static final String b;
    private final UrlFinder<M> c;
    private final boolean d;
    private final Pattern[] e;
    private static final String[] h;

    d(MessageUrlResourceInfo messageUrlResourceInfo, UrlResolver<R> urlResolver, UrlFinder<M> urlFinder, Audit audit) throws PatternSyntaxException {
        super(urlResolver, audit);
        if (urlFinder == null) {
            throw new NullPointerException();
        }
        this.c = urlFinder;
        this.d = messageUrlResourceInfo.isAllowMessagesWithoutUrl();
        this.e = messageUrlResourceInfo.makeUrlPatterns();
    }

    @Override
    public void close() {
    }

    /*
     * Loose catch block
     */
    @Override
    public R getResource(M m2, Map<String, Object> map) throws IOException, ResourceGetter.MalformedResourceUrlException, ResourceGetter.UrlNotPermittedException, ResourceGetter.ResourceIOException, ResourceGetter.InvalidMessageException, ResourceGetter.ResourceParseException, GeneralSecurityException, ResourceGetter.UrlNotFoundException {
        String string;
        block10: {
            block11: {
                string = this.c.findUrl(m2);
                if (string != null) break block10;
                try {
                    block12: {
                        if (!this.d) break block11;
                        break block12;
                        catch (ParseException parseException) {
                            throw com.l7tech.server.util.res.d.a(parseException);
                        }
                    }
                    return null;
                }
                catch (ParseException parseException) {
                    throw com.l7tech.server.util.res.d.a(parseException);
                }
            }
            throw new ResourceGetter.UrlNotFoundException();
        }
        try {
            if (!TextUtils.matchesAny((String)com.l7tech.server.util.res.d.a(string), (Pattern[])this.e)) {
                throw new ResourceGetter.UrlNotPermittedException(h[1] + string, string);
            }
        }
        catch (ParseException parseException) {
            throw com.l7tech.server.util.res.d.a(parseException);
        }
        try {
            return this.fetchObject(string);
        }
        catch (ParseException parseException) {
            throw new ResourceGetter.ResourceParseException(parseException, string);
        }
        catch (IOException iOException) {
            throw new ResourceGetter.ResourceIOException(iOException, string);
        }
    }

    @NotNull
    static String a(@NotNull String string) {
        String string2;
        try {
            if (string == null) {
                com.l7tech.server.util.res.d.a(0);
            }
        }
        catch (NullPointerException nullPointerException) {
            throw com.l7tech.server.util.res.d.a(nullPointerException);
        }
        String[] stringArray = h;
        if (SyspropUtil.getBoolean((String)stringArray[6], (boolean)true)) {
            string = string.replaceAll(stringArray[0], "");
        }
        try {
            string2 = string;
            if (string2 == null) {
                com.l7tech.server.util.res.d.a(1);
            }
        }
        catch (NullPointerException nullPointerException) {
            throw com.l7tech.server.util.res.d.a(nullPointerException);
        }
        return string2;
    }

    /*
     * 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 6[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;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[11];
                var3_1 = 0;
                var2_2 = "\u0005t\u0006\fK2\u001c/\\C\u001dO:5wZC\u001cN.+4M\u0006:s\u0017y9GROQ>+:AR\u001bD?y5Q\u0006\u0018I2-2DO\u001cUay/:8E\b\u0003\u0016/<4@\b\u001cD)/2Z\b\u0017R7-yEC\u001cR:>2]T\u0003\u000f(-%AV)S:>:MH\u001b>\u0018%OS\u0002D5-wNI\u001d\u0001\u001b\u00178\\h\u001aM7y'IT\u000eL>-2Z\u0006H\u0004(~wG@O\u0004(wr[\u0006\u0002T(-wFI\u001b\u00019<wFS\u0003M\u001246QD\nr/+>X`\u001d@<42FR\u001246QD\nr/+>X`\u001d@<42FR/:8E\b\u0003\u0016/<4@\b\u001cD)/2Z\b\u0017R7-yEC\u001cR:>2]T\u0003\u000f(-%AV)S:>:MH\u001b\u001c:8E\t\u0003\u0016/<4@\t\u001cD)/2Z\t\u001aU25xZC\u001c\u000e?*\u0019\u0019GR!T75wEC\u001bI4=w\rUA\u0004(y:]U\u001b\u000156#\bT\nU.+9\bH\u001aM7";
                var4_3 = "\u0005t\u0006\fK2\u001c/\\C\u001dO:5wZC\u001cN.+4M\u0006:s\u0017y9GROQ>+:AR\u001bD?y5Q\u0006\u0018I2-2DO\u001cUay/:8E\b\u0003\u0016/<4@\b\u001cD)/2Z\b\u0017R7-yEC\u001cR:>2]T\u0003\u000f(-%AV)S:>:MH\u001b>\u0018%OS\u0002D5-wNI\u001d\u0001\u001b\u00178\\h\u001aM7y'IT\u000eL>-2Z\u0006H\u0004(~wG@O\u0004(wr[\u0006\u0002T(-wFI\u001b\u00019<wFS\u0003M\u001246QD\nr/+>X`\u001d@<42FR\u001246QD\nr/+>X`\u001d@<42FR/:8E\b\u0003\u0016/<4@\b\u001cD)/2Z\b\u0017R7-yEC\u001cR:>2]T\u0003\u000f(-%AV)S:>:MH\u001b\u001c:8E\t\u0003\u0016/<4@\t\u001cD)/2Z\t\u001aU25xZC\u001c\u000e?*\u0019\u0019GR!T75wEC\u001bI4=w\rUA\u0004(y:]U\u001b\u000156#\bT\nU.+9\bH\u001aM7".length();
                var1_4 = 5;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = com.l7tech.server.util.res.d.c(v0, com.l7tech.server.util.res.d.d(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "LN3\u007fu`YJB6\u007fj2_YD,\u007fl#DC\u000e,5jxI\u0003ZS2";
                    var4_3 = "LN3\u007fu`YJB6\u007fj2_YD,\u007fl#DC\u000e,5jxI\u0003ZS2".length();
                    var1_4 = 28;
                    var0_5 = -1;
lbl22:
                    // 2 sources

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

                while (true) {
                    var5[var3_1++] = com.l7tech.server.util.res.d.c(v0, com.l7tech.server.util.res.d.d(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        com.l7tech.server.util.res.d.h = var5;
        com.l7tech.server.util.res.d.b = com.l7tech.server.util.res.d.h[2];
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String c(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 -> 19;
                    case 1 -> 29;
                    case 2 -> 98;
                    case 3 -> 108;
                    case 4 -> 37;
                    case 5 -> 107;
                    default -> 17;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

