@innosolutions/inno-calendar 1.0.47 → 1.0.49

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 (54) hide show
  1. package/dist/agenda-widget-B-AVTnqM.cjs +2 -0
  2. package/dist/agenda-widget-B-AVTnqM.cjs.map +1 -0
  3. package/dist/{agenda-widget-BiuoHkpP.js → agenda-widget-DhCPt2vI.js} +941 -929
  4. package/dist/agenda-widget-DhCPt2vI.js.map +1 -0
  5. package/dist/components/event/event-card.d.ts.map +1 -1
  6. package/dist/components/index.cjs +1 -1
  7. package/dist/components/index.mjs +2 -2
  8. package/dist/components/inno-calendar.d.ts +11 -0
  9. package/dist/components/inno-calendar.d.ts.map +1 -1
  10. package/dist/core/context/inno-calendar-provider.d.ts +15 -1
  11. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  12. package/dist/core/index.cjs +1 -1
  13. package/dist/core/index.mjs +43 -43
  14. package/dist/core/types.d.ts +12 -0
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.mjs +62 -62
  18. package/dist/presets/index.cjs +1 -1
  19. package/dist/presets/index.mjs +1 -1
  20. package/dist/slot-selection-context-BCsC7WT7.cjs +2 -0
  21. package/dist/slot-selection-context-BCsC7WT7.cjs.map +1 -0
  22. package/dist/slot-selection-context-D1495hEJ.js +595 -0
  23. package/dist/slot-selection-context-D1495hEJ.js.map +1 -0
  24. package/dist/{tailwind-calendar-7wDEMPEi.js → tailwind-calendar-BmJa4HhQ.js} +2 -2
  25. package/dist/{tailwind-calendar-7wDEMPEi.js.map → tailwind-calendar-BmJa4HhQ.js.map} +1 -1
  26. package/dist/{tailwind-calendar-QMXCp1an.cjs → tailwind-calendar-CJmOutn1.cjs} +2 -2
  27. package/dist/{tailwind-calendar-QMXCp1an.cjs.map → tailwind-calendar-CJmOutn1.cjs.map} +1 -1
  28. package/dist/use-calendar-BEuelmSu.cjs +2 -0
  29. package/dist/use-calendar-BEuelmSu.cjs.map +1 -0
  30. package/dist/use-calendar-Clo9DFK4.js +175 -0
  31. package/dist/use-calendar-Clo9DFK4.js.map +1 -0
  32. package/dist/{use-slot-selection-BJHlyfxL.js → use-slot-selection-BCZKnZSM.js} +2 -2
  33. package/dist/{use-slot-selection-BJHlyfxL.js.map → use-slot-selection-BCZKnZSM.js.map} +1 -1
  34. package/dist/{use-slot-selection-CTFC2-xS.cjs → use-slot-selection-Bwqwjiaq.cjs} +2 -2
  35. package/dist/{use-slot-selection-CTFC2-xS.cjs.map → use-slot-selection-Bwqwjiaq.cjs.map} +1 -1
  36. package/dist/week-view-D19YRBQC.cjs +11 -0
  37. package/dist/week-view-D19YRBQC.cjs.map +1 -0
  38. package/dist/{week-view-C4YFlrPS.js → week-view-aRPB2cjn.js} +922 -904
  39. package/dist/week-view-aRPB2cjn.js.map +1 -0
  40. package/package.json +1 -1
  41. package/dist/agenda-widget-BREvI5ia.cjs +0 -2
  42. package/dist/agenda-widget-BREvI5ia.cjs.map +0 -1
  43. package/dist/agenda-widget-BiuoHkpP.js.map +0 -1
  44. package/dist/slot-selection-context-Bx3FKJfR.cjs +0 -2
  45. package/dist/slot-selection-context-Bx3FKJfR.cjs.map +0 -1
  46. package/dist/slot-selection-context-D2eu2o-7.js +0 -203
  47. package/dist/slot-selection-context-D2eu2o-7.js.map +0 -1
  48. package/dist/use-calendar-DR2emWYC.js +0 -555
  49. package/dist/use-calendar-DR2emWYC.js.map +0 -1
  50. package/dist/use-calendar-DR89bZu5.cjs +0 -2
  51. package/dist/use-calendar-DR89bZu5.cjs.map +0 -1
  52. package/dist/week-view-C4YFlrPS.js.map +0 -1
  53. package/dist/week-view-DWLMtGVt.cjs +0 -11
  54. package/dist/week-view-DWLMtGVt.cjs.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react"),T=require("./use-calendar-DR89bZu5.cjs"),d=require("./utils.cjs");function P(){const{preferences:t,setPreferences:s}=T.useCalendarContext(),a=n.useMemo(()=>({from:t.startHour,to:t.endHour}),[t.startHour,t.endHour]),u=n.useMemo(()=>({1:{from:t.startHour,to:t.endHour},2:{from:t.startHour,to:t.endHour},3:{from:t.startHour,to:t.endHour},4:{from:t.startHour,to:t.endHour},5:{from:t.startHour,to:t.endHour}}),[t.startHour,t.endHour]),o=n.useCallback(e=>{s({startHour:e.from,endHour:e.to})},[s]),f=n.useCallback(e=>{const r=Object.values(e)[0];r&&s({startHour:r.from,endHour:r.to})},[s]),D=n.useCallback(e=>{s({slotDuration:e})},[s]),H=n.useCallback(e=>{console.warn("showWorkingHoursOnly is not yet supported in core preferences")},[]);return{visibleHours:a,setVisibleHours:o,workingHours:u,setWorkingHours:f,slotDuration:t.slotDuration,setSlotDuration:D,showWorkingHoursOnly:!1,setShowWorkingHoursOnly:H}}function w(t={}){const{initial:s={},storageKey:a,onChange:u}=t,[o,f]=n.useState(()=>{if(a&&typeof window<"u")try{const r=localStorage.getItem(a);if(r){const S=JSON.parse(r);return{...d.DEFAULT_PREFERENCES,...S,...s}}}catch{}return{...d.DEFAULT_PREFERENCES,...s}});n.useEffect(()=>{if(a&&typeof window<"u")try{localStorage.setItem(a,JSON.stringify(o))}catch{}},[o,a]);const D=n.useCallback(r=>{f(S=>{const m={...S,...r};return u?.(m),m})},[u]),H=n.useCallback(()=>{const r={...d.DEFAULT_PREFERENCES,...s};f(r),u?.(r)},[s,u]),e=n.useCallback(r=>o[r],[o]);return{preferences:o,setPreferences:D,resetPreferences:H,getPreference:e}}const C={isSelecting:!1,startDate:null,endDate:null,startY:null,currentY:null,resourceId:void 0};function I(t){const{dayStart:s,visibleHours:a,hourHeight:u=d.DEFAULT_HOUR_HEIGHT,slotDuration:o=30,resourceId:f,enabled:D=!0,onSelect:H}=t,[e,r]=n.useState(C),S=n.useRef(0),m=n.useCallback((l,c)=>{if(!D)return;const i=l.clientY-c.top;S.current=c.height;const g=d.yToTime(i,s,a,u,o);r({isSelecting:!0,startDate:g,endDate:d.addMinutes(g,o),startY:i,currentY:i,resourceId:f})},[D,s,a,u,o,f]),b=n.useCallback((l,c)=>{if(!e.isSelecting||!e.startY)return;const i=Math.max(0,Math.min(l.clientY-c.top,c.height)),g=d.yToTime(i,s,a,u,o);r(h=>{if(!h.startDate)return h;const E=i>=(h.startY??0);return{...h,currentY:i,endDate:E?d.addMinutes(g,o):g,startDate:E?h.startDate:g}})},[e.isSelecting,e.startY,s,a,u,o]),Y=n.useCallback(()=>{if(!e.isSelecting||!e.startDate||!e.endDate){r(C);return}const l=e.startDate<e.endDate?e.startDate:e.endDate,c=e.startDate<e.endDate?e.endDate:e.startDate,i={startDate:l,endDate:c,resourceId:e.resourceId};H?.(i),r(C)},[e,H]),y=n.useCallback(()=>{r(C)},[]),k=(()=>{if(!e.isSelecting||e.startY===null||e.currentY===null)return{top:0,height:0,visible:!1};const l=Math.min(e.startY,e.currentY),c=Math.max(e.startY,e.currentY);return{top:l,height:Math.max(c-l,20),visible:!0}})();return{selection:e,overlay:k,handlePointerDown:m,handlePointerMove:b,handlePointerUp:Y,cancel:y,isSelecting:e.isSelecting}}exports.useCalendarTimeConfig=P;exports.usePreferences=w;exports.useSlotSelection=I;
2
- //# sourceMappingURL=use-slot-selection-CTFC2-xS.cjs.map
1
+ "use strict";const n=require("react"),T=require("./use-calendar-BEuelmSu.cjs"),d=require("./utils.cjs");function P(){const{preferences:t,setPreferences:s}=T.useCalendarContext(),a=n.useMemo(()=>({from:t.startHour,to:t.endHour}),[t.startHour,t.endHour]),u=n.useMemo(()=>({1:{from:t.startHour,to:t.endHour},2:{from:t.startHour,to:t.endHour},3:{from:t.startHour,to:t.endHour},4:{from:t.startHour,to:t.endHour},5:{from:t.startHour,to:t.endHour}}),[t.startHour,t.endHour]),o=n.useCallback(e=>{s({startHour:e.from,endHour:e.to})},[s]),f=n.useCallback(e=>{const r=Object.values(e)[0];r&&s({startHour:r.from,endHour:r.to})},[s]),D=n.useCallback(e=>{s({slotDuration:e})},[s]),H=n.useCallback(e=>{console.warn("showWorkingHoursOnly is not yet supported in core preferences")},[]);return{visibleHours:a,setVisibleHours:o,workingHours:u,setWorkingHours:f,slotDuration:t.slotDuration,setSlotDuration:D,showWorkingHoursOnly:!1,setShowWorkingHoursOnly:H}}function w(t={}){const{initial:s={},storageKey:a,onChange:u}=t,[o,f]=n.useState(()=>{if(a&&typeof window<"u")try{const r=localStorage.getItem(a);if(r){const S=JSON.parse(r);return{...d.DEFAULT_PREFERENCES,...S,...s}}}catch{}return{...d.DEFAULT_PREFERENCES,...s}});n.useEffect(()=>{if(a&&typeof window<"u")try{localStorage.setItem(a,JSON.stringify(o))}catch{}},[o,a]);const D=n.useCallback(r=>{f(S=>{const m={...S,...r};return u?.(m),m})},[u]),H=n.useCallback(()=>{const r={...d.DEFAULT_PREFERENCES,...s};f(r),u?.(r)},[s,u]),e=n.useCallback(r=>o[r],[o]);return{preferences:o,setPreferences:D,resetPreferences:H,getPreference:e}}const C={isSelecting:!1,startDate:null,endDate:null,startY:null,currentY:null,resourceId:void 0};function I(t){const{dayStart:s,visibleHours:a,hourHeight:u=d.DEFAULT_HOUR_HEIGHT,slotDuration:o=30,resourceId:f,enabled:D=!0,onSelect:H}=t,[e,r]=n.useState(C),S=n.useRef(0),m=n.useCallback((l,c)=>{if(!D)return;const i=l.clientY-c.top;S.current=c.height;const g=d.yToTime(i,s,a,u,o);r({isSelecting:!0,startDate:g,endDate:d.addMinutes(g,o),startY:i,currentY:i,resourceId:f})},[D,s,a,u,o,f]),b=n.useCallback((l,c)=>{if(!e.isSelecting||!e.startY)return;const i=Math.max(0,Math.min(l.clientY-c.top,c.height)),g=d.yToTime(i,s,a,u,o);r(h=>{if(!h.startDate)return h;const E=i>=(h.startY??0);return{...h,currentY:i,endDate:E?d.addMinutes(g,o):g,startDate:E?h.startDate:g}})},[e.isSelecting,e.startY,s,a,u,o]),Y=n.useCallback(()=>{if(!e.isSelecting||!e.startDate||!e.endDate){r(C);return}const l=e.startDate<e.endDate?e.startDate:e.endDate,c=e.startDate<e.endDate?e.endDate:e.startDate,i={startDate:l,endDate:c,resourceId:e.resourceId};H?.(i),r(C)},[e,H]),y=n.useCallback(()=>{r(C)},[]),k=(()=>{if(!e.isSelecting||e.startY===null||e.currentY===null)return{top:0,height:0,visible:!1};const l=Math.min(e.startY,e.currentY),c=Math.max(e.startY,e.currentY);return{top:l,height:Math.max(c-l,20),visible:!0}})();return{selection:e,overlay:k,handlePointerDown:m,handlePointerMove:b,handlePointerUp:Y,cancel:y,isSelecting:e.isSelecting}}exports.useCalendarTimeConfig=P;exports.usePreferences=w;exports.useSlotSelection=I;
2
+ //# sourceMappingURL=use-slot-selection-Bwqwjiaq.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slot-selection-CTFC2-xS.cjs","sources":["../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\n * useCalendarTimeConfig - Time Configuration Hook\n *\n * Convenience hook that provides access to time-related preferences\n * from the calendar context. Matches agenda-v2 naming conventions.\n *\n * @example\n * ```tsx\n * function TimeSettings() {\n * const {\n * visibleHours,\n * setVisibleHours,\n * workingHours,\n * setWorkingHours,\n * slotDuration,\n * setSlotDuration,\n * showWorkingHoursOnly,\n * setShowWorkingHoursOnly,\n * } = useCalendarTimeConfig();\n *\n * return (\n * <div>\n * <p>Visible: {visibleHours.from}:00 - {visibleHours.to}:00</p>\n * <p>Slot duration: {slotDuration} minutes</p>\n * </div>\n * );\n * }\n * ```\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { useCalendarContext } from '../context/calendar-context';\nimport type { IVisibleHoursConfig, TWorkingHoursConfig } from '../preferences/types';\nimport type { TSlotDuration } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseCalendarTimeConfigReturn {\n\t/** Current visible hours range */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Update visible hours */\n\tsetVisibleHours: (hours: IVisibleHoursConfig) => void;\n\t/** Current working hours configuration */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Update working hours */\n\tsetWorkingHours: (hours: TWorkingHoursConfig) => void;\n\t/** Current slot duration in minutes */\n\tslotDuration: TSlotDuration;\n\t/** Update slot duration */\n\tsetSlotDuration: (duration: TSlotDuration) => void;\n\t/** Whether to show only working hours */\n\tshowWorkingHoursOnly: boolean;\n\t/** Toggle show working hours only */\n\tsetShowWorkingHoursOnly: (show: boolean) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Get time configuration from calendar context\n *\n * Provides a focused subset of calendar preferences related to time display.\n * All setters will update the underlying preferences in the calendar context.\n *\n * Note: This hook maps the core preferences (startHour/endHour) to the\n * agenda-v2 naming convention (visibleHours.from/to, workingHours).\n */\nexport function useCalendarTimeConfig(): UseCalendarTimeConfigReturn {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\n\t// Map core preferences to visible hours format\n\tconst visibleHours = useMemo<IVisibleHoursConfig>(\n\t\t() => ({\n\t\t\tfrom: preferences.startHour,\n\t\t\tto: preferences.endHour,\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\t// Default working hours based on visible hours (can be extended later)\n\tconst workingHours = useMemo<TWorkingHoursConfig>(\n\t\t() => ({\n\t\t\t// Default: Mon-Fri same hours\n\t\t\t1: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t2: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t3: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t4: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t5: { from: preferences.startHour, to: preferences.endHour },\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\tconst setVisibleHours = useCallback(\n\t\t(hours: IVisibleHoursConfig) => {\n\t\t\tsetPreferences({\n\t\t\t\tstartHour: hours.from,\n\t\t\t\tendHour: hours.to,\n\t\t\t});\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setWorkingHours = useCallback(\n\t\t(_hours: TWorkingHoursConfig) => {\n\t\t\t// Working hours per-day config would need to be added to core preferences\n\t\t\t// For now, we use the first available day's hours to set visible hours\n\t\t\tconst firstDay = Object.values(_hours)[0];\n\t\t\tif (firstDay) {\n\t\t\t\tsetPreferences({\n\t\t\t\t\tstartHour: firstDay.from,\n\t\t\t\t\tendHour: firstDay.to,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setSlotDuration = useCallback(\n\t\t(duration: TSlotDuration) => {\n\t\t\tsetPreferences({ slotDuration: duration });\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setShowWorkingHoursOnly = useCallback((_show: boolean) => {\n\t\t// This would need to be added to ICalendarPreferences\n\t\t// For now, this is a no-op but provides the API surface\n\t\tconsole.warn('showWorkingHoursOnly is not yet supported in core preferences');\n\t}, []);\n\n\treturn {\n\t\tvisibleHours,\n\t\tsetVisibleHours,\n\t\tworkingHours,\n\t\tsetWorkingHours,\n\t\tslotDuration: preferences.slotDuration as TSlotDuration,\n\t\tsetSlotDuration,\n\t\tshowWorkingHoursOnly: false, // Default until added to core preferences\n\t\tsetShowWorkingHoursOnly,\n\t};\n}\n","/**\n * usePreferences - Calendar Preferences Hook\n *\n * Manages user preferences with optional localStorage persistence.\n */\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type { ICalendarPreferences } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UsePreferencesOptions {\n\t/** Initial preferences (overrides defaults) */\n\tinitial?: Partial<ICalendarPreferences>;\n\t/** Storage key for persistence (if provided, uses localStorage) */\n\tstorageKey?: string;\n\t/** Callback when preferences change */\n\tonChange?: (preferences: ICalendarPreferences) => void;\n}\n\nexport interface UsePreferencesReturn {\n\t/** Current preferences */\n\tpreferences: ICalendarPreferences;\n\t/** Update preferences */\n\tsetPreferences: (updates: Partial<ICalendarPreferences>) => void;\n\t/** Reset to defaults */\n\tresetPreferences: () => void;\n\t/** Get a specific preference */\n\tgetPreference: <K extends keyof ICalendarPreferences>(key: K) => ICalendarPreferences[K];\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function usePreferences(options: UsePreferencesOptions = {}): UsePreferencesReturn {\n\tconst { initial = {}, storageKey, onChange } = options;\n\n\t// Load from storage or use defaults\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tconst stored = localStorage.getItem(storageKey);\n\t\t\t\tif (stored) {\n\t\t\t\t\tconst parsed = JSON.parse(stored) as Partial<ICalendarPreferences>;\n\t\t\t\t\treturn { ...DEFAULT_PREFERENCES, ...parsed, ...initial };\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore parsing errors\n\t\t\t}\n\t\t}\n\t\treturn { ...DEFAULT_PREFERENCES, ...initial };\n\t});\n\n\t// Persist to storage when preferences change\n\tuseEffect(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tlocalStorage.setItem(storageKey, JSON.stringify(preferences));\n\t\t\t} catch {\n\t\t\t\t// Ignore storage errors\n\t\t\t}\n\t\t}\n\t}, [preferences, storageKey]);\n\n\tconst setPreferences = useCallback(\n\t\t(updates: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onChange]\n\t);\n\n\tconst resetPreferences = useCallback(() => {\n\t\tconst defaults = { ...DEFAULT_PREFERENCES, ...initial };\n\t\tsetPreferencesState(defaults);\n\t\tonChange?.(defaults);\n\t}, [initial, onChange]);\n\n\tconst getPreference = useCallback(\n\t\t<K extends keyof ICalendarPreferences>(key: K): ICalendarPreferences[K] => {\n\t\t\treturn preferences[key];\n\t\t},\n\t\t[preferences]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tgetPreference,\n\t};\n}\n","/**\n * useSlotSelection - Drag-to-Select Hook\n *\n * Handles mouse/touch interactions for creating events by\n * selecting time slots in the calendar grid.\n */\n\nimport { useCallback, useRef, useState } from 'react';\nimport { DEFAULT_HOUR_HEIGHT } from '../constants';\nimport type { ISelectionResult, ISlotSelection, IVisibleHours } from '../types';\nimport { addMinutes } from '../utils/date-utils';\nimport { yToTime } from '../utils/position-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseSlotSelectionOptions {\n\t/** Current day being selected on */\n\tdayStart: Date;\n\t/** Visible hours configuration */\n\tvisibleHours: IVisibleHours;\n\t/** Height of one hour in pixels */\n\thourHeight?: number;\n\t/** Slot duration in minutes for snapping */\n\tslotDuration?: number;\n\t/** Resource ID (for resource views) */\n\tresourceId?: string;\n\t/** Whether selection is enabled */\n\tenabled?: boolean;\n\t/** Callback when selection completes */\n\tonSelect?: (selection: ISelectionResult) => void;\n}\n\nexport interface UseSlotSelectionReturn {\n\t/** Current selection state */\n\tselection: ISlotSelection;\n\t/** Selection overlay for rendering */\n\toverlay: { top: number; height: number; visible: boolean };\n\t/** Handler for mouse/touch down */\n\thandlePointerDown: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch move */\n\thandlePointerMove: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch up */\n\thandlePointerUp: () => void;\n\t/** Cancel current selection */\n\tcancel: () => void;\n\t/** Whether currently selecting */\n\tisSelecting: boolean;\n}\n\n// ============================================================================\n// INITIAL STATE\n// ============================================================================\n\nconst INITIAL_SELECTION: ISlotSelection = {\n\tisSelecting: false,\n\tstartDate: null,\n\tendDate: null,\n\tstartY: null,\n\tcurrentY: null,\n\tresourceId: undefined,\n};\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useSlotSelection(options: UseSlotSelectionOptions): UseSlotSelectionReturn {\n\tconst {\n\t\tdayStart,\n\t\tvisibleHours,\n\t\thourHeight = DEFAULT_HOUR_HEIGHT,\n\t\tslotDuration = 30,\n\t\tresourceId,\n\t\tenabled = true,\n\t\tonSelect,\n\t} = options;\n\n\tconst [selection, setSelection] = useState<ISlotSelection>(INITIAL_SELECTION);\n\tconst containerHeightRef = useRef<number>(0);\n\n\t// ========================================================================\n\t// HANDLERS\n\t// ========================================================================\n\n\tconst handlePointerDown = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!enabled) return;\n\n\t\t\tconst y = e.clientY - containerRect.top;\n\t\t\tcontainerHeightRef.current = containerRect.height;\n\n\t\t\tconst startTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection({\n\t\t\t\tisSelecting: true,\n\t\t\t\tstartDate: startTime,\n\t\t\t\tendDate: addMinutes(startTime, slotDuration),\n\t\t\t\tstartY: y,\n\t\t\t\tcurrentY: y,\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t},\n\t\t[enabled, dayStart, visibleHours, hourHeight, slotDuration, resourceId]\n\t);\n\n\tconst handlePointerMove = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!selection.isSelecting || !selection.startY) return;\n\n\t\t\tconst y = Math.max(0, Math.min(e.clientY - containerRect.top, containerRect.height));\n\t\t\tconst currentTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection((prev) => {\n\t\t\t\tif (!prev.startDate) return prev;\n\n\t\t\t\t// Determine if dragging up or down\n\t\t\t\tconst isDraggingDown = y >= (prev.startY ?? 0);\n\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tcurrentY: y,\n\t\t\t\t\tendDate: isDraggingDown ? addMinutes(currentTime, slotDuration) : currentTime,\n\t\t\t\t\tstartDate: isDraggingDown ? prev.startDate : currentTime,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\t[selection.isSelecting, selection.startY, dayStart, visibleHours, hourHeight, slotDuration]\n\t);\n\n\tconst handlePointerUp = useCallback(() => {\n\t\tif (!selection.isSelecting || !selection.startDate || !selection.endDate) {\n\t\t\tsetSelection(INITIAL_SELECTION);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure start is before end\n\t\tconst start = selection.startDate < selection.endDate ? selection.startDate : selection.endDate;\n\t\tconst end = selection.startDate < selection.endDate ? selection.endDate : selection.startDate;\n\n\t\tconst result: ISelectionResult = {\n\t\t\tstartDate: start,\n\t\t\tendDate: end,\n\t\t\tresourceId: selection.resourceId,\n\t\t};\n\n\t\tonSelect?.(result);\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, [selection, onSelect]);\n\n\tconst cancel = useCallback(() => {\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, []);\n\n\t// ========================================================================\n\t// OVERLAY CALCULATION\n\t// ========================================================================\n\n\tconst overlay = (() => {\n\t\tif (!selection.isSelecting || selection.startY === null || selection.currentY === null) {\n\t\t\treturn { top: 0, height: 0, visible: false };\n\t\t}\n\n\t\tconst minY = Math.min(selection.startY, selection.currentY);\n\t\tconst maxY = Math.max(selection.startY, selection.currentY);\n\n\t\treturn {\n\t\t\ttop: minY,\n\t\t\theight: Math.max(maxY - minY, 20), // Minimum height\n\t\t\tvisible: true,\n\t\t};\n\t})();\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\tselection,\n\t\toverlay,\n\t\thandlePointerDown,\n\t\thandlePointerMove,\n\t\thandlePointerUp,\n\t\tcancel,\n\t\tisSelecting: selection.isSelecting,\n\t};\n}\n"],"names":["useCalendarTimeConfig","preferences","setPreferences","useCalendarContext","visibleHours","useMemo","workingHours","setVisibleHours","useCallback","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","options","initial","storageKey","onChange","setPreferencesState","useState","stored","parsed","DEFAULT_PREFERENCES","useEffect","updates","prev","next","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","selection","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","result","cancel","overlay","minY","maxY"],"mappings":"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"}
1
+ {"version":3,"file":"use-slot-selection-Bwqwjiaq.cjs","sources":["../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\n * useCalendarTimeConfig - Time Configuration Hook\n *\n * Convenience hook that provides access to time-related preferences\n * from the calendar context. Matches agenda-v2 naming conventions.\n *\n * @example\n * ```tsx\n * function TimeSettings() {\n * const {\n * visibleHours,\n * setVisibleHours,\n * workingHours,\n * setWorkingHours,\n * slotDuration,\n * setSlotDuration,\n * showWorkingHoursOnly,\n * setShowWorkingHoursOnly,\n * } = useCalendarTimeConfig();\n *\n * return (\n * <div>\n * <p>Visible: {visibleHours.from}:00 - {visibleHours.to}:00</p>\n * <p>Slot duration: {slotDuration} minutes</p>\n * </div>\n * );\n * }\n * ```\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { useCalendarContext } from '../context/calendar-context';\nimport type { IVisibleHoursConfig, TWorkingHoursConfig } from '../preferences/types';\nimport type { TSlotDuration } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseCalendarTimeConfigReturn {\n\t/** Current visible hours range */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Update visible hours */\n\tsetVisibleHours: (hours: IVisibleHoursConfig) => void;\n\t/** Current working hours configuration */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Update working hours */\n\tsetWorkingHours: (hours: TWorkingHoursConfig) => void;\n\t/** Current slot duration in minutes */\n\tslotDuration: TSlotDuration;\n\t/** Update slot duration */\n\tsetSlotDuration: (duration: TSlotDuration) => void;\n\t/** Whether to show only working hours */\n\tshowWorkingHoursOnly: boolean;\n\t/** Toggle show working hours only */\n\tsetShowWorkingHoursOnly: (show: boolean) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Get time configuration from calendar context\n *\n * Provides a focused subset of calendar preferences related to time display.\n * All setters will update the underlying preferences in the calendar context.\n *\n * Note: This hook maps the core preferences (startHour/endHour) to the\n * agenda-v2 naming convention (visibleHours.from/to, workingHours).\n */\nexport function useCalendarTimeConfig(): UseCalendarTimeConfigReturn {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\n\t// Map core preferences to visible hours format\n\tconst visibleHours = useMemo<IVisibleHoursConfig>(\n\t\t() => ({\n\t\t\tfrom: preferences.startHour,\n\t\t\tto: preferences.endHour,\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\t// Default working hours based on visible hours (can be extended later)\n\tconst workingHours = useMemo<TWorkingHoursConfig>(\n\t\t() => ({\n\t\t\t// Default: Mon-Fri same hours\n\t\t\t1: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t2: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t3: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t4: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t5: { from: preferences.startHour, to: preferences.endHour },\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\tconst setVisibleHours = useCallback(\n\t\t(hours: IVisibleHoursConfig) => {\n\t\t\tsetPreferences({\n\t\t\t\tstartHour: hours.from,\n\t\t\t\tendHour: hours.to,\n\t\t\t});\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setWorkingHours = useCallback(\n\t\t(_hours: TWorkingHoursConfig) => {\n\t\t\t// Working hours per-day config would need to be added to core preferences\n\t\t\t// For now, we use the first available day's hours to set visible hours\n\t\t\tconst firstDay = Object.values(_hours)[0];\n\t\t\tif (firstDay) {\n\t\t\t\tsetPreferences({\n\t\t\t\t\tstartHour: firstDay.from,\n\t\t\t\t\tendHour: firstDay.to,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setSlotDuration = useCallback(\n\t\t(duration: TSlotDuration) => {\n\t\t\tsetPreferences({ slotDuration: duration });\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setShowWorkingHoursOnly = useCallback((_show: boolean) => {\n\t\t// This would need to be added to ICalendarPreferences\n\t\t// For now, this is a no-op but provides the API surface\n\t\tconsole.warn('showWorkingHoursOnly is not yet supported in core preferences');\n\t}, []);\n\n\treturn {\n\t\tvisibleHours,\n\t\tsetVisibleHours,\n\t\tworkingHours,\n\t\tsetWorkingHours,\n\t\tslotDuration: preferences.slotDuration as TSlotDuration,\n\t\tsetSlotDuration,\n\t\tshowWorkingHoursOnly: false, // Default until added to core preferences\n\t\tsetShowWorkingHoursOnly,\n\t};\n}\n","/**\n * usePreferences - Calendar Preferences Hook\n *\n * Manages user preferences with optional localStorage persistence.\n */\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type { ICalendarPreferences } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UsePreferencesOptions {\n\t/** Initial preferences (overrides defaults) */\n\tinitial?: Partial<ICalendarPreferences>;\n\t/** Storage key for persistence (if provided, uses localStorage) */\n\tstorageKey?: string;\n\t/** Callback when preferences change */\n\tonChange?: (preferences: ICalendarPreferences) => void;\n}\n\nexport interface UsePreferencesReturn {\n\t/** Current preferences */\n\tpreferences: ICalendarPreferences;\n\t/** Update preferences */\n\tsetPreferences: (updates: Partial<ICalendarPreferences>) => void;\n\t/** Reset to defaults */\n\tresetPreferences: () => void;\n\t/** Get a specific preference */\n\tgetPreference: <K extends keyof ICalendarPreferences>(key: K) => ICalendarPreferences[K];\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function usePreferences(options: UsePreferencesOptions = {}): UsePreferencesReturn {\n\tconst { initial = {}, storageKey, onChange } = options;\n\n\t// Load from storage or use defaults\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tconst stored = localStorage.getItem(storageKey);\n\t\t\t\tif (stored) {\n\t\t\t\t\tconst parsed = JSON.parse(stored) as Partial<ICalendarPreferences>;\n\t\t\t\t\treturn { ...DEFAULT_PREFERENCES, ...parsed, ...initial };\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore parsing errors\n\t\t\t}\n\t\t}\n\t\treturn { ...DEFAULT_PREFERENCES, ...initial };\n\t});\n\n\t// Persist to storage when preferences change\n\tuseEffect(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tlocalStorage.setItem(storageKey, JSON.stringify(preferences));\n\t\t\t} catch {\n\t\t\t\t// Ignore storage errors\n\t\t\t}\n\t\t}\n\t}, [preferences, storageKey]);\n\n\tconst setPreferences = useCallback(\n\t\t(updates: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onChange]\n\t);\n\n\tconst resetPreferences = useCallback(() => {\n\t\tconst defaults = { ...DEFAULT_PREFERENCES, ...initial };\n\t\tsetPreferencesState(defaults);\n\t\tonChange?.(defaults);\n\t}, [initial, onChange]);\n\n\tconst getPreference = useCallback(\n\t\t<K extends keyof ICalendarPreferences>(key: K): ICalendarPreferences[K] => {\n\t\t\treturn preferences[key];\n\t\t},\n\t\t[preferences]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tgetPreference,\n\t};\n}\n","/**\n * useSlotSelection - Drag-to-Select Hook\n *\n * Handles mouse/touch interactions for creating events by\n * selecting time slots in the calendar grid.\n */\n\nimport { useCallback, useRef, useState } from 'react';\nimport { DEFAULT_HOUR_HEIGHT } from '../constants';\nimport type { ISelectionResult, ISlotSelection, IVisibleHours } from '../types';\nimport { addMinutes } from '../utils/date-utils';\nimport { yToTime } from '../utils/position-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseSlotSelectionOptions {\n\t/** Current day being selected on */\n\tdayStart: Date;\n\t/** Visible hours configuration */\n\tvisibleHours: IVisibleHours;\n\t/** Height of one hour in pixels */\n\thourHeight?: number;\n\t/** Slot duration in minutes for snapping */\n\tslotDuration?: number;\n\t/** Resource ID (for resource views) */\n\tresourceId?: string;\n\t/** Whether selection is enabled */\n\tenabled?: boolean;\n\t/** Callback when selection completes */\n\tonSelect?: (selection: ISelectionResult) => void;\n}\n\nexport interface UseSlotSelectionReturn {\n\t/** Current selection state */\n\tselection: ISlotSelection;\n\t/** Selection overlay for rendering */\n\toverlay: { top: number; height: number; visible: boolean };\n\t/** Handler for mouse/touch down */\n\thandlePointerDown: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch move */\n\thandlePointerMove: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch up */\n\thandlePointerUp: () => void;\n\t/** Cancel current selection */\n\tcancel: () => void;\n\t/** Whether currently selecting */\n\tisSelecting: boolean;\n}\n\n// ============================================================================\n// INITIAL STATE\n// ============================================================================\n\nconst INITIAL_SELECTION: ISlotSelection = {\n\tisSelecting: false,\n\tstartDate: null,\n\tendDate: null,\n\tstartY: null,\n\tcurrentY: null,\n\tresourceId: undefined,\n};\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useSlotSelection(options: UseSlotSelectionOptions): UseSlotSelectionReturn {\n\tconst {\n\t\tdayStart,\n\t\tvisibleHours,\n\t\thourHeight = DEFAULT_HOUR_HEIGHT,\n\t\tslotDuration = 30,\n\t\tresourceId,\n\t\tenabled = true,\n\t\tonSelect,\n\t} = options;\n\n\tconst [selection, setSelection] = useState<ISlotSelection>(INITIAL_SELECTION);\n\tconst containerHeightRef = useRef<number>(0);\n\n\t// ========================================================================\n\t// HANDLERS\n\t// ========================================================================\n\n\tconst handlePointerDown = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!enabled) return;\n\n\t\t\tconst y = e.clientY - containerRect.top;\n\t\t\tcontainerHeightRef.current = containerRect.height;\n\n\t\t\tconst startTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection({\n\t\t\t\tisSelecting: true,\n\t\t\t\tstartDate: startTime,\n\t\t\t\tendDate: addMinutes(startTime, slotDuration),\n\t\t\t\tstartY: y,\n\t\t\t\tcurrentY: y,\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t},\n\t\t[enabled, dayStart, visibleHours, hourHeight, slotDuration, resourceId]\n\t);\n\n\tconst handlePointerMove = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!selection.isSelecting || !selection.startY) return;\n\n\t\t\tconst y = Math.max(0, Math.min(e.clientY - containerRect.top, containerRect.height));\n\t\t\tconst currentTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection((prev) => {\n\t\t\t\tif (!prev.startDate) return prev;\n\n\t\t\t\t// Determine if dragging up or down\n\t\t\t\tconst isDraggingDown = y >= (prev.startY ?? 0);\n\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tcurrentY: y,\n\t\t\t\t\tendDate: isDraggingDown ? addMinutes(currentTime, slotDuration) : currentTime,\n\t\t\t\t\tstartDate: isDraggingDown ? prev.startDate : currentTime,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\t[selection.isSelecting, selection.startY, dayStart, visibleHours, hourHeight, slotDuration]\n\t);\n\n\tconst handlePointerUp = useCallback(() => {\n\t\tif (!selection.isSelecting || !selection.startDate || !selection.endDate) {\n\t\t\tsetSelection(INITIAL_SELECTION);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure start is before end\n\t\tconst start = selection.startDate < selection.endDate ? selection.startDate : selection.endDate;\n\t\tconst end = selection.startDate < selection.endDate ? selection.endDate : selection.startDate;\n\n\t\tconst result: ISelectionResult = {\n\t\t\tstartDate: start,\n\t\t\tendDate: end,\n\t\t\tresourceId: selection.resourceId,\n\t\t};\n\n\t\tonSelect?.(result);\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, [selection, onSelect]);\n\n\tconst cancel = useCallback(() => {\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, []);\n\n\t// ========================================================================\n\t// OVERLAY CALCULATION\n\t// ========================================================================\n\n\tconst overlay = (() => {\n\t\tif (!selection.isSelecting || selection.startY === null || selection.currentY === null) {\n\t\t\treturn { top: 0, height: 0, visible: false };\n\t\t}\n\n\t\tconst minY = Math.min(selection.startY, selection.currentY);\n\t\tconst maxY = Math.max(selection.startY, selection.currentY);\n\n\t\treturn {\n\t\t\ttop: minY,\n\t\t\theight: Math.max(maxY - minY, 20), // Minimum height\n\t\t\tvisible: true,\n\t\t};\n\t})();\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\tselection,\n\t\toverlay,\n\t\thandlePointerDown,\n\t\thandlePointerMove,\n\t\thandlePointerUp,\n\t\tcancel,\n\t\tisSelecting: selection.isSelecting,\n\t};\n}\n"],"names":["useCalendarTimeConfig","preferences","setPreferences","useCalendarContext","visibleHours","useMemo","workingHours","setVisibleHours","useCallback","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","options","initial","storageKey","onChange","setPreferencesState","useState","stored","parsed","DEFAULT_PREFERENCES","useEffect","updates","prev","next","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","selection","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","result","cancel","overlay","minY","maxY"],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ "use strict";const e=require("react/jsx-runtime"),a=require("react"),c=require("./index-D2U2F80P.cjs"),st=require("@radix-ui/react-dropdown-menu"),g=require("./utils.cjs"),oe=require("./slot-selection-context-BCsC7WT7.cjs"),rt=require("@radix-ui/react-popover"),ot=require("@radix-ui/react-tooltip");function Ne(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const ee=Ne(a),U=Ne(st),de=Ne(rt),pe=Ne(ot),Z=de.Root,Q=de.Trigger,at=de.Anchor,X=ee.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},o)=>e.jsx(de.Portal,{children:e.jsx(de.Content,{ref:o,align:n,sideOffset:s,className:c.cn("z-50 w-72 rounded-xl border bg-white text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));X.displayName=de.Content.displayName;const it=pe.Provider,ne=pe.Root,se=pe.Trigger,J=ee.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(pe.Content,{ref:r,sideOffset:n,className:c.cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));J.displayName=pe.Content.displayName;function re(t){return{blue:{bg:"bg-blue-50 dark:bg-blue-950/30",text:"text-blue-700 dark:text-blue-300",dot:"bg-blue-500",dotFill:"fill-blue-600 dark:fill-blue-500",border:"border-blue-400 dark:border-blue-600",accentBorder:"border-l-blue-500 dark:border-l-blue-400"},green:{bg:"bg-green-50 dark:bg-green-950/30",text:"text-green-700 dark:text-green-300",dot:"bg-green-500",dotFill:"fill-green-600 dark:fill-green-500",border:"border-green-400 dark:border-green-600",accentBorder:"border-l-green-500 dark:border-l-green-400"},red:{bg:"bg-red-50 dark:bg-red-950/30",text:"text-red-700 dark:text-red-300",dot:"bg-red-500",dotFill:"fill-red-600 dark:fill-red-500",border:"border-red-400 dark:border-red-600",accentBorder:"border-l-red-500 dark:border-l-red-400"},yellow:{bg:"bg-yellow-50 dark:bg-yellow-950/30",text:"text-yellow-700 dark:text-yellow-300",dot:"bg-yellow-500",dotFill:"fill-yellow-600 dark:fill-yellow-500",border:"border-yellow-400 dark:border-yellow-600",accentBorder:"border-l-yellow-500 dark:border-l-yellow-400"},purple:{bg:"bg-purple-50 dark:bg-purple-950/30",text:"text-purple-700 dark:text-purple-300",dot:"bg-purple-500",dotFill:"fill-purple-600 dark:fill-purple-500",border:"border-purple-400 dark:border-purple-600",accentBorder:"border-l-purple-500 dark:border-l-purple-400"},orange:{bg:"bg-orange-50 dark:bg-orange-950/30",text:"text-orange-700 dark:text-orange-300",dot:"bg-orange-500",dotFill:"fill-orange-600 dark:fill-orange-500",border:"border-orange-400 dark:border-orange-600",accentBorder:"border-l-orange-500 dark:border-l-orange-400"},pink:{bg:"bg-pink-50 dark:bg-pink-950/30",text:"text-pink-700 dark:text-pink-300",dot:"bg-pink-500",dotFill:"fill-pink-600 dark:fill-pink-500",border:"border-pink-400 dark:border-pink-600",accentBorder:"border-l-pink-500 dark:border-l-pink-400"},teal:{bg:"bg-teal-50 dark:bg-teal-950/30",text:"text-teal-700 dark:text-teal-300",dot:"bg-teal-500",dotFill:"fill-teal-600 dark:fill-teal-500",border:"border-teal-400 dark:border-teal-600",accentBorder:"border-l-teal-500 dark:border-l-teal-400"},gray:{bg:"bg-gray-50 dark:bg-gray-950/30",text:"text-gray-700 dark:text-gray-300",dot:"bg-gray-500",dotFill:"fill-gray-600 dark:fill-gray-500",border:"border-gray-400 dark:border-gray-600",accentBorder:"border-l-gray-500 dark:border-l-gray-400"},indigo:{bg:"bg-indigo-50 dark:bg-indigo-950/30",text:"text-indigo-700 dark:text-indigo-300",dot:"bg-indigo-500",dotFill:"fill-indigo-600 dark:fill-indigo-500",border:"border-indigo-400 dark:border-indigo-600",accentBorder:"border-l-indigo-500 dark:border-l-indigo-400"}}[t??"blue"]}function Fe(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function he({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:o,showTime:p=!0,showDescription:i=!1,showParticipants:y=!1,style:N,disablePopover:l=!1,renderPopover:b,enableDrag:w=!1,enablePageTransition:m=!1,pageTransitionDuration:f=400}){const u=re(t.color),[v,j]=a.useState(!1),[W,E]=a.useState(!1),[S,I]=a.useState(!1),[M,L]=a.useState(null),A=a.useRef(null),B=oe.useOptionalDragDrop(),T=oe.useOptionalInnoCalendar();a.useEffect(()=>{if(!l&&T?.focusEventId&&T.focusEventId===t.id){const P=setTimeout(()=>{j(!0),T.clearFocusEventId()},300);return()=>clearTimeout(P)}},[T?.focusEventId,t.id,l]);const F=t.endDate<Fe(new Date),$=t.isCanceled??!1,D=w&&B&&!$&&!F,x=t.data,_=x?.meetingTookPlace??t.meetingTookPlace??!1,z=$?e.jsx(dt,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):_?e.jsx(lt,{className:c.cn("h-3 w-3",u.text)}):null,q=t.scheduleTypeName||x?.scheduleTypeName||x?.typeName,k=x?.productName,d=x?.nrParticipant,h=x?.siteName,C=x?.siteCity,H=[h,C].filter(Boolean).join(", "),O=a.useCallback(()=>{if(!W){if(l&&r){r(t);return}if(m&&A.current){const P=A.current.getBoundingClientRect();L(P),I(!0)}else l||j(!0)}},[W,l,r,t,m]);a.useCallback(()=>{I(!1),L(null),l||j(!0)},[l]);const R=a.useCallback(()=>{j(!1)},[]),V=a.useCallback(P=>{D&&(P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",t.id),E(!0),B?.startDrag?.(t))},[D,t,B]),G=a.useCallback(()=>{E(!1),B?.isDragging&&B.endDrag?.()},[B]);if(n==="dot"){const P=e.jsx("button",{type:"button",onClick:O,className:c.cn("size-2 rounded-full cursor-pointer transition-opacity",u.dot,t.isCanceled&&"opacity-50",o),style:N,"aria-label":t.title});return l?e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:P}),e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs opacity-80",children:g.formatEventTimeDisplay(t)})]})})]}):e.jsxs(Z,{open:v,onOpenChange:j,children:[e.jsx(Q,{asChild:!0,children:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:P}),e.jsx(J,{children:e.jsx("div",{className:"font-medium",children:t.title})})]})}),e.jsx(X,{className:"w-80",children:b?b({event:t,onClose:R}):e.jsx(me,{event:t,onClose:R})})]})}if(n==="compact"){const P=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!D,onDragStart:V,onDragEnd:G,onClick:l?O:void 0,onKeyDown:K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),O())},className:c.cn("group flex w-full relative items-center shadow-[0_0_1px_rgba(0,0,0,0.3)] gap-0 rounded px-1.5 py-1 text-left text-xs transition-colors hover:opacity-80",D?"cursor-grab active:cursor-grabbing":"cursor-pointer",W&&"opacity-50",$?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[u.bg,u.text],s==="mixed"&&[u.bg,u.text],s==="dot"&&"bg-muted/50"],o),style:N,children:[["dot","mixed"].includes(s)&&!$&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot absolute -top-1 -left-1 shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:u.dotFill})}),e.jsx("span",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsxs("span",{className:"",children:[e.jsx("span",{className:"relative block overflow-hidden whitespace-nowrap text-xs leading-tight",style:{maskImage:"linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)",WebkitMaskImage:"linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)"},children:e.jsxs("span",{className:"inline-flex event-marquee",children:[e.jsx("span",{className:"shrink-0 px-1",children:t.title}),e.jsx("span",{className:"shrink-0 px-1",children:"•"}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 px-1",children:t.title}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 px-1",children:"•"})]})}),e.jsx("div",{className:c.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",u.border),children:g.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:z})]});return l?e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:P}),e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t)})]})})]}):e.jsxs(Z,{open:v,onOpenChange:j,children:[e.jsx(Q,{asChild:!0,children:P}),e.jsx(X,{className:"w-80",children:b?b({event:t,onClose:R}):e.jsx(me,{event:t,onClose:R})})]})}const te=e.jsxs("button",{type:"button",onClick:O,className:c.cn("group relative flex w-full flex-col gap-1 rounded-md border-l-[3px] px-2 py-1.5 text-left transition-all","shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",$?"bg-zinc-100 dark:bg-zinc-800 border-l-zinc-400 dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[u.bg,u.accentBorder,u.text],s==="mixed"&&[u.bg,u.accentBorder,u.text],s==="dot"&&"bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"],o),style:N,children:[e.jsxs("div",{className:"flex items-start justify-between gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[["dot","mixed"].includes(s)&&!$&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:u.dotFill})}),e.jsxs("span",{className:c.cn("text-sm font-medium truncate",!$&&s!=="dot"&&u.text,$&&"line-through"),children:[t.title,q&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",q]})]})]}),z]}),k&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k}),d!=null&&d>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Se,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[d," participant",d!==1?"s":""]})]}),p&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ee,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:g.formatEventTimeDisplay(t)})]}),H&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(qe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:H})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),y&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Se,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(P=>P.name).join(", ")})]})]});return l?e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:te}),e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t)})]})})]}):e.jsxs(Z,{open:v,onOpenChange:j,children:[e.jsx(Q,{asChild:!0,children:te}),e.jsx(X,{className:"w-80",children:b?b({event:t,onClose:R}):e.jsx(me,{event:t,onClose:R})})]})}function Ee({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("polyline",{points:"12 6 12 12 16 14"})]})}function lt({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 dt({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 Se({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 qe({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 me({event:t,onClose:n}){const s=re(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:c.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:c.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1",children:[e.jsx(Ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:g.formatEventTimeDisplay(t)})]})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),t.isRecurring&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"Recurring"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function Le({event:t,position:n,hourHeight:s=96,badgeVariant:r="colored",onClick:o,className:p,disablePopover:i=!1,renderPopover:y,enableDrag:N=!0}){const l=re(t.color),[b,w]=a.useState(!1),[m,f]=a.useState(!1),u=oe.useOptionalDragDrop(),v=oe.useOptionalInnoCalendar();a.useEffect(()=>{if(!i&&v?.focusEventId&&v.focusEventId===t.id){const R=setTimeout(()=>{w(!0),v.clearFocusEventId()},300);return()=>clearTimeout(R)}},[v?.focusEventId,t.id,i]);const j=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),W=j/60*s-8,E=t.endDate<Fe(new Date),S=t.isCanceled??!1,I=N&&u&&!S&&!E,M=j<35,L=j>25,A=j>=45,B=t.data,T=t.scheduleTypeName||B?.scheduleTypeName||B?.typeName,F=B?.productName,$=B?.nrParticipant,D=B?.siteName,x=B?.siteCity,_=[D,x].filter(Boolean).join(", "),z=r==="dot",q=a.useCallback(()=>{m||(i&&o?o(t):i||w(!0))},[m,i,o,t]),k=a.useCallback(()=>{w(!1)},[]),d=a.useCallback(R=>{if(!I)return;R.dataTransfer.effectAllowed="move",R.dataTransfer.setData("text/plain",t.id);const V=R.currentTarget,G=V.getBoundingClientRect();R.dataTransfer.setDragImage(V,R.clientX-G.left,R.clientY-G.top),f(!0),u?.startDrag?.(t)},[I,t,u]),h=a.useCallback(()=>{f(!1),u?.isDragging&&u.endDrag?.()},[u]),C=a.useCallback(R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),q())},[q]),H=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!I,onDragStart:d,onDragEnd:h,onKeyDown:C,onClick:m?void 0:q,className:c.cn("group flex w-full select-none flex-col gap-0.5 overflow-hidden rounded-md border-l-[3px] px-2 py-1.5 text-xs text-left","shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-all",I?"cursor-grab active:cursor-grabbing":"cursor-pointer",m&&"opacity-50",S?"bg-zinc-100 dark:bg-zinc-800 border-l-zinc-400 dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400 line-through":[!z&&[l.bg,l.accentBorder,l.text],z&&"bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"],M&&"py-0 justify-center",p),style:{height:`${Math.max(W,20)}px`},children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!S&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:l.dotFill})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsxs("p",{className:c.cn("font-semibold truncate leading-tight",!S&&z&&"text-foreground"),children:[t.title,T&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",T]})]})})]}),A&&F&&e.jsx("p",{className:c.cn("text-[11px] truncate leading-tight",z?"text-muted-foreground":"opacity-80"),children:F}),$!=null&&$>0&&e.jsxs("div",{className:c.cn("flex items-center gap-1 text-[11px] leading-tight",z?"text-muted-foreground":"opacity-80"),children:[e.jsx(Se,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[$," participant",$!==1?"s":""]})]}),L&&e.jsxs("div",{className:c.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",z?"text-muted-foreground":"opacity-90"),children:[e.jsx(Ee,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:g.formatEventTimeDisplay(t)})]}),A&&_&&e.jsxs("div",{className:c.cn("flex items-center gap-1 text-[11px] truncate leading-tight",z?"text-muted-foreground":"opacity-80"),children:[e.jsx(qe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:_})]})]}),O=e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"font-medium",children:[t.title,T&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",T]})]}),F&&e.jsx("div",{className:"text-xs text-muted-foreground",children:F}),$!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[$," participant",$!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t)}),_&&e.jsx("div",{className:"text-xs text-muted-foreground",children:_})]})});return i?e.jsx("div",{className:"absolute p-0.5",style:{top:`${n.top}px`,left:`${n.left}%`,width:n.minWidth?`max(${n.minWidth}px, ${n.width}%)`:`${n.width}%`,minWidth:n.minWidth?`${n.minWidth}px`:void 0},children:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:H}),O]})}):e.jsx("div",{className:"absolute p-0.5",style:{top:`${n.top}px`,left:`${n.left}%`,width:n.minWidth?`max(${n.minWidth}px, ${n.width}%)`:`${n.width}%`,minWidth:n.minWidth?`${n.minWidth}px`:void 0},children:e.jsxs(Z,{open:b,onOpenChange:w,children:[e.jsx(Q,{asChild:!0,children:H}),e.jsx(X,{className:"w-80",children:y?y({event:t,onClose:k}):e.jsx(me,{event:t,onClose:k})})]})})}function ct({event:t,spanDays:n,isStart:s,isEnd:r,onClick:o,className:p,disablePopover:i=!1,renderPopover:y}){const N=re(t.color),[l,b]=a.useState(!1),w=t.isCanceled??!1,m=a.useCallback(()=>{i&&o?o(t):i||b(!0)},[i,o,t]),f=a.useCallback(()=>{b(!1)},[]),u=e.jsx("button",{type:"button",onClick:m,className:c.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",w?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[N.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",!s&&"border-l-0",!r&&"border-r-0",p),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),v=e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t)})]})});return i?e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:u}),v]}):e.jsxs(Z,{open:l,onOpenChange:b,children:[e.jsx(Q,{asChild:!0,children:u}),e.jsx(X,{className:"w-80",children:y?y({event:t,onClose:f}):e.jsx(me,{event:t,onClose:f})})]})}if(typeof window<"u"&&!document.getElementById("inno-calendar-event-marquee-style")){const t=document.createElement("style");t.id="inno-calendar-event-marquee-style",t.innerHTML=`
2
+ @keyframes event-marquee {
3
+ 0% { transform: translateX(0); }
4
+ 100% { transform: translateX(-50%); }
5
+ }
6
+ .event-marquee {
7
+ animation: event-marquee 28s linear infinite;
8
+ will-change: transform;
9
+ }
10
+ `,document.head.appendChild(t)}const ze=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Be=c.clsx,Ge=(t,n)=>s=>{var r;if(n?.variants==null)return Be(t,s?.class,s?.className);const{variants:o,defaultVariants:p}=n,i=Object.keys(o).map(l=>{const b=s?.[l],w=p?.[l];if(b===null)return null;const m=ze(b)||ze(w);return o[l][m]}),y=s&&Object.entries(s).reduce((l,b)=>{let[w,m]=b;return m===void 0||(l[w]=m),l},{}),N=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((l,b)=>{let{class:w,className:m,...f}=b;return Object.entries(f).every(u=>{let[v,j]=u;return Array.isArray(j)?j.includes({...p,...y}[v]):{...p,...y}[v]===j})?[...l,w,m]:l},[]);return Be(t,i,N,s?.class,s?.className)},Ue=Ge("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input active:!bg-zinc-100 hover:!bg-zinc-50 active:bg-white !bg-white hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ae=a.forwardRef(({className:t,variant:n,size:s,loading:r,disabled:o,children:p,...i},y)=>e.jsxs("button",{className:c.cn(Ue({variant:n,size:s,className:t})),ref:y,disabled:o||r,...i,children:[r&&e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 size-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),p]}));ae.displayName="Button";const Ke=(...t)=>t.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();const ut=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const xt=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,s,r)=>r?r.toUpperCase():s.toLowerCase());const Ie=t=>{const n=xt(t);return n.charAt(0).toUpperCase()+n.slice(1)};var mt={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"};const ht=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const pt=a.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:o="",children:p,iconNode:i,...y},N)=>a.createElement("svg",{ref:N,...mt,width:n,height:n,stroke:t,strokeWidth:r?Number(s)*24/Number(n):s,className:Ke("lucide",o),...!p&&!ht(y)&&{"aria-hidden":"true"},...y},[...i.map(([l,b])=>a.createElement(l,b)),...Array.isArray(p)?p:[p]]));const Ae=(t,n)=>{const s=a.forwardRef(({className:r,...o},p)=>a.createElement(pt,{ref:p,iconNode:n,className:Ke(`lucide-${ut(Ie(t))}`,`lucide-${t}`,r),...o}));return s.displayName=Ie(t),s};const ft=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],gt=Ae("check",ft);const yt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bt=Ae("chevron-right",yt);const jt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wt=Ae("circle",jt),Me=U.Root,Te=U.Trigger,vt=ee.forwardRef(({className:t,inset:n,children:s,...r},o)=>e.jsxs(U.SubTrigger,{ref:o,className:c.cn("flex cursor-default select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",t),...r,children:[s,e.jsx(bt,{className:"ml-auto h-4 w-4"})]}));vt.displayName=U.SubTrigger.displayName;const Nt=ee.forwardRef(({className:t,...n},s)=>e.jsx(U.SubContent,{ref:s,className:c.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));Nt.displayName=U.SubContent.displayName;const je=ee.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(U.Portal,{children:e.jsx(U.Content,{ref:r,sideOffset:n,className:c.cn("z-50 rounded-xl border bg-popover p-1 text-popover-foreground shadow-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));je.displayName=U.Content.displayName;const we=ee.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Item,{ref:r,className:c.cn("relative flex cursor-pointer select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...s}));we.displayName=U.Item.displayName;const kt=ee.forwardRef(({className:t,children:n,checked:s=!1,...r},o)=>e.jsxs(U.CheckboxItem,{ref:o,className:c.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:s,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(U.ItemIndicator,{children:e.jsx(gt,{className:"h-4 w-4"})})}),n]}));kt.displayName=U.CheckboxItem.displayName;const Dt=ee.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(U.RadioItem,{ref:r,className:c.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(U.ItemIndicator,{children:e.jsx(wt,{className:"h-2 w-2 fill-current"})})}),n]}));Dt.displayName=U.RadioItem.displayName;const Ct=ee.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Label,{ref:r,className:c.cn("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...s}));Ct.displayName=U.Label.displayName;const St=ee.forwardRef(({className:t,...n},s)=>e.jsx(U.Separator,{ref:s,className:c.cn("-mx-1 my-1 h-px bg-muted",t),...n}));St.displayName=U.Separator.displayName;const Mt=Ge("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Xe({className:t,variant:n,...s}){return e.jsx("div",{className:c.cn(Mt({variant:n}),t),...s})}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:"m15 18-6-6 6-6"})})}function Et({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:"m9 18 6-6-6-6"})})}const Lt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Ye({date:t,view:n,events:s=[],onNavigatePrev:r,onNavigateNext:o,weekStartsOn:p=1,showEventCount:i=!0,className:y}){const N=Lt[t.getMonth()],l=t.getFullYear(),b=i?g.getEventsCountInView(s,t,n,p):0,w=g.getRangeText(t,n);return e.jsxs("div",{className:c.cn("min-w-0 flex-1",y),children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-base sm:text-lg font-semibold truncate",children:[N," ",l]}),i&&e.jsx(Xe,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:b})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(ae,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(Tt,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:w}),e.jsx(ae,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:o,children:e.jsx(Et,{})})]})]})}const At=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function Je({onClick:t,className:n}){const s=new Date;return e.jsxs("button",{type:"button",className:c.cn("flex size-11 sm:size-14 flex-col items-start overflow-hidden rounded-lg border shrink-0","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","hover:bg-accent/50 transition-colors",n),onClick:t,children:[e.jsx("p",{className:"flex h-4 sm:h-6 w-full items-center justify-center bg-primary text-center text-[10px] sm:text-xs font-semibold text-primary-foreground",children:At[s.getMonth()]}),e.jsx("p",{className:"flex w-full flex-1 items-center justify-center text-sm sm:text-lg font-bold",children:s.getDate()})]})}function Wt({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:"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 le({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M9 8h7"}),e.jsx("path",{d:"M8 12h6"}),e.jsx("path",{d:"M11 16h5"})]})}function Re({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:"m6 9 6 6 6-6"})})}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:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function $e({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:"M5 12h14"}),e.jsx("path",{d:"M12 5v14"})]})}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("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),e.jsx("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),e.jsx("path",{d:"M14 4h7"}),e.jsx("path",{d:"M14 9h7"}),e.jsx("path",{d:"M14 15h7"}),e.jsx("path",{d:"M14 20h7"})]})}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("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M12 3v18"})]})}function It({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 12h18"}),e.jsx("path",{d:"M12 3v18"})]})}function Rt({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M3 15h18"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M15 3v18"})]})}const $t=[{value:"day",label:"Day",icon:zt},{value:"week",label:"Week",icon:Bt},{value:"month",label:"Month",icon:It},{value:"year",label:"Year",icon:Rt}],He=[{value:"timeline-day",label:"1 Day",icon:le},{value:"timeline-3day",label:"3 Days",icon:le},{value:"timeline-week",label:"7 Days",icon:le}],Ht=[{value:"resource-day",label:"1 Day",icon:le},{value:"resource-week",label:"7 Days",icon:le}];function Ot({currentDate:t,view:n,events:s=[],onNavigateToday:r,onNavigatePrev:o,onNavigateNext:p,onNavigate:i,onViewChange:y,onAddEvent:N,availableViews:l=["day","week","month","agenda"],showTimelineViews:b=!1,timelineViews:w,settingsContent:m,showSettings:f=!1,filterContent:u,actions:v,className:j,weekStartsOn:W=1,labels:E={}}){const S=a.useMemo(()=>({today:"Today",addEvent:"Add Event",calendarView:"Calendar View",resourceView:"Resource View",...E}),[E]),I=()=>{r?.(),i?.("today")},M=()=>{o?.(),i?.("prev")},L=()=>{p?.(),i?.("next")},A=["day","week","month","year","agenda"].includes(n),B=n.startsWith("timeline-")||n.startsWith("resource-"),T=$t.filter(x=>l.includes(x.value)),F=A?T.find(x=>x.value===n):null,$=[...He,...Ht],D=B?$.find(x=>x.value===n):null;return e.jsxs("div",{className:c.cn("flex flex-col w-full gap-3 mb-2",j),children:[e.jsxs("div",{className:"flex lg:flex-row flex-col w-full justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx(Je,{onClick:I}),e.jsx(Ye,{date:t,view:n,events:s,onNavigatePrev:M,onNavigateNext:L,weekStartsOn:W})]}),N&&e.jsx(ae,{size:"icon",className:"shrink-0 lg:hidden",onClick:N,children:e.jsx($e,{className:"size-4"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none",children:[y&&T.length>0&&e.jsxs(Me,{children:[e.jsxs(Te,{className:c.cn("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",A?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-background hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(Wt,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:F?.label??S.calendarView}),e.jsx(Re,{className:"size-3 opacity-60"})]}),e.jsx(je,{align:"start",className:"min-w-[120px]",children:T.map(x=>{const _=x.icon;return e.jsxs(we,{onClick:()=>y(x.value),className:c.cn("gap-2",n===x.value&&"bg-accent"),children:[e.jsx(_,{className:"size-4"}),e.jsx("span",{children:x.label})]},x.value)})})]}),b&&y&&e.jsxs(Me,{children:[e.jsxs(Te,{className:c.cn("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",B?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-white hover:bg-zinc-50 hover:text-accent-foreground"),children:[e.jsx(le,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:D?.label??S.resourceView}),e.jsx(Re,{className:"size-3 opacity-60"})]}),e.jsx(je,{align:"start",className:"min-w-[120px]",children:He.map(x=>{const _=x.icon;return e.jsxs(we,{onClick:()=>y(x.value),className:c.cn("gap-2",n===x.value&&"bg-accent"),children:[e.jsx(_,{className:"size-4"}),e.jsx("span",{children:x.label})]},x.value)})})]}),f&&m&&e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:e.jsx(ae,{variant:"outline",size:"icon",className:"min-w-10 min-h-10 shrink-0 mx-0",children:e.jsx(_t,{className:"size-4 sm:size-5"})})}),e.jsx(X,{className:"w-auto min-w-80 p-0",align:"end",sideOffset:8,children:e.jsx("div",{className:"max-h-[70vh] overflow-y-auto p-4 space-y-6",children:m})})]}),v,N&&e.jsxs(ae,{className:"hidden lg:flex shrink-0 max-h-10",onClick:N,children:[e.jsx($e,{className:"size-4"}),S.addEvent]})]})]}),u&&e.jsx("div",{className:"flex items-center gap-2 pb-1 -mb-1 scrollbar-none",children:u})]})}function Pt({events:t,date:n,daysAhead:s=60,badgeVariant:r="colored",onEventClick:o,className:p,renderEvent:i,renderPopover:y,slots:N,classNames:l}){const b=a.useMemo(()=>{const m=new Date(n);m.setHours(0,0,0,0);const f=new Date(m);return f.setDate(f.getDate()+s),t.filter(u=>u.endDate>=m&&u.startDate<=f)},[t,s,n]),w=a.useMemo(()=>{const m=g.groupEventsByDate(b),f=[];for(const[u,v]of m)f.push({date:new Date(u),dateKey:u,events:v});return f.sort((u,v)=>u.date.getTime()-v.date.getTime()),f},[b]);return w.length===0?e.jsx("div",{className:c.cn("flex flex-col items-center justify-center h-full py-12",p),children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:"No events found"}),e.jsx("p",{className:"text-sm text-muted-foreground/70",children:"No events scheduled for this period"})]})}):e.jsxs("div",{className:c.cn("flex flex-col h-full overflow-auto",l?.agendaList,p),children:[e.jsx("div",{className:"sticky top-0 z-10 bg-background border-b px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-medium",children:"Schedule"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[b.length," event",b.length!==1?"s":""]})]})}),e.jsx("div",{className:"flex-1",children:w.map(({date:m,dateKey:f,events:u})=>{const v=g.isToday(m),j=m.toLocaleDateString([],{weekday:"short"}),W=m.getDate(),E=m.toLocaleDateString([],{month:"short"});return e.jsxs("div",{className:c.cn("",l?.agendaDayGroup),children:[e.jsx("div",{className:c.cn("sticky top-[52px] z-10 bg-background px-4 py-3 border-b",l?.agendaDayHeader),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center min-w-[40px]",children:[e.jsx("span",{className:c.cn("text-[11px] font-medium uppercase tracking-wide",v?"text-primary":"text-muted-foreground"),children:j}),e.jsx("span",{className:c.cn("flex items-center justify-center rounded-full mt-0.5","size-10 text-xl font-normal",v?"bg-primary text-primary-foreground":"text-foreground"),children:W})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[E," ",m.getFullYear()]})]})}),e.jsx("div",{className:"px-4 py-3 space-y-2 border-b last:border-b-0",children:u.map(S=>i?e.jsx("div",{children:i({event:S,variant:"full"})},S.id):e.jsx(he,{event:S,variant:"full",badgeVariant:r,onClick:o,disablePopover:!!o&&!y,renderPopover:y,showTime:!0,showDescription:!0,showParticipants:!0,...l?.eventCard&&{className:l.eventCard}},S.id))})]},f)})})]})}const fe=360,ge=480,ke=280;function Ze({isOpen:t,onClose:n,date:s,events:r,anchorRect:o,badgeVariant:p="colored",onEventClick:i,renderEvent:y,renderPopover:N,className:l}){const b=a.useRef(null),w=a.useRef(null),[m,f]=a.useState("closed"),u=a.useMemo(()=>[...r].sort((M,L)=>M.startDate.getTime()-L.startDate.getTime()),[r]),v=a.useMemo(()=>{if(!o)return{top:0,left:0,width:fe,maxHeight:ge};const M=typeof window<"u"?window.innerWidth:1200,L=typeof window<"u"?window.innerHeight:800;let A=o.left+o.width/2-fe/2;A=Math.max(16,Math.min(A,M-fe-16));const B=Math.min(r.length*68+80,ge);let T=o.top+o.height/2-B/2;return T=Math.max(16,Math.min(T,L-B-16)),{top:T,left:A,width:fe,maxHeight:ge}},[o,r.length]);a.useLayoutEffect(()=>{if(t&&o)f("entering"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{f("open")})});else if(!t&&m==="open"){f("exiting");const M=setTimeout(()=>{f("closed")},ke);return()=>clearTimeout(M)}},[t,o]),a.useEffect(()=>{if(m==="closed")return;const M=L=>{L.key==="Escape"&&(L.stopPropagation(),n())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[m,n]),a.useEffect(()=>{m==="open"&&w.current&&w.current.focus()},[m]);const j=a.useCallback(M=>{M.target===b.current&&n()},[n]);if(m==="closed")return null;const W=m==="entering"||m==="exiting",E=W&&o?{position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,maxHeight:o.height,opacity:m==="entering"?.7:0,transform:"scale(1)",borderRadius:"8px"}:{position:"fixed",top:v.top,left:v.left,width:v.width,maxHeight:v.maxHeight,opacity:1,transform:"scale(1)",borderRadius:"12px"},S=W?0:1,I=s.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:b,role:"presentation",onClick:j,className:"ic-expansion-backdrop",style:{position:"fixed",inset:0,zIndex:50,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:S,transition:`opacity ${ke}ms cubic-bezier(0.32, 0.72, 0, 1)`}}),e.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":`Events for ${I}`,tabIndex:-1,className:c.cn("ic-expansion-panel","bg-background border border-border shadow-2xl overflow-hidden","focus:outline-none",l),style:{...E,zIndex:51,transition:`all ${ke}ms cubic-bezier(0.32, 0.72, 0, 1)`,willChange:"top, left, width, height, max-height, opacity, border-radius"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b bg-muted/30",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:I}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.length," event",r.length!==1?"s":""]})]}),e.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center size-7 rounded-full hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":"Close",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]}),e.jsxs("div",{className:"overflow-y-auto px-3 py-2 space-y-1.5",style:{maxHeight:`${ge-64}px`},children:[u.map(M=>e.jsx("div",{onPointerDown:L=>L.stopPropagation(),children:y?y({event:M,variant:"compact"}):e.jsx(he,{event:M,variant:"compact",badgeVariant:p,onClick:L=>{n(),i?.(L)},disablePopover:!!i&&!N,renderPopover:N,showTime:!0})},M.id)),r.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No events"})]})]})]})}function Vt({event:t,date:n,onEventClick:s,disablePopover:r,renderPopover:o}){const[p,i]=a.useState(!1),y=re(t.color),N=g.detectAllDayEvent(t),l=g.isSameDay(t.startDate,n),b=g.isSameDay(t.endDate,n),w=N&&g.isSameDay(t.startDate,t.endDate),m=a.useCallback(()=>{r&&s?s(t):r||i(!0)},[r,s,t]),f=a.useCallback(()=>{i(!1)},[]),u=e.jsxs("button",{type:"button",onClick:m,title:g.formatEventTimeDisplay(t),className:c.cn("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium transition-opacity hover:opacity-80","sm:px-2 sm:py-1 sm:text-xs",y.bg,y.text,t.isCanceled&&"opacity-60 line-through"),children:[!w&&l&&!b&&"→ ",!w&&!l&&b&&" ←",!w&&!l&&!b&&"↔ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:t.title}),w&&e.jsx("span",{className:"text-[9px] opacity-70 sm:text-[10px]",children:"All day"})]}),v=e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t)})]})});return r?e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:u}),v]}):e.jsxs(Z,{open:p,onOpenChange:i,children:[e.jsx(Q,{asChild:!0,children:u}),e.jsx(X,{className:"w-80",children:o?o({event:t,onClose:f}):e.jsx(Ft,{event:t,onClose:f})})]})}function Ft({event:t,onClose:n}){const s=re(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:c.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:c.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:g.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function Qe({events:t,date:n,onEventClick:s,disablePopover:r=!1,renderPopover:o,className:p}){if(t.length===0)return null;const i=t.some(l=>g.detectAllDayEvent(l)&&g.isSameDay(l.startDate,l.endDate)),y=t.some(l=>!g.isSameDay(l.startDate,l.endDate)||g.detectAllDayEvent(l)&&!g.isSameDay(l.startDate,l.endDate)),N=i&&y?"All day / Multi-day":i?"All day":"Multi-day";return e.jsxs("div",{className:c.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",p),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:N}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(l=>e.jsx(Vt,{event:l,date:n,onEventClick:s,disablePopover:r,renderPopover:o},l.id))})]})}const qt=5;function et({slot:t,onSelectionStart:n,onSelectionMove:s,onSelectionEnd:r,isSelected:o=!1,isSelecting:p=!1,disabled:i=!1,ariaLabel:y,children:N,className:l,height:b,style:w,dataAttributes:m}){const f=a.useRef(null),u=a.useRef(!1),v=a.useRef(!1),j=a.useRef(null),[W,E]=a.useState(!1),S=oe.useOptionalDragDrop(),I=a.useCallback(D=>{i||D.button!==0&&D.pointerType==="mouse"||(D.preventDefault(),f.current={x:D.clientX,y:D.clientY},u.current=!1,v.current=!0,n?.(t))},[i,t,n]),M=a.useCallback(D=>{if(!(f.current&&v.current&&!i))return;const x=D.clientX-f.current.x,_=D.clientY-f.current.y;Math.sqrt(x*x+_*_)>=qt&&(u.current=!0)},[i]),L=a.useCallback(D=>{i||(D.buttons>0||p)&&s?.(t)},[i,p,t,s]),A=a.useCallback(()=>{i||(r?.(),f.current=null,u.current=!1,v.current=!1)},[i,r]),B=a.useCallback(D=>{if(!S?.isDragging||i)return;D.preventDefault(),D.dataTransfer.dropEffect="move",E(!0);const x=new Date,_=t.hour??x.getHours(),z=t.minute??(x.getMinutes()>=30?30:0);S.updateDragPreview?.(t.date,_,z)},[S,i,t]),T=a.useCallback(()=>{E(!1)},[]),F=a.useCallback(D=>{D.preventDefault(),E(!1),!(!S?.isDragging||i)&&S.endDrag?.()},[S,i]);a.useEffect(()=>{const D=()=>{v.current&&(v.current=!1,f.current=null,u.current=!1)};return window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),()=>{window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)}},[]);const $=a.useCallback(D=>{i||(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),n?.(t),r?.())},[i,t,n,r]);return e.jsx("button",{ref:j,type:"button","aria-label":y,"aria-disabled":i,"aria-pressed":o,disabled:i,onPointerDown:I,onPointerMove:M,onPointerUp:A,onPointerEnter:L,onKeyDown:$,onDragOver:B,onDragLeave:T,onDrop:F,className:c.cn("select-none touch-none cursor-pointer transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",!(p||i)&&"hover:bg-blue-50/60",o&&"bg-blue-100/70",W&&"bg-primary/20 ring-2 ring-primary ring-inset",i&&"cursor-not-allowed opacity-50",l),style:{height:b,...w},...m,children:N})}function We({slot:t,date:n,hour:s,minute:r,ariaLabel:o,...p}){const i=t??{date:n,hour:s??0,minute:r??0},y=o??`Add event at ${(i.hour??0).toString().padStart(2,"0")}:${(i.minute??0).toString().padStart(2,"0")} on ${i.date.toLocaleDateString()}`;return e.jsx(et,{slot:i,ariaLabel:y,...p})}function tt({slot:t,date:n,ariaLabel:s,...r}){const o=t??{date:n},p=s??`Select ${o.date.toLocaleDateString()}`;return e.jsx(et,{slot:o,ariaLabel:p,...r})}const ce=96,De=72,Ce=80;function Gt({events:t,date:n,visibleHours:s={startHour:0,endHour:24},workingHours:r,slotDuration:o=30,badgeVariant:p="colored",onEventClick:i,onSlotSelect:y,className:N,renderEvent:l,renderPopover:b,slots:w,classNames:m}){const f=60/o,u=100/f,v=a.useMemo(()=>{const k=[];for(let d=0;d<f;d++)k.push(d*o);return k},[f,o]),j=a.useMemo(()=>g.getEventsForDay(t,n),[t,n]),{singleDay:W,multiDay:E}=a.useMemo(()=>g.separateEventsByDuration(j),[j]),S=a.useMemo(()=>{const k=g.calculateOverlappingPositions(W,n,s,ce),d=new Map;for(const h of k)d.set(h.event.id,h.position);return d},[W,n,s]),I=a.useMemo(()=>g.getVisibleHoursArray(s),[s]),M=new Date,L=g.isToday(n),A=a.useMemo(()=>{if(!L)return 0;const k=M.getHours()+M.getMinutes()/60;return k<s.startHour||k>s.endHour?-1:(k-s.startHour)*ce},[L,s,M]),B=a.useRef(null);a.useLayoutEffect(()=>{const k=B.current;if(!k)return;const d=()=>{let h;if(L){const H=new Date().getHours();h=Math.max(H-1,s.startHour)}else{const H=n.getDay(),O=r?.[H];O?.enabled&&O.from>0?h=Math.max(O.from-1,s.startHour):h=Math.max(7,s.startHour)}const C=(h-s.startHour)*ce;k.scrollTo({top:C,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(d)})},[n,r,s,L]);const T=oe.useOptionalSlotSelection(),F=a.useCallback(k=>{T?.startSelection(k)},[T]),$=a.useCallback(k=>{T?.updateSelection(k)},[T]),D=a.useCallback(()=>{T?.endSelection()},[T]),x=a.useCallback(k=>{i?.(k)},[i]),_=n.toLocaleDateString([],{weekday:"short"}),z=n.getDate(),q=g.isToday(n);return e.jsxs("div",{className:c.cn("flex flex-col h-full",N),children:[e.jsx("div",{className:c.cn("flex items-center gap-3 border-b px-4 py-3",m?.columnHeader,q&&m?.columnHeaderToday),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:c.cn("text-[11px] font-medium uppercase tracking-wide",q?"text-primary":"text-muted-foreground"),children:_}),e.jsx("span",{className:c.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",q?"bg-primary text-primary-foreground":"text-foreground"),children:z})]})}),E.length>0&&e.jsx(Qe,{events:E,date:n,onEventClick:x,disablePopover:!!i&&!b,renderPopover:b,...m?.multiDayBanner&&{className:m.multiDayBanner}}),e.jsx("div",{ref:B,className:c.cn("flex-1",m?.scrollContainer),children:e.jsxs("div",{className:"relative min-h-full",children:[I.map((k,d)=>{const C=!g.isWorkingHour(n,k,r);return e.jsxs("div",{className:c.cn("relative flex",C&&"bg-calendar-disabled-hour",m?.timeSlot,C?m?.timeSlotNonWorking:m?.timeSlotWorking),style:{height:ce},children:[e.jsx("div",{className:c.cn("relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",m?.timeGutter),style:{width:De},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:d!==0&&e.jsx("span",{className:c.cn("text-[10px] sm:text-xs text-muted-foreground",m?.timeGutterLabel),children:g.formatHourLabel(k)})})}),e.jsxs("div",{className:"relative flex-1",children:[L&&!C&&e.jsx("div",{className:"absolute inset-0 bg-primary/5"}),d!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),v.slice(1).map(H=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${H/60*100}%`}},H)),v.map((H,O)=>{const R={date:n,hour:k,minute:H};return e.jsx(We,{slot:R,onSelectionStart:F,onSelectionMove:$,onSelectionEnd:D,isSelected:T?.isSlotSelected(R)??!1,isSelecting:T?.isSelecting??!1,disabled:C,className:"absolute inset-x-0",style:{top:`${O*u}%`,height:`${u}%`},ariaLabel:`Add event at ${g.formatHourLabel(k)}:${String(H).padStart(2,"0")}`},H)})]})]},k)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:De},children:W.map(k=>{const d=S.get(k.id);if(!d)return null;const h=`calc(${d.width}% - 2px)`,C=`max(${Ce}px, ${h})`;return l?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${d.top}px`,left:`${d.left}%`,width:C,minWidth:`${Ce}px`},children:l({event:k,position:d})},k.id):e.jsx(Le,{event:k,position:{top:d.top,left:d.left,width:d.width,minWidth:Ce},hourHeight:ce,badgeVariant:p,onClick:i,disablePopover:!!i&&!b,renderPopover:b,className:c.cn("pointer-events-auto",m?.eventCard)},k.id)})}),L&&A>=0&&e.jsxs("div",{className:c.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",m?.currentTimeIndicator),style:{top:A,left:De},children:[e.jsx("div",{className:"h-2.5 w-2.5 -ml-1 rounded-full bg-red-500"}),e.jsx("div",{className:"flex-1 h-0.5 bg-red-500"})]})]})})]})}const Ut=[{full:"Monday",short:"Mon",tiny:"M"},{full:"Tuesday",short:"Tue",tiny:"T"},{full:"Wednesday",short:"Wed",tiny:"W"},{full:"Thursday",short:"Thu",tiny:"T"},{full:"Friday",short:"Fri",tiny:"F"},{full:"Saturday",short:"Sat",tiny:"S"},{full:"Sunday",short:"Sun",tiny:"S"}],Kt=[{full:"Sunday",short:"Sun",tiny:"S"},{full:"Monday",short:"Mon",tiny:"M"},{full:"Tuesday",short:"Tue",tiny:"T"},{full:"Wednesday",short:"Wed",tiny:"W"},{full:"Thursday",short:"Thu",tiny:"T"},{full:"Friday",short:"Fri",tiny:"F"},{full:"Saturday",short:"Sat",tiny:"S"}],ue=3;function Xt({events:t,date:n,weekStartsOn:s=1,badgeVariant:r="colored",onEventClick:o,onSlotSelect:p,onDayClick:i,className:y,renderEvent:N,renderPopover:l,showMoreMode:b,showMoreEventsInPopover:w=!1,slots:m,classNames:f}){const u=b??(w?"popover":"expand"),v=m?.dayCellHeader,j=m?.dayCellFooter,[W,E]=a.useState(null),[S,I]=a.useState(null),M=a.useMemo(()=>g.generateMonthGrid(n,s),[n,s]),L=a.useMemo(()=>{const x=new Map;for(const _ of M){const z=_.date.toDateString(),q=g.getEventsForDay(t,_.date);q.sort((k,d)=>k.startDate.getTime()-d.startDate.getTime()),x.set(z,q)}return x},[M,t]),A=oe.useOptionalSlotSelection(),B=a.useCallback(x=>{A?.startSelection(x)},[A]),T=a.useCallback(x=>{A?.updateSelection(x)},[A]),F=a.useCallback(()=>{A?.endSelection()},[A]),$=a.useCallback(x=>{i?.(x)},[i]),D=s===0?Kt:Ut;return e.jsxs("div",{className:c.cn("flex flex-col h-full overflow-hidden",y),children:[e.jsx("div",{className:"flex flex-col flex-1 overflow-auto",children:e.jsxs("div",{className:"flex flex-col flex-1 min-w-[560px] sm:min-w-0",children:[e.jsx("div",{className:c.cn("grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",f?.weekdayHeader),children:D.map((x,_)=>e.jsxs("div",{className:c.cn("py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",_>=5&&"text-muted-foreground/70",f?.weekdayLabel),children:[e.jsx("span",{className:"sm:hidden",children:x.short}),e.jsx("span",{className:"hidden sm:inline",children:x.short})]},x.full))}),e.jsx("div",{className:c.cn("grid grid-cols-7 auto-rows-min",f?.monthGrid),children:M.map(x=>{const _=x.date.toDateString(),z=L.get(_)||[],q=g.isToday(x.date),k=x.date.getDay()===0||x.date.getDay()===6,d=z.length>ue;return e.jsxs(tt,{date:x.date,dataAttributes:{"data-day-key":_},onSelectionStart:B,onSelectionMove:T,onSelectionEnd:F,isSelected:A?.isSlotSelected({date:x.date})??!1,isSelecting:A?.isSelecting??!1,className:c.cn("relative flex flex-col border-r border-b text-left min-h-[80px] sm:min-h-[100px] overflow-hidden","[&:nth-child(7n)]:border-r-0",!x.isCurrentMonth&&"bg-muted/20",k&&x.isCurrentMonth&&"bg-muted/10",f?.dayCell,q&&f?.dayCellToday,!x.isCurrentMonth&&f?.dayCellOutside,k&&f?.dayCellWeekend),ariaLabel:`${x.date.toLocaleDateString()} - ${z.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:c.cn("flex items-center justify-center p-1",!x.isCurrentMonth&&"text-muted-foreground/40",f?.dayCellNumber),children:e.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),$(x.date)},className:c.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",q?"bg-primary text-primary-foreground":"hover:bg-muted"),children:x.date.getDate()})}),v&&e.jsx(v,{date:x.date,events:z,isToday:q,isCurrentMonth:x.isCurrentMonth,isWeekend:k,view:"month"}),e.jsxs("div",{className:c.cn("flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",f?.dayCellContent),children:[z.slice(0,ue).map(h=>e.jsx("div",{onPointerDown:C=>{C.stopPropagation()},children:N?N({event:h,variant:"compact"}):e.jsx(he,{event:h,variant:"compact",badgeVariant:r,onClick:o,disablePopover:!!o&&!l,renderPopover:l,showTime:!1,enableDrag:!0,...f?.eventCardCompact&&{className:f.eventCardCompact}})},h.id)),d&&u==="expand"&&e.jsxs("button",{type:"button",onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation();const C=document.querySelector(`[data-day-key="${_}"]`);I({date:x.date,events:z,rect:C?.getBoundingClientRect()??new DOMRect(window.innerWidth/2-180,window.innerHeight/2-240,0,0)})},className:c.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",z.length-ue," more"]}),d&&u==="popover"&&e.jsxs(Z,{open:W===_,onOpenChange:h=>E(h?_:null),children:[e.jsx(Q,{asChild:!0,children:e.jsxs("button",{type:"button",onPointerDown:h=>h.stopPropagation(),onClick:h=>{h.stopPropagation(),E(_)},className:c.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",z.length-ue," more"]})}),e.jsxs(X,{align:"start",side:"right",sideOffset:8,className:"w-72 max-h-80 overflow-y-auto p-2",onPointerDown:h=>h.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 pb-2 border-b",children:[e.jsx("span",{className:"text-sm font-medium",children:x.date.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[z.length," events"]})]}),e.jsx("div",{className:"space-y-1.5",children:z.map(h=>e.jsx("div",{children:N?N({event:h,variant:"compact"}):e.jsx(he,{event:h,variant:"compact",badgeVariant:r,onClick:C=>{E(null),o?.(C)},disablePopover:!!o&&!l,renderPopover:l,showTime:!0})},h.id))})]})]}),d&&u==="dayView"&&e.jsxs("div",{onPointerDown:h=>{h.stopPropagation(),$(x.date)},className:c.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",z.length-ue," more"]})]}),j&&e.jsx(j,{date:x.date,events:z,isToday:q,isCurrentMonth:x.isCurrentMonth,isWeekend:k,view:"month"})]},_)})})]})}),e.jsx(Ze,{isOpen:S!==null,onClose:()=>I(null),date:S?.date??new Date,events:S?.events??[],anchorRect:S?.rect??null,badgeVariant:r,onEventClick:o,renderEvent:N,renderPopover:l})]})}const ve=26,Oe=2,ye=4;function Pe(t,n){const s=g.startOfDay(t);for(let o=0;o<n.length;o++){const p=n[o];if(p&&g.isSameDay(s,p))return o}const r=n[0];return r&&s<g.startOfDay(r)?-1:7}function Yt(t){const n=[...t].sort((r,o)=>{const p=r.endCol-r.startCol,i=o.endCol-o.startCol;return i!==p?i-p:r.startCol-o.startCol}),s=[];return n.map(r=>{let o=-1;for(let i=0;i<s.length;i++){const y=s[i];if(!y)continue;let N=!0;for(let l=r.startCol;l<=r.endCol;l++)if(y[l]){N=!1;break}if(N){o=i;break}}o===-1&&(o=s.length,s.push(new Array(7).fill(!1)));const p=s[o];if(p)for(let i=r.startCol;i<=r.endCol;i++)p[i]=!0;return{...r,row:o}})}function Jt({pe:t,onEventClick:n,disablePopover:s,renderPopover:r}){const[o,p]=a.useState(!1),i=re(t.event.color),y=a.useCallback(()=>{s&&n?n(t.event):s||p(!0)},[s,n,t.event]),N=a.useCallback(()=>{p(!1)},[]),l=e.jsxs("button",{type:"button",onClick:y,className:c.cn("inline-flex items-center gap-1 rounded text-[10px] font-medium transition-opacity hover:opacity-80 mx-0.5 overflow-hidden w-full","sm:text-xs",i.bg,i.text,t.event.isCanceled&&"opacity-60 line-through",t.continuesBefore&&"rounded-l-none -ml-0.5 pl-1",t.continuesAfter&&"rounded-r-none -mr-0.5 pr-1"),style:{height:ve,lineHeight:`${ve}px`,paddingLeft:t.continuesBefore?4:6,paddingRight:t.continuesAfter?4:6},children:[t.continuesBefore&&e.jsx("span",{className:"text-[9px] opacity-60 flex-shrink-0",children:"◂"}),e.jsx("span",{className:"truncate",children:t.event.title}),t.isSingleDayAllDay&&e.jsx("span",{className:"text-[9px] opacity-70 flex-shrink-0 hidden sm:inline",children:"All day"}),t.continuesAfter&&e.jsx("span",{className:"text-[9px] opacity-60 flex-shrink-0",children:"▸"})]}),b=e.jsx(J,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.event.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:g.formatEventTimeDisplay(t.event)})]})}),w={gridColumn:`${t.startCol+2} / ${t.endCol+3}`,gridRow:t.row+1};return s?e.jsx("div",{style:w,children:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:l}),b]})}):e.jsx("div",{style:w,children:e.jsxs(Z,{open:o,onOpenChange:p,children:[e.jsx(Q,{asChild:!0,children:l}),e.jsx(X,{className:"w-80",children:r?r({event:t.event,onClose:N}):e.jsx(Zt,{event:t.event,onClose:N})})]})})}function Zt({event:t,onClose:n}){const s=re(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:c.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:c.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:g.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function Qt({events:t,weekDays:n,hourColumnWidth:s,minDayColumnWidth:r,dayColumnWidths:o,onEventClick:p,disablePopover:i=!1,renderPopover:y,className:N}){const l=a.useMemo(()=>{if(t.length===0)return[];const j=t.map(W=>{const E=Pe(W.startDate,n),S=Pe(W.endDate,n),I=Math.max(0,E),M=Math.min(6,S);if(I>6||M<0)return null;const L=E<0,A=S>6,T=g.detectAllDayEvent(W)&&g.isSameDay(W.startDate,W.endDate);return{event:W,startCol:I,endCol:M,continuesBefore:L,continuesAfter:A,isSingleDayAllDay:T}}).filter(Boolean);return Yt(j)},[t,n]);if(l.length===0)return null;const b=Math.max(...l.map(j=>j.row))+1,w=Math.min(b,ye),m=b>ye,f=m?l.filter(j=>j.row>=ye).length:0,u=[`${s}px`,...o.map(j=>j>r?`${j}px`:`minmax(${r}px, 1fr)`)].join(" "),v=w*ve+(w-1)*Oe+8;return e.jsxs("div",{className:c.cn("ic-all-day-row border-b bg-muted/20 relative",N),style:{display:"grid",gridTemplateColumns:u,gridTemplateRows:`repeat(${w}, ${ve}px)`,gap:`${Oe}px 0`,paddingTop:4,paddingBottom:4,minHeight:v},children:[e.jsx("div",{className:"flex items-start justify-center pt-1 text-[10px] font-medium text-muted-foreground",style:{gridColumn:1,gridRow:`1 / span ${w}`},children:e.jsx("span",{className:"hidden sm:inline",children:"All day"})}),n.map((j,W)=>e.jsx("div",{className:"pointer-events-none border-r last:border-r-0",style:{gridColumn:W+2,gridRow:`1 / span ${w}`}},j.toDateString())),l.filter(j=>j.row<ye).map(j=>e.jsx(Jt,{pe:j,onEventClick:p,disablePopover:i,renderPopover:y},j.event.id)),m&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-2 flex items-center",style:{gridColumn:`2 / ${n.length+2}`,gridRow:w},children:["+",f," more"]})]})}const ie=96,xe=56,Ve=72,Y=120,be=100,en=3;function tn({events:t,date:n,weekStartsOn:s=1,visibleHours:r={startHour:0,endHour:24},workingHours:o,slotDuration:p=30,badgeVariant:i="colored",onEventClick:y,onSlotSelect:N,onDayClick:l,className:b,renderEvent:w,renderPopover:m,slots:f,classNames:u}){const v=60/p,j=100/v,W=a.useMemo(()=>{const d=[];for(let h=0;h<v;h++)d.push(h*p);return d},[v,p]),E=a.useMemo(()=>g.getWeekDays(n,s),[n,s]),S=a.useMemo(()=>g.getVisibleHoursArray(r),[r]),I=a.useMemo(()=>{const d=new Map;for(const h of E){const C=h.toDateString(),H=g.getEventsForDay(t,h),{singleDay:O,multiDay:R}=g.separateEventsByDuration(H),V=g.calculateOverlappingPositions(O,h,r,ie),G=new Map;let te=1;for(const P of V)if(G.set(P.event.id,P.position),P.position.width>0){const K=Math.round(100/P.position.width);te=Math.max(te,K)}d.set(C,{singleDay:O,multiDay:R,positions:G,maxOverlapping:te})}return d},[E,t,r]),M=a.useMemo(()=>{const d=new Map;for(const{multiDay:h}of I.values())for(const C of h)d.set(C.id,C);return Array.from(d.values())},[I]),L=new Date,A=E.findIndex(d=>g.isToday(d)),B=a.useMemo(()=>{if(A<0)return-1;const d=L.getHours()+L.getMinutes()/60;return d<r.startHour||d>r.endHour?-1:(d-r.startHour)*ie},[A,r,L]),T=a.useRef(null);a.useLayoutEffect(()=>{const d=T.current;if(!d)return;const h=()=>{let C;if(A!==-1){const O=new Date().getHours();C=Math.max(O-1,r.startHour)}else{const R=new Date().getDay();let V=o?.[R];if(!V?.enabled||V.from===0){const G=o?.[1];G?.enabled&&(V=G)}V?.enabled&&V.from>0?C=Math.max(V.from-1,r.startHour):C=Math.max(7,r.startHour)}const H=(C-r.startHour)*ie;d.scrollTo({top:H,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(h)})},[n,o,r,A]);const F=oe.useOptionalSlotSelection(),$=a.useCallback(d=>{F?.startSelection(d)},[F]),D=a.useCallback(d=>{F?.updateSelection(d)},[F]),x=a.useCallback(()=>{F?.endSelection()},[F]),_=a.useCallback(d=>{y?.(d)},[y]),z=xe+7*Y,q=a.useMemo(()=>{const d=[];for(const h of E){const C=h.toDateString(),O=I.get(C)?.maxOverlapping??1;O>en?d.push(Math.max(Y,O*be)):d.push(Y)}return d},[E,I]),k=xe+q.reduce((d,h)=>d+h,0);return e.jsxs("div",{className:c.cn("ic-week-view flex flex-col h-full",b),children:[M.length>0&&e.jsx(Qt,{events:M,weekDays:E,hourColumnWidth:xe,minDayColumnWidth:Y,dayColumnWidths:q,onEventClick:_,disablePopover:!!y&&!m,renderPopover:m,...u?.multiDayBanner&&{className:u.multiDayBanner}}),e.jsx("div",{ref:T,className:c.cn("ic-week-scroll-container flex-1",u?.scrollContainer),children:e.jsxs("div",{style:{minWidth:Math.max(z,k)},children:[e.jsx("div",{className:"ic-week-header sticky top-0 z-20 border-b bg-background",children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex-shrink-0 flex items-end justify-center pb-2 text-[10px] text-muted-foreground/70",style:{width:xe,height:Ve},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const d=new Date().getTimezoneOffset(),h=Math.abs(Math.floor(d/60)),C=d<=0?"+":"-";return h>0?`${C}${String(h).padStart(2,"0")}`:""})()]})}),E.map((d,h)=>{const C=g.isToday(d),H=q[h]??Y,O=H>Y;return e.jsxs("div",{className:c.cn("flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",u?.columnHeader,C&&u?.columnHeaderToday),style:{height:Ve,minWidth:O?H:Y},children:[e.jsx("span",{className:c.cn("text-[11px] font-medium uppercase tracking-wide",C?"text-primary":"text-muted-foreground"),children:d.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>l?.(d),className:c.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",C?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:d.getDate()})]},d.toDateString())})]})}),e.jsxs("div",{className:"relative flex",children:[e.jsx("div",{className:c.cn("ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",u?.timeGutter),style:{width:xe},children:S.map((d,h)=>e.jsx("div",{className:"relative",style:{height:ie},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:h!==0&&e.jsx("span",{className:c.cn("text-[10px] sm:text-xs text-muted-foreground",u?.timeGutterLabel),children:g.formatHourLabel(d)})})},d))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:E.map((d,h)=>{const C=d.toDateString(),H=I.get(C),O=q[h]??Y,R=O>Y;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:R?O:Y},children:[S.map((V,G)=>{const P=!g.isWorkingHour(d,V,o);return e.jsxs("div",{className:c.cn("relative",P&&"bg-calendar-disabled-hour",g.isToday(d)&&!P&&"bg-primary/5",u?.timeSlot,P?u?.timeSlotNonWorking:u?.timeSlotWorking),style:{height:ie},children:[G!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),W.slice(1).map(K=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${K/60*100}%`}},K)),W.map((K,nt)=>{const _e={date:d,hour:V,minute:K};return e.jsx(We,{slot:_e,onSelectionStart:$,onSelectionMove:D,onSelectionEnd:x,isSelected:F?.isSlotSelected(_e)??!1,isSelecting:F?.isSelecting??!1,disabled:P,className:"absolute inset-x-0",style:{top:`${nt*j}%`,height:`${j}%`},ariaLabel:`Add event on ${d.toLocaleDateString()} at ${g.formatHourLabel(V)}:${String(K).padStart(2,"0")}`},K)})]},V)}),H?.singleDay.map(V=>{const G=H.positions.get(V.id);if(!G)return null;const te=`calc(${G.width}% - 2px)`,P=`max(${be}px, ${te})`;return w?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${G.top}px`,left:`${G.left}%`,width:P,minWidth:`${be}px`},children:w({event:V,position:G})},V.id):e.jsx(Le,{event:V,position:{top:G.top,left:G.left,width:G.width,minWidth:be},hourHeight:ie,badgeVariant:i,onClick:y,disablePopover:!!y&&!m,renderPopover:m,className:c.cn("pointer-events-auto",u?.eventCard)},V.id)}),h===A&&B>=0&&e.jsxs("div",{className:c.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",u?.currentTimeIndicator),style:{top:B},children:[e.jsx("div",{className:"h-2 w-2 -ml-1 rounded-full bg-red-500"}),e.jsx("div",{className:"flex-1 h-0.5 bg-red-500"})]})]},d.toDateString())})})})]})]})})]})}exports.AgendaView=Pt;exports.Badge=Xe;exports.Button=ae;exports.CalendarHeader=Ot;exports.DateNavigator=Ye;exports.DayEventsExpansion=Ze;exports.DaySlot=tt;exports.DayView=Gt;exports.DropdownMenu=Me;exports.DropdownMenuContent=je;exports.DropdownMenuItem=we;exports.DropdownMenuTrigger=Te;exports.EventBlock=Le;exports.EventCard=he;exports.MonthView=Xt;exports.MultiDayBanner=Qe;exports.MultiDayEventBar=ct;exports.Popover=Z;exports.PopoverAnchor=at;exports.PopoverContent=X;exports.PopoverTrigger=Q;exports.TimeSlot=We;exports.TodayButton=Je;exports.Tooltip=ne;exports.TooltipContent=J;exports.TooltipProvider=it;exports.TooltipTrigger=se;exports.WeekView=tn;exports.buttonVariants=Ue;exports.getEventColorClasses=re;
11
+ //# sourceMappingURL=week-view-D19YRBQC.cjs.map