import{a as x,d as f,g as h}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-LXBIOR2L.js";import{$ as n,g as c,k as u}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-SPLCWT2Q.js";import{a as p}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-KO3756JP.js";import{e as i}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-RUFYZOTV.js";import{a as d}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-MEFRPCES.js";import{a as m}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-722DUSLT.js";import{a as B}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-7MZ5ZFIB.js";import{d as o}from"https://cdn.shopify.com/oxygen-v2/26324/10616/21935/1653405/build/_shared/chunk-SFLZO754.js";var t=o(B());var e=o(m()),j=h().shape({email:f().email("Invalid email format").required("Email field is required")}),J=(0,t.memo)(()=>{let[w,s]=(0,t.useState)(!1),{values:g,handleBlur:b,handleChange:v,errors:r,touched:N,submitForm:y,...k}=x({initialValues:{email:""},validationSchema:j,onSubmit:(a,{resetForm:S})=>{if(k.isValid){let E={method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({email:a.email})};(async()=>{let l=await(await fetch("/api/subscription",E)).json();if(l?.email&&l.status===202){i("You have successfully subscribed for updates","info");return}i("Something wend wrong. Please, try again","error")})(),S()}}});return(0,t.useEffect)(()=>{let a=u(()=>{if(window.outerWidth>768){s(!0);return}s(!1)},400);return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),(0,e.jsxs)("section",{className:"screen-content-container rounded-0 relative h-[412px] !max-w-[1280px] overflow-hidden text-center lg:mx-auto lg:h-[358px] xl:rounded-lg",children:[(0,e.jsx)(c,{width:1280,height:412,className:"absolute h-[412px] w-full object-cover lg:h-[358px]",src:w?n.newsletter:n.newsletterBgModile,alt:"newsletter background"}),(0,e.jsxs)("div",{className:"color-white z-10 mx-auto mt-[105px] max-w-[1320px] md:my-auto",children:[(0,e.jsx)("h4",{className:"mx-auto mb-2 max-w-[260px] text-[32px] font-bold !leading-[120%] tracking-[-0.96px] md:!leading-[130%] md:tracking-normal lg:text-lg lg:font-medium",children:"Join Our Newsletter"}),(0,e.jsx)("p",{className:"mb-10 text-[18px] font-[400] tracking-normal md:tracking-[-1.44px] lg:mb-6 lg:text-5xl lg:font-bold",children:"Exclusive discounts & promotions."}),(0,e.jsxs)("div",{className:"relative mx-auto mb-4 flex w-[343px] flex-row md:w-[406px]",children:[(0,e.jsx)("input",{type:"text",name:"email",value:g.email,onChange:v,onBlur:b,className:"h-[48px] w-full rounded-full px-5 py-3 pr-[142px] text-black placeholder:font-[600] placeholder:text-black",placeholder:"Email address"}),(0,e.jsx)(p.Primary,{name:"submit",className:"newsletter-button text-base absolute h-[48px] !w-[141px] whitespace-nowrap rounded-full bg-[#FE522A] px-5 py-3 font-[600] leading-[24px] text-white",onClick:y,children:"Sign up"})]}),r.email&&N.email&&(0,e.jsx)("div",{className:d("h-[21px] pb-1 text-red"),children:r.email}),(0,e.jsx)("p",{className:"text-base hidden font-medium leading-[130%] opacity-60 lg:block",children:"No spam, unsubscribe anytime."})]})]})});export{J as a};