import{r as s,cf as P,j as e,a0 as d,cF as t,cG as U,cg as z,aa as B,cH as K,cI as W,ax as H,cJ as J,cK as $,cL as q,a6 as Q}from"./index-C_wxwc3T.js";function X({city:o,headline:N="Check your date in 30 seconds",sub:w="Enter your date, time and group size. We check real availability and email you the answer in seconds.",variant:r="modal"}){var j;const c=r==="inline",E=!!o,[v,D]=s.useState(o),a=o??v,[m,l]=s.useState("form"),[u,R]=s.useState("adults"),[x,F]=s.useState(8),[p,I]=s.useState(void 0),[g,L]=s.useState(""),[f,T]=s.useState(""),[_,y]=s.useState(!1),[A,h]=s.useState(null),O=async n=>{if(!p||!a)return;const k=H(p,"yyyy-MM-dd");y(!0),h(null);const S=await J({audience:u,city:a,date:k,preferredTime:g,occasion:f,groupSize:x,...n});if(y(!1),!S.ok){h(S.error??$);return}q("check_date_lead_submitted",{city:a,date:k,audience:u,group:x,preferredTime:g,source:"TOP_FORM_INLINE"}),l("done")},i=N.split(" "),b=c?Math.max(1,i.length-2):i.length-1,G=i.slice(0,b).join(" "),M=i.slice(b).join(" "),C=a?((j=P.find(n=>n.slug===a))==null?void 0:j.name)??a.charAt(0).toUpperCase()+a.slice(1):null;return e.jsxs("div",{className:d("overflow-hidden",c?"rounded-[6px]":"rounded-[12px] mb-8"),style:{backgroundColor:t.pageBg,border:`1px solid ${t.green}`},children:[e.jsxs("div",{className:d("",c?"px-6 md:px-10 lg:px-12 pt-6 md:pt-10 lg:pt-12":"px-5 md:px-6 pt-5 md:pt-6"),children:[e.jsxs("h3",{className:d("font-display italic font-black uppercase tracking-tight leading-tight",c?"text-3xl md:text-4xl lg:text-5xl":"text-2xl md:text-3xl"),style:{color:t.body},children:[G," ",e.jsx("span",{style:{color:t.green},children:M})]}),e.jsx("p",{className:"text-sm mt-1",style:{color:t.secondary},children:w})]}),m==="form"&&e.jsxs(e.Fragment,{children:[e.jsx(U,{framing:"check",audience:u,onAudienceChange:R,showAudienceToggle:!0,date:p,onDateChange:I,group:x,onGroupChange:F,onSubmit:()=>l("contact"),loading:!1,showCityField:!0,citySlug:a,onCityChange:D,cityLocked:E,preferredTime:g,onPreferredTimeChange:L,occasion:f,onOccasionChange:T,variant:r}),e.jsxs("div",{className:d("-mt-2 pt-3 border-t border-white/5 flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6",c?"mx-6 md:mx-10 lg:mx-12 mb-6 md:mb-10 lg:mb-12":"mx-5 mb-5"),children:[C&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",style:{color:t.muted},children:[e.jsx(z,{className:"w-3.5 h-3.5",style:{color:t.green}}),"Checking ",e.jsx("strong",{className:"font-medium",style:{color:t.secondary},children:C})]}),e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 sm:flex sm:flex-wrap sm:gap-x-5",children:["Groups from 8","Instant confirmation","Individual payments"].map(n=>e.jsxs("span",{className:"flex items-center gap-2 text-[13px]",style:{color:t.body},children:[e.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full border shrink-0",style:{backgroundColor:"rgba(151,196,89,.15)",borderColor:"rgba(151,196,89,.4)"},children:e.jsx(B,{className:"w-2.5 h-2.5",style:{color:t.green},strokeWidth:3})}),n]},n))})]})]}),m==="contact"&&e.jsx(K,{onBack:()=>{h(null),l("form")},onSubmit:O,variant:r,submitting:_,error:A}),m==="done"&&e.jsx(W,{onClose:()=>l("form"),variant:r})]})}function Y(){const{display:o}=Q();return e.jsx(e.Fragment,{children:o})}export{X as C,Y as U};