$( () => {
    const n = n => {
        if (n == null)
            return;
        const t = document.querySelector("#selected_channel_type")
          , i = document.querySelector("#forgot_password_form_container")
          , r = document.querySelector("#forgot_password_modal");
        if (t) {
            if (t.onchange = () => {
                $.ajax({
                    type: "GET",
                    data: {
                        channelType: t.value,
                        platform: n.platform
                    },
                    url: "/Account/GetForgotPasswordTypeForm",
                    contentType: "application/json; charset=utf-8",
                    dataType: "html",
                    success: t => {
                        i && (i.innerHTML = t),
                        document.querySelector("#forgot_password_form") && ($(document.querySelector("#forgot_password_form")).removeData("validator").removeData("unobtrusiveValidation"),
                        $.validator.unobtrusive.parse("#forgot_password_form")),
                        $(i).find(".format_phone").mask("000-0000-0000-0000"),
                        applyCountryCodeDropdownOptions({
                            parentForm: "#forgot_password_form",
                            translations: {
                                contactNumberLengthErrorMessage: n.translations.contactNumberLengthErrorMessage
                            }
                        })
                    }
                })
            }
            ,
            r)
                $("#forgot_password_modal").on("show.bs.modal", function() {
                    t.onchange()
                });
            else
                t.onchange();
            const u = document.querySelector("#forgot_password_alert");
            u && (u.parentElement.hidden = !0);
            window.onForgotPasswordAjaxRequestBegin = () => {
                u && (u.parentElement.hidden = !0,
                u.innerText = "");
                const n = document.querySelectorAll(".btn-primary");
                $(n).prop("disabled", !0)
            }
            ;
            window.onForgotPasswordAjaxRequestSuccess = n => {
                if (n.status !== !0) {
                    u.innerHTML = n.message;
                    u.parentElement.hidden = !1;
                    return
                }
                n.message && registerPopup({
                    contentTitle: n.statusText,
                    content: n.message
                });
                $(r).modal("hide");
                n.redirectUrl && (window.location.href = n.redirectUrl)
            }
        } else {
            const t = document.querySelector("#login_modal");
            t.addEventListener("click", t => {
                const i = t.target.closest("#forgot_password_link");
                i && (t.preventDefault(),
                i.href = "#",
                delete i.dataset.target,
                delete i.dataset.toggle,
                registerPopup({
                    content: n.translations.contactSupportToReset,
                    onClose: () => {
                        window.location.href = "/contact-us"
                    }
                }))
            }
            );
            i && !r && registerPopup({
                content: n.translations.contactSupportToReset,
                onClose: () => {
                    window.location.href = "/contact-us"
                }
            })
        }
    }
    ;
    window.forgotPasswordOptions && n(window.forgotPasswordOptions)
}
);
