@innosolutions/inno-calendar 1.0.61 → 1.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT.md +1783 -1783
- package/README.md +305 -279
- package/dist/agenda-widget-BiZIpa3f.cjs +2 -0
- package/dist/agenda-widget-BiZIpa3f.cjs.map +1 -0
- package/dist/{agenda-widget-DVj4CEZE.js → agenda-widget-DbqQHhyM.js} +1515 -1494
- package/dist/agenda-widget-DbqQHhyM.js.map +1 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/inno-calendar.d.ts +24 -0
- package/dist/components/inno-calendar.d.ts.map +1 -1
- package/dist/components/views/timeline-view.d.ts +12 -1
- package/dist/components/views/timeline-view.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +201 -201
- package/dist/position-utils-BQpbtF6N.cjs.map +1 -1
- package/dist/position-utils-DMVQFywD.js.map +1 -1
- package/dist/slot-selection-context-CRstOosL.js.map +1 -1
- package/dist/slot-selection-context-DBCZI2Dn.cjs.map +1 -1
- package/dist/week-view-C1Vu2ErD.cjs.map +1 -1
- package/dist/week-view-DY167Wok.js.map +1 -1
- package/package.json +138 -138
- package/dist/agenda-widget-D6E-NQK-.cjs +0 -2
- package/dist/agenda-widget-D6E-NQK-.cjs.map +0 -1
- package/dist/agenda-widget-DVj4CEZE.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),De=require("./use-calendar-DkT1_V3j.cjs"),c=require("react"),f=require("./index-D2U2F80P.cjs"),w=require("./week-view-C1Vu2ErD.cjs"),ke=require("./slot-selection-context-DBCZI2Dn.cjs"),q=require("./position-utils-BQpbtF6N.cjs");function et({view:t,className:n=""}){return e.jsx("div",{className:n,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"400px",backgroundColor:"#f9fafb",borderRadius:"0.5rem",border:"1px dashed #d1d5db"},children:e.jsxs("div",{style:{textAlign:"center",color:"#6b7280"},children:[e.jsxs("p",{style:{fontSize:"1.125rem",fontWeight:500},children:[t.charAt(0).toUpperCase()+t.slice(1)," View"]}),e.jsx("p",{style:{fontSize:"0.875rem"},children:"Implementation pending"})]})})}function Pe({view:t,className:n}){return e.jsx(et,{view:t,className:n})}function tt(t){const{events:n,resources:s,scheduleTypes:r,initialView:o="week",initialDate:i,initialFilters:p,preferences:x,locale:l,slots:j,renderEvent:F,onViewChange:b,onDateChange:y,onEventClick:$,onSlotSelect:A,onFiltersChange:W,className:O,children:H}=t,k=De.useOptionalCalendarContext();if(k)return e.jsx("div",{className:O,style:{position:"relative"},children:H??e.jsx(Pe,{view:k.view,className:O})});const R=De.useCalendar({events:n,resources:s,scheduleTypes:r,initialView:o,initialDate:i,initialFilters:p,preferences:x,locale:l,onViewChange:b,onDateChange:y,onEventClick:$,onSlotSelect:A,onFiltersChange:W});return e.jsx(De.CalendarProvider,{value:R,children:e.jsx("div",{className:O,style:{position:"relative"},children:H??e.jsx(Pe,{view:R.view,className:O})})})}function nt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),e.jsx("path",{d:"m15 5 4 4"})]})}function Je({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),e.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),e.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]})}function Me({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function rt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m4.9 4.9 14.2 14.2"})]})}function be({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function st({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]})}function ot({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function at({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function it({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]})}function lt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"})]})}function ct({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),e.jsx("path",{d:"M10 9H8"}),e.jsx("path",{d:"M16 13H8"}),e.jsx("path",{d:"M16 17H8"})]})}function pe({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f.cn("animate-spin",t),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}const dt={edit:"Edit",delete:"Delete",cancel:"Cancel Event",close:"Close",going:"Going",notGoing:"Not Going",confirmMeeting:"Confirm meeting took place",completed:"Completed",canceled:"Canceled",participants:"Participants",guest:"guest",guests:"guests",confirmed:"confirmed",organizer:"Organizer",client:"Client",more:"more",noDateProvided:"No date provided",eventNotFound:"Event not found",cancellationNote:"Cancellation Note",canceledOn:"Canceled on",acceptThisEvent:"Accept this event only",acceptAllEvents:"Accept all events",deleteConfirmTitle:"Delete Event",deleteConfirmDescription:"Are you sure you want to delete this event? This action cannot be undone."},ye=c.forwardRef(({onClick:t,label:n,children:s,className:r,variant:o="ghost",...i},p)=>e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button",ref:p,onClick:t,className:f.cn("h-8 w-8 rounded-full flex items-center justify-center transition-colors",o==="ghost"&&"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",o==="destructive"&&"hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",r),"aria-label":n,...i,children:s})}),e.jsx(w.TooltipContent,{side:"bottom",className:"text-xs",children:n})]}));ye.displayName="IconButton";function ut({src:t,alt:n,initials:s,className:r,isClient:o}){const[i,p]=c.useState(!1);return e.jsx("div",{className:f.cn("relative h-7 w-7 rounded-full overflow-hidden shrink-0",r),children:t&&!i?e.jsx("img",{src:t,alt:n,className:"h-full w-full object-cover",onError:()=>p(!0)}):e.jsx("div",{className:f.cn("h-full w-full flex items-center justify-center text-[10px] font-medium",o?"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300":"bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-300"),children:s})})}function Ae({participant:t,isEventCanceled:n=!1,labels:s}){const r=t.name||"Unknown",o=r.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),i=t.isOrganizer??!1,p=t.isConfirmed,x=p===!0,l=p===!1,j=t.isClient??!1,F=t.profilePicture||t.avatar,b=n;return e.jsxs("div",{className:f.cn("flex items-center gap-3 py-0",b&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(ut,{src:F,alt:r,initials:o,isClient:j,className:f.cn(b&&"grayscale")}),b||l?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-100 dark:bg-red-900/50 flex items-center justify-center",children:e.jsx(Me,{className:"h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]"})})}):x?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center",children:e.jsx(be,{className:"h-2 w-2 text-green-600 dark:text-green-400 stroke-[3]"})})}):null]}),e.jsxs("div",{className:"!h-fit min-w-0 gap-0",children:[e.jsx("div",{className:"gap-0",children:e.jsx("span",{className:f.cn("text-sm text-zinc-900 dark:text-zinc-100 truncate",b&&"line-through text-zinc-500 dark:text-zinc-500"),children:r})}),j&&e.jsx("div",{className:"text-[10px] px-1.5 w-fit py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 font-medium",children:s.client}),i&&!b&&e.jsx("div",{className:"text-xs text-zinc-500",children:s.organizer})]})]})}function xt({open:t,onOpenChange:n,title:s,children:r}){return c.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&n(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,n]),c.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t?e.jsxs("div",{className:"fixed inset-0 z-50",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>n(!1),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&n(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden",children:[s&&e.jsx("div",{className:"sr-only",children:s}),r]})})]}):null}function ht({open:t,onOpenChange:n,title:s,description:r,cancelLabel:o,confirmLabel:i,onConfirm:p,isLoading:x}){return t?e.jsxs("div",{className:"fixed inset-0 z-[60]",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>n(!1),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&n(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:s}),e.jsx("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:r}),e.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[e.jsx(w.Button,{variant:"outline",size:"sm",onClick:()=>n(!1),children:o}),e.jsxs(w.Button,{variant:"destructive",size:"sm",onClick:p,disabled:x,children:[x&&e.jsx(pe,{className:"h-4 w-4 mr-2"}),e.jsx(Je,{className:"h-4 w-4 mr-2"}),i]})]})]})})]}):null}function mt(t,n){return t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function ft(t,n){const s={hour:"2-digit",minute:"2-digit",hour12:!1};return`${t.toLocaleTimeString(void 0,s)} – ${n.toLocaleTimeString(void 0,s)}`}function gt(t){return t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function pt(t){const[n,s]=c.useState(()=>typeof window<"u"?window.matchMedia(t).matches:!1);return c.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(t),o=i=>s(i.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),n}function Fe({event:t,labels:n,isLoading:s,onClose:r,onEdit:o,onDelete:i,onCancel:p,onAccept:x,onDecline:l,onConfirmMeeting:j,canEdit:F=!0,canDelete:b=!1,canCancel:y=!0,isCurrentUserParticipant:$=!1,isCurrentUserClient:A=!1,currentUserAcceptStatus:W,isAcceptLoading:O=!1,isDeclineLoading:H=!1,isConfirmLoading:k=!1,isDeleteLoading:R=!1,renderParticipant:B,renderHeaderActions:Y,renderCancelReason:M,renderDeleteConfirmation:V,formatDate:E=mt,formatTimeRange:z=ft}){const[U,G]=c.useState(!1),Q=!(t.isCanceled||t.meetingTookPlace),h=t.isRecurring??!1,g=t.participantDetails,m=t.participantsNames||[],T=g&&g.length>0,D=W===!0,L=W===!1,te=$&&!A&&Q,_=T?g.filter(d=>d.isConfirmed).length:t.isAccepted?m.length:0,X=T?g.length:m.length,re=t.scheduleTypeColor||t.hexColor||"#039BE5",Z=c.useCallback(()=>t.startDate?E(t.startDate):n.noDateProvided,[t.startDate,E,n.noDateProvided]),ue=c.useCallback(()=>t.startDate&&t.endDate?z(t.startDate,t.endDate):null,[t.startDate,t.endDate,z]),oe=()=>{r(),o?.(t)},ae=()=>{r(),p?.(t)},xe=()=>{G(!0)},le=()=>{i?.(t),G(!1)};return s?e.jsx("div",{className:"flex h-48 items-center justify-center",children:e.jsx(pe,{className:"h-6 w-6 text-zinc-400"})}):e.jsxs(w.TooltipProvider,{delayDuration:300,children:[e.jsxs("div",{className:"flex flex-col gap-0.5 p-3",children:[e.jsx("div",{className:"flex items-start justify-end gap-0.5",children:Y?Y({onClose:r}):e.jsxs(e.Fragment,{children:[Q&&F&&o&&e.jsx(ye,{onClick:oe,label:n.edit,children:e.jsx(nt,{className:"h-[18px] w-[18px]"})}),Q&&y&&p&&e.jsx(ye,{onClick:ae,label:n.cancel,children:e.jsx(rt,{className:"h-[18px] w-[18px]"})}),b&&i&&e.jsx(ye,{onClick:xe,label:n.delete,variant:"destructive",children:e.jsx(Je,{className:"h-[18px] w-[18px]"})}),e.jsx(ye,{onClick:r,label:n.close,children:e.jsx(Me,{className:"h-[18px] w-[18px]"})})]})}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded mt-1 shrink-0",style:{backgroundColor:re}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:f.cn("text-[22px] font-normal text-zinc-900 dark:text-zinc-100 leading-tight",t.isCanceled&&"line-through opacity-60"),children:t.title}),t.meetingTookPlace&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 text-xs font-medium",children:[e.jsx(st,{className:"h-3 w-3"}),n.completed]}),t.isCanceled&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-medium",children:[e.jsx(Me,{className:"h-3 w-3"}),n.canceled]})]}),e.jsxs("div",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{children:Z()}),ue()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:ue()})]})]}),h&&t.recurrenceSummary&&e.jsx("div",{className:"text-sm text-zinc-500 dark:text-zinc-500",children:t.recurrenceSummary})]})]})}),t.isCanceled&&e.jsx("div",{className:"mx-4 p-3 rounded-lg bg-red-50 dark:bg-red-950/30",children:M?M(t):e.jsx("div",{className:"flex items-start gap-0",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:n.cancellationNote}),t.cancelReason&&e.jsxs("div",{className:"mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic",children:['"',t.cancelReason,'"']}),t.canceledDate&&e.jsxs("div",{className:"mt-1.5 text-xs text-red-500/70 dark:text-red-400/60",children:[n.canceledOn," ",gt(t.canceledDate)]})]})})}),e.jsxs("div",{className:"space-y-0.5",children:[t.address&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(it,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("span",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:t.address})]}),(T||m.length>0)&&e.jsxs("div",{className:"flex items-start gap-2 py-0",children:[e.jsx(at,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("span",{className:"text-sm text-zinc-900 dark:text-zinc-100 font-medium",children:[X," ",X!==1?n.guests:n.guest]}),X>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",_," ",n.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[T?g.slice(0,6).map((d,I)=>B?B(d,I):e.jsx(Ae,{participant:d,isEventCanceled:t.isCanceled,labels:n},d.id)):m.slice(0,6).map((d,I)=>{const K={id:String(I),name:d,email:"",isConfirmed:t.isAccepted,isOrganizer:I===0,isClient:!1};return B?B(K,I):e.jsx(Ae,{participant:K,isEventCanceled:t.isCanceled,labels:n},d)}),X>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",X-6," ",n.more]})]})]})]}),t.description&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ct,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap",children:t.description})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(lt,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("div",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:T&&g.find(d=>d.isOrganizer)?.name||m[0]||"Calendar"})]})]}),te&&x&&l&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 mt-3 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[h?e.jsxs(w.DropdownMenu,{children:[e.jsx(w.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",D&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:d=>{d.stopPropagation(),D||x(t)},disabled:O,children:O?e.jsx(pe,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[D&&e.jsx(be,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",D&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(ot,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(w.DropdownMenuContent,{align:"start",children:[e.jsxs(w.DropdownMenuItem,{className:f.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",D&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>x(t),children:[e.jsx(be,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptThisEvent]}),e.jsxs(w.DropdownMenuItem,{onClick:()=>x(t),children:[e.jsx(be,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptAllEvents]})]})]}):e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",D&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{D||x(t)},disabled:O,children:O?e.jsx(pe,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[D&&e.jsx(be,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",L&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{L||l(t)},disabled:H,children:H?e.jsx(pe,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[L&&e.jsx(Me,{className:"h-3.5 w-3.5"}),n.notGoing]})})]})}),$&&D&&!t.meetingTookPlace&&!t.isCanceled&&j&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(w.Button,{size:"sm",variant:"outline",className:"w-full h-9 hover:!bg-green-100 hover:text-green-700 text-green-700 !bg-green-100 !border-none dark:text-green-400 dark:hover:bg-green-950/30",onClick:()=>j(t),disabled:k,children:[k&&e.jsx(pe,{className:"h-4 w-4 mr-2"}),n.confirmMeeting]})})]}),V?U&&V({onConfirm:le,onCancel:()=>G(!1),isLoading:R}):e.jsx(ht,{open:U,onOpenChange:G,title:n.deleteConfirmTitle,description:n.deleteConfirmDescription,cancelLabel:n.cancel,confirmLabel:n.delete,onConfirm:le,isLoading:R})]})}function vt({event:t,children:n,open:s,onOpenChange:r,isLoading:o,labels:i,onEdit:p,onDelete:x,onCancel:l,onAccept:j,onDecline:F,onConfirmMeeting:b,canEdit:y=!0,canDelete:$=!1,canCancel:A=!0,isCurrentUserParticipant:W,isCurrentUserClient:O,currentUserAcceptStatus:H,isAcceptLoading:k,isDeclineLoading:R,isConfirmLoading:B,isDeleteLoading:Y,renderParticipant:M,renderHeaderActions:V,renderCancelReason:E,renderDeleteConfirmation:z,formatDate:U,formatTimeRange:G,className:Q,width:h=360}){const g=pt("(min-width: 768px)"),m={...dt,...i},T=c.useCallback(()=>{r?.(!1)},[r]),D={event:t,labels:m,isLoading:o,onClose:T,onEdit:p,onDelete:x,onCancel:l,onAccept:j,onDecline:F,onConfirmMeeting:b,canEdit:y,canDelete:$,canCancel:A,isCurrentUserParticipant:W,isCurrentUserClient:O,currentUserAcceptStatus:H,isAcceptLoading:k,isDeclineLoading:R,isConfirmLoading:B,isDeleteLoading:Y,renderParticipant:M,renderHeaderActions:V,renderCancelReason:E,renderDeleteConfirmation:z,formatDate:U,formatTimeRange:G};return g?e.jsxs(w.Popover,{open:s??!1,onOpenChange:r??(()=>{}),children:[e.jsx(w.PopoverTrigger,{asChild:!0,children:n}),e.jsx(w.PopoverContent,{className:f.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",Q),style:{width:h},align:"center",side:"bottom",sideOffset:4,children:e.jsx(Fe,{...D})})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(xt,{open:s??!1,onOpenChange:r??(()=>{}),title:t.title,children:e.jsx(Fe,{...D})})]})}const Te=44,We=4,jt=56,Oe=8,Ne=80,we=140,Re=100,_e=2,wt=8,bt=18;function yt(t){return t.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2)}function kt(t,n){const s=[];for(let r=0;r<n;r++){const o=new Date(t);o.setDate(o.getDate()+r),s.push(o)}return s}function Nt(t,n,s){const r=[];return t.forEach((o,i)=>{for(let p=n;p<s;p++)r.push({hour:p,dayIndex:i,date:o})}),r}function Se(t){return`${t.toString().padStart(2,"0")}:00`}function Ct(t){return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function $e(t){const n=[...t].sort((o,i)=>o.startCol!==i.startCol?o.startCol-i.startCol:i.spanCols-o.spanCols),s=[],r=[];for(const o of n){let i=0;for(;r[i]!==void 0&&r[i]>o.startCol;)i++;r[i]=o.startCol+o.spanCols,s.push({...o,stackIndex:i})}return s}function Dt({src:t,alt:n,fallback:s,className:r}){return e.jsx("div",{className:f.cn("relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",r),children:t?e.jsx("img",{src:t,alt:n,className:"aspect-square h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:s})})}const Mt=7;function ve({daysToShow:t=Mt,events:n,users:s=[],alwaysShowResources:r,selectedDate:o,onDateChange:i,onEventClick:p,onSlotClick:x,onSlotSelect:l,visibleHours:j,className:F,getEventUserId:b,renderPopover:y,slots:$,classNames:A,enableDrag:W=!0}){const O=c.useRef(null),H=ke.useOptionalDragDrop(),[k,R]=c.useState(null),B=c.useRef(!1),[Y,M]=c.useState(null),V=o??new Date,E=!0,z=j?.from??wt,U=j?.to??bt,G=U-z,Q=c.useMemo(()=>{const a=new Date(V);if(t===1||t===3)return a.setHours(0,0,0,0),a;const u=a.getDay(),v=u===0?-6:1-u;return a.setDate(a.getDate()+v),a.setHours(0,0,0,0),a},[V,t]),h=c.useMemo(()=>kt(Q,t),[Q,t]),g=c.useMemo(()=>Nt(h,z,U),[E,h,z,U]),T=b??(a=>{if(a.resourceId)return a.resourceId;const u=a.data;if(u?.userId)return String(u.userId);if(u?.user&&typeof u.user=="object"&&u.user.id)return String(u.user.id);if(a.user?.id)return a.user.id;if(a.participants?.[0]?.id)return a.participants[0].id}),D=c.useMemo(()=>{const a=new Map;for(const u of s)a.set(u.id,{id:u.id,name:u.name,avatar:u.avatar??void 0,email:u.email});for(const u of n){const N=u.data?.user;N?.id&&!a.has(N.id)&&a.set(N.id,{id:N.id,name:N.name??"",avatar:N.avatar??void 0,email:N.email}),u.user?.id&&!a.has(u.user.id)&&a.set(u.user.id,{id:u.user.id,name:u.user.name,avatar:u.user.avatar??void 0,email:u.user.email});for(const C of u.participants||[])C.id&&!a.has(C.id)&&a.set(C.id,{id:C.id,name:C.name,avatar:C.avatar??void 0,email:C.email})}return Array.from(a.values())},[s,n]),L=c.useMemo(()=>{const a=[],u=new Map;for(const C of D)u.set(C.id,[]);u.set("unassigned",[]);for(const C of n){const S=T(C)??"unassigned";(u.get(S)??u.get("unassigned")).push(C)}const v=C=>{const S=[];for(const P of C){const ee=P.startDate.getHours()+P.startDate.getMinutes()/60,ne=P.endDate.getHours()+P.endDate.getMinutes()/60;for(let J=0;J<h.length;J++){const se=h[J],he=q.startOfDay(se),me=q.endOfDay(se);if(P.startDate<=me&&P.endDate>=he){let fe=z,je=U;if(P.startDate>=he&&(fe=Math.max(z,ee)),P.endDate<=me&&(je=Math.min(U,ne)),fe=Math.max(z,Math.min(U,fe)),je=Math.max(z,Math.min(U,je)),je>fe){const ze=J*G+Math.floor(fe-z),Ze=J*G+Math.ceil(je-z);S.push({event:P,startCol:ze,spanCols:Math.max(1,Ze-ze)})}}}}return S};for(const C of D){const S=u.get(C.id)??[],P=v(S),ee=$e(P),ne=ee.reduce((J,se)=>Math.max(J,se.stackIndex+1),0);a.push({user:C,events:ee,maxStack:Math.max(ne,1)})}const N=u.get("unassigned")??[];if(N.length>0){const C=v(N),S=$e(C),P=S.reduce((ee,ne)=>Math.max(ee,ne.stackIndex+1),0);a.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:S,maxStack:Math.max(P,1)})}if(r?.length){const C=new Set(a.map(S=>S.user.id));for(const S of r)C.has(S.id)||(a.push({user:{id:S.id,name:S.name,avatar:S.avatar??void 0,email:S.email},events:[],maxStack:1}),C.add(S.id))}return a},[D,n,h,E,G,z,U,T,r]),te=c.useMemo(()=>{const a=new Map;for(const u of L)for(const v of u.events)if(v.spanCols===1){const N=a.get(v.startCol)??0;a.set(v.startCol,N+1)}return a},[L]),_=c.useMemo(()=>{const a=g.length,u=Ne,v=[];for(let N=0;N<a;N++){const C=te.get(N)??0;C>_e?v.push(Re+(C-_e)*20):C>0?v.push(Math.max(u,Re)):v.push(u)}return v},[E,g.length,h.length,te]),X=a=>Math.max(jt,a*(Te+We)+Oe*2),re=we+_.reduce((a,u)=>a+u,0),Z=c.useMemo(()=>{const a=[0];for(let u=0;u<_.length;u++)a.push(a[u]+_[u]);return a},[_]);c.useLayoutEffect(()=>{const a=O.current;if(!a)return;const u=()=>{let v=-1;const C=new Date().getHours();{for(let S=0;S<g.length;S++){const P=g[S];if(P&&q.isToday(P.date)&&P.hour<=C&&P.hour+1>C){v=S;break}}if(v===-1)for(let S=0;S<g.length;S++){const P=g[S];if(P&&q.isToday(P.date)){v=S;break}}}if(v!==-1){const S=(Z[v]??0)+we,P=a.clientWidth,ee=Math.max(0,S-P/3);a.scrollTo({left:ee,behavior:"instant"})}};requestAnimationFrame(()=>{requestAnimationFrame(u)})},[V,g,h,Z,E]);const ue=c.useCallback((a,u)=>{const v=u.getBoundingClientRect(),N=a-v.left+u.scrollLeft;for(let C=0;C<Z.length-1;C++){const S=Z[C],P=Z[C+1];if(N>=S&&N<P){const ee=(N-S)/(P-S),ne=Math.floor(ee*60),J=Math.round(ne/15)*15;return{colIndex:C,minute:Math.min(J,45)}}}return null},[Z]),oe=c.useCallback((a,u)=>{if(g[a]){const v=g[a],N=new Date(v.date);return N.setHours(v.hour,u??0,0,0),{date:N,hour:v.hour}}return{date:new Date}},[E,g,h]),ae=c.useCallback((a,u)=>{if(a.preventDefault(),a.dataTransfer.dropEffect="move",!H?.isDragging||!H.dragState)return;const v=a.currentTarget,N=ue(a.clientX,v);if(!N)return;const{colIndex:C,minute:S}=N,{date:P,hour:ee}=oe(C,S);H.updateDragPreview(P,ee,S,u);const{originalStartDate:ne,originalEndDate:J}=H.dragState,se=J.getTime()-ne.getTime(),he=g.length;let me;{const fe=se/36e5;me=Math.max(1,Math.ceil(fe))}me=Math.min(me,he-C),M({resourceId:u,colIndex:C,spanCols:me})},[H,ue,oe,E,g.length,h.length]),xe=c.useCallback(a=>{const u=a.relatedTarget;a.currentTarget.contains(u)||M(null)},[]),le=c.useCallback((a,u)=>{a.preventDefault(),M(null),H?.isDragging&&H.endDrag()},[H]),d=c.useCallback((a,u)=>{if(!k||k.resourceId!==a)return!1;const v=Math.min(k.startCol,k.endCol),N=Math.max(k.startCol,k.endCol);return u>=v&&u<=N},[k]),I=c.useCallback((a,u)=>!Y||Y.resourceId!==a?!1:u>=Y.colIndex&&u<Y.colIndex+Y.spanCols,[Y]),K=c.useCallback((a,u,v)=>{v.button!==0&&v.pointerType==="mouse"||(l||x)&&(v.preventDefault(),B.current=!0,R({resourceId:a,startCol:u,endCol:u,isSelecting:!0}))},[l,x]),ie=c.useCallback((a,u,v)=>{if(B.current&&!(!k||k.resourceId!==a)){if(v.buttons===0){B.current=!1;return}R(N=>N?{...N,endCol:u}:null)}},[k]),ge=c.useCallback(()=>{if(!B.current||!k)return;B.current=!1;const a=Math.min(k.startCol,k.endCol),u=Math.max(k.startCol,k.endCol),v=oe(a),N=oe(u),C=new Date(v.date),S=new Date(N.date);N.hour!==void 0&&S.setHours(N.hour+1,0,0,0);const P={startDate:C,endDate:S,resourceId:k.resourceId};a===u&&x&&x(v.date,v.hour,k.resourceId),l?.(P),R(ee=>ee?{...ee,isSelecting:!1}:null),setTimeout(()=>R(null),150)},[k,oe,E,x,l]);return c.useEffect(()=>{const a=()=>{B.current&&ge()};return window.addEventListener("pointerup",a),window.addEventListener("pointercancel",a),()=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a)}},[ge]),c.useEffect(()=>{H?.isDragging||M(null)},[H?.isDragging]),e.jsx("div",{className:f.cn("flex h-full flex-col",F),children:e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:O,children:e.jsxs("div",{className:"relative",style:{minWidth:re},children:[e.jsx("div",{className:"ic-timeline-header sticky top-0 z-20 border-b bg-background",children:t>1?e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex shrink-0 items-center justify-center border-r bg-background px-2 sticky left-0 z-10",style:{width:we},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("div",{className:"flex border-b",children:h.map((a,u)=>{const v=q.isToday(a),N=u*G,C=_.slice(N,N+G).reduce((S,P)=>S+P,0);return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",v?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:C},children:e.jsx("span",{className:"text-xs",children:Ct(a)})},`day-${a.toISOString()}`)})}),e.jsx("div",{className:"flex",children:g.map((a,u)=>{const v=a.hour===z,N=q.isToday(a.date),C=_[u]??Ne;return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",v&&u>0?"border-l-2 border-l-border":"border-r border-r-border/50",N&&"bg-primary/5"),style:{width:C},children:Se(a.hour)},`hour-${a.dayIndex}-${a.hour}`)})})]})]}):e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex shrink-0 items-center border-r bg-background px-2 py-2",style:{width:we},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),g.map((a,u)=>{const v=a.hour===z,N=q.isToday(a.date),C=_[u]??Ne;return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",v&&u>0?"border-l-2 border-l-border":"border-r border-r-border/50",N&&"bg-primary/5"),style:{width:C},children:Se(a.hour)},`hour-${a.dayIndex}-${a.hour}`)})]})}),L.map(a=>{const u=X(a.maxStack);return e.jsxs("div",{className:f.cn("relative flex border-b",A?.resourceRow),style:{height:u},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:we},children:e.jsxs("div",{className:f.cn("flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",A?.resourceHeader),children:[e.jsx(Dt,{className:"size-7",src:a.user.avatar,alt:a.user.name,fallback:yt(a.user.name)}),e.jsx("span",{className:"truncate text-xs sm:text-sm font-medium",children:a.user.name})]})}),e.jsxs("div",{className:"ic-timeline-grid relative flex",onDragOver:v=>ae(v,a.user.id),onDragLeave:xe,onDrop:v=>le(v,a.user.id),children:[g.map((v,N)=>{const C=v.hour===z&&N>0,S=_[N]??Ne,P=d(a.user.id,N),ee=I(a.user.id,N),ne=!!(l||x);return e.jsx("div",{role:ne?"button":void 0,tabIndex:ne?0:void 0,"aria-label":ne?`Select ${Se(v.hour)} on ${v.date.toLocaleDateString()} for ${a.user.name}`:void 0,onPointerDown:J=>K(a.user.id,N,J),onPointerEnter:J=>ie(a.user.id,N,J),onPointerUp:ge,onKeyDown:J=>{if(ne&&(J.key==="Enter"||J.key===" ")){J.preventDefault();const se=oe(N);x?.(se.date,se.hour,a.user.id),l?.({startDate:se.date,endDate:(()=>{const he=new Date(se.date);return se.hour!==void 0&&he.setHours(se.hour+1,0,0,0),he})(),resourceId:a.user.id})}},className:f.cn("shrink-0 select-none touch-none transition-colors",ne&&"cursor-pointer",C?"border-l-2 border-l-border":"border-r border-r-border/50",q.isToday(v.date)&&"bg-primary/5",ne&&!k?.isSelecting&&!H?.isDragging&&"hover:bg-blue-50/60",P&&"bg-blue-100/70",ee&&"bg-primary/20 ring-2 ring-primary ring-inset"),style:{width:S}},`cell-${v.dayIndex}-${v.hour}`)}),a.events.map(v=>{const N=(Z[v.startCol]??0)+2,C=Z[v.startCol+v.spanCols]??Z[Z.length-1]??0,S=Z[v.startCol]??0,P=C-S-4,ee=Oe+v.stackIndex*(Te+We),ne=t===1?"timeline-day":t===3?"timeline-3day":"timeline-week",J=$?.eventCard;return e.jsx("div",{className:"absolute",style:{left:N,width:Math.max(P,0),top:ee,height:Te},children:J?e.jsx(J,{event:v.event,view:ne,isCompact:!0,onClick:()=>p?.(v.event)}):e.jsx(w.EventCard,{event:v.event,variant:"compact",enableDrag:W,onClick:p,renderPopover:y,className:f.cn("h-full w-full",A?.eventCardCompact)})},v.event.id)})]})]},a.user.id)}),L.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})})}const Tt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],St=["January","February","March","April","May","June","July","August","September","October","November","December"];function Be(t){const n=t.hexColor;return n?{backgroundColor:n}:{}}function Et({day:t,date:n,events:s,isCurrentMonth:r,onDayClick:o}){const i=q.isToday(n),p=3,x=s.length;return e.jsxs("button",{type:"button",onClick:()=>o?.(n),className:f.cn("flex h-9 sm:h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-0.5 sm:pt-1","hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-colors",!r&&"opacity-40"),children:[e.jsx("div",{className:f.cn("flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",i&&"bg-primary font-semibold text-primary-foreground"),children:t}),x>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:x<=p?s.map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Be(l)},l.id)):e.jsxs(e.Fragment,{children:[s.slice(0,p).map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Be(l)},l.id)),e.jsxs("span",{className:"text-[6px] sm:text-[7px] font-medium text-muted-foreground",children:["+",x-p]})]})})]})}function Lt({date:t,events:n,onMonthClick:s,onDayClick:r}){const o=c.useMemo(()=>q.generateMonthGrid(t,0),[t]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:()=>s?.(t),className:f.cn("w-full rounded-t-lg border px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-semibold","hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-colors"),children:St[t.getMonth()]}),e.jsxs("div",{className:"flex-1 space-y-1.5 sm:space-y-2 rounded-b-lg border border-t-0 p-2 sm:p-3",children:[e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 text-center",children:Tt.map((i,p)=>e.jsxs("div",{className:"text-[9px] sm:text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"sm:hidden",children:i[0]}),e.jsx("span",{className:"hidden sm:inline",children:i})]},p))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:o.map((i,p)=>{const x=q.getEventsForDay(n,i.date);return e.jsx(Et,{day:i.date.getDate(),date:i.date,events:x,isCurrentMonth:i.isCurrentMonth,onDayClick:r},`${p+1}-${i.date.toISOString()}`)})})]})]})}function Xe({events:t,year:n,onMonthClick:s,onDayClick:r,className:o,slots:i,classNames:p}){const x=c.useMemo(()=>q.getYearMonths(n),[n]);return e.jsxs("div",{className:f.cn("flex flex-col h-full",o),children:[e.jsx("div",{className:"flex items-center justify-center border-b px-4 py-3",children:e.jsx("h2",{className:"text-lg font-semibold",children:n})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(l=>e.jsx(Lt,{date:l,events:t,onMonthClick:s,onDayClick:r},l.getMonth()))})})]})}const Ce=200,Ht=60,It=300,zt=7,Ue=2,Ee=40,Pt=18;function At(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m18 15-6-6-6 6"})})}function Ft(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function Wt(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function Ot(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Rt({containerRef:t,currentDate:n,className:s}){const[r,o]=c.useState({canUp:!1,canDown:!1,canLeft:!1,canRight:!1}),[i,p]=c.useState({x:0,y:0}),[x,l]=c.useState(!1),j=r.canUp||r.canDown||r.canLeft||r.canRight,F=c.useRef(null),b=c.useRef(null),y=c.useRef(null),$=c.useRef(!1),A=c.useRef({x:0,y:0}),W=c.useRef({x:0,y:0}),O=c.useRef(0),H=c.useRef(null),k=c.useCallback(()=>{const m=t.current;if(!m)return;const T=4;o({canUp:m.scrollTop>T,canDown:m.scrollTop+m.clientHeight<m.scrollHeight-T,canLeft:m.scrollLeft>T,canRight:m.scrollLeft+m.clientWidth<m.scrollWidth-T})},[t]);c.useEffect(()=>{const m=t.current;if(!m)return;k(),m.addEventListener("scroll",k,{passive:!0});const T=new ResizeObserver(k);T.observe(m);const D=new MutationObserver(k);return D.observe(m,{childList:!0,subtree:!0}),()=>{m.removeEventListener("scroll",k),T.disconnect(),D.disconnect()}},[t,k]);const R=c.useCallback((m,T)=>{t.current?.scrollBy({left:m,top:T,behavior:"smooth"})},[t]),B=c.useCallback(()=>R(0,-Ce),[R]),Y=c.useCallback(()=>R(0,Ce),[R]),M=c.useCallback(()=>R(-Ce,0),[R]),V=c.useCallback(()=>R(Ce,0),[R]),E=c.useCallback(()=>{F.current&&(clearTimeout(F.current),F.current=null),b.current&&(clearInterval(b.current),b.current=null)},[]),z=c.useCallback(m=>{m(),F.current=setTimeout(()=>{b.current=setInterval(m,Ht)},It)},[]);c.useEffect(()=>E,[E]),c.useEffect(()=>{const m=t.current;if(!m)return;const T=D=>{if(D.ctrlKey||D.metaKey||D.altKey)return;const L=D.target.tagName;if(!(L==="INPUT"||L==="TEXTAREA"||D.target.isContentEditable))switch(D.key){case"ArrowUp":D.preventDefault(),B();break;case"ArrowDown":D.preventDefault(),Y();break;case"ArrowLeft":D.preventDefault(),M();break;case"ArrowRight":D.preventDefault(),V();break}};return m.addEventListener("keydown",T),()=>m.removeEventListener("keydown",T)},[t,B,Y,M,V]),c.useEffect(()=>{if(!j)return;const m=H.current;if(!m)return;let T=0;const D=()=>{const X=m.offsetParent;if(!X)return;const re=X.getBoundingClientRect(),Z=window.innerHeight;if(re.height<=Z){m.style.removeProperty("top"),m.style.removeProperty("bottom");return}const oe=Math.min(re.bottom,Z)-re.top,ae=m.offsetHeight,xe=oe-ae-12,le=12,d=X.clientHeight-ae-12,I=Math.max(le,Math.min(xe,d));m.style.top=`${I}px`,m.style.bottom="auto"},L=()=>{cancelAnimationFrame(T),T=requestAnimationFrame(D)},te=[window];let _=m.parentElement;for(;_;){const X=getComputedStyle(_);/(auto|scroll)/.test(X.overflow+X.overflowY)&&te.push(_),_=_.parentElement}for(const X of te)X.addEventListener("scroll",L,{passive:!0});return window.addEventListener("resize",L,{passive:!0}),D(),()=>{cancelAnimationFrame(T);for(const X of te)X.removeEventListener("scroll",L);window.removeEventListener("resize",L)}},[j]);const U=c.useCallback(()=>{$.current=!1,l(!1),p({x:0,y:0}),W.current={x:0,y:0},O.current&&cancelAnimationFrame(O.current)},[]),G=c.useCallback(m=>{m.preventDefault(),$.current=!0,l(!0),A.current={x:m.clientX,y:m.clientY},W.current={x:0,y:0},m.target.setPointerCapture(m.pointerId);const T=()=>{if(!$.current)return;const D=t.current;if(D){const{x:L,y:te}=W.current,_=Math.sqrt(L*L+te*te);if(_>Ue){const re=Math.min(_/Ee,1)*Pt;D.scrollLeft+=L/_*re,D.scrollTop+=te/_*re}}O.current=requestAnimationFrame(T)};O.current=requestAnimationFrame(T)},[t]),Q=c.useCallback(m=>{if(!$.current)return;const T=m.clientX-A.current.x,D=m.clientY-A.current.y;W.current={x:T,y:D};const L=Math.sqrt(T*T+D*D);if(L<Ue)p({x:0,y:0});else{const _=Math.min(L,Ee)/Ee*zt;p({x:T/L*_,y:D/L*_})}},[]),h=c.useCallback(m=>{switch(m.key){case"ArrowUp":m.preventDefault(),B();break;case"ArrowDown":m.preventDefault(),Y();break;case"ArrowLeft":m.preventDefault(),M();break;case"ArrowRight":m.preventDefault(),V();break}},[B,Y,M,V]);if(!j)return null;const g=n?n.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):null;return e.jsxs("div",{ref:H,className:`inno-scroll-nav-wrapper ${s??""}`,role:"toolbar","aria-label":"Scroll navigation",onKeyDown:h,children:[g&&e.jsx("div",{className:"inno-scroll-nav-date","aria-live":"polite",children:g}),e.jsxs("div",{className:"inno-scroll-nav",children:[e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-up ${r.canUp?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll up",disabled:!r.canUp,onPointerDown:()=>z(B),onPointerUp:E,onPointerLeave:E,tabIndex:r.canUp?0:-1,children:e.jsx(At,{})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-left ${r.canLeft?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll left",disabled:!r.canLeft,onPointerDown:()=>z(M),onPointerUp:E,onPointerLeave:E,tabIndex:r.canLeft?0:-1,children:e.jsx(Wt,{})}),e.jsx("button",{ref:y,type:"button",className:`inno-scroll-nav-joystick ${x?"inno-scroll-nav-joystick-active":""}`,"aria-label":"Drag to scroll freely",onPointerDown:G,onPointerMove:Q,onPointerUp:U,onPointerCancel:U,tabIndex:0,children:e.jsx("span",{className:"inno-scroll-nav-joystick-dot",style:{transform:`translate(${i.x}px, ${i.y}px)`}})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-right ${r.canRight?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll right",disabled:!r.canRight,onPointerDown:()=>z(V),onPointerUp:E,onPointerLeave:E,tabIndex:r.canRight?0:-1,children:e.jsx(Ot,{})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-down ${r.canDown?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll down",disabled:!r.canDown,onPointerDown:()=>z(Y),onPointerUp:E,onPointerLeave:E,tabIndex:r.canDown?0:-1,children:e.jsx(Ft,{})})]})]})}function _t(t){switch(t){case"day":case"week":return"time";default:return"day"}}function $t({onEventClick:t,onSlotClick:n,onSlotSelect:s,onAddEvent:r,alwaysShowResources:o,className:i,showHeader:p=!0,minSelectionMinutes:x=30,showMoreMode:l,showMoreEventsInPopover:j=!1,isLoading:F=!1,slots:b,classNames:y,settingsContent:$,filterContent:A,headerActions:W,renderPopover:O,calendarRef:H,headerConfig:k,eventDetailMode:R,renderEventDetail:B}){const Y=l??(j?"popover":"expand"),{view:M,setView:V,selectedDate:E,setSelectedDate:z,slotDuration:U,filteredEvents:G,users:Q,visibleHours:h,workingHours:g,badgeVariant:m,showWorkingHoursOnly:T,clearFocusEventId:D}=ke.useInnoCalendar(),L=c.useMemo(()=>{if(!T||!g)return{startHour:h.start,endHour:h.end};let d=24,I=0;for(const K of Object.keys(g)){const ie=g[Number(K)];!ie||ie.enabled===!1||(ie.from<d&&(d=ie.from),ie.to>I&&(I=ie.to))}return d>=I?{startHour:h.start,endHour:h.end}:{startHour:d,endHour:I}},[T,g,h]),te=L,_=c.useRef(null);c.useImperativeHandle(H,()=>({scrollToToday:()=>{const d=new Date;z(d,M),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const I=_.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!I)return;const ge=(d.getHours()-L.startHour)*96;ge>0&&I.scrollTo({top:Math.max(0,ge-100),behavior:"smooth"})})})},scrollToWorkingHours:()=>{let d=8;if(g)for(const I of Object.keys(g)){const K=g[Number(I)];K?.enabled&&K.from<d&&(d=Math.max(K.from-1,0))}requestAnimationFrame(()=>{requestAnimationFrame(()=>{const I=_.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!I)return;const ie=(d-L.startHour)*96;I.scrollTo({top:Math.max(0,ie),behavior:"smooth"})})})},getViewRect:()=>_.current?.getBoundingClientRect()??null,focusEvent:d=>{D(),requestAnimationFrame(()=>{D()});const I=_.current?.querySelector(`[data-event-id="${d}"]`);I&&setTimeout(()=>I.click(),150)}}),[z,M,L,g,D]);const X=c.useMemo(()=>_t(M),[M]),re=c.useCallback(d=>{if(s){s(d);return}if(n){const I=d.startDate.getHours();n(d.startDate,I)}},[s,n]),Z=c.useCallback(d=>{V("day"),z(d,"day")},[z,V]),ue=c.useCallback(d=>{V("month"),z(d,"month")},[z,V]),oe=c.useCallback(d=>{t?.(d)},[t]),ae=c.useCallback((d,I,K)=>{n?.(d,I)},[n]),xe=()=>{const d=G,I=oe,K=O;switch(M){case"day":return e.jsx(w.DayView,{events:d,date:E,visibleHours:te,workingHours:g,slotDuration:U,badgeVariant:m,onEventClick:I,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"week":return e.jsx(w.WeekView,{events:d,date:E,visibleHours:te,workingHours:g,slotDuration:U,badgeVariant:m,onEventClick:I,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"month":return e.jsx(w.MonthView,{events:d,date:E,badgeVariant:m,onEventClick:I,onDayClick:Z,renderPopover:K,showMoreMode:Y,...b&&{slots:b},...y&&{classNames:y}});case"year":return e.jsx(Xe,{events:d,year:E.getFullYear(),onMonthClick:ue,onDayClick:Z,...b&&{slots:b},...y&&{classNames:y}});case"agenda":return e.jsx(w.AgendaView,{events:d,date:E,onEventClick:I,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"resource-day":return e.jsx(ve,{daysToShow:1,events:d,users:Q,...o&&{alwaysShowResources:o},selectedDate:E,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:ae,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"resource-week":return e.jsx(ve,{daysToShow:7,events:d,users:Q,...o&&{alwaysShowResources:o},selectedDate:E,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:ae,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"timeline-day":return e.jsx(ve,{daysToShow:1,events:d,users:Q,selectedDate:E,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:ae,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"timeline-3day":return e.jsx(ve,{daysToShow:3,events:d,users:Q,selectedDate:E,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:ae,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});case"timeline-week":return e.jsx(ve,{daysToShow:7,events:d,users:Q,selectedDate:E,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:ae,renderPopover:K,...b&&{slots:b},...y&&{classNames:y}});default:return e.jsx(w.MonthView,{events:d,date:E,badgeVariant:m,onEventClick:I,onDayClick:Z,...b&&{slots:b},...y&&{classNames:y}})}},le=c.useRef(null);return c.useEffect(()=>{_.current=le.current}),e.jsx(ke.SlotSelectionProvider,{mode:X,onSelect:re,minDurationMinutes:x,slotDurationMinutes:U,enabled:!!(s||n),children:e.jsxs("div",{className:f.cn("inno-calendar-root flex flex-col h-full p-4",y?.root,i),children:[p&&e.jsx(w.CalendarHeader,{currentDate:E,view:M,events:G,onViewChange:V,onNavigateToday:()=>z(new Date,M),onNavigatePrev:()=>{const d=new Date(E);M==="day"||M==="timeline-day"||M==="resource-day"?d.setDate(d.getDate()-1):M==="timeline-3day"?d.setDate(d.getDate()-3):M==="week"||M==="timeline-week"||M==="resource-week"?d.setDate(d.getDate()-7):M==="month"?d.setMonth(d.getMonth()-1):M==="year"?d.setFullYear(d.getFullYear()-1):d.setDate(d.getDate()-7),z(d,M)},onNavigateNext:()=>{const d=new Date(E);M==="day"||M==="timeline-day"||M==="resource-day"?d.setDate(d.getDate()+1):M==="timeline-3day"?d.setDate(d.getDate()+3):M==="week"||M==="timeline-week"||M==="resource-week"?d.setDate(d.getDate()+7):M==="month"?d.setMonth(d.getMonth()+1):M==="year"?d.setFullYear(d.getFullYear()+1):d.setDate(d.getDate()+7),z(d,M)},availableViews:["day","week","month","agenda"],showTimelineViews:!0,showSettings:!!$,...!W&&r&&{onAddEvent:r},actions:W,settingsContent:$,filterContent:A,...k&&{headerConfig:k}}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:le,className:f.cn("h-full border rounded-lg bg-white overflow-x-auto",y?.viewContainer),children:xe()}),F&&e.jsx("div",{className:"inno-calendar-loading-overlay",children:e.jsx("div",{className:"inno-calendar-spinner"})}),e.jsx(Rt,{containerRef:le,currentDate:E})]})]})})}function Bt({events:t,users:n=[],alwaysShowResources:s,scheduleTypes:r=[],initialView:o="week",initialDate:i,initialSelectedUserId:p,initialScheduleTypeIds:x,initialParticipantIds:l,initialWorkingHoursView:j,initialSearchQuery:F,preferencesConfig:b,onEventClick:y,onSlotClick:$,onSlotSelect:A,onAddEvent:W,onEventDrop:O,onDateChange:H,onViewChange:k,className:R,showHeader:B=!0,minSelectionMinutes:Y=30,showMoreMode:M,showMoreEventsInPopover:V=!1,isLoading:E=!1,renderPopover:z,slots:U,classNames:G,settingsContent:Q,filterContent:h,headerActions:g,focusEventId:m,headerConfig:T,eventDetailMode:D,renderEventDetail:L},te){return e.jsx(ke.DragDropProvider,{...O&&{onEventDrop:O},children:e.jsx(ke.InnoCalendarProvider,{initialEvents:t,initialUsers:n,initialScheduleTypes:r,initialView:o,...i&&{initialDate:i},...p&&{initialSelectedUserId:p},...x&&{initialScheduleTypeIds:x},...l&&{initialParticipantIds:l},...j&&{initialWorkingHoursView:j},...F&&{initialSearchQuery:F},...b&&{preferencesConfig:b},...H&&{onDateChange:H},...k&&{onViewChange:k},...m&&{initialFocusEventId:m},children:e.jsx($t,{...y&&{onEventClick:y},...$&&{onSlotClick:$},...A&&{onSlotSelect:A},...W&&{onAddEvent:W},...s&&{alwaysShowResources:s},...z&&{renderPopover:z},className:R,showHeader:B,minSelectionMinutes:Y,...M&&{showMoreMode:M},showMoreEventsInPopover:V,isLoading:E,...U&&{slots:U},...G&&{classNames:G},settingsContent:Q,filterContent:h,headerActions:g,calendarRef:te,...T&&{headerConfig:T},...D&&{eventDetailMode:D},...L&&{renderEventDetail:L}})})})}const Ut=c.forwardRef(Bt),de=c.forwardRef(({className:t,children:n,...s},r)=>e.jsx("select",{ref:r,className:f.cn("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm","ring-offset-background","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","[&>option]:bg-background",t),...s,children:n}));de.displayName="Select";const ce=c.forwardRef(({className:t,...n},s)=>e.jsx("label",{ref:s,className:f.cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...n}));ce.displayName="Label";function Vt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function Yt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}const Kt=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}];function qt({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Slot duration",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the time slot duration for day and week calendar views.",...o},p=x=>{s||n(Number(x.target.value))};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Yt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Vt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(de,{value:t.toString(),onChange:p,disabled:s,className:"h-9 w-[128px] text-sm",children:Kt.map(x=>e.jsx("option",{value:x.value.toString(),children:x.label},x.value))})]})}function Gt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function Jt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}const Xt=[{value:"dot",label:"Dot indicator"},{value:"colored",label:"Full color"},{value:"mixed",label:"Mixed"}];function Qt({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Event display",lockedMessage:"This setting is locked by the administrator",infoMessage:"Choose how events are displayed. Dot shows a small indicator, colored fills the entire event, mixed uses both.",options:{dot:"Dot indicator",colored:"Full color",mixed:"Mixed"},...o},p=l=>i.options?.[l]??l,x=l=>{s||n(l.target.value)};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Jt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Gt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(de,{value:t,onChange:x,disabled:s,className:"h-9 w-[128px] text-sm",children:Xt.map(l=>e.jsx("option",{value:l.value,children:p(l.value)},l.value))})]})}function Zt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function en({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function tn(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}function nn({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Visible hours",from:"From",to:"To",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the visible hour range for day and week views. Hours outside this range will be hidden.",...o},p=tn(),x=j=>{if(s)return;const F=Number(j.target.value);F<t.endHour&&n({...t,startHour:F})},l=j=>{if(s)return;const F=Number(j.target.value);F>t.startHour&&n({...t,endHour:F})};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(en,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Zt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(ce,{className:"text-xs text-muted-foreground",children:i.from}),e.jsx(de,{value:t.startHour.toString(),onChange:x,disabled:s,className:"h-9 w-[88px] text-sm",children:p.map(j=>e.jsx("option",{value:j.value.toString(),disabled:j.value>=t.endHour,children:j.label},j.value))})]}),e.jsx("span",{className:"mt-5 text-muted-foreground",children:"—"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(ce,{className:"text-xs text-muted-foreground",children:i.to}),e.jsx(de,{value:t.endHour.toString(),onChange:l,disabled:s,className:"h-9 w-[88px] text-sm",children:p.map(j=>e.jsx("option",{value:j.value.toString(),disabled:j.value<=t.startHour,children:j.label},j.value))})]})]})]})}function rn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function sn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function on({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}const an=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function ln(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}const Ve={sunday:"Sun",monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat"};function cn({dayLabel:t,config:n,onChange:s,disabled:r,hourOptions:o}){const i=()=>{r||s({...n,enabled:!n.enabled})},p=l=>{if(r)return;const j=Number(l.target.value);j<n.to&&s({...n,from:j})},x=l=>{if(r)return;const j=Number(l.target.value);j>n.from&&s({...n,to:j})};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"checkbox","aria-checked":n.enabled,"aria-label":`Enable ${t}`,onClick:i,disabled:r,className:f.cn("flex size-5 shrink-0 items-center justify-center rounded border transition-colors",n.enabled?"border-primary bg-primary text-primary-foreground":"border-input bg-background",r&&"cursor-not-allowed opacity-50"),children:n.enabled&&e.jsx(on,{className:"size-3"})}),e.jsx("span",{className:f.cn("w-10 text-sm",!n.enabled&&"text-muted-foreground"),children:t}),e.jsx(de,{value:n.from.toString(),onChange:p,disabled:r||!n.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value>=n.to,children:l.label},l.value))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}),e.jsx(de,{value:n.to.toString(),onChange:x,disabled:r||!n.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value<=n.from,children:l.label},l.value))})]})}function dn({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Working hours",lockedMessage:"This setting is locked by the administrator",infoMessage:"Configure working hours for each day of the week. Non-working hours will be grayed out in day and week views.",days:Ve,...o},p=ln(),x=(l,j)=>{s||n({...t,[l]:j})};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(sn,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(rn,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:an.map(l=>e.jsx(cn,{dayLabel:i.days?.[l]??Ve[l],config:t[l],onChange:j=>x(l,j),disabled:s,hourOptions:p},l))})]})}const un={sunday:{enabled:!1,from:8,to:18},monday:{enabled:!0,from:8,to:18},tuesday:{enabled:!0,from:8,to:18},wednesday:{enabled:!0,from:8,to:18},thursday:{enabled:!0,from:8,to:18},friday:{enabled:!0,from:8,to:18},saturday:{enabled:!1,from:8,to:18}};function Le({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function xn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function hn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function He({checked:t,onCheckedChange:n,className:s,children:r}){return e.jsx("button",{type:"button",role:"checkbox","aria-checked":t,onClick:()=>n(!t),className:s,children:r})}function mn({src:t,alt:n,fallback:s,className:r}){const[o,i]=c.useState(!1);return!t||o?e.jsx("div",{className:f.cn("flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",r),children:s||"?"}):e.jsx("img",{src:t,alt:n||"",className:f.cn("object-cover",r),onError:()=>i(!0)})}function Ye({value:t,onChange:n,placeholder:s,className:r}){return e.jsxs("div",{className:f.cn("relative",r),children:[e.jsx(xn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),placeholder:s,className:"h-9 w-full rounded-lg border border-border bg-white pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]})}function Ke(t,n,s,r=.3){if(!n.trim())return t;const o=n.toLowerCase();return t.filter(i=>s(i).some(x=>x?x.toLowerCase().includes(o):!1))}const fn={title:"Filters",subtitle:"Filter calendar events",scheduleTypes:"Event Types",participants:"Participants",clearAll:"Clear all",selectAll:"Select all",unselectAll:"Unselect all",searchScheduleTypes:"Search event types...",searchParticipants:"Search participants...",noScheduleTypes:"No event types found",noParticipants:"No participants found"};function gn({scheduleTypes:t,users:n,selectedScheduleTypeIds:s,onScheduleTypeChange:r,selectedUserIds:o,onUserChange:i,onClearAll:p,className:x,scheduleTypesLoading:l=!1,usersLoading:j=!1,labels:F,getScheduleTypeName:b}){const y={...fn,...F},[$,A]=c.useState(""),[W,O]=c.useState(""),H=c.useMemo(()=>$.trim()?Ke(t,$,h=>[h.name,b?.(h)||h.name]):t,[t,$,b]),k=c.useMemo(()=>W.trim()?Ke(n,W,h=>[h.name,h.email||""]):n,[n,W]),R=H.length>0&&H.every(h=>s.includes(h.id)),B=k.length>0&&k.every(h=>o.includes(h.id)),Y=s.length+o.length,M=(h,g)=>{const m=g?[...s,h]:s.filter(T=>T!==h);r(m)},V=()=>{if(R){const h=new Set(H.map(g=>g.id));r(s.filter(g=>!h.has(g)))}else{const h=new Set([...s,...H.map(g=>g.id)]);r(Array.from(h))}},E=(h,g)=>{const m=g?[...o,h]:o.filter(T=>T!==h);i(m)},z=()=>{if(B){const h=new Set(k.map(g=>g.id));i(o.filter(g=>!h.has(g)))}else{const h=new Set([...o,...k.map(g=>g.id)]);i(Array.from(h))}},U=()=>{r([]),i([]),p?.()},G=h=>b?b(h):h.name,Q=h=>h.colorHex||h.color||"#069AD7";return e.jsxs("div",{className:f.cn("flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",x),children:[e.jsxs("header",{className:"flex items-start justify-between gap-2 px-4 pb-2 pt-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:y.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y.subtitle})]}),Y>0&&e.jsxs("button",{type:"button",onClick:U,className:"flex h-auto items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10",children:[e.jsx(hn,{className:"h-3.5 w-3.5"}),y.clearAll]})]}),e.jsx("div",{className:"h-px w-full bg-border/60"}),e.jsxs("section",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:y.scheduleTypes}),e.jsx("button",{type:"button",onClick:V,className:"text-xs font-medium text-primary transition-colors hover:text-primary/80",children:R?y.unselectAll:y.selectAll})]}),t.length>6&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Ye,{value:$,onChange:A,placeholder:y.searchScheduleTypes})}),e.jsxs("div",{className:"flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin",children:[l?Array.from({length:4}).map((h,g)=>e.jsxs("div",{className:"flex animate-pulse items-center gap-2 rounded-md border border-border/60 bg-muted/40 p-2",children:[e.jsx("div",{className:"h-5 w-5 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-3 w-24 rounded bg-muted-foreground/20"})]},`skeleton-${g}`)):H.map(h=>{const g=s.includes(h.id),m=Q(h);return e.jsxs(He,{checked:g,onCheckedChange:T=>M(h.id,T),className:f.cn("relative flex w-full cursor-pointer items-center justify-between gap-3 rounded-md border border-border bg-white px-3 py-2 transition-colors hover:border-primary/50",g&&"border-primary bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:f.cn("flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",g&&"border-primary bg-primary text-primary-foreground"),children:g&&e.jsx(Le,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:G(h)})]}),e.jsx("div",{className:"h-4 w-4 rounded-full border",style:{backgroundColor:m,borderColor:m}})]},h.id)}),!l&&H.length===0&&e.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:y.noScheduleTypes})]})]}),e.jsx("div",{className:"h-px w-full bg-border/60"}),e.jsxs("section",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:y.participants}),e.jsx(He,{checked:B,onCheckedChange:()=>z(),className:f.cn("flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",B&&"border-primary bg-primary text-primary-foreground"),children:B&&e.jsx(Le,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Ye,{value:W,onChange:O,placeholder:y.searchParticipants})}),e.jsxs("div",{className:"flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[j?Array.from({length:4}).map((h,g)=>e.jsxs("div",{className:"flex animate-pulse items-center gap-3 rounded-md border border-border/60 bg-muted/40 p-3",children:[e.jsx("div",{className:"h-5 w-5 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted-foreground/20"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 w-24 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-2 w-32 rounded bg-muted-foreground/10"})]})]},`p-skeleton-${g}`)):k.map(h=>{const g=o.includes(h.id);return e.jsxs(He,{checked:g,onCheckedChange:m=>E(h.id,m),className:f.cn("relative flex w-full cursor-pointer items-start gap-2 rounded-lg border border-border bg-white p-2 transition-colors hover:border-primary/50",g&&"border-primary bg-zinc-50"),children:[e.jsx("span",{className:f.cn("flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",g&&"border-primary bg-primary text-primary-foreground"),children:g&&e.jsx(Le,{className:"h-2.5 w-2.5"})}),e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[e.jsx(mn,{src:h.avatar??null,alt:h.name,fallback:h.name?.[0]?.toUpperCase()??"?",className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex max-w-[140px] flex-col gap-0.5 overflow-hidden",children:[e.jsx("span",{className:"line-clamp-1 text-sm font-medium text-foreground",children:h.name}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:h.email,children:h.email})]})]})]},h.id)}),!j&&k.length===0&&e.jsx("p",{className:"px-4 text-xs text-muted-foreground",children:y.noParticipants})]})]})]})}function pn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}),e.jsx("circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"})]})}function vn({scheduleTypes:t,value:n,onChange:s,allLabel:r="All types",className:o,label:i}){const p=l=>{s(l.target.value)},x=t.find(l=>String(l.id)===n);return e.jsxs("div",{className:f.cn("flex flex-col gap-1",o),children:[i&&e.jsx(ce,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[x?e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",style:{backgroundColor:x.color}}):e.jsx(pn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(de,{value:n,onChange:p,className:"h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(l=>e.jsx("option",{value:String(l.id),children:l.label},l.id))]})]})]})}function jn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function wn({users:t,value:n,onChange:s,allLabel:r="All users",className:o,label:i}){const p=x=>{s(x.target.value)};return e.jsxs("div",{className:f.cn("flex flex-col gap-1",o),children:[i&&e.jsx(ce,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[e.jsx(jn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(de,{value:n,onChange:p,className:"h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(x=>e.jsx("option",{value:x.id,children:x.name},x.id))]})]})]})}function bn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"}),e.jsx("path",{d:"M8 14h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 18h.01"}),e.jsx("path",{d:"M12 18h.01"}),e.jsx("path",{d:"M16 18h.01"})]})}function yn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M3 10h5"}),e.jsx("path",{d:"M17.5 17.5 16 16.3V14"}),e.jsx("circle",{cx:"16",cy:"16",r:"6"})]})}function kn({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Nn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function Cn(t){const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${r}`}function qe(t){const n=t.getHours(),s=t.getMinutes(),r=n>=12?"PM":"AM",o=n%12||12,i=String(s).padStart(2,"0");return`${o}:${i} ${r}`}function Dn(t){const n=qe(t.startDate),s=qe(t.endDate);return`${n} - ${s}`}function Mn(t){const n=q.addDays(new Date,1);return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Tn(t){if(q.isToday(t))return"Today";if(Mn(t))return"Tomorrow";const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=n[t.getDay()],o=s[t.getMonth()],i=t.getDate();return`${r}, ${o} ${i}`}function Sn(t,n){const s=new Map;for(const r of t){const o=Cn(r.startDate),i=s.get(o)??[];i.push(r),s.set(o,i)}return Array.from(s.entries()).map(([r,o])=>{const i=[...o].sort((x,l)=>x.startDate.getTime()-l.startDate.getTime()),p=n>0?i.slice(0,n):i;return{date:new Date(r),dateKey:r,events:p,hasMore:n>0&&i.length>n}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function En(t){const n=q.startOfDay(new Date),s=q.endOfDay(new Date);return t.filter(r=>r.startDate>=n&&r.startDate<=s).length}function Ie({className:t}){return e.jsx("div",{className:f.cn("animate-pulse rounded-md bg-muted",t)})}function Ln({event:t,onClick:n}){return e.jsxs("button",{type:"button",onClick:()=>n?.(t),className:f.cn("w-full text-left rounded-lg transition-colors","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","flex items-start gap-3 p-2"),children:[e.jsx("div",{className:"shrink-0 rounded-full mt-1.5 size-2",style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Dn(t)})]}),n&&e.jsx(kn,{className:"shrink-0 size-4 text-muted-foreground/50 mt-1"})]})}function Hn({group:t,onEventClick:n}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[e.jsx("h3",{className:f.cn("text-xs font-semibold",q.isToday(t.date)&&"text-primary"),children:Tn(t.date)}),t.hasMore&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",t.events.length," more"]})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(s=>e.jsx(Ln,{event:s,onClick:n},s.id))})]})}function In({events:t,isLoading:n=!1,className:s,daysAhead:r=7,maxEventsPerDay:o=3,onEventClick:i,onNavigateToAgenda:p}){const[x,l]=c.useState(!1),j=c.useMemo(()=>{const A=q.startOfDay(new Date),W=q.addDays(A,r);return t.filter(O=>O.endDate>=A&&O.startDate<W)},[t,r]),F=c.useMemo(()=>Sn(j,o),[j,o]),b=c.useMemo(()=>En(t),[t]),y=A=>{l(!1),i?.(A)},$=()=>{l(!1),p?.()};return e.jsxs(w.Popover,{open:x,onOpenChange:l,children:[e.jsxs(w.PopoverTrigger,{className:f.cn("relative rounded-xl hover:text-zinc-700 hover:!bg-zinc-300 !bg-zinc-200 text-zinc-600 shadow-none !px-2.5 p-2 max-h-10",s),children:[e.jsx(bn,{className:"h-4 w-4"}),b>0&&e.jsx(w.Badge,{variant:"destructive",className:"absolute -right-4 -top-4 m-3 flex h-5 w-5 items-center justify-center rounded-full bg-primary p-0 text-[10px] font-medium hover:bg-primary",children:b>99?"99+":b})]}),e.jsxs(w.PopoverContent,{className:"w-80 rounded-xl p-0",align:"end",side:"bottom",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between border-b p-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Upcoming"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:b>0?`${b} event${b>1?"s":""} today`:"No events today"})]}),p&&e.jsxs("button",{type:"button",onClick:$,className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all",e.jsx(Nn,{className:"size-3"})]})]}),e.jsx("div",{className:"max-h-80 overflow-y-auto p-2",children:n?e.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:3}).map((A,W)=>e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(Ie,{className:"h-2 w-2 rounded-full mt-2"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Ie,{className:"h-4 w-full"}),e.jsx(Ie,{className:"h-3 w-3/4"})]})]},W))}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(yn,{className:"mb-2 h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"}),e.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["Your schedule is clear for the next ",r," days"]})]}):e.jsx("div",{className:"space-y-3 divide-y",children:F.map(A=>e.jsx(Hn,{group:A,onEventClick:y},A.dateKey))})})]})]})}function zn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M3 10h5"}),e.jsx("path",{d:"M17.5 17.5 16 16.25V14"}),e.jsx("circle",{cx:"16",cy:"16",r:"6"})]})}function Qe({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Pn(t){const n=new Date;return n.setDate(n.getDate()+1),t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Ge(t){const n=t.getHours(),s=t.getMinutes(),r=n>=12?"PM":"AM";return`${n%12||12}:${s.toString().padStart(2,"0")} ${r}`}function An(t){return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"short",day:"numeric"}).format(t)}function Fn(t){const n=Ge(t.startDate),s=Ge(t.endDate);return`${n} - ${s}`}function Wn(t){return q.isToday(t)?"Today":Pn(t)?"Tomorrow":An(t)}function On(t,n){const s=new Map;for(const r of t){const o=q.formatDateISO(r.startDate),i=s.get(o)??[];i.push(r),s.set(o,i)}return Array.from(s.entries()).map(([r,o])=>{const i=[...o].sort((x,l)=>x.startDate.getTime()-l.startDate.getTime()),p=n>0?i.slice(0,n):i;return{date:new Date(r),dateKey:r,events:p,hasMore:n>0&&i.length>n}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function Rn({event:t,onClick:n,compact:s}){return e.jsxs("button",{type:"button",onClick:()=>n?.(t),className:f.cn("w-full text-left rounded-lg transition-colors","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","flex items-start gap-3",s?"p-2":"p-3"),children:[e.jsx("div",{className:f.cn("shrink-0 rounded-full mt-1",s?"size-2":"size-2.5"),style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:f.cn("font-medium truncate",s?"text-xs":"text-sm"),children:t.title}),e.jsx("p",{className:f.cn("text-muted-foreground truncate",s?"text-[10px]":"text-xs"),children:Fn(t)})]}),n&&e.jsx(Qe,{className:f.cn("shrink-0 text-muted-foreground/50",s?"size-3":"size-4")})]})}function _n({group:t,onEventClick:n,onViewMore:s,compact:r}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:f.cn("flex items-center justify-between px-2",r?"py-1":"py-1.5"),children:[e.jsx("h3",{className:f.cn("font-semibold",r?"text-xs":"text-sm",q.isToday(t.date)&&"text-primary"),children:Wn(t.date)}),t.hasMore&&s&&e.jsx("button",{type:"button",onClick:()=>s(t.date),className:f.cn("text-primary hover:underline",r?"text-[10px]":"text-xs"),children:"+more"})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(o=>e.jsx(Rn,{event:o,onClick:n,compact:r},o.id))})]})}function $n({events:t,daysAhead:n=7,maxEventsPerDay:s=3,onEventClick:r,onViewAll:o,className:i,emptyState:p,title:x="Upcoming",showHeader:l=!0,compact:j=!1}){const F=De.useOptionalCalendarContext(),b=F?.filteredEvents,y=F?.currentDate??new Date,$=t??b??[],A=c.useMemo(()=>{const H=q.startOfDay(y),k=new Date(H);return k.setDate(k.getDate()+n),$.filter(R=>R.endDate>=H&&R.startDate<k)},[$,n,y]),W=c.useMemo(()=>On(A,s),[A,s]),O=A.length;return W.length===0?e.jsxs("div",{className:f.cn("rounded-lg border bg-card",i),children:[l&&e.jsx("div",{className:f.cn("border-b px-4 flex items-center justify-between",j?"py-2":"py-3"),children:e.jsx("h2",{className:f.cn("font-semibold",j?"text-sm":"text-base"),children:x})}),e.jsx("div",{className:f.cn("flex flex-col items-center justify-center text-center",j?"py-6 px-4":"py-10 px-6"),children:p??e.jsxs(e.Fragment,{children:[e.jsx(zn,{className:f.cn("text-muted-foreground/50 mb-2",j?"size-8":"size-10")}),e.jsx("p",{className:f.cn("text-muted-foreground",j?"text-xs":"text-sm"),children:"No upcoming events"})]})})]}):e.jsxs("div",{className:f.cn("rounded-lg border bg-card overflow-hidden",i),children:[l&&e.jsxs("div",{className:f.cn("border-b px-4 flex items-center justify-between",j?"py-2":"py-3"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:f.cn("font-semibold",j?"text-sm":"text-base"),children:x}),e.jsx("span",{className:f.cn("text-muted-foreground bg-muted rounded-full px-2",j?"text-[10px] py-0":"text-xs py-0.5"),children:O})]}),o&&e.jsxs("button",{type:"button",onClick:()=>o(),className:f.cn("text-primary hover:underline flex items-center gap-0.5",j?"text-xs":"text-sm"),children:["View all",e.jsx(Qe,{className:"size-3"})]})]}),e.jsx("div",{className:f.cn("divide-y overflow-auto",j?"p-2 max-h-[280px]":"p-3 max-h-[400px]"),children:W.map(H=>e.jsx(_n,{group:H,onEventClick:r,onViewMore:o?k=>o(k):void 0,compact:j},H.dateKey))})]})}exports.AgendaDropdown=In;exports.AgendaWidget=$n;exports.BadgeVariantSetting=Qt;exports.Calendar=tt;exports.CalendarFilterSidebar=gn;exports.DEFAULT_WEEK_WORKING_HOURS=un;exports.EventPopover=vt;exports.InnoCalendar=Ut;exports.ScheduleTypeFilter=vn;exports.SlotDurationSetting=qt;exports.TimelineView=ve;exports.UserFilter=wn;exports.VisibleHoursSetting=nn;exports.WorkingHoursSetting=dn;exports.YearView=Xe;
|
|
2
|
+
//# sourceMappingURL=agenda-widget-BiZIpa3f.cjs.map
|