/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.util.Charsets
 *  com.l7tech.util.IOUtils
 *  jakarta.servlet.ServletException
 *  jakarta.servlet.ServletOutputStream
 *  jakarta.servlet.http.HttpServlet
 *  jakarta.servlet.http.HttpServletRequest
 *  jakarta.servlet.http.HttpServletResponse
 */
package com.l7tech.server.admin;

import com.l7tech.util.Charsets;
import com.l7tech.util.IOUtils;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URL;
import java.text.MessageFormat;

public class SSGLoginFormServlet
extends HttpServlet {
    private static final String NORMAL_MESSAGE;
    private static final String INCORRECT_USR_PWD_MESSAGE;
    private static final String LOCK_OUT_MESSAGE;
    private static final String CREDS_EXPIRED_MESSAGE;
    private static final String REQUIRE_CERT_TO_LOGIN;
    private static final String LOGIN_PAGE;
    static final long serialVersionUID = -79104025708043756L;
    private static final String[] a;

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
        String[] stringArray = a;
        httpServletResponse.setContentType(stringArray[12]);
        httpServletResponse.setStatus(200);
        ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
        PrintStream printStream = new PrintStream((OutputStream)servletOutputStream);
        String string = new String(IOUtils.slurpUrl((URL)SSGLoginFormServlet.class.getResource(this.getServletConfig().getInitParameter(stringArray[17]))), Charsets.UTF8);
        String string2 = new String(IOUtils.slurpUrl((URL)SSGLoginFormServlet.class.getResource(stringArray[6])), Charsets.UTF8);
        try {
            String string3;
            String string4;
            block17: {
                String string5;
                block12: {
                    block14: {
                        String string6;
                        block13: {
                            block16: {
                                string4 = "";
                                string3 = stringArray[16];
                                if (httpServletRequest.getAttribute(stringArray[23]) == null) break block16;
                                String string7 = (String)httpServletRequest.getAttribute(stringArray[21]);
                                if (string7.equalsIgnoreCase(stringArray[24])) {
                                    string3 = stringArray[5];
                                } else {
                                    stringArray = a;
                                    string3 = stringArray[20];
                                }
                                break block17;
                            }
                            try {
                                if (httpServletRequest.getAttribute(a[1]) == null && httpServletRequest.getAttribute(a[8]) == null) break block12;
                            }
                            catch (ServletException servletException) {
                                throw SSGLoginFormServlet.a(servletException);
                            }
                            stringArray = a;
                            String string8 = (String)httpServletRequest.getAttribute(stringArray[7]);
                            string6 = (String)httpServletRequest.getAttribute(stringArray[0]);
                            try {
                                if (string8 == null || !string8.equalsIgnoreCase(stringArray[18])) break block13;
                            }
                            catch (ServletException servletException) {
                                throw SSGLoginFormServlet.a(servletException);
                            }
                            stringArray = a;
                            string3 = stringArray[4];
                            break block14;
                        }
                        try {
                            if (string6 == null || !string6.equalsIgnoreCase(a[18])) break block14;
                        }
                        catch (ServletException servletException) {
                            throw SSGLoginFormServlet.a(servletException);
                        }
                        stringArray = a;
                        string3 = (String)httpServletRequest.getAttribute(stringArray[13]);
                    }
                    stringArray = a;
                    string4 = (String)httpServletRequest.getAttribute(stringArray[14]);
                    break block17;
                }
                stringArray = a;
                if (httpServletRequest.getAttribute(stringArray[19]) != null && (string5 = (String)httpServletRequest.getAttribute(stringArray[9])).equalsIgnoreCase(stringArray[18])) {
                    string3 = stringArray[2];
                }
            }
            printStream.print(MessageFormat.format(string, string2, string3, string4));
        }
        finally {
            printStream.close();
        }
    }

    protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
        this.doGet(httpServletRequest, httpServletResponse);
    }

    private static ServletException a(ServletException servletException) {
        return servletException;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[26];
                var3_1 = 0;
                var2_2 = "f<@![AP\u0014=Y+\u001c\\Q\u00140B8]DWPy\\/O[I[+H`\"f<@![AP\u0014=Y+\u001c\\Q\u0014<T>UZ[PyO<YL[Z-E/P[0a*I<\u001cAM\u0014+I?IALQ=\f:S\bKG<\f-PA[Z-\f-YZJ]?E-]\\[\u00145C)UF\tX6K'Rx_S<.d8_=KGLPyI6LALQ=\u0000nLD[U*In_@_Z>InEGKFy\\/O[I[+H`3`1InI[[FyB/QM\u001e[+\f>][MC6^*\u001cAM\u00140B-SZLQ:X`\u001c\bjF \f/[IWZw)\u001b:C#\u0013D\t@<O&\u0013[[F/I<\u0013Z[G6Y<_MM\u001b*_)PGY]7\u0002-O[\"f<@![AP\u0014=Y+\u001c\\Q\u0014<T>UZ[PyO<YL[Z-E/P[ f<@![AP\u0014=Y+\u001c\\Q\u00140B8]DWPy\\/O[I[+H`\u0012f\u001c}\u001buz{\u001a\u001ai\u001ch\u0006r{\u001ee\u00008y8T'Q]S\u00145C)UF\u001eU-X+QXJGyI6_M[P<Hb\u001cXRQ8_+\u001c\\LMyM)]AP\u00145M:YZ\u0010.d8_=KGLPyI6LALQ=\u0000nLD[U*In_@_Z>InEGKFy\\/O[I[+H`\t@<T:\u0013@JY5\u0016]7Z/PAZd8_=KGLP\u0014I=OIYQ\bA*I<RISQ\u0019w6B YKJ]7KnHG\u001e@1In{IJQ.M7\u0019w6B YKJ]7KnHG\u001e@1In{IJQ.M7\tX6K'Rx_S<\u0003m\u001c\u007f\u0012f\u001c}\u001buz{\u001a\u001ai\u001ch\u0006r{\u001ee\u00008y8T'Q]S\u00145C)UF\u001eU-X+QXJGyI6_M[P<Hb\u001cXRQ8_+\u001c\\LMyM)]AP\u00145M:YZ\u0010-f<@![AP\u0014=Y+\u001c\\Q\u00140B-SZLQ:XnI[[F7M#Y\bQFy\\/O[I[+H0a*I<\u001cAM\u0014+I?IALQ=\f:S\bKG<\f-PA[Z-\f-YZJ]?E-]\\[\u00145C)UF-f<@![AP\u0014=Y+\u001c\\Q\u00140B-SZLQ:XnI[[F7M#Y\bQFy\\/O[I[+H";
                var4_3 = "f<@![AP\u0014=Y+\u001c\\Q\u00140B8]DWPy\\/O[I[+H`\"f<@![AP\u0014=Y+\u001c\\Q\u0014<T>UZ[PyO<YL[Z-E/P[0a*I<\u001cAM\u0014+I?IALQ=\f:S\bKG<\f-PA[Z-\f-YZJ]?E-]\\[\u00145C)UF\tX6K'Rx_S<.d8_=KGLPyI6LALQ=\u0000nLD[U*In_@_Z>InEGKFy\\/O[I[+H`3`1InI[[FyB/QM\u001e[+\f>][MC6^*\u001cAM\u00140B-SZLQ:X`\u001c\bjF \f/[IWZw)\u001b:C#\u0013D\t@<O&\u0013[[F/I<\u0013Z[G6Y<_MM\u001b*_)PGY]7\u0002-O[\"f<@![AP\u0014=Y+\u001c\\Q\u0014<T>UZ[PyO<YL[Z-E/P[ f<@![AP\u0014=Y+\u001c\\Q\u00140B8]DWPy\\/O[I[+H`\u0012f\u001c}\u001buz{\u001a\u001ai\u001ch\u0006r{\u001ee\u00008y8T'Q]S\u00145C)UF\u001eU-X+QXJGyI6_M[P<Hb\u001cXRQ8_+\u001c\\LMyM)]AP\u00145M:YZ\u0010.d8_=KGLPyI6LALQ=\u0000nLD[U*In_@_Z>InEGKFy\\/O[I[+H`\t@<T:\u0013@JY5\u0016]7Z/PAZd8_=KGLP\u0014I=OIYQ\bA*I<RISQ\u0019w6B YKJ]7KnHG\u001e@1In{IJQ.M7\u0019w6B YKJ]7KnHG\u001e@1In{IJQ.M7\tX6K'Rx_S<\u0003m\u001c\u007f\u0012f\u001c}\u001buz{\u001a\u001ai\u001ch\u0006r{\u001ee\u00008y8T'Q]S\u00145C)UF\u001eU-X+QXJGyI6_M[P<Hb\u001cXRQ8_+\u001c\\LMyM)]AP\u00145M:YZ\u0010-f<@![AP\u0014=Y+\u001c\\Q\u00140B-SZLQ:XnI[[F7M#Y\bQFy\\/O[I[+H0a*I<\u001cAM\u0014+I?IALQ=\f:S\bKG<\f-PA[Z-\f-YZJ]?E-]\\[\u00145C)UF-f<@![AP\u0014=Y+\u001c\\Q\u00140B-SZLQ:XnI[[F7M#Y\bQFy\\/O[I[+H".length();
                var1_4 = 32;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = SSGLoginFormServlet.a(v0, SSGLoginFormServlet.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u0016g\u00043\u001bJ2\u00152  =\u00029T*6e PwE& 68M%Qg:6oK9V(!7*A#\u001bgs\u0011=[wT 2,!\f";
                    var4_3 = "\u0016g\u00043\u001bJ2\u00152  =\u00029T*6e PwE& 68M%Qg:6oK9V(!7*A#\u001bgs\u0011=[wT 2,!\f".length();
                    var1_4 = 3;
                    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++] = SSGLoginFormServlet.a(v0, SSGLoginFormServlet.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;
            }
        }
        SSGLoginFormServlet.a = var5;
        SSGLoginFormServlet.NORMAL_MESSAGE = SSGLoginFormServlet.a[15];
        SSGLoginFormServlet.LOGIN_PAGE = SSGLoginFormServlet.a[3];
        SSGLoginFormServlet.INCORRECT_USR_PWD_MESSAGE = SSGLoginFormServlet.a[25];
        SSGLoginFormServlet.LOCK_OUT_MESSAGE = SSGLoginFormServlet.a[10];
        SSGLoginFormServlet.CREDS_EXPIRED_MESSAGE = SSGLoginFormServlet.a[11];
        SSGLoginFormServlet.REQUIRE_CERT_TO_LOGIN = SSGLoginFormServlet.a[22];
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x39);
        }
        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 -> 51;
                    case 1 -> 94;
                    case 2 -> 43;
                    case 3 -> 73;
                    case 4 -> 59;
                    case 5 -> 47;
                    default -> 57;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

