/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.audit.AuditConfiguration
 *  com.l7tech.gateway.common.transport.ftp.FtpClientConfig
 *  com.l7tech.gateway.common.transport.ftp.FtpUtils
 *  com.l7tech.objectmodel.ObjectModelException
 *  com.l7tech.objectmodel.UpdateException
 *  com.l7tech.util.Option
 *  org.springframework.transaction.TransactionStatus
 *  org.springframework.transaction.support.TransactionCallback
 */
package com.l7tech.server.audit;

import com.l7tech.gateway.common.audit.AuditConfiguration;
import com.l7tech.gateway.common.transport.ftp.FtpClientConfig;
import com.l7tech.gateway.common.transport.ftp.FtpUtils;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.server.audit.AuditConfigurationManagerImpl;
import com.l7tech.util.Option;
import java.io.IOException;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;

class l
implements TransactionCallback<Option<UpdateException>> {
    final AuditConfiguration val$entity;
    final AuditConfigurationManagerImpl this$0;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    l(AuditConfigurationManagerImpl auditConfigurationManagerImpl, AuditConfiguration auditConfiguration) {
        this.this$0 = auditConfigurationManagerImpl;
        this.val$entity = auditConfiguration;
    }

    public Option<UpdateException> doInTransaction(TransactionStatus transactionStatus) {
        try {
            String string;
            String string2;
            AuditConfigurationManagerImpl auditConfigurationManagerImpl;
            String string3;
            String string4;
            AuditConfigurationManagerImpl auditConfigurationManagerImpl2;
            String string5;
            String string6;
            AuditConfigurationManagerImpl auditConfigurationManagerImpl3;
            try {
                auditConfigurationManagerImpl3 = this.this$0;
                string6 = a[3];
                string5 = this.val$entity.getSinkPolicyGoid() == null ? null : this.this$0.a(this.val$entity.getSinkPolicyGoid()).getGuid();
            }
            catch (ObjectModelException objectModelException) {
                throw l.a(objectModelException);
            }
            try {
                auditConfigurationManagerImpl3.a(string6, string5);
                auditConfigurationManagerImpl2 = this.this$0;
                string4 = a[1];
                string3 = this.val$entity.getLookupPolicyGoid() == null ? null : this.this$0.a(this.val$entity.getLookupPolicyGoid()).getGuid();
            }
            catch (ObjectModelException objectModelException) {
                throw l.a(objectModelException);
            }
            try {
                auditConfigurationManagerImpl2.a(string4, string3);
                this.this$0.a(a[4], Boolean.valueOf(this.val$entity.isAlwaysSaveInternal()).toString());
                auditConfigurationManagerImpl = this.this$0;
                string2 = a[2];
                string = this.val$entity.getFtpClientConfig() == null ? null : FtpUtils.serialize((FtpClientConfig)this.val$entity.getFtpClientConfig());
            }
            catch (ObjectModelException objectModelException) {
                throw l.a(objectModelException);
            }
            auditConfigurationManagerImpl.a(string2, string);
            return Option.none();
        }
        catch (ObjectModelException | IOException throwable) {
            return Option.some((Object)((Object)new UpdateException(a[0], throwable)));
        }
    }

    private static ObjectModelException a(ObjectModelException objectModelException) {
        return objectModelException;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[5];
                var3_1 = 0;
                var2_2 = ">'+3\u007f.7\u001f&j$c/v\u001f,j4}?~\u001f0d\u0018\n<.8ge{\u0004&!$ceg\u0004%#2jep\u001e .\u0019\n<.8gev\u0019*\"8e.eE/>!=(x\u0005/#6";
                var4_3 = ">'+3\u007f.7\u001f&j$c/v\u001f,j4}?~\u001f0d\u0018\n<.8ge{\u0004&!$ceg\u0004%#2jep\u001e .\u0019\n<.8gev\u0019*\"8e.eE/>!=(x\u0005/#6".length();
                var1_4 = 24;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = l.a(v0, l.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "?\t\u001b\rRPQ7\u0012\u0014JV\u0011N7\u001f\u0006JA\u000bK:\u001d?\t\u001b\rRPQ7\u0012\u0014JG\u0012U?\u0005\f7G\bG\u0017\u0012\u000b\u0001T\u0010C2";
                    var4_3 = "?\t\u001b\rRPQ7\u0012\u0014JV\u0011N7\u001f\u0006JA\u000bK:\u001d?\t\u001b\rRPQ7\u0012\u0014JG\u0012U?\u0005\f7G\bG\u0017\u0012\u000b\u0001T\u0010C2".length();
                    var1_4 = 22;
                    var0_5 = -1;
lbl22:
                    // 2 sources

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

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x30);
        }
        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 -> 76;
                    case 1 -> 110;
                    case 2 -> 109;
                    case 3 -> 118;
                    case 4 -> 52;
                    case 5 -> 108;
                    default -> 48;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

