@innosolutions/inno-calendar 1.0.69 → 1.0.71

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 (61) hide show
  1. package/dist/agenda-widget-Bl-Gb588.cjs +2 -0
  2. package/dist/agenda-widget-Bl-Gb588.cjs.map +1 -0
  3. package/dist/{agenda-widget-QSVTdgaz.js → agenda-widget-DrRyLzTK.js} +124 -119
  4. package/dist/agenda-widget-DrRyLzTK.js.map +1 -0
  5. package/dist/components/index.cjs +1 -1
  6. package/dist/components/index.mjs +2 -2
  7. package/dist/components/inno-calendar.d.ts +23 -1
  8. package/dist/components/inno-calendar.d.ts.map +1 -1
  9. package/dist/components/views/timeline-view.d.ts.map +1 -1
  10. package/dist/core/context/inno-calendar-provider.d.ts +8 -2
  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.d.ts +1 -1
  14. package/dist/core/index.d.ts.map +1 -1
  15. package/dist/core/index.mjs +4 -4
  16. package/dist/core/types.d.ts +55 -8
  17. package/dist/core/types.d.ts.map +1 -1
  18. package/dist/core/utils/view-storage.d.ts +14 -10
  19. package/dist/core/utils/view-storage.d.ts.map +1 -1
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.mjs +7 -7
  22. package/dist/position-utils-D_KpwRus.js +1053 -0
  23. package/dist/position-utils-D_KpwRus.js.map +1 -0
  24. package/dist/position-utils-ksZ_IjXC.cjs +2 -0
  25. package/dist/position-utils-ksZ_IjXC.cjs.map +1 -0
  26. package/dist/presets/index.cjs +1 -1
  27. package/dist/presets/index.mjs +1 -1
  28. package/dist/slot-selection-context-CLYZU6ul.cjs +2 -0
  29. package/dist/slot-selection-context-CLYZU6ul.cjs.map +1 -0
  30. package/dist/slot-selection-context-Ct5cVcKW.js +611 -0
  31. package/dist/slot-selection-context-Ct5cVcKW.js.map +1 -0
  32. package/dist/{tailwind-calendar-KJ1XJ4gr.cjs → tailwind-calendar-BbUb61uY.cjs} +2 -2
  33. package/dist/{tailwind-calendar-KJ1XJ4gr.cjs.map → tailwind-calendar-BbUb61uY.cjs.map} +1 -1
  34. package/dist/{tailwind-calendar-B6qsueM3.js → tailwind-calendar-DrwGVSF-.js} +3 -3
  35. package/dist/{tailwind-calendar-B6qsueM3.js.map → tailwind-calendar-DrwGVSF-.js.map} +1 -1
  36. package/dist/{use-calendar-BwqE_WNA.cjs → use-calendar-BK0nQYJq.cjs} +2 -2
  37. package/dist/{use-calendar-BwqE_WNA.cjs.map → use-calendar-BK0nQYJq.cjs.map} +1 -1
  38. package/dist/{use-calendar--JnbGA3L.js → use-calendar-DJI35SSd.js} +2 -2
  39. package/dist/{use-calendar--JnbGA3L.js.map → use-calendar-DJI35SSd.js.map} +1 -1
  40. package/dist/{use-slot-selection-C1tk-o0j.cjs → use-slot-selection-CCE11R4j.cjs} +2 -2
  41. package/dist/{use-slot-selection-C1tk-o0j.cjs.map → use-slot-selection-CCE11R4j.cjs.map} +1 -1
  42. package/dist/{use-slot-selection-BLCDzQzo.js → use-slot-selection-CX1w8EdM.js} +3 -3
  43. package/dist/{use-slot-selection-BLCDzQzo.js.map → use-slot-selection-CX1w8EdM.js.map} +1 -1
  44. package/dist/utils.cjs +1 -1
  45. package/dist/utils.mjs +1 -1
  46. package/dist/{week-view-Dv-Uz0eT.cjs → week-view-BXmaRChB.cjs} +2 -2
  47. package/dist/{week-view-Dv-Uz0eT.cjs.map → week-view-BXmaRChB.cjs.map} +1 -1
  48. package/dist/{week-view-B1KsZsC3.js → week-view-BeasFcyR.js} +3 -3
  49. package/dist/{week-view-B1KsZsC3.js.map → week-view-BeasFcyR.js.map} +1 -1
  50. package/package.json +1 -1
  51. package/dist/agenda-widget-BJroIHYG.cjs +0 -2
  52. package/dist/agenda-widget-BJroIHYG.cjs.map +0 -1
  53. package/dist/agenda-widget-QSVTdgaz.js.map +0 -1
  54. package/dist/position-utils-BzmOPdvQ.js +0 -1038
  55. package/dist/position-utils-BzmOPdvQ.js.map +0 -1
  56. package/dist/position-utils-EQTCC4tZ.cjs +0 -2
  57. package/dist/position-utils-EQTCC4tZ.cjs.map +0 -1
  58. package/dist/slot-selection-context-CjS_VIPj.js +0 -603
  59. package/dist/slot-selection-context-CjS_VIPj.js.map +0 -1
  60. package/dist/slot-selection-context-CmE-aWgt.cjs +0 -2
  61. package/dist/slot-selection-context-CmE-aWgt.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { useMemo as p, useCallback as i, useState as I, useEffect as M, useRef as O } from "react";
2
- import { a as x } from "./use-calendar--JnbGA3L.js";
3
- import { d as Y, c as k, bb as w, q as b } from "./position-utils-BzmOPdvQ.js";
2
+ import { a as x } from "./use-calendar-DJI35SSd.js";
3
+ import { d as Y, c as k, bb as w, q as b } from "./position-utils-D_KpwRus.js";
4
4
  function L() {
5
5
  const { preferences: e, setPreferences: n } = x(), o = p(
6
6
  () => ({
@@ -185,4 +185,4 @@ export {
185
185
  W as b,
186
186
  L as u
187
187
  };
188
- //# sourceMappingURL=use-slot-selection-BLCDzQzo.js.map
188
+ //# sourceMappingURL=use-slot-selection-CX1w8EdM.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slot-selection-BLCDzQzo.js","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-CX1w8EdM.js","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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"}
package/dist/utils.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./position-utils-EQTCC4tZ.cjs");exports.CALENDAR_VIEWS=e.CALENDAR_VIEWS;exports.CALENDAR_VIEW_STORAGE_KEY=e.CALENDAR_VIEW_STORAGE_KEY;exports.DEFAULT_BUSINESS_HOURS=e.DEFAULT_BUSINESS_HOURS;exports.DEFAULT_HEADER_HEIGHT=e.DEFAULT_HEADER_HEIGHT;exports.DEFAULT_HOUR_HEIGHT=e.DEFAULT_HOUR_HEIGHT;exports.DEFAULT_PREFERENCES=e.DEFAULT_PREFERENCES;exports.DEFAULT_RESOURCE_WIDTH=e.DEFAULT_RESOURCE_WIDTH;exports.DEFAULT_SLOT_HEIGHT=e.DEFAULT_SLOT_HEIGHT;exports.DEFAULT_VIEW_CONFIGS=e.DEFAULT_VIEW_CONFIGS;exports.DEFAULT_VISIBLE_HOURS=e.DEFAULT_VISIBLE_HOURS;exports.EVENT_COLORS=e.EVENT_COLORS;exports.EVENT_COLOR_CLASSES=e.EVENT_COLOR_CLASSES;exports.HEX_TO_EVENT_COLOR=e.HEX_TO_EVENT_COLOR;exports.HOURS_IN_DAY=e.HOURS_IN_DAY;exports.MINUTES_IN_HOUR=e.MINUTES_IN_HOUR;exports.MIN_EVENT_HEIGHT=e.MIN_EVENT_HEIGHT;exports.MS_PER_DAY=e.MS_PER_DAY;exports.MS_PER_HOUR=e.MS_PER_HOUR;exports.MS_PER_MINUTE=e.MS_PER_MINUTE;exports.RESOURCE_VIEW_STORAGE_KEY=e.RESOURCE_VIEW_STORAGE_KEY;exports.addDays=e.addDays;exports.addHours=e.addHours;exports.addMinutes=e.addMinutes;exports.addMonths=e.addMonths;exports.addWeeks=e.addWeeks;exports.addYears=e.addYears;exports.applyEventFilters=e.applyEventFilters;exports.calculateEventPosition=e.calculateEventPosition;exports.calculateOverlappingPositions=e.calculateOverlappingPositions;exports.calculateSelectionOverlay=e.calculateSelectionOverlay;exports.clearCalendarView=e.clearCalendarView;exports.clearResourceView=e.clearResourceView;exports.detectAllDayEvent=e.detectAllDayEvent;exports.differenceInDays=e.differenceInDays;exports.differenceInHours=e.differenceInHours;exports.differenceInMilliseconds=e.differenceInMilliseconds;exports.differenceInMinutes=e.differenceInMinutes;exports.eachDayOfInterval=e.eachDayOfInterval;exports.eachHourOfInterval=e.eachHourOfInterval;exports.endOfDay=e.endOfDay;exports.endOfMonth=e.endOfMonth;exports.endOfWeek=e.endOfWeek;exports.endOfYear=e.endOfYear;exports.eventsOverlap=e.eventsOverlap;exports.filterEventsByDateRange=e.filterEventsByDateRange;exports.filterEventsByResource=e.filterEventsByResource;exports.filterEventsByScheduleType=e.filterEventsByScheduleType;exports.filterEventsBySearch=e.filterEventsBySearch;exports.filterOutCanceled=e.filterOutCanceled;exports.formatDateISO=e.formatDateISO;exports.formatEventTimeDisplay=e.formatEventTimeDisplay;exports.formatHourLabel=e.formatHourLabel;exports.formatTime=e.formatTime;exports.generateHourLabels=e.generateHourLabels;exports.generateMonthCells=e.generateMonthCells;exports.generateMonthGrid=e.generateMonthGrid;exports.generateTimeSlots=e.generateTimeSlots;exports.generateWeekCells=e.generateWeekCells;exports.generateYearCells=e.generateYearCells;exports.getAllDayEvents=e.getAllDayEvents;exports.getDayOfWeek=e.getDayOfWeek;exports.getDaysInMonth=e.getDaysInMonth;exports.getDecimalHours=e.getDecimalHours;exports.getEventColor=e.getEventColor;exports.getEventDurationMinutes=e.getEventDurationMinutes;exports.getEventsCountInView=e.getEventsCountInView;exports.getEventsForDay=e.getEventsForDay;exports.getEventsInRange=e.getEventsInRange;exports.getMonthNames=e.getMonthNames;exports.getMultiDayEvents=e.getMultiDayEvents;exports.getOverlappingGroups=e.getOverlappingGroups;exports.getRangeText=e.getRangeText;exports.getTimedEvents=e.getTimedEvents;exports.getViewDateRange=e.getViewDateRange;exports.getViewTitle=e.getViewTitle;exports.getVisibleHoursArray=e.getVisibleHoursArray;exports.getWeekDays=e.getWeekDays;exports.getWeekNumber=e.getWeekNumber;exports.getWeekdayHeaders=e.getWeekdayHeaders;exports.getWeekdayNames=e.getWeekdayNames;exports.getWorkingHoursForDay=e.getWorkingHoursForDay;exports.getYearMonths=e.getYearMonths;exports.groupEventsByDate=e.groupEventsByDate;exports.groupEventsByResource=e.groupEventsByResource;exports.groupEventsByScheduleType=e.groupEventsByScheduleType;exports.isAfter=e.isAfter;exports.isBefore=e.isBefore;exports.isBetween=e.isBetween;exports.isCalendarGridView=e.isCalendarGridView;exports.isMultiDayEvent=e.isMultiDayEvent;exports.isResourceView=e.isResourceView;exports.isSameDay=e.isSameDay;exports.isSameMonth=e.isSameMonth;exports.isSameWeek=e.isSameWeek;exports.isSameYear=e.isSameYear;exports.isToday=e.isToday;exports.isWeekend=e.isWeekend;exports.isWorkingHour=e.isWorkingHour;exports.maxDate=e.maxDate;exports.minDate=e.minDate;exports.navigateNext=e.navigateNext;exports.navigatePrev=e.navigatePrev;exports.navigateToday=e.navigateToday;exports.parseISO=e.parseISO;exports.reactNodeToText=e.reactNodeToText;exports.readCalendarView=e.readCalendarView;exports.readPersistedView=e.readPersistedView;exports.readPreferencesView=e.readPreferencesView;exports.readResourceView=e.readResourceView;exports.resolveEventColor=e.resolveEventColor;exports.saveCalendarView=e.saveCalendarView;exports.saveResourceView=e.saveResourceView;exports.saveViewByFamily=e.saveViewByFamily;exports.separateEventsByDuration=e.separateEventsByDuration;exports.setTime=e.setTime;exports.shouldShowEventTime=e.shouldShowEventTime;exports.sortEventsByDuration=e.sortEventsByDuration;exports.sortEventsByEnd=e.sortEventsByEnd;exports.sortEventsByStart=e.sortEventsByStart;exports.startOfDay=e.startOfDay;exports.startOfMonth=e.startOfMonth;exports.startOfWeek=e.startOfWeek;exports.startOfYear=e.startOfYear;exports.subDays=e.subDays;exports.subMonths=e.subMonths;exports.subWeeks=e.subWeeks;exports.subYears=e.subYears;exports.timeToY=e.timeToY;exports.yToTime=e.yToTime;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./position-utils-ksZ_IjXC.cjs");exports.CALENDAR_VIEWS=e.CALENDAR_VIEWS;exports.CALENDAR_VIEW_STORAGE_KEY=e.CALENDAR_VIEW_STORAGE_KEY;exports.DEFAULT_BUSINESS_HOURS=e.DEFAULT_BUSINESS_HOURS;exports.DEFAULT_HEADER_HEIGHT=e.DEFAULT_HEADER_HEIGHT;exports.DEFAULT_HOUR_HEIGHT=e.DEFAULT_HOUR_HEIGHT;exports.DEFAULT_PREFERENCES=e.DEFAULT_PREFERENCES;exports.DEFAULT_RESOURCE_WIDTH=e.DEFAULT_RESOURCE_WIDTH;exports.DEFAULT_SLOT_HEIGHT=e.DEFAULT_SLOT_HEIGHT;exports.DEFAULT_VIEW_CONFIGS=e.DEFAULT_VIEW_CONFIGS;exports.DEFAULT_VISIBLE_HOURS=e.DEFAULT_VISIBLE_HOURS;exports.EVENT_COLORS=e.EVENT_COLORS;exports.EVENT_COLOR_CLASSES=e.EVENT_COLOR_CLASSES;exports.HEX_TO_EVENT_COLOR=e.HEX_TO_EVENT_COLOR;exports.HOURS_IN_DAY=e.HOURS_IN_DAY;exports.MINUTES_IN_HOUR=e.MINUTES_IN_HOUR;exports.MIN_EVENT_HEIGHT=e.MIN_EVENT_HEIGHT;exports.MS_PER_DAY=e.MS_PER_DAY;exports.MS_PER_HOUR=e.MS_PER_HOUR;exports.MS_PER_MINUTE=e.MS_PER_MINUTE;exports.RESOURCE_VIEW_STORAGE_KEY=e.RESOURCE_VIEW_STORAGE_KEY;exports.addDays=e.addDays;exports.addHours=e.addHours;exports.addMinutes=e.addMinutes;exports.addMonths=e.addMonths;exports.addWeeks=e.addWeeks;exports.addYears=e.addYears;exports.applyEventFilters=e.applyEventFilters;exports.calculateEventPosition=e.calculateEventPosition;exports.calculateOverlappingPositions=e.calculateOverlappingPositions;exports.calculateSelectionOverlay=e.calculateSelectionOverlay;exports.clearCalendarView=e.clearCalendarView;exports.clearResourceView=e.clearResourceView;exports.detectAllDayEvent=e.detectAllDayEvent;exports.differenceInDays=e.differenceInDays;exports.differenceInHours=e.differenceInHours;exports.differenceInMilliseconds=e.differenceInMilliseconds;exports.differenceInMinutes=e.differenceInMinutes;exports.eachDayOfInterval=e.eachDayOfInterval;exports.eachHourOfInterval=e.eachHourOfInterval;exports.endOfDay=e.endOfDay;exports.endOfMonth=e.endOfMonth;exports.endOfWeek=e.endOfWeek;exports.endOfYear=e.endOfYear;exports.eventsOverlap=e.eventsOverlap;exports.filterEventsByDateRange=e.filterEventsByDateRange;exports.filterEventsByResource=e.filterEventsByResource;exports.filterEventsByScheduleType=e.filterEventsByScheduleType;exports.filterEventsBySearch=e.filterEventsBySearch;exports.filterOutCanceled=e.filterOutCanceled;exports.formatDateISO=e.formatDateISO;exports.formatEventTimeDisplay=e.formatEventTimeDisplay;exports.formatHourLabel=e.formatHourLabel;exports.formatTime=e.formatTime;exports.generateHourLabels=e.generateHourLabels;exports.generateMonthCells=e.generateMonthCells;exports.generateMonthGrid=e.generateMonthGrid;exports.generateTimeSlots=e.generateTimeSlots;exports.generateWeekCells=e.generateWeekCells;exports.generateYearCells=e.generateYearCells;exports.getAllDayEvents=e.getAllDayEvents;exports.getDayOfWeek=e.getDayOfWeek;exports.getDaysInMonth=e.getDaysInMonth;exports.getDecimalHours=e.getDecimalHours;exports.getEventColor=e.getEventColor;exports.getEventDurationMinutes=e.getEventDurationMinutes;exports.getEventsCountInView=e.getEventsCountInView;exports.getEventsForDay=e.getEventsForDay;exports.getEventsInRange=e.getEventsInRange;exports.getMonthNames=e.getMonthNames;exports.getMultiDayEvents=e.getMultiDayEvents;exports.getOverlappingGroups=e.getOverlappingGroups;exports.getRangeText=e.getRangeText;exports.getTimedEvents=e.getTimedEvents;exports.getViewDateRange=e.getViewDateRange;exports.getViewTitle=e.getViewTitle;exports.getVisibleHoursArray=e.getVisibleHoursArray;exports.getWeekDays=e.getWeekDays;exports.getWeekNumber=e.getWeekNumber;exports.getWeekdayHeaders=e.getWeekdayHeaders;exports.getWeekdayNames=e.getWeekdayNames;exports.getWorkingHoursForDay=e.getWorkingHoursForDay;exports.getYearMonths=e.getYearMonths;exports.groupEventsByDate=e.groupEventsByDate;exports.groupEventsByResource=e.groupEventsByResource;exports.groupEventsByScheduleType=e.groupEventsByScheduleType;exports.isAfter=e.isAfter;exports.isBefore=e.isBefore;exports.isBetween=e.isBetween;exports.isCalendarGridView=e.isCalendarGridView;exports.isMultiDayEvent=e.isMultiDayEvent;exports.isResourceView=e.isResourceView;exports.isSameDay=e.isSameDay;exports.isSameMonth=e.isSameMonth;exports.isSameWeek=e.isSameWeek;exports.isSameYear=e.isSameYear;exports.isToday=e.isToday;exports.isWeekend=e.isWeekend;exports.isWorkingHour=e.isWorkingHour;exports.maxDate=e.maxDate;exports.minDate=e.minDate;exports.navigateNext=e.navigateNext;exports.navigatePrev=e.navigatePrev;exports.navigateToday=e.navigateToday;exports.parseISO=e.parseISO;exports.reactNodeToText=e.reactNodeToText;exports.readCalendarView=e.readCalendarView;exports.readPersistedView=e.readPersistedView;exports.readPreferencesView=e.readPreferencesView;exports.readResourceView=e.readResourceView;exports.resolveEventColor=e.resolveEventColor;exports.saveCalendarView=e.saveCalendarView;exports.saveResourceView=e.saveResourceView;exports.saveViewByFamily=e.saveViewByFamily;exports.separateEventsByDuration=e.separateEventsByDuration;exports.setTime=e.setTime;exports.shouldShowEventTime=e.shouldShowEventTime;exports.sortEventsByDuration=e.sortEventsByDuration;exports.sortEventsByEnd=e.sortEventsByEnd;exports.sortEventsByStart=e.sortEventsByStart;exports.startOfDay=e.startOfDay;exports.startOfMonth=e.startOfMonth;exports.startOfWeek=e.startOfWeek;exports.startOfYear=e.startOfYear;exports.subDays=e.subDays;exports.subMonths=e.subMonths;exports.subWeeks=e.subWeeks;exports.subYears=e.subYears;exports.timeToY=e.timeToY;exports.yToTime=e.yToTime;
2
2
  //# sourceMappingURL=utils.cjs.map
package/dist/utils.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as s, a as t, D as r, b as n, c as i, d as E, e as o, f as l, g as d, h as g, E as v, i as D, H as u, j as y, M as T, k as _, l as O, m as S, n as R, R as f, o as c, p as I, q as H, r as m, s as V, t as A, u as M, v as b, w as C, x as N, y as U, z as W, A as L, B as h, F as p, G as w, I as B, J as k, K as F, L as Y, N as G, O as P, Q as x, S as K, T as X, U as j, V as q, W as z, X as J, Y as Q, Z, _ as $, $ as aa, a0 as ea, a1 as sa, a2 as ta, a3 as ra, a4 as na, a5 as ia, a6 as Ea, a7 as oa, a8 as la, a9 as da, aa as ga, ab as va, ac as Da, ad as ua, ae as ya, af as Ta, ag as _a, ah as Oa, ai as Sa, aj as Ra, ak as fa, al as ca, am as Ia, an as Ha, ao as ma, ap as Va, aq as Aa, ar as Ma, as as ba, at as Ca, au as Na, av as Ua, aw as Wa, ax as La, ay as ha, az as pa, aA as wa, aB as Ba, aC as ka, aD as Fa, aE as Ya, aF as Ga, aG as Pa, aH as xa, aI as Ka, aJ as Xa, aK as ja, aL as qa, aM as za, aN as Ja, aO as Qa, aP as Za, aQ as $a, aR as ae, aS as ee, aT as se, aU as te, aV as re, aW as ne, aX as ie, aY as Ee, aZ as oe, a_ as le, a$ as de, b0 as ge, b1 as ve, b2 as De, b3 as ue, b4 as ye, b5 as Te, b6 as _e, b7 as Oe, b8 as Se, b9 as Re, ba as fe, bb as ce } from "./position-utils-BzmOPdvQ.js";
1
+ import { C as s, a as t, D as r, b as n, c as i, d as E, e as o, f as l, g as d, h as g, E as v, i as D, H as u, j as y, M as T, k as _, l as O, m as S, n as R, R as f, o as c, p as I, q as H, r as m, s as V, t as A, u as M, v as b, w as C, x as N, y as U, z as W, A as L, B as h, F as p, G as w, I as B, J as k, K as F, L as Y, N as G, O as P, Q as x, S as K, T as X, U as j, V as q, W as z, X as J, Y as Q, Z, _ as $, $ as aa, a0 as ea, a1 as sa, a2 as ta, a3 as ra, a4 as na, a5 as ia, a6 as Ea, a7 as oa, a8 as la, a9 as da, aa as ga, ab as va, ac as Da, ad as ua, ae as ya, af as Ta, ag as _a, ah as Oa, ai as Sa, aj as Ra, ak as fa, al as ca, am as Ia, an as Ha, ao as ma, ap as Va, aq as Aa, ar as Ma, as as ba, at as Ca, au as Na, av as Ua, aw as Wa, ax as La, ay as ha, az as pa, aA as wa, aB as Ba, aC as ka, aD as Fa, aE as Ya, aF as Ga, aG as Pa, aH as xa, aI as Ka, aJ as Xa, aK as ja, aL as qa, aM as za, aN as Ja, aO as Qa, aP as Za, aQ as $a, aR as ae, aS as ee, aT as se, aU as te, aV as re, aW as ne, aX as ie, aY as Ee, aZ as oe, a_ as le, a$ as de, b0 as ge, b1 as ve, b2 as De, b3 as ue, b4 as ye, b5 as Te, b6 as _e, b7 as Oe, b8 as Se, b9 as Re, ba as fe, bb as ce } from "./position-utils-D_KpwRus.js";
2
2
  export {
3
3
  s as CALENDAR_VIEWS,
4
4
  t as CALENDAR_VIEW_STORAGE_KEY,
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("react/jsx-runtime"),o=require("react"),a=require("./index-D2U2F80P.cjs"),wt=require("@radix-ui/react-dropdown-menu"),y=require("./position-utils-EQTCC4tZ.cjs"),oe=require("./slot-selection-context-CmE-aWgt.cjs"),vt=require("@radix-ui/react-dialog"),Nt=require("@radix-ui/react-popover"),kt=require("@radix-ui/react-tooltip");function be(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 K=be(o),U=be(wt),V=be(vt),ue=be(Nt),je=be(kt);const Ye=(...t)=>t.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();const Dt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ct=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,s,r)=>r?r.toUpperCase():s.toLowerCase());const $e=t=>{const n=Ct(t);return n.charAt(0).toUpperCase()+n.slice(1)};var St={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 Mt=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const Tt=o.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:d="",children:h,iconNode:i,...b},C)=>o.createElement("svg",{ref:C,...St,width:n,height:n,stroke:t,strokeWidth:r?Number(s)*24/Number(n):s,className:Ye("lucide",d),...!h&&!Mt(b)&&{"aria-hidden":"true"},...b},[...i.map(([l,j])=>o.createElement(l,j)),...Array.isArray(h)?h:[h]]));const Me=(t,n)=>{const s=o.forwardRef(({className:r,...d},h)=>o.createElement(Tt,{ref:h,iconNode:n,className:Ye(`lucide-${Dt($e(t))}`,`lucide-${t}`,r),...d}));return s.displayName=$e(t),s};const Et=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],At=Me("check",Et);const Rt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zt=Me("chevron-right",Rt);const Lt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_t=Me("circle",Lt);const Wt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Je=Me("x",Wt),Ze=V.Root,Qe=V.Trigger,Bt=V.Portal,It=V.Close,et=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Overlay,{ref:s,className:a.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n}));et.displayName=V.Overlay.displayName;const _e=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(Bt,{children:[e.jsx(et,{}),e.jsxs(V.Content,{ref:r,className:a.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",t),...s,children:[n,e.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=V.Content.displayName;const tt=({className:t,...n})=>e.jsx("div",{className:a.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...n});tt.displayName="DialogHeader";const nt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Title,{ref:s,className:a.cn("text-lg font-semibold leading-none tracking-tight",t),...n}));nt.displayName=V.Title.displayName;const st=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Description,{ref:s,className:a.cn("text-sm text-muted-foreground",t),...n}));st.displayName=V.Description.displayName;const ae=ue.Root,ie=ue.Trigger,Ht=ue.Anchor,se=K.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},d)=>e.jsx(ue.Portal,{children:e.jsx(ue.Content,{ref:d,align:n,sideOffset:s,className:a.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})}));se.displayName=ue.Content.displayName;const rt=V.Root,ot=V.Trigger,Ot=V.Close,$t=V.Portal,at=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Overlay,{className:a.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:s}));at.displayName=V.Overlay.displayName;const We=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs($t,{children:[e.jsx(at,{}),e.jsxs(V.Content,{ref:r,className:a.cn("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500","inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",t),...s,children:[n,e.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));We.displayName="SheetContent";const it=({className:t,...n})=>e.jsx("div",{className:a.cn("flex flex-col space-y-2 text-center sm:text-left",t),...n});it.displayName="SheetHeader";const lt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Title,{ref:s,className:a.cn("text-lg font-semibold text-foreground",t),...n}));lt.displayName=V.Title.displayName;const dt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Description,{ref:s,className:a.cn("text-sm text-muted-foreground",t),...n}));dt.displayName=V.Description.displayName;const Pt=je.Provider,te=je.Root,ne=je.Trigger,ee=K.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(je.Content,{ref:r,sideOffset:n,className:a.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}));ee.displayName=je.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 ct(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function ye({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:d,showTime:h=!0,showDescription:i=!1,showParticipants:b=!1,style:C,disablePopover:l=!1,renderPopover:j,enableDrag:v=!1,enablePageTransition:u=!1,pageTransitionDuration:g=400,eventDetailMode:p="popover",renderEventDetail:N}){const f=re(t.color),[z,S]=o.useState(!1),[T,W]=o.useState(!1),[q,F]=o.useState(!1),[O,A]=o.useState(null),R=o.useRef(null),I=oe.useOptionalDragDrop(),$=oe.useOptionalInnoCalendar();o.useEffect(()=>{if(!l&&$?.focusEventId&&$.focusEventId===t.id){const G=setTimeout(()=>{S(!0),$.clearFocusEventId()},300);return()=>clearTimeout(G)}},[$?.focusEventId,t.id,l]);const k=t.endDate<ct(new Date),m=t.isCanceled??!1,L=v&&I&&!m&&!k,_=t.data,B=_?.meetingTookPlace??t.meetingTookPlace??!1,w=m?e.jsx(Vt,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):B?e.jsx(Ft,{className:a.cn("h-3 w-3",f.text)}):null,c=_?.productName,x=_?.extendedProps,M=_?.nrParticipant,D=_?.siteName,H=_?.siteCity,Y=!!D||!!H,E=o.useCallback(()=>{if(!T){if(l&&r){r(t);return}if(u&&R.current){const G=R.current.getBoundingClientRect();A(G),F(!0)}else l||S(!0)}},[T,l,r,t,u]);o.useCallback(()=>{F(!1),A(null),l||S(!0)},[l]);const P=o.useCallback(()=>{S(!1)},[]),Z=o.useCallback(G=>{L&&(G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",t.id),W(!0),I?.startDrag?.(t))},[L,t,I]),X=o.useCallback(()=>{W(!1),I?.isDragging&&I.endDrag?.()},[I]),J=N?N({event:t,onClose:P}):j?j({event:t,onClose:P}):e.jsx(Ie,{event:t,onClose:P}),xe=G=>{switch(p){case"dialog":return e.jsxs(Ze,{open:z,onOpenChange:S,children:[e.jsx(Qe,{asChild:!0,children:G}),e.jsx(_e,{className:"sm:max-w-md",children:J})]});case"sheet":return e.jsxs(rt,{open:z,onOpenChange:S,children:[e.jsx(ot,{asChild:!0,children:G}),e.jsx(We,{children:J})]});case"custom":return G;default:return e.jsxs(ae,{open:z,onOpenChange:S,children:[e.jsx(ie,{asChild:!0,children:G}),e.jsx(se,{className:"w-80",children:J})]})}};if(n==="dot"){const G=e.jsx("button",{type:"button",onClick:E,className:a.cn("size-2 rounded-full cursor-pointer transition-opacity",f.dot,t.isCanceled&&"opacity-50",d),style:C,"aria-label":y.reactNodeToText(t.title)});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})})]}):xe(e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{children:e.jsx("div",{className:"font-medium",children:t.title})})]}))}if(n==="compact"){const G=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!L,onDragStart:Z,onDragEnd:X,onClick:l?E:void 0,onKeyDown:he=>{(he.key==="Enter"||he.key===" ")&&(he.preventDefault(),E())},className:a.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",L?"cursor-grab active:cursor-grabbing":"cursor-pointer",T&&"opacity-50",m?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[f.bg,f.text],s==="mixed"&&[f.bg,f.text],s==="dot"&&"bg-muted/50"],d),style:C,children:[["dot","mixed"].includes(s)&&!m&&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:f.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:a.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",f.border),children:y.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:w})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})})]}):xe(G)}const me=e.jsxs("button",{type:"button",onClick:E,className:a.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",m?"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"&&[f.bg,f.accentBorder,f.text],s==="mixed"&&[f.bg,f.accentBorder,f.text],s==="dot"&&"bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"],d),style:C,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)&&!m&&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:f.dotFill})}),e.jsx("span",{className:a.cn("text-sm font-medium truncate",!m&&s!=="dot"&&f.text,m&&"line-through"),children:t.title})]}),w]}),c&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c}),x&&x.length>0&&e.jsx("div",{className:"flex flex-col text-xs text-muted-foreground",children:x.map((G,he)=>e.jsx("div",{children:G},he))}),M!=null&&M>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[M," participant",M!==1?"s":""]})]}),h&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),Y&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[D,D&&H?", ":"",H]})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),b&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(G=>G.name).join(", ")})]})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:me}),e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})})]}):xe(me)}function Be({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function Ft({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 Vt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function Re({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 ut({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 Ie({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:a.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:a.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(Be,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:y.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 He({event:t,position:n,hourHeight:s=96,badgeVariant:r="colored",onClick:d,className:h,disablePopover:i=!1,renderPopover:b,enableDrag:C=!0}){const l=re(t.color),[j,v]=o.useState(!1),[u,g]=o.useState(!1),p=oe.useOptionalDragDrop(),N=oe.useOptionalInnoCalendar();o.useEffect(()=>{if(!i&&N?.focusEventId&&N.focusEventId===t.id){const E=setTimeout(()=>{v(!0),N.clearFocusEventId()},300);return()=>clearTimeout(E)}},[N?.focusEventId,t.id,i]);const f=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),z=f/60*s-8,S=t.endDate<ct(new Date),T=t.isCanceled??!1,W=C&&p&&!T&&!S,q=f<=20,F=f<35,O=f>20,A=f>=45,R=t.data,I=R?.productName,$=R?.extendedProps,k=R?.nrParticipant,m=R?.siteName,L=R?.siteCity,_=!!m||!!L,B=r==="dot",w=o.useCallback(()=>{u||(i&&d?d(t):i||v(!0))},[u,i,d,t]),c=o.useCallback(()=>{v(!1)},[]),x=o.useCallback(E=>{if(!W)return;E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",t.id);const P=E.currentTarget,Z=P.getBoundingClientRect();E.dataTransfer.setDragImage(P,E.clientX-Z.left,E.clientY-Z.top),g(!0),p?.startDrag?.(t)},[W,t,p]),M=o.useCallback(()=>{g(!1),p?.isDragging&&p.endDrag?.()},[p]),D=o.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),w())},[w]),H=e.jsx("div",{role:"button",tabIndex:0,draggable:!!W,onDragStart:x,onDragEnd:M,onKeyDown:D,onClick:u?void 0:w,className:a.cn("group flex w-full select-none overflow-hidden rounded-md border-l-[3px] 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",W?"cursor-grab active:cursor-grabbing":"cursor-pointer",u&&"opacity-50",T?"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":[!B&&[l.bg,l.accentBorder,l.text],B&&"bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"],q?"flex-row items-center gap-1.5 px-2 py-0":F?"flex-col gap-0.5 px-2 py-0 justify-center":"flex-col gap-0.5 px-2 py-1.5",h),style:{height:`${Math.max(z,20)}px`},children:q?e.jsxs(e.Fragment,{children:[["mixed","dot"].includes(r)&&!T&&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("span",{className:a.cn("font-semibold truncate leading-none text-[11px]",!T&&B&&"text-foreground"),children:t.title}),e.jsx("span",{className:"shrink-0 text-[10px] leading-none opacity-75 tabular-nums",children:y.formatEventTimeDisplay(t)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!T&&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.jsx("p",{className:a.cn("font-semibold truncate leading-tight",!T&&B&&"text-foreground"),children:t.title})})]}),A&&I&&e.jsx("p",{className:a.cn("text-[11px] truncate leading-tight",B?"text-muted-foreground":"opacity-80"),children:I}),A&&$&&$.length>0&&e.jsx("div",{className:a.cn("flex flex-col text-[11px] leading-tight",B?"text-muted-foreground":"opacity-80"),children:$.map((E,P)=>e.jsx("div",{children:E},P))}),k!=null&&k>0&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] leading-tight",B?"text-muted-foreground":"opacity-80"),children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[k," participant",k!==1?"s":""]})]}),O&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",B?"text-muted-foreground":"opacity-90"),children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),A&&_&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] truncate leading-tight",B?"text-muted-foreground":"opacity-80"),children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[m,m&&L?", ":"",L]})]})]})}),Y=e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),I&&e.jsx("div",{className:"text-xs text-muted-foreground",children:I}),$&&$.length>0&&$.map((E,P)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:E},P)),k!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[k," participant",k!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)}),_&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[m,m&&L?", ":"",L]})]})});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(te,{children:[e.jsx(ne,{asChild:!0,children:H}),Y]})}):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(ae,{open:j,onOpenChange:v,children:[e.jsx(ie,{asChild:!0,children:H}),e.jsx(se,{className:"w-80",children:b?b({event:t,onClose:c}):e.jsx(Ie,{event:t,onClose:c})})]})})}function qt({event:t,spanDays:n,isStart:s,isEnd:r,onClick:d,className:h,disablePopover:i=!1,renderPopover:b}){const C=re(t.color),[l,j]=o.useState(!1),v=t.isCanceled??!1,u=o.useCallback(()=>{i&&d?d(t):i||j(!0)},[i,d,t]),g=o.useCallback(()=>{j(!1)},[]),p=e.jsx("button",{type:"button",onClick:u,className:a.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",v?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[C.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",!s&&"border-l-0",!r&&"border-r-0",h),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),N=e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})});return i?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:p}),N]}):e.jsxs(ae,{open:l,onOpenChange:j,children:[e.jsx(ie,{asChild:!0,children:p}),e.jsx(se,{className:"w-80",children:b?b({event:t,onClose:g}):e.jsx(Ie,{event:t,onClose:g})})]})}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=`
1
+ "use strict";const e=require("react/jsx-runtime"),o=require("react"),a=require("./index-D2U2F80P.cjs"),wt=require("@radix-ui/react-dropdown-menu"),y=require("./position-utils-ksZ_IjXC.cjs"),oe=require("./slot-selection-context-CLYZU6ul.cjs"),vt=require("@radix-ui/react-dialog"),Nt=require("@radix-ui/react-popover"),kt=require("@radix-ui/react-tooltip");function be(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 K=be(o),U=be(wt),V=be(vt),ue=be(Nt),je=be(kt);const Ye=(...t)=>t.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();const Dt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ct=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,s,r)=>r?r.toUpperCase():s.toLowerCase());const $e=t=>{const n=Ct(t);return n.charAt(0).toUpperCase()+n.slice(1)};var St={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 Mt=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const Tt=o.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:d="",children:h,iconNode:i,...b},C)=>o.createElement("svg",{ref:C,...St,width:n,height:n,stroke:t,strokeWidth:r?Number(s)*24/Number(n):s,className:Ye("lucide",d),...!h&&!Mt(b)&&{"aria-hidden":"true"},...b},[...i.map(([l,j])=>o.createElement(l,j)),...Array.isArray(h)?h:[h]]));const Me=(t,n)=>{const s=o.forwardRef(({className:r,...d},h)=>o.createElement(Tt,{ref:h,iconNode:n,className:Ye(`lucide-${Dt($e(t))}`,`lucide-${t}`,r),...d}));return s.displayName=$e(t),s};const Et=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],At=Me("check",Et);const Rt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zt=Me("chevron-right",Rt);const Lt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],_t=Me("circle",Lt);const Wt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Je=Me("x",Wt),Ze=V.Root,Qe=V.Trigger,Bt=V.Portal,It=V.Close,et=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Overlay,{ref:s,className:a.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n}));et.displayName=V.Overlay.displayName;const _e=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(Bt,{children:[e.jsx(et,{}),e.jsxs(V.Content,{ref:r,className:a.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",t),...s,children:[n,e.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=V.Content.displayName;const tt=({className:t,...n})=>e.jsx("div",{className:a.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...n});tt.displayName="DialogHeader";const nt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Title,{ref:s,className:a.cn("text-lg font-semibold leading-none tracking-tight",t),...n}));nt.displayName=V.Title.displayName;const st=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Description,{ref:s,className:a.cn("text-sm text-muted-foreground",t),...n}));st.displayName=V.Description.displayName;const ae=ue.Root,ie=ue.Trigger,Ht=ue.Anchor,se=K.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},d)=>e.jsx(ue.Portal,{children:e.jsx(ue.Content,{ref:d,align:n,sideOffset:s,className:a.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})}));se.displayName=ue.Content.displayName;const rt=V.Root,ot=V.Trigger,Ot=V.Close,$t=V.Portal,at=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Overlay,{className:a.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:s}));at.displayName=V.Overlay.displayName;const We=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs($t,{children:[e.jsx(at,{}),e.jsxs(V.Content,{ref:r,className:a.cn("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500","inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",t),...s,children:[n,e.jsxs(V.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));We.displayName="SheetContent";const it=({className:t,...n})=>e.jsx("div",{className:a.cn("flex flex-col space-y-2 text-center sm:text-left",t),...n});it.displayName="SheetHeader";const lt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Title,{ref:s,className:a.cn("text-lg font-semibold text-foreground",t),...n}));lt.displayName=V.Title.displayName;const dt=K.forwardRef(({className:t,...n},s)=>e.jsx(V.Description,{ref:s,className:a.cn("text-sm text-muted-foreground",t),...n}));dt.displayName=V.Description.displayName;const Pt=je.Provider,te=je.Root,ne=je.Trigger,ee=K.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(je.Content,{ref:r,sideOffset:n,className:a.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}));ee.displayName=je.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 ct(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function ye({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:d,showTime:h=!0,showDescription:i=!1,showParticipants:b=!1,style:C,disablePopover:l=!1,renderPopover:j,enableDrag:v=!1,enablePageTransition:u=!1,pageTransitionDuration:g=400,eventDetailMode:p="popover",renderEventDetail:N}){const f=re(t.color),[z,S]=o.useState(!1),[T,W]=o.useState(!1),[q,F]=o.useState(!1),[O,A]=o.useState(null),R=o.useRef(null),I=oe.useOptionalDragDrop(),$=oe.useOptionalInnoCalendar();o.useEffect(()=>{if(!l&&$?.focusEventId&&$.focusEventId===t.id){const G=setTimeout(()=>{S(!0),$.clearFocusEventId()},300);return()=>clearTimeout(G)}},[$?.focusEventId,t.id,l]);const k=t.endDate<ct(new Date),m=t.isCanceled??!1,L=v&&I&&!m&&!k,_=t.data,B=_?.meetingTookPlace??t.meetingTookPlace??!1,w=m?e.jsx(Vt,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):B?e.jsx(Ft,{className:a.cn("h-3 w-3",f.text)}):null,c=_?.productName,x=_?.extendedProps,M=_?.nrParticipant,D=_?.siteName,H=_?.siteCity,Y=!!D||!!H,E=o.useCallback(()=>{if(!T){if(l&&r){r(t);return}if(u&&R.current){const G=R.current.getBoundingClientRect();A(G),F(!0)}else l||S(!0)}},[T,l,r,t,u]);o.useCallback(()=>{F(!1),A(null),l||S(!0)},[l]);const P=o.useCallback(()=>{S(!1)},[]),Z=o.useCallback(G=>{L&&(G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",t.id),W(!0),I?.startDrag?.(t))},[L,t,I]),X=o.useCallback(()=>{W(!1),I?.isDragging&&I.endDrag?.()},[I]),J=N?N({event:t,onClose:P}):j?j({event:t,onClose:P}):e.jsx(Ie,{event:t,onClose:P}),xe=G=>{switch(p){case"dialog":return e.jsxs(Ze,{open:z,onOpenChange:S,children:[e.jsx(Qe,{asChild:!0,children:G}),e.jsx(_e,{className:"sm:max-w-md",children:J})]});case"sheet":return e.jsxs(rt,{open:z,onOpenChange:S,children:[e.jsx(ot,{asChild:!0,children:G}),e.jsx(We,{children:J})]});case"custom":return G;default:return e.jsxs(ae,{open:z,onOpenChange:S,children:[e.jsx(ie,{asChild:!0,children:G}),e.jsx(se,{className:"w-80",children:J})]})}};if(n==="dot"){const G=e.jsx("button",{type:"button",onClick:E,className:a.cn("size-2 rounded-full cursor-pointer transition-opacity",f.dot,t.isCanceled&&"opacity-50",d),style:C,"aria-label":y.reactNodeToText(t.title)});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})})]}):xe(e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{children:e.jsx("div",{className:"font-medium",children:t.title})})]}))}if(n==="compact"){const G=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!L,onDragStart:Z,onDragEnd:X,onClick:l?E:void 0,onKeyDown:he=>{(he.key==="Enter"||he.key===" ")&&(he.preventDefault(),E())},className:a.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",L?"cursor-grab active:cursor-grabbing":"cursor-pointer",T&&"opacity-50",m?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[f.bg,f.text],s==="mixed"&&[f.bg,f.text],s==="dot"&&"bg-muted/50"],d),style:C,children:[["dot","mixed"].includes(s)&&!m&&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:f.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:a.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",f.border),children:y.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:w})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:G}),e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})})]}):xe(G)}const me=e.jsxs("button",{type:"button",onClick:E,className:a.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",m?"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"&&[f.bg,f.accentBorder,f.text],s==="mixed"&&[f.bg,f.accentBorder,f.text],s==="dot"&&"bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"],d),style:C,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)&&!m&&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:f.dotFill})}),e.jsx("span",{className:a.cn("text-sm font-medium truncate",!m&&s!=="dot"&&f.text,m&&"line-through"),children:t.title})]}),w]}),c&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:c}),x&&x.length>0&&e.jsx("div",{className:"flex flex-col text-xs text-muted-foreground",children:x.map((G,he)=>e.jsx("div",{children:G},he))}),M!=null&&M>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[M," participant",M!==1?"s":""]})]}),h&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),Y&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[D,D&&H?", ":"",H]})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),b&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(G=>G.name).join(", ")})]})]});return l?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:me}),e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})})]}):xe(me)}function Be({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function Ft({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 Vt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function Re({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 ut({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 Ie({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:a.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:a.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(Be,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:y.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 He({event:t,position:n,hourHeight:s=96,badgeVariant:r="colored",onClick:d,className:h,disablePopover:i=!1,renderPopover:b,enableDrag:C=!0}){const l=re(t.color),[j,v]=o.useState(!1),[u,g]=o.useState(!1),p=oe.useOptionalDragDrop(),N=oe.useOptionalInnoCalendar();o.useEffect(()=>{if(!i&&N?.focusEventId&&N.focusEventId===t.id){const E=setTimeout(()=>{v(!0),N.clearFocusEventId()},300);return()=>clearTimeout(E)}},[N?.focusEventId,t.id,i]);const f=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),z=f/60*s-8,S=t.endDate<ct(new Date),T=t.isCanceled??!1,W=C&&p&&!T&&!S,q=f<=20,F=f<35,O=f>20,A=f>=45,R=t.data,I=R?.productName,$=R?.extendedProps,k=R?.nrParticipant,m=R?.siteName,L=R?.siteCity,_=!!m||!!L,B=r==="dot",w=o.useCallback(()=>{u||(i&&d?d(t):i||v(!0))},[u,i,d,t]),c=o.useCallback(()=>{v(!1)},[]),x=o.useCallback(E=>{if(!W)return;E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",t.id);const P=E.currentTarget,Z=P.getBoundingClientRect();E.dataTransfer.setDragImage(P,E.clientX-Z.left,E.clientY-Z.top),g(!0),p?.startDrag?.(t)},[W,t,p]),M=o.useCallback(()=>{g(!1),p?.isDragging&&p.endDrag?.()},[p]),D=o.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),w())},[w]),H=e.jsx("div",{role:"button",tabIndex:0,draggable:!!W,onDragStart:x,onDragEnd:M,onKeyDown:D,onClick:u?void 0:w,className:a.cn("group flex w-full select-none overflow-hidden rounded-md border-l-[3px] 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",W?"cursor-grab active:cursor-grabbing":"cursor-pointer",u&&"opacity-50",T?"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":[!B&&[l.bg,l.accentBorder,l.text],B&&"bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"],q?"flex-row items-center gap-1.5 px-2 py-0":F?"flex-col gap-0.5 px-2 py-0 justify-center":"flex-col gap-0.5 px-2 py-1.5",h),style:{height:`${Math.max(z,20)}px`},children:q?e.jsxs(e.Fragment,{children:[["mixed","dot"].includes(r)&&!T&&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("span",{className:a.cn("font-semibold truncate leading-none text-[11px]",!T&&B&&"text-foreground"),children:t.title}),e.jsx("span",{className:"shrink-0 text-[10px] leading-none opacity-75 tabular-nums",children:y.formatEventTimeDisplay(t)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!T&&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.jsx("p",{className:a.cn("font-semibold truncate leading-tight",!T&&B&&"text-foreground"),children:t.title})})]}),A&&I&&e.jsx("p",{className:a.cn("text-[11px] truncate leading-tight",B?"text-muted-foreground":"opacity-80"),children:I}),A&&$&&$.length>0&&e.jsx("div",{className:a.cn("flex flex-col text-[11px] leading-tight",B?"text-muted-foreground":"opacity-80"),children:$.map((E,P)=>e.jsx("div",{children:E},P))}),k!=null&&k>0&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] leading-tight",B?"text-muted-foreground":"opacity-80"),children:[e.jsx(Re,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[k," participant",k!==1?"s":""]})]}),O&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",B?"text-muted-foreground":"opacity-90"),children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),A&&_&&e.jsxs("div",{className:a.cn("flex items-center gap-1 text-[11px] truncate leading-tight",B?"text-muted-foreground":"opacity-80"),children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[m,m&&L?", ":"",L]})]})]})}),Y=e.jsx(ee,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),I&&e.jsx("div",{className:"text-xs text-muted-foreground",children:I}),$&&$.length>0&&$.map((E,P)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:E},P)),k!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[k," participant",k!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)}),_&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[m,m&&L?", ":"",L]})]})});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(te,{children:[e.jsx(ne,{asChild:!0,children:H}),Y]})}):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(ae,{open:j,onOpenChange:v,children:[e.jsx(ie,{asChild:!0,children:H}),e.jsx(se,{className:"w-80",children:b?b({event:t,onClose:c}):e.jsx(Ie,{event:t,onClose:c})})]})})}function qt({event:t,spanDays:n,isStart:s,isEnd:r,onClick:d,className:h,disablePopover:i=!1,renderPopover:b}){const C=re(t.color),[l,j]=o.useState(!1),v=t.isCanceled??!1,u=o.useCallback(()=>{i&&d?d(t):i||j(!0)},[i,d,t]),g=o.useCallback(()=>{j(!1)},[]),p=e.jsx("button",{type:"button",onClick:u,className:a.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",v?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[C.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",!s&&"border-l-0",!r&&"border-r-0",h),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),N=e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})});return i?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:p}),N]}):e.jsxs(ae,{open:l,onOpenChange:j,children:[e.jsx(ie,{asChild:!0,children:p}),e.jsx(se,{className:"w-80",children:b?b({event:t,onClose:g}):e.jsx(Ie,{event:t,onClose:g})})]})}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
2
  @keyframes event-marquee {
3
3
  0% { transform: translateX(0); }
4
4
  100% { transform: translateX(-50%); }
@@ -8,4 +8,4 @@
8
8
  will-change: transform;
9
9
  }
10
10
  `,document.head.appendChild(t)}const Pe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Fe=a.clsx,xt=(t,n)=>s=>{var r;if(n?.variants==null)return Fe(t,s?.class,s?.className);const{variants:d,defaultVariants:h}=n,i=Object.keys(d).map(l=>{const j=s?.[l],v=h?.[l];if(j===null)return null;const u=Pe(j)||Pe(v);return d[l][u]}),b=s&&Object.entries(s).reduce((l,j)=>{let[v,u]=j;return u===void 0||(l[v]=u),l},{}),C=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((l,j)=>{let{class:v,className:u,...g}=j;return Object.entries(g).every(p=>{let[N,f]=p;return Array.isArray(f)?f.includes({...h,...b}[N]):{...h,...b}[N]===f})?[...l,v,u]:l},[]);return Fe(t,i,C,s?.class,s?.className)},mt=xt("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"}}),le=o.forwardRef(({className:t,variant:n,size:s,loading:r,disabled:d,children:h,...i},b)=>e.jsxs("button",{className:a.cn(mt({variant:n,size:s,className:t})),ref:b,disabled:d||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"})]}),h]}));le.displayName="Button";const ze=U.Root,Le=U.Trigger,Gt=K.forwardRef(({className:t,inset:n,children:s,...r},d)=>e.jsxs(U.SubTrigger,{ref:d,className:a.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(zt,{className:"ml-auto h-4 w-4"})]}));Gt.displayName=U.SubTrigger.displayName;const Ut=K.forwardRef(({className:t,...n},s)=>e.jsx(U.SubContent,{ref:s,className:a.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}));Ut.displayName=U.SubContent.displayName;const De=K.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(U.Portal,{children:e.jsx(U.Content,{ref:r,sideOffset:n,className:a.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})}));De.displayName=U.Content.displayName;const Ce=K.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Item,{ref:r,className:a.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}));Ce.displayName=U.Item.displayName;const Kt=K.forwardRef(({className:t,children:n,checked:s=!1,...r},d)=>e.jsxs(U.CheckboxItem,{ref:d,className:a.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(At,{className:"h-4 w-4"})})}),n]}));Kt.displayName=U.CheckboxItem.displayName;const Xt=K.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(U.RadioItem,{ref:r,className:a.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(_t,{className:"h-2 w-2 fill-current"})})}),n]}));Xt.displayName=U.RadioItem.displayName;const Yt=K.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Label,{ref:r,className:a.cn("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...s}));Yt.displayName=U.Label.displayName;const Jt=K.forwardRef(({className:t,...n},s)=>e.jsx(U.Separator,{ref:s,className:a.cn("-mx-1 my-1 h-px bg-muted",t),...n}));Jt.displayName=U.Separator.displayName;const Zt=xt("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 ht({className:t,variant:n,...s}){return e.jsx("div",{className:a.cn(Zt({variant:n}),t),...s})}function Qt({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 en({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 tn=["January","February","March","April","May","June","July","August","September","October","November","December"];function pt({date:t,view:n,events:s=[],onNavigatePrev:r,onNavigateNext:d,weekStartsOn:h=1,showEventCount:i=!0,className:b}){const C=tn[t.getMonth()],l=t.getFullYear(),j=i?y.getEventsCountInView(s,t,n,h):0,v=y.getRangeText(t,n);return e.jsxs("div",{className:a.cn("min-w-0 flex-1",b),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:[C," ",l]}),i&&e.jsx(ht,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:j})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(le,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(Qt,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:v}),e.jsx(le,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:d,children:e.jsx(en,{})})]})]})}const nn=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function ft({onClick:t,className:n}){const s=new Date;return e.jsxs("button",{type:"button",className:a.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:nn[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 sn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("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 ce({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 Ve({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 rn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("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 qe({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 on({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 an({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 ln({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 dn({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 cn=[{value:"day",label:"Day",icon:on},{value:"week",label:"Week",icon:an},{value:"month",label:"Month",icon:ln},{value:"year",label:"Year",icon:dn}],Ge=[{value:"timeline-day",label:"1 Day",icon:ce},{value:"timeline-3day",label:"3 Days",icon:ce},{value:"timeline-week",label:"7 Days",icon:ce}],un=[{value:"resource-day",label:"1 Day",icon:ce},{value:"resource-week",label:"7 Days",icon:ce}];function xn({currentDate:t,view:n,events:s=[],onNavigateToday:r,onNavigatePrev:d,onNavigateNext:h,onNavigate:i,onViewChange:b,onAddEvent:C,availableViews:l=["day","week","month","agenda"],showTimelineViews:j=!1,timelineViews:v,settingsContent:u,showSettings:g=!1,filterContent:p,actions:N,className:f,weekStartsOn:z=1,headerConfig:S,labels:T={}}){const W=S?.showToday??!0,q=S?.showDateNavigator??!0,F=S?.showCalendarViews??!0,O=S?.showResourceViews??j,A=S?.showSettings??g,R=S?.showAddEvent??!0,I=S?.showFilters??!0,$=o.useMemo(()=>({today:"Today",addEvent:"Add Event",calendarView:"Calendar View",resourceView:"Resource View",...T}),[T]),k=()=>{r?.(),i?.("today")},m=()=>{d?.(),i?.("prev")},L=()=>{h?.(),i?.("next")},_=["day","week","month","year","agenda"].includes(n),B=n.startsWith("timeline-")||n.startsWith("resource-"),w=cn.filter(D=>l.includes(D.value)),c=_?w.find(D=>D.value===n):null,x=[...Ge,...un],M=B?x.find(D=>D.value===n):null;return e.jsxs("div",{className:a.cn("flex flex-col w-full gap-3 mb-2",f),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:[W&&e.jsx(ft,{onClick:k}),q&&e.jsx(pt,{date:t,view:n,events:s,onNavigatePrev:m,onNavigateNext:L,weekStartsOn:z})]}),R&&C&&e.jsx(le,{size:"icon",className:"shrink-0 lg:hidden",onClick:C,children:e.jsx(qe,{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:[F&&b&&w.length>0&&e.jsxs(ze,{children:[e.jsxs(Le,{className:a.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",_?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-background hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(sn,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:c?.label??$.calendarView}),e.jsx(Ve,{className:"size-3 opacity-60"})]}),e.jsx(De,{align:"start",className:"min-w-[120px]",children:w.map(D=>{const H=D.icon;return e.jsxs(Ce,{onClick:()=>b(D.value),className:a.cn("gap-2",n===D.value&&"bg-accent"),children:[e.jsx(H,{className:"size-4"}),e.jsx("span",{children:D.label})]},D.value)})})]}),O&&b&&e.jsxs(ze,{children:[e.jsxs(Le,{className:a.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(ce,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:M?.label??$.resourceView}),e.jsx(Ve,{className:"size-3 opacity-60"})]}),e.jsx(De,{align:"start",className:"min-w-[120px]",children:Ge.map(D=>{const H=D.icon;return e.jsxs(Ce,{onClick:()=>b(D.value),className:a.cn("gap-2",n===D.value&&"bg-accent"),children:[e.jsx(H,{className:"size-4"}),e.jsx("span",{children:D.label})]},D.value)})})]}),A&&u&&e.jsxs(ae,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(le,{variant:"outline",size:"icon",className:"min-w-10 min-h-10 shrink-0 mx-0",children:e.jsx(rn,{className:"size-4 sm:size-5"})})}),e.jsx(se,{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:u})})]}),N,R&&C&&e.jsxs(le,{className:"hidden lg:flex shrink-0 max-h-10",onClick:C,children:[e.jsx(qe,{className:"size-4"}),$.addEvent]})]})]}),I&&p&&e.jsx("div",{className:"flex items-center gap-2 pb-1 -mb-1 scrollbar-none",children:p})]})}function mn({events:t,date:n,daysAhead:s=60,badgeVariant:r="colored",onEventClick:d,className:h,renderEvent:i,renderPopover:b,slots:C,classNames:l}){const j=o.useMemo(()=>{const u=new Date(n);u.setHours(0,0,0,0);const g=new Date(u);return g.setDate(g.getDate()+s),t.filter(p=>p.endDate>=u&&p.startDate<=g)},[t,s,n]),v=o.useMemo(()=>{const u=y.groupEventsByDate(j),g=[];for(const[p,N]of u)g.push({date:new Date(p),dateKey:p,events:N});return g.sort((p,N)=>p.date.getTime()-N.date.getTime()),g},[j]);return v.length===0?e.jsx("div",{className:a.cn("flex flex-col items-center justify-center h-full py-12",h),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:a.cn("flex flex-col h-full overflow-auto",l?.agendaList,h),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:[j.length," event",j.length!==1?"s":""]})]})}),e.jsx("div",{className:"flex-1",children:v.map(({date:u,dateKey:g,events:p})=>{const N=y.isToday(u),f=u.toLocaleDateString([],{weekday:"short"}),z=u.getDate(),S=u.toLocaleDateString([],{month:"short"});return e.jsxs("div",{className:a.cn("",l?.agendaDayGroup),children:[e.jsx("div",{className:a.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:a.cn("text-[11px] font-medium uppercase tracking-wide",N?"text-primary":"text-muted-foreground"),children:f}),e.jsx("span",{className:a.cn("flex items-center justify-center rounded-full mt-0.5","size-10 text-xl font-normal",N?"bg-primary text-primary-foreground":"text-foreground"),children:z})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[S," ",u.getFullYear()]})]})}),e.jsx("div",{className:"px-4 py-3 space-y-2 border-b last:border-b-0",children:p.map(T=>i?e.jsx("div",{children:i({event:T,variant:"full"})},T.id):e.jsx(ye,{event:T,variant:"full",badgeVariant:r,onClick:d,disablePopover:!!d&&!b,renderPopover:b,showTime:!0,showDescription:!0,showParticipants:!0,...l?.eventCard&&{className:l.eventCard}},T.id))})]},g)})})]})}const we=360,ve=480,Te=280;function gt({isOpen:t,onClose:n,date:s,events:r,anchorRect:d,badgeVariant:h="colored",onEventClick:i,renderEvent:b,renderPopover:C,className:l}){const j=o.useRef(null),v=o.useRef(null),[u,g]=o.useState("closed"),p=o.useRef(null);d&&(p.current=d);const N=d??p.current,f=o.useMemo(()=>[...r].sort((A,R)=>A.startDate.getTime()-R.startDate.getTime()),[r]),z=o.useMemo(()=>{const A=N;if(!A)return{top:0,left:0,width:we,maxHeight:ve};const R=typeof window<"u"?window.innerWidth:1200,I=typeof window<"u"?window.innerHeight:800;let $=A.left+A.width/2-we/2;$=Math.max(16,Math.min($,R-we-16));const k=Math.min(r.length*68+80,ve);let m=A.top+A.height/2-k/2;return m=Math.max(16,Math.min(m,I-k-16)),{top:m,left:$,width:we,maxHeight:ve}},[N,r.length]);o.useLayoutEffect(()=>{if(t&&N)g("entering"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{g("open")})});else if(!t&&(u==="open"||u==="entering")){g("exiting");const A=setTimeout(()=>{g("closed"),p.current=null},Te);return()=>clearTimeout(A)}},[t,N]),o.useEffect(()=>{if(u==="closed")return;const A=R=>{R.key==="Escape"&&(R.stopPropagation(),n())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[u,n]),o.useEffect(()=>{u==="open"&&v.current&&v.current.focus()},[u]);const S=o.useCallback(A=>{A.target===j.current&&n()},[n]);if(u==="closed")return null;const T=u==="entering"||u==="exiting",W=N,q=T&&W?{position:"fixed",top:W.top,left:W.left,width:W.width,height:W.height,maxHeight:W.height,opacity:u==="entering"?.7:0,transform:"scale(1)",borderRadius:"8px"}:{position:"fixed",top:z.top,left:z.left,width:z.width,maxHeight:z.maxHeight,opacity:1,transform:"scale(1)",borderRadius:"12px"},F=T?0:1,O=s.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:j,role:"presentation",onClick:S,className:"ic-expansion-backdrop",style:{position:"fixed",inset:0,zIndex:40,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:F,transition:`opacity ${Te}ms cubic-bezier(0.32, 0.72, 0, 1)`}}),e.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":`Events for ${O}`,tabIndex:-1,className:a.cn("ic-expansion-panel","!bg-white border border-border shadow-2xl overflow-hidden","focus:outline-none",l),style:{...q,zIndex:41,transition:`all ${Te}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:O}),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:`${ve-64}px`},children:[f.map(A=>e.jsx("div",{onPointerDown:R=>R.stopPropagation(),children:b?b({event:A,variant:"compact"}):e.jsx(ye,{event:A,variant:"compact",badgeVariant:h,onClick:i,renderPopover:C,showTime:!0})},A.id)),r.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No events"})]})]})]})}function hn({event:t,date:n,onEventClick:s,disablePopover:r,renderPopover:d}){const[h,i]=o.useState(!1),b=re(t.color),C=y.detectAllDayEvent(t),l=y.isSameDay(t.startDate,n),j=y.isSameDay(t.endDate,n),v=C&&y.isSameDay(t.startDate,t.endDate),u=o.useCallback(()=>{r&&s?s(t):r||i(!0)},[r,s,t]),g=o.useCallback(()=>{i(!1)},[]),p=e.jsxs("button",{type:"button",onClick:u,title:y.formatEventTimeDisplay(t),className:a.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",b.bg,b.text,t.isCanceled&&"opacity-60 line-through"),children:[!v&&l&&!j&&"→ ",!v&&!l&&j&&" ←",!v&&!l&&!j&&"↔ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:t.title}),v&&e.jsx("span",{className:"text-[9px] opacity-70 sm:text-[10px]",children:"All day"})]}),N=e.jsx(ee,{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:y.formatEventTimeDisplay(t)})]})});return r?e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:p}),N]}):e.jsxs(ae,{open:h,onOpenChange:i,children:[e.jsx(ie,{asChild:!0,children:p}),e.jsx(se,{className:"w-80",children:d?d({event:t,onClose:g}):e.jsx(pn,{event:t,onClose:g})})]})}function pn({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:a.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:a.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:y.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 yt({events:t,date:n,onEventClick:s,disablePopover:r=!1,renderPopover:d,className:h}){if(t.length===0)return null;const i=t.some(l=>y.detectAllDayEvent(l)&&y.isSameDay(l.startDate,l.endDate)),b=t.some(l=>!y.isSameDay(l.startDate,l.endDate)||y.detectAllDayEvent(l)&&!y.isSameDay(l.startDate,l.endDate)),C=i&&b?"All day / Multi-day":i?"All day":"Multi-day";return e.jsxs("div",{className:a.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",h),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:C}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(l=>e.jsx(hn,{event:l,date:n,onEventClick:s,disablePopover:r,renderPopover:d},l.id))})]})}const fn=5;function bt({slot:t,onSelectionStart:n,onSelectionMove:s,onSelectionEnd:r,isSelected:d=!1,isSelecting:h=!1,disabled:i=!1,ariaLabel:b,children:C,className:l,height:j,style:v,dataAttributes:u}){const g=o.useRef(null),p=o.useRef(!1),N=o.useRef(!1),f=o.useRef(null),[z,S]=o.useState(!1),T=oe.useOptionalDragDrop(),W=o.useCallback(k=>{i||k.button!==0&&k.pointerType==="mouse"||(k.preventDefault(),g.current={x:k.clientX,y:k.clientY},p.current=!1,N.current=!0,n?.(t))},[i,t,n]),q=o.useCallback(k=>{if(!(g.current&&N.current&&!i))return;const m=k.clientX-g.current.x,L=k.clientY-g.current.y;Math.sqrt(m*m+L*L)>=fn&&(p.current=!0)},[i]),F=o.useCallback(k=>{i||(k.buttons>0||h)&&s?.(t)},[i,h,t,s]),O=o.useCallback(()=>{i||(r?.(),g.current=null,p.current=!1,N.current=!1)},[i,r]),A=o.useCallback(k=>{if(!T?.isDragging||i)return;k.preventDefault(),k.dataTransfer.dropEffect="move",S(!0);const m=new Date,L=t.hour??m.getHours(),_=t.minute??(m.getMinutes()>=30?30:0);T.updateDragPreview?.(t.date,L,_)},[T,i,t]),R=o.useCallback(()=>{S(!1)},[]),I=o.useCallback(k=>{k.preventDefault(),S(!1),!(!T?.isDragging||i)&&T.endDrag?.()},[T,i]);o.useEffect(()=>{const k=()=>{N.current&&(N.current=!1,g.current=null,p.current=!1)};return window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k),()=>{window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)}},[]);const $=o.useCallback(k=>{i||(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),n?.(t),r?.())},[i,t,n,r]);return e.jsx("button",{ref:f,type:"button","aria-label":b,"aria-disabled":i,"aria-pressed":d,disabled:i,onPointerDown:W,onPointerMove:q,onPointerUp:O,onPointerEnter:F,onKeyDown:$,onDragOver:A,onDragLeave:R,onDrop:I,className:a.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",!(h||i)&&"hover:bg-blue-50/60",d&&"bg-blue-100/70",z&&"bg-primary/20 ring-2 ring-primary ring-inset",i&&"cursor-not-allowed opacity-50",l),style:{height:j,...v},...u,children:C})}function Oe({slot:t,date:n,hour:s,minute:r,ariaLabel:d,...h}){const i=t??{date:n,hour:s??0,minute:r??0},b=d??`Add event at ${(i.hour??0).toString().padStart(2,"0")}:${(i.minute??0).toString().padStart(2,"0")} on ${i.date.toLocaleDateString()}`;return e.jsx(bt,{slot:i,ariaLabel:b,...h})}function jt({slot:t,date:n,ariaLabel:s,...r}){const d=t??{date:n},h=s??`Select ${d.date.toLocaleDateString()}`;return e.jsx(bt,{slot:d,ariaLabel:h,...r})}const pe=96,Ee=72,Ae=80;function gn({events:t,date:n,visibleHours:s={startHour:0,endHour:24},workingHours:r,slotDuration:d=30,badgeVariant:h="colored",onEventClick:i,onSlotSelect:b,className:C,renderEvent:l,renderPopover:j,slots:v,classNames:u}){const g=60/d,p=100/g,N=o.useMemo(()=>{const w=[];for(let c=0;c<g;c++)w.push(c*d);return w},[g,d]),f=o.useMemo(()=>y.getEventsForDay(t,n),[t,n]),{singleDay:z,multiDay:S}=o.useMemo(()=>y.separateEventsByDuration(f),[f]),T=o.useMemo(()=>{const w=y.calculateOverlappingPositions(z,n,s,pe),c=new Map;for(const x of w)c.set(x.event.id,x.position);return c},[z,n,s]),W=o.useMemo(()=>y.getVisibleHoursArray(s),[s]),q=new Date,F=y.isToday(n),O=o.useMemo(()=>{if(!F)return 0;const w=q.getHours()+q.getMinutes()/60;return w<s.startHour||w>s.endHour?-1:(w-s.startHour)*pe},[F,s,q]),A=o.useRef(null);o.useLayoutEffect(()=>{const w=A.current;if(!w)return;const c=()=>{let x;if(F){const D=new Date().getHours();x=Math.max(D-1,s.startHour)}else{const D=n.getDay(),H=r?.[D];H?.enabled&&H.from>0?x=Math.max(H.from-1,s.startHour):x=Math.max(7,s.startHour)}const M=(x-s.startHour)*pe;w.scrollTo({top:M,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(c)})},[n,r,s,F]);const R=oe.useOptionalSlotSelection(),I=o.useCallback(w=>{R?.startSelection(w)},[R]),$=o.useCallback(w=>{R?.updateSelection(w)},[R]),k=o.useCallback(()=>{R?.endSelection()},[R]),m=o.useCallback(w=>{i?.(w)},[i]),L=n.toLocaleDateString([],{weekday:"short"}),_=n.getDate(),B=y.isToday(n);return e.jsxs("div",{className:a.cn("flex flex-col h-full",C),children:[e.jsx("div",{className:a.cn("flex items-center gap-3 border-b px-4 py-3",u?.columnHeader,B&&u?.columnHeaderToday),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:a.cn("text-[11px] font-medium uppercase tracking-wide",B?"text-primary":"text-muted-foreground"),children:L}),e.jsx("span",{className:a.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",B?"bg-primary text-primary-foreground":"text-foreground"),children:_})]})}),S.length>0&&e.jsx(yt,{events:S,date:n,onEventClick:m,disablePopover:!!i&&!j,renderPopover:j,...u?.multiDayBanner&&{className:u.multiDayBanner}}),e.jsx("div",{ref:A,className:a.cn("flex-1",u?.scrollContainer),children:e.jsxs("div",{className:"relative min-h-full",children:[W.map((w,c)=>{const M=!y.isWorkingHour(n,w,r);return e.jsxs("div",{className:a.cn("relative flex",M&&"bg-calendar-disabled-hour",u?.timeSlot,M?u?.timeSlotNonWorking:u?.timeSlotWorking),style:{height:pe},children:[e.jsx("div",{className:a.cn("relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",u?.timeGutter),style:{width:Ee},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:c!==0&&e.jsx("span",{className:a.cn("text-[10px] sm:text-xs text-muted-foreground",u?.timeGutterLabel),children:y.formatHourLabel(w)})})}),e.jsxs("div",{className:"relative flex-1",children:[F&&!M&&e.jsx("div",{className:"absolute inset-0 bg-primary/5"}),c!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),N.slice(1).map(D=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${D/60*100}%`}},D)),N.map((D,H)=>{const Y={date:n,hour:w,minute:D};return e.jsx(Oe,{slot:Y,onSelectionStart:I,onSelectionMove:$,onSelectionEnd:k,isSelected:R?.isSlotSelected(Y)??!1,isSelecting:R?.isSelecting??!1,disabled:M,className:"absolute inset-x-0",style:{top:`${H*p}%`,height:`${p}%`},ariaLabel:`Add event at ${y.formatHourLabel(w)}:${String(D).padStart(2,"0")}`},D)})]})]},w)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:Ee},children:z.map(w=>{const c=T.get(w.id);if(!c)return null;const x=`calc(${c.width}% - 2px)`,M=`max(${Ae}px, ${x})`;return l?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${c.top}px`,left:`${c.left}%`,width:M,minWidth:`${Ae}px`},children:l({event:w,position:c})},w.id):e.jsx(He,{event:w,position:{top:c.top,left:c.left,width:c.width,minWidth:Ae},hourHeight:pe,badgeVariant:h,onClick:i,disablePopover:!!i&&!j,renderPopover:j,className:a.cn("pointer-events-auto",u?.eventCard)},w.id)})}),F&&O>=0&&e.jsxs("div",{className:a.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",u?.currentTimeIndicator),style:{top:O,left:Ee},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 yn=[{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"}],bn=[{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"}],fe=3;function jn({events:t,date:n,weekStartsOn:s=1,badgeVariant:r="colored",onEventClick:d,onSlotSelect:h,onDayClick:i,className:b,renderEvent:C,renderPopover:l,showMoreMode:j,showMoreEventsInPopover:v=!1,slots:u,classNames:g}){const p=j??(v?"popover":"expand"),N=u?.dayCellHeader,f=u?.dayCellFooter,[z,S]=o.useState(null),[T,W]=o.useState(null),q=o.useMemo(()=>y.generateMonthGrid(n,s),[n,s]),F=o.useMemo(()=>{const m=new Map;for(const L of q){const _=L.date.toDateString(),B=y.getEventsForDay(t,L.date);B.sort((w,c)=>w.startDate.getTime()-c.startDate.getTime()),m.set(_,B)}return m},[q,t]),O=oe.useOptionalSlotSelection(),A=o.useCallback(m=>{O?.startSelection(m)},[O]),R=o.useCallback(m=>{O?.updateSelection(m)},[O]),I=o.useCallback(()=>{O?.endSelection()},[O]),$=o.useCallback(m=>{i?.(m)},[i]),k=s===0?bn:yn;return e.jsxs("div",{className:a.cn("flex flex-col h-full overflow-hidden",b),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:a.cn("grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",g?.weekdayHeader),children:k.map((m,L)=>e.jsxs("div",{className:a.cn("py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",L>=5&&"text-muted-foreground/70",g?.weekdayLabel),children:[e.jsx("span",{className:"sm:hidden",children:m.short}),e.jsx("span",{className:"hidden sm:inline",children:m.short})]},m.full))}),e.jsx("div",{className:a.cn("grid grid-cols-7 auto-rows-min",g?.monthGrid),children:q.map(m=>{const L=m.date.toDateString(),_=F.get(L)||[],B=y.isToday(m.date),w=m.date.getDay()===0||m.date.getDay()===6,c=_.length>fe;return e.jsxs(jt,{date:m.date,dataAttributes:{"data-day-key":L},onSelectionStart:A,onSelectionMove:R,onSelectionEnd:I,isSelected:O?.isSlotSelected({date:m.date})??!1,isSelecting:O?.isSelecting??!1,className:a.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",!m.isCurrentMonth&&"bg-muted/20",w&&m.isCurrentMonth&&"bg-muted/10",g?.dayCell,B&&g?.dayCellToday,!m.isCurrentMonth&&g?.dayCellOutside,w&&g?.dayCellWeekend),ariaLabel:`${m.date.toLocaleDateString()} - ${_.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:a.cn("flex items-center justify-center p-1",!m.isCurrentMonth&&"text-muted-foreground/40",g?.dayCellNumber),children:e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),$(m.date)},className:a.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",B?"bg-primary text-primary-foreground":"hover:bg-muted"),children:m.date.getDate()})}),N&&e.jsx(N,{date:m.date,events:_,isToday:B,isCurrentMonth:m.isCurrentMonth,isWeekend:w,view:"month"}),e.jsxs("div",{className:a.cn("flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",g?.dayCellContent),children:[_.slice(0,fe).map(x=>e.jsx("div",{onPointerDown:M=>{M.stopPropagation()},children:C?C({event:x,variant:"compact"}):e.jsx(ye,{event:x,variant:"compact",badgeVariant:r,onClick:d,disablePopover:!!d&&!l,renderPopover:l,showTime:!1,enableDrag:!0,...g?.eventCardCompact&&{className:g.eventCardCompact}})},x.id)),c&&p==="expand"&&e.jsxs("button",{type:"button",onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation();const M=document.querySelector(`[data-day-key="${L}"]`);W({date:m.date,events:_,rect:M?.getBoundingClientRect()??new DOMRect(window.innerWidth/2-180,window.innerHeight/2-240,0,0)})},className:a.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",g?.moreEventsIndicator),children:["+",_.length-fe," more"]}),c&&p==="popover"&&e.jsxs(ae,{open:z===L,onOpenChange:x=>S(x?L:null),children:[e.jsx(ie,{asChild:!0,children:e.jsxs("button",{type:"button",onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation(),S(L)},className:a.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",g?.moreEventsIndicator),children:["+",_.length-fe," more"]})}),e.jsxs(se,{align:"start",side:"right",sideOffset:8,className:"w-72 max-h-80 overflow-y-auto p-2",onPointerDown:x=>x.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:m.date.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.length," events"]})]}),e.jsx("div",{className:"space-y-1.5",children:_.map(x=>e.jsx("div",{children:C?C({event:x,variant:"compact"}):e.jsx(ye,{event:x,variant:"compact",badgeVariant:r,onClick:M=>{S(null),d?.(M)},disablePopover:!!d&&!l,renderPopover:l,showTime:!0})},x.id))})]})]}),c&&p==="dayView"&&e.jsxs("div",{onPointerDown:x=>{x.stopPropagation(),$(m.date)},className:a.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",g?.moreEventsIndicator),children:["+",_.length-fe," more"]})]}),f&&e.jsx(f,{date:m.date,events:_,isToday:B,isCurrentMonth:m.isCurrentMonth,isWeekend:w,view:"month"})]},L)})})]})}),e.jsx(gt,{isOpen:T!==null,onClose:()=>W(null),date:T?.date??new Date,events:T?.events??[],anchorRect:T?.rect??null,badgeVariant:r,onEventClick:d,renderEvent:C,renderPopover:l})]})}const Se=26,Ue=2,Ne=4;function Ke(t,n){const s=y.startOfDay(t);for(let d=0;d<n.length;d++){const h=n[d];if(h&&y.isSameDay(s,h))return d}const r=n[0];return r&&s<y.startOfDay(r)?-1:7}function wn(t){const n=[...t].sort((r,d)=>{const h=r.endCol-r.startCol,i=d.endCol-d.startCol;return i!==h?i-h:r.startCol-d.startCol}),s=[];return n.map(r=>{let d=-1;for(let i=0;i<s.length;i++){const b=s[i];if(!b)continue;let C=!0;for(let l=r.startCol;l<=r.endCol;l++)if(b[l]){C=!1;break}if(C){d=i;break}}d===-1&&(d=s.length,s.push(new Array(7).fill(!1)));const h=s[d];if(h)for(let i=r.startCol;i<=r.endCol;i++)h[i]=!0;return{...r,row:d}})}function vn({pe:t,onEventClick:n,disablePopover:s,renderPopover:r}){const[d,h]=o.useState(!1),i=re(t.event.color),b=o.useCallback(()=>{s&&n?n(t.event):s||h(!0)},[s,n,t.event]),C=o.useCallback(()=>{h(!1)},[]),l=e.jsxs("button",{type:"button",onClick:b,className:a.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:Se,lineHeight:`${Se}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:"▸"})]}),j=e.jsx(ee,{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:y.formatEventTimeDisplay(t.event)})]})}),v={gridColumn:`${t.startCol+2} / ${t.endCol+3}`,gridRow:t.row+1};return s?e.jsx("div",{style:v,children:e.jsxs(te,{children:[e.jsx(ne,{asChild:!0,children:l}),j]})}):e.jsx("div",{style:v,children:e.jsxs(ae,{open:d,onOpenChange:h,children:[e.jsx(ie,{asChild:!0,children:l}),e.jsx(se,{className:"w-80",children:r?r({event:t.event,onClose:C}):e.jsx(Nn,{event:t.event,onClose:C})})]})})}function Nn({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:a.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:a.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:y.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 kn({events:t,weekDays:n,hourColumnWidth:s,minDayColumnWidth:r,dayColumnWidths:d,onEventClick:h,disablePopover:i=!1,renderPopover:b,className:C}){const l=o.useMemo(()=>{if(t.length===0)return[];const f=t.map(z=>{const S=Ke(z.startDate,n),T=Ke(z.endDate,n),W=Math.max(0,S),q=Math.min(6,T);if(W>6||q<0)return null;const F=S<0,O=T>6,R=y.detectAllDayEvent(z)&&y.isSameDay(z.startDate,z.endDate);return{event:z,startCol:W,endCol:q,continuesBefore:F,continuesAfter:O,isSingleDayAllDay:R}}).filter(Boolean);return wn(f)},[t,n]);if(l.length===0)return null;const j=Math.max(...l.map(f=>f.row))+1,v=Math.min(j,Ne),u=j>Ne,g=u?l.filter(f=>f.row>=Ne).length:0,p=[`${s}px`,...d.map(f=>f>r?`${f}px`:`minmax(${r}px, 1fr)`)].join(" "),N=v*Se+(v-1)*Ue+8;return e.jsxs("div",{className:a.cn("ic-all-day-row border-b bg-muted/20 relative",C),style:{display:"grid",gridTemplateColumns:p,gridTemplateRows:`repeat(${v}, ${Se}px)`,gap:`${Ue}px 0`,paddingTop:4,paddingBottom:4,minHeight:N},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 ${v}`},children:e.jsx("span",{className:"hidden sm:inline",children:"All day"})}),n.map((f,z)=>e.jsx("div",{className:"pointer-events-none border-r last:border-r-0",style:{gridColumn:z+2,gridRow:`1 / span ${v}`}},f.toDateString())),l.filter(f=>f.row<Ne).map(f=>e.jsx(vn,{pe:f,onEventClick:h,disablePopover:i,renderPopover:b},f.event.id)),u&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-2 flex items-center",style:{gridColumn:`2 / ${n.length+2}`,gridRow:v},children:["+",g," more"]})]})}const de=96,ge=56,Xe=72,Q=120,ke=100,Dn=3;function Cn({events:t,date:n,weekStartsOn:s=1,visibleHours:r={startHour:0,endHour:24},workingHours:d,slotDuration:h=30,badgeVariant:i="colored",onEventClick:b,onSlotSelect:C,onDayClick:l,className:j,renderEvent:v,renderPopover:u,slots:g,classNames:p}){const N=60/h,f=100/N,z=o.useMemo(()=>{const c=[];for(let x=0;x<N;x++)c.push(x*h);return c},[N,h]),S=o.useMemo(()=>y.getWeekDays(n,s),[n,s]),T=o.useMemo(()=>y.getVisibleHoursArray(r),[r]),W=o.useMemo(()=>{const c=new Map;for(const x of S){const M=x.toDateString(),D=y.getEventsForDay(t,x),{singleDay:H,multiDay:Y}=y.separateEventsByDuration(D),E=y.calculateOverlappingPositions(H,x,r,de),P=new Map;let Z=1;for(const X of E)if(P.set(X.event.id,X.position),X.position.width>0){const J=Math.round(100/X.position.width);Z=Math.max(Z,J)}c.set(M,{singleDay:H,multiDay:Y,positions:P,maxOverlapping:Z})}return c},[S,t,r]),q=o.useMemo(()=>{const c=new Map;for(const{multiDay:x}of W.values())for(const M of x)c.set(M.id,M);return Array.from(c.values())},[W]),F=new Date,O=S.findIndex(c=>y.isToday(c)),A=o.useMemo(()=>{if(O<0)return-1;const c=F.getHours()+F.getMinutes()/60;return c<r.startHour||c>r.endHour?-1:(c-r.startHour)*de},[O,r,F]),R=o.useRef(null);o.useLayoutEffect(()=>{const c=R.current;if(!c)return;const x=()=>{let M;if(O!==-1){const H=new Date().getHours();M=Math.max(H-1,r.startHour)}else{const Y=new Date().getDay();let E=d?.[Y];if(!E?.enabled||E.from===0){const P=d?.[1];P?.enabled&&(E=P)}E?.enabled&&E.from>0?M=Math.max(E.from-1,r.startHour):M=Math.max(7,r.startHour)}const D=(M-r.startHour)*de;c.scrollTo({top:D,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(x)})},[n,d,r,O]);const I=oe.useOptionalSlotSelection(),$=o.useCallback(c=>{I?.startSelection(c)},[I]),k=o.useCallback(c=>{I?.updateSelection(c)},[I]),m=o.useCallback(()=>{I?.endSelection()},[I]),L=o.useCallback(c=>{b?.(c)},[b]),_=ge+7*Q,B=o.useMemo(()=>{const c=[];for(const x of S){const M=x.toDateString(),H=W.get(M)?.maxOverlapping??1;H>Dn?c.push(Math.max(Q,H*ke)):c.push(Q)}return c},[S,W]),w=ge+B.reduce((c,x)=>c+x,0);return e.jsxs("div",{className:a.cn("ic-week-view flex flex-col h-full",j),children:[q.length>0&&e.jsx(kn,{events:q,weekDays:S,hourColumnWidth:ge,minDayColumnWidth:Q,dayColumnWidths:B,onEventClick:L,disablePopover:!!b&&!u,renderPopover:u,...p?.multiDayBanner&&{className:p.multiDayBanner}}),e.jsx("div",{ref:R,className:a.cn("ic-week-scroll-container flex-1",p?.scrollContainer),children:e.jsxs("div",{style:{minWidth:Math.max(_,w)},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:ge,height:Xe},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const c=new Date().getTimezoneOffset(),x=Math.abs(Math.floor(c/60)),M=c<=0?"+":"-";return x>0?`${M}${String(x).padStart(2,"0")}`:""})()]})}),S.map((c,x)=>{const M=y.isToday(c),D=B[x]??Q,H=D>Q;return e.jsxs("div",{className:a.cn("flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",p?.columnHeader,M&&p?.columnHeaderToday),style:{height:Xe,minWidth:H?D:Q},children:[e.jsx("span",{className:a.cn("text-[11px] font-medium uppercase tracking-wide",M?"text-primary":"text-muted-foreground"),children:c.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>l?.(c),className:a.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",M?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:c.getDate()})]},c.toDateString())})]})}),e.jsxs("div",{className:"relative flex",children:[e.jsx("div",{className:a.cn("ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",p?.timeGutter),style:{width:ge},children:T.map((c,x)=>e.jsx("div",{className:"relative",style:{height:de},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:x!==0&&e.jsx("span",{className:a.cn("text-[10px] sm:text-xs text-muted-foreground",p?.timeGutterLabel),children:y.formatHourLabel(c)})})},c))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:S.map((c,x)=>{const M=c.toDateString(),D=W.get(M),H=B[x]??Q,Y=H>Q;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:Y?H:Q},children:[T.map((E,P)=>{const X=!y.isWorkingHour(c,E,d);return e.jsxs("div",{className:a.cn("relative",X&&"bg-calendar-disabled-hour",y.isToday(c)&&!X&&"bg-primary/5",p?.timeSlot,X?p?.timeSlotNonWorking:p?.timeSlotWorking),style:{height:de},children:[P!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),z.slice(1).map(J=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${J/60*100}%`}},J)),z.map((J,xe)=>{const me={date:c,hour:E,minute:J};return e.jsx(Oe,{slot:me,onSelectionStart:$,onSelectionMove:k,onSelectionEnd:m,isSelected:I?.isSlotSelected(me)??!1,isSelecting:I?.isSelecting??!1,disabled:X,className:"absolute inset-x-0",style:{top:`${xe*f}%`,height:`${f}%`},ariaLabel:`Add event on ${c.toLocaleDateString()} at ${y.formatHourLabel(E)}:${String(J).padStart(2,"0")}`},J)})]},E)}),D?.singleDay.map(E=>{const P=D.positions.get(E.id);if(!P)return null;const Z=`calc(${P.width}% - 2px)`,X=`max(${ke}px, ${Z})`;return v?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${P.top}px`,left:`${P.left}%`,width:X,minWidth:`${ke}px`},children:v({event:E,position:P})},E.id):e.jsx(He,{event:E,position:{top:P.top,left:P.left,width:P.width,minWidth:ke},hourHeight:de,badgeVariant:i,onClick:b,disablePopover:!!b&&!u,renderPopover:u,className:a.cn("pointer-events-auto",p?.eventCard)},E.id)}),x===O&&A>=0&&e.jsxs("div",{className:a.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",p?.currentTimeIndicator),style:{top:A},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"})]})]},c.toDateString())})})})]})]})})]})}exports.AgendaView=mn;exports.Badge=ht;exports.Button=le;exports.CalendarHeader=xn;exports.DateNavigator=pt;exports.DayEventsExpansion=gt;exports.DaySlot=jt;exports.DayView=gn;exports.Dialog=Ze;exports.DialogClose=It;exports.DialogContent=_e;exports.DialogDescription=st;exports.DialogHeader=tt;exports.DialogTitle=nt;exports.DialogTrigger=Qe;exports.DropdownMenu=ze;exports.DropdownMenuContent=De;exports.DropdownMenuItem=Ce;exports.DropdownMenuTrigger=Le;exports.EventBlock=He;exports.EventCard=ye;exports.MonthView=jn;exports.MultiDayBanner=yt;exports.MultiDayEventBar=qt;exports.Popover=ae;exports.PopoverAnchor=Ht;exports.PopoverContent=se;exports.PopoverTrigger=ie;exports.Sheet=rt;exports.SheetClose=Ot;exports.SheetContent=We;exports.SheetDescription=dt;exports.SheetHeader=it;exports.SheetTitle=lt;exports.SheetTrigger=ot;exports.TimeSlot=Oe;exports.TodayButton=ft;exports.Tooltip=te;exports.TooltipContent=ee;exports.TooltipProvider=Pt;exports.TooltipTrigger=ne;exports.WeekView=Cn;exports.buttonVariants=mt;exports.getEventColorClasses=re;
11
- //# sourceMappingURL=week-view-Dv-Uz0eT.cjs.map
11
+ //# sourceMappingURL=week-view-BXmaRChB.cjs.map