/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.message.HeadersKnob
 */
package com.l7tech.server.policy.variable;

import com.l7tech.message.HeadersKnob;
import com.l7tech.server.policy.variable.ExpandVariables;
import com.l7tech.server.policy.variable.MessageSelector;

class fd
extends MessageSelector.HeadersKnobSelector {
    private static final String[] c;

    fd(String string) {
        super(string);
    }

    @Override
    protected ExpandVariables.Selector.Selection createSelection(String string, HeadersKnob headersKnob) {
        String[] stringArray = c;
        String string2 = string.substring(0, string.length() - stringArray[0].length());
        String[] stringArray2 = headersKnob.getHeaderValues(string2, stringArray[1]);
        return stringArray2 != null && stringArray2.length > 0 ? new ExpandVariables.Selector.Selection(stringArray2[stringArray2.length - 1]) : null;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "^;<J\t\u001fV\u00152\n:\u001b\u0000\u000e(\u001c^\u00143!";
        int n3 = "^;<J\t\u001fV\u00152\n:\u001b\u0000\u000e(\u001c^\u00143!".length();
        int n4 = 9;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = fd.b(91, fd.b(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                c = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x64);
        }
        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 -> 43;
                    case 1 -> 13;
                    case 2 -> 8;
                    case 3 -> 117;
                    case 4 -> 59;
                    case 5 -> 34;
                    default -> 100;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

