!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(' ')).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(' ')).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('
'),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=''+wc_password_strength_meter_params.i18n_password_hint+" ",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(c0&&o'),i=l()('
'),s=l()('');s.text("Wordfence 2FA Code "),s.append(l()(' ')),s=l()("").append(s);var u=l()('
'),d=l()('
');d.find("label").append("Remember for 30 days");var f=l()('
');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>/);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("")){const o=t.match(/(.*?)<\/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",`${t}
`),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",`${t}
`)},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()})}();