@innosolutions/inno-calendar 1.0.35 → 1.0.38

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.
Files changed (55) hide show
  1. package/AGENT.md +36 -1
  2. package/dist/agenda-widget-BsRtRyZ3.cjs +2 -0
  3. package/dist/agenda-widget-BsRtRyZ3.cjs.map +1 -0
  4. package/dist/{agenda-widget-CyRPG-1p.js → agenda-widget-CNUXKiQT.js} +723 -745
  5. package/dist/agenda-widget-CNUXKiQT.js.map +1 -0
  6. package/dist/components/event/event-card.d.ts +16 -1
  7. package/dist/components/event/event-card.d.ts.map +1 -1
  8. package/dist/components/event/event-page-transition.d.ts +32 -0
  9. package/dist/components/event/event-page-transition.d.ts.map +1 -0
  10. package/dist/components/index.cjs +1 -1
  11. package/dist/components/index.d.ts +1 -1
  12. package/dist/components/index.d.ts.map +1 -1
  13. package/dist/components/index.mjs +27 -26
  14. package/dist/components/inno-calendar.d.ts.map +1 -1
  15. package/dist/components/primitives/multi-day-banner.d.ts.map +1 -1
  16. package/dist/components/views/day-events-expansion.d.ts +51 -0
  17. package/dist/components/views/day-events-expansion.d.ts.map +1 -0
  18. package/dist/components/views/index.d.ts +1 -0
  19. package/dist/components/views/index.d.ts.map +1 -1
  20. package/dist/components/views/month-view.d.ts +14 -3
  21. package/dist/components/views/month-view.d.ts.map +1 -1
  22. package/dist/components/views/timeline-view.d.ts.map +1 -1
  23. package/dist/core/index.cjs +1 -1
  24. package/dist/core/index.mjs +139 -136
  25. package/dist/core/utils/date-utils.d.ts +31 -1
  26. package/dist/core/utils/date-utils.d.ts.map +1 -1
  27. package/dist/core/utils/event-utils.d.ts +40 -0
  28. package/dist/core/utils/event-utils.d.ts.map +1 -1
  29. package/dist/core/utils/position-utils.d.ts +5 -1
  30. package/dist/core/utils/position-utils.d.ts.map +1 -1
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.mjs +190 -186
  33. package/dist/presets/index.cjs +1 -1
  34. package/dist/presets/index.mjs +1 -1
  35. package/dist/styles/index.css +1 -1
  36. package/dist/{tailwind-calendar-BaJAw6io.cjs → tailwind-calendar-BqhSHRk0.cjs} +2 -2
  37. package/dist/{tailwind-calendar-BaJAw6io.cjs.map → tailwind-calendar-BqhSHRk0.cjs.map} +1 -1
  38. package/dist/{tailwind-calendar-D-8ALvNh.js → tailwind-calendar-BvWm9ry9.js} +16 -16
  39. package/dist/{tailwind-calendar-D-8ALvNh.js.map → tailwind-calendar-BvWm9ry9.js.map} +1 -1
  40. package/dist/utils.cjs +1 -1
  41. package/dist/utils.cjs.map +1 -1
  42. package/dist/utils.mjs +380 -335
  43. package/dist/utils.mjs.map +1 -1
  44. package/dist/week-view-BGthazCB.js +3015 -0
  45. package/dist/week-view-BGthazCB.js.map +1 -0
  46. package/dist/week-view-DOvr2VIq.cjs +11 -0
  47. package/dist/week-view-DOvr2VIq.cjs.map +1 -0
  48. package/package.json +1 -1
  49. package/dist/agenda-widget-CuQxfYVI.cjs +0 -2
  50. package/dist/agenda-widget-CuQxfYVI.cjs.map +0 -1
  51. package/dist/agenda-widget-CyRPG-1p.js.map +0 -1
  52. package/dist/week-view-5nw-Hvod.js +0 -2754
  53. package/dist/week-view-5nw-Hvod.js.map +0 -1
  54. package/dist/week-view-C0iWG7_6.cjs +0 -11
  55. package/dist/week-view-C0iWG7_6.cjs.map +0 -1
package/AGENT.md CHANGED
@@ -221,7 +221,8 @@ interface InnoCalendarProps<TEventData> {
221
221
  className?: string;
222
222
  showHeader?: boolean; // default: true
223
223
  minSelectionMinutes?: number; // default: 30
224
- showMoreEventsInPopover?: boolean; // default: false
224
+ showMoreEventsInPopover?: boolean; // @deprecated — use showMoreMode instead
225
+ showMoreMode?: 'expand' | 'popover' | 'dayView'; // default: 'expand'
225
226
 
226
227
  // === CUSTOM RENDERING ===
227
228
  renderPopover?: (props: {
@@ -363,6 +364,24 @@ const siteCity = eventData?.siteCity as string;
363
364
  const locationStr = [siteName, siteCity].filter(Boolean).join(", ");
364
365
  ```
365
366
 
367
+ ### All-Day / Multi-Day Time Display
368
+
369
+ All time displays use `formatEventTimeDisplay()` from `core/utils/event-utils.ts`.
370
+ All-day events show **"All day"** instead of confusing raw times like "00:00 - 23:59".
371
+
372
+ | Event Type | Display |
373
+ | --------------------- | ------------------------------------- |
374
+ | All-day (single day) | "All day" |
375
+ | All-day (multi-day) | "All day · Feb 16 – Feb 18" |
376
+ | Timed (multi-day) | "Feb 16, 09:00 – Feb 18, 17:00" |
377
+ | Timed (same day) | "09:00 - 17:00" |
378
+
379
+ Detection uses `detectAllDayEvent()` which checks `isAllDay: true` flag OR
380
+ midnight-to-midnight time boundaries (00:00:00 start, 23:59/00:00 end).
381
+
382
+ `separateEventsByDuration()` routes all-day events to the `multiDay` bucket
383
+ (banner display) even when they span only a single day.
384
+
366
385
  Display rules based on event duration:
367
386
 
368
387
  | Duration | Shows |
@@ -373,6 +392,21 @@ Display rules based on event duration:
373
392
 
374
393
  The title line format: `{title}` + optional ` - {scheduleTypeName}` in lighter weight.
375
394
 
395
+ ### Month View "Show More" Expansion
396
+
397
+ When a day cell has more events than `MAX_EVENTS_SHOWN`, the "+N more" indicator
398
+ uses one of three modes controlled by `showMoreMode`:
399
+
400
+ | Mode | Behavior |
401
+ | ---------- | ------------------------------------------------------------------------------ |
402
+ | `'expand'` | Morphing overlay (`DayEventsExpansion`) animates from cell to centered panel |
403
+ | `'popover'`| Radix popover shows all events inline |
404
+ | `'dayView'`| Redirects to day view via `onDateChange` |
405
+
406
+ Default is `'expand'`. The `DayEventsExpansion` component uses CSS transitions
407
+ (280ms, `cubic-bezier(0.32, 0.72, 0, 1)`) with phase states
408
+ (`closed` → `entering` → `open` → `exiting` → `closed`).
409
+
376
410
  ---
377
411
 
378
412
  ## 9. Integration Guide
@@ -617,6 +651,7 @@ Folders also use kebab-case: `core/`, `components/`, `presets/`.
617
651
  - **CSS custom properties** prefixed with `--inno-` or `--ic-`
618
652
  - **lucide-react** for icons (ClockIcon, UsersIcon, MapPinIcon, etc.)
619
653
  - **Radix UI** for popovers, tooltips, dropdowns, selects (optional peer deps)
654
+ - **Expansion overlay CSS**: `.ic-expansion-backdrop`, `.ic-expansion-panel` in `calendar.css`
620
655
 
621
656
  ---
622
657
 
@@ -0,0 +1,2 @@
1
+ "use strict";const e=require("react/jsx-runtime"),te=require("./use-calendar-DR89bZu5.cjs"),v=require("react"),x=require("./index-D2U2F80P.cjs"),g=require("./week-view-DOvr2VIq.cjs"),Me=require("./slot-selection-context-Bx3FKJfR.cjs"),P=require("./utils.cjs");function ze({view:t,className:s=""}){return e.jsx("div",{className:s,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 he({view:t,className:s}){return e.jsx(ze,{view:t,className:s})}function Le(t){const{events:s,resources:n,scheduleTypes:r,initialView:o="week",initialDate:i,initialFilters:f,preferences:m,locale:l,slots:c,renderEvent:w,onViewChange:C,onDateChange:E,onEventClick:I,onSlotSelect:L,onFiltersChange:N,className:p,children:D}=t,k=te.useOptionalCalendarContext();if(k)return e.jsx("div",{className:p,style:{position:"relative"},children:D??e.jsx(he,{view:k.view,className:p})});const T=te.useCalendar({events:s,resources:n,scheduleTypes:r,initialView:o,initialDate:i,initialFilters:f,preferences:m,locale:l,onViewChange:C,onDateChange:E,onEventClick:I,onSlotSelect:L,onFiltersChange:N});return e.jsx(te.CalendarProvider,{value:T,children:e.jsx("div",{className:p,style:{position:"relative"},children:D??e.jsx(he,{view:T.view,className:p})})})}function He({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 Te({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 oe({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 Ie({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 ne({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 We({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 Fe({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 Ae({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 Pe({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 Be({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 Oe({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 ee({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:x.cn("animate-spin",t),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}const _e={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."},re=v.forwardRef(({onClick:t,label:s,children:n,className:r,variant:o="ghost",...i},f)=>e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button",ref:f,onClick:t,className:x.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":s,...i,children:n})}),e.jsx(g.TooltipContent,{side:"bottom",className:"text-xs",children:s})]}));re.displayName="IconButton";function $e({src:t,alt:s,initials:n,className:r,isClient:o}){const[i,f]=v.useState(!1);return e.jsx("div",{className:x.cn("relative h-7 w-7 rounded-full overflow-hidden shrink-0",r),children:t&&!i?e.jsx("img",{src:t,alt:s,className:"h-full w-full object-cover",onError:()=>f(!0)}):e.jsx("div",{className:x.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:n})})}function me({participant:t,isEventCanceled:s=!1,labels:n}){const r=t.name||"Unknown",o=r.split(" ").map(E=>E[0]).join("").toUpperCase().slice(0,2),i=t.isOrganizer??!1,f=t.isConfirmed,m=f===!0,l=f===!1,c=t.isClient??!1,w=t.profilePicture||t.avatar,C=s;return e.jsxs("div",{className:x.cn("flex items-center gap-3 py-0",C&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx($e,{src:w,alt:r,initials:o,isClient:c,className:x.cn(C&&"grayscale")}),C||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(oe,{className:"h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]"})})}):m?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(ne,{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:x.cn("text-sm text-zinc-900 dark:text-zinc-100 truncate",C&&"line-through text-zinc-500 dark:text-zinc-500"),children:r})}),c&&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:n.client}),i&&!C&&e.jsx("div",{className:"text-xs text-zinc-500",children:n.organizer})]})]})}function Re({open:t,onOpenChange:s,title:n,children:r}){return v.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&s(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,s]),v.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:()=>s(!1),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&s(!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:[n&&e.jsx("div",{className:"sr-only",children:n}),r]})})]}):null}function Ve({open:t,onOpenChange:s,title:n,description:r,cancelLabel:o,confirmLabel:i,onConfirm:f,isLoading:m}){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:()=>s(!1),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&s(!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:n}),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(g.Button,{variant:"outline",size:"sm",onClick:()=>s(!1),children:o}),e.jsxs(g.Button,{variant:"destructive",size:"sm",onClick:f,disabled:m,children:[m&&e.jsx(ee,{className:"h-4 w-4 mr-2"}),e.jsx(Te,{className:"h-4 w-4 mr-2"}),i]})]})]})})]}):null}function Ue(t,s){return t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function Ye(t,s){const n={hour:"2-digit",minute:"2-digit",hour12:!1};return`${t.toLocaleTimeString(void 0,n)} – ${s.toLocaleTimeString(void 0,n)}`}function Ge(t){return t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function qe(t){const[s,n]=v.useState(()=>typeof window<"u"?window.matchMedia(t).matches:!1);return v.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(t),o=i=>n(i.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),s}function fe({event:t,labels:s,isLoading:n,onClose:r,onEdit:o,onDelete:i,onCancel:f,onAccept:m,onDecline:l,onConfirmMeeting:c,canEdit:w=!0,canDelete:C=!1,canCancel:E=!0,isCurrentUserParticipant:I=!1,isCurrentUserClient:L=!1,currentUserAcceptStatus:N,isAcceptLoading:p=!1,isDeclineLoading:D=!1,isConfirmLoading:k=!1,isDeleteLoading:T=!1,renderParticipant:H,renderHeaderActions:q,renderCancelReason:U,renderDeleteConfirmation:O,formatDate:W=Ue,formatTimeRange:R=Ye}){const[_,F]=v.useState(!1),Y=!(t.isCanceled||t.meetingTookPlace),h=t.isRecurring??!1,a=t.participantDetails,u=t.participantsNames||[],j=a&&a.length>0,b=N===!0,y=N===!1,z=I&&!L&&Y,M=j?a.filter(V=>V.isConfirmed).length:t.isAccepted?u.length:0,$=j?a.length:u.length,J=t.scheduleTypeColor||t.hexColor||"#039BE5",K=v.useCallback(()=>t.startDate?W(t.startDate):s.noDateProvided,[t.startDate,W,s.noDateProvided]),d=v.useCallback(()=>t.startDate&&t.endDate?R(t.startDate,t.endDate):null,[t.startDate,t.endDate,R]),S=()=>{r(),o?.(t)},A=()=>{r(),f?.(t)},B=()=>{F(!0)},G=()=>{i?.(t),F(!1)};return n?e.jsx("div",{className:"flex h-48 items-center justify-center",children:e.jsx(ee,{className:"h-6 w-6 text-zinc-400"})}):e.jsxs(g.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:q?q({onClose:r}):e.jsxs(e.Fragment,{children:[Y&&w&&o&&e.jsx(re,{onClick:S,label:s.edit,children:e.jsx(He,{className:"h-[18px] w-[18px]"})}),Y&&E&&f&&e.jsx(re,{onClick:A,label:s.cancel,children:e.jsx(Ie,{className:"h-[18px] w-[18px]"})}),C&&i&&e.jsx(re,{onClick:B,label:s.delete,variant:"destructive",children:e.jsx(Te,{className:"h-[18px] w-[18px]"})}),e.jsx(re,{onClick:r,label:s.close,children:e.jsx(oe,{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:J}}),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:x.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(We,{className:"h-3 w-3"}),s.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(oe,{className:"h-3 w-3"}),s.canceled]})]}),e.jsxs("div",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{children:K()}),d()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:d()})]})]}),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:U?U(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:s.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:[s.canceledOn," ",Ge(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(Pe,{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})]}),(j||u.length>0)&&e.jsxs("div",{className:"flex items-start gap-2 py-0",children:[e.jsx(Ae,{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:[$," ",$!==1?s.guests:s.guest]}),$>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",M," ",s.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[j?a.slice(0,6).map((V,X)=>H?H(V,X):e.jsx(me,{participant:V,isEventCanceled:t.isCanceled,labels:s},V.id)):u.slice(0,6).map((V,X)=>{const xe={id:String(X),name:V,email:"",isConfirmed:t.isAccepted,isOrganizer:X===0,isClient:!1};return H?H(xe,X):e.jsx(me,{participant:xe,isEventCanceled:t.isCanceled,labels:s},V)}),$>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",$-6," ",s.more]})]})]})]}),t.description&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Oe,{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(Be,{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:j&&a.find(V=>V.isOrganizer)?.name||u[0]||"Calendar"})]})]}),z&&m&&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(g.DropdownMenu,{children:[e.jsx(g.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(g.Button,{size:"sm",variant:"outline",className:x.cn("rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",b&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:V=>{V.stopPropagation(),b||m(t)},disabled:p,children:p?e.jsx(ee,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[b&&e.jsx(ne,{className:"h-3.5 w-3.5"}),s.going]})}),e.jsx(g.Button,{size:"sm",variant:"outline",className:x.cn("rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",b&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(g.DropdownMenuContent,{align:"start",children:[e.jsxs(g.DropdownMenuItem,{className:x.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",b&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>m(t),children:[e.jsx(ne,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),s.acceptThisEvent]}),e.jsxs(g.DropdownMenuItem,{onClick:()=>m(t),children:[e.jsx(ne,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),s.acceptAllEvents]})]})]}):e.jsx(g.Button,{size:"sm",variant:"outline",className:x.cn("gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",b&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{b||m(t)},disabled:p,children:p?e.jsx(ee,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[b&&e.jsx(ne,{className:"h-3.5 w-3.5"}),s.going]})}),e.jsx(g.Button,{size:"sm",variant:"outline",className:x.cn("gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",y&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{y||l(t)},disabled:D,children:D?e.jsx(ee,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[y&&e.jsx(oe,{className:"h-3.5 w-3.5"}),s.notGoing]})})]})}),I&&b&&!t.meetingTookPlace&&!t.isCanceled&&c&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(g.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:()=>c(t),disabled:k,children:[k&&e.jsx(ee,{className:"h-4 w-4 mr-2"}),s.confirmMeeting]})})]}),O?_&&O({onConfirm:G,onCancel:()=>F(!1),isLoading:T}):e.jsx(Ve,{open:_,onOpenChange:F,title:s.deleteConfirmTitle,description:s.deleteConfirmDescription,cancelLabel:s.cancel,confirmLabel:s.delete,onConfirm:G,isLoading:T})]})}function Ke({event:t,children:s,open:n,onOpenChange:r,isLoading:o,labels:i,onEdit:f,onDelete:m,onCancel:l,onAccept:c,onDecline:w,onConfirmMeeting:C,canEdit:E=!0,canDelete:I=!1,canCancel:L=!0,isCurrentUserParticipant:N,isCurrentUserClient:p,currentUserAcceptStatus:D,isAcceptLoading:k,isDeclineLoading:T,isConfirmLoading:H,isDeleteLoading:q,renderParticipant:U,renderHeaderActions:O,renderCancelReason:W,renderDeleteConfirmation:R,formatDate:_,formatTimeRange:F,className:Y,width:h=360}){const a=qe("(min-width: 768px)"),u={..._e,...i},j=v.useCallback(()=>{r?.(!1)},[r]),b={event:t,labels:u,isLoading:o,onClose:j,onEdit:f,onDelete:m,onCancel:l,onAccept:c,onDecline:w,onConfirmMeeting:C,canEdit:E,canDelete:I,canCancel:L,isCurrentUserParticipant:N,isCurrentUserClient:p,currentUserAcceptStatus:D,isAcceptLoading:k,isDeclineLoading:T,isConfirmLoading:H,isDeleteLoading:q,renderParticipant:U,renderHeaderActions:O,renderCancelReason:W,renderDeleteConfirmation:R,formatDate:_,formatTimeRange:F};return a?e.jsxs(g.Popover,{open:n??!1,onOpenChange:r??(()=>{}),children:[e.jsx(g.PopoverTrigger,{asChild:!0,children:s}),e.jsx(g.PopoverContent,{className:x.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",Y),style:{width:h},align:"center",side:"bottom",sideOffset:4,children:e.jsx(fe,{...b})})]}):e.jsxs(e.Fragment,{children:[s,e.jsx(Re,{open:n??!1,onOpenChange:r??(()=>{}),title:t.title,children:e.jsx(fe,{...b})})]})}const ae=44,ge=4,Je=56,pe=8,le=80,se=140,je=100,ve=2,Xe=8,Qe=18;function Ze(t){return t.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2)}function et(t,s){const n=[];for(let r=0;r<s;r++){const o=new Date(t);o.setDate(o.getDate()+r),n.push(o)}return n}function tt(t,s,n){const r=[];return t.forEach((o,i)=>{for(let f=s;f<n;f++)r.push({hour:f,dayIndex:i,date:o})}),r}function st(t){return`${t.toString().padStart(2,"0")}:00`}function nt(t){return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function we(t){const s=[...t].sort((o,i)=>o.startCol!==i.startCol?o.startCol-i.startCol:i.spanCols-o.spanCols),n=[],r=[];for(const o of s){let i=0;for(;r[i]!==void 0&&r[i]>o.startCol;)i++;r[i]=o.startCol+o.spanCols,n.push({...o,stackIndex:i})}return n}function rt({src:t,alt:s,fallback:n,className:r}){return e.jsx("div",{className:x.cn("relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",r),children:t?e.jsx("img",{src:t,alt:s,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:n})})}const ot=7;function ie({daysToShow:t=ot,events:s,users:n=[],selectedDate:r,onDateChange:o,onEventClick:i,visibleHours:f,className:m,getEventUserId:l,renderPopover:c,slots:w,classNames:C}){const E=v.useRef(null),I=r??new Date,L=!0,N=f?.from??Xe,p=f?.to??Qe,D=p-N,k=v.useMemo(()=>{const a=new Date(I);if(t===1||t===3)return a.setHours(0,0,0,0),a;const u=a.getDay(),j=u===0?-6:1-u;return a.setDate(a.getDate()+j),a.setHours(0,0,0,0),a},[I,t]),T=v.useMemo(()=>et(k,t),[k,t]),H=v.useMemo(()=>tt(T,N,p),[L,T,N,p]),U=l??(a=>{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}),O=v.useMemo(()=>{const a=new Map;for(const u of n)a.set(u.id,{id:u.id,name:u.name,avatar:u.avatar??void 0,email:u.email});for(const u of s){const b=u.data?.user;b?.id&&!a.has(b.id)&&a.set(b.id,{id:b.id,name:b.name??"",avatar:b.avatar??void 0,email:b.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 y of u.participants||[])y.id&&!a.has(y.id)&&a.set(y.id,{id:y.id,name:y.name,avatar:y.avatar??void 0,email:y.email})}return Array.from(a.values())},[n,s]),W=v.useMemo(()=>{const a=[],u=new Map;for(const y of O)u.set(y.id,[]);u.set("unassigned",[]);for(const y of s){const z=U(y)??"unassigned";(u.get(z)??u.get("unassigned")).push(y)}const j=y=>{const z=[];for(const M of y){const $=M.startDate.getHours()+M.startDate.getMinutes()/60,J=M.endDate.getHours()+M.endDate.getMinutes()/60;for(let K=0;K<T.length;K++){const d=T[K],S=P.startOfDay(d),A=P.endOfDay(d);if(M.startDate<=A&&M.endDate>=S){let B=N,G=p;if(M.startDate>=S&&(B=Math.max(N,$)),M.endDate<=A&&(G=Math.min(p,J)),B=Math.max(N,Math.min(p,B)),G=Math.max(N,Math.min(p,G)),G>B){const V=K*D+Math.floor(B-N),X=K*D+Math.ceil(G-N);z.push({event:M,startCol:V,spanCols:Math.max(1,X-V)})}}}}return z};for(const y of O){const z=u.get(y.id)??[],M=j(z),$=we(M),J=$.reduce((K,d)=>Math.max(K,d.stackIndex+1),0);a.push({user:y,events:$,maxStack:Math.max(J,1)})}const b=u.get("unassigned")??[];if(b.length>0){const y=j(b),z=we(y),M=z.reduce(($,J)=>Math.max($,J.stackIndex+1),0);a.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:z,maxStack:Math.max(M,1)})}return a.filter(y=>y.events.length>0)},[O,s,T,L,D,N,p,U]),R=v.useMemo(()=>{const a=new Map;for(const u of W)for(const j of u.events)if(j.spanCols===1){const b=a.get(j.startCol)??0;a.set(j.startCol,b+1)}return a},[W]),_=v.useMemo(()=>{const a=H.length,u=le,j=[];for(let b=0;b<a;b++){const y=R.get(b)??0;y>ve?j.push(je+(y-ve)*20):y>0?j.push(Math.max(u,je)):j.push(u)}return j},[L,H.length,T.length,R]),F=a=>Math.max(Je,a*(ae+ge)+pe*2),Y=se+_.reduce((a,u)=>a+u,0),h=v.useMemo(()=>{const a=[0];for(let u=0;u<_.length;u++)a.push(a[u]+_[u]);return a},[_]);return v.useLayoutEffect(()=>{const a=E.current;if(!a)return;const u=()=>{let j=-1;const y=new Date().getHours();{for(let z=0;z<H.length;z++){const M=H[z];if(M&&P.isToday(M.date)&&M.hour<=y&&M.hour+1>y){j=z;break}}if(j===-1)for(let z=0;z<H.length;z++){const M=H[z];if(M&&P.isToday(M.date)){j=z;break}}}if(j!==-1){const z=(h[j]??0)+se,M=a.clientWidth,$=Math.max(0,z-M/3);a.scrollTo({left:$,behavior:"instant"})}};requestAnimationFrame(()=>{requestAnimationFrame(u)})},[I,H,T,h,L]),e.jsx("div",{className:x.cn("flex h-full flex-col",m),children:e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:E,children:e.jsxs("div",{className:"relative",style:{minWidth:Y},children:[e.jsx("div",{className:"ic-timeline-header sticky top-0 z-20 border-b bg-background",children:e.jsxs("div",{className:"flex flex-col",children:[t>1&&e.jsxs("div",{className:"flex border-b",children:[e.jsx("div",{className:"flex shrink-0 items-center border-r bg-background px-2 py-1",style:{width:se},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),T.map((a,u)=>{const j=P.isToday(a),b=u*D,y=_.slice(b,b+D).reduce((z,M)=>z+M,0);return e.jsx("div",{className:x.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",j?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:y},children:e.jsx("span",{className:"text-xs",children:nt(a)})},`day-${a.toISOString()}`)})]}),e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:x.cn("flex shrink-0 items-center border-r bg-background px-2 py-2",t>1&&"sticky left-0 z-10"),style:{width:se},children:t===1&&e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),H.map((a,u)=>{const j=a.hour===N,b=P.isToday(a.date),y=_[u]??le;return e.jsx("div",{className:x.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",j&&u>0?"border-l-2 border-l-border":"border-r border-r-border/50",b&&"bg-primary/5"),style:{width:y},children:st(a.hour)},`hour-${a.dayIndex}-${a.hour}`)})]})]})}),W.map(a=>{const u=F(a.maxStack);return e.jsxs("div",{className:x.cn("relative flex border-b",C?.resourceRow),style:{height:u},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:se},children:e.jsxs("div",{className:x.cn("flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",C?.resourceHeader),children:[e.jsx(rt,{className:"size-7",src:a.user.avatar,alt:a.user.name,fallback:Ze(a.user.name)}),e.jsx("span",{className:"truncate text-xs sm:text-sm font-medium",children:a.user.name})]})}),e.jsxs("div",{className:"relative flex",children:[H.map((j,b)=>{const y=j.hour===N&&b>0,z=_[b]??le;return e.jsx("div",{className:x.cn("shrink-0",y?"border-l-2 border-l-border":"border-r border-r-border/50",P.isToday(j.date)&&"bg-primary/5"),style:{width:z}},`cell-${j.dayIndex}-${j.hour}`)}),a.events.map(j=>{const b=(h[j.startCol]??0)+2,y=h[j.startCol+j.spanCols]??h[h.length-1]??0,z=h[j.startCol]??0,M=y-z-4,$=pe+j.stackIndex*(ae+ge);return e.jsx("div",{className:"absolute",style:{left:b,width:Math.max(M,0),top:$,height:ae},children:e.jsx(g.EventCard,{event:j.event,variant:"compact",onClick:i,renderPopover:c,className:x.cn("h-full w-full",C?.eventCardCompact)})},j.event.id)})]})]},a.user.id)}),W.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})})}const it=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],at=["January","February","March","April","May","June","July","August","September","October","November","December"];function be(t){const s=t.hexColor;return s?{backgroundColor:s}:{}}function lt({day:t,date:s,events:n,isCurrentMonth:r,onDayClick:o}){const i=P.isToday(s),f=3,m=n.length;return e.jsxs("button",{type:"button",onClick:()=>o?.(s),className:x.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:x.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}),m>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:m<=f?n.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:[n.slice(0,f).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:["+",m-f]})]})})]})}function ct({date:t,events:s,onMonthClick:n,onDayClick:r}){const o=v.useMemo(()=>P.generateMonthGrid(t,0),[t]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:()=>n?.(t),className:x.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:at[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:it.map((i,f)=>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})]},f))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:o.map((i,f)=>{const m=P.getEventsForDay(s,i.date);return e.jsx(lt,{day:i.date.getDate(),date:i.date,events:m,isCurrentMonth:i.isCurrentMonth,onDayClick:r},`${f+1}-${i.date.toISOString()}`)})})]})]})}function Se({events:t,year:s,onMonthClick:n,onDayClick:r,className:o,slots:i,classNames:f}){const m=v.useMemo(()=>P.getYearMonths(s),[s]);return e.jsxs("div",{className:x.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:s})}),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:m.map(l=>e.jsx(ct,{date:l,events:t,onMonthClick:n,onDayClick:r},l.getMonth()))})})]})}function dt(t){switch(t){case"day":case"week":return"time";default:return"day"}}function ut({onEventClick:t,onSlotClick:s,onSlotSelect:n,onAddEvent:r,className:o,showHeader:i=!0,minSelectionMinutes:f=30,showMoreEventsInPopover:m=!1,isLoading:l=!1,slots:c,classNames:w,settingsContent:C,filterContent:E,headerActions:I,renderPopover:L,calendarRef:N}){const{view:p,setView:D,selectedDate:k,setSelectedDate:T,slotDuration:H,filteredEvents:q,users:U,visibleHours:O,workingHours:W,badgeVariant:R,showWorkingHoursOnly:_}=te.useInnoCalendar(),F=v.useMemo(()=>{if(!_||!W)return{startHour:O.start,endHour:O.end};let d=24,S=0;for(const A of Object.keys(W)){const B=W[Number(A)];!B||B.enabled===!1||(B.from<d&&(d=B.from),B.to>S&&(S=B.to))}return d>=S?{startHour:O.start,endHour:O.end}:{startHour:d,endHour:S}},[_,W,O]),Y=F,h=v.useRef(null);v.useImperativeHandle(N,()=>({scrollToToday:()=>{const d=new Date;T(d,p),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const S=h.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!S)return;const G=(d.getHours()-F.startHour)*96;G>0&&S.scrollTo({top:Math.max(0,G-100),behavior:"smooth"})})})},scrollToWorkingHours:()=>{let d=8;if(W)for(const S of Object.keys(W)){const A=W[Number(S)];A?.enabled&&A.from<d&&(d=Math.max(A.from-1,0))}requestAnimationFrame(()=>{requestAnimationFrame(()=>{const S=h.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!S)return;const B=(d-F.startHour)*96;S.scrollTo({top:Math.max(0,B),behavior:"smooth"})})})},getViewRect:()=>h.current?.getBoundingClientRect()??null}),[T,p,F,W]);const a=v.useMemo(()=>dt(p),[p]),u=v.useCallback(d=>{if(n){n(d);return}if(s){const S=d.startDate.getHours();s(d.startDate,S)}},[n,s]),j=v.useCallback(d=>{D("day"),T(d,"day")},[T,D]),b=v.useCallback(d=>{D("month"),T(d,"month")},[T,D]),y=v.useCallback(d=>{t?.(d)},[t]),z=()=>{const d=q,S=y,A=L;switch(p){case"day":return e.jsx(g.DayView,{events:d,date:k,visibleHours:Y,workingHours:W,slotDuration:H,badgeVariant:R,onEventClick:S,renderPopover:A,...c&&{slots:c},...w&&{classNames:w}});case"week":return e.jsx(g.WeekView,{events:d,date:k,visibleHours:Y,workingHours:W,slotDuration:H,badgeVariant:R,onEventClick:S,renderPopover:A,...c&&{slots:c},...w&&{classNames:w}});case"month":return e.jsx(g.MonthView,{events:d,date:k,badgeVariant:R,onEventClick:S,onDayClick:j,renderPopover:A,showMoreEventsInPopover:m,...c&&{slots:c},...w&&{classNames:w}});case"year":return e.jsx(Se,{events:d,year:k.getFullYear(),onMonthClick:b,onDayClick:j,...c&&{slots:c},...w&&{classNames:w}});case"agenda":return e.jsx(g.AgendaView,{events:d,date:k,onEventClick:S,renderPopover:A,...c&&{slots:c},...w&&{classNames:w}});case"timeline-day":return e.jsx(ie,{daysToShow:1,events:d,users:U,selectedDate:k,visibleHours:{from:F.startHour,to:F.endHour},onEventClick:S,renderPopover:A,...c&&{slots:c},...w&&{classNames:w}});case"timeline-3day":return e.jsx(ie,{daysToShow:3,events:d,users:U,selectedDate:k,visibleHours:{from:F.startHour,to:F.endHour},onEventClick:S,renderPopover:A,...c&&{slots:c},...w&&{classNames:w}});case"timeline-week":return e.jsx(ie,{daysToShow:7,events:d,users:U,selectedDate:k,visibleHours:{from:F.startHour,to:F.endHour},onEventClick:S,renderPopover:A,...c&&{slots:c},...w&&{classNames:w}});default:return e.jsx(g.MonthView,{events:d,date:k,badgeVariant:R,onEventClick:S,onDayClick:j,...c&&{slots:c},...w&&{classNames:w}})}},M=v.useRef(null),[$,J]=v.useState(!1);v.useEffect(()=>{h.current=M.current}),v.useEffect(()=>{const d=M.current;if(!d)return;const S=()=>{const{scrollLeft:G,scrollWidth:V,clientWidth:X}=d;J(G+X<V-4)};S(),d.addEventListener("scroll",S,{passive:!0});const A=new ResizeObserver(S);A.observe(d);const B=new MutationObserver(S);return B.observe(d,{childList:!0,subtree:!0}),()=>{d.removeEventListener("scroll",S),A.disconnect(),B.disconnect()}},[p]);const K=v.useCallback(()=>{M.current?.scrollBy({left:300,behavior:"smooth"})},[]);return e.jsx(Me.SlotSelectionProvider,{mode:a,onSelect:u,minDurationMinutes:f,slotDurationMinutes:H,enabled:!!(n||s),children:e.jsxs("div",{className:x.cn("inno-calendar-root flex flex-col h-full p-4",w?.root,o),children:[i&&e.jsx(g.CalendarHeader,{currentDate:k,view:p,events:q,onViewChange:D,onNavigateToday:()=>T(new Date,p),onNavigatePrev:()=>{const d=new Date(k);p==="day"||p==="timeline-day"?d.setDate(d.getDate()-1):p==="timeline-3day"?d.setDate(d.getDate()-3):p==="week"||p==="timeline-week"?d.setDate(d.getDate()-7):p==="month"?d.setMonth(d.getMonth()-1):p==="year"?d.setFullYear(d.getFullYear()-1):d.setDate(d.getDate()-7),T(d,p)},onNavigateNext:()=>{const d=new Date(k);p==="day"||p==="timeline-day"?d.setDate(d.getDate()+1):p==="timeline-3day"?d.setDate(d.getDate()+3):p==="week"||p==="timeline-week"?d.setDate(d.getDate()+7):p==="month"?d.setMonth(d.getMonth()+1):p==="year"?d.setFullYear(d.getFullYear()+1):d.setDate(d.getDate()+7),T(d,p)},availableViews:["day","week","month","agenda"],showTimelineViews:!0,showSettings:!!C,...!I&&r&&{onAddEvent:r},actions:I,settingsContent:C,filterContent:E}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:M,className:x.cn("h-full border rounded-lg bg-white overflow-x-auto",w?.viewContainer),children:z()}),l&&e.jsx("div",{className:"inno-calendar-loading-overlay",children:e.jsx("div",{className:"inno-calendar-spinner"})}),$&&e.jsx("button",{type:"button",onClick:K,className:"inno-scroll-right-btn","aria-label":"Scroll right",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("title",{children:"Scroll right"}),e.jsx("path",{d:"m9 18 6-6-6-6"})]})})]})]})})}function xt({events:t,users:s=[],scheduleTypes:n=[],initialView:r="week",initialDate:o,initialSelectedUserId:i,initialScheduleTypeIds:f,initialParticipantIds:m,initialWorkingHoursView:l,initialSearchQuery:c,preferencesConfig:w,onEventClick:C,onSlotClick:E,onSlotSelect:I,onAddEvent:L,onEventDrop:N,onDateChange:p,onViewChange:D,className:k,showHeader:T=!0,minSelectionMinutes:H=30,showMoreEventsInPopover:q=!1,isLoading:U=!1,renderPopover:O,slots:W,classNames:R,settingsContent:_,filterContent:F,headerActions:Y},h){return e.jsx(Me.DragDropProvider,{...N&&{onEventDrop:N},children:e.jsx(te.InnoCalendarProvider,{initialEvents:t,initialUsers:s,initialScheduleTypes:n,initialView:r,...o&&{initialDate:o},...i&&{initialSelectedUserId:i},...f&&{initialScheduleTypeIds:f},...m&&{initialParticipantIds:m},...l&&{initialWorkingHoursView:l},...c&&{initialSearchQuery:c},...w&&{preferencesConfig:w},...p&&{onDateChange:p},...D&&{onViewChange:D},children:e.jsx(ut,{...C&&{onEventClick:C},...E&&{onSlotClick:E},...I&&{onSlotSelect:I},...L&&{onAddEvent:L},...O&&{renderPopover:O},className:k,showHeader:T,minSelectionMinutes:H,showMoreEventsInPopover:q,isLoading:U,...W&&{slots:W},...R&&{classNames:R},settingsContent:_,filterContent:F,headerActions:Y,calendarRef:h})})})}const ht=v.forwardRef(xt),Z=v.forwardRef(({className:t,children:s,...n},r)=>e.jsx("select",{ref:r,className:x.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),...n,children:s}));Z.displayName="Select";const Q=v.forwardRef(({className:t,...s},n)=>e.jsx("label",{ref:n,className:x.cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...s}));Q.displayName="Label";function mt({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 ft({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 gt=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}];function pt({value:t,onChange:s,isLocked:n=!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},f=m=>{n||s(Number(m.target.value))};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"text-sm font-semibold",children:i.title}),n?e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(ft,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(mt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(Z,{value:t.toString(),onChange:f,disabled:n,className:"h-9 w-[128px] text-sm",children:gt.map(m=>e.jsx("option",{value:m.value.toString(),children:m.label},m.value))})]})}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("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}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("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 wt=[{value:"dot",label:"Dot indicator"},{value:"colored",label:"Full color"},{value:"mixed",label:"Mixed"}];function bt({value:t,onChange:s,isLocked:n=!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},f=l=>i.options?.[l]??l,m=l=>{n||s(l.target.value)};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"text-sm font-semibold",children:i.title}),n?e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(vt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(jt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(Z,{value:t,onChange:m,disabled:n,className:"h-9 w-[128px] text-sm",children:wt.map(l=>e.jsx("option",{value:l.value,children:f(l.value)},l.value))})]})}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("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function kt({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 Nt(){return Array.from({length:25},(t,s)=>({value:s,label:`${String(s).padStart(2,"0")}:00`}))}function Ct({value:t,onChange:s,isLocked:n=!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},f=Nt(),m=c=>{if(n)return;const w=Number(c.target.value);w<t.endHour&&s({...t,startHour:w})},l=c=>{if(n)return;const w=Number(c.target.value);w>t.startHour&&s({...t,endHour:w})};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"text-sm font-semibold",children:i.title}),n?e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(kt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(yt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.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(Q,{className:"text-xs text-muted-foreground",children:i.from}),e.jsx(Z,{value:t.startHour.toString(),onChange:m,disabled:n,className:"h-9 w-[88px] text-sm",children:f.map(c=>e.jsx("option",{value:c.value.toString(),disabled:c.value>=t.endHour,children:c.label},c.value))})]}),e.jsx("span",{className:"mt-5 text-muted-foreground",children:"—"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Q,{className:"text-xs text-muted-foreground",children:i.to}),e.jsx(Z,{value:t.endHour.toString(),onChange:l,disabled:n,className:"h-9 w-[88px] text-sm",children:f.map(c=>e.jsx("option",{value:c.value.toString(),disabled:c.value<=t.startHour,children:c.label},c.value))})]})]})]})}function Dt({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 Mt({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 Tt({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 St=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function Et(){return Array.from({length:25},(t,s)=>({value:s,label:`${String(s).padStart(2,"0")}:00`}))}const ye={sunday:"Sun",monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat"};function zt({dayLabel:t,config:s,onChange:n,disabled:r,hourOptions:o}){const i=()=>{r||n({...s,enabled:!s.enabled})},f=l=>{if(r)return;const c=Number(l.target.value);c<s.to&&n({...s,from:c})},m=l=>{if(r)return;const c=Number(l.target.value);c>s.from&&n({...s,to:c})};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"checkbox","aria-checked":s.enabled,"aria-label":`Enable ${t}`,onClick:i,disabled:r,className:x.cn("flex size-5 shrink-0 items-center justify-center rounded border transition-colors",s.enabled?"border-primary bg-primary text-primary-foreground":"border-input bg-background",r&&"cursor-not-allowed opacity-50"),children:s.enabled&&e.jsx(Tt,{className:"size-3"})}),e.jsx("span",{className:x.cn("w-10 text-sm",!s.enabled&&"text-muted-foreground"),children:t}),e.jsx(Z,{value:s.from.toString(),onChange:f,disabled:r||!s.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value>=s.to,children:l.label},l.value))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}),e.jsx(Z,{value:s.to.toString(),onChange:m,disabled:r||!s.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value<=s.from,children:l.label},l.value))})]})}function Lt({value:t,onChange:s,isLocked:n=!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:ye,...o},f=Et(),m=(l,c)=>{n||s({...t,[l]:c})};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"text-sm font-semibold",children:i.title}),n?e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(Mt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(g.TooltipProvider,{delayDuration:100,children:e.jsxs(g.Tooltip,{children:[e.jsx(g.TooltipTrigger,{children:e.jsx(Dt,{className:"size-3 text-muted-foreground"})}),e.jsx(g.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:St.map(l=>e.jsx(zt,{dayLabel:i.days?.[l]??ye[l],config:t[l],onChange:c=>m(l,c),disabled:n,hourOptions:f},l))})]})}const Ht={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 ce({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 It({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 Wt({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 de({checked:t,onCheckedChange:s,className:n,children:r}){return e.jsx("button",{type:"button",role:"checkbox","aria-checked":t,onClick:()=>s(!t),className:n,children:r})}function Ft({src:t,alt:s,fallback:n,className:r}){const[o,i]=v.useState(!1);return!t||o?e.jsx("div",{className:x.cn("flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",r),children:n||"?"}):e.jsx("img",{src:t,alt:s||"",className:x.cn("object-cover",r),onError:()=>i(!0)})}function ke({value:t,onChange:s,placeholder:n,className:r}){return e.jsxs("div",{className:x.cn("relative",r),children:[e.jsx(It,{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=>s(o.target.value),placeholder:n,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 Ne(t,s,n,r=.3){if(!s.trim())return t;const o=s.toLowerCase();return t.filter(i=>n(i).some(m=>m?m.toLowerCase().includes(o):!1))}const At={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 Pt({scheduleTypes:t,users:s,selectedScheduleTypeIds:n,onScheduleTypeChange:r,selectedUserIds:o,onUserChange:i,onClearAll:f,className:m,scheduleTypesLoading:l=!1,usersLoading:c=!1,labels:w,getScheduleTypeName:C}){const E={...At,...w},[I,L]=v.useState(""),[N,p]=v.useState(""),D=v.useMemo(()=>I.trim()?Ne(t,I,h=>[h.name,C?.(h)||h.name]):t,[t,I,C]),k=v.useMemo(()=>N.trim()?Ne(s,N,h=>[h.name,h.email||""]):s,[s,N]),T=D.length>0&&D.every(h=>n.includes(h.id)),H=k.length>0&&k.every(h=>o.includes(h.id)),q=n.length+o.length,U=(h,a)=>{const u=a?[...n,h]:n.filter(j=>j!==h);r(u)},O=()=>{if(T){const h=new Set(D.map(a=>a.id));r(n.filter(a=>!h.has(a)))}else{const h=new Set([...n,...D.map(a=>a.id)]);r(Array.from(h))}},W=(h,a)=>{const u=a?[...o,h]:o.filter(j=>j!==h);i(u)},R=()=>{if(H){const h=new Set(k.map(a=>a.id));i(o.filter(a=>!h.has(a)))}else{const h=new Set([...o,...k.map(a=>a.id)]);i(Array.from(h))}},_=()=>{r([]),i([]),f?.()},F=h=>C?C(h):h.name,Y=h=>h.colorHex||h.color||"#069AD7";return e.jsxs("div",{className:x.cn("flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",m),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:E.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:E.subtitle})]}),q>0&&e.jsxs("button",{type:"button",onClick:_,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(Wt,{className:"h-3.5 w-3.5"}),E.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:E.scheduleTypes}),e.jsx("button",{type:"button",onClick:O,className:"text-xs font-medium text-primary transition-colors hover:text-primary/80",children:T?E.unselectAll:E.selectAll})]}),t.length>6&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx(ke,{value:I,onChange:L,placeholder:E.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,a)=>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-${a}`)):D.map(h=>{const a=n.includes(h.id),u=Y(h);return e.jsxs(de,{checked:a,onCheckedChange:j=>U(h.id,j),className:x.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",a&&"border-primary bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:x.cn("flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",a&&"border-primary bg-primary text-primary-foreground"),children:a&&e.jsx(ce,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:F(h)})]}),e.jsx("div",{className:"h-4 w-4 rounded-full border",style:{backgroundColor:u,borderColor:u}})]},h.id)}),!l&&D.length===0&&e.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:E.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:E.participants}),e.jsx(de,{checked:H,onCheckedChange:()=>R(),className:x.cn("flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",H&&"border-primary bg-primary text-primary-foreground"),children:H&&e.jsx(ce,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(ke,{value:N,onChange:p,placeholder:E.searchParticipants})}),e.jsxs("div",{className:"flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[c?Array.from({length:4}).map((h,a)=>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-${a}`)):k.map(h=>{const a=o.includes(h.id);return e.jsxs(de,{checked:a,onCheckedChange:u=>W(h.id,u),className:x.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",a&&"border-primary bg-zinc-50"),children:[e.jsx("span",{className:x.cn("flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",a&&"border-primary bg-primary text-primary-foreground"),children:a&&e.jsx(ce,{className:"h-2.5 w-2.5"})}),e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[e.jsx(Ft,{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)}),!c&&k.length===0&&e.jsx("p",{className:"px-4 text-xs text-muted-foreground",children:E.noParticipants})]})]})]})}function Bt({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 Ot({scheduleTypes:t,value:s,onChange:n,allLabel:r="All types",className:o,label:i}){const f=l=>{n(l.target.value)},m=t.find(l=>String(l.id)===s);return e.jsxs("div",{className:x.cn("flex flex-col gap-1",o),children:[i&&e.jsx(Q,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[m?e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",style:{backgroundColor:m.color}}):e.jsx(Bt,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(Z,{value:s,onChange:f,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 _t({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 $t({users:t,value:s,onChange:n,allLabel:r="All users",className:o,label:i}){const f=m=>{n(m.target.value)};return e.jsxs("div",{className:x.cn("flex flex-col gap-1",o),children:[i&&e.jsx(Q,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[e.jsx(_t,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(Z,{value:s,onChange:f,className:"h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(m=>e.jsx("option",{value:m.id,children:m.name},m.id))]})]})]})}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: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 Vt({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 Ut({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 Yt({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 Gt(t){const s=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}-${n}-${r}`}function Ce(t){const s=t.getHours(),n=t.getMinutes(),r=s>=12?"PM":"AM",o=s%12||12,i=String(n).padStart(2,"0");return`${o}:${i} ${r}`}function qt(t){const s=Ce(t.startDate),n=Ce(t.endDate);return`${s} - ${n}`}function Kt(t){const s=P.addDays(new Date,1);return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function Jt(t){if(P.isToday(t))return"Today";if(Kt(t))return"Tomorrow";const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=s[t.getDay()],o=n[t.getMonth()],i=t.getDate();return`${r}, ${o} ${i}`}function Xt(t,s){const n=new Map;for(const r of t){const o=Gt(r.startDate),i=n.get(o)??[];i.push(r),n.set(o,i)}return Array.from(n.entries()).map(([r,o])=>{const i=[...o].sort((m,l)=>m.startDate.getTime()-l.startDate.getTime()),f=s>0?i.slice(0,s):i;return{date:new Date(r),dateKey:r,events:f,hasMore:s>0&&i.length>s}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function Qt(t){const s=P.startOfDay(new Date),n=P.endOfDay(new Date);return t.filter(r=>r.startDate>=s&&r.startDate<=n).length}function ue({className:t}){return e.jsx("div",{className:x.cn("animate-pulse rounded-md bg-muted",t)})}function Zt({event:t,onClick:s}){return e.jsxs("button",{type:"button",onClick:()=>s?.(t),className:x.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:qt(t)})]}),s&&e.jsx(Ut,{className:"shrink-0 size-4 text-muted-foreground/50 mt-1"})]})}function es({group:t,onEventClick:s}){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:x.cn("text-xs font-semibold",P.isToday(t.date)&&"text-primary"),children:Jt(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(n=>e.jsx(Zt,{event:n,onClick:s},n.id))})]})}function ts({events:t,isLoading:s=!1,className:n,daysAhead:r=7,maxEventsPerDay:o=3,onEventClick:i,onNavigateToAgenda:f}){const[m,l]=v.useState(!1),c=v.useMemo(()=>{const L=P.startOfDay(new Date),N=P.addDays(L,r);return t.filter(p=>p.endDate>=L&&p.startDate<N)},[t,r]),w=v.useMemo(()=>Xt(c,o),[c,o]),C=v.useMemo(()=>Qt(t),[t]),E=L=>{l(!1),i?.(L)},I=()=>{l(!1),f?.()};return e.jsxs(g.Popover,{open:m,onOpenChange:l,children:[e.jsxs(g.PopoverTrigger,{className:x.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",n),children:[e.jsx(Rt,{className:"h-4 w-4"}),C>0&&e.jsx(g.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:C>99?"99+":C})]}),e.jsxs(g.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:C>0?`${C} event${C>1?"s":""} today`:"No events today"})]}),f&&e.jsxs("button",{type:"button",onClick:I,className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all",e.jsx(Yt,{className:"size-3"})]})]}),e.jsx("div",{className:"max-h-80 overflow-y-auto p-2",children:s?e.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:3}).map((L,N)=>e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(ue,{className:"h-2 w-2 rounded-full mt-2"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ue,{className:"h-4 w-full"}),e.jsx(ue,{className:"h-3 w-3/4"})]})]},N))}):w.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Vt,{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:w.map(L=>e.jsx(es,{group:L,onEventClick:E},L.dateKey))})})]})]})}function ss({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 Ee({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 ns(t){const s=new Date;return s.setDate(s.getDate()+1),t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function De(t){const s=t.getHours(),n=t.getMinutes(),r=s>=12?"PM":"AM";return`${s%12||12}:${n.toString().padStart(2,"0")} ${r}`}function rs(t){return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"short",day:"numeric"}).format(t)}function os(t){const s=De(t.startDate),n=De(t.endDate);return`${s} - ${n}`}function is(t){return P.isToday(t)?"Today":ns(t)?"Tomorrow":rs(t)}function as(t,s){const n=new Map;for(const r of t){const o=P.formatDateISO(r.startDate),i=n.get(o)??[];i.push(r),n.set(o,i)}return Array.from(n.entries()).map(([r,o])=>{const i=[...o].sort((m,l)=>m.startDate.getTime()-l.startDate.getTime()),f=s>0?i.slice(0,s):i;return{date:new Date(r),dateKey:r,events:f,hasMore:s>0&&i.length>s}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function ls({event:t,onClick:s,compact:n}){return e.jsxs("button",{type:"button",onClick:()=>s?.(t),className:x.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",n?"p-2":"p-3"),children:[e.jsx("div",{className:x.cn("shrink-0 rounded-full mt-1",n?"size-2":"size-2.5"),style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:x.cn("font-medium truncate",n?"text-xs":"text-sm"),children:t.title}),e.jsx("p",{className:x.cn("text-muted-foreground truncate",n?"text-[10px]":"text-xs"),children:os(t)})]}),s&&e.jsx(Ee,{className:x.cn("shrink-0 text-muted-foreground/50",n?"size-3":"size-4")})]})}function cs({group:t,onEventClick:s,onViewMore:n,compact:r}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:x.cn("flex items-center justify-between px-2",r?"py-1":"py-1.5"),children:[e.jsx("h3",{className:x.cn("font-semibold",r?"text-xs":"text-sm",P.isToday(t.date)&&"text-primary"),children:is(t.date)}),t.hasMore&&n&&e.jsx("button",{type:"button",onClick:()=>n(t.date),className:x.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(ls,{event:o,onClick:s,compact:r},o.id))})]})}function ds({events:t,daysAhead:s=7,maxEventsPerDay:n=3,onEventClick:r,onViewAll:o,className:i,emptyState:f,title:m="Upcoming",showHeader:l=!0,compact:c=!1}){const w=te.useOptionalCalendarContext(),C=w?.filteredEvents,E=w?.currentDate??new Date,I=t??C??[],L=v.useMemo(()=>{const D=P.startOfDay(E),k=new Date(D);return k.setDate(k.getDate()+s),I.filter(T=>T.endDate>=D&&T.startDate<k)},[I,s,E]),N=v.useMemo(()=>as(L,n),[L,n]),p=L.length;return N.length===0?e.jsxs("div",{className:x.cn("rounded-lg border bg-card",i),children:[l&&e.jsx("div",{className:x.cn("border-b px-4 flex items-center justify-between",c?"py-2":"py-3"),children:e.jsx("h2",{className:x.cn("font-semibold",c?"text-sm":"text-base"),children:m})}),e.jsx("div",{className:x.cn("flex flex-col items-center justify-center text-center",c?"py-6 px-4":"py-10 px-6"),children:f??e.jsxs(e.Fragment,{children:[e.jsx(ss,{className:x.cn("text-muted-foreground/50 mb-2",c?"size-8":"size-10")}),e.jsx("p",{className:x.cn("text-muted-foreground",c?"text-xs":"text-sm"),children:"No upcoming events"})]})})]}):e.jsxs("div",{className:x.cn("rounded-lg border bg-card overflow-hidden",i),children:[l&&e.jsxs("div",{className:x.cn("border-b px-4 flex items-center justify-between",c?"py-2":"py-3"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:x.cn("font-semibold",c?"text-sm":"text-base"),children:m}),e.jsx("span",{className:x.cn("text-muted-foreground bg-muted rounded-full px-2",c?"text-[10px] py-0":"text-xs py-0.5"),children:p})]}),o&&e.jsxs("button",{type:"button",onClick:()=>o(),className:x.cn("text-primary hover:underline flex items-center gap-0.5",c?"text-xs":"text-sm"),children:["View all",e.jsx(Ee,{className:"size-3"})]})]}),e.jsx("div",{className:x.cn("divide-y overflow-auto",c?"p-2 max-h-[280px]":"p-3 max-h-[400px]"),children:N.map(D=>e.jsx(cs,{group:D,onEventClick:r,onViewMore:o?k=>o(k):void 0,compact:c},D.dateKey))})]})}exports.AgendaDropdown=ts;exports.AgendaWidget=ds;exports.BadgeVariantSetting=bt;exports.Calendar=Le;exports.CalendarFilterSidebar=Pt;exports.DEFAULT_WEEK_WORKING_HOURS=Ht;exports.EventPopover=Ke;exports.InnoCalendar=ht;exports.ScheduleTypeFilter=Ot;exports.SlotDurationSetting=pt;exports.TimelineView=ie;exports.UserFilter=$t;exports.VisibleHoursSetting=Ct;exports.WorkingHoursSetting=Lt;exports.YearView=Se;
2
+ //# sourceMappingURL=agenda-widget-BsRtRyZ3.cjs.map