/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.siteminder.SiteMinderContext
 *  com.l7tech.gateway.common.siteminder.SiteMinderContext$RealmDef
 *  com.l7tech.util.Functions$Unary
 */
package com.l7tech.server.policy.variable;

import com.l7tech.gateway.common.siteminder.SiteMinderContext;
import com.l7tech.server.policy.variable.ExpandVariables;
import com.l7tech.server.policy.variable.SiteMinderContextSelector;
import com.l7tech.util.Functions;

class fs
implements Functions.Unary<ExpandVariables.Selector.Selection, String> {
    final SiteMinderContext val$ctx;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    fs(SiteMinderContextSelector siteMinderContextSelector, SiteMinderContext siteMinderContext) {
        this.val$ctx = siteMinderContext;
    }

    public ExpandVariables.Selector.Selection call(String string) {
        SiteMinderContext.RealmDef realmDef = this.val$ctx.getRealmDef();
        String string2 = string;
        int n2 = -1;
        switch (string2.hashCode()) {
            case -82270087: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[1])) break;
                n2 = 0;
                break;
            }
            case 288957180: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[0])) break;
                n2 = 1;
                break;
            }
            case 110026: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[4])) break;
                n2 = 2;
                break;
            }
            case -1326184120: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[3])) break;
                n2 = 3;
                break;
            }
            case 3373707: {
                if (!string2.equals(a[2])) break;
                n2 = 4;
            }
        }
        switch (n2) {
            case 0: {
                return new ExpandVariables.Selector.Selection(realmDef.getFormLocation());
            }
            case 1: {
                return new ExpandVariables.Selector.Selection(Integer.toString(realmDef.getCredentials()));
            }
            case 2: {
                return new ExpandVariables.Selector.Selection(realmDef.getOid());
            }
            case 3: {
                return new ExpandVariables.Selector.Selection(realmDef.getDomOid());
            }
            case 4: {
                return new ExpandVariables.Selector.Selection(realmDef.getName());
            }
        }
        return null;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[5];
                var3_1 = 0;
                var2_2 = "\u0002zF)?*l\biO>\f\u0007gQ 6+{\u0000|J\"4\u0004\u000fiN(";
                var4_3 = "\u0002zF)?*l\biO>\f\u0007gQ 6+{\u0000|J\"4\u0004\u000fiN(".length();
                var1_4 = 11;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = fs.a(v0, fs.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u0014v_3\"1\u0003\u001fpV";
                    var4_3 = "\u0014v_3\"1\u0003\u001fpV".length();
                    var1_4 = 6;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 41;
                        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++] = fs.a(v0, fs.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;
            }
        }
        fs.a = var5;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x20);
        }
        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 -> 89;
                    case 1 -> 48;
                    case 2 -> 27;
                    case 3 -> 117;
                    case 4 -> 98;
                    case 5 -> 124;
                    default -> 32;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

