/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.security.password.SecurePassword
 *  com.l7tech.objectmodel.EntityHeader
 *  com.l7tech.objectmodel.EntityType
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.search.Dependency$DependencyType
 *  com.l7tech.search.Dependency$MethodReturnType
 *  jakarta.inject.Inject
 *  org.jetbrains.annotations.NotNull
 */
package com.l7tech.server.search.processors;

import com.l7tech.gateway.common.security.password.SecurePassword;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.search.Dependency;
import com.l7tech.server.policy.variable.ServerVariables;
import com.l7tech.server.search.exceptions.CannotRetrieveDependenciesException;
import com.l7tech.server.search.objects.DependentObject;
import com.l7tech.server.search.processors.DefaultDependencyProcessor;
import com.l7tech.server.search.processors.DependencyFinder;
import com.l7tech.server.search.processors.DependencyProcessor;
import com.l7tech.server.search.processors.ak;
import com.l7tech.server.security.password.SecurePasswordManager;
import jakarta.inject.Inject;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.jetbrains.annotations.NotNull;

public class SecurePasswordDependencyProcessor
extends DefaultDependencyProcessor<SecurePassword>
implements DependencyProcessor<SecurePassword> {
    @Inject
    private SecurePasswordManager securePasswordManager;
    static final /* synthetic */ boolean a;
    private static final String[] c;

    /*
     * Unable to fully structure code
     * Could not resolve type clashes
     */
    @Override
    @NotNull
    public List<DependencyFinder.FindResults<SecurePassword>> find(@NotNull Object var1_1, @NotNull Dependency.DependencyType var2_2, @NotNull Dependency.MethodReturnType var3_3) throws FindException {
        try {
            if (var1_1 == null) {
                SecurePasswordDependencyProcessor.b(0);
            }
        }
        catch (FindException v0) {
            throw SecurePasswordDependencyProcessor.a((Exception)v0);
        }
        try {
            if (var2_2 == null) {
                SecurePasswordDependencyProcessor.b(1);
            }
        }
        catch (FindException v1) {
            throw SecurePasswordDependencyProcessor.a((Exception)v1);
        }
        try {
            if (var3_3 == null) {
                SecurePasswordDependencyProcessor.b(2);
            }
        }
        catch (FindException v2) {
            throw SecurePasswordDependencyProcessor.a((Exception)v2);
        }
        switch (ak.a[var3_3.ordinal()]) {
            case 1: {
                var4_4 = (SecurePassword)this.securePasswordManager.findByUniqueName((String)var1_1);
                try {
                    v3 = Arrays.asList(new DependencyFinder.FindResults[]{DependencyFinder.FindResults.create(var4_4, new EntityHeader(Goid.DEFAULT_GOID, EntityType.SECURE_PASSWORD, (String)var1_1, null))});
                    if (v3 == null) {
                        SecurePasswordDependencyProcessor.b(3);
                    }
                }
                catch (FindException v4) {
                    throw SecurePasswordDependencyProcessor.a((Exception)v4);
                }
                return v3;
            }
            case 2: {
                var4_5 = ServerVariables.SINGLE_SECPASS_PATTERN.matcher((String)var1_1);
                try {
                    try {
                        if (var4_5.matches()) ** GOTO lbl46
                        v5 = Collections.emptyList();
                        if (v5 == null) {
                        }
                        ** GOTO lbl45
                    }
                    catch (FindException v6) {
                        throw SecurePasswordDependencyProcessor.a((Exception)v6);
                    }
                    SecurePasswordDependencyProcessor.b(4);
                }
                catch (FindException v7) {
                    throw SecurePasswordDependencyProcessor.a((Exception)v7);
                }
lbl45:
                // 2 sources

                return v5;
lbl46:
                // 1 sources

                var5_6 = var4_5.group(1);
                try {
                    try {
                        if (!SecurePasswordDependencyProcessor.a && var5_6 == null) {
                        }
                        ** GOTO lbl57
                    }
                    catch (FindException v8) {
                        throw SecurePasswordDependencyProcessor.a((Exception)v8);
                    }
                    throw new AssertionError();
                }
                catch (FindException v9) {
                    throw SecurePasswordDependencyProcessor.a((Exception)v9);
                }
lbl57:
                // 1 sources

                try {
                    try {
                        if (!SecurePasswordDependencyProcessor.a && var5_6.length() <= 0) {
                        }
                        ** GOTO lbl67
                    }
                    catch (FindException v10) {
                        throw SecurePasswordDependencyProcessor.a((Exception)v10);
                    }
                    throw new AssertionError();
                }
                catch (FindException v11) {
                    throw SecurePasswordDependencyProcessor.a((Exception)v11);
                }
lbl67:
                // 1 sources

                var6_7 = (SecurePassword)this.securePasswordManager.findByUniqueName(var5_6);
                try {
                    v12 /* !! */  = var6_7 != null ? Arrays.asList(new DependencyFinder.FindResults[]{DependencyFinder.FindResults.create(var6_7, null)}) : Collections.emptyList();
                }
                catch (FindException v13) {
                    throw SecurePasswordDependencyProcessor.a((Exception)v13);
                }
                try {
                    v14 = v12 /* !! */ ;
                    if (v12 /* !! */  == null) {
                        SecurePasswordDependencyProcessor.b(5);
                    }
                }
                catch (FindException v15) {
                    throw SecurePasswordDependencyProcessor.a((Exception)v15);
                }
                return v14;
            }
        }
        try {
            v16 = super.find(var1_1, var2_2, var3_3);
            if (v16 == null) {
                SecurePasswordDependencyProcessor.b(6);
            }
        }
        catch (FindException v17) {
            throw SecurePasswordDependencyProcessor.a((Exception)v17);
        }
        return v16;
    }

    /*
     * Exception decompiling
     */
    @Override
    @NotNull
    public List<DependentObject> createDependentObjects(@NotNull Object var1_1, @NotNull Dependency.DependencyType var2_2, @NotNull Dependency.MethodReturnType var3_3) throws CannotRetrieveDependenciesException {
        /*
         * 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 [4[TRYBLOCK]], but top level block is 13[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:1055)
         *     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");
    }

    /*
     * Unable to fully structure code
     */
    static {
        block12: {
            block11: {
                var5 = new String[11];
                var3_1 = 0;
                var2_2 = "gN+\u0019 K`K )\b\u001aVcC a\u001e@\u001b\u007f\u0007m1\u001e\u001a\u001ebHtd\u001f\u000bJyUnd\u0003\u001bR`\u000fTe%\u001f\rVZFl1\b:G|B>fr#\u0018\u0003[bS \"\u0002\u001c\u001eLio0#\u001bR`\u0007p%\u001f\u000fSiSe6MI\u001b\u007f\u0000 +\u000bN\u001b\u007f\t%7M\u0003K\u007fS *\u0002\u001a\u001enB *\u0018\u0002R\u0004Ai*\tEDo)B\u0002\txBc,B\u001d[~Qe6B\u001d[mUc,B\u001eLcDe7\u001e\u0001L\u007f\bS!\u000e\u001bLiwa7\u001e\u0019Q~CD!\u001d\u000bPhBn'\u0014>LcDe7\u001e\u0001LEDo)B\u0002\txBc,B\u001d[~Qe6B\u001d[mUc,B\u001eLcDe7\u001e\u0001L\u007f\bS!\u000e\u001bLiwa7\u001e\u0019Q~CD!\u001d\u000bPhBn'\u0014>LcDe7\u001e\u0001L\u000bTe%\u001f\rVZFl1\b\u0004Ai*\t\u000eCe4\b\u0000ZiIc=9\u0017Ni";
                var4_3 = "gN+\u0019 K`K )\b\u001aVcC a\u001e@\u001b\u007f\u0007m1\u001e\u001a\u001ebHtd\u001f\u000bJyUnd\u0003\u001bR`\u000fTe%\u001f\rVZFl1\b:G|B>fr#\u0018\u0003[bS \"\u0002\u001c\u001eLio0#\u001bR`\u0007p%\u001f\u000fSiSe6MI\u001b\u007f\u0000 +\u000bN\u001b\u007f\t%7M\u0003K\u007fS *\u0002\u001a\u001enB *\u0018\u0002R\u0004Ai*\tEDo)B\u0002\txBc,B\u001d[~Qe6B\u001d[mUc,B\u001eLcDe7\u001e\u0001L\u007f\bS!\u000e\u001bLiwa7\u001e\u0019Q~CD!\u001d\u000bPhBn'\u0014>LcDe7\u001e\u0001LEDo)B\u0002\txBc,B\u001d[~Qe6B\u001d[mUc,B\u001eLcDe7\u001e\u0001L\u007f\bS!\u000e\u001bLiwa7\u001e\u0019Q~CD!\u001d\u000bPhBn'\u0014>LcDe7\u001e\u0001L\u000bTe%\u001f\rVZFl1\b\u0004Ai*\t\u000eCe4\b\u0000ZiIc=9\u0017Ni".length();
                var1_4 = 42;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = SecurePasswordDependencyProcessor.b(v0, SecurePasswordDependencyProcessor.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "_i:\u0017\u0001@SYk:\u0018\u0011@yHT=\u001c\u0010FcO\u0016_i:\u0017\u0001@SYk:\u0018\u0011@yHT=\u001c\u0010FcO";
                    var4_3 = "_i:\u0017\u0001@SYk:\u0018\u0011@yHT=\u001c\u0010FcO\u0016_i:\u0017\u0001@SYk:\u0018\u0011@yHT=\u001c\u0010FcO".length();
                    var1_4 = 22;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 119;
                        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++] = SecurePasswordDependencyProcessor.b(v0, SecurePasswordDependencyProcessor.a(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;
            }
        }
        SecurePasswordDependencyProcessor.c = var5;
        try {
            v5 = SecurePasswordDependencyProcessor.class.desiredAssertionStatus() == false;
        }
        catch (IllegalArgumentException v6) {
            throw SecurePasswordDependencyProcessor.a(v6);
        }
        SecurePasswordDependencyProcessor.a = v5;
    }

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

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x60);
        }
        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 -> 75;
                    case 1 -> 108;
                    case 2 -> 40;
                    case 3 -> 1;
                    case 4 -> 2;
                    case 5 -> 82;
                    default -> 96;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

