1import{r as s,j as e}from"./vendor-react-zwv87yMD.js";import{a as B,b as L}from"./vendor-query-DYq8g7OI.js";import{p as O}from"./waitlist-BuuPR6ss.js";import{p as $}from"./reservations-7yQ-Swm2.js";import{B as _}from"./button-DlBDuKbo.js";import{I as l}from"./input-C9cRIRX4.js";import{L as i}from"./label-CSUA9GMO.js";import{T as D}from"./textarea-CfTUtQow.js";import{f as K}from"./phoneUtils-CLDOdnrv.js";import{b as U}from"./api-client-wl3SCNAO.js";import{O as Y,P as Q}from"./PublicBranding-DhRuCgEQ.js";import{a as W}from"./track-B7QfuplP.js";import{s as G,a1 as H,w as J}from"./vendor-icons-bLSWzydc.js";import{e as V,c as X}from"./vendor-router-DimZLiZb.js";import"./vendor-charts-CtrTLS4K.js";import"./vendor-i18n-BdYkS11p.js";import"./vendor-ui-CfDMlrKu.js";import"./vendor-pdf-DQuePnfN.js";import"./vendor-state-ByI9XJey.js";import"./vendor-editor-C_dhmuey.js";import"./kioskAuth-DLY0QXQp.js";import"./utils-BXSzAfFa.js";const Z=void 0;function ee(r){const[m,n]=r.split(":").map(Number),p=m>=12?"PM":"AM";return`${m%12===0?12:m%12}:${String(n).padStart(2,"0")} ${p}`}function Se(){const{token:r}=V(),m=X(),[n,p]=s.useState(""),[a,w]=s.useState(""),[j,C]=s.useState(""),[h,T]=s.useState(1),[u,P]=s.useState(""),[x,v]=s.useState(""),[y,F]=s.useState(""),[b,f]=s.useState(!0),[N,E]=s.useState(!1),[z,A]=s.useState(null),I=s.useRef(null),{data:c,isLoading:M,error:R}=B({queryKey:["public-waitlist",r],queryFn:()=>O.getInfo(r),enabled:!!r}),o=L({mutationFn:()=>$.create(r,{customerName:n.trim(),customerPhone:a.trim()||void 0,customerEmail:j.trim()||void 0,partySize:h,reservationDate:u,reservationTime:x,notes:y.trim()||void 0,smsConsent:a.trim()?b:!1,marketingOptIn:N,turnstileToken:z||void 0}),onSuccess:t=>{W("reservation_booked",{party_size:h}),m(`/waitlist/reservation/${t.confirmationCode}`)},onError:()=>{var t;(t=I.current)==null||t.reset(),A(null)}});if(M)return e.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})});if(R||!c)return e.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 p-4",children:e.jsxs("div",{className:"text-center max-w-sm",children:[e.jsx(G,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Not Found"}),e.jsx("p",{className:"text-gray-600",children:"This reservation link is invalid or has expired."})]})});const q=U();return e.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col items-center p-4 pt-12",children:[e.jsxs("div",{className:"w-full max-w-md bg-white rounded-xl shadow-lg p-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[c.hasLogo&&r&&e.jsx("div",{className:"flex justify-center mb-3",children:e.jsx(Y,{token:r,size:56})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:c.organizationName}),e.jsx("p",{className:"text-gray-500 mt-1",children:"Make a Reservation"})]}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),n.trim()&&a.trim()&&u&&x&&o.mutate()},className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{htmlFor:"res-name",children:"Name *"}),e.jsx(l,{id:"res-name",value:n,onChange:t=>p(t.target.value),placeholder:"Your name",required:!0,autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"res-phone",children:"Phone Number *"}),e.jsx(l,{id:"res-phone",type:"tel",value:a,onChange:t=>{const d=K(t.target.value);w(d),d.trim()||f(!1)},placeholder:"(555) 555-5555",required:!0}),a.trim()&&e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-600 cursor-pointer mt-2",children:[e.jsx("input",{type:"checkbox",checked:b,onChange:t=>f(t.target.checked),className:"rounded border-gray-300 mt-0.5"}),e.jsx("span",{children:"Text me a confirmation and reminder. Msg & data rates may apply. Consent is not a condition of service."})]})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"res-email",children:"Email"}),e.jsx(l,{id:"res-email",type:"email",value:j,onChange:t=>C(t.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsxs(i,{htmlFor:"res-date",children:[e.jsx(H,{className:"h-3.5 w-3.5 inline mr-1"}),"Date *"]}),e.jsx(l,{id:"res-date",type:"date",value:u,onChange:t=>P(t.target.value),min:q,required:!0})]}),e.jsxs("div",{children:[e.jsxs(i,{htmlFor:"res-time",children:[e.jsx(J,{className:"h-3.5 w-3.5 inline mr-1"}),"Time *"]}),e.jsx(l,{id:"res-time",type:"time",value:x,onChange:t=>v(t.target.value),required:!0})]})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"res-party",children:"Party Size"}),e.jsx(l,{id:"res-party",type:"number",min:1,max:c.maxPartySize??void 0,value:h,onChange:t=>T(parseInt(t.target.value)||1),onFocus:t=>t.target.select()}),c.maxPartySize!=null&&e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Larger parties â please call us."})]}),e.jsxs("div",{children:[e.jsx(i,{htmlFor:"res-notes",children:"Notes (optional)"}),e.jsx(D,{id:"res-notes",value:y,onChange:t=>F(t.target.value),placeholder:"Any special requests?",rows:2})]}),e.jsxs("label",{className:"flex items-start gap-2 text-sm text-gray-600 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:N,onChange:t=>E(t.target.checked),className:"rounded border-gray-300 mt-0.5"}),e.jsx("span",{children:"Send me news, updates & promotions by text and email. Msg & data rates may apply; reply STOP to opt out of texts. Unsubscribe anytime."})]}),Z,o.isError&&(()=>{var S,k;const t=(k=(S=o.error)==null?void 0:S.response)==null?void 0:k.data,d=Array.isArray(t==null?void 0:t.availableSlots)?t.availableSlots:[];return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-red-600",children:(t==null?void 0:t.message)||"Failed to book. Please try again."}),d.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-600 mb-1.5",children:"Available nearby:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:d.map(g=>e.jsx("button",{type:"button",onClick:()=>{v(g),o.reset()},className:"px-3 py-1.5 text-sm rounded-md border border-blue-200 bg-blue-50 text-blue-700 hover:bg-blue-100 hover:border-blue-300",children:ee(g)},g))})]})]})})(),e.jsx(_,{type:"submit",className:"w-full",size:"lg",disabled:!n.trim()||!a.trim()||!u||!x||o.isPending||!1,children:o.isPending?"Booking...":"Book Reservation"}),e.jsx("p",{className:"text-center text-sm text-gray-500",children:e.jsx("a",{href:`/waitlist/${r}`,className:"text-blue-600 hover:underline",children:"Back to options"})})]})]}),e.jsx(Q,{})]})}
1export{Se as default};
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.