/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.policy.Policy
 *  com.l7tech.policy.assertion.Assertion
 */
package com.l7tech.server.policy;

import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.objectmodel.Goid;
import com.l7tech.policy.Policy;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.server.policy.PolicyService;
import com.l7tech.server.policy.PolicyServlet;
import com.l7tech.server.policy.ad;
import java.io.IOException;
import java.util.logging.Level;

class ac
implements PolicyService.PolicyGetter {
    final boolean val$allowDisabled;
    final boolean val$inlineIncludes;
    final boolean val$includeComments;
    final PolicyServlet this$0;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    ac(PolicyServlet policyServlet, boolean bl2, boolean bl3, boolean bl4) {
        this.this$0 = policyServlet;
        this.val$allowDisabled = bl2;
        this.val$inlineIncludes = bl3;
        this.val$includeComments = bl4;
    }

    /*
     * Loose catch block
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    @Override
    public PolicyService.ServiceInfo getPolicy(String string) {
        try {
            PublishedService publishedService;
            block15: {
                block16: {
                    PublishedService publishedService2;
                    Goid goid = null;
                    Long l2 = null;
                    try {
                        goid = Goid.parseGoid((String)string);
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        try {
                            l2 = Long.parseLong(string);
                        }
                        catch (NumberFormatException numberFormatException) {
                            String[] stringArray = a;
                            PolicyServlet.access$200(this.this$0).log(Level.INFO, stringArray[3] + string);
                            throw new IllegalStateException(stringArray[0] + string + ")");
                        }
                    }
                    try {
                        publishedService2 = goid != null ? PolicyServlet.access$300(this.this$0, goid) : PolicyServlet.access$400(this.this$0, l2);
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw ac.a(illegalArgumentException);
                    }
                    publishedService = publishedService2;
                    if (publishedService == null) throw new IllegalStateException(a[2] + string + ")");
                    if (!publishedService.isDisabled()) break block15;
                    break block16;
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw ac.a(illegalArgumentException);
                    }
                }
                try {
                    if (this.val$allowDisabled) break block15;
                    throw new IllegalStateException(a[2] + string + ")");
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw ac.a(illegalArgumentException);
                    }
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw ac.a(illegalArgumentException);
                }
            }
            Assertion assertion = new Policy(publishedService.getPolicy()).getAssertion();
            if (assertion == null) {
                return null;
            }
            String string2 = this.this$0.policyCache.getUniquePolicyVersionIdentifer(publishedService.getPolicy().getGoid());
            return new ad(this, assertion, string2);
        }
        catch (IOException iOException) {
            PolicyServlet.access$500(this.this$0).log(Level.SEVERE, a[1], iOException);
            return null;
        }
    }

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

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[4];
                var3_1 = 0;
                var2_2 = "Q'_\n2(|\",B\b{-vw,I\\s\u0013a#C\u00124?9r#_\u000f>kim.D\u001f\"";
                var4_3 = "Q'_\n2(|\",B\b{-vw,I\\s\u0013a#C\u00124?9r#_\u000f>kim.D\u001f\"".length();
                var1_4 = 19;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = ac.a(v0, ac.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = ")_'rJP\u0004ZT:p\u0003U\u000e\u000fT1$\u000b\u0019\u0019[;jLGA\n['wF\u0013\u0012\u001fH#m@VA\u0013^o$";
                    var4_3 = ")_'rJP\u0004ZT:p\u0003U\u000e\u000fT1$\u000b\u0019\u0019[;jLGA\n['wF\u0013\u0012\u001fH#m@VA\u0013^o$".length();
                    var1_4 = 19;
                    var0_5 = -1;
lbl22:
                    // 2 sources

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

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 2);
        }
        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 -> 25;
                    case 1 -> 89;
                    case 2 -> 54;
                    case 3 -> 103;
                    case 4 -> 64;
                    case 5 -> 80;
                    default -> 2;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

