; ; (()=>{var e=null,o=document.getElementById("wp-block-gamurs-auth-login-form");window.GAMURS_wordpress_blocks=window.GAMURS_wordpress_blocks||{},window.GAMURS_wordpress_blocks.auth=window.GAMURS_wordpress_blocks.auth||{},window.GAMURS_wordpress_blocks.auth.ui=window.GAMURS_wordpress_blocks.auth.ui||{},window.GAMURS_wordpress_blocks.auth.ui.login=window.GAMURS_wordpress_blocks.auth.ui.login||{},window.GAMURS_wordpress_blocks.auth.ui.login.resetState=function(){o.style.display="flex",o.querySelector('input[name="email"]').value="",o.querySelector('input[name="password"]').value="",Array.from(o.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(o.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")})),Array.from(o.parentElement.querySelectorAll(".wp-block-gamurs-auth-login__message")).forEach((function(e){e.style.display="none"}))},o.addEventListener("submit",(function(t){t.preventDefault(),window.clearTimeout(e),e=window.setTimeout((async function(){document.getElementById("wp-block-gamurs-auth-login-generic-error").style.display="none",Array.from(o.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(o.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")}));var e=o.querySelector('button[type="submit"]');if(e&&(e.disabled=!0),window.GAMURS_wordpress_blocks.auth.firebase&&window.GAMURS_wordpress_blocks.auth.firebase.auth){const s=new FormData(t.target),r=s.get("email"),l=s.get("password");try{const e=await window.GAMURS_wordpress_blocks.auth.firebase.auth.signInWithEmailAndPassword(r,l);console.log("logged in",e),window.snowplow&&window.snowplow("setUserId",e.uid),o.querySelector('label:has(input[name="email"])').value="",o.querySelector('label:has(input[name="password"])').value=""}catch(t){var a=document.createElement("span");switch(a.classList.add("wp-block-gamurs-input__helper"),a.classList.add("added"),t.code){case"auth/invalid-email":a.innerText="Invalid email address",o.querySelector('label:has(input[name="email"])').classList.remove("is-enabled-state"),o.querySelector('label:has(input[name="email"])').classList.add("is-error-state"),o.querySelector('label:has(input[name="email"])').appendChild(a);break;case"auth/missing-password":a.innerText="No password provided",o.querySelector('label:has(input[name="password"])').classList.remove("is-enabled-state"),o.querySelector('label:has(input[name="password"])').classList.add("is-error-state"),o.querySelector('label:has(input[name="password"])').appendChild(a);break;case"auth/invalid-credential":document.getElementById("wp-block-gamurs-auth-login-details-error").style.display="block";break;default:document.getElementById("wp-block-gamurs-auth-login-generic-error").style.display="block"}e&&(e.disabled=!1)}}}),200)}));var t=document.querySelector('#wp-block-gamurs-auth-login-form .wp-block-gamurs-icon[class*="icon-visibility"]'),a=document.querySelector('#wp-block-gamurs-auth-login-form input[name="password"]');t&&a&&t.addEventListener("click",(function(e){e.preventDefault(),window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Password Visibility Toggled",label:e.currentTarget.classList.contains("icon-visibility-on")?"Off":"On"}),e.currentTarget.classList.toggle("icon-visibility-off"),e.currentTarget.classList.toggle("icon-visibility-on"),a.type="password"===a.type?"text":"password"}));var s=document.getElementById("wp-block-gamurs-auth-login-forgot-password");s&&s.addEventListener("click",(function(e){e.preventDefault(),window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Forgot Password Clicked"}),window.GAMURS_wordpress_blocks.auth.ui.goToForgot()}));var r=document.getElementById("wp-block-gamurs-auth-login-dont-have-an-account");r&&r.addEventListener("click",(function(e){e.preventDefault(),window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Switch to Signup Screen Clicked"}),window.GAMURS_wordpress_blocks.auth.ui.goToSignup()}))})();; (()=>{var e=document.getElementById("wp-block-gamurs-auth-signup-create"),s=document.getElementById("wp-block-gamurs-auth-signup-usernameonly"),a=document.getElementById("wp-block-gamurs-auth-signup-emailpreferences"),t=document.getElementById("wp-block-gamurs-auth-signup-confirm"),r=document.getElementById("wp-block-gamurs-auth-signup-form"),n=document.getElementById("wp-block-gamurs-auth-signup-usernameonly-form"),o=document.getElementById("wp-block-gamurs-auth-signup-emailpreferences-form");window.GAMURS_wordpress_blocks=window.GAMURS_wordpress_blocks||{},window.GAMURS_wordpress_blocks.auth=window.GAMURS_wordpress_blocks.auth||{},window.GAMURS_wordpress_blocks.auth.ui=window.GAMURS_wordpress_blocks.auth.ui||{},window.GAMURS_wordpress_blocks.auth.ui.signup=window.GAMURS_wordpress_blocks.auth.ui.signup||{},window.GAMURS_wordpress_blocks.auth.ui.signup.resetState=function(){r.style.display="flex",r.querySelector('input[name="username"]').value="",r.querySelector('input[name="email"]').value="",r.querySelector('input[name="password"]').value="",r.querySelector('button[type="submit"]').disabled=!1,Array.from(r.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(r.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")})),Array.from(r.parentElement.querySelectorAll(".wp-block-gamurs-auth-signup_message")).forEach((function(e){e.style.display="none"})),n.querySelector('input[name="username"]').value="",Array.from(n.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper")).forEach((function(e){e.remove()})),Array.from(n.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")})),Array.from(n.parentElement.querySelectorAll(".wp-block-gamurs-auth-signup_message")).forEach((function(e){e.style.display="none"})),e.classList.add("is-visible"),s.classList.remove("is-visible"),a.classList.remove("is-visible"),t.classList.remove("is-visible")};var i=function(){e.classList.remove("is-visible"),t.classList.remove("is-visible"),a.classList.remove("is-visible"),s.classList.add("is-visible")};window.GAMURS_wordpress_blocks.auth.ui.signup.goToUsernameOnly=i;var l=function(){e.classList.remove("is-visible"),t.classList.remove("is-visible"),s.classList.remove("is-visible"),a.classList.add("is-visible")};window.GAMURS_wordpress_blocks.auth.ui.signup.goToEmailPreferences=l;var u=function(){e.classList.remove("is-visible"),s.classList.remove("is-visible"),a.classList.remove("is-visible"),t.classList.add("is-visible")};window.GAMURS_wordpress_blocks.auth.ui.signup.goToConfirm=u;var c=null;r.addEventListener("submit",(async function(e){e.preventDefault(),window.clearTimeout(c),c=window.setTimeout((async function(){Array.from(r.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(r.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")})),document.getElementById("wp-block-gamurs-auth-signup-generic-error").style.display="none";var s=r.querySelector('button[type="submit"]');if(s&&(s.disabled=!0),window.GAMURS_wordpress_blocks.auth.firebase&&window.GAMURS_wordpress_blocks.auth.firebase.auth&&window.GAMURS_wordpress_blocks.auth.firebase.functions){const i=new FormData(e.target),u=i.get("username"),c=i.get("email"),d=i.get("password");try{var a=window.GAMURS_wordpress_blocks.auth.firebase.functions.httpsCallable("usernameValidityCheck");await a({username:u});try{if(window.GAMURS_wordpress_blocks.auth.isSigningUp=!0,await window.GAMURS_wordpress_blocks.auth.firebase.auth.createUserWithEmailAndPassword(c,d),window.GAMURS_wordpress_blocks.auth.firebase.auth.currentUser){var t=window.GAMURS_wordpress_blocks.auth.firebase.auth.currentUser,n=window.GAMURS_wordpress_blocks.auth.firebase.functions.httpsCallable("usernameSave");try{await n({username:u}),window.GAMURS_wordpress_blocks.auth.openweb.startSSO&&window.GAMURS_wordpress_blocks.auth.openweb.startSSO(),t.sendEmailVerification(),window.snowplow&&(window.snowplow("setUserId",t.uid),window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Signed Up with Email"}))}catch(e){throw await t.delete(),e}finally{s&&(s.disabled=!1)}}r.querySelector('label:has(input[name="username"])').value="",r.querySelector('label:has(input[name="email"])').value="",r.querySelector('label:has(input[name="password"])').value="",l()}catch(e){switch((o=document.createElement("span")).classList.add("wp-block-gamurs-input__helper"),o.classList.add("added"),e.code){case"functions/invalid-argument":o.innerText=e.message,r.querySelector('label:has(input[name="username"])').classList.remove("is-enabled-state"),r.querySelector('label:has(input[name="username"])').classList.add("is-error-state"),r.querySelector('label:has(input[name="username"])').appendChild(o);break;case"auth/email-already-in-use":document.getElementById("wp-block-gamurs-auth-login-form").querySelector('input[name*="email"]').value=c,window.GAMURS_wordpress_blocks.auth.ui.goToLogin();break;case"auth/invalid-email":o.innerText="Invalid email address",r.querySelector('label:has(input[name="email"])').classList.remove("is-enabled-state"),r.querySelector('label:has(input[name="email"])').classList.add("is-error-state"),r.querySelector('label:has(input[name="email"])').appendChild(o);break;case"auth/weak-password":o.innerText="Password is too weak",r.querySelector('label:has(input[name="password"])').classList.remove("is-enabled-state"),r.querySelector('label:has(input[name="password"])').classList.add("is-error-state"),r.querySelector('label:has(input[name="password"])').appendChild(o);break;default:document.getElementById("wp-block-gamurs-auth-signup-generic-error").style.display="block"}}finally{s&&(s.disabled=!1)}}catch(e){var o;(o=document.createElement("span")).classList.add("wp-block-gamurs-input__helper"),o.classList.add("added"),o.innerText=e.message,r.querySelector('label:has(input[name="username"])').classList.remove("is-enabled-state"),r.querySelector('label:has(input[name="username"])').classList.add("is-error-state"),r.querySelector('label:has(input[name="username"])').appendChild(o)}finally{s&&(s.disabled=!1)}}}),200)}));var d=null;n.addEventListener("submit",(async function(e){e.preventDefault(),window.clearTimeout(d),d=window.setTimeout((async function(){document.getElementById("wp-block-gamurs-auth-signup-usernameonly-generic-error").style.display="none",Array.from(n.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(n.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")}));var a=n.querySelector('button[type="submit"]');if(a&&(a.disabled=!0),window.GAMURS_wordpress_blocks.auth.firebase&&window.GAMURS_wordpress_blocks.auth.firebase.auth&&window.GAMURS_wordpress_blocks.auth.firebase.functions){const o=new FormData(e.target).get("username");if(window.GAMURS_wordpress_blocks.auth.firebase.auth.currentUser){var t=window.GAMURS_wordpress_blocks.auth.firebase.functions.httpsCallable("usernameSave");try{await t({username:o}),window.GAMURS_wordpress_blocks.auth.openweb.startSSO&&window.GAMURS_wordpress_blocks.auth.openweb.startSSO(),window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Set Username"}),n.querySelector('label:has(input[name="username"])').value="",s.classList.remove("is-visible"),window.GAMURS_wordpress_blocks.auth.onboardingStatus.emailPreferences?window.GAMURS_wordpress_blocks.auth.ui.close():l()}catch(e){var r=document.createElement("span");r.classList.add("wp-block-gamurs-input__helper"),r.classList.add("added"),"functions/invalid-argument"===e.code?(r.innerText=e.message,n.querySelector('label:has(input[name="username"])').classList.remove("is-enabled-state"),n.querySelector('label:has(input[name="username"])').classList.add("is-error-state"),n.querySelector('label:has(input[name="username"])').appendChild(r)):document.getElementById("wp-block-gamurs-auth-signup-usernameonly-generic-error").style.display="block"}finally{a&&(a.disabled=!1)}}}}),200)}));var w=null;o.addEventListener("submit",(async function(e){e.preventDefault(),window.clearTimeout(w),w=window.setTimeout((async function(){document.getElementById("wp-block-gamurs-auth-signup-usernameonly-generic-error").style.display="none",Array.from(o.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(o.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")}));var s=o.querySelector('button[type="submit"]');if(s&&(s.disabled=!0),window.GAMURS_wordpress_blocks.auth.firebase&&window.GAMURS_wordpress_blocks.auth.firebase.auth&&window.GAMURS_wordpress_blocks.auth.firebase.functions){const t=new FormData(e.target),r="on"===t.get("publicationFlagshipNewsletterConsent"),n="on"===t.get("publicationMarketingConsent"),l="on"===t.get("networkMarketingConsent");if(window.GAMURS_wordpress_blocks.auth.firebase.auth.currentUser)try{var a=window.GAMURS_wordpress_blocks.auth.firebase.functions.httpsCallable("saveEmailPreferences");await a({site:window.GAMURS_wordpress_blocks.auth.site,flagshipNewsletter:r,publicationMarketing:n,networkMarketing:l}),o.querySelector('input[name="publicationFlagshipNewsletterConsent"]')&&(o.querySelector('input[name="publicationFlagshipNewsletterConsent"]').checked=!1),o.querySelector('input[name="publicationMarketingConsent"]')&&(o.querySelector('input[name="publicationMarketingConsent"]').checked=!1),o.querySelector('input[name="publicationMarketingConsent"]')&&(o.querySelector('input[name="networkMarketingConsent"]').checked=!1),window.GAMURS_wordpress_blocks.auth.isSigningUp?u():window.GAMURS_wordpress_blocks.auth.onboardingStatus.username?window.GAMURS_wordpress_blocks.auth.ui.close():i()}catch(e){document.getElementById("wp-block-gamurs-auth-signup-emailpreferences-generic-error").style.display="block"}finally{s&&(s.disabled=!1)}}}),200)}));var p=document.querySelector('#wp-block-gamurs-auth-signup-form .wp-block-gamurs-icon[class*="icon-visibility"]'),m=document.querySelector('#wp-block-gamurs-auth-signup-form input[name="password"]');p&&m&&p.addEventListener("click",(function(e){e.preventDefault(),e.currentTarget.classList.toggle("icon-visibility-off"),e.currentTarget.classList.toggle("icon-visibility-on"),m.type="password"===m.type?"text":"password"}));var b=document.getElementById("wp-block-gamurs-auth-signup-already-have-an-account");b&&b.addEventListener("click",(function(e){e.preventDefault(),window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Switch to Login Screen Clicked"}),window.GAMURS_wordpress_blocks.auth.ui.goToLogin()}));var h=document.getElementById("wp-block-gamurs-auth-signup-got-it");h&&h.addEventListener("click",(function(e){e.preventDefault(),window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Close Signup Screen Clicked"}),window.GAMURS_wordpress_blocks.auth.ui.goToLogin(),window.GAMURS_wordpress_blocks.auth.ui.close()}));var g=document.getElementById("wp-block-gamurs-auth-signup-resend-email");g&&g.addEventListener("click",(function(e){e.preventDefault(),window.GAMURS_wordpress_blocks.auth.firebase.auth.currentUser&&(window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Resend Email Verification Clicked"}),window.GAMURS_wordpress_blocks.auth.firebase.auth.currentUser.sendEmailVerification(),g.disabled=!0,g.innerText="Email sent",setTimeout((function(){g.disabled=!1}),5e3))}))})();; (()=>{var e=null,t=document.getElementById("wp-block-gamurs-auth-forgot-form"),o=function(){t.style.display="flex",t.querySelector('input[name="email"]').value="",Array.from(t.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(t.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")})),Array.from(t.parentElement.querySelectorAll(".wp-block-gamurs-auth-forgot__message")).forEach((function(e){e.style.display="none"})),t.parentElement.querySelector("#wp-block-gamurs-auth-forgot-go-to-login").style.display="none"};window.GAMURS_wordpress_blocks=window.GAMURS_wordpress_blocks||{},window.GAMURS_wordpress_blocks.auth=window.GAMURS_wordpress_blocks.auth||{},window.GAMURS_wordpress_blocks.auth.ui=window.GAMURS_wordpress_blocks.auth.ui||{},window.GAMURS_wordpress_blocks.auth.ui.forgot=window.GAMURS_wordpress_blocks.auth.ui.forgot||{},window.GAMURS_wordpress_blocks.auth.ui.forgot.resetState=o,t.addEventListener("submit",(async function(o){o.preventDefault(),window.clearTimeout(e),e=window.setTimeout((async function(){if(document.getElementById("wp-block-gamurs-auth-forgot-generic-error").style.display="none",Array.from(t.querySelectorAll("label.is-error-state .wp-block-gamurs-input__helper.added")).forEach((function(e){e.remove()})),Array.from(t.querySelectorAll("label")).forEach((function(e){e.classList.remove("is-error-state"),e.classList.add("is-enabled-state")})),window.GAMURS_wordpress_blocks.auth.firebase&&window.GAMURS_wordpress_blocks.auth.firebase.auth){const a=new FormData(o.target).get("email");try{await window.GAMURS_wordpress_blocks.auth.firebase.auth.sendPasswordResetEmail(a),t.style.display="none",t.querySelector('input[name="email"]').value="",document.getElementById("wp-block-gamurs-auth-forgot-success").style.display="block",t.parentElement.querySelector("#wp-block-gamurs-auth-forgot-go-to-login").style.display="block",window.snowplow&&window.snowplow("trackStructEvent",{category:"GAMURS Account",action:"Password Reset Requested"})}catch(o){var e=document.createElement("span");switch(e.classList.add("wp-block-gamurs-input__helper"),e.classList.add("added"),o.code){case"auth/invalid-email":e.innerText="Invalid email address",t.querySelector('label:has(input[name="email"])').classList.remove("is-enabled-state"),t.querySelector('label:has(input[name="email"])').classList.add("is-error-state"),t.querySelector('label:has(input[name="email"])').appendChild(e);break;case"auth/missing-email":e.innerText="No email provided",t.querySelector('label:has(input[name="email"])').classList.remove("is-enabled-state"),t.querySelector('label:has(input[name="email"])').classList.add("is-error-state"),t.querySelector('label:has(input[name="email"])').appendChild(e);break;default:document.getElementById("wp-block-gamurs-auth-forgot-generic-error").style.display="block"}}}}),200)}));var a=document.getElementById("wp-block-gamurs-auth-forgot-back");a&&a.addEventListener("click",(function(e){e.preventDefault(),o(),window.GAMURS_wordpress_blocks.auth.ui.goToLogin()}));var r=document.getElementById("wp-block-gamurs-auth-forgot-go-to-login");r&&r.addEventListener("click",(function(e){e.preventDefault(),o(),window.GAMURS_wordpress_blocks.auth.ui.goToLogin()}))})();;