/*
 * Decompiled with CFR 0.152.
 */
package com.l7tech.server.message;

public abstract class PolicyContextCache {
    private static final String[] f;

    public void put(String string, Object object, Info info) {
        block14: {
            block12: {
                block13: {
                    try {
                        if (string == null) {
                            throw new IllegalArgumentException(f[1]);
                        }
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw PolicyContextCache.a(illegalArgumentException);
                    }
                    try {
                        if (info == null) {
                            throw new IllegalArgumentException(f[2]);
                        }
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw PolicyContextCache.a(illegalArgumentException);
                    }
                    try {
                        try {
                            try {
                                if (info.a > 0L && info.a <= System.currentTimeMillis()) break block12;
                            }
                            catch (IllegalArgumentException illegalArgumentException) {
                                throw PolicyContextCache.a(illegalArgumentException);
                            }
                            if (object != null) break block13;
                        }
                        catch (IllegalArgumentException illegalArgumentException) {
                            throw PolicyContextCache.a(illegalArgumentException);
                        }
                        throw new IllegalArgumentException(f[0]);
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw PolicyContextCache.a(illegalArgumentException);
                    }
                }
                this.putItem(string, this.newItem(string, object, info));
                break block14;
            }
            this.removeItem(string);
        }
    }

    public Object get(String string) {
        return this.get(string, null);
    }

    public Object get(String string, Object object) {
        Object object2;
        block7: {
            block4: {
                block6: {
                    Item item;
                    block5: {
                        object2 = null;
                        item = this.getItem(string);
                        try {
                            try {
                                if (item == null) break block4;
                                if (item.c.a <= 0L) break block5;
                            }
                            catch (IllegalArgumentException illegalArgumentException) {
                                throw PolicyContextCache.a(illegalArgumentException);
                            }
                            if (item.c.a <= System.currentTimeMillis()) break block6;
                        }
                        catch (IllegalArgumentException illegalArgumentException) {
                            throw PolicyContextCache.a(illegalArgumentException);
                        }
                    }
                    object2 = item.b;
                    break block7;
                }
                this.removeItem(string);
                break block7;
            }
            object2 = object;
        }
        return object2;
    }

    protected abstract void putItem(String var1, Item var2);

    protected abstract Item getItem(String var1);

    protected abstract void removeItem(String var1);

    protected Item newItem(String string, Object object, Info info) {
        return new Item(this, string, object, info);
    }

    private static IllegalArgumentException a(IllegalArgumentException illegalArgumentException) {
        return illegalArgumentException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "Wtc&\u0003w\fTf{s\b8\u0015\u0001wjs\b\"\rM\u0015Otb6F:\u0014Ra/=\t#ACp/=\u0013;\r\u0015H{i<F:\u0014Ra/=\t#ACp/=\u0013;\r";
        int n3 = "Wtc&\u0003w\fTf{s\b8\u0015\u0001wjs\b\"\rM\u0015Otb6F:\u0014Ra/=\t#ACp/=\u0013;\r\u0015H{i<F:\u0014Ra/=\t#ACp/=\u0013;\r".length();
        int n4 = 22;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = PolicyContextCache.a(41, PolicyContextCache.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                f = 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] ^ 0x48);
        }
        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 -> 60;
                    case 2 -> 38;
                    case 3 -> 122;
                    case 4 -> 79;
                    case 5 -> 126;
                    default -> 72;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    public static class Info {
        private final long a;

        public Info(long l2) {
            this.a = l2;
        }
    }

    protected class Item {
        private final String a;
        private final Object b;
        private final Info c;

        protected Item(PolicyContextCache policyContextCache, String string, Object object, Info info) {
            this.a = string;
            this.b = object;
            this.c = info;
        }
    }
}

