/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.service.PublishedService
 *  org.jetbrains.annotations.NotNull
 *  org.jetbrains.annotations.Nullable
 */
package com.l7tech.server.messageprocessor.injection;

import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.server.extension.registry.processorinjection.ServiceInjectionsRegistry;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.messageprocessor.injection.MessageProcessorInjector;
import com.l7tech.server.messageprocessor.injection.ServiceInjectionContextImpl;
import com.l7tech.server.messageprocessor.injection.a;
import com.l7tech.server.messageprocessor.injection.b;
import java.util.logging.Logger;
import java.util.stream.Stream;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*
 * Exception performing whole class analysis ignored.
 */
public class MessageProcessorInjectorImpl
implements MessageProcessorInjector {
    private static final Logger a;
    private final ServiceInjectionsRegistry b;
    private final ServiceInjectionsRegistry c;
    private static final String[] d;

    public MessageProcessorInjectorImpl(@NotNull ServiceInjectionsRegistry serviceInjectionsRegistry, @NotNull ServiceInjectionsRegistry serviceInjectionsRegistry2) {
        if (serviceInjectionsRegistry == null) {
            MessageProcessorInjectorImpl.a(0);
        }
        if (serviceInjectionsRegistry2 == null) {
            MessageProcessorInjectorImpl.a(1);
        }
        this.b = serviceInjectionsRegistry;
        this.c = serviceInjectionsRegistry2;
    }

    @Override
    public boolean executePreServiceInjections(@NotNull PolicyEnforcementContext policyEnforcementContext) {
        try {
            if (policyEnforcementContext == null) {
                MessageProcessorInjectorImpl.a(2);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw MessageProcessorInjectorImpl.a(illegalArgumentException);
        }
        return MessageProcessorInjectorImpl.a(this.b, policyEnforcementContext);
    }

    @Override
    public boolean executePostServiceInjections(@NotNull PolicyEnforcementContext policyEnforcementContext) {
        try {
            if (policyEnforcementContext == null) {
                MessageProcessorInjectorImpl.a(3);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw MessageProcessorInjectorImpl.a(illegalArgumentException);
        }
        return MessageProcessorInjectorImpl.a(this.c, policyEnforcementContext);
    }

    static boolean a(@NotNull ServiceInjectionsRegistry serviceInjectionsRegistry, @NotNull PolicyEnforcementContext policyEnforcementContext) {
        try {
            if (serviceInjectionsRegistry == null) {
                MessageProcessorInjectorImpl.a(4);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw MessageProcessorInjectorImpl.a(illegalArgumentException);
        }
        try {
            if (policyEnforcementContext == null) {
                MessageProcessorInjectorImpl.a(5);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw MessageProcessorInjectorImpl.a(illegalArgumentException);
        }
        Stream stream = Stream.concat(serviceInjectionsRegistry.getTaggedExtensions(MessageProcessorInjectorImpl.a(policyEnforcementContext.getService())).stream(), serviceInjectionsRegistry.getTaggedExtensions("*").stream()).distinct();
        ServiceInjectionContextImpl serviceInjectionContextImpl = new ServiceInjectionContextImpl(policyEnforcementContext);
        return stream.reduce(Boolean.TRUE, new a(serviceInjectionContextImpl), new b());
    }

    @NotNull
    private static String[] a(@Nullable PublishedService publishedService) {
        if (publishedService != null) {
            String[] stringArray;
            String[] stringArray2;
            String string = publishedService.getProperty(d[1]);
            try {
                stringArray2 = string == null ? new String[]{} : string.split(",");
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw MessageProcessorInjectorImpl.a(illegalArgumentException);
            }
            try {
                stringArray = stringArray2;
                if (stringArray2 == null) {
                    MessageProcessorInjectorImpl.a(6);
                }
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw MessageProcessorInjectorImpl.a(illegalArgumentException);
            }
            return stringArray;
        }
        return new String[0];
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[14];
                var3_1 = 0;
                var2_2 = "m2L*sp\u0017t#L0xt\u000e~!]\u0010yl(s*L\u001abk\u000es3{\u001cqk\u0012i2P\u0004i!N\n\u0019n%[\u000f\u007fa\u0004T.C\u001cuv\br.Z+se\bn4[\u0000\u001cx8L\u001acv\u0004M/Z\rEg\u0013k)J\u001c_l\u000bx#]\u0010yl\u0012I~/DVz5\u0015x#AVeg\u0013k%[V{g\u0012n!N\u001cfp\u000e~%Z\nypNt.C\u001cuv\br.\u00064sq\u0012|'L)dm\u0002x3Z\u0016dK\u000fw%J\ryp(p0E\u0011x8L\u001acv\u0004T.C\u001cuv\br.Z\u0007~/G\rsz\u0015'm/Z\rEg\u0013k)J\u001c_l\u0017r#H\r\u007fm\u000fT.C\u001cuv\br.Z+se\bn4[\u0000*]\u000eF\rXw\rq`D\u001cbj\u000ey`\f\n8'\u0012=-\\\nb\"\u000fr4\t\u000bsv\u0014o.\t\u0017cn\r\u000ez%]*sp\u0017t#L-we\u0012\u001bx8L\u001acv\u0004M2L*sp\u0017t#L0xh\u0004~4@\u0016xq>\\2N\f{g\u000fi`O\u0016d\"!S/]7cn\r=0H\u000bwo\u0004i%[Y1'\u0012:`F\u001f6'\u00123eZY{w\u0012i`G\u0016b\"\u0003x`G\fzn";
                var4_3 = "m2L*sp\u0017t#L0xt\u000e~!]\u0010yl(s*L\u001abk\u000es3{\u001cqk\u0012i2P\u0004i!N\n\u0019n%[\u000f\u007fa\u0004T.C\u001cuv\br.Z+se\bn4[\u0000\u001cx8L\u001acv\u0004M/Z\rEg\u0013k)J\u001c_l\u000bx#]\u0010yl\u0012I~/DVz5\u0015x#AVeg\u0013k%[V{g\u0012n!N\u001cfp\u000e~%Z\nypNt.C\u001cuv\br.\u00064sq\u0012|'L)dm\u0002x3Z\u0016dK\u000fw%J\ryp(p0E\u0011x8L\u001acv\u0004T.C\u001cuv\br.Z\u0007~/G\rsz\u0015'm/Z\rEg\u0013k)J\u001c_l\u0017r#H\r\u007fm\u000fT.C\u001cuv\br.Z+se\bn4[\u0000*]\u000eF\rXw\rq`D\u001cbj\u000ey`\f\n8'\u0012=-\\\nb\"\u000fr4\t\u000bsv\u0014o.\t\u0017cn\r\u000ez%]*sp\u0017t#L-we\u0012\u001bx8L\u001acv\u0004M2L*sp\u0017t#L0xh\u0004~4@\u0016xq>\\2N\f{g\u000fi`O\u0016d\"!S/]7cn\r=0H\u000bwo\u0004i%[Y1'\u0012:`F\u001f6'\u00123eZY{w\u0012i`G\u0016b\"\u0003x`G\fzn".length();
                var1_4 = 38;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = MessageProcessorInjectorImpl.a(v0, MessageProcessorInjectorImpl.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\bY2 \fCc\u000eU7 \u0013\u0011e\u001dS- \r\u0011d\u0018W8j\u0010\u0006x\bS,|\u000f\u00068\u0002X5j\u0003\u0000~\u0004XpB\u0005\u0007d\nQ:_\u0012\u001bt\u000eE,`\u0012=y\u0001S<{\u000f\u0006^\u0006F3\u0006W_1f\u0014J";
                    var4_3 = "\bY2 \fCc\u000eU7 \u0013\u0011e\u001dS- \r\u0011d\u0018W8j\u0010\u0006x\bS,|\u000f\u00068\u0002X5j\u0003\u0000~\u0004XpB\u0005\u0007d\nQ:_\u0012\u001bt\u000eE,`\u0012=y\u0001S<{\u000f\u0006^\u0006F3\u0006W_1f\u0014J".length();
                    var1_4 = 73;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 98;
                        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++] = MessageProcessorInjectorImpl.a(v0, MessageProcessorInjectorImpl.a(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;
            }
        }
        MessageProcessorInjectorImpl.d = var5;
        MessageProcessorInjectorImpl.a = Logger.getLogger(MessageProcessorInjectorImpl.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 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 IllegalArgumentException a(IllegalArgumentException illegalArgumentException) {
        return illegalArgumentException;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x75);
        }
        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 -> 9;
                    case 1 -> 84;
                    case 2 -> 61;
                    case 3 -> 109;
                    case 4 -> 2;
                    case 5 -> 22;
                    default -> 117;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

