/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.security.rbac.OperationType
 *  com.l7tech.objectmodel.EntityType
 *  com.l7tech.policy.PolicyType
 *  com.l7tech.util.Triple
 *  org.jetbrains.annotations.NotNull
 */
package com.l7tech.server.upgrade;

import com.l7tech.gateway.common.security.rbac.OperationType;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.policy.PolicyType;
import com.l7tech.server.upgrade.AbstractDynamicRolePermissionsUpgradeTask;
import com.l7tech.util.Triple;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.jetbrains.annotations.NotNull;

public class Upgrade71To80UpdateRoles
extends AbstractDynamicRolePermissionsUpgradeTask {
    private static final String[] c;

    @Override
    protected boolean shouldCreateMissingRoles() {
        return false;
    }

    @Override
    protected List<Triple<OperationType, String, EntityType>> permissionsToAdd() {
        return Arrays.asList(new Triple((Object)OperationType.READ, null, (Object)EntityType.ASSERTION_ACCESS), new Triple((Object)OperationType.CREATE, null, (Object)EntityType.ASSERTION_ACCESS));
    }

    @Override
    protected boolean shouldIgnorePolicyType(PolicyType policyType) {
        boolean bl2;
        try {
            bl2 = !PolicyType.INCLUDE_FRAGMENT.equals((Object)policyType);
        }
        catch (IllegalStateException illegalStateException) {
            throw Upgrade71To80UpdateRoles.a(illegalStateException);
        }
        return bl2;
    }

    @Override
    @NotNull
    protected Collection<EntityType> getEntityTypesToUpgrade() {
        List<EntityType> list;
        try {
            list = Arrays.asList(EntityType.SERVICE, EntityType.POLICY, EntityType.FOLDER);
            if (list == null) {
                Upgrade71To80UpdateRoles.a(0);
            }
        }
        catch (IllegalStateException illegalStateException) {
            throw Upgrade71To80UpdateRoles.a(illegalStateException);
        }
        return list;
    }

    private static /* synthetic */ void a(int n2) {
        String[] stringArray = c;
        throw new IllegalStateException(String.format(stringArray[2], stringArray[0], stringArray[1]));
    }

    private static IllegalStateException a(IllegalStateException illegalStateException) {
        return illegalStateException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "D\u007fU\u001a`0\u0005BsP\u001a\u007fb\u0003QuJ\u001ayw\u0016Uq\\P#R\u0001@bYQi0@s\u007f\u0000\u0005Yw\u0015Fd]gck\u0014T\u0017@uLpbs\u0018SilL|b\u0002s\u007fmEku\u0010Cu*g^WABr\u001dK0UPxo\u001eC0\u001dF\"\"\u0002\u0007}MFx'\u001fHd\u0018Gis\u0004U~\u0018[yk\u001d";
        int n3 = "D\u007fU\u001a`0\u0005BsP\u001a\u007fb\u0003QuJ\u001ayw\u0016Uq\\P#R\u0001@bYQi0@s\u007f\u0000\u0005Yw\u0015Fd]gck\u0014T\u0017@uLpbs\u0018SilL|b\u0002s\u007fmEku\u0010Cu*g^WABr\u001dK0UPxo\u001eC0\u001dF\"\"\u0002\u0007}MFx'\u001fHd\u0018Gis\u0004U~\u0018[yk\u001d".length();
        int n4 = 50;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = Upgrade71To80UpdateRoles.b(32, Upgrade71To80UpdateRoles.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] ^ 0x51);
        }
        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 -> 7;
                    case 1 -> 48;
                    case 2 -> 24;
                    case 3 -> 21;
                    case 4 -> 44;
                    case 5 -> 39;
                    default -> 81;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

