/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.policy.assertion.ext.store.KeyValueStore
 *  com.l7tech.policy.assertion.ext.store.KeyValueStoreException
 *  com.l7tech.policy.assertion.ext.store.KeyValueStoreServices
 */
package com.l7tech.server.store;

import com.l7tech.policy.assertion.ext.store.KeyValueStore;
import com.l7tech.policy.assertion.ext.store.KeyValueStoreException;
import com.l7tech.policy.assertion.ext.store.KeyValueStoreServices;
import com.l7tech.server.policy.CustomKeyValueStoreManager;
import com.l7tech.server.store.CustomKeyValueStoreImpl;

public class KeyValueStoreServicesImpl
implements KeyValueStoreServices {
    private final CustomKeyValueStoreImpl a;
    private static final String[] b;

    public KeyValueStoreServicesImpl(CustomKeyValueStoreManager customKeyValueStoreManager) {
        this.a = new CustomKeyValueStoreImpl(customKeyValueStoreManager);
    }

    public KeyValueStore getKeyValueStore() throws KeyValueStoreException {
        return this.getKeyValueStore(b[0]);
    }

    public KeyValueStore getKeyValueStore(String string) throws KeyValueStoreException {
        try {
            if (!b[2].equals(string)) {
                throw new KeyValueStoreException(b[1] + string);
            }
        }
        catch (KeyValueStoreException keyValueStoreException) {
            throw KeyValueStoreServicesImpl.a(keyValueStoreException);
        }
        return this.a;
    }

    private static KeyValueStoreException a(KeyValueStoreException keyValueStoreException) {
        return keyValueStoreException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "~\f\u0001KyTP{6\u0007OeIPt\u0016\u001cAe[](Y\rUEnC\u0011a\u0003\u0019[n\u001aBc\r\u0007K+[Gv\u000b\u0019OiVT7\u0015\u001cZc\u001a_v\u000f\u0010\u0014+\u0015~\f\u0001KyTP{6\u0007OeIPt\u0016\u001cAe[]";
        int n3 = "~\f\u0001KyTP{6\u0007OeIPt\u0016\u001cAe[](Y\rUEnC\u0011a\u0003\u0019[n\u001aBc\r\u0007K+[Gv\u000b\u0019OiVT7\u0015\u001cZc\u001a_v\u000f\u0010\u0014+\u0015~\f\u0001KyTP{6\u0007OeIPt\u0016\u001cAe[]".length();
        int n4 = 21;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = KeyValueStoreServicesImpl.a(31, KeyValueStoreServicesImpl.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                b = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x2E);
        }
        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 -> 8;
                    case 1 -> 125;
                    case 2 -> 106;
                    case 3 -> 49;
                    case 4 -> 20;
                    case 5 -> 37;
                    default -> 46;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

