/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.objectmodel.Entity
 *  com.l7tech.objectmodel.EntityHeader
 *  com.l7tech.objectmodel.ExternalEntityHeader
 *  com.l7tech.objectmodel.migration.MigrationUtils
 *  com.l7tech.objectmodel.migration.PropertyResolver$Type
 *  com.l7tech.objectmodel.migration.PropertyResolverException
 */
package com.l7tech.server.migration;

import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.ExternalEntityHeader;
import com.l7tech.objectmodel.migration.MigrationUtils;
import com.l7tech.objectmodel.migration.PropertyResolver;
import com.l7tech.objectmodel.migration.PropertyResolverException;
import com.l7tech.server.EntityHeaderUtils;
import com.l7tech.server.migration.DefaultEntityPropertyResolver;
import com.l7tech.server.migration.PropertyResolverFactory;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;

public class AssertionPropertyResolver
extends DefaultEntityPropertyResolver {
    private static final Logger d;
    private static final String[] g;

    public AssertionPropertyResolver(PropertyResolverFactory propertyResolverFactory, PropertyResolver.Type type) {
        super(propertyResolverFactory, type);
    }

    @Override
    public void applyMapping(Object object, String string, ExternalEntityHeader externalEntityHeader, Object object2, ExternalEntityHeader externalEntityHeader2) throws PropertyResolverException {
        String[] stringArray = g;
        d.log(Level.FINEST, stringArray[1], new Object[]{object, string});
        try {
            if (stringArray[0].equals(string)) {
                Method method = MigrationUtils.setterForPropertyName((Object)object, (String)stringArray[2], (Class[])new Class[]{EntityHeader.class, EntityHeader.class});
                method.invoke(object, EntityHeaderUtils.fromExternal(externalEntityHeader2), EntityHeaderUtils.fromEntity((Entity)object2));
            } else {
                Method method = MigrationUtils.setterForPropertyName((Object)object, (String)string, (Class[])new Class[]{object2.getClass()});
                method.invoke(object, object2);
            }
        }
        catch (Exception exception) {
            throw new PropertyResolverException(g[3] + string, (Throwable)exception);
        }
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[4];
                var3_1 = 0;
                var2_2 = "%\u0016\u0019Cu7H\u0013-\u001eOe)!\b\u001dFx7C\u0007X\u0000Kq.D\u000e\u001fMLn,\r\u0001\u000b\u001eOs*D\u000f\u0016MQ1#\rZX\u0016\u001b|p";
                var4_3 = "%\u0016\u0019Cu7H\u0013-\u001eOe)!\b\u001dFx7C\u0007X\u0000Kq.D\u000e\u001fMLn,\r\u0001\u000b\u001eOs*D\u000f\u0016MQ1#\rZX\u0016\u001b|p".length();
                var1_4 = 12;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = AssertionPropertyResolver.c(v0, AssertionPropertyResolver.c(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u0013\u001c\u001cGa<I$\u0017\u0018Bt&\u001b$\u000b\u001eDr\u007fM\u0011\t\u0000Ri1KA\u0014\r[p6B\u0006Y\nDr\u007f";
                    var4_3 = "\u0013\u001c\u001cGa<I$\u0017\u0018Bt&\u001b$\u000b\u001eDr\u007fM\u0011\t\u0000Ri1KA\u0014\r[p6B\u0006Y\nDr\u007f".length();
                    var1_4 = 13;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 124;
                        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++] = AssertionPropertyResolver.c(v0, AssertionPropertyResolver.c(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;
            }
        }
        AssertionPropertyResolver.g = var5;
        AssertionPropertyResolver.d = Logger.getLogger(AssertionPropertyResolver.class.getName());
    }

    private static char[] c(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x50);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String c(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 -> 29;
                    case 1 -> 5;
                    case 2 -> 16;
                    case 3 -> 87;
                    case 4 -> 124;
                    case 5 -> 35;
                    default -> 80;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

