1import{n as e,t}from"./recaptcha.CPIB_VEf.js";async function n(){try{await e();let n=document.getElementById(`newsletterForm`),r=document.getElementById(`newsletterSuccessMessage`),i=document.getElementById(`newsletterFormContainer`),a=document.getElementById(`newsletterFormHeader`);if(!n||!r||!i||!a)throw console.error(`Required elements not found`),Error(`Required elements not found`);let o=n.querySelector(`button[type="submit"]`);if(!o)throw console.error(`Submit button not found`),Error(`Submit button not found`);let s=e=>{let t=n.querySelector(`#${e}`);if(!t)throw Error(`Element with id ${e} not found`);return t};n.addEventListener(`submit`,async e=>{e.preventDefault(),o.disabled=!0;let n=o.querySelector(`.button__text--original`),c=o.querySelector(`.button__text--clone`);n&&c&&(n.textContent=`Subscribing...`,c.textContent=`Subscribing...`);try{let e=await t(`newsletter_signup`);if(!e)throw Error(`reCAPTCHA verification failed`);let n={formType:`newsletter`,firstName:s(`firstName`).value,lastName:s(`lastName`).value,email:s(`email`).value,location:s(`location`).value,consent:s(`consent`).checked,mailingList:!0,recaptchaResponse:e},o=await fetch(`https://content.cosyclub.co.uk/wp-json/custom/v1/send-newsletter`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}),c=await o.json();if(o.ok||c.message===`Newsletter signup successful`)i.classList.add(`hidden`),a.classList.add(`hidden`),r.classList.remove(`hidden`);else throw Error(c.message||`HTTP error! status: ${o.status}`)}catch(e){e instanceof Error?alert(`Error: ${e.message}`):alert(`Sorry, there was an error signing up for the newsletter. Please try again later.`)}finally{o.disabled=!1,n&&c&&(n.textContent=`Subscribe`,c.textContent=`Subscribe`)}})}catch(e){console.error(`Error setting up form:`,e)}}n();
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.