/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.identity.LogonInfo
 *  com.l7tech.identity.User
 *  com.l7tech.objectmodel.PersistentEntity
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.Functions$UnaryVoid
 *  org.springframework.dao.CannotAcquireLockException
 *  org.springframework.transaction.TransactionStatus
 *  org.springframework.transaction.support.TransactionCallback
 */
package com.l7tech.server.logon;

import com.l7tech.identity.LogonInfo;
import com.l7tech.identity.User;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.server.logon.SSMLogonService;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.Functions;
import java.util.logging.Level;
import org.springframework.dao.CannotAcquireLockException;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;

class e
implements TransactionCallback {
    final User val$user;
    final Functions.UnaryVoid val$callback;
    final String val$name;
    final SSMLogonService this$0;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    e(SSMLogonService sSMLogonService, User user, Functions.UnaryVoid unaryVoid, String string) {
        this.this$0 = sSMLogonService;
        this.val$user = user;
        this.val$callback = unaryVoid;
        this.val$name = string;
    }

    public Object doInTransaction(TransactionStatus transactionStatus) {
        block8: {
            boolean bl2 = false;
            try {
                LogonInfo logonInfo;
                block7: {
                    logonInfo = this.this$0.d.findByCompositeKey(this.val$user.getProviderId(), this.val$user.getLogin(), true);
                    if (logonInfo == null) {
                        logonInfo = new LogonInfo(this.val$user.getProviderId(), this.val$user.getLogin());
                        bl2 = true;
                    }
                    try {
                        this.val$callback.call((Object)logonInfo);
                        if (!bl2) break block7;
                        this.this$0.d.save((PersistentEntity)logonInfo);
                        break block8;
                    }
                    catch (Exception exception) {
                        throw e.a(exception);
                    }
                }
                this.this$0.d.update(logonInfo);
            }
            catch (Exception exception) {
                block9: {
                    try {
                        transactionStatus.setRollbackOnly();
                        if (!ExceptionUtils.causedBy((Throwable)exception, CannotAcquireLockException.class)) break block9;
                        SSMLogonService.b.log(Level.WARNING, a[1] + this.val$name + a[2], ExceptionUtils.getDebugException((Throwable)exception));
                    }
                    catch (Exception exception2) {
                        throw e.a(exception2);
                    }
                }
                SSMLogonService.b.log(Level.WARNING, a[0] + this.val$name + "'", exception);
            }
        }
        return null;
    }

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

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "<40y@@V\u000e:y`U@\u0017\u000e0yyJC\u0019\u0014u8aQA\u001b\n!ysJVV]$<40y@@V\u000e:y`U@\u0017\u000e0yyJC\u0019\u0014u8aQA\u001b\n!ysJVV]\u001a]yyvJQ\u001a\u001eu7zQ\u0004\u0017\u0019$,|WAV\u0016::~\u000b";
        int n3 = "<40y@@V\u000e:y`U@\u0017\u000e0yyJC\u0019\u0014u8aQA\u001b\n!ysJVV]$<40y@@V\u000e:y`U@\u0017\u000e0yyJC\u0019\u0014u8aQA\u001b\n!ysJVV]\u001a]yyvJQ\u001a\u001eu7zQ\u0004\u0017\u0019$,|WAV\u0016::~\u000b".length();
        int n4 = 36;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = e.a(109, e.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                a = 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] ^ 0x1B);
        }
        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 -> 23;
                    case 1 -> 56;
                    case 2 -> 52;
                    case 3 -> 120;
                    case 4 -> 72;
                    case 5 -> 73;
                    default -> 27;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

