STRATO-apps/wordpress_03/app/wp-content/plugins/blocksy-companion-pro/static/bundle/account.js

SHA-256: e8e4ae69ce0f5127145d37ec8e82ab646ee5a47412a2b0fc8ea733835a01fd03
!function(){"use strict";var e={n:function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,{a:o}),o},d:function(t,o){for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.ctEvents,o=e.n(t),r=window.ctFrontend;var n=function(e,t){let o=function(e){var t=jQuery();return[...e.querySelectorAll("input")].map(function(e){t=t.add(e)}),t}(t);if("object"==typeof grecaptcha)grecaptcha.ready(function(){grecaptcha.execute(WFLSVars.recaptchasitekey,{action:"login"}).then(function(t){var r=jQuery("#wfls-captcha-token");r.length?r.val(t):o.length&&((r=jQuery('<input type="hidden" name="wfls-captcha-token" id="wfls-captcha-token" />')).val(t),o.parent().append(r)),"function"==typeof e&&e(!0)})});else{var r=jQuery("#wfls-captcha-token");r.length?r.val("grecaptcha-missing"):o.length&&((r=jQuery('<input type="hidden" name="wfls-captcha-token" id="wfls-captcha-token" />')).val("grecaptcha-missing"),o.parent().append(r)),"function"==typeof e&&e(!0)}};const c=function(e,t){return!(!window.WPDEF||window.turnstile)&&(function(e,t){"v3_recaptcha"!=WPDEF.options.version?"v2_checkbox"!=WPDEF.options.version&&"v2_invisible"!=WPDEF.options.version||[...t.querySelectorAll('div[id^="wpdef_recaptcha_"]')].forEach(function(t){if(""!==t.innerHTML.trim())return;const o={sitekey:WPDEF.options.sitekey,theme:WPDEF.options.theme,size:WPDEF.options.size,callback:function(){"function"==typeof e&&e(!0)}};grecaptcha.render(t.id,o)}):grecaptcha.ready(function(){grecaptcha.execute(WPDEF.options.siteKey,{action:"WPDEF_reCaptcha"}).then(function(t){document.querySelectorAll(".g-recaptcha-response").forEach(function(e){e.value=t}),"function"==typeof e&&e(!0)})})}(function(){return e()},t),!0)},a=function(e){[...e.querySelectorAll(".g-recaptcha, .anr_captcha_field")].map(function(e){e.classList.contains("anr_captcha_field")?grecaptcha.reset(parseFloat(e.firstElementChild.id.replace("anr_captcha_field_",""))-1):grecaptcha.reset(e.gID)})},i=function(e){return new Promise(function(t){(function(e,t){return!(!window.WFLSVars||!parseInt(WFLSVars.useCAPTCHA)||(n(function(){return e()},t),0))})(t,e)||c(t,e)||t()})};var s=window.jQuery,l=e.n(s);const u=function(e){const t=function(){var t=e.closest("form");!function(e,t){var o=l()(e).find(".woocommerce-password-strength");""===l()(t).val()?(o.hide(),l()(document.body).trigger("wc-password-strength-hide")):0===o.length?(l()(t.nextElementSibling).after('<div class="woocommerce-password-strength" aria-live="polite"></div>'),l()(document.body).trigger("wc-password-strength-added")):(o.show(),l()(document.body).trigger("wc-password-strength-show"))}(t,e);let o=function(e,t){let o=l()(e).find(".woocommerce-password-strength"),r=l()(e).find(".woocommerce-password-hint"),n='<small class="woocommerce-password-hint">'+wc_password_strength_meter_params.i18n_password_hint+"</small>",c=wp.passwordStrength.meter(l()(t).val(),wp.passwordStrength.userInputDisallowedList()),a="";if(o.removeClass("short bad good strong"),r.remove(),o.is(":hidden"))return c;switch(c<wc_password_strength_meter_params.min_password_strength&&(a=" - "+wc_password_strength_meter_params.i18n_password_error),c){case 0:o.addClass("short").html(pwsL10n.short+a),o.after(n);break;case 1:case 2:o.addClass("bad").html(pwsL10n.bad+a),o.after(n);break;case 3:o.addClass("good").html(pwsL10n.good+a);break;case 4:o.addClass("strong").html(pwsL10n.strong+a);break;case 5:o.addClass("short").html(pwsL10n.mismatch)}return c}(t,e),r=l()(t).find('button[name="wp-submit"]');e.value.length>0&&o<wc_password_strength_meter_params.min_password_strength&&-1!==o?r.attr("disabled","disabled").addClass("disabled"):r.prop("disabled",!1).removeClass("disabled")};e.addEventListener("keyup",t),e.addEventListener("change",t)},d=function(e,t){const o=t.querySelector('[name="validate_2fa_form"]');if(!o)return!1;let r="";e.parentNode.querySelector('[name="validate_2fa_form"]')&&(r=e.parentNode.querySelector('[id="authcode"]').value,e.parentNode.querySelector('[name="validate_2fa_form"]').remove()),e.insertAdjacentElement("beforebegin",o),o.querySelector('[id="authcode"]').value=r;let n=o.querySelector('input.authcode[inputmode="numeric"]'),c=(null==n?void 0:n.dataset.digits)||0;if(n){let e=!1;n.addEventListener("input",function(){let t=this.value.replace(/[^0-9 ]/g,"").trimStart();!e&&c&&t.length===Math.floor(c/2)?(t+=" ",e=!0):e&&!this.value&&(e=!1),this.value=t,c&&t.replace(/ /g,"").length==c&&void 0!==o.requestSubmit&&(o.requestSubmit(),o.submit.disabled="disabled")})}return o.addEventListener("submit",function(t){t.preventDefault();let r=new FormData(o);fetch(o.action,{method:o.method,body:r}).then(function(e){return e.text()}).then(function(t){p(e);const{doc:o,hasError:r}=w(e.closest(".ct-login-form"),t);r&&d(e,o),r||setTimeout(function(){location=e.querySelector('[name="redirect_to"]').value},2e3)})}),!0},f=function(e){let t=e.querySelector('[name="loginform"]');t&&t.addEventListener("submit",function(e){if(e.preventDefault(),window.ct_customizer_localizations)return;m(t);let o=new FormData(t);o.append("redirect_to",location.href),t.querySelector('[name="username"]')&&o.append("log",t.querySelector('[name="username"]').value);let r=`${ct_localizations.ajax_url}?action=blc_implement_user_login`;if(window.WFLSVars&&!t.loginProceed)return o.append("action","wordfence_ls_authenticate"),r=WFLSVars.ajaxurl,void i(t).then(function(){fetch(r,{method:t.method,body:o}).then(function(e){return e.json()}).then(function(e){p(t);let o=!!e.error;const r=t.closest(".ct-login-form"),n=t.closest(".ct-login-form").querySelector("form");if(o&&g(r,e.error),e.message&&y(n,e.message),e.login){if(e.two_factor_required){if(!t.querySelector("#wfls-prompt-overlay")){var c=l()('<div id="wfls-prompt-overlay"></div>'),i=l()('<div id="wfls-prompt-wrapper"></div>'),s=l()('<label for="wfls-token">');s.text("Wordfence 2FA Code "),s.append(l()('<a href="javascript:void(0)" class="wfls-2fa-code-help wfls-tooltip-trigger" title="The Wordfence 2FA Code can be found within the authenticator app you used when first activating two-factor authentication. You may also use one of your recovery codes."><i class="dashicons dashicons-editor-help"></i></a>')),s=l()("<p>").append(s);var u=l()('<p><input type="text" name="wfls-token" id="wfls-token" aria-describedby="wfls-token-error" class="input" value="" size="6" autocomplete="one-time-code"/></p>'),d=l()('<p class="wfls-remember-device-wrapper"><label for="wfls-remember-device"><input name="wfls-remember-device" type="checkbox" id="wfls-remember-device" value="1" /> </label></p>');d.find("label").append("Remember for 30 days");var f=l()('<p class="submit"><input type="submit" name="wfls-token-submit" id="wfls-token-submit" class="button button-primary button-large"/></p>');f.find("input[type=submit]").val("Log In"),i.append(s),i.append(u),parseInt(WFLSVars.allowremember)&&i.append(d),i.append(f),c.append(i),l()(n).css("position","relative").append(c),l()("#wfls-token").focus(),new(l().Zebra_Tooltips)(l()(".wfls-tooltip-trigger"))}}else{const e=new FormData(t);e.append("redirect_to",location.href),fetch(`${ct_localizations.ajax_url}?action=blc_implement_user_login`,{method:t.method,body:e}).then(function(e){return e.json()}).then(function({data:{html:e,redirect_to:t}}){location=t})}t.loginProceed=!0}(!o||o&&-1===t.closest(".ct-login-form").querySelector(".ct-form-notification-error").innerHTML.indexOf("Captcha"))&&a(t.closest(".ct-login-form"))})});i(t).then(function(){fetch(r,{method:t.method,body:o}).then(function(e){if(200===e.status)return e.redirected&&e.url?{data:{html:"",redirect_to:e.url}}:e.json();e.text().then(function(e){p(t);const o=function(e,t){const o=e.closest(".ct-login-form");if(!o)return!0;let r=ct_localizations.login_generic_error_msg;if(-1!==t.indexOf("jetpack_protect_process_math_form")){const n=t.match(/<h2.*?>(.*?)<\/h2>/);n&&n.length>1&&(r=n[1]),g(e.closest(".ct-login-form"),r);const c=document.createElement("div");c.innerHTML=t;const a=c.querySelector("form"),i=o.querySelector("#jetpack_protect_answer");if(a){const e=a.querySelector('input[type="submit"], button[type="submit"]');e&&e.remove,i&&i.parentNode.remove();const t=o.querySelector(".login-remember");t&&t.insertAdjacentElement("beforebegin",...a.children)}return!1}if(-1!==t.indexOf("Jetpack")&&-1!==t.indexOf("<strong>")){const o=t.match(/<strong.*?>(.*?)<\/strong>/);return o&&o.length>1&&(r=o[1]),g(e.closest(".ct-login-form"),r),!1}return!0}(t,e);o&&g(t.closest(".ct-login-form"),ct_localizations.login_generic_error_msg)})}).then(function({data:{html:e,redirect_to:o}}){const{doc:r,hasError:n}=w(t.closest(".ct-login-form"),e);n?p(t):d(t,r)||setTimeout(function(){location=o},2e3),(!n||n&&-1===t.closest(".ct-login-form").querySelector(".ct-form-notification-error").innerHTML.indexOf("Captcha"))&&a(t.closest(".ct-login-form"))})})})},m=function(e){const t=e.querySelector('[name*="submit"]');t&&t.classList.add("ct-loading")},p=function(e){const t=e.querySelector('[name*="submit"]');t&&t.classList.remove("ct-loading")},h=function(e,{screen:t="login"}){e.querySelector(`.ct-${t}-form`)||(t="login"),e.querySelector("ul")&&e.querySelector(`ul .ct-${t}`)&&(e.querySelector("ul .active").classList.remove("active"),e.querySelector(`ul .ct-${t}`).classList.add("active")),e.querySelector('[class*="-form"].active').classList.remove("active"),e.querySelector(`.ct-${t}-form`).classList.add("active"),e.querySelector(`.ct-${t}-form form`)&&e.querySelector(`.ct-${t}-form form`).reset(),e.querySelector(".ct-account-modal").classList.remove("ct-error");let o=e.querySelector(`.ct-${t}-form`).querySelector(".ct-form-notification");o&&o.remove();let r=e.querySelector(`.ct-${t}-form`).querySelector(".ct-form-notification-error");r&&r.remove(),function(e){[...e.querySelectorAll(".g-recaptcha, .anr_captcha_field")].map(function(e){e.gID||(e.innerHTML="",e.gID=grecaptcha.render(e))})}(e)};let g=function(e,t){let o=e.querySelector(".ct-form-notification-error");o&&o.remove(),e.closest(".ct-account-modal").classList.remove("ct-error"),t&&(e.insertAdjacentHTML("afterbegin",`<div class="ct-form-notification-error">${t}</div>`),requestAnimationFrame(function(){e.closest(".ct-account-modal").classList.add("ct-error")}))};const w=function(e,t){let o=(new DOMParser).parseFromString(t,"text/html"),r=o.querySelector("#login_error"),n="";return r&&(n=r.innerHTML),g(e,n),{hasError:!!r,doc:o}},y=function(e,t){let o=e.querySelector(".ct-form-notification");o&&o.remove(),e.closest(".ct-account-modal").classList.remove("ct-error"),t&&e.insertAdjacentHTML("afterbegin",`<div class="ct-form-notification">${t}</div>`)},v=function(e,t){let o=(new DOMParser).parseFromString(t,"text/html"),r=o.querySelector(".message"),n="";return r&&(n=r.innerHTML),y(e,n),{doc:o}};let _="";const b={login:".ct-account-modal #loginform .cf-turnstile",lostpassword:".ct-account-modal #lostpasswordform .cf-turnstile",register:".ct-account-modal #registerform .cf-turnstile"},S=function(){window.anr_onloadCallback&&window.anr_onloadCallback(),window.turnstile&&Object.keys(b).forEach(function(e){document.querySelector(b[e])&&turnstile.render(b[e])}),function(){if(!window.google||!google.accounts||!google.accounts.id)return;const e=document.querySelectorAll(".googlesitekit-sign-in-with-google__frontend-output-button");e.length&&e.forEach(function(e){const t=e.closest("form").querySelector(".login-submit");t&&t.insertAdjacentElement("afterend",e),google.accounts.id.renderButton(e,{})})}(),window.Dokan_Vendor_Registration&&window.Dokan_Vendor_Registration.init()};(0,r.registerDynamicChunk)("blocksy_account",{mount:function(e,{event:t}){if(document.body.dataset.panel)return;if(!_){let t=document.querySelector("#ct-account-modal-template");if(!t)return void(location=document.querySelector('[data-id="account"] .ct-account-item')?document.querySelector('[data-id="account"] .ct-account-item').href:e.href);const o=document.createElement("div"),r=t.content.cloneNode(!0);o.insertAdjacentHTML("beforeend",r.firstElementChild.outerHTML),_=o.firstChild.outerHTML,window.turnstile&&Object.keys(b).forEach(function(e){document.querySelector(b[e])&&(turnstile.remove(b[e]),"register"===e&&turnstile.remove(".ct-account-modal #registerform .sct-woocommerce-register"))}),t.remove()}let r=document.querySelector("#account-modal");r||(document.querySelector(".ct-drawer-canvas").insertAdjacentHTML("beforeend",_),r=document.querySelector(".ct-drawer-canvas").lastChild);!function(e){if(!e)return;if(e.hasListeners)return;e.hasListeners=!0,f(e);let t=e.querySelector('[name="loginform"]'),r=e.querySelector('[name="registerform"]'),n=e.querySelector('[name="lostpasswordform"]');if(e.addEventListener("click",function(o){o.target.href&&o.target.href.indexOf("lostpassword")>-1&&(h(e,{screen:"forgot-password"}),o.preventDefault()),o.target.href&&o.target.classList.contains("showlogin")&&(h(e,{screen:"login"}),o.preventDefault()),o.target.href&&(o.target.href.indexOf("wp-login")>-1||t&&o.target.href===t.action||o.target.href.indexOf("login")>-1||"yes"===o.target.dataset.login)&&-1===o.target.href.indexOf("lostpassword")&&(h(e,{screen:"login"}),o.preventDefault())},!0),e.querySelectorAll(".show-password-input + .show-password-input")&&e.querySelectorAll(".show-password-input + .show-password-input").forEach(function(e){e.remove()}),[...e.querySelectorAll(".show-password-input")].map(function(e){e.addEventListener("click",function(t){e.previousElementSibling.type="password"===e.previousElementSibling.type?"text":"password"})}),r){r.addEventListener("submit",function(e){e.preventDefault(),window.ct_customizer_localizations||(m(r),i(r).then(function(){return fetch(`${ct_localizations.ajax_url}?action=blc_implement_user_registration`,{method:r.method,body:new FormData(r)}).then(function(e){return e.text()}).then(function(e){const{doc:t,hasError:n}=w(r.closest(".ct-register-form"),e);p(r),n||v(r.closest(".ct-register-form"),e),o().trigger("blocksy:account:register:"+(n?"error":"success")),n||r.querySelector('[name="redirect_to"]')&&r.querySelector('[name="role"][value="seller"]:checked')&&(location=r.querySelector('[name="redirect_to"]').value),(!n||n&&-1===r.closest(".ct-register-form").querySelector(".ct-form-notification-error").innerHTML.indexOf("Captcha"))&&a(r.closest(".ct-register-form"))})}))});let e=r.querySelector("#user_pass_register");e&&u(e)}n&&n.addEventListener("submit",function(e){e.preventDefault(),window.ct_customizer_localizations||(m(n),fetch(`${ct_localizations.ajax_url}?action=blc_implement_user_lostpassword`,{method:n.method,body:new FormData(n)}).then(function(e){return e.text()}).then(function(e){const{doc:t,hasError:o}=w(n.closest(".ct-forgot-password-form"),e);p(n),o||v(n.closest(".ct-forgot-password-form"),e),(!o||o&&-1===n.closest(".ct-forgot-password-form").querySelector(".ct-form-notification-error").innerHTML.indexOf("Captcha"))&&a(n.closest(".ct-forgot-password-form"))}))}),["login","register","forgot-password"].map(function(t){Array.from(e.querySelectorAll(`.ct-${t}`)).map(function(o){o.addEventListener("click",function(o){o.preventDefault(),h(e,{screen:t})}),o.addEventListener("keyup",function(o){13===o.keyCode&&(o.preventDefault(),h(e,{screen:t}))})})})}(r),h(r,{screen:e.dataset.view||"login"}),S(),o().trigger("ct:overlay:handle-click",{e:t,href:"#account-modal",options:{isModal:!0,computeScrollContainer:function(){if(r.closest("body"))return r.querySelector(".ct-account-forms")}}})}}),o().on("ct:modal:closed",function(e){e.closest("#account-modal")&&e.remove()})}();