{
  "version": 3,
  "sources": ["../../auth/login_page.tsx", "../../login.ts"],
  "sourcesContent": ["import {i18n} from \"@cling/lib.web.i18n\"\nimport {Button} from \"@cling/lib.web.mdc/button\"\nimport {running_on_ios, running_on_mac, with_perfect_scrollbar} from \"@cling/lib.web.utils\"\nimport * as React from \"react\"\nimport {PublicPage} from \"../pages/public_page\"\nimport {Icon, TextField} from \"@cling/lib.web.mdc\"\nimport {log_in, reset_password} from \"@cling/lib.web.auth/authenticate\"\nimport {safe_session_storage} from \"@cling/lib.web.utils/safe_storage\"\nimport {assert_never, ignore_errors, not_null} from \"@cling/lib.shared.utils\"\nimport {Dialog} from \"@cling/lib.web.mdc/dialog\"\nimport {report_error, report_info} from \"@cling/lib.shared.debug\"\nimport {sha256} from \"@cling/lib.shared.crypto\"\nimport FocusTrap from \"focus-trap-react\"\nimport {is_cling_hp} from \"../utils\"\nimport {query_param} from \"@cling/lib.web.utils/query_param\"\nimport {open_intercom} from \"../misc/intercom\"\nimport {LoginError, logout} from \"@cling/lib.web.auth\"\nimport {LIMIT_EMAIL, LIMIT_PASSWORD} from \"@cling/lib.shared.limits\"\nimport {IntroductionTab} from \"../misc/introduction_tab\"\nimport {\n    as_AuthActionCodeUID,\n    as_locale,\n    AuthProvider,\n    ManageAuthApplyAuthActionCode,\n    ManageAuthRequest,\n    ManageAuthResponse,\n    SignUpResponse,\n} from \"@cling/lib.shared.model/model\"\nimport {call_function} from \"@cling/lib.shared.faas/index\"\nimport {LoadingIndicator} from \"@cling/lib.web.lazy_load/loading_indicator\"\nimport type {AuthActionCodeUID} from \"@cling/lib.shared.model/types\"\nimport {categorize_error} from \"@cling/lib.shared.error/categorize_error\"\nimport {redirect_based_on_sign_up_response} from \"./authenticate\"\n\nexport const LoginPage = () => {\n    let mode = query_param(\"mode\") as\n        | \"reset_password\"\n        | \"change_password\"\n        | \"change_email\"\n        | \"revert_email\"\n        | \"verify_email\"\n        | \"activated\"\n        | \"password_login\"\n        | undefined\n    if (!mode) {\n        mode = undefined\n    }\n    if (mode === \"reset_password\") {\n        return <ResetPasswordPage />\n    }\n    if (\n        mode === \"verify_email\" ||\n        mode === \"change_email\" ||\n        mode === \"revert_email\" ||\n        mode === \"change_password\"\n    ) {\n        return <ApplyAuthActionCodePage mode={mode} />\n    }\n    return <RegularLoginPage mode={mode as \"activated\" | \"password_login\" | undefined} />\n}\n\nconst RegularLoginPage = ({\n    mode,\n    sign_up_res,\n}: {\n    mode: \"activated\" | \"password_login\" | undefined\n    sign_up_res?: SignUpResponse\n}) => {\n    const [view, set_view] = React.useState<\"start\" | \"password\">(mode ? \"password\" : \"start\")\n    const [email, set_email] = React.useState({value: \"\", is_valid: false})\n    const [password, set_password] = React.useState({value: \"\", is_valid: false})\n    const [error_msg, set_error_msg] = React.useState<{title: string; content: any} | undefined>()\n    const [waiting, set_waiting] = React.useState(false)\n    const logout_promise = React.useRef<Promise<void>>()\n    const clear_error_msg = React.useCallback(() => set_error_msg(undefined), [])\n    const log_in_with_social = React.useCallback((provider: \"google\" | \"facebook\" | \"apple\") => {\n        ;(async () => {\n            await ignore_errors(() => logout_promise.current)\n            safe_session_storage.setItem(\"authenticate.provider\", `${AuthProvider[provider]}`)\n            try {\n                await log_in({provider, is_dev: cling.dev, locale: is_cling_hp() || \"en\"})\n            } catch (error) {\n                report_error(\"Login with social provider failed. Showing message to the user.\", {\n                    error,\n                    provider,\n                })\n                set_waiting(false)\n                set_error_msg({\n                    title: i18n.login_failed,\n                    content: i18n.unfortunately_the_login_attempt_was_unsuccessful,\n                })\n            }\n        })().catch(report_error)\n    }, [])\n    const log_in_with_password = React.useCallback(() => {\n        if (!email.value || !password.value || !email.is_valid || !password.is_valid) {\n            set_error_msg({\n                title: i18n.wrong_e_mail_or_password,\n                content: i18n.please_make_sure_that_your_e_mail_address_and_password,\n            })\n            return\n        }\n        ;(async () => {\n            set_waiting(true)\n            try {\n                await ignore_errors(() => logout_promise.current)\n                const res = await log_in({\n                    provider: \"password\",\n                    locale: is_cling_hp() || \"en\",\n                    is_dev: cling.dev,\n                    email: not_null(email.value),\n                    password: not_null(password.value),\n                })\n                safe_session_storage.setItem(\n                    \"authenticate.provider\",\n                    `${AuthProvider.username_password}`,\n                )\n                safe_session_storage.setItem(\n                    \"authenticate.method\",\n                    res?.is_signup ? \"signup\" : \"login\",\n                )\n                redirect_based_on_sign_up_response(sign_up_res)\n            } catch (error) {\n                report_info(\"Password authentication failed\", {\n                    error,\n                    email_hash: sha256(new TextEncoder().encode(email.value)).toString(\"base64\"),\n                })\n                set_waiting(false)\n                if ((error as LoginError).code === \"access_denied\") {\n                    set_error_msg({\n                        title: i18n.wrong_e_mail_or_password,\n                        content: i18n.please_make_sure_that_your_e_mail_address_and_password,\n                    })\n                } else if ((error as LoginError).code === \"unverified_email\") {\n                    set_error_msg({\n                        title: i18n.please_verify_your_email_address,\n                        content: i18n.we_sent_you_an_e_mail_with_a_link_to_verify,\n                    })\n                } else {\n                    set_error_msg({\n                        title: i18n.sorry_something_went_wrong,\n                        content: i18n.please_make_sure_that_your_e_mail_address_and_password,\n                    })\n                }\n            }\n        })().catch(report_error)\n    }, [email, password, sign_up_res])\n    const set_view_password = React.useCallback(() => set_view(\"password\"), [])\n    const set_view_start = React.useCallback(() => set_view(\"start\"), [])\n    React.useEffect(() => {\n        logout_promise.current = (async () => {\n            await logout({shallow: true}).catch(report_error)\n        })()\n    }, [])\n    const login_with_apple_btn = (\n        <Button\n            onClick={() => log_in_with_social(\"apple\")}\n            raised\n            icon={<div className=\"public-page__login-btn-icon\" />}\n            className=\"mt--1-5 public-page__login-btn public-page__login-btn--apple\"\n            data-test-id=\"LoginPage_apple\"\n        >\n            {i18n.log_in_with_apple}\n        </Button>\n    )\n    return (\n        <LoginPageChrome>\n            <>\n                {!!error_msg?.title && (\n                    <Dialog\n                        onAccept={clear_error_msg}\n                        onCancel={clear_error_msg}\n                        button_label_accept={i18n.ok}\n                        desktop_focus=\"accept\"\n                        title={error_msg.title}\n                    >\n                        {error_msg.content}\n                    </Dialog>\n                )}\n                <div className=\"public-page__login-content\">\n                    <IntroductionTab stock_image_name=\"start2.svg\">\n                        <>\n                            {view === \"start\" && (\n                                <div className=\"flex-col align-items--center\">\n                                    <div className=\"public-page__login-header\">{i18n.lets_go}</div>\n                                    {(running_on_ios() || running_on_mac()) && login_with_apple_btn}\n                                    <Button\n                                        onClick={() => log_in_with_social(\"google\")}\n                                        raised\n                                        icon={<div className=\"public-page__login-btn-icon\" />}\n                                        className=\"mt--1-5 public-page__login-btn public-page__login-btn--google\"\n                                        data-test-id=\"LoginPage_google\"\n                                    >\n                                        {i18n.log_in_with_google}\n                                    </Button>\n                                    {!running_on_ios() && !running_on_mac() && login_with_apple_btn}\n                                    <Button\n                                        onClick={() => log_in_with_social(\"facebook\")}\n                                        raised\n                                        icon={\n                                            <Icon\n                                                icon=\"facebook\"\n                                                className=\"public-page__login-btn-icon\"\n                                            />\n                                        }\n                                        className=\"mt--1-5 public-page__login-btn public-page__login-btn--facebook\"\n                                        data-test-id=\"LoginPage_facebook\"\n                                    >\n                                        {i18n.log_in_with_facebook}\n                                    </Button>\n                                    <Button\n                                        onClick={set_view_password}\n                                        raised\n                                        icon={\n                                            <Icon\n                                                icon=\"password\"\n                                                className=\"public-page__login-btn-icon\"\n                                            />\n                                        }\n                                        className=\"mt--1-5 public-page__login-btn public-page__login-btn--password\"\n                                        data-test-id=\"LoginPage_password\"\n                                    >\n                                        {i18n.log_in_with_password}\n                                    </Button>\n                                </div>\n                            )}\n                            {view === \"password\" && (\n                                <div className=\"flex-col align-items--center\">\n                                    {mode === \"activated\" && (\n                                        <>\n                                            <div\n                                                className=\"mb--2 public-page__login-header\"\n                                                data-test-id=\"LoginPage_first_login\"\n                                            >\n                                                {i18n.your_first_login}\n                                            </div>\n                                            <div className=\"mb--2\">\n                                                {i18n.your_email_address_has_been_verified}\n                                            </div>\n                                        </>\n                                    )}\n                                    {mode !== \"activated\" && (\n                                        <Button\n                                            onClick={set_view_start}\n                                            className=\"mb--1 public-page__login-btn\"\n                                            icon=\"arrow_back\"\n                                        >\n                                            {i18n.back}\n                                        </Button>\n                                    )}\n                                    <TextField\n                                        key=\"email\"\n                                        onChange={set_email}\n                                        onEnter={log_in_with_password}\n                                        required\n                                        initial_focus={false}\n                                        value={email.value}\n                                        id=\"email\"\n                                        label={i18n.e_mail_address}\n                                        email\n                                        full_width\n                                        maxLength={LIMIT_EMAIL.upper_bound}\n                                        className=\"mb--1\"\n                                        data-test-id=\"LoginPage_email\"\n                                    />\n                                    <TextField\n                                        key=\"password\"\n                                        onChange={set_password}\n                                        onEnter={log_in_with_password}\n                                        required\n                                        initial_focus={false}\n                                        value={password.value}\n                                        id=\"password\"\n                                        label={i18n.password}\n                                        type=\"password\"\n                                        full_width\n                                        maxLength={LIMIT_PASSWORD.upper_bound}\n                                        data-test-id=\"LoginPage_password\"\n                                    />\n                                    <a\n                                        href={`/${is_cling_hp()}/login.html?mode=reset_password`}\n                                        className=\"action mb--2 mt--1\"\n                                        data-test-id=\"LoginPage_forget_password\"\n                                    >\n                                        {i18n.forgot_password}\n                                    </a>\n                                    <Button\n                                        key=\"button\"\n                                        onClick={log_in_with_password}\n                                        raised\n                                        disabled={waiting}\n                                        icon={\n                                            <Icon\n                                                icon=\"password\"\n                                                className=\"public-page__login-btn-icon\"\n                                            />\n                                        }\n                                        className=\"public-page__login-btn public-page__login-btn--password\"\n                                        data-test-id=\"LoginPage_log_in_with_password\"\n                                    >\n                                        {i18n.log_in_with_password}\n                                    </Button>\n                                </div>\n                            )}\n                            {view === \"start\" && (\n                                <div className=\"mt--2 flex-col align-items--center\">\n                                    <div>{i18n.dont_have_a_cling_account}</div>\n                                    <a\n                                        href={`/${is_cling_hp()}/signup.html`}\n                                        className=\"action-no-font\"\n                                    >\n                                        {i18n.sign_up_for_free}\n                                    </a>\n                                </div>\n                            )}\n                        </>\n                    </IntroductionTab>\n                </div>\n            </>\n        </LoginPageChrome>\n    )\n}\n\nconst ResetPasswordPage = () => {\n    const [view, set_view] = React.useState<\"start\" | \"done\">(\"start\")\n    const [email, set_email] = React.useState({value: \"\", is_valid: false})\n    const [error_msg, set_error_msg] = React.useState<{title: string; content: any} | undefined>()\n    const [waiting, set_waiting] = React.useState(false)\n    const clear_error_msg = React.useCallback(() => set_error_msg(undefined), [])\n    const open_chat = React.useCallback((e: React.MouseEvent) => {\n        e.preventDefault()\n        e.stopPropagation()\n        open_intercom(\"new_message\")\n    }, [])\n    const send_email = React.useCallback(() => {\n        if (!email.value || !email.is_valid) {\n            set_error_msg({\n                title: i18n.failed_to_reset_password,\n                content: i18n.please_make_sure_that_your_e_mail_address_is_correct,\n            })\n            return\n        }\n        set_waiting(true)\n        reset_password({\n            is_dev: cling.dev,\n            email: not_null(email.value),\n            locale: as_locale(is_cling_hp()!),\n        })\n            .then(() => {\n                set_waiting(false)\n                set_view(\"done\")\n            })\n            .catch((error) => {\n                report_info(\"Reset password failed\", {\n                    error,\n                    email_hash: sha256(new TextEncoder().encode(email.value)).toString(\"base64\"),\n                })\n                set_waiting(false)\n                set_error_msg({\n                    title: i18n.failed_to_reset_password,\n                    content: i18n.please_make_sure_that_your_e_mail_address_is_correct,\n                })\n            })\n    }, [email])\n    return (\n        <LoginPageChrome>\n            <>\n                {!!error_msg?.title && (\n                    <Dialog\n                        onAccept={clear_error_msg}\n                        onCancel={clear_error_msg}\n                        button_label_accept={i18n.ok}\n                        desktop_focus=\"accept\"\n                        title={error_msg.title}\n                    >\n                        {error_msg.content}\n                    </Dialog>\n                )}\n                <div className=\"public-page__login-content\">\n                    <IntroductionTab stock_image_name=\"start2.svg\">\n                        {view === \"start\" && (\n                            <div className=\"flex-col align-items--center\">\n                                <div className=\"public-page__login-header\">\n                                    {i18n.change_password}\n                                </div>\n                                <div className=\"mb--2\">\n                                    {i18n.enter_your_e_mail_address_and_we_will}\n                                </div>\n                                <TextField\n                                    key=\"email\"\n                                    onChange={set_email}\n                                    initial_focus={false}\n                                    value={email.value}\n                                    id=\"email\"\n                                    required\n                                    label={i18n.e_mail_address}\n                                    email\n                                    full_width\n                                    maxLength={LIMIT_EMAIL.upper_bound}\n                                    className=\"mb--2\"\n                                    data-test-id=\"ResetPasswordPage_email\"\n                                    onEnter={send_email}\n                                />\n                                <Button\n                                    onClick={send_email}\n                                    className=\"mb--2\"\n                                    raised\n                                    icon=\"email\"\n                                    data-test-id=\"ResetPasswordPage_send_email\"\n                                    disabled={waiting}\n                                >\n                                    {i18n.request_email}\n                                </Button>\n                                <div className=\"flex-col align-items--center\">\n                                    <a\n                                        href={`/${is_cling_hp()}/login.html`}\n                                        className=\"action-no-font mb--1\"\n                                    >\n                                        {i18n.back_to_login}\n                                    </a>\n                                    <a\n                                        href={`/${is_cling_hp()}/support-chat.html`}\n                                        className=\"action-no-font\"\n                                        onClick={open_chat}\n                                    >\n                                        {i18n.contact_us}\n                                    </a>\n                                </div>\n                            </div>\n                        )}\n                        {view === \"done\" && (\n                            <>\n                                <div\n                                    className=\"public-page__login-header\"\n                                    data-test-id=\"ResetPasswordPage_done\"\n                                >\n                                    {i18n.done}\n                                </div>\n                                <div>{i18n.we_sent_you_an_e_mail_with_instructions_on_how}</div>\n                            </>\n                        )}\n                    </IntroductionTab>\n                </div>\n            </>\n        </LoginPageChrome>\n    )\n}\n\nconst ApplyAuthActionCodePage = ({\n    mode,\n}: {\n    mode: \"verify_email\" | \"change_email\" | \"revert_email\" | \"change_password\"\n}) => {\n    const [view, set_view] = React.useState<\"enter_password\" | \"working\" | \"done\" | \"login\">(\n        mode === \"change_password\" ? \"enter_password\" : \"working\",\n    )\n    const [new_password, set_new_password] = React.useState<{value: string; is_valid: boolean}>({\n        value: \"\",\n        is_valid: false,\n    })\n    const [error_msg, set_error_msg] = React.useState<{title: string; content: any} | undefined>()\n    const sign_up_res = React.useRef<SignUpResponse>()\n    const open_chat = React.useCallback((e: React.MouseEvent) => {\n        e.preventDefault()\n        e.stopPropagation()\n        open_intercom(\"new_message\")\n    }, [])\n    React.useEffect(() => {\n        if (view !== \"working\") {\n            return\n        }\n        let auth_action_code_uid: AuthActionCodeUID\n        ;(async () => {\n            auth_action_code_uid = as_AuthActionCodeUID(\n                not_null(query_param(\"aac\"), \"`aac` is required in query string\"),\n            )\n            sign_up_res.current = (\n                await call_function(\n                    new ManageAuthRequest({\n                        apply_auth_action_code: new ManageAuthApplyAuthActionCode({\n                            auth_action_code_uid,\n                            new_password: new_password.value,\n                        }),\n                    }),\n                    ManageAuthResponse,\n                )\n            ).sign_up_response\n            set_view(mode === \"verify_email\" ? \"login\" : \"done\")\n        })().catch((error) => {\n            if (categorize_error(error).category === \"not_found_or_gone\" || !auth_action_code_uid) {\n                if (mode === \"verify_email\") {\n                    // In most cases this means that the account is activated, i.e.\n                    // the e-mail address had been verified earlier. Send the user\n                    // to the login page.\n                    error.message = `${error.message} -- ignored, the user is shown the login`\n                    set_view(\"login\")\n                } else {\n                    set_error_msg({\n                        title: i18n.action_is_invalid,\n                        content: (\n                            <div>\n                                {i18n.the_link_is_invalid_or_has_already_been_used}\n                                <br />\n                                <br />\n                                <a\n                                    href={`/${is_cling_hp()}/support-chat.html`}\n                                    className=\"action-no-font\"\n                                    onClick={open_chat}\n                                >\n                                    {i18n.contact_us}\n                                </a>\n                            </div>\n                        ),\n                    })\n                }\n            } else {\n                set_error_msg({\n                    title: i18n.action_failed,\n                    content: (\n                        <div>\n                            {i18n.the_action_failed_please_tell_us_about_it}\n                            <br />\n                            <br />\n                            <a\n                                href={`/${is_cling_hp()}/support-chat.html`}\n                                className=\"action-no-font\"\n                                onClick={open_chat}\n                            >\n                                {i18n.contact_us}\n                            </a>\n                        </div>\n                    ),\n                })\n            }\n            report_error(error)\n        })\n    }, [mode, view, new_password, open_chat])\n    if (error_msg) {\n        return (\n            <LoginPageChrome disable_focus_trap>\n                <div className=\"public-page__login-content\">\n                    <IntroductionTab stock_image_name=\"start2.svg\">\n                        <div className=\"public-page__login-header\">{error_msg.title}</div>\n                        <div>{error_msg.content}</div>\n                    </IntroductionTab>\n                </div>\n            </LoginPageChrome>\n        )\n    }\n    if (view === \"enter_password\") {\n        const update_password = () => {\n            if (!new_password.is_valid || new_password.value.length < 6) {\n                return\n            }\n            set_view(\"working\")\n        }\n        return (\n            <LoginPageChrome disable_focus_trap>\n                <div className=\"public-page__login-content\">\n                    <IntroductionTab stock_image_name=\"start2.svg\">\n                        <>\n                            <div\n                                className=\"public-page__login-header\"\n                                data-test-id=\"ApplyAuthActionCodePage_change_password\"\n                            >\n                                {i18n.set_a_new_password}\n                            </div>\n                            <div className=\"flex-col align-items--center\">\n                                <TextField\n                                    key=\"password\"\n                                    onChange={set_new_password}\n                                    onEnter={update_password}\n                                    is_valid={(s) => s.length >= 6}\n                                    required\n                                    initial_focus\n                                    value={new_password.value}\n                                    id=\"password\"\n                                    label={i18n.password}\n                                    type=\"password\"\n                                    full_width\n                                    maxLength={LIMIT_PASSWORD.upper_bound}\n                                    data-test-id=\"ApplyAuthActionCodePage_new_password\"\n                                />\n                                <Button\n                                    key=\"button\"\n                                    onClick={update_password}\n                                    raised\n                                    disabled={!new_password.is_valid}\n                                    icon=\"checkmark\"\n                                    className=\"mt--2\"\n                                    data-test-id=\"ApplyAuthActionCodePage_update_password\"\n                                >\n                                    {i18n.set_a_new_password}\n                                </Button>\n                            </div>\n                        </>\n                    </IntroductionTab>\n                </div>\n            </LoginPageChrome>\n        )\n    } else if (view === \"login\") {\n        return (\n            <RegularLoginPage\n                mode={\n                    sign_up_res.current && mode === \"verify_email\" ? \"activated\" : \"password_login\"\n                }\n                sign_up_res={sign_up_res.current}\n            />\n        )\n    } else if (view === \"working\") {\n        return (\n            <LoginPageChrome disable_focus_trap>\n                <div className=\"public-page__login-content\">\n                    <IntroductionTab stock_image_name=\"start2.svg\">\n                        <div className=\"flex-col align-items--center\">\n                            <div className=\"public-page__login-header\">\n                                {mode === \"change_password\" && i18n.changing_password}\n                                {mode === \"change_email\" && i18n.changing_email_address}\n                                {mode === \"revert_email\" && i18n.reverting_email_address}\n                                {mode === \"verify_email\" && i18n.verifying_email_address}\n                            </div>\n                            <div className=\"mb--2\">\n                                <LoadingIndicator />\n                            </div>\n                        </div>\n                    </IntroductionTab>\n                </div>\n            </LoginPageChrome>\n        )\n    } else if (view === \"done\") {\n        return (\n            <LoginPageChrome disable_focus_trap>\n                <div className=\"public-page__login-content\">\n                    <IntroductionTab stock_image_name=\"start2.svg\">\n                        <>\n                            <div\n                                className=\"public-page__login-header\"\n                                data-test-id=\"ApplyAuthActionCodePage_done\"\n                            >\n                                {mode === \"change_password\" && i18n.password_changed}\n                                {mode === \"change_email\" && i18n.email_address_changed}\n                                {mode === \"revert_email\" && i18n.email_address_reverted}\n                            </div>\n                            <div className=\"flex-col align-items--center\">\n                                <div>{i18n.all_is_done_you_can_now_log_in}</div>\n                                <div className=\"mt--2\">\n                                    <Button\n                                        raised\n                                        onClick={() => set_view(\"login\")}\n                                        data-test-id=\"ApplyAuthActionCodePage_log_in\"\n                                        icon={\n                                            <Icon\n                                                icon=\"password\"\n                                                className=\"public-page__login-btn-icon\"\n                                            />\n                                        }\n                                        className=\"public-page__login-btn public-page__login-btn--password\"\n                                    >\n                                        {i18n.log_in_with_password}\n                                    </Button>\n                                </div>\n                            </div>\n                        </>\n                    </IntroductionTab>\n                </div>\n            </LoginPageChrome>\n        )\n    } else {\n        throw assert_never(view)\n    }\n}\n\nconst LoginPageChrome = ({\n    children,\n    disable_focus_trap,\n}: {\n    children: any\n    disable_focus_trap?: boolean\n}) => {\n    return (\n        <PublicPage title={i18n.log_in}>\n            <FocusTrap\n                focusTrapOptions={{\n                    allowOutsideClick: true,\n                    initialFocus: disable_focus_trap ? false : undefined,\n                    fallbackFocus: disable_focus_trap ? () => document.body : undefined,\n                }}\n            >\n                {with_perfect_scrollbar(\n                    <div className=\"public-page__content--center\">\n                        <div>\n                            <div>{children}</div>\n                        </div>\n                    </div>,\n                )}\n            </FocusTrap>\n        </PublicPage>\n    )\n}\n", "import {init} from \"./entry\"\nimport {report_error} from \"@cling/lib.shared.debug\"\nimport {start_public_page} from \"./startup/startup_public_page\"\nimport {LoginPage} from \"./auth/login_page\"\nimport {init as auth_init} from \"@cling/lib.web.auth/index\"\nimport {handle_auth_redirect} from \"./auth/authenticate\"\n\nif (process.env.NODE_ENV !== \"test\") {\n    ;(async function start() {\n        init()\n        auth_init({is_dev: cling.dev})\n        if (!(await handle_auth_redirect())) {\n            start_public_page(LoginPage).catch(report_error)\n        }\n    })().catch(report_error)\n}\n"],
  "mappings": "4yBAGAA,KASA,IAAAC,GAAsB,WAsBf,IAAMC,GAAYC,EAAA,IAAM,CAC3B,IAAIC,EAAOC,EAAY,MAAM,EAY7B,OAHKD,IACDA,EAAO,QAEPA,IAAS,iBACFE,EAACC,GAAA,IAAkB,EAG1BH,IAAS,gBACTA,IAAS,gBACTA,IAAS,gBACTA,IAAS,kBAEFE,EAACE,GAAA,CAAwB,KAAMJ,EAAM,EAEzCE,EAACG,GAAA,CAAiB,KAAML,EAAoD,CACvF,EAzByB,aA2BnBK,GAAmBN,EAAA,CAAC,CACtB,KAAAC,EACA,YAAAM,CACJ,IAGM,CACF,GAAM,CAACC,EAAMC,CAAQ,EAAUC,EAA+BT,EAAO,WAAa,OAAO,EACnF,CAACU,EAAOC,CAAS,EAAUF,EAAS,CAAC,MAAO,GAAI,SAAU,EAAK,CAAC,EAChE,CAACG,EAAUC,CAAY,EAAUJ,EAAS,CAAC,MAAO,GAAI,SAAU,EAAK,CAAC,EACtE,CAACK,EAAWC,CAAa,EAAUN,EAAoD,EACvF,CAACO,EAASC,CAAW,EAAUR,EAAS,EAAK,EAC7CS,EAAuBC,EAAsB,EAC7CC,EAAwBC,EAAY,IAAMN,EAAc,MAAS,EAAG,CAAC,CAAC,EACtEO,EAA2BD,EAAaE,GAA8C,EACtF,SAAY,CACV,MAAMC,EAAc,IAAMN,EAAe,OAAO,EAChDO,EAAqB,QAAQ,wBAAyB,GAAGC,EAAaH,CAAQ,CAAC,EAAE,EACjF,GAAI,CACA,MAAMI,EAAO,CAAC,SAAAJ,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
  "names": ["init_compat_module", "import_focus_trap_react", "LoginPage", "__name", "mode", "query_param", "_", "ResetPasswordPage", "ApplyAuthActionCodePage", "RegularLoginPage", "sign_up_res", "view", "set_view", "d", "email", "set_email", "password", "set_password", "error_msg", "set_error_msg", "waiting", "set_waiting", "logout_promise", "A", "clear_error_msg", "q", "log_in_with_social", "provider", "ignore_errors", "safe_session_storage", "AuthProvider", "log_in", "is_cling_hp", "error", "report_error", "i18n", "log_in_with_password", "res", "not_null", "redirect_based_on_sign_up_response", "report_info", "sha256", "set_view_password", "set_view_start", "y", "logout", "login_with_apple_btn", "Button", "LoginPageChrome", "Dialog", "IntroductionTab", "running_on_ios", "running_on_mac", "Icon", "TextField", "LIMIT_EMAIL", "LIMIT_PASSWORD", "open_chat", "e", "open_intercom", "send_email", "reset_password", "as_locale", "new_password", "set_new_password", "auth_action_code_uid", "as_AuthActionCodeUID", "call_function", "ManageAuthRequest", "ManageAuthApplyAuthActionCode", "ManageAuthResponse", "categorize_error", "update_password", "s", "LoadingIndicator", "assert_never", "children", "disable_focus_trap", "PublicPage", "FocusTrap", "with_perfect_scrollbar", "__name", "init", "handle_auth_redirect", "start_public_page", "LoginPage", "report_error"]
}