document.addEventListener("DOMContentLoaded",function(){const n=document.querySelector(".menu-toggle"),i=document.querySelector(".main-nav");n&&i&&n.addEventListener("click",function(){document.body.classList.toggle("mobile-nav-active")});const e=document.getElementById("waitlist-modal"),s=document.getElementById("hero-waitlist-btn"),o=e?e.querySelector(".modal-close"):null,a=()=>{e&&(e.style.display="flex",setTimeout(()=>{e.classList.add("active")},10))},t=()=>{e&&(e.classList.remove("active"),e.style.display="none")};s&&s.addEventListener("click",e=>{e.preventDefault(),a()}),o&&o.addEventListener("click",t),e&&(e.addEventListener("click",n=>{n.target===e&&t()}),document.addEventListener("keydown",n=>{n.key==="Escape"&&e.classList.contains("active")&&t()}));const r=(e,t)=>{e.preventDefault();const s=e.target,o=s.parentElement,n=s.querySelector('button[type="submit"]'),i=n.textContent;n.textContent="Submitting...",n.disabled=!0;const a=new FormData(s);fetch("/submit",{method:"POST",body:a}).then(e=>{if(!e.ok)throw new Error("Network response was not ok.");return e.json()}).then(e=>{console.log("Success:",e),o.innerHTML=t}).catch(e=>{console.error("Error:",e),n.textContent="Submission Failed",setTimeout(()=>{n.textContent=i,n.disabled=!1},3e3)})},c=[{id:"modal-waitlist-form",success:`
You've been added to the waitlist. We'll be in touch soon.
Thank you for reaching out. We'll get back to you as soon as possible.
Thank you! We'll notify you when the paper is published.
Your request for early access has been received. Our team will review it and be in touch.
Thank you for subscribing!
You've been added to the waitlist. We'll be in touch soon.