/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.Component
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.gateway.common.audit.SystemMessages
 *  com.l7tech.gateway.common.security.rbac.Role
 *  com.l7tech.gateway.common.security.rbac.Role$Tag
 *  com.l7tech.identity.AuthenticationException
 *  com.l7tech.identity.FailAttemptsExceededException
 *  com.l7tech.identity.FailInactivityPeriodExceededException
 *  com.l7tech.identity.IdentityProviderConfigManager
 *  com.l7tech.identity.LogonInfo
 *  com.l7tech.identity.LogonInfo$State
 *  com.l7tech.identity.User
 *  com.l7tech.identity.UserDisabledException
 *  com.l7tech.identity.internal.InternalUser
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.PersistentEntity
 *  com.l7tech.objectmodel.SaveException
 *  com.l7tech.objectmodel.UpdateException
 *  com.l7tech.util.Config
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.Functions$UnaryVoid
 *  com.l7tech.util.Pair
 *  com.l7tech.util.ValidatedConfig
 *  org.springframework.beans.BeansException
 *  org.springframework.context.ApplicationContext
 *  org.springframework.context.ApplicationContextAware
 *  org.springframework.context.ApplicationEvent
 *  org.springframework.transaction.PlatformTransactionManager
 *  org.springframework.transaction.annotation.Propagation
 *  org.springframework.transaction.annotation.Transactional
 *  org.springframework.transaction.support.TransactionCallback
 *  org.springframework.transaction.support.TransactionTemplate
 */
package com.l7tech.server.logon;

import com.l7tech.gateway.common.Component;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.gateway.common.audit.SystemMessages;
import com.l7tech.gateway.common.security.rbac.Role;
import com.l7tech.identity.AuthenticationException;
import com.l7tech.identity.FailAttemptsExceededException;
import com.l7tech.identity.FailInactivityPeriodExceededException;
import com.l7tech.identity.IdentityProviderConfigManager;
import com.l7tech.identity.LogonInfo;
import com.l7tech.identity.User;
import com.l7tech.identity.UserDisabledException;
import com.l7tech.identity.internal.InternalUser;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.server.audit.Auditor;
import com.l7tech.server.event.system.SystemEvent;
import com.l7tech.server.identity.AuthenticationResult;
import com.l7tech.server.identity.IdentityProviderFactory;
import com.l7tech.server.identity.internal.InternalIdentityProvider;
import com.l7tech.server.identity.internal.InternalUserManager;
import com.l7tech.server.logon.LogonInfoManager;
import com.l7tech.server.logon.LogonService;
import com.l7tech.server.logon.a;
import com.l7tech.server.logon.b;
import com.l7tech.server.logon.c;
import com.l7tech.server.logon.d;
import com.l7tech.server.logon.e;
import com.l7tech.server.security.rbac.RoleManager;
import com.l7tech.util.Config;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.Functions;
import com.l7tech.util.Pair;
import com.l7tech.util.ValidatedConfig;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.MessageFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.security.auth.Subject;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

public class SSMLogonService
implements LogonService,
PropertyChangeListener,
ApplicationContextAware {
    private ApplicationContext a;
    private static final Logger b;
    private PlatformTransactionManager c;
    private LogonInfoManager d;
    private Config e;
    private Auditor f;
    private final RoleManager g;
    private InternalUserManager h;
    private final IdentityProviderFactory i;
    private int j;
    private int k;
    private int l;
    private static final int m = 1200;
    private static final int n = 5;
    private static final int o = 35;
    private static final String p;
    private static final String[] q;

    public SSMLogonService(PlatformTransactionManager platformTransactionManager, LogonInfoManager logonInfoManager, Config config, RoleManager roleManager, IdentityProviderFactory identityProviderFactory) {
        if (platformTransactionManager == null) {
            String[] stringArray = q;
            throw new IllegalArgumentException(stringArray[23]);
        }
        try {
            if (logonInfoManager == null) {
                throw new IllegalArgumentException(q[18]);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw SSMLogonService.a(illegalArgumentException);
        }
        try {
            if (config == null) {
                throw new IllegalArgumentException(q[15]);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw SSMLogonService.a(illegalArgumentException);
        }
        this.c = platformTransactionManager;
        this.d = logonInfoManager;
        this.setConfig(config);
        this.g = roleManager;
        this.i = identityProviderFactory;
        String[] stringArray = q;
        this.j = this.e.getIntProperty(stringArray[20], 5);
        this.k = this.e.getIntProperty(stringArray[3], 1200);
        this.l = this.e.getIntProperty(stringArray[25], 35);
    }

    public PlatformTransactionManager getTransactionManager() {
        return this.c;
    }

    public void setTransactionManager(PlatformTransactionManager platformTransactionManager) {
        this.c = platformTransactionManager;
    }

    public LogonInfoManager getLogonManager() {
        return this.d;
    }

    public void setLogonManager(LogonInfoManager logonInfoManager) {
        this.d = logonInfoManager;
    }

    public void setConfig(Config config) {
        ValidatedConfig validatedConfig = new ValidatedConfig(config, b);
        String[] stringArray = q;
        validatedConfig.setMinimumValue(stringArray[12], (Number)1);
        validatedConfig.setMaximumValue(stringArray[20], (Number)20);
        validatedConfig.setMinimumValue(stringArray[2], (Number)1);
        validatedConfig.setMaximumValue(stringArray[3], (Number)86400);
        validatedConfig.setMinimumValue(stringArray[7], (Number)1);
        validatedConfig.setMaximumValue(stringArray[25], (Number)365);
        this.e = validatedConfig;
    }

    @Override
    public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
        block14: {
            String string;
            block13: {
                block12: {
                    string = propertyChangeEvent.getPropertyName();
                    try {
                        try {
                            if (string == null || !string.equals(q[20])) break block12;
                        }
                        catch (IllegalArgumentException illegalArgumentException) {
                            throw SSMLogonService.a(illegalArgumentException);
                        }
                        this.j = this.e.getIntProperty(q[20], 5);
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw SSMLogonService.a(illegalArgumentException);
                    }
                }
                try {
                    try {
                        if (string == null || !string.equals(q[3])) break block13;
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw SSMLogonService.a(illegalArgumentException);
                    }
                    this.k = this.e.getIntProperty(q[3], 1200);
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SSMLogonService.a(illegalArgumentException);
                }
            }
            try {
                try {
                    if (string == null || !string.equals(q[25])) break block14;
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SSMLogonService.a(illegalArgumentException);
                }
                this.l = this.e.getIntProperty(q[25], 35);
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw SSMLogonService.a(illegalArgumentException);
            }
        }
    }

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.a = applicationContext;
        this.f = new Auditor(this, this.a, b);
    }

    /*
     * Loose catch block
     */
    @Override
    public void hookPreLoginCheck(User user) throws AuthenticationException {
        try {
            block21: {
                Calendar calendar;
                LogonInfo logonInfo;
                long l2;
                block22: {
                    block20: {
                        block19: {
                            block18: {
                                try {
                                    if (!(user instanceof InternalUser) || ((InternalUser)user).isEnabled()) break block18;
                                }
                                catch (FindException findException) {
                                    throw SSMLogonService.a((Exception)((Object)findException));
                                }
                                this.f.logAndAudit((AuditDetailMessage)SystemMessages.AUTH_USER_DISABLED, user.getLogin());
                                String[] stringArray = q;
                                String string = stringArray[0] + user.getLogin() + stringArray[9];
                                b.info(string);
                                throw new UserDisabledException(string);
                            }
                            l2 = System.currentTimeMillis();
                            logonInfo = this.d.findByCompositeKey(user.getProviderId(), user.getLogin(), true);
                            try {
                                if (logonInfo == null) {
                                    throw new FindException(q[11] + user.getLogin() + "'");
                                }
                            }
                            catch (FindException findException) {
                                throw SSMLogonService.a((Exception)((Object)findException));
                            }
                            try {
                                if (logonInfo.getState() != LogonInfo.State.INACTIVE || this.b(user)) break block19;
                            }
                            catch (FindException findException) {
                                throw SSMLogonService.a((Exception)((Object)findException));
                            }
                            String[] stringArray = q;
                            String string = stringArray[1];
                            b.info(string);
                            throw new FailInactivityPeriodExceededException(string);
                        }
                        try {
                            if (logonInfo.getState() != LogonInfo.State.EXCEED_ATTEMPT && logonInfo.getFailCount() < this.j) break block20;
                        }
                        catch (FindException findException) {
                            throw SSMLogonService.a((Exception)((Object)findException));
                        }
                        calendar = Calendar.getInstance();
                        calendar.setTimeInMillis(logonInfo.getLastAttempted());
                        calendar.add(13, this.k);
                        if (calendar.getTimeInMillis() >= l2) {
                            this.f.logAndAudit((AuditDetailMessage)SystemMessages.AUTH_USER_EXCEED_ATTEMPT, user.getLogin(), Integer.toString(logonInfo.getFailCount()), Integer.toString(this.j));
                            String[] stringArray = q;
                            String string = stringArray[26] + user.getLogin() + stringArray[13];
                            b.info(string);
                            this.a(user, (AuthenticationResult)null);
                            this.a(user, LogonInfo.State.EXCEED_ATTEMPT);
                            throw new FailAttemptsExceededException(string);
                        }
                        this.a(user, l2);
                    }
                    calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(logonInfo.getLastActivity());
                    calendar.add(10, this.l * 24);
                    if (this.b(user)) break block21;
                    if (this.l == 0) break block21;
                    break block22;
                    catch (FindException findException) {
                        throw SSMLogonService.a((Exception)((Object)findException));
                    }
                }
                try {
                    block23: {
                        if (logonInfo.getLastActivity() <= 0L) break block21;
                        break block23;
                        catch (FindException findException) {
                            throw SSMLogonService.a((Exception)((Object)findException));
                        }
                    }
                    if (calendar.getTimeInMillis() > l2) break block21;
                }
                catch (FindException findException) {
                    throw SSMLogonService.a((Exception)((Object)findException));
                }
                long l3 = (l2 - logonInfo.getLastActivity()) / 1000L / 60L / 60L / 24L;
                this.f.logAndAudit((AuditDetailMessage)SystemMessages.AUTH_USER_EXCEED_INACTIVITY, user.getLogin(), Long.toString(l3), Integer.toString(this.l));
                String[] stringArray = q;
                String string = stringArray[26] + user.getLogin() + stringArray[14];
                b.info(string);
                this.a(user, LogonInfo.State.INACTIVE);
                throw new FailInactivityPeriodExceededException(string);
            }
            this.a(user);
        }
        catch (FindException findException) {
            // empty catch block
        }
    }

    @Override
    public void updateLogonAttempt(User user, AuthenticationResult authenticationResult) {
        this.a(user, authenticationResult);
    }

    /*
     * Loose catch block
     */
    @Override
    @Transactional(propagation=Propagation.REQUIRES_NEW)
    public void updateInactivityInfo() {
        String string = null;
        String[] stringArray = q;
        String string2 = stringArray[10];
        try {
            long l2 = System.currentTimeMillis();
            Calendar calendar = Calendar.getInstance();
            Collection collection = this.d.findAll();
            for (LogonInfo logonInfo : collection) {
                try {
                    if (logonInfo.getState() != LogonInfo.State.ACTIVE) {
                        continue;
                    }
                }
                catch (UpdateException updateException) {
                    throw SSMLogonService.a((Exception)((Object)updateException));
                }
                calendar.setTimeInMillis(l2);
                calendar.setTimeInMillis(logonInfo.getLastActivity());
                calendar.add(10, this.l * 24);
                if (this.l == 0) continue;
                try {
                    block14: {
                        if (logonInfo.getLastActivity() <= 0L) continue;
                        break block14;
                        catch (UpdateException updateException) {
                            throw SSMLogonService.a((Exception)((Object)updateException));
                        }
                    }
                    if (calendar.getTimeInMillis() > l2) continue;
                }
                catch (UpdateException updateException) {
                    throw SSMLogonService.a((Exception)((Object)updateException));
                }
                try {
                    this.d.update(logonInfo);
                    long l3 = (l2 - logonInfo.getLastActivity()) / 1000L / 60L / 60L / 24L;
                    String string3 = MessageFormat.format(SystemMessages.AUTH_USER_EXCEED_INACTIVITY.getMessage(), logonInfo.getLogin(), Long.toString(l3), Integer.toString(this.l));
                    this.a.publishEvent((ApplicationEvent)new SystemEvent(this, Component.GW_ACCOUNT_MANAGER, null, Level.INFO, string3){
                        static final long serialVersionUID = 8227207759276868000L;
                        private static final String b = 1.b(4, 1.b("0Sk\u0017IU=Qyf\u0019_O \u0007Y|\u0001\u001cv&\u001fY|\u0017N"));

                        @Override
                        public String getAction() {
                            return b;
                        }

                        private static char[] b(String string) {
                            char[] cArray = string.toCharArray();
                            if (cArray.length < 2) {
                                cArray = cArray;
                                cArray[0] = (char)(cArray[0] ^ 0x4D);
                            }
                            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 -> 117;
                                        case 1 -> 52;
                                        case 2 -> 12;
                                        case 3 -> 124;
                                        case 4 -> 56;
                                        case 5 -> 63;
                                        default -> 77;
                                    })));
                                    ++n3;
                                    n4 = n4;
                                } while (n4 > n3);
                            }
                            return new String(cArray2).intern();
                        }
                    });
                    logonInfo.setState(LogonInfo.State.INACTIVE);
                }
                catch (UpdateException updateException) {
                    stringArray = q;
                    string = stringArray[16] + logonInfo.getLogin() + stringArray[19] + ExceptionUtils.getMessage((Throwable)updateException);
                    break;
                }
            }
        }
        catch (FindException findException) {
            stringArray = q;
            string = stringArray[6] + ExceptionUtils.getMessage((Throwable)findException);
        }
        if (string != null) {
            String string4 = q[4] + string;
            this.a.publishEvent((ApplicationEvent)new SystemEvent(this, Component.GW_ACCOUNT_MANAGER, null, Level.INFO, string4){
                static final long serialVersionUID = -7605801838251551715L;
                private static final String b = 2.b(68, 2.b("#ba<pn4BHl2ft)\u0014hv*%M/\fhv<w"));

                @Override
                public String getAction() {
                    return b;
                }

                private static char[] b(String string) {
                    char[] cArray = string.toCharArray();
                    if (cArray.length < 2) {
                        cArray = cArray;
                        cArray[0] = (char)(cArray[0] ^ 4);
                    }
                    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 -> 38;
                                case 1 -> 69;
                                case 2 -> 70;
                                case 3 -> 23;
                                case 4 -> 65;
                                case 5 -> 68;
                                default -> 4;
                            })));
                            ++n3;
                            n4 = n4;
                        } while (n4 > n3);
                    }
                    return new String(cArray2).intern();
                }
            });
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    @Override
    @Transactional(propagation=Propagation.REQUIRES_NEW)
    public void checkLogonInfos() {
        block12: {
            String[] stringArray;
            Object object;
            String string = null;
            try {
                object = this.g.getExplicitRoleAssignments();
                Iterator<Pair<Goid, String>> iterator = object.iterator();
                while (iterator.hasNext()) {
                    InternalUser internalUser;
                    InternalUserManager internalUserManager;
                    Pair<Goid, String> pair = iterator.next();
                    Goid goid = (Goid)pair.left;
                    String string2 = null;
                    if (IdentityProviderConfigManager.INTERNALPROVIDER_SPECIAL_GOID.equals((Object)goid)) {
                        internalUserManager = this.a();
                        internalUser = (InternalUser)internalUserManager.findByPrimaryKey((String)pair.right);
                        if (internalUser != null) {
                            string2 = internalUser.getLogin();
                        } else {
                            stringArray = q;
                            b.info(stringArray[24] + String.valueOf(pair.right));
                        }
                    } else {
                        string2 = (String)pair.right;
                    }
                    if (string2 == null || (internalUserManager = this.d.findByCompositeKey(goid, string2, false)) != null) continue;
                    internalUser = new LogonInfo(goid, string2);
                    this.d.save((PersistentEntity)internalUser);
                }
                if (string == null) break block12;
                stringArray = q;
            }
            catch (FindException findException) {
                string = ExceptionUtils.getMessage((Throwable)findException);
                if (string == null) break block12;
                String[] stringArray2 = q;
                String string3 = stringArray2[22] + string;
                this.a.publishEvent((ApplicationEvent)new SystemEvent(this, Component.GW_ACCOUNT_MANAGER, null, Level.INFO, string3){
                    static final long serialVersionUID = 7354690038689273495L;
                    private static final String b = 3.b(69, 3.b("i\u0007V\"\u001f\u0007\u000eN\fHq*\u0011\u0002S\rS\"\u001f\u0000\u0000H\u0017Ov~.\fI\u000bUm,"));

                    @Override
                    public String getAction() {
                        return b;
                    }

                    private static char[] b(String string) {
                        char[] cArray = string.toCharArray();
                        if (cArray.length < 2) {
                            cArray = cArray;
                            cArray[0] = (char)(cArray[0] ^ 0x26);
                        }
                        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 -> 98;
                                    case 1 -> 39;
                                    case 2 -> 100;
                                    case 3 -> 71;
                                    case 4 -> 27;
                                    case 5 -> 38;
                                    default -> 38;
                                })));
                                ++n3;
                                n4 = n4;
                            } while (n4 > n3);
                        }
                        return new String(cArray2).intern();
                    }
                });
            }
            catch (SaveException saveException) {
                string = ExceptionUtils.getMessage((Throwable)saveException);
                if (string == null) break block12;
                String[] stringArray3 = q;
                {
                    catch (Throwable throwable) {
                        if (string != null) {
                            String string4 = q[22] + string;
                            this.a.publishEvent((ApplicationEvent)new /* invalid duplicate definition of identical inner class */);
                        }
                        throw throwable;
                    }
                }
                String string5 = stringArray3[22] + string;
                this.a.publishEvent((ApplicationEvent)new /* invalid duplicate definition of identical inner class */);
            }
            object = stringArray[5] + string;
            this.a.publishEvent((ApplicationEvent)new /* invalid duplicate definition of identical inner class */);
        }
    }

    private void a(User user, LogonInfo.State state) {
        this.a(user, new a(this, state));
    }

    private void a(User user) {
        this.a(user, new b(this));
    }

    private void a(User user, AuthenticationResult authenticationResult) {
        this.a(user, new c(this, authenticationResult));
    }

    private void a(User user, long l2) {
        this.a(user, new d(this, l2));
    }

    private void a(User user, Functions.UnaryVoid<LogonInfo> unaryVoid) {
        HashSet<User> hashSet = new HashSet<User>();
        hashSet.add(user);
        Subject subject = new Subject(true, hashSet, Collections.emptySet(), Collections.emptySet());
        String string = user.getLogin();
        Subject.callAs(subject, () -> {
            try {
                TransactionTemplate transactionTemplate = new TransactionTemplate(this.c);
                transactionTemplate.setPropagationBehavior(3);
                transactionTemplate.execute((TransactionCallback)new e(this, user, unaryVoid, string));
            }
            catch (Exception exception) {
                b.log(Level.INFO, q[8] + string + "'", exception);
            }
            return null;
        });
    }

    private boolean b(User user) throws FindException {
        for (Role role : this.g.getAssignedRoles(user)) {
            try {
                if (role.getTag() != Role.Tag.ADMIN) continue;
                return true;
            }
            catch (FindException findException) {
                throw SSMLogonService.a((Exception)((Object)findException));
            }
        }
        return false;
    }

    private InternalUserManager a() throws FindException {
        if (this.h == null) {
            InternalIdentityProvider internalIdentityProvider = (InternalIdentityProvider)this.i.getProvider(IdentityProviderConfigManager.INTERNALPROVIDER_SPECIAL_GOID);
            try {
                if (internalIdentityProvider == null) {
                    throw new FindException(q[17]);
                }
            }
            catch (FindException findException) {
                throw SSMLogonService.a((Exception)((Object)findException));
            }
            this.h = (InternalUserManager)internalIdentityProvider.getUserManager();
        }
        return this.h;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[27];
                var3_1 = 0;
                var2_2 = "B!X,\nz\u0019h2Q;Ox\u0002f:Sh\u0002u\u0019b;X;Ou\u0003!:S<\nf\u0003`?\u001d=\u001cq\u001f!&@0^-\u001cgMh \u001d,\nz\u0004d7\u001d*\nw\ft Xh\u0000rMh=\\+\u001b}\u001bh'D\u0011m<Z'\u0001:\u0001n0V'\u001a`9h>X\u0011m<Z'\u0001:\u0001n0V'\u001a`9h>X!@0^'\u001az\u0019!2^<\u0006b\u0004u*\u001d%\u0000z\u0004u<Oh\tu\u0004m6YfO.O6Jh\u000ep\u0000h=T;\u001bf\fu<Oh\u000ew\u000en&S<Oy\fh=I-\u0001u\u0003b6\u001d.\u000e}\u0001d7\u0013h#G2T$\npMu<\u001d=\u001fp\fu6\u001d=\u001cq\u001frsT&\u000ew\u0019h%T<\u0016:M\u0016m<Z'\u0001:\u0004o2^<\u0006b\u0004u*m-\u001d}\u0002e$G2T$\npMu<\u001d=\u001fp\fu6\u001d$\u0000s\u0002os\\<\u001bq\u0000q'\u001d.\u0000fM&0-s_=\u001b4\fb0X;\u001c4\u0004rsY-\u0001}\bes_-\fu\u0018r6\u001d=\u001cq\u001f!:Nh\u000b}\u001e`1Q-\u000b:\u001a@0^'\u001az\u0019!\u001aS)\f`\u0004w:I1OY\u0002o:I'\u001d\u000eO<\u001d-\u0001`\u001fxs['\u001d4J\u001am<Z'\u0001:\u0000`+|$\u0003{\u001a`1Q-.`\u0019d>M<\u001c<-s_=\u001b4\fb0X;\u001c4\u0004rsY-\u0001}\bes_-\fu\u0018r6\u001d'\t4\u0003t>_-\u001d4\u0002gs[)\u0006x\bes\\<\u001bq\u0000q'Nf5-s_=\u001b4\fb0X;\u001c4\u0004rsY-\u0001}\bes_-\fu\u0018r6\u001d'\t4\fb0R=\u0001`Mh=\\+\u001b}\u001bh'Df\u001cR6O>\nf.n=[!\b4\u000e`=S'\u001b4\u000fdsS=\u0003xC!G2T$\npMu<\u001d=\u001fp\fu6\u001d!\u0001u\u000eu:K!\u001bmMg<OhH#H7X&\u001b}\u0019x\u0003O'\u0019}\td!\u001d+\u0000a\u0001esS'\u001b4\u000fds['\u001az\t M<Z'\u0001]\u0003g<p)\u0001u\nd!\u001d+\u000ez\u0003n'\u001d*\n4\u0003t?Qf\u0003&}\u001d\u001am<Z'\u0001:\u0000`+|$\u0003{\u001a`1Q-.`\u0019d>M<\u001c$G2T$\npMu<\u001d=\u001fp\fu6\u001d$\u0000s\u0002os\\<\u001bq\u0000q'\u001d.\u0000fM&.O6Jh\u000ep\u0000h=T;\u001bf\fu<Oh\u000ew\u000en&S<Oy\fh=I-\u0001u\u0003b6\u001d.\u000e}\u0001d7\u0013h+Q?\\<\nr\u0002s>i:\u000ez\u001e`0I!\u0000z `=\\/\nfMb2S&\u0000`Mc6\u001d&\u001ax\u0001/\u0019H=I-\u001dz\fmsH;\nfMo<Ih\t{\u0018o7\u0007h";
                var4_3 = "B!X,\nz\u0019h2Q;Ox\u0002f:Sh\u0002u\u0019b;X;Ou\u0003!:S<\nf\u0003`?\u001d=\u001cq\u001f!&@0^-\u001cgMh \u001d,\nz\u0004d7\u001d*\nw\ft Xh\u0000rMh=\\+\u001b}\u001bh'D\u0011m<Z'\u0001:\u0001n0V'\u001a`9h>X\u0011m<Z'\u0001:\u0001n0V'\u001a`9h>X!@0^'\u001az\u0019!2^<\u0006b\u0004u*\u001d%\u0000z\u0004u<Oh\tu\u0004m6YfO.O6Jh\u000ep\u0000h=T;\u001bf\fu<Oh\u000ew\u000en&S<Oy\fh=I-\u0001u\u0003b6\u001d.\u000e}\u0001d7\u0013h#G2T$\npMu<\u001d=\u001fp\fu6\u001d=\u001cq\u001frsT&\u000ew\u0019h%T<\u0016:M\u0016m<Z'\u0001:\u0004o2^<\u0006b\u0004u*m-\u001d}\u0002e$G2T$\npMu<\u001d=\u001fp\fu6\u001d$\u0000s\u0002os\\<\u001bq\u0000q'\u001d.\u0000fM&0-s_=\u001b4\fb0X;\u001c4\u0004rsY-\u0001}\bes_-\fu\u0018r6\u001d=\u001cq\u001f!:Nh\u000b}\u001e`1Q-\u000b:\u001a@0^'\u001az\u0019!\u001aS)\f`\u0004w:I1OY\u0002o:I'\u001d\u000eO<\u001d-\u0001`\u001fxs['\u001d4J\u001am<Z'\u0001:\u0000`+|$\u0003{\u001a`1Q-.`\u0019d>M<\u001c<-s_=\u001b4\fb0X;\u001c4\u0004rsY-\u0001}\bes_-\fu\u0018r6\u001d'\t4\u0003t>_-\u001d4\u0002gs[)\u0006x\bes\\<\u001bq\u0000q'Nf5-s_=\u001b4\fb0X;\u001c4\u0004rsY-\u0001}\bes_-\fu\u0018r6\u001d'\t4\fb0R=\u0001`Mh=\\+\u001b}\u001bh'Df\u001cR6O>\nf.n=[!\b4\u000e`=S'\u001b4\u000fdsS=\u0003xC!G2T$\npMu<\u001d=\u001fp\fu6\u001d!\u0001u\u000eu:K!\u001bmMg<OhH#H7X&\u001b}\u0019x\u0003O'\u0019}\td!\u001d+\u0000a\u0001esS'\u001b4\u000fds['\u001az\t M<Z'\u0001]\u0003g<p)\u0001u\nd!\u001d+\u000ez\u0003n'\u001d*\n4\u0003t?Qf\u0003&}\u001d\u001am<Z'\u0001:\u0000`+|$\u0003{\u001a`1Q-.`\u0019d>M<\u001c$G2T$\npMu<\u001d=\u001fp\fu6\u001d$\u0000s\u0002os\\<\u001bq\u0000q'\u001d.\u0000fM&.O6Jh\u000ep\u0000h=T;\u001bf\fu<Oh\u000ew\u000en&S<Oy\fh=I-\u0001u\u0003b6\u001d.\u000e}\u0001d7\u0013h+Q?\\<\nr\u0002s>i:\u000ez\u001e`0I!\u0000z `=\\/\nfMb2S&\u0000`Mc6\u001d&\u001ax\u0001/\u0019H=I-\u001dz\fmsH;\nfMo<Ih\t{\u0018o7\u0007h".length();
                var1_4 = 43;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = SSMLogonService.a(v0, SSMLogonService.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "<m\u000bvPkU>c\u000fmW3U${<|L,S4+\u0013p\t}[+H9c\u0000j\u001e)S7k\u00029S$H3j\tj\u001e$Rpk\u0002m[7R1nLlM Np";
                    var4_3 = "<m\u000bvPkU>c\u000fmW3U${<|L,S4+\u0013p\t}[+H9c\u0000j\u001e)S7k\u00029S$H3j\tj\u001e$Rpk\u0002m[7R1nLlM Np".length();
                    var1_4 = 22;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 107;
                        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++] = SSMLogonService.a(v0, SSMLogonService.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;
            }
        }
        SSMLogonService.q = var5;
        SSMLogonService.p = SSMLogonService.q[21];
        SSMLogonService.b = Logger.getLogger(SSMLogonService.class.getName());
    }

    private static Exception a(Exception exception) {
        return exception;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x57);
        }
        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 -> 59;
                    case 1 -> 105;
                    case 2 -> 7;
                    case 3 -> 114;
                    case 4 -> 85;
                    case 5 -> 46;
                    default -> 87;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

