import{g as w,aT as _,h as k,r as o,o as m,c as u,a as s,s as y,am as S,an as C,j as r,I as E,q as M,t as d,x as p,bK as T,a7 as B}from"./DgR3D_w1.js";const U={class:"bg-gray-200 pt-22 sm:pt-41 pb-26 sm:pb-20"},q={class:"container"},A=s("strong",{class:"block text-f14 sm:text-f22 leading-a35 font-medium text-center mb-12 sm:mb-39"}," Subscribe to get notified when we’ve added new resources. ",-1),D={class:"flex flex-wrap items-center max-w-686 mx-auto mb-10 sm:mb-34"},I={class:"flex-1 pr-7 sm:pr-15"},N={class:"sm:min-h-29"},V={key:0,class:"success-message text-center block text-green-100 text-f14 sm:text-f22 leading-a35 font-bold"},R={key:1,class:"error-message text-center block text-red-100 text-f14 sm:text-f22 leading-a35 font-bold"},$="Email Address",j="Subscribe",z="Thanks for subscribing!",L=w({__name:"index",setup(F){const b=T(),f=_(),g=k(()=>`${b.public.baseApiEnpoint}/api/marketing/blog-subscriptions`),x=()=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@(([^<>()[\]\\.,;:\s@"]+\.)+[^<>()[\]\\.,;:\s@"]{2,})$/i.test(String(t.value).toLowerCase()),n=o("Something went wrong. Please try again."),t=o(""),a=o(!1),i=o(!1),l=o(!1),v=()=>{if(a.value=!1,i.value=!1,n.value="",!x()){l.value=!0,a.value=!1;return}l.value=!1;const c={email:t.value,pageUrl:window.location.href,abandonedCartId:f.abandonedCartId};B.post(g.value,c).then(e=>{a.value=!0,t.value=""}).catch(e=>{console.error("There was a problem with your submission:",e),e.response&&e.response.data?n.value=e.response.data.message||"Unknown error occurred":n.value=e.message||"Unknown error occurred",i.value=!0,a.value=!1})};return(c,e)=>(m(),u("div",U,[s("div",q,[A,s("form",{onSubmit:y(v,["prevent"]),id:"form-newsletter",class:"subscribe-form"},[s("div",D,[s("div",I,[S(s("input",{"onUpdate:modelValue":e[0]||(e[0]=h=>E(t)?t.value=h:null),required:"",name:"email",id:"email-inputter",class:M(["w-full rounded-40 placeholder-gray-100a50 text-base sm:text-f22 font-medium px-37 sm:px-41 pt-8 sm:pt-14 pb-9 sm:pb-18 border-2 border-gray-100",{"border-red-100 border-2 error":r(l)}]),type:"email",placeholder:$},null,2),[[C,r(t)]])]),s("input",{type:"submit",class:"btn bg-[#004B2C] text-f14 sm:text-f22 min-w-80 w-120 sm:w-242 sm:px-40 sm:pt-13 sm:pb-16",value:j})]),s("div",N,[r(a)?(m(),u("strong",V,d(z))):p("",!0),r(i)?(m(),u("strong",R,d(r(n)),1)):p("",!0)])],32)])]))}});export{L as _};