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