1import{r as y,j as e,f as R}from"./vendor-query-BRciFQuE.js";import{a2 as G,bZ as Y,bQ as J,bz as X,as as ee,ad as _,b8 as te,aq as se}from"./index-DNKTWqBG.js";import{u as ae}from"./use-mobile-dUjef1gs.js";import{r as ne}from"./rich-html-CD3ZqCMN.js";import{e as re,a as ie,S as oe}from"./schedule-event-details-BKzmMbrh.js";import{i as le,c as ce,h as me,d as de,l as ue}from"./authoring-en7QGFLe.js";import{p as pe,v as U}from"./today-events-0Ifc7n_h.js";import{P as O}from"./party-popper-Dc4SVIVa.js";import{T as he}from"./triangle-alert-hq7wUP_F.js";import{C as fe}from"./cloud-rain-DHsntca8.js";import{b as xe,c as ye,a as ge,C as je}from"./cloud-wSqSI2z6.js";import"./vendor-react-Kr73Scym.js";import"./index-D2tI7d8k.js";import"./dialog-BP0RkA9I.js";import"./fields-D4hTAgTm.js";import"./constants-S04ki6ZQ.js";import"./vendor-forms-D1c-fY6x.js";import"./arrow-right-BrY__xEF.js";import"./phone-kF5d2IhC.js";import"./arrow-up-right-f_HsuBR1.js";const z={eventTitle:"clamp(1.1rem, 2.8vw, 1.55rem)",eventTime:"clamp(0.9rem, 2vw, 1.15rem)",meta:"clamp(0.82rem, 1.8vw, 1.02rem)"};function q({event:t,tz:a,accent:n,highlight:p,isMobile:h,embedded:o,showDate:b=!0,woodland:d=!1,theme:m,nowMs:i}){const[c,l]=y.useState(!1),D=!!t.descriptionHtml,f=h,j=re(t,i??Date.now()),w=j==="cancelled",v=(g,C)=>n.startsWith("var(")?`color-mix(in srgb, ${n} ${C}%, transparent)`:`${n}${g}`,S=new Intl.DateTimeFormat("en-US",{timeZone:a,weekday:"short",month:"short",day:"numeric"}).format(new Date(t.startsAt)),T=e.jsxs("div",{className:"flex items-center gap-x-4 gap-y-1 mt-1.5 flex-wrap",style:{fontSize:o?"0.9rem":z.eventTime},children:[e.jsxs("span",{className:`font-medium${w?" line-through":""}`,style:{color:n},children:[h&&b&&e.jsxs("span",{children:[S," · "]}),e.jsx("span",{className:"tabular-nums",children:le(t.startsAt,t.endsAt,t.allDay,a)})]}),j&&e.jsx(ie,{kind:j,accent:d?void 0:n}),t.venueName&&e.jsxs("span",{className:"text-muted-foreground flex items-center gap-1.5",children:[e.jsx(G,{className:"w-[1.1em] h-[1.1em] shrink-0","aria-hidden":!0})," ",t.venueName]})]}),$=e.jsxs("div",{className:`relative rounded-2xl border bg-card p-4 flex gap-4 transition-transform ${o?"":"sm:p-5 sm:gap-5"} ${f?"cursor-pointer active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2":""}`,style:p?{borderColor:v("55",33),...d?{}:{background:v("0f",6)}}:void 0,onClick:f?()=>l(!0):void 0,onKeyDown:f?g=>{g.target===g.currentTarget&&(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l(!0))}:void 0,role:f?"button":void 0,tabIndex:f?0:void 0,"aria-label":f?`View details for ${t.title}${j?`, ${j}`:""}`:void 0,"aria-haspopup":f?"dialog":void 0,"data-testid":`kiosk-event-${t.sourceId}`,"data-cancelled":w||void 0,children:[p&&e.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-4 bottom-4 w-1 rounded-full",style:{background:n}}),e.jsxs("div",{className:`min-w-0 flex-1 ${p?"pl-3":""}`,children:[e.jsx("div",{className:`font-display font-semibold leading-snug${w?" line-through":""}`,style:{fontSize:o?"1.1rem":z.eventTitle},children:t.title}),T,w&&t.cancelNote&&e.jsx("p",{className:"mt-1.5 font-medium",style:{fontSize:o?"0.9rem":z.meta},"data-testid":`kiosk-event-cancel-note-${t.sourceId}`,children:t.cancelNote}),D&&e.jsx(e.Fragment,{children:e.jsx("div",{className:`prose prose-sm dark:prose-invert max-w-none text-muted-foreground mt-2.5 ${h?"line-clamp-2":""}`,style:{fontSize:o?"0.82rem":z.meta},children:ne(t.descriptionHtml)})}),f&&e.jsx("div",{className:"mt-2 font-medium",style:{color:n,fontSize:"0.8rem"},children:"Tap for details â"})]}),t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:"",className:`shrink-0 self-start w-1/4 h-auto rounded-xl object-contain bg-muted/40${w?" opacity-60 grayscale":""}`,loading:"lazy"})]});return f?e.jsxs(e.Fragment,{children:[$,e.jsx(oe,{event:t,open:c,onOpenChange:l,tz:a,accent:n,appearance:d?"woodland":void 0,theme:m,nowMs:i})]}):$}function ve({woodland:t=!1}){const[a,n]=y.useState(null);if(y.useEffect(()=>{const h=te();if(!h)return;let o=!1,b;const d=async()=>{try{const m=await fetch(`/api/trivia/hosted/${h}/current`);o||n(m.ok?await m.json():null)}catch{}o||(b=setTimeout(d,2e4))};return d(),()=>{o=!0,b&&clearTimeout(b)}},[]),!(a!=null&&a.joinCode))return null;const p=`${window.location.origin}/trivia/${a.joinCode}`;return e.jsxs("div",{className:"relative flex items-center justify-center gap-4 px-4 py-2.5 text-white",style:{background:t?"#244836":"linear-gradient(90deg, #4f46e5, #7c3aed)"},"data-testid":"live-trivia-banner",children:[e.jsx(O,{className:"h-5 w-5 shrink-0 text-amber-300","aria-hidden":!0}),e.jsxs("p",{className:"font-medium",style:{fontSize:x.meta},children:["Trivia is starting â scan to play · code"," ",e.jsx("span",{className:"font-mono font-bold tracking-widest text-amber-300",children:a.joinCode})]}),e.jsx("div",{className:"rounded bg-white p-1",children:e.jsx(_,{value:p,size:44})})]})}const K=t=>`${t.calendarId??""}-${t.sourceId}-${t.startsAt}`,we=15e4,Ne=30*6e4,x={title:"clamp(1.9rem, 5.5vw, 3.25rem)",eyebrow:"clamp(0.72rem, 1.5vw, 0.9rem)",dayLabel:"clamp(1.05rem, 2.4vw, 1.45rem)",eventTime:"
1clamp(0.9rem, 2vw, 1.15rem)",meta:"clamp(0.82rem, 1.8vw, 1.02rem)",clock:"clamp(1.15rem, 2.6vw, 1.7rem)",util:"clamp(0.72rem, 1.5vw, 0.95rem)"};function M({code:t,className:a}){const n=(t??"").slice(0,2),p=n==="01"?se:n==="09"||n==="10"?fe:n==="11"?xe:n==="13"?ye:n==="50"?ge:je;return e.jsx(p,{className:a,"aria-hidden":!0})}function P({children:t,color:a,live:n,embedded:p}){return e.jsxs("div",{className:"flex items-center gap-2.5 uppercase font-medium mb-4",style:{color:a,fontSize:p?"0.72rem":x.eyebrow,letterSpacing:"0.14em"},children:[n&&e.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full opacity-75 animate-ping",style:{background:a}}),e.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5",style:{background:a}})]}),t]})}function Ke({embedded:t=!1}){var L,Z;const{establishment:a,isLoading:n,notFound:p}=Y(),h=J(),o=(a==null?void 0:a.subdomain)==="thewoods",b=ae(),d=t||b,m=a==null?void 0:a.id,i=(a==null?void 0:a.defaultTimezone)??"America/New_York",c=o?h==="dark"?"#dce879":"#244836":(a==null?void 0:a.primaryColor)??"#7c3aed",[l,D]=y.useState(()=>Date.now());y.useEffect(()=>{const s=setInterval(()=>D(Date.now()),1e3);return()=>clearInterval(s)},[]);const f=R({queryKey:["kiosk-schedule",m,d],enabled:!!m,refetchInterval:we,refetchIntervalInBackground:!0,queryFn:async()=>{const s=new Date(Date.now()+(d?12096e5:1728e5)).toISOString(),r=await fetch(`/api/establishments/${m}/schedule?to=${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`schedule ${r.status}`);return r.json()}}),j=R({queryKey:["kiosk-weather",m],enabled:!!m,refetchInterval:Ne,refetchIntervalInBackground:!0,retry:1,queryFn:async()=>{const s=await fetch(`/api/establishments/${m}/weather`);if(!s.ok)throw new Error(`weather ${s.status}`);return s.json()}}),w=R({queryKey:["/api/establishments",m,"storefronts"],enabled:!!m,refetchInterval:6e4,refetchIntervalInBackground:!0,queryFn:async()=>{const s=await fetch(`/api/establishments/${m}/storefronts`);return s.ok?s.json():[]}}),v=((L=f.data)==null?void 0:L.events)??[],S=y.useMemo(()=>pe(v,l).now,[v,l]),T=y.useMemo(()=>ce(v,l,d?300:8),[v,l,d]),$=y.useMemo(()=>{const s=U(new Date(l),i);return me(v,i).find(r=>r.startDate<=s&&s<=r.endDate)??null},[v,l,i]),g=y.useMemo(()=>X(w.data??[],l,i,20).filter(s=>s.state==="paused"),[w.data,l,i]),C=y.useMemo(()=>{var r;const s=new Map;for(const N of((r=j.data)==null?void 0:r.daily)??[])s.set(N.date,N);return s},[j.data]),E=y.useMemo(()=>{const s=U(new Date(l),i),r=[];for(const N of T){const I=U(new Date(N.startsAt),i),k=I<s?s:I,F=r[r.length-1];F&&F.date===k?F.events.push(N):r.push({date:k,label:de(k,s,i),events:[N]})}return r},[T,l,i]);if(p)return e.jsx("div",{className:`${t?"py-16":"min-h-screen"} flex items-center justify-center text-muted-foreground text-xl`,children:t?"Resort guide not configured.":"Display not configured."});if(n||!a)return e.jsx("div",{className:`${t?"py-16":"min-h-screen"} flex items-center justify-center text-muted-foreground text-xl`,children:"Loadingâ¦"});const u=j.data,A=(u==null?void 0:u.enabled)&&!u.unavailable,B=((u==null?void 0:u.daily)??[]).slice(0,4),Q=typeof window<"u"?window.location.href:"",H=new Date(l),W=new Intl.DateTimeFormat("en-US",{timeZone:i,hour:"numeric",minute:"2-digit"}).format(H),V=new Intl.DateTimeFormat("en-US",{timeZone:i,weekday:"short",month:"short",day:"numeric"}).format(H);return e.jsxs("div",{className:`${o?"woodland-schedule":""} ${t?"min-h-0 w-full":"min-h-screen"} bg-background text-foreground flex flex-col relative`,"data-theme":h,"data-testid":"schedule-kiosk",children:[!t&&e.jsx(ve,{woodland:o}),e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 h-72",style:{background:`radial-gradient(120% 100% at 50% 0%, ${c}16, transparent 72%)`}}),!t&&e.jsxs("header",{className:"schedule-masthead relative px-6 pt-5 pb-4 sm:pb-5 border-b",style:{borderColor:`${c}22`},children:[e.jsx("div",{"aria-hidden":!0,className:"absolute inset-x-0 top-0 h-1.5",style:{background:c}}),e.jsxs("div",{className:"grid grid-cols-3 items-start gap-4",children:[e.jsx("div",{className:"justify-self-start min-w-0",children:a.logoUrl?e.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[e.jsx("img",{src:a.logoUrl,alt:a.name,className:"h-10 sm:h-14 w-auto max-w-full object-contain"}),e.jsx("span",{className:"hidden sm:block font-medium truncate text-muted-foreground",style:{fontSize:x.util},children:a.name})]}):e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("div",{className:"h-11 w-11 rounded-xl flex items-center justify-center font-semibold shrink-0 text-white",style:{background:c,fontSize:"1.15rem"},children:(Z=a.name)==null?void 0:Z.slice(0,2).toUpperCase()}),e.jsx("span",{className:"font-display font-semibold truncate",style:{fontSize:"clamp(1rem, 2.6vw, 1.5rem)"},children:a.name})]})}),e.jsxs("div",{className:"justify-self-center text-center",children:[e.jsx("h1",{className:"font-display font-semibold leading-none tracking-tight",style:{fontSize:x.title},children:"Event Schedule"}),e.jsx("div",{className:"mx-auto mt-2.5 h-1 rounded-full",style:{width:"3rem",background:c}})]}),e.jsxs("div",{className:"justify-self-end text-right",children:[o&&e.jsx("div",{className:"schedule-theme-toggle",children:e.jsx(ee,{})}),e.jsx("div",{className:"font-display font-semibold tabular-nums leading-none",style:{fontSize:x.clock},children:W}),e.jsxs("div",{className:"text-muted-foreground mt-1 flex items-center gap-2 justify-end",style:{fontSize:x.util},children:[e.jsx("span",{children:V}),A&&(u==null?void 0:u.current)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,style:{opacity:.5},children:"·"}),e.jsx(M,{code:u.current.iconCode,className:"w-[1.15em] h-[1.15em]"}),e.jsxs("span",{children:[Math.round(u.current.temp),"°"]})]})]})]})]})]}),$&&e.jsxs("div",{className:"schedule-theme-banner flex items-center justify-center gap-3 px-6 py-2.5 text-white font-display font-medium",style:{background:o?"#244836":c,fontSize:t?"1rem":"clamp(1rem, 2.6vw, 1.35rem)"},children:[e.jsx(O,{className:"w-[1.15em] h-[1.15em] shrink-0","aria-hidden":!0}),e.jsx("span",{className:"text-center",children:$.title})]}),e.jsxs("main",{className:`relative flex-1 ${t?"px-4 py-6 space-y-8":"px-6 py-7 space-y-10"} animate-in fade-in duration-500`,children:[g.length>0&&e.jsx("div",{className:"rounded-2xl border border-amber-500/40 bg-amber-500/10 px-5 py-4 space-y-3","data-testid":"banner-kiosk-closure",children:g.map(s=>e.jsxs("div",{className:"flex items-start gap-3 text-amber-800 dark:text-amber-200",style:{fontSize:t?"0.9rem":x.eventTime},children:[e.jsx(he,{className:"w-[1.15em] h-[1.15em] shrink-0 mt-0.5","aria-hidden":!0}),e.jsxs("div",{className:"font-medium leading-snug",children:[e.jsx("strong",{className:"font-display",children:s.name})," â ",s.detail,"."]})]},s.id))}),S.length>0&&e.jsxs("section",{children:[e.jsx(P,{color:c,live:!0,embedded:t,children:"Happening now"}
1),e.jsx("div",{className:t?"space-y-3":"space-y-3 sm:space-y-4",children:S.map(s=>e.jsx(q,{event:s,tz:i,accent:c,isMobile:d,embedded:t,woodland:o,theme:h,nowMs:l,highlight:!0},K(s)))})]}),e.jsxs("section",{children:[e.jsx(P,{embedded:t,children:"Coming up"}),E.length===0&&S.length===0?e.jsx("div",{className:"text-muted-foreground py-14 text-center",style:{fontSize:"clamp(1rem, 2.6vw, 1.35rem)"},children:"That's a wrap for today â see you tomorrow!"}):E.length===0?e.jsx("div",{className:"text-muted-foreground py-4",style:{fontSize:x.meta},children:"Nothing else scheduled today."}):e.jsx("div",{className:"space-y-6",children:E.map(s=>{const r=C.get(s.date),N=ue(s.date),I=new Intl.DateTimeFormat("en-US",{timeZone:i,month:"short",day:"numeric"}).format(new Date(`${s.date}T12:00:00Z`));return e.jsxs("div",{children:[e.jsx("div",{className:`mb-3.5 sticky top-0 z-20 py-2 bg-background/95 backdrop-blur ${t?"-mx-4 px-4":"-mx-6 px-6 sm:static sm:mx-0 sm:px-0 sm:py-0 sm:bg-transparent sm:backdrop-blur-none"}`,children:e.jsxs("div",{className:`flex items-center justify-between gap-3 rounded-xl border px-4 py-2.5 ${t?"flex-wrap":""}`,style:N?{borderColor:`${c}44`,background:`${c}0d`}:void 0,children:[e.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[e.jsx("span",{className:"font-display font-semibold",style:{color:c,fontSize:t?"1.05rem":x.dayLabel},children:s.label}),e.jsx("span",{className:"text-muted-foreground",style:{fontSize:t?"0.82rem":x.meta},children:I})]}),r&&e.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground shrink-0",style:{fontSize:t?"0.82rem":x.meta},children:[e.jsx(M,{code:r.iconCode,className:"w-[1.15em] h-[1.15em]"}),r.high,"° / ",r.low,"° · ",r.precipChancePct,"% rain"]})]})}),e.jsx("div",{className:t?"space-y-3":"space-y-3 sm:space-y-4",children:s.events.map(k=>e.jsx(q,{event:k,tz:i,accent:c,isMobile:d,embedded:t,woodland:o,theme:h,nowMs:l},K(k)))})]},s.date)})})]})]}),e.jsxs("footer",{className:`px-6 py-4 border-t flex items-center justify-center gap-6 ${t?"":"sm:py-5 sm:justify-between"}`,style:{borderColor:`${c}22`},children:[A&&B.length>0?e.jsx("div",{className:t?"flex flex-wrap justify-center gap-3":"flex gap-3 sm:gap-4",children:B.map(s=>e.jsxs("div",{className:"text-center rounded-xl px-3 py-2 bg-muted/40",children:[e.jsx("div",{className:"text-muted-foreground uppercase",style:{fontSize:"0.7rem",letterSpacing:"0.08em"},children:new Intl.DateTimeFormat("en-US",{timeZone:i,weekday:"short"}).format(new Date(`${s.date}T12:00:00Z`))}),e.jsx(M,{code:s.iconCode,className:"w-6 h-6 mx-auto my-1"}),e.jsxs("div",{className:"font-medium tabular-nums",style:{fontSize:"clamp(0.85rem, 2vw, 1rem)"},children:[Math.round(s.high),"°"]})]},s.date))}):e.jsx("div",{}),!t&&e.jsxs("div",{className:"hidden sm:flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-medium leading-tight",style:{fontSize:"clamp(0.82rem, 2vw, 1.05rem)"},children:"Scan to view on your phone"}),e.jsx("div",{className:"text-muted-foreground leading-tight",style:{fontSize:"clamp(0.72rem, 1.6vw, 0.85rem)"},children:"Take the schedule with you"})]}),e.jsx("div",{className:"bg-white p-2 rounded-xl shrink-0","aria-label":"QR code linking to this schedule",children:e.jsx(_,{value:Q,size:92})})]})]})]})}export{Ke 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.