/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.siteminder.SiteMinderContext
 *  com.l7tech.gateway.common.siteminder.SiteMinderContext$ResourceContextDef
 *  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 ft
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
     */
    ft(SiteMinderContextSelector siteMinderContextSelector, SiteMinderContext siteMinderContext) {
        this.val$ctx = siteMinderContext;
    }

    public ExpandVariables.Selector.Selection call(String string) {
        SiteMinderContext.ResourceContextDef resourceContextDef = this.val$ctx.getResContextDef();
        String string2 = string;
        int n2 = -1;
        switch (string2.hashCode()) {
            case 92750597: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[1])) break;
                n2 = 0;
                break;
            }
            case -1422950858: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[0])) break;
                n2 = 1;
                break;
            }
            case -341064690: {
                String[] stringArray = a;
                if (!string2.equals(stringArray[3])) break;
                n2 = 2;
                break;
            }
            case -905826493: {
                if (!string2.equals(a[2])) break;
                n2 = 3;
            }
        }
        switch (n2) {
            case 0: {
                return new ExpandVariables.Selector.Selection(resourceContextDef.getAgent());
            }
            case 1: {
                return new ExpandVariables.Selector.Selection(resourceContextDef.getAction());
            }
            case 2: {
                return new ExpandVariables.Selector.Selection(resourceContextDef.getResource());
            }
            case 3: {
                return new ExpandVariables.Selector.Selection(resourceContextDef.getServer());
            }
        }
        return null;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[4];
                var3_1 = 0;
                var2_2 = "b/\"?\u007f5\u0005b+38d";
                var4_3 = "b/\"?\u007f5\u0005b+38d".length();
                var1_4 = 6;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = ft.a(v0, ft.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "z#.*\u007f#\b{#/3o#$l";
                    var4_3 = "z#.*\u007f#\b{#/3o#$l".length();
                    var1_4 = 6;
                    var0_5 = -1;
lbl22:
                    // 2 sources

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

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x5C);
        }
        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 -> 18;
                    case 1 -> 93;
                    case 2 -> 71;
                    case 3 -> 71;
                    case 4 -> 1;
                    case 5 -> 74;
                    default -> 92;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

