/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.util.Config
 *  com.l7tech.util.ValidatedConfig
 */
package com.l7tech.server.identity.ldap;

import com.l7tech.util.Config;
import com.l7tech.util.ValidatedConfig;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.MessageFormat;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LdapRuntimeConfig
implements PropertyChangeListener {
    private static final Logger a;
    private final Config b;
    private static final long c = 600000L;
    private static final long d = 600000L;
    private static final long e = 600000L;
    private static final long f = 10000L;
    private static final long g = 10000L;
    private static final long h = 100L;
    private static final long i = 60000L;
    private final AtomicLong j = new AtomicLong(600000L);
    private final AtomicLong k = new AtomicLong(600000L);
    private final AtomicLong l = new AtomicLong(600000L);
    private final AtomicLong m = new AtomicLong(5000L);
    private final AtomicLong n = new AtomicLong(30000L);
    private final AtomicLong o = new AtomicLong(100L);
    private final AtomicLong p = new AtomicLong(100L);
    private final AtomicLong q = new AtomicLong(60000L);
    private static final String[] r;

    public LdapRuntimeConfig(Config config) {
        this.b = this.a(config);
        this.a();
    }

    public long getRebuildTimerLength() {
        return this.j.get();
    }

    public long getCleanupTimerLength() {
        return this.k.get();
    }

    public long getCachedCertEntryLife() {
        return this.l.get();
    }

    public long getLdapConnectionTimeout() {
        return this.m.get();
    }

    public long getLdapReadTimeout() {
        return this.n.get();
    }

    public long getMaxSearchResultSize() {
        return this.o.get();
    }

    public long getMaxGroupSearchResultSize() {
        return this.p.get();
    }

    public long getRetryFailedConnectionTimeout() {
        return this.q.get();
    }

    @Override
    public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
        block14: {
            String string;
            block18: {
                block17: {
                    block16: {
                        block15: {
                            block13: {
                                string = propertyChangeEvent.getPropertyName();
                                try {
                                    if (!r[9].equals(string)) break block13;
                                    this.b();
                                    break block14;
                                }
                                catch (NumberFormatException numberFormatException) {
                                    throw LdapRuntimeConfig.a(numberFormatException);
                                }
                            }
                            try {
                                if (!r[8].equals(string)) break block15;
                                this.c();
                                break block14;
                            }
                            catch (NumberFormatException numberFormatException) {
                                throw LdapRuntimeConfig.a(numberFormatException);
                            }
                        }
                        try {
                            if (!r[20].equals(string)) break block16;
                            this.d();
                            this.e();
                            break block14;
                        }
                        catch (NumberFormatException numberFormatException) {
                            throw LdapRuntimeConfig.a(numberFormatException);
                        }
                    }
                    try {
                        if (!r[22].equals(string)) break block17;
                        this.e();
                        break block14;
                    }
                    catch (NumberFormatException numberFormatException) {
                        throw LdapRuntimeConfig.a(numberFormatException);
                    }
                }
                try {
                    if (!r[16].equals(string)) break block18;
                    this.f();
                    break block14;
                }
                catch (NumberFormatException numberFormatException) {
                    throw LdapRuntimeConfig.a(numberFormatException);
                }
            }
            try {
                if (r[2].equals(string)) {
                    this.g();
                }
            }
            catch (NumberFormatException numberFormatException) {
                throw LdapRuntimeConfig.a(numberFormatException);
            }
        }
    }

    private void a() {
        this.b();
        this.c();
        this.d();
        this.e();
        this.f();
        this.g();
    }

    private void b() {
        String[] stringArray = r;
        long l2 = this.b.getTimeUnitProperty(stringArray[1], 5000L);
        a.config(stringArray[25] + l2);
        this.m.set(l2);
    }

    private void c() {
        String[] stringArray = r;
        long l2 = this.b.getTimeUnitProperty(stringArray[21], 30000L);
        a.config(stringArray[19] + l2);
        this.n.set(l2);
    }

    private void d() {
        block7: {
            String string;
            String[] stringArray;
            block6: {
                stringArray = r;
                string = this.b.getProperty(stringArray[11], Long.toString(100L));
                try {
                    if (string != null) break block6;
                    a.info(stringArray[3]);
                    this.o.set(100L);
                    break block7;
                }
                catch (NumberFormatException numberFormatException) {
                    throw LdapRuntimeConfig.a(numberFormatException);
                }
            }
            try {
                long l2;
                block8: {
                    l2 = Long.parseLong(string);
                    try {
                        if (l2 > 0L) break block8;
                        a.info(r[0] + string + r[23]);
                        this.o.set(100L);
                        break block7;
                    }
                    catch (NumberFormatException numberFormatException) {
                        throw LdapRuntimeConfig.a(numberFormatException);
                    }
                }
                stringArray = r;
                a.info(stringArray[17] + string);
                this.o.set(l2);
            }
            catch (NumberFormatException numberFormatException) {
                a.log(Level.WARNING, r[13], numberFormatException);
                this.o.set(100L);
            }
        }
    }

    private void e() {
        this.p.set(this.b.getLongProperty(r[10], 100L));
    }

    private void f() {
        long l2 = 600000L;
        String[] stringArray = r;
        String string = this.b.getProperty(stringArray[5], Long.toString(600000L));
        if (string != null) {
            try {
                l2 = Long.parseLong(string);
                if (l2 < 10000L) {
                    a.info(MessageFormat.format(stringArray[14], stringArray[5], 10000L, l2, 600000L));
                    l2 = 600000L;
                }
                stringArray = r;
                a.fine(stringArray[12] + l2);
            }
            catch (NumberFormatException numberFormatException) {
                stringArray = r;
                a.warning(MessageFormat.format(stringArray[4], stringArray[5], string, 600000L));
            }
        }
        this.j.set(l2);
        a.config(r[18] + l2);
    }

    private void g() {
        long l2 = 600000L;
        String[] stringArray = r;
        String string = this.b.getProperty(stringArray[24], Long.toString(600000L));
        if (string != null) {
            try {
                l2 = Long.parseLong(string);
                if (l2 < 10000L) {
                    a.info(MessageFormat.format(stringArray[7], stringArray[2], 10000L, l2, 600000L));
                    l2 = 600000L;
                }
            }
            catch (NumberFormatException numberFormatException) {
                stringArray = r;
                a.warning(MessageFormat.format(stringArray[15], stringArray[2], string, 600000L));
            }
        }
        this.l.set(l2);
        a.config(r[6] + l2);
    }

    private Config a(Config config) {
        ValidatedConfig validatedConfig = new ValidatedConfig(config, a);
        validatedConfig.setMinimumValue(r[22], (Number)1);
        return validatedConfig;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[26];
                var3_1 = 0;
                var2_2 = "\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003sdH2\nv\u0010x2A?\u00102Y`%L&\u001clY\u0015\u0015r%P\u0010\u00168\u0017s'T:\u00168-\u007f)E<\f\"\u0015\u0015r%P\u0010\u001c$\rU%C;\u001c\u001a\u0010p!T:\u001438\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003sdI Y8\u0016bdS6\rxYc7I=\u001ev\u001ds\"A&\u0015\"Y`%L&\u001cxH<d6O!Y&\u0018d7I=\u001ev\td+P6\u000b\"\u00006?\u0010.Y!\u0010b,\u0000%\u0018:\fsd[b\u0004xYC7I=\u001ev\r~!\u00007\u001c0\u0018c(Ts\u000f7\u0015c!\u0000{\u0002d\u0004?\u0015\u0015r%P\u0010\u001c$\r_*D6\u0001\u001f\u0017b!R%\u0018:#:s6T:\u001f?\u001aw0Es\u001a7\u001a~!\u00006\u0017\"\u000bodL:\u001f3\r\u007f)EsDvj)d+P6\u000b\"\u00006?\u0010.Y?\n6(E \nv\r~%Ns\r>\u001c6)I=\u0010;\f{dV2\u0015#\u001c6?\u0011.Y~\u001ay*F:\u001e#\u000bs \u0000%\u0018:\fsd\u001ds\u0002d\u0004?j\u0000\u0006\n?\u0017qdT;\u001cv\u001ds\"A&\u0015\"Y`%L&\u001cvQmw]s\u0014%P\u000f\u0015r%P\u0001\u001c7\u001dB-M6\u0016#\r\u0015\u0015r%P\u0010\u00168\u0017s'T:\u00168-\u007f)E<\f\"\u001b\u0015r%P}\u001e$\u0016c4\u000e \u001c7\u000bu,m2\u0001\u0004\u001ce1L'\n\u0017\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003s/+s%Ds\t$\u0016f!R'\u0000v\u0015r%P\u0010\u001c$\r_*D6\u0001\u001f\u0017b!R%\u0018:Ya-T;Y \u0018z1EsZ-~!\u0000#\u000b9\ts6T*Y;\u0018n\bD2\t\u0005\u001cw6C;+3\nc(T\u0000\u0010,\u001c6,A Y7\u00176-N%\u0018:\u0010rdF<\u000b;\u0018bj\u00005\u0018:\u0015\u007f*Gs\u001b7\u001a}dO=Y2\u001cp%U?\rv\u000fw(U6Wj)d+P6\u000b\"\u00006?\u0010.Y?\n6(E \nv\r~%Ns\r>\u001c6)I=\u0010;\f{dV2\u0015#\u001c6?\u0011.Y~\u001ay*F:\u001e#\u000bs \u0000%\u0018:\fsd\u001ds\u0002d\u0004?j\u0000\u0006\n?\u0017qdT;\u001cv\u001ds\"A&\u0015\"Y`%L&\u001cvQmw]s\u0014%PG:y1L7Y8\u0016bdP2\u000b%\u001c64R<\t3\u000bb=\u0000(I+Ya-T;Y \u0018z1Es\u0002g\u00048du \u00108\u001e60H6Y2\u001cp%U?\rvQmv]s\u0014%P\u0015\u0015r%P\u0010\u001c$\r_*D6\u0001\u001f\u0017b!R%\u0018:-+s%Ds\n/\nb!Ms\u000f7\u0015c!\u0000>\u0018.5r%P\u0000\u001c7\u000bu,r6\n#\u0015b\u0017I)\u001cv\u0016pd%:s6T:\u001f?\u001aw0Es\u00108\u001ds<\u0000!\u001c4\f\u007f(Ds\u00108\rs6V2\u0015vD6\u000f+s%Ds\r?\u0014s+U'YkY\u0017\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003s\u000f\u0015r%P\u0001\u001c7\u001dB-M6\u0016#\r\u001b\u0015r%P}\u001e$\u0016c4\u000e \u001c7\u000bu,m2\u0001\u0004\u001ce1L'\n\u0016W61S:\u00171Yr!F2\f:\r62A?\f3W";
                var4_3 = "\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003sdH2\nv\u0010x2A?\u00102Y`%L&\u001clY\u0015\u0015r%P\u0010\u00168\u0017s'T:\u00168-\u007f)E<\f\"\u0015\u0015r%P\u0010\u001c$\rU%C;\u001c\u001a\u0010p!T:\u001438\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003sdI Y8\u0016bdS6\rxYc7I=\u001ev\u001ds\"A&\u0015\"Y`%L&\u001cxH<d6O!Y&\u0018d7I=\u001ev\td+P6\u000b\"\u00006?\u0010.Y!\u0010b,\u0000%\u0018:\fsd[b\u0004xYC7I=\u001ev\r~!\u00007\u001c0\u0018c(Ts\u000f7\u0015c!\u0000{\u0002d\u0004?\u0015\u0015r%P\u0010\u001c$\r_*D6\u0001\u001f\u0017b!R%\u0018:#:s6T:\u001f?\u001aw0Es\u001a7\u001a~!\u00006\u0017\"\u000bodL:\u001f3\r\u007f)EsDvj)d+P6\u000b\"\u00006?\u0010.Y?\n6(E \nv\r~%Ns\r>\u001c6)I=\u0010;\f{dV2\u0015#\u001c6?\u0011.Y~\u001ay*F:\u001e#\u000bs \u0000%\u0018:\fsd\u001ds\u0002d\u0004?j\u0000\u0006\n?\u0017qdT;\u001cv\u001ds\"A&\u0015\"Y`%L&\u001cvQmw]s\u0014%P\u000f\u0015r%P\u0001\u001c7\u001dB-M6\u0016#\r\u0015\u0015r%P\u0010\u00168\u0017s'T:\u00168-\u007f)E<\f\"\u001b\u0015r%P}\u001e$\u0016c4\u000e \u001c7\u000bu,m2\u0001\u0004\u001ce1L'\n\u0017\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003s/+s%Ds\t$\u0016f!R'\u0000v\u0015r%P\u0010\u001c$\r_*D6\u0001\u001f\u0017b!R%\u0018:Ya-T;Y \u0018z1EsZ-~!\u0000#\u000b9\ts6T*Y;\u0018n\bD2\t\u0005\u001cw6C;+3\nc(T\u0000\u0010,\u001c6,A Y7\u00176-N%\u0018:\u0010rdF<\u000b;\u0018bj\u00005\u0018:\u0015\u007f*Gs\u001b7\u001a}dO=Y2\u001cp%U?\rv\u000fw(U6Wj)d+P6\u000b\"\u00006?\u0010.Y?\n6(E \nv\r~%Ns\r>\u001c6)I=\u0010;\f{dV2\u0015#\u001c6?\u0011.Y~\u001ay*F:\u001e#\u000bs \u0000%\u0018:\fsd\u001ds\u0002d\u0004?j\u0000\u0006\n?\u0017qdT;\u001cv\u001ds\"A&\u0015\"Y`%L&\u001cvQmw]s\u0014%PG:y1L7Y8\u0016bdP2\u000b%\u001c64R<\t3\u000bb=\u0000(I+Ya-T;Y \u0018z1Es\u0002g\u00048du \u00108\u001e60H6Y2\u001cp%U?\rvQmv]s\u0014%P\u0015\u0015r%P\u0010\u001c$\r_*D6\u0001\u001f\u0017b!R%\u0018:-+s%Ds\n/\nb!Ms\u000f7\u0015c!\u0000>\u0018.5r%P\u0000\u001c7\u000bu,r6\n#\u0015b\u0017I)\u001cv\u0016pd%:s6T:\u001f?\u001aw0Es\u00108\u001ds<\u0000!\u001c4\f\u007f(Ds\u00108\rs6V2\u0015vD6\u000f+s%Ds\r?\u0014s+U'YkY\u0017\u0014w<l7\u0018&*s%R0\u0011\u0004\u001ce1L'*?\u0003s\u000f\u0015r%P\u0001\u001c7\u001dB-M6\u0016#\r\u001b\u0015r%P}\u001e$\u0016c4\u000e \u001c7\u000bu,m2\u0001\u0004\u001ce1L'\n\u0016W61S:\u00171Yr!F2\f:\r62A?\f3W".length();
                var1_4 = 43;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = LdapRuntimeConfig.a(v0, LdapRuntimeConfig.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "S4c\u0016VZbK\u0013c\u0005}Z\\V6g\u0012|Ru\u0015|?l\bp\\dV?lFaV}Z?w\u00125\u00020";
                    var4_3 = "S4c\u0016VZbK\u0013c\u0005}Z\\V6g\u0012|Ru\u0015|?l\bp\\dV?lFaV}Z?w\u00125\u00020".length();
                    var1_4 = 21;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 15;
                        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++] = LdapRuntimeConfig.a(v0, LdapRuntimeConfig.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;
            }
        }
        LdapRuntimeConfig.r = var5;
        LdapRuntimeConfig.a = Logger.getLogger(LdapRuntimeConfig.class.getName());
    }

    private static NumberFormatException a(NumberFormatException numberFormatException) {
        return numberFormatException;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x1F);
        }
        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 -> 48;
                    case 1 -> 95;
                    case 2 -> 13;
                    case 3 -> 105;
                    case 4 -> 26;
                    case 5 -> 48;
                    default -> 31;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

