1import{u as e,r as s,j as a,L as t}from"./vendor-react-BH6F5oQJ.js";import{l as n,S as l,f as i,H as r,J as d,C as o,K as c,m,B as x,L as h}from"./index-dRqPaCFl.js";import{u}from"./useEventAgenda-BtQLJVXt.js";import{T as p,a as j,b as g,c as f}from"./tabs-Bc5GG4D6.js";import{S as v,a as N,b as w,c as y,d as _}from"./select-DsVkFSYt.js";import{c as b,a as k,f as C,t as $,C as S,u as E}from"./vendor-icons-CaI5__By.js";import"./vendor-ui-B4WC06Sp.js";import"./vendor-query-CC4VRGyP.js";import"./vendor-supabase-COwyE4EW.js";import"./index-D5Ei2fSx.js";import"./index-B3FPD4RS.js";import"./Combination-DzDAyqvK.js";const T="undefined"!=typeof window?window.location.origin:"https://delphigrc.org";function z(e,s,a){return new Intl.DateTimeFormat("en-US",{timeZone:s,...a}).format(new Date(e))}function D(e,s){return`${z(e.starts_at,s,{hour:"numeric",minute:"2-digit"})} â ${z(e.ends_at,s,{hour:"numeric",minute:"2-digit"})}`}const A=()=>{var z,A,L,R,V,q;const{id:F}=e(),{data:P,isLoading:B}=n(F),I=!!(null==P?void 0:P.agenda_enabled),M=(null==P?void 0:P.agenda_timezone)||"America/New_York",{data:O,isLoading:U}=u(null==P?void 0:P.id,I),[G,H]=s.useState("all"),[J,K]=s.useState("all"),[Q,W]=s.useState(null),X=(null==P?void 0:P.slug)||(null==P?void 0:P.id)||F||"",Y=(null==O?void 0:O.days)??[];null==(A=null==(z=Y[0])?void 0:z.day_index)||A.toString();const[Z,ee]=s.useState("1");s.useEffect(()=>{if(0===Y.length)return;const e=String(Y[0].day_index);Y.some(e=>String(e.day_index)===Z)||ee(e)},[Y,Z]);const se=s.useMemo(()=>{const e=new Map;for(const s of Y){let a=s.items;"all"!==G&&(a=a.filter(e=>e.track_id===G)),"all"!==J&&(a=a.filter(e=>(e.room_id||"none")===J)),e.set(s.day_index,a)}return e},[Y,G,J]),ae=`${T}/events/${X}/agenda`,te=`https://api.qrserver.com/v1/create-qr-code/?size=180x180&data=${encodeURIComponent(ae)}`;return B?a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("main",{className:"container py-16",children:[a.jsx(l,{className:"h-8 w-64 mb-6"}),a.jsx(l,{className:"h-96 w-full"})]})}):P?I?a.jsxs(a.Fragment,{children:[a.jsxs(r,{children:[a.jsxs("title",{children:[P.title," â Program | Delphi Global Research Center"]}),a.jsx("meta",{name:"description",content:`Program schedule: ${P.title}`}),a.jsx("meta",{property:"og:title",content:`${P.title} â Program`}),a.jsx("meta",{property:"og:url",content:ae}),P.image_url&&a.jsx("meta",{property:"og:image",content:P.image_url})]}),a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("main",{className:"container py-10 max-w-4xl",children:[a.jsxs("div",{className:"mb-8 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{children:[a.jsx(i,{asChild:!0,variant:"ghost",size:"sm",className:"mb-2 -ml-2",children:a.jsxs(t,{to:`/events/${X}`,className:"gap-2",children:[a.jsx(b,{className:"h-4 w-4"})," Event details"]})}),a.jsx("h1",{className:"font-heading text-2xl md:text-3xl font-bold",children:P.title}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1 flex items-center gap-2",children:[a.jsx(k,{className:"h-4 w-4"}),"Times in ",M.replace(/_/g," ")]})]}),a.jsxs("div",{className:"flex flex-col items-center gap-2 rounded-lg border bg-card p-3",children:[a.jsx("img",{src:te,width:120,height:120,alt:"QR code to this program",className:"rounded"}),a.jsxs(i,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:()=>{navigator.clipboard.writeText(ae)},children:[a.jsx(C,{className:"h-4 w-4"})," Copy program link"]})]})]}),(null==(L=null==O?void 0:O.tracks)?void 0:L.length)||(null==(R=null==O?void 0:O.rooms)?void 0:R.length)?a.jsxs("div",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center",children:[a.jsxs("span",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1",children:[a.jsx($,{className:"h-3.5 w-3.5"})," Filters"]}),!!(null==(V=null==O?void 0:O.tracks)?void 0:V.length)&&a.jsxs(v,{value:G,onValueChange:H,children:[a.jsx(N,{className:"w-[200px]",children:a.jsx(w,{placeholder:"Track"})}),a.jsxs(y,{children:[a.jsx(_,{value:"all",children:"All tracks"}),O.tracks.map(e=>a.jsx(_,{value:e.id,children:e.name},e.id))]})]}),!!(null==(q=null==O?void 0:O.rooms)?void 0:q.length)&&a.jsxs(v,{value:J,onValueChange:K,children:[a.jsx(N,{className:"w-[200px]",children:a.jsx(w,{placeholder:"Room"})}),a.jsxs(y,{children:[a.jsx(_,{value:"all",children:"All rooms"}),O.rooms.map(e=>a.jsx(_,{value:e.id,children:e.label},e.id))]})]})]}):null,U?a.jsx(l,{className:"h-80 w-full"}):0===Y.length?a.jsx("p",{className:"text-muted-foreground",children:"No program days configured yet."}):a.jsxs(p,{value:Z,onValueChange:ee,children:[a.jsx(j,{className:"flex flex-wrap h-auto gap-1",children:Y.map(e=>{var s;return a.jsx(g,{value:String(e.day_index),className:"text-sm",children:(null==(s=e.label)?void 0:s.trim())||`Day ${e.day_index}`},e.id)})}),Y.map(e=>a.jsx(f,{value:String(e.day_index),className:"mt-6 space-y-3",children:0===(se.get(e.day_index)??[]).length?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No sessions match the filters."}):(se.get(e.day_index)??[]).map(e=>a.jsx(d,{open:Q===e.id,onOpenChange:s=>W(s?e.id:null),children:a.jsxs(o,{children:[a.jsx(c,{asChild:!0,children:a.jsx("button",{type:"button",className:"w-full text-left","aria-expanded":Q===e.id,children:a.jsxs(m,{className:"p-4 flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5 text-muted-foreground",children:a.jsx(S,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(x,{variant:"outline",className:"text-xs font-normal",children:e.item_type}),e.track&&a.jsx(x,{variant:"secondary",className:"text-xs",children:e.track.name})]}),a.jsx("p",{className:"font-medium text-foreground",children:e.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[D(e,M),e.room?` · ${e.room.label}`:"",e.location_note?` · ${e.location_note}`:""]})]}),a.jsx(E,{className:"h-5 w-5 shrink-0 text-muted-foreground transition-transform "+(Q===e.id?"rotate-180":"")})]})})}),a.jsx(h,{children:a.jsxs(m,{className:"px-4 pb-4 pt-0 border-t text-sm space-y-3",children:[e.description&&a.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.description}),e.event_agenda_item_speakers&&e.event_agenda_item_speakers.length>0&&a.jsx("ul",{className:"space-y-1",children:e.event_agenda_item_speakers.map(e=>a.jsx("li",{children:e.fellows?a.jsxs("span",{children:[a.jsx("strong",{children:e.fellows.name}),e.fellows.title?` â ${e.fellows.title}`:""]}):a.jsxs("span",{children:[a.jsx("strong",{children:e.guest_name}),e.guest_title?` â ${e.guest_title}`:""]})},e.id))}),a.jsx("div",{className:"flex flex-wrap gap-2",children:a.jsx(i,{asChild:!0,variant:"outline",size:"sm",children:a.jsx(t,{to:`/events/${X}/agenda/sessions/${e.id}`,children:"Open & share"})})})]})})]})},e.id))},e.id))]})]})})]}):a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("main",{className:"container py-16 max-w-xl mx-auto text-center space-y-4",children:[a.jsx("p",{className:"text-muted-foreground",children:"The program for this event is not published yet."}),a.jsx(i,{asChild:!0,variant:"outline",children:a.jsx(t,{to:`/events/${X}`,children:"Event details"})})]})}):a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("main",{className:"container py-16 text-center text-muted-foreground",children:[a.jsx("p",{children:"Event not found."}),a.jsx(i,{asChild:!0,variant:"link",className:"mt-4",children:a.jsx(t,{to:"/events",children:"Back to Events"})})]})})};export{A 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.