1import{a as l}from"./calls.mCs5so1O.js";import{F as m}from"./validation-api.BLsfURn-.js";import"./index.DhXgJQ-f.js";const E=()=>{const a=function(t){this.form=t,this.container=document.querySelector(".newsletter-block"),this.submitButton=t.querySelector(".btn-loading"),this.input=t.querySelector('input[type="email"]'),this.loadingState=t.dataset.submitLoading,this.successAlert=document.getElementById("newsletter-success"),this.formErrorId="form-error",this.formError=document.getElementById(this.formErrorId),this.turnstileToken=null,!(!this.form||!this.container)&&(e(this),d(this))},e=t=>{const o=document.getElementById("newsletter-turnstile");if(!o)return;t.submitButton.disabled=!0;const i=()=>{turnstile.render("#newsletter-turnstile",{sitekey:o.dataset.sitekey,callback:function(c){t.turnstileToken=c,t.submitButton.disabled=!1},"error-callback":function(){t.turnstileToken=null,t.submitButton.disabled=!0},"expired-callback":function(){t.submitButton.disabled=!0}})};turnstile.ready(i)},d=t=>{new m(t.form,{showErrorBox:!1,disableSubmit:!0}),t.form.addEventListener("validationFormValid",function(o){if(console.log("form EventListener validationFormValid",o),t.loadingState&&t.submitButton.classList.add("is-loading"),t.formError.classList.add("hidden"),t.input.classList.remove("error"),t.input.removeAttribute("aria-describedby"),!t.turnstileToken){s(t,null,"Please confirm you are not a robot."),t.loadingState&&r(t);return}l(t.input.value,t.turnstileToken).then(({status:i})=>{u(t),t.loadingState&&r(t)}).catch(i=>{s(t,i.response.status,i.response?.data?.error?.message||""),t.loadingState&&r(t)})},!1),t.form.addEventListener("validationFormInvalid",function(o){console.log("form EventListener validationFormInvalid",o),t.formError.classList.add("hidden")},!1)},r=t=>{t.submitButton.classList.remove("is-loading")},u=t=>{t.form.classList.add("hidden"),t.successAlert.classList.remove("hidden")},s=(t,o,i)=>{t.input.classList.add("error"),t.input.removeAttribute("aria-describedby"),t.formError.classList.add("hidden"),i?t.formError.textContent=i:t.formError.textContent="Something went wrong. Please try again later.",t.formError.classList.remove("hidden"),t.input.setAttribute("aria-describedby",t.formErrorId)};var n=document.getElementById("newsletter-signup-form");n&&new a(n)};export{E as default}; 2//# sourceMappingURL=newsletter-signup.CvqWWg-z.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.