function toSendOtpBttn() {
    $mo(".um-login").length > 0 && ($mo(".um-login .um-field-password").show(), $mo("#hidden_current_tab").val("Login"), $mo(".um-login #um-submit-btn").parent().next().children().val("Login with OTP").attr("onclick", "hidePassBttn()"), $mo(".um-login #um-submit-btn").val("Login with Password").children().remove()), $mo('#loginform label[for="user_pass"]').length > 0 && ($mo("#loginform label[for='user_pass']").parent().show(200), $mo("#hidden_current_tab").val("Login"), $mo('input[name="wp-submit"]:eq(0)').css({
        padding: "0px 2px"
    }).val("Login with Password"), $mo('input[name="wp-submit"]:eq(1)').val("Back").attr("onclick", "hidePassBttn()")), $mo('.woocommerce-form-login label[for="password"]').length > 0 && ($mo("#hidden_current_tab").val("Login"), $mo('label[for="password"]').parent().show(200), $mo('button[name="login"]:eq(1)').html("Login with OTP").attr("onclick", "hidePassBttn()"), $mo('button[name="login"]:eq(0)').html("Login with Password").prop("value", "Login with Password"))
}

function hidePassBttn() {
    $mo(".um-login").length > 0 && ($mo(".um-login .um-field-password").hide(), $mo("#hidden_current_tab").val("OTP"), $mo(".um-login #um-submit-btn").parent().next().children().val("Login with Password").attr("onclick", "toSendOtpBttn()"), $mo(".um-login #um-submit-btn").val("Login with OTP").append('<input hidden name="logintype" value="' + movarlogin.buttontext + '"/>')), $mo('#loginform label[for="user_pass"]').length > 0 && ($mo("#hidden_current_tab").val("OTP"), $mo("#loginform label[for='user_pass']").parent().hide(200), $mo('input[name="wp-submit"]:eq(1)').attr("onclick", "toSendOtpBttn()").val("Login with Password"), $mo('input[name="wp-submit"]:eq(0)').val("Login with OTP")), $mo('.woocommerce-form-login label[for="password"]').length > 0 && ($mo('label[for="password"]').parent().hide(200), $mo("#hidden_current_tab").val("OTP"), $mo('button[name="login"]:eq(1)').html("Login with Password").attr("onclick", "toSendOtpBttn()"), $mo('button[name="login"]:eq(0)').html("Login with OTP").prop("value", "Login with OTP"))
}

function moIsAdminCheck(usernameSelector, passwordFieldSelector, submitButtonSelector, buttonText) {
    var username = $mo(usernameSelector).val();
    $mo.ajax({
        url: movarlogin.siteURL,
        type: "POST",
        data: {
            username: username,
            action: movarlogin.isAdminAction,
            security: movarlogin.nonce
        },
        crossDomain: !0,
        dataType: "json",
        success: function(response) {
            "success" === response.result ? ($mo(".um-login").length > 0 && ($mo(passwordFieldSelector).show(), $mo(submitButtonSelector).val("Login with Password"), $mo(".um-login #um-submit-btn").parent().next().hide(), $mo(".um-login #um-submit-btn").parent().next().next().hide(), $mo(".um-login #um-submit-btn").parent().next().next().next().addClass("um-right").addClass("um-half").children().css({
                margin: "0%"
            })), $mo('#loginform label[for="user_pass"]').length > 0 && ($mo(passwordFieldSelector).parent().show(), $mo("#user_pass").prop("disabled", !1), $mo('input[name="wp-submit"]:eq(1)').hide(), $mo('input[name="wp-submit"]:eq(0)').val("Login")), $mo('.woocommerce-form-login label[for="password"').length > 0 && ($mo(passwordFieldSelector).parent().show(), $mo('button[name="login"]:eq(1)').hide(), $mo('button[name="login"]:eq(0)').html("Login"))) : ($mo(".um-login").length > 0 && ($mo(passwordFieldSelector).hide(), $mo(".um-login #um-submit-btn").parent().next().show(), $mo(".um-login #um-submit-btn").parent().next().next().show(), $mo(".um-login #um-submit-btn").parent().next().next().show(), $mo(".um-login #um-submit-btn").parent().next().next().next().removeClass("um-right").removeClass("um-half").children().css({
                "margin-top": "2%"
            })), $mo('#loginform label[for="user_pass"]').length > 0 && ($mo(passwordFieldSelector).parent().hide(), $mo('input[name="wp-submit"]:eq(1)').show().val("Login with Password"), $mo('input[name="wp-submit"]:eq(0)').show().val("Login with OTP")), $mo('.woocommerce-form-login label[for="password"').length > 0 && ($mo(passwordFieldSelector).parent().hide(), $mo('button[name="login"]:eq(1)').show(), $mo('button[name="login"]:eq(0)').html("Login with OTP")))
        },
        error: function(errorResponse) {}
    })
}
jQuery(document).ready((function() {
    $mo = jQuery;
    var wpLoginButtonHtml = '<p><input type="submit"name="wp-submit"id="wp-submit"class="button button-primary button-large"style="width:48%;float:right; value="' + movarlogin.buttontext + '"></p>',
        woocommerceLoginButtonHtml = '<button  type="submit" class="woocommerce-Button button" style="width:50%;float:right;padding: 1.4em 2em; margin-top: 1.1em" name="login" value="' + movarlogin.buttontext + '"> </button',
        umLoginButtonHtml = '<div class="um-right um-half"><input type="submit" name="logintype" value="' + movarlogin.buttontext + '" class="um-button um-alt"></div><div class="um-clear"></div>';
    if (movarlogin.userLabel) {
        if ($mo(".um-login").length > 0 && $mo(".um-login label[for^=username-]").text(movarlogin.userLabel), $mo('#loginform label[for="user_login"').length > 0) {
            var updatedLabelHtml = $mo('label[for="user_login"]').html().replace("Username or Email Address", movarlogin.userLabel);
            $mo('label[for="user_login"]').html(updatedLabelHtml)
        }
        $mo(".woocommerce-form-login").length > 0 && $mo("label[for^=username]").text(movarlogin.userLabel)
    }
    if (movarlogin.skipPwdCheck && !movarlogin.skipPwdFallback) $mo(".um-login").length > 0 && (passwordFieldSelector = ".um-login .um-field-password", submitButtonSelector = ".um-login #um-submit-btn", usernameSelector = 'input[name^="username"]', buttonText = movarlogin.buttontext, $mo(".um-login .um-field-password").hide(), $mo(".um-login #um-submit-btn").val(movarlogin.buttontext).append('<input hidden name="logintype" value="' + movarlogin.buttontext + '"/>')), $mo('#loginform label[for="user_pass"').length > 0 && (passwordFieldSelector = '#loginform label[for="user_pass"]', submitButtonSelector = "#loginform #wp-submit", usernameSelector = "input#user_login", buttonText = $mo(submitButtonSelector).val(), $mo(passwordFieldSelector).parent().hide(), $mo(submitButtonSelector).val(movarlogin.buttontext)), $mo('.woocommerce-form-login label[for="password"').length > 0 && (passwordFieldSelector = 'label[for="password"]', submitButtonSelector = $mo(".woocommerce-form-login .woocommerce-Button[type='submit']").length ? ".woocommerce-form-login .woocommerce-Button[type='submit']" : ".woocommerce-button[name=login]", usernameSelector = "input#username", buttonText = $mo(submitButtonSelector).val(), $mo(passwordFieldSelector).parent().hide(), $mo(submitButtonSelector).val(movarlogin.buttontext)), movarlogin.byPassAdmin && (moIsAdminCheck(usernameSelector, passwordFieldSelector, submitButtonSelector, buttonText), $mo(usernameSelector).on("keyup", (function() {
        moIsAdminCheck(usernameSelector, passwordFieldSelector, submitButtonSelector, buttonText)
    })));
    else if (movarlogin.skipPwdCheck) {
        var passwordFieldSelector, submitButtonSelector, usernameSelector, buttonText;
        $mo(".um-login").length > 0 && (passwordFieldSelector = ".um-login .um-field-password", submitButtonSelector = ".um-login #um-submit-btn", usernameSelector = 'input[name^="username"]', buttonText = movarlogin.buttontext, $mo('<input type="hidden" id="hidden_current_tab" value="OTP">').insertBefore(submitButtonSelector), $mo(".um-login .um-field-password").hide(), $mo(".um-login #um-submit-btn").val(movarlogin.buttontext).append('<input hidden name="logintype" value="' + movarlogin.buttontext + '"/>'), $mo("#um-login #um-submit-btn").css({
            width: "50%",
            float: "left"
        }), $mo(".um-login #um-submit-btn").parent().next().removeClass("um-right").removeClass("um-half").children().css({
            "margin-top": "2%"
        }), $mo(umLoginButtonHtml).insertAfter($mo(".um-login #um-submit-btn").parent()), $mo(".um-login #um-submit-btn").parent().next().children().attr("type", "button").val("Login with Password").attr("onclick", "toSendOtpBttn()")), $mo('#loginform label[for="user_pass"]').length > 0 && (passwordFieldSelector = '#loginform label[for="user_pass"]', submitButtonSelector = "#loginform #wp-submit", usernameSelector = "input#user_login", buttonText = $mo(submitButtonSelector).val(), $mo('<input type="hidden" id="hidden_current_tab" value="OTP">').insertBefore(submitButtonSelector), $mo(passwordFieldSelector).parent().hide(200), $mo(submitButtonSelector).css({
            width: "48%",
            float: "left"
        }), $mo("#loginform .forgetmenot").css({
            width: "100%",
            "margin-bottom": "2%"
        }), $mo("#loginform #wp-submit").val("Login with OTP"), $mo("#loginform").append(wpLoginButtonHtml), $mo('input[name="wp-submit"]:eq(1)').val("Login with Password").css({
            padding: "0px 2px"
        }).attr("type", "button").attr("onclick", "toSendOtpBttn()")), $mo('.woocommerce-form-login label[for="password"').length > 0 && (passwordFieldSelector = 'label[for="password"]', submitButtonSelector = $mo(".woocommerce-form-login .woocommerce-Button[type='submit']").length ? ".woocommerce-form-login .woocommerce-Button[type='submit']" : ".woocommerce-button[name=login]", usernameSelector = "input#username", buttonText = $mo(submitButtonSelector).val(), $mo('<input type="hidden" id="hidden_current_tab" value="OTP">').insertBefore(submitButtonSelector), $mo(passwordFieldSelector).parent().hide(), $mo(woocommerceLoginButtonHtml).insertAfter(submitButtonSelector), $mo(submitButtonSelector).val(movarlogin.buttontext), $mo('button[name="login"]:eq(0)').html("Login with OTP"), $mo('button[name="login"]:eq(1)').attr("type", "button").html("Login with password").attr("onclick", "toSendOtpBttn()")), movarlogin.byPassAdmin && (moIsAdminCheck(usernameSelector, passwordFieldSelector, submitButtonSelector, buttonText), $mo(usernameSelector).on("keyup", (function() {
            "OTP" == $mo("#hidden_current_tab").val() && moIsAdminCheck(usernameSelector, passwordFieldSelector, submitButtonSelector, buttonText)
        })))
    }
}));