1import{y as M,z as h,E as x,cF as S,e as d,r as i,f as F,K as j,j as e,q as k,C as y,M as T,B as u}from"./index-DHwBXtP2.js";import{S as B}from"./SlotPicker-DVWuMf3A.js";import{C as I}from"./calendar-clock-mAoTkiAu.js";import{V as P}from"./video-Dk6kj1q-.js";import{D as L}from"./download-Dm0Bb9aW.js";import"./chevron-left-B7lTa6YE.js";const R=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]],z=M("calendar-x-2",R),D=h({method:"POST"}).handler(x("src_lib_booking-manage_functions_ts--getManagedBooking_createServerFn_handler")),E=h({method:"POST"}).handler(x("src_lib_booking-manage_functions_ts--rescheduleManagedBooking_createServerFn_handler")),O=h({method:"POST"}).handler(x("src_lib_booking-manage_functions_ts--cancelManagedBooking_createServerFn_handler"));function Y(){const{token:n}=S.useParams(),v=d(D),N=d(E),w=d(O),C=typeof Intl<"u"&&Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",[c,g]=i.useState(C);i.useEffect(()=>{if(typeof Intl>"u")return;const s=Intl.DateTimeFormat().resolvedOptions().timeZone;s&&s!==c&&g(s)},[]);const[b,r]=i.useState("view"),[p,t]=i.useState(null),o=F({queryKey:["managed-booking",n],queryFn:()=>v({data:{token:n}}),refetchOnWindowFocus:!1}),a=o.data,f=j({mutationFn:s=>N({data:{token:n,startIso:s}}),onSuccess:s=>{s.ok?(r("view"),t("Your call has been moved. A fresh invite is on its way."),o.refetch()):t(s.message)},onError:s=>t(s.message)}),m=j({mutationFn:()=>w({data:{token:n}}),onSuccess:s=>{s.ok?(t("Your call has been cancelled."),o.refetch()):t(s.message)},onError:s=>t(s.message)}),_=s=>new Intl.DateTimeFormat("en-US",{timeZone:c,weekday:"long",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(new Date(s));if(o.isLoading)return e.jsx("main",{className:"mx-auto w-full max-w-md px-4 py-12",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(k,{className:"h-4 w-4 animate-spin"})," Loading your bookingâ¦"]})});if(!a?.found)return e.jsx("main",{className:"mx-auto w-full max-w-md px-4 py-12",children:e.jsx(y,{className:"p-6 text-sm text-muted-foreground",children:"This link is no longer valid. Reply to your confirmation email and we'll sort it out."})});const l=a.status==="cancelled";return e.jsxs("main",{className:"mx-auto w-full max-w-3xl overflow-x-hidden px-4 py-8",children:[e.jsxs("header",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-semibold leading-tight",children:a.eventName}),e.jsx("p",{className:"mt-2 flex items-center gap-2 text-sm text-muted-foreground",children:l?e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"h-4 w-4"})," Cancelled"]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"h-4 w-4 text-primary"})," Confirmed"]})})]}),e.jsxs(y,{className:"space-y-3 p-4",children:[e.jsxs("p",{className:"flex items-start gap-2 text-sm",children:[e.jsx(I,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("span",{children:[a.startIso?_(a.startIso):"â",e.jsxs("span",{className:"block text-xs text-muted-foreground",children:[a.durationMinutes," minutes"]})]})]}),a.meetLink&&!l?e.jsxs("a",{href:a.meetLink,className:"flex items-center gap-2 text-sm text-primary underline",children:[e.jsx(P,{className:"h-4 w-4"})," Join the meeting"]}):null,!l&&a.icsUrl?e.jsxs("a",{href:a.icsUrl,className:"flex items-center gap-2 text-sm text-primary underline",children:[e.jsx(L,{className:"h-4 w-4"})," Add to calendar (.ics)"]}):null]}),p?e.jsx("p",{role:"status",className:"mt-4 text-sm text-muted-foreground",children:p}):null,l?null:e.jsx("div",{className:"mt-6 space-y-4",children:b==="view"?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.canReschedule?e.jsx(u,{variant:"outline",onClick:()=>r("reschedule"),children:"Reschedule"}):null,a.canCancel?e.jsx(u,{variant:"ghost",className:"text-destructive",disabled:m.isPending,onClick:()=>m.mutate(),children:m.isPending?e.jsx(k,{className:"h-4 w-4 animate-spin"}):"Cancel call"}
1):null,!a.canReschedule&&!a.canCancel?e.jsx("p",{className:"text-sm text-muted-foreground",children:"It's too close to the call to change it here â reply to your confirmation email and we'll help."}):null]}):e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("h2",{className:"text-base font-medium",children:"Pick a new time"}),e.jsx(u,{variant:"ghost",size:"sm",onClick:()=>r("view"),children:"Back"})]}),e.jsx(B,{slots:(a.slots??[]).map(s=>s.startIso),timezone:c,onTimezoneChange:g,onSelect:s=>{t(null),f.mutate(s)},busy:f.isPending,emptyText:"No times available on this day.",confirmLabel:"Move my call"})]})})]})}export{Y as component};
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.