@innosolutions/inno-calendar 1.0.53 → 1.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/agenda-widget-B7ryNQOt.js +3922 -0
  2. package/dist/agenda-widget-B7ryNQOt.js.map +1 -0
  3. package/dist/agenda-widget-YH495m1F.cjs +2 -0
  4. package/dist/agenda-widget-YH495m1F.cjs.map +1 -0
  5. package/dist/components/index.cjs +1 -1
  6. package/dist/components/index.mjs +2 -2
  7. package/dist/components/inno-calendar.d.ts.map +1 -1
  8. package/dist/components/primitives/index.d.ts +1 -0
  9. package/dist/components/primitives/index.d.ts.map +1 -1
  10. package/dist/components/primitives/scroll-navigator.d.ts +32 -0
  11. package/dist/components/primitives/scroll-navigator.d.ts.map +1 -0
  12. package/dist/components/views/day-events-expansion.d.ts +2 -2
  13. package/dist/components/views/day-events-expansion.d.ts.map +1 -1
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.mjs +3 -3
  16. package/dist/presets/index.cjs +1 -1
  17. package/dist/presets/index.mjs +1 -1
  18. package/dist/styles/index.css +1 -1
  19. package/dist/{tailwind-calendar-Ufp5YM_i.cjs → tailwind-calendar-B2Wloz_o.cjs} +2 -2
  20. package/dist/{tailwind-calendar-Ufp5YM_i.cjs.map → tailwind-calendar-B2Wloz_o.cjs.map} +1 -1
  21. package/dist/{tailwind-calendar-Wvl6G_sK.js → tailwind-calendar-CjhEUHpL.js} +2 -2
  22. package/dist/{tailwind-calendar-Wvl6G_sK.js.map → tailwind-calendar-CjhEUHpL.js.map} +1 -1
  23. package/dist/{week-view-CCzE8DEb.js → week-view-D3PDybDq.js} +184 -187
  24. package/dist/week-view-D3PDybDq.js.map +1 -0
  25. package/dist/{week-view-1DnsOgRW.cjs → week-view-DfavofVM.cjs} +3 -3
  26. package/dist/week-view-DfavofVM.cjs.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/agenda-widget-CcvTi51_.cjs +0 -2
  29. package/dist/agenda-widget-CcvTi51_.cjs.map +0 -1
  30. package/dist/agenda-widget-DHq2DsjV.js +0 -3740
  31. package/dist/agenda-widget-DHq2DsjV.js.map +0 -1
  32. package/dist/week-view-1DnsOgRW.cjs.map +0 -1
  33. package/dist/week-view-CCzE8DEb.js.map +0 -1
@@ -0,0 +1,3922 @@
1
+ import { jsx as e, jsxs as r, Fragment as pe } from "react/jsx-runtime";
2
+ import { g as it, u as pt, C as xt } from "./use-calendar-Clo9DFK4.js";
3
+ import { useCallback as $, useState as oe, useEffect as ce, forwardRef as Ae, useRef as ae, useMemo as X, useLayoutEffect as vt, useImperativeHandle as wt } from "react";
4
+ import { c as m } from "./index-DtaLkIY8.js";
5
+ import { P as lt, p as ct, o as dt, z as ue, I as bt, J as yt, B as ye, K as kt, L as Ue, x as he, F as me, y as fe, k as Nt, C as Dt, M as Ve, A as Ct, W as Mt, c as St, N as Et } from "./week-view-D3PDybDq.js";
6
+ import { j as Lt, D as Tt, I as Ht, e as It, S as zt } from "./slot-selection-context-BwghpxKA.js";
7
+ import { isToday as ie, startOfDay as Pe, endOfDay as ut, getYearMonths as jt, generateMonthGrid as At, getEventsForDay as Pt, addDays as ht, formatDateISO as Wt } from "./utils.mjs";
8
+ function $t({ view: t, className: n = "" }) {
9
+ return /* @__PURE__ */ e(
10
+ "div",
11
+ {
12
+ className: n,
13
+ style: {
14
+ display: "flex",
15
+ alignItems: "center",
16
+ justifyContent: "center",
17
+ minHeight: "400px",
18
+ backgroundColor: "#f9fafb",
19
+ borderRadius: "0.5rem",
20
+ border: "1px dashed #d1d5db"
21
+ },
22
+ children: /* @__PURE__ */ r("div", { style: { textAlign: "center", color: "#6b7280" }, children: [
23
+ /* @__PURE__ */ r("p", { style: { fontSize: "1.125rem", fontWeight: 500 }, children: [
24
+ t.charAt(0).toUpperCase() + t.slice(1),
25
+ " View"
26
+ ] }),
27
+ /* @__PURE__ */ e("p", { style: { fontSize: "0.875rem" }, children: "Implementation pending" })
28
+ ] })
29
+ }
30
+ );
31
+ }
32
+ function Ye({ view: t, className: n }) {
33
+ return /* @__PURE__ */ e($t, { view: t, className: n });
34
+ }
35
+ function kr(t) {
36
+ const {
37
+ events: n,
38
+ resources: o,
39
+ scheduleTypes: s,
40
+ initialView: a = "week",
41
+ initialDate: i,
42
+ initialFilters: f,
43
+ preferences: h,
44
+ locale: d,
45
+ slots: w,
46
+ renderEvent: k,
47
+ onViewChange: b,
48
+ onDateChange: I,
49
+ onEventClick: F,
50
+ onSlotSelect: P,
51
+ onFiltersChange: W,
52
+ className: E,
53
+ children: y
54
+ } = t, A = it();
55
+ if (A)
56
+ return /* @__PURE__ */ e("div", { className: E, style: { position: "relative" }, children: y ?? /* @__PURE__ */ e(Ye, { view: A.view, className: E }) });
57
+ const O = pt({
58
+ events: n,
59
+ resources: o,
60
+ scheduleTypes: s,
61
+ initialView: a,
62
+ initialDate: i,
63
+ initialFilters: f,
64
+ preferences: h,
65
+ locale: d,
66
+ onViewChange: b,
67
+ onDateChange: I,
68
+ onEventClick: F,
69
+ onSlotSelect: P,
70
+ onFiltersChange: W
71
+ });
72
+ return /* @__PURE__ */ e(xt, { value: O, children: /* @__PURE__ */ e("div", { className: E, style: { position: "relative" }, children: y ?? /* @__PURE__ */ e(Ye, { view: O.view, className: E }) }) });
73
+ }
74
+ function Ft({ className: t }) {
75
+ return /* @__PURE__ */ r(
76
+ "svg",
77
+ {
78
+ xmlns: "http://www.w3.org/2000/svg",
79
+ viewBox: "0 0 24 24",
80
+ fill: "none",
81
+ stroke: "currentColor",
82
+ strokeWidth: "2",
83
+ strokeLinecap: "round",
84
+ strokeLinejoin: "round",
85
+ className: t,
86
+ children: [
87
+ /* @__PURE__ */ e("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" }),
88
+ /* @__PURE__ */ e("path", { d: "m15 5 4 4" })
89
+ ]
90
+ }
91
+ );
92
+ }
93
+ function mt({ className: t }) {
94
+ return /* @__PURE__ */ r(
95
+ "svg",
96
+ {
97
+ xmlns: "http://www.w3.org/2000/svg",
98
+ viewBox: "0 0 24 24",
99
+ fill: "none",
100
+ stroke: "currentColor",
101
+ strokeWidth: "2",
102
+ strokeLinecap: "round",
103
+ strokeLinejoin: "round",
104
+ className: t,
105
+ children: [
106
+ /* @__PURE__ */ e("path", { d: "M3 6h18" }),
107
+ /* @__PURE__ */ e("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
108
+ /* @__PURE__ */ e("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
109
+ /* @__PURE__ */ e("line", { x1: "10", x2: "10", y1: "11", y2: "17" }),
110
+ /* @__PURE__ */ e("line", { x1: "14", x2: "14", y1: "11", y2: "17" })
111
+ ]
112
+ }
113
+ );
114
+ }
115
+ function je({ className: t }) {
116
+ return /* @__PURE__ */ r(
117
+ "svg",
118
+ {
119
+ xmlns: "http://www.w3.org/2000/svg",
120
+ viewBox: "0 0 24 24",
121
+ fill: "none",
122
+ stroke: "currentColor",
123
+ strokeWidth: "2",
124
+ strokeLinecap: "round",
125
+ strokeLinejoin: "round",
126
+ className: t,
127
+ children: [
128
+ /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
129
+ /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
130
+ ]
131
+ }
132
+ );
133
+ }
134
+ function Ot({ className: t }) {
135
+ return /* @__PURE__ */ r(
136
+ "svg",
137
+ {
138
+ xmlns: "http://www.w3.org/2000/svg",
139
+ viewBox: "0 0 24 24",
140
+ fill: "none",
141
+ stroke: "currentColor",
142
+ strokeWidth: "2",
143
+ strokeLinecap: "round",
144
+ strokeLinejoin: "round",
145
+ className: t,
146
+ children: [
147
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
148
+ /* @__PURE__ */ e("path", { d: "m4.9 4.9 14.2 14.2" })
149
+ ]
150
+ }
151
+ );
152
+ }
153
+ function Te({ className: t }) {
154
+ return /* @__PURE__ */ e(
155
+ "svg",
156
+ {
157
+ xmlns: "http://www.w3.org/2000/svg",
158
+ viewBox: "0 0 24 24",
159
+ fill: "none",
160
+ stroke: "currentColor",
161
+ strokeWidth: "2",
162
+ strokeLinecap: "round",
163
+ strokeLinejoin: "round",
164
+ className: t,
165
+ children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
166
+ }
167
+ );
168
+ }
169
+ function _t({ className: t }) {
170
+ return /* @__PURE__ */ r(
171
+ "svg",
172
+ {
173
+ xmlns: "http://www.w3.org/2000/svg",
174
+ viewBox: "0 0 24 24",
175
+ fill: "none",
176
+ stroke: "currentColor",
177
+ strokeWidth: "2",
178
+ strokeLinecap: "round",
179
+ strokeLinejoin: "round",
180
+ className: t,
181
+ children: [
182
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
183
+ /* @__PURE__ */ e("path", { d: "m9 12 2 2 4-4" })
184
+ ]
185
+ }
186
+ );
187
+ }
188
+ function Bt({ className: t }) {
189
+ return /* @__PURE__ */ e(
190
+ "svg",
191
+ {
192
+ xmlns: "http://www.w3.org/2000/svg",
193
+ viewBox: "0 0 24 24",
194
+ fill: "none",
195
+ stroke: "currentColor",
196
+ strokeWidth: "2",
197
+ strokeLinecap: "round",
198
+ strokeLinejoin: "round",
199
+ className: t,
200
+ children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
201
+ }
202
+ );
203
+ }
204
+ function Rt({ className: t }) {
205
+ return /* @__PURE__ */ r(
206
+ "svg",
207
+ {
208
+ xmlns: "http://www.w3.org/2000/svg",
209
+ viewBox: "0 0 24 24",
210
+ fill: "none",
211
+ stroke: "currentColor",
212
+ strokeWidth: "2",
213
+ strokeLinecap: "round",
214
+ strokeLinejoin: "round",
215
+ className: t,
216
+ children: [
217
+ /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
218
+ /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
219
+ /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
220
+ /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
221
+ ]
222
+ }
223
+ );
224
+ }
225
+ function Ut({ className: t }) {
226
+ return /* @__PURE__ */ r(
227
+ "svg",
228
+ {
229
+ xmlns: "http://www.w3.org/2000/svg",
230
+ viewBox: "0 0 24 24",
231
+ fill: "none",
232
+ stroke: "currentColor",
233
+ strokeWidth: "2",
234
+ strokeLinecap: "round",
235
+ strokeLinejoin: "round",
236
+ className: t,
237
+ children: [
238
+ /* @__PURE__ */ e("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" }),
239
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "10", r: "3" })
240
+ ]
241
+ }
242
+ );
243
+ }
244
+ function Vt({ className: t }) {
245
+ return /* @__PURE__ */ r(
246
+ "svg",
247
+ {
248
+ xmlns: "http://www.w3.org/2000/svg",
249
+ viewBox: "0 0 24 24",
250
+ fill: "none",
251
+ stroke: "currentColor",
252
+ strokeWidth: "2",
253
+ strokeLinecap: "round",
254
+ strokeLinejoin: "round",
255
+ className: t,
256
+ children: [
257
+ /* @__PURE__ */ e("path", { d: "M8 2v4" }),
258
+ /* @__PURE__ */ e("path", { d: "M16 2v4" }),
259
+ /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
260
+ /* @__PURE__ */ e("path", { d: "M3 10h18" })
261
+ ]
262
+ }
263
+ );
264
+ }
265
+ function Yt({ className: t }) {
266
+ return /* @__PURE__ */ r(
267
+ "svg",
268
+ {
269
+ xmlns: "http://www.w3.org/2000/svg",
270
+ viewBox: "0 0 24 24",
271
+ fill: "none",
272
+ stroke: "currentColor",
273
+ strokeWidth: "2",
274
+ strokeLinecap: "round",
275
+ strokeLinejoin: "round",
276
+ className: t,
277
+ children: [
278
+ /* @__PURE__ */ e("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
279
+ /* @__PURE__ */ e("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
280
+ /* @__PURE__ */ e("path", { d: "M10 9H8" }),
281
+ /* @__PURE__ */ e("path", { d: "M16 13H8" }),
282
+ /* @__PURE__ */ e("path", { d: "M16 17H8" })
283
+ ]
284
+ }
285
+ );
286
+ }
287
+ function De({ className: t }) {
288
+ return /* @__PURE__ */ e(
289
+ "svg",
290
+ {
291
+ xmlns: "http://www.w3.org/2000/svg",
292
+ viewBox: "0 0 24 24",
293
+ fill: "none",
294
+ stroke: "currentColor",
295
+ strokeWidth: "2",
296
+ strokeLinecap: "round",
297
+ strokeLinejoin: "round",
298
+ className: m("animate-spin", t),
299
+ children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
300
+ }
301
+ );
302
+ }
303
+ const Kt = {
304
+ edit: "Edit",
305
+ delete: "Delete",
306
+ cancel: "Cancel Event",
307
+ close: "Close",
308
+ going: "Going",
309
+ notGoing: "Not Going",
310
+ confirmMeeting: "Confirm meeting took place",
311
+ completed: "Completed",
312
+ canceled: "Canceled",
313
+ participants: "Participants",
314
+ guest: "guest",
315
+ guests: "guests",
316
+ confirmed: "confirmed",
317
+ organizer: "Organizer",
318
+ client: "Client",
319
+ more: "more",
320
+ noDateProvided: "No date provided",
321
+ eventNotFound: "Event not found",
322
+ cancellationNote: "Cancellation Note",
323
+ canceledOn: "Canceled on",
324
+ acceptThisEvent: "Accept this event only",
325
+ acceptAllEvents: "Accept all events",
326
+ deleteConfirmTitle: "Delete Event",
327
+ deleteConfirmDescription: "Are you sure you want to delete this event? This action cannot be undone."
328
+ }, He = Ae(
329
+ ({ onClick: t, label: n, children: o, className: s, variant: a = "ghost", ...i }, f) => /* @__PURE__ */ r(he, { children: [
330
+ /* @__PURE__ */ e(me, { asChild: !0, children: /* @__PURE__ */ e(
331
+ "button",
332
+ {
333
+ type: "button",
334
+ ref: f,
335
+ onClick: t,
336
+ className: m(
337
+ "h-8 w-8 rounded-full flex items-center justify-center transition-colors",
338
+ a === "ghost" && "hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",
339
+ a === "destructive" && "hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",
340
+ s
341
+ ),
342
+ "aria-label": n,
343
+ ...i,
344
+ children: o
345
+ }
346
+ ) }),
347
+ /* @__PURE__ */ e(fe, { side: "bottom", className: "text-xs", children: n })
348
+ ] })
349
+ );
350
+ He.displayName = "IconButton";
351
+ function Gt({ src: t, alt: n, initials: o, className: s, isClient: a }) {
352
+ const [i, f] = oe(!1);
353
+ return /* @__PURE__ */ e(
354
+ "div",
355
+ {
356
+ className: m(
357
+ "relative h-7 w-7 rounded-full overflow-hidden shrink-0",
358
+ s
359
+ ),
360
+ children: t && !i ? /* @__PURE__ */ e(
361
+ "img",
362
+ {
363
+ src: t,
364
+ alt: n,
365
+ className: "h-full w-full object-cover",
366
+ onError: () => f(!0)
367
+ }
368
+ ) : /* @__PURE__ */ e(
369
+ "div",
370
+ {
371
+ className: m(
372
+ "h-full w-full flex items-center justify-center text-[10px] font-medium",
373
+ 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"
374
+ ),
375
+ children: o
376
+ }
377
+ )
378
+ }
379
+ );
380
+ }
381
+ function Ke({
382
+ participant: t,
383
+ isEventCanceled: n = !1,
384
+ labels: o
385
+ }) {
386
+ const s = t.name || "Unknown", a = s.split(" ").map((I) => I[0]).join("").toUpperCase().slice(0, 2), i = t.isOrganizer ?? !1, f = t.isConfirmed, h = f === !0, d = f === !1, w = t.isClient ?? !1, k = t.profilePicture || t.avatar, b = n;
387
+ return /* @__PURE__ */ r(
388
+ "div",
389
+ {
390
+ className: m(
391
+ "flex items-center gap-3 py-0",
392
+ b && "opacity-60"
393
+ ),
394
+ children: [
395
+ /* @__PURE__ */ r("div", { className: "relative", children: [
396
+ /* @__PURE__ */ e(
397
+ Gt,
398
+ {
399
+ src: k,
400
+ alt: s,
401
+ initials: a,
402
+ isClient: w,
403
+ className: m(b && "grayscale")
404
+ }
405
+ ),
406
+ b || d ? /* @__PURE__ */ e("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: /* @__PURE__ */ e("div", { className: "h-3 w-3 rounded-full bg-red-100 dark:bg-red-900/50 flex items-center justify-center", children: /* @__PURE__ */ e(je, { className: "h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]" }) }) }) : h ? /* @__PURE__ */ e("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: /* @__PURE__ */ e("div", { className: "h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center", children: /* @__PURE__ */ e(Te, { className: "h-2 w-2 text-green-600 dark:text-green-400 stroke-[3]" }) }) }) : null
407
+ ] }),
408
+ /* @__PURE__ */ r("div", { className: "!h-fit min-w-0 gap-0", children: [
409
+ /* @__PURE__ */ e("div", { className: "gap-0", children: /* @__PURE__ */ e(
410
+ "span",
411
+ {
412
+ className: m(
413
+ "text-sm text-zinc-900 dark:text-zinc-100 truncate",
414
+ b && "line-through text-zinc-500 dark:text-zinc-500"
415
+ ),
416
+ children: s
417
+ }
418
+ ) }),
419
+ w && /* @__PURE__ */ e("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: o.client }),
420
+ i && !b && /* @__PURE__ */ e("div", { className: "text-xs text-zinc-500", children: o.organizer })
421
+ ] })
422
+ ]
423
+ }
424
+ );
425
+ }
426
+ function Jt({
427
+ open: t,
428
+ onOpenChange: n,
429
+ title: o,
430
+ children: s
431
+ }) {
432
+ return ce(() => {
433
+ if (!t) return;
434
+ const a = (i) => {
435
+ i.key === "Escape" && n(!1);
436
+ };
437
+ return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
438
+ }, [t, n]), ce(() => (t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
439
+ document.body.style.overflow = "";
440
+ }), [t]), t ? /* @__PURE__ */ r("div", { className: "fixed inset-0 z-50", children: [
441
+ /* @__PURE__ */ e(
442
+ "div",
443
+ {
444
+ className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
445
+ onClick: () => n(!1),
446
+ onKeyDown: (a) => {
447
+ (a.key === "Enter" || a.key === " ") && n(!1);
448
+ }
449
+ }
450
+ ),
451
+ /* @__PURE__ */ e("div", { className: "fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto", children: /* @__PURE__ */ r("div", { className: "bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden", children: [
452
+ o && /* @__PURE__ */ e("div", { className: "sr-only", children: o }),
453
+ s
454
+ ] }) })
455
+ ] }) : null;
456
+ }
457
+ function qt({
458
+ open: t,
459
+ onOpenChange: n,
460
+ title: o,
461
+ description: s,
462
+ cancelLabel: a,
463
+ confirmLabel: i,
464
+ onConfirm: f,
465
+ isLoading: h
466
+ }) {
467
+ return t ? /* @__PURE__ */ r("div", { className: "fixed inset-0 z-[60]", children: [
468
+ /* @__PURE__ */ e(
469
+ "div",
470
+ {
471
+ className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
472
+ onClick: () => n(!1),
473
+ onKeyDown: (d) => {
474
+ (d.key === "Enter" || d.key === " ") && n(!1);
475
+ }
476
+ }
477
+ ),
478
+ /* @__PURE__ */ e("div", { className: "fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto", children: /* @__PURE__ */ r("div", { className: "bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6", children: [
479
+ /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: o }),
480
+ /* @__PURE__ */ e("p", { className: "mt-2 text-sm text-zinc-600 dark:text-zinc-400", children: s }),
481
+ /* @__PURE__ */ r("div", { className: "mt-4 flex justify-end gap-3", children: [
482
+ /* @__PURE__ */ e(
483
+ ye,
484
+ {
485
+ variant: "outline",
486
+ size: "sm",
487
+ onClick: () => n(!1),
488
+ children: a
489
+ }
490
+ ),
491
+ /* @__PURE__ */ r(
492
+ ye,
493
+ {
494
+ variant: "destructive",
495
+ size: "sm",
496
+ onClick: f,
497
+ disabled: h,
498
+ children: [
499
+ h && /* @__PURE__ */ e(De, { className: "h-4 w-4 mr-2" }),
500
+ /* @__PURE__ */ e(mt, { className: "h-4 w-4 mr-2" }),
501
+ i
502
+ ]
503
+ }
504
+ )
505
+ ] })
506
+ ] }) })
507
+ ] }) : null;
508
+ }
509
+ function Xt(t, n) {
510
+ return t.toLocaleDateString(void 0, {
511
+ weekday: "long",
512
+ month: "long",
513
+ day: "numeric"
514
+ });
515
+ }
516
+ function Qt(t, n) {
517
+ const o = {
518
+ hour: "2-digit",
519
+ minute: "2-digit",
520
+ hour12: !1
521
+ };
522
+ return `${t.toLocaleTimeString(void 0, o)} – ${n.toLocaleTimeString(void 0, o)}`;
523
+ }
524
+ function Zt(t) {
525
+ return t.toLocaleDateString(void 0, {
526
+ day: "2-digit",
527
+ month: "short",
528
+ year: "numeric",
529
+ hour: "2-digit",
530
+ minute: "2-digit"
531
+ });
532
+ }
533
+ function en(t) {
534
+ const [n, o] = oe(() => typeof window < "u" ? window.matchMedia(t).matches : !1);
535
+ return ce(() => {
536
+ if (typeof window > "u") return;
537
+ const s = window.matchMedia(t), a = (i) => o(i.matches);
538
+ return s.addEventListener("change", a), () => s.removeEventListener("change", a);
539
+ }, [t]), n;
540
+ }
541
+ function Ge({
542
+ event: t,
543
+ labels: n,
544
+ isLoading: o,
545
+ onClose: s,
546
+ onEdit: a,
547
+ onDelete: i,
548
+ onCancel: f,
549
+ onAccept: h,
550
+ onDecline: d,
551
+ onConfirmMeeting: w,
552
+ canEdit: k = !0,
553
+ canDelete: b = !1,
554
+ canCancel: I = !0,
555
+ isCurrentUserParticipant: F = !1,
556
+ isCurrentUserClient: P = !1,
557
+ currentUserAcceptStatus: W,
558
+ isAcceptLoading: E = !1,
559
+ isDeclineLoading: y = !1,
560
+ isConfirmLoading: A = !1,
561
+ isDeleteLoading: O = !1,
562
+ renderParticipant: R,
563
+ renderHeaderActions: C,
564
+ renderCancelReason: _,
565
+ renderDeleteConfirmation: z,
566
+ formatDate: j = Xt,
567
+ formatTimeRange: V = Qt
568
+ }) {
569
+ const [K, Y] = oe(!1), x = !(t.isCanceled || t.meetingTookPlace), c = t.isRecurring ?? !1, g = t.participantDetails, L = t.participantsNames || [], B = g && g.length > 0, S = W === !0, re = W === !1, G = F && !P && x, Ce = B ? g.filter((M) => M.isConfirmed).length : t.isAccepted ? L.length : 0, ee = B ? g.length : L.length, Q = t.scheduleTypeColor || t.hexColor || "#039BE5", ke = $(() => t.startDate ? j(t.startDate) : n.noDateProvided, [t.startDate, j, n.noDateProvided]), se = $(() => t.startDate && t.endDate ? V(t.startDate, t.endDate) : null, [t.startDate, t.endDate, V]), le = () => {
570
+ s(), a?.(t);
571
+ }, Me = () => {
572
+ s(), f?.(t);
573
+ }, xe = () => {
574
+ Y(!0);
575
+ }, p = () => {
576
+ i?.(t), Y(!1);
577
+ };
578
+ return o ? /* @__PURE__ */ e("div", { className: "flex h-48 items-center justify-center", children: /* @__PURE__ */ e(De, { className: "h-6 w-6 text-zinc-400" }) }) : /* @__PURE__ */ r(ue, { delayDuration: 300, children: [
579
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5 p-3", children: [
580
+ /* @__PURE__ */ e("div", { className: "flex items-start justify-end gap-0.5", children: C ? C({ onClose: s }) : /* @__PURE__ */ r(pe, { children: [
581
+ x && k && a && /* @__PURE__ */ e(He, { onClick: le, label: n.edit, children: /* @__PURE__ */ e(Ft, { className: "h-[18px] w-[18px]" }) }),
582
+ x && I && f && /* @__PURE__ */ e(He, { onClick: Me, label: n.cancel, children: /* @__PURE__ */ e(Ot, { className: "h-[18px] w-[18px]" }) }),
583
+ b && i && /* @__PURE__ */ e(
584
+ He,
585
+ {
586
+ onClick: xe,
587
+ label: n.delete,
588
+ variant: "destructive",
589
+ children: /* @__PURE__ */ e(mt, { className: "h-[18px] w-[18px]" })
590
+ }
591
+ ),
592
+ /* @__PURE__ */ e(He, { onClick: s, label: n.close, children: /* @__PURE__ */ e(je, { className: "h-[18px] w-[18px]" }) })
593
+ ] }) }),
594
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
595
+ /* @__PURE__ */ e(
596
+ "div",
597
+ {
598
+ className: "w-4 h-4 rounded mt-1 shrink-0",
599
+ style: { backgroundColor: Q }
600
+ }
601
+ ),
602
+ /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
603
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 flex-wrap", children: [
604
+ /* @__PURE__ */ e(
605
+ "h2",
606
+ {
607
+ className: m(
608
+ "text-[22px] font-normal text-zinc-900 dark:text-zinc-100 leading-tight",
609
+ t.isCanceled && "line-through opacity-60"
610
+ ),
611
+ children: t.title
612
+ }
613
+ ),
614
+ t.meetingTookPlace && /* @__PURE__ */ r("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: [
615
+ /* @__PURE__ */ e(_t, { className: "h-3 w-3" }),
616
+ n.completed
617
+ ] }),
618
+ t.isCanceled && /* @__PURE__ */ r("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: [
619
+ /* @__PURE__ */ e(je, { className: "h-3 w-3" }),
620
+ n.canceled
621
+ ] })
622
+ ] }),
623
+ /* @__PURE__ */ r("div", { className: "mt-1 text-sm text-zinc-600 dark:text-zinc-400", children: [
624
+ /* @__PURE__ */ e("span", { children: ke() }),
625
+ se() && /* @__PURE__ */ r(pe, { children: [
626
+ /* @__PURE__ */ e("span", { className: "mx-1.5", children: "·" }),
627
+ /* @__PURE__ */ e("span", { children: se() })
628
+ ] })
629
+ ] }),
630
+ c && t.recurrenceSummary && /* @__PURE__ */ e("div", { className: "text-sm text-zinc-500 dark:text-zinc-500", children: t.recurrenceSummary })
631
+ ] })
632
+ ] }) }),
633
+ t.isCanceled && /* @__PURE__ */ e("div", { className: "mx-4 p-3 rounded-lg bg-red-50 dark:bg-red-950/30", children: _ ? _(t) : /* @__PURE__ */ e("div", { className: "flex items-start gap-0", children: /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
634
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-red-700 dark:text-red-400", children: n.cancellationNote }),
635
+ t.cancelReason && /* @__PURE__ */ r("div", { className: "mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic", children: [
636
+ '"',
637
+ t.cancelReason,
638
+ '"'
639
+ ] }),
640
+ t.canceledDate && /* @__PURE__ */ r("div", { className: "mt-1.5 text-xs text-red-500/70 dark:text-red-400/60", children: [
641
+ n.canceledOn,
642
+ " ",
643
+ Zt(t.canceledDate)
644
+ ] })
645
+ ] }) }) }),
646
+ /* @__PURE__ */ r("div", { className: "space-y-0.5", children: [
647
+ t.address && /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
648
+ /* @__PURE__ */ e(Ut, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
649
+ /* @__PURE__ */ e("span", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: t.address })
650
+ ] }),
651
+ (B || L.length > 0) && /* @__PURE__ */ r("div", { className: "flex items-start gap-2 py-0", children: [
652
+ /* @__PURE__ */ e(Rt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
653
+ /* @__PURE__ */ r("div", { className: "flex-1", children: [
654
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-0", children: [
655
+ /* @__PURE__ */ r("span", { className: "text-sm text-zinc-900 dark:text-zinc-100 font-medium", children: [
656
+ ee,
657
+ " ",
658
+ ee !== 1 ? n.guests : n.guest
659
+ ] }),
660
+ ee > 0 && /* @__PURE__ */ r("span", { className: "text-xs text-zinc-500", children: [
661
+ "(",
662
+ Ce,
663
+ " ",
664
+ n.confirmed,
665
+ ")"
666
+ ] })
667
+ ] }),
668
+ /* @__PURE__ */ r("div", { className: "mt-2 space-y-2", children: [
669
+ B ? g.slice(0, 6).map(
670
+ (M, U) => R ? R(M, U) : /* @__PURE__ */ e(
671
+ Ke,
672
+ {
673
+ participant: M,
674
+ isEventCanceled: t.isCanceled,
675
+ labels: n
676
+ },
677
+ M.id
678
+ )
679
+ ) : L.slice(0, 6).map((M, U) => {
680
+ const te = {
681
+ id: String(U),
682
+ name: M,
683
+ email: "",
684
+ isConfirmed: t.isAccepted,
685
+ isOrganizer: U === 0,
686
+ isClient: !1
687
+ };
688
+ return R ? R(te, U) : /* @__PURE__ */ e(
689
+ Ke,
690
+ {
691
+ participant: te,
692
+ isEventCanceled: t.isCanceled,
693
+ labels: n
694
+ },
695
+ M
696
+ );
697
+ }),
698
+ ee > 6 && /* @__PURE__ */ r("div", { className: "text-xs text-zinc-500 py-1.5 pl-10", children: [
699
+ "+",
700
+ ee - 6,
701
+ " ",
702
+ n.more
703
+ ] })
704
+ ] })
705
+ ] })
706
+ ] }),
707
+ t.description && /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
708
+ /* @__PURE__ */ e(Yt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
709
+ /* @__PURE__ */ e("p", { className: "text-sm text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap", children: t.description })
710
+ ] }),
711
+ /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
712
+ /* @__PURE__ */ e(Vt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
713
+ /* @__PURE__ */ e("div", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: B && g.find((M) => M.isOrganizer)?.name || L[0] || "Calendar" })
714
+ ] })
715
+ ] }),
716
+ G && h && d && /* @__PURE__ */ e("div", { className: "border-t border-zinc-100 dark:border-zinc-800 mt-3 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
717
+ c ? /* @__PURE__ */ r(bt, { children: [
718
+ /* @__PURE__ */ e(yt, { asChild: !0, children: /* @__PURE__ */ r("div", { className: "flex", children: [
719
+ /* @__PURE__ */ e(
720
+ ye,
721
+ {
722
+ size: "sm",
723
+ variant: "outline",
724
+ className: m(
725
+ "rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
726
+ S && "!bg-green-700 !text-white hover:!bg-green-700"
727
+ ),
728
+ onClick: (M) => {
729
+ M.stopPropagation(), S || h(t);
730
+ },
731
+ disabled: E,
732
+ children: E ? /* @__PURE__ */ e(De, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(pe, { children: [
733
+ S && /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5" }),
734
+ n.going
735
+ ] })
736
+ }
737
+ ),
738
+ /* @__PURE__ */ e(
739
+ ye,
740
+ {
741
+ size: "sm",
742
+ variant: "outline",
743
+ className: m(
744
+ "rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
745
+ S && "!bg-green-700 !text-white hover:!bg-green-700"
746
+ ),
747
+ children: /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5" })
748
+ }
749
+ )
750
+ ] }) }),
751
+ /* @__PURE__ */ r(kt, { align: "start", children: [
752
+ /* @__PURE__ */ r(
753
+ Ue,
754
+ {
755
+ className: m(
756
+ "gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",
757
+ S && "!bg-green-700 !text-white hover:!bg-green-700"
758
+ ),
759
+ onClick: () => h(t),
760
+ children: [
761
+ /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5 mr-2 text-green-600" }),
762
+ n.acceptThisEvent
763
+ ]
764
+ }
765
+ ),
766
+ /* @__PURE__ */ r(Ue, { onClick: () => h(t), children: [
767
+ /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5 mr-2 text-green-600" }),
768
+ n.acceptAllEvents
769
+ ] })
770
+ ] })
771
+ ] }) : /* @__PURE__ */ e(
772
+ ye,
773
+ {
774
+ size: "sm",
775
+ variant: "outline",
776
+ className: m(
777
+ "gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
778
+ S && "!bg-green-700 !text-white hover:!bg-green-700"
779
+ ),
780
+ onClick: () => {
781
+ S || h(t);
782
+ },
783
+ disabled: E,
784
+ children: E ? /* @__PURE__ */ e(De, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(pe, { children: [
785
+ S && /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5" }),
786
+ n.going
787
+ ] })
788
+ }
789
+ ),
790
+ /* @__PURE__ */ e(
791
+ ye,
792
+ {
793
+ size: "sm",
794
+ variant: "outline",
795
+ className: m(
796
+ "gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",
797
+ re && "!bg-rose-700 !text-white hover:!bg-rose-700"
798
+ ),
799
+ onClick: () => {
800
+ re || d(t);
801
+ },
802
+ disabled: y,
803
+ children: y ? /* @__PURE__ */ e(De, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(pe, { children: [
804
+ re && /* @__PURE__ */ e(je, { className: "h-3.5 w-3.5" }),
805
+ n.notGoing
806
+ ] })
807
+ }
808
+ )
809
+ ] }) }),
810
+ F && S && !t.meetingTookPlace && !t.isCanceled && w && /* @__PURE__ */ e("div", { className: "border-t border-zinc-100 dark:border-zinc-800 py-3", children: /* @__PURE__ */ r(
811
+ ye,
812
+ {
813
+ size: "sm",
814
+ variant: "outline",
815
+ 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",
816
+ onClick: () => w(t),
817
+ disabled: A,
818
+ children: [
819
+ A && /* @__PURE__ */ e(De, { className: "h-4 w-4 mr-2" }),
820
+ n.confirmMeeting
821
+ ]
822
+ }
823
+ ) })
824
+ ] }),
825
+ z ? K && z({
826
+ onConfirm: p,
827
+ onCancel: () => Y(!1),
828
+ isLoading: O
829
+ }) : /* @__PURE__ */ e(
830
+ qt,
831
+ {
832
+ open: K,
833
+ onOpenChange: Y,
834
+ title: n.deleteConfirmTitle,
835
+ description: n.deleteConfirmDescription,
836
+ cancelLabel: n.cancel,
837
+ confirmLabel: n.delete,
838
+ onConfirm: p,
839
+ isLoading: O
840
+ }
841
+ )
842
+ ] });
843
+ }
844
+ function Nr({
845
+ event: t,
846
+ children: n,
847
+ open: o,
848
+ onOpenChange: s,
849
+ isLoading: a,
850
+ labels: i,
851
+ onEdit: f,
852
+ onDelete: h,
853
+ onCancel: d,
854
+ onAccept: w,
855
+ onDecline: k,
856
+ onConfirmMeeting: b,
857
+ canEdit: I = !0,
858
+ canDelete: F = !1,
859
+ canCancel: P = !0,
860
+ isCurrentUserParticipant: W,
861
+ isCurrentUserClient: E,
862
+ currentUserAcceptStatus: y,
863
+ isAcceptLoading: A,
864
+ isDeclineLoading: O,
865
+ isConfirmLoading: R,
866
+ isDeleteLoading: C,
867
+ renderParticipant: _,
868
+ renderHeaderActions: z,
869
+ renderCancelReason: j,
870
+ renderDeleteConfirmation: V,
871
+ formatDate: K,
872
+ formatTimeRange: Y,
873
+ className: x,
874
+ width: c = 360
875
+ }) {
876
+ const g = en("(min-width: 768px)"), L = { ...Kt, ...i }, B = $(() => {
877
+ s?.(!1);
878
+ }, [s]), S = {
879
+ event: t,
880
+ labels: L,
881
+ isLoading: a,
882
+ onClose: B,
883
+ onEdit: f,
884
+ onDelete: h,
885
+ onCancel: d,
886
+ onAccept: w,
887
+ onDecline: k,
888
+ onConfirmMeeting: b,
889
+ canEdit: I,
890
+ canDelete: F,
891
+ canCancel: P,
892
+ isCurrentUserParticipant: W,
893
+ isCurrentUserClient: E,
894
+ currentUserAcceptStatus: y,
895
+ isAcceptLoading: A,
896
+ isDeclineLoading: O,
897
+ isConfirmLoading: R,
898
+ isDeleteLoading: C,
899
+ renderParticipant: _,
900
+ renderHeaderActions: z,
901
+ renderCancelReason: j,
902
+ renderDeleteConfirmation: V,
903
+ formatDate: K,
904
+ formatTimeRange: Y
905
+ };
906
+ return g ? /* @__PURE__ */ r(lt, { open: o ?? !1, onOpenChange: s ?? (() => {
907
+ }), children: [
908
+ /* @__PURE__ */ e(ct, { asChild: !0, children: n }),
909
+ /* @__PURE__ */ e(
910
+ dt,
911
+ {
912
+ className: m(
913
+ "p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",
914
+ x
915
+ ),
916
+ style: { width: c },
917
+ align: "center",
918
+ side: "bottom",
919
+ sideOffset: 4,
920
+ children: /* @__PURE__ */ e(Ge, { ...S })
921
+ }
922
+ )
923
+ ] }) : /* @__PURE__ */ r(pe, { children: [
924
+ n,
925
+ /* @__PURE__ */ e(
926
+ Jt,
927
+ {
928
+ open: o ?? !1,
929
+ onOpenChange: s ?? (() => {
930
+ }),
931
+ title: t.title,
932
+ children: /* @__PURE__ */ e(Ge, { ...S })
933
+ }
934
+ )
935
+ ] });
936
+ }
937
+ const We = 44, Je = 4, tn = 56, qe = 8, Ie = 80, Ee = 140, Xe = 100, Qe = 2, nn = 8, rn = 18;
938
+ function on(t) {
939
+ return t.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
940
+ }
941
+ function sn(t, n) {
942
+ const o = [];
943
+ for (let s = 0; s < n; s++) {
944
+ const a = new Date(t);
945
+ a.setDate(a.getDate() + s), o.push(a);
946
+ }
947
+ return o;
948
+ }
949
+ function an(t, n, o) {
950
+ const s = [];
951
+ return t.forEach((a, i) => {
952
+ for (let f = n; f < o; f++)
953
+ s.push({ hour: f, dayIndex: i, date: a });
954
+ }), s;
955
+ }
956
+ function $e(t) {
957
+ return `${t.toString().padStart(2, "0")}:00`;
958
+ }
959
+ function ln(t) {
960
+ return t.toLocaleDateString("en-US", {
961
+ weekday: "short",
962
+ month: "short",
963
+ day: "numeric"
964
+ });
965
+ }
966
+ function Ze(t) {
967
+ const n = [...t].sort((a, i) => a.startCol !== i.startCol ? a.startCol - i.startCol : i.spanCols - a.spanCols), o = [], s = [];
968
+ for (const a of n) {
969
+ let i = 0;
970
+ for (; s[i] !== void 0 && s[i] > a.startCol; )
971
+ i++;
972
+ s[i] = a.startCol + a.spanCols, o.push({
973
+ ...a,
974
+ stackIndex: i
975
+ });
976
+ }
977
+ return o;
978
+ }
979
+ function cn({ src: t, alt: n, fallback: o, className: s }) {
980
+ return /* @__PURE__ */ e(
981
+ "div",
982
+ {
983
+ className: m(
984
+ "relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",
985
+ s
986
+ ),
987
+ children: t ? /* @__PURE__ */ e(
988
+ "img",
989
+ {
990
+ src: t,
991
+ alt: n,
992
+ className: "aspect-square h-full w-full object-cover"
993
+ }
994
+ ) : /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground", children: o })
995
+ }
996
+ );
997
+ }
998
+ const dn = 7;
999
+ function Le({
1000
+ daysToShow: t = dn,
1001
+ events: n,
1002
+ users: o = [],
1003
+ selectedDate: s,
1004
+ onDateChange: a,
1005
+ onEventClick: i,
1006
+ onSlotClick: f,
1007
+ onSlotSelect: h,
1008
+ visibleHours: d,
1009
+ className: w,
1010
+ getEventUserId: k,
1011
+ renderPopover: b,
1012
+ slots: I,
1013
+ classNames: F,
1014
+ enableDrag: P = !0
1015
+ }) {
1016
+ const W = ae(null), E = Lt(), [y, A] = oe(null), O = ae(!1), [R, C] = oe(null), _ = s ?? /* @__PURE__ */ new Date(), z = !0, j = d?.from ?? nn, V = d?.to ?? rn, K = V - j, Y = X(() => {
1017
+ const l = new Date(_);
1018
+ if (t === 1 || t === 3)
1019
+ return l.setHours(0, 0, 0, 0), l;
1020
+ const u = l.getDay(), v = u === 0 ? -6 : 1 - u;
1021
+ return l.setDate(l.getDate() + v), l.setHours(0, 0, 0, 0), l;
1022
+ }, [_, t]), x = X(
1023
+ () => sn(Y, t),
1024
+ [Y, t]
1025
+ ), c = X(
1026
+ () => an(x, j, V),
1027
+ [z, x, j, V]
1028
+ ), L = k ?? ((l) => {
1029
+ if (l.resourceId) return l.resourceId;
1030
+ const u = l.data;
1031
+ if (u?.userId) return String(u.userId);
1032
+ if (u?.user && typeof u.user == "object" && u.user.id)
1033
+ return String(u.user.id);
1034
+ if (l.user?.id) return l.user.id;
1035
+ if (l.participants?.[0]?.id) return l.participants[0].id;
1036
+ }), B = X(() => {
1037
+ const l = /* @__PURE__ */ new Map();
1038
+ for (const u of o)
1039
+ l.set(u.id, {
1040
+ id: u.id,
1041
+ name: u.name,
1042
+ avatar: u.avatar ?? void 0,
1043
+ email: u.email
1044
+ });
1045
+ for (const u of n) {
1046
+ const N = u.data?.user;
1047
+ N?.id && !l.has(N.id) && l.set(N.id, {
1048
+ id: N.id,
1049
+ name: N.name ?? "",
1050
+ avatar: N.avatar ?? void 0,
1051
+ email: N.email
1052
+ }), u.user?.id && !l.has(u.user.id) && l.set(u.user.id, {
1053
+ id: u.user.id,
1054
+ name: u.user.name,
1055
+ avatar: u.user.avatar ?? void 0,
1056
+ email: u.user.email
1057
+ });
1058
+ for (const D of u.participants || [])
1059
+ D.id && !l.has(D.id) && l.set(D.id, {
1060
+ id: D.id,
1061
+ name: D.name,
1062
+ avatar: D.avatar ?? void 0,
1063
+ email: D.email
1064
+ });
1065
+ }
1066
+ return Array.from(l.values());
1067
+ }, [o, n]), S = X(() => {
1068
+ const l = [], u = /* @__PURE__ */ new Map();
1069
+ for (const D of B)
1070
+ u.set(D.id, []);
1071
+ u.set("unassigned", []);
1072
+ for (const D of n) {
1073
+ const T = L(D) ?? "unassigned";
1074
+ (u.get(T) ?? u.get("unassigned")).push(D);
1075
+ }
1076
+ const v = (D) => {
1077
+ const T = [];
1078
+ for (const H of D) {
1079
+ const J = H.startDate.getHours() + H.startDate.getMinutes() / 60, Z = H.endDate.getHours() + H.endDate.getMinutes() / 60;
1080
+ for (let q = 0; q < x.length; q++) {
1081
+ const ne = x[q], ve = Pe(ne), we = ut(ne);
1082
+ if (H.startDate <= we && H.endDate >= ve) {
1083
+ let be = j, Se = V;
1084
+ if (H.startDate >= ve && (be = Math.max(j, J)), H.endDate <= we && (Se = Math.min(V, Z)), be = Math.max(
1085
+ j,
1086
+ Math.min(V, be)
1087
+ ), Se = Math.max(
1088
+ j,
1089
+ Math.min(V, Se)
1090
+ ), Se > be) {
1091
+ const Re = q * K + Math.floor(be - j), gt = q * K + Math.ceil(Se - j);
1092
+ T.push({
1093
+ event: H,
1094
+ startCol: Re,
1095
+ spanCols: Math.max(1, gt - Re)
1096
+ });
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1101
+ return T;
1102
+ };
1103
+ for (const D of B) {
1104
+ const T = u.get(D.id) ?? [], H = v(T), J = Ze(H), Z = J.reduce(
1105
+ (q, ne) => Math.max(q, ne.stackIndex + 1),
1106
+ 0
1107
+ );
1108
+ l.push({
1109
+ user: D,
1110
+ events: J,
1111
+ maxStack: Math.max(Z, 1)
1112
+ });
1113
+ }
1114
+ const N = u.get("unassigned") ?? [];
1115
+ if (N.length > 0) {
1116
+ const D = v(N), T = Ze(D), H = T.reduce(
1117
+ (J, Z) => Math.max(J, Z.stackIndex + 1),
1118
+ 0
1119
+ );
1120
+ l.push({
1121
+ user: {
1122
+ id: "unassigned",
1123
+ name: "Unassigned",
1124
+ avatar: void 0,
1125
+ email: void 0
1126
+ },
1127
+ events: T,
1128
+ maxStack: Math.max(H, 1)
1129
+ });
1130
+ }
1131
+ return l.filter((D) => D.events.length > 0);
1132
+ }, [
1133
+ B,
1134
+ n,
1135
+ x,
1136
+ z,
1137
+ K,
1138
+ j,
1139
+ V,
1140
+ L
1141
+ ]), re = X(() => {
1142
+ const l = /* @__PURE__ */ new Map();
1143
+ for (const u of S)
1144
+ for (const v of u.events)
1145
+ if (v.spanCols === 1) {
1146
+ const N = l.get(v.startCol) ?? 0;
1147
+ l.set(v.startCol, N + 1);
1148
+ }
1149
+ return l;
1150
+ }, [S]), G = X(() => {
1151
+ const l = c.length, u = Ie, v = [];
1152
+ for (let N = 0; N < l; N++) {
1153
+ const D = re.get(N) ?? 0;
1154
+ D > Qe ? v.push(
1155
+ Xe + (D - Qe) * 20
1156
+ ) : D > 0 ? v.push(Math.max(u, Xe)) : v.push(u);
1157
+ }
1158
+ return v;
1159
+ }, [
1160
+ z,
1161
+ c.length,
1162
+ x.length,
1163
+ re
1164
+ ]), Ce = (l) => Math.max(
1165
+ tn,
1166
+ l * (We + Je) + qe * 2
1167
+ ), ee = Ee + G.reduce((l, u) => l + u, 0), Q = X(() => {
1168
+ const l = [0];
1169
+ for (let u = 0; u < G.length; u++)
1170
+ l.push(l[u] + G[u]);
1171
+ return l;
1172
+ }, [G]);
1173
+ vt(() => {
1174
+ const l = W.current;
1175
+ if (!l) return;
1176
+ const u = () => {
1177
+ let v = -1;
1178
+ const D = (/* @__PURE__ */ new Date()).getHours();
1179
+ {
1180
+ for (let T = 0; T < c.length; T++) {
1181
+ const H = c[T];
1182
+ if (H && ie(H.date) && H.hour <= D && H.hour + 1 > D) {
1183
+ v = T;
1184
+ break;
1185
+ }
1186
+ }
1187
+ if (v === -1)
1188
+ for (let T = 0; T < c.length; T++) {
1189
+ const H = c[T];
1190
+ if (H && ie(H.date)) {
1191
+ v = T;
1192
+ break;
1193
+ }
1194
+ }
1195
+ }
1196
+ if (v !== -1) {
1197
+ const T = (Q[v] ?? 0) + Ee, H = l.clientWidth, J = Math.max(0, T - H / 3);
1198
+ l.scrollTo({
1199
+ left: J,
1200
+ behavior: "instant"
1201
+ });
1202
+ }
1203
+ };
1204
+ requestAnimationFrame(() => {
1205
+ requestAnimationFrame(u);
1206
+ });
1207
+ }, [_, c, x, Q, z]);
1208
+ const ke = $(
1209
+ (l, u) => {
1210
+ const v = u.getBoundingClientRect(), N = l - v.left + u.scrollLeft;
1211
+ for (let D = 0; D < Q.length - 1; D++) {
1212
+ const T = Q[D], H = Q[D + 1];
1213
+ if (N >= T && N < H) {
1214
+ const J = (N - T) / (H - T), Z = Math.floor(J * 60), q = Math.round(Z / 15) * 15;
1215
+ return { colIndex: D, minute: Math.min(q, 45) };
1216
+ }
1217
+ }
1218
+ return null;
1219
+ },
1220
+ [Q]
1221
+ ), se = $(
1222
+ (l, u) => {
1223
+ if (c[l]) {
1224
+ const v = c[l], N = new Date(v.date);
1225
+ return N.setHours(v.hour, u ?? 0, 0, 0), { date: N, hour: v.hour };
1226
+ }
1227
+ return { date: /* @__PURE__ */ new Date() };
1228
+ },
1229
+ [z, c, x]
1230
+ ), le = $(
1231
+ (l, u) => {
1232
+ if (l.preventDefault(), l.dataTransfer.dropEffect = "move", !E?.isDragging || !E.dragState) return;
1233
+ const v = l.currentTarget, N = ke(l.clientX, v);
1234
+ if (!N) return;
1235
+ const { colIndex: D, minute: T } = N, { date: H, hour: J } = se(D, T);
1236
+ E.updateDragPreview(H, J, T, u);
1237
+ const { originalStartDate: Z, originalEndDate: q } = E.dragState, ne = q.getTime() - Z.getTime(), ve = c.length;
1238
+ let we;
1239
+ {
1240
+ const be = ne / 36e5;
1241
+ we = Math.max(1, Math.ceil(be));
1242
+ }
1243
+ we = Math.min(we, ve - D), C({ resourceId: u, colIndex: D, spanCols: we });
1244
+ },
1245
+ [E, ke, se, z, c.length, x.length]
1246
+ ), Me = $(
1247
+ (l) => {
1248
+ const u = l.relatedTarget;
1249
+ l.currentTarget.contains(u) || C(null);
1250
+ },
1251
+ []
1252
+ ), xe = $(
1253
+ (l, u) => {
1254
+ l.preventDefault(), C(null), E?.isDragging && E.endDrag();
1255
+ },
1256
+ [E]
1257
+ ), p = $(
1258
+ (l, u) => {
1259
+ if (!y || y.resourceId !== l) return !1;
1260
+ const v = Math.min(y.startCol, y.endCol), N = Math.max(y.startCol, y.endCol);
1261
+ return u >= v && u <= N;
1262
+ },
1263
+ [y]
1264
+ ), M = $(
1265
+ (l, u) => !R || R.resourceId !== l ? !1 : u >= R.colIndex && u < R.colIndex + R.spanCols,
1266
+ [R]
1267
+ ), U = $(
1268
+ (l, u, v) => {
1269
+ v.button !== 0 && v.pointerType === "mouse" || (h || f) && (v.preventDefault(), O.current = !0, A({ resourceId: l, startCol: u, endCol: u, isSelecting: !0 }));
1270
+ },
1271
+ [h, f]
1272
+ ), te = $(
1273
+ (l, u, v) => {
1274
+ if (O.current && !(!y || y.resourceId !== l)) {
1275
+ if (v.buttons === 0) {
1276
+ O.current = !1;
1277
+ return;
1278
+ }
1279
+ A((N) => N ? { ...N, endCol: u } : null);
1280
+ }
1281
+ },
1282
+ [y]
1283
+ ), Ne = $(() => {
1284
+ if (!O.current || !y) return;
1285
+ O.current = !1;
1286
+ const l = Math.min(y.startCol, y.endCol), u = Math.max(y.startCol, y.endCol), v = se(l), N = se(u), D = new Date(v.date), T = new Date(N.date);
1287
+ N.hour !== void 0 && T.setHours(N.hour + 1, 0, 0, 0);
1288
+ const H = {
1289
+ startDate: D,
1290
+ endDate: T,
1291
+ resourceId: y.resourceId
1292
+ };
1293
+ l === u && f && f(v.date, v.hour, y.resourceId), h?.(H), A((J) => J ? { ...J, isSelecting: !1 } : null), setTimeout(() => A(null), 150);
1294
+ }, [y, se, z, f, h]);
1295
+ return ce(() => {
1296
+ const l = () => {
1297
+ O.current && Ne();
1298
+ };
1299
+ return window.addEventListener("pointerup", l), window.addEventListener("pointercancel", l), () => {
1300
+ window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", l);
1301
+ };
1302
+ }, [Ne]), ce(() => {
1303
+ E?.isDragging || C(null);
1304
+ }, [E?.isDragging]), /* @__PURE__ */ e("div", { className: m("flex h-full flex-col", w), children: /* @__PURE__ */ e("div", { className: "ic-timeline-scroll-container flex-1", ref: W, children: /* @__PURE__ */ r("div", { className: "relative", style: { minWidth: ee }, children: [
1305
+ // Hour mode: Day headers + Hour sub-headers - sticky wrapper with flex child (sticky + flex breaks sticky)
1306
+ /* @__PURE__ */ e("div", { className: "ic-timeline-header sticky top-0 z-20 border-b bg-background", children: t > 1 ? (
1307
+ // Multi-day: Resources cell spans both day-header + hour-header rows
1308
+ /* @__PURE__ */ r("div", { className: "flex", children: [
1309
+ /* @__PURE__ */ e(
1310
+ "div",
1311
+ {
1312
+ className: "flex shrink-0 items-center justify-center border-r bg-background px-2 sticky left-0 z-10",
1313
+ style: { width: Ee },
1314
+ children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Resources" })
1315
+ }
1316
+ ),
1317
+ /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-col", children: [
1318
+ /* @__PURE__ */ e("div", { className: "flex border-b", children: x.map((l, u) => {
1319
+ const v = ie(l), N = u * K, D = G.slice(N, N + K).reduce((T, H) => T + H, 0);
1320
+ return /* @__PURE__ */ e(
1321
+ "div",
1322
+ {
1323
+ className: m(
1324
+ "flex shrink-0 items-center justify-center border-r py-1.5 font-medium",
1325
+ v ? "bg-primary/10 text-primary" : "bg-muted/30"
1326
+ ),
1327
+ style: { width: D },
1328
+ children: /* @__PURE__ */ e("span", { className: "text-xs", children: ln(l) })
1329
+ },
1330
+ `day-${l.toISOString()}`
1331
+ );
1332
+ }) }),
1333
+ /* @__PURE__ */ e("div", { className: "flex", children: c.map((l, u) => {
1334
+ const v = l.hour === j, N = ie(l.date), D = G[u] ?? Ie;
1335
+ return /* @__PURE__ */ e(
1336
+ "div",
1337
+ {
1338
+ className: m(
1339
+ "flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",
1340
+ v && u > 0 ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1341
+ N && "bg-primary/5"
1342
+ ),
1343
+ style: { width: D },
1344
+ children: $e(l.hour)
1345
+ },
1346
+ `hour-${l.dayIndex}-${l.hour}`
1347
+ );
1348
+ }) })
1349
+ ] })
1350
+ ] })
1351
+ ) : (
1352
+ // Single-day: simple single row
1353
+ /* @__PURE__ */ r("div", { className: "flex", children: [
1354
+ /* @__PURE__ */ e(
1355
+ "div",
1356
+ {
1357
+ className: "flex shrink-0 items-center border-r bg-background px-2 py-2",
1358
+ style: { width: Ee },
1359
+ children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Resources" })
1360
+ }
1361
+ ),
1362
+ c.map((l, u) => {
1363
+ const v = l.hour === j, N = ie(l.date), D = G[u] ?? Ie;
1364
+ return /* @__PURE__ */ e(
1365
+ "div",
1366
+ {
1367
+ className: m(
1368
+ "flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",
1369
+ v && u > 0 ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1370
+ N && "bg-primary/5"
1371
+ ),
1372
+ style: { width: D },
1373
+ children: $e(l.hour)
1374
+ },
1375
+ `hour-${l.dayIndex}-${l.hour}`
1376
+ );
1377
+ })
1378
+ ] })
1379
+ ) }),
1380
+ S.map((l) => {
1381
+ const u = Ce(l.maxStack);
1382
+ return /* @__PURE__ */ r(
1383
+ "div",
1384
+ {
1385
+ className: m(
1386
+ "relative flex border-b",
1387
+ F?.resourceRow
1388
+ ),
1389
+ style: { height: u },
1390
+ children: [
1391
+ /* @__PURE__ */ e(
1392
+ "div",
1393
+ {
1394
+ className: "sticky left-0 z-10",
1395
+ style: { width: Ee },
1396
+ children: /* @__PURE__ */ r(
1397
+ "div",
1398
+ {
1399
+ className: m(
1400
+ "flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",
1401
+ F?.resourceHeader
1402
+ ),
1403
+ children: [
1404
+ /* @__PURE__ */ e(
1405
+ cn,
1406
+ {
1407
+ className: "size-7",
1408
+ src: l.user.avatar,
1409
+ alt: l.user.name,
1410
+ fallback: on(l.user.name)
1411
+ }
1412
+ ),
1413
+ /* @__PURE__ */ e("span", { className: "truncate text-xs sm:text-sm font-medium", children: l.user.name })
1414
+ ]
1415
+ }
1416
+ )
1417
+ }
1418
+ ),
1419
+ /* @__PURE__ */ r(
1420
+ "div",
1421
+ {
1422
+ className: "ic-timeline-grid relative flex",
1423
+ onDragOver: (v) => le(v, l.user.id),
1424
+ onDragLeave: Me,
1425
+ onDrop: (v) => xe(v, l.user.id),
1426
+ children: [
1427
+ // Hour mode cells — interactive buttons for slot selection
1428
+ c.map((v, N) => {
1429
+ const D = v.hour === j && N > 0, T = G[N] ?? Ie, H = p(l.user.id, N), J = M(l.user.id, N), Z = !!(h || f);
1430
+ return /* @__PURE__ */ e(
1431
+ "div",
1432
+ {
1433
+ role: Z ? "button" : void 0,
1434
+ tabIndex: Z ? 0 : void 0,
1435
+ "aria-label": Z ? `Select ${$e(v.hour)} on ${v.date.toLocaleDateString()} for ${l.user.name}` : void 0,
1436
+ onPointerDown: (q) => U(l.user.id, N, q),
1437
+ onPointerEnter: (q) => te(l.user.id, N, q),
1438
+ onPointerUp: Ne,
1439
+ onKeyDown: (q) => {
1440
+ if (Z && (q.key === "Enter" || q.key === " ")) {
1441
+ q.preventDefault();
1442
+ const ne = se(N);
1443
+ f?.(ne.date, ne.hour, l.user.id), h?.({
1444
+ startDate: ne.date,
1445
+ endDate: (() => {
1446
+ const ve = new Date(ne.date);
1447
+ return ne.hour !== void 0 && ve.setHours(ne.hour + 1, 0, 0, 0), ve;
1448
+ })(),
1449
+ resourceId: l.user.id
1450
+ });
1451
+ }
1452
+ },
1453
+ className: m(
1454
+ "shrink-0 select-none touch-none transition-colors",
1455
+ Z && "cursor-pointer",
1456
+ D ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1457
+ ie(v.date) && "bg-primary/5",
1458
+ // Hover — subtle feedback (only when not selecting or dragging)
1459
+ Z && !y?.isSelecting && !E?.isDragging && "hover:bg-blue-50/60",
1460
+ // Slot selection highlight
1461
+ H && "bg-blue-100/70",
1462
+ // Drop target highlight
1463
+ J && "bg-primary/20 ring-2 ring-primary ring-inset"
1464
+ ),
1465
+ style: { width: T }
1466
+ },
1467
+ `cell-${v.dayIndex}-${v.hour}`
1468
+ );
1469
+ }),
1470
+ l.events.map((v) => {
1471
+ const N = (Q[v.startCol] ?? 0) + 2, D = Q[v.startCol + v.spanCols] ?? Q[Q.length - 1] ?? 0, T = Q[v.startCol] ?? 0, H = D - T - 4, J = qe + v.stackIndex * (We + Je);
1472
+ return /* @__PURE__ */ e(
1473
+ "div",
1474
+ {
1475
+ className: "absolute",
1476
+ style: {
1477
+ left: N,
1478
+ width: Math.max(H, 0),
1479
+ // No forced minimum - columns are guaranteed wide enough
1480
+ top: J,
1481
+ height: We
1482
+ },
1483
+ children: /* @__PURE__ */ e(
1484
+ Nt,
1485
+ {
1486
+ event: v.event,
1487
+ variant: "compact",
1488
+ enableDrag: P,
1489
+ onClick: i,
1490
+ renderPopover: b,
1491
+ className: m(
1492
+ "h-full w-full",
1493
+ F?.eventCardCompact
1494
+ )
1495
+ }
1496
+ )
1497
+ },
1498
+ v.event.id
1499
+ );
1500
+ })
1501
+ ]
1502
+ }
1503
+ )
1504
+ ]
1505
+ },
1506
+ l.user.id
1507
+ );
1508
+ }),
1509
+ S.length === 0 && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-20 text-muted-foreground", children: "No users or events to display" })
1510
+ ] }) }) });
1511
+ }
1512
+ const un = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], hn = [
1513
+ "January",
1514
+ "February",
1515
+ "March",
1516
+ "April",
1517
+ "May",
1518
+ "June",
1519
+ "July",
1520
+ "August",
1521
+ "September",
1522
+ "October",
1523
+ "November",
1524
+ "December"
1525
+ ];
1526
+ function et(t) {
1527
+ const n = t.hexColor;
1528
+ return n ? { backgroundColor: n } : {};
1529
+ }
1530
+ function mn({ day: t, date: n, events: o, isCurrentMonth: s, onDayClick: a }) {
1531
+ const i = ie(n), f = 3, h = o.length;
1532
+ return /* @__PURE__ */ r(
1533
+ "button",
1534
+ {
1535
+ type: "button",
1536
+ onClick: () => a?.(n),
1537
+ className: m(
1538
+ "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",
1539
+ "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1540
+ "transition-colors",
1541
+ !s && "opacity-40"
1542
+ ),
1543
+ children: [
1544
+ /* @__PURE__ */ e(
1545
+ "div",
1546
+ {
1547
+ className: m(
1548
+ "flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",
1549
+ i && "bg-primary font-semibold text-primary-foreground"
1550
+ ),
1551
+ children: t
1552
+ }
1553
+ ),
1554
+ h > 0 && /* @__PURE__ */ e("div", { className: "mt-0.5 flex items-center gap-0.5", children: h <= f ? o.map((d) => /* @__PURE__ */ e(
1555
+ "div",
1556
+ {
1557
+ className: "size-1 sm:size-1.5 rounded-full bg-primary",
1558
+ style: et(d)
1559
+ },
1560
+ d.id
1561
+ )) : /* @__PURE__ */ r(pe, { children: [
1562
+ o.slice(0, f).map((d) => /* @__PURE__ */ e(
1563
+ "div",
1564
+ {
1565
+ className: "size-1 sm:size-1.5 rounded-full bg-primary",
1566
+ style: et(d)
1567
+ },
1568
+ d.id
1569
+ )),
1570
+ /* @__PURE__ */ r("span", { className: "text-[6px] sm:text-[7px] font-medium text-muted-foreground", children: [
1571
+ "+",
1572
+ h - f
1573
+ ] })
1574
+ ] }) })
1575
+ ]
1576
+ }
1577
+ );
1578
+ }
1579
+ function fn({
1580
+ date: t,
1581
+ events: n,
1582
+ onMonthClick: o,
1583
+ onDayClick: s
1584
+ }) {
1585
+ const a = X(() => At(t, 0), [t]);
1586
+ return /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
1587
+ /* @__PURE__ */ e(
1588
+ "button",
1589
+ {
1590
+ type: "button",
1591
+ onClick: () => o?.(t),
1592
+ className: m(
1593
+ "w-full rounded-t-lg border px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-semibold",
1594
+ "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1595
+ "transition-colors"
1596
+ ),
1597
+ children: hn[t.getMonth()]
1598
+ }
1599
+ ),
1600
+ /* @__PURE__ */ r("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: [
1601
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 text-center", children: un.map((i, f) => /* @__PURE__ */ r("div", { className: "text-[9px] sm:text-xs font-medium text-muted-foreground", children: [
1602
+ /* @__PURE__ */ e("span", { className: "sm:hidden", children: i[0] }),
1603
+ /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: i })
1604
+ ] }, f)) }),
1605
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 gap-y-1", children: a.map((i, f) => {
1606
+ const h = Pt(n, i.date);
1607
+ return /* @__PURE__ */ e(
1608
+ mn,
1609
+ {
1610
+ day: i.date.getDate(),
1611
+ date: i.date,
1612
+ events: h,
1613
+ isCurrentMonth: i.isCurrentMonth,
1614
+ onDayClick: s
1615
+ },
1616
+ `${f + 1}-${i.date.toISOString()}`
1617
+ );
1618
+ }) })
1619
+ ] })
1620
+ ] });
1621
+ }
1622
+ function gn({
1623
+ events: t,
1624
+ year: n,
1625
+ onMonthClick: o,
1626
+ onDayClick: s,
1627
+ className: a,
1628
+ slots: i,
1629
+ classNames: f
1630
+ }) {
1631
+ const h = X(() => jt(n), [n]);
1632
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col h-full", a), children: [
1633
+ /* @__PURE__ */ e("div", { className: "flex items-center justify-center border-b px-4 py-3", children: /* @__PURE__ */ e("h2", { className: "text-lg font-semibold", children: n }) }),
1634
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto p-4", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: h.map((d) => /* @__PURE__ */ e(
1635
+ fn,
1636
+ {
1637
+ date: d,
1638
+ events: t,
1639
+ onMonthClick: o,
1640
+ onDayClick: s
1641
+ },
1642
+ d.getMonth()
1643
+ )) }) })
1644
+ ] });
1645
+ }
1646
+ const ze = 200, pn = 60, xn = 300, vn = 7, tt = 2, Fe = 40, wn = 18;
1647
+ function bn() {
1648
+ return /* @__PURE__ */ e("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: /* @__PURE__ */ e("path", { d: "m18 15-6-6-6 6" }) });
1649
+ }
1650
+ function yn() {
1651
+ return /* @__PURE__ */ e("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: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" }) });
1652
+ }
1653
+ function kn() {
1654
+ return /* @__PURE__ */ e("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: /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" }) });
1655
+ }
1656
+ function Nn() {
1657
+ return /* @__PURE__ */ e("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: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" }) });
1658
+ }
1659
+ function Dn({ containerRef: t, className: n }) {
1660
+ const [o, s] = oe({
1661
+ canUp: !1,
1662
+ canDown: !1,
1663
+ canLeft: !1,
1664
+ canRight: !1
1665
+ }), [a, i] = oe({ x: 0, y: 0 }), [f, h] = oe(!1), d = o.canUp || o.canDown || o.canLeft || o.canRight, w = ae(null), k = ae(null), b = ae(null), I = ae(!1), F = ae({ x: 0, y: 0 }), P = ae({ x: 0, y: 0 }), W = ae(0), E = $(() => {
1666
+ const x = t.current;
1667
+ if (!x) return;
1668
+ const c = 4;
1669
+ s({
1670
+ canUp: x.scrollTop > c,
1671
+ canDown: x.scrollTop + x.clientHeight < x.scrollHeight - c,
1672
+ canLeft: x.scrollLeft > c,
1673
+ canRight: x.scrollLeft + x.clientWidth < x.scrollWidth - c
1674
+ });
1675
+ }, [t]);
1676
+ ce(() => {
1677
+ const x = t.current;
1678
+ if (!x) return;
1679
+ E(), x.addEventListener("scroll", E, { passive: !0 });
1680
+ const c = new ResizeObserver(E);
1681
+ c.observe(x);
1682
+ const g = new MutationObserver(E);
1683
+ return g.observe(x, { childList: !0, subtree: !0 }), () => {
1684
+ x.removeEventListener("scroll", E), c.disconnect(), g.disconnect();
1685
+ };
1686
+ }, [t, E]);
1687
+ const y = $(
1688
+ (x, c) => {
1689
+ t.current?.scrollBy({ left: x, top: c, behavior: "smooth" });
1690
+ },
1691
+ [t]
1692
+ ), A = $(() => y(0, -ze), [y]), O = $(() => y(0, ze), [y]), R = $(() => y(-ze, 0), [y]), C = $(() => y(ze, 0), [y]), _ = $(() => {
1693
+ w.current && (clearTimeout(w.current), w.current = null), k.current && (clearInterval(k.current), k.current = null);
1694
+ }, []), z = $(
1695
+ (x) => {
1696
+ x(), w.current = setTimeout(() => {
1697
+ k.current = setInterval(x, pn);
1698
+ }, xn);
1699
+ },
1700
+ []
1701
+ );
1702
+ ce(() => _, [_]), ce(() => {
1703
+ const x = t.current;
1704
+ if (!x) return;
1705
+ const c = (g) => {
1706
+ if (g.ctrlKey || g.metaKey || g.altKey) return;
1707
+ const L = g.target.tagName;
1708
+ if (!(L === "INPUT" || L === "TEXTAREA" || g.target.isContentEditable))
1709
+ switch (g.key) {
1710
+ case "ArrowUp":
1711
+ g.preventDefault(), A();
1712
+ break;
1713
+ case "ArrowDown":
1714
+ g.preventDefault(), O();
1715
+ break;
1716
+ case "ArrowLeft":
1717
+ g.preventDefault(), R();
1718
+ break;
1719
+ case "ArrowRight":
1720
+ g.preventDefault(), C();
1721
+ break;
1722
+ }
1723
+ };
1724
+ return x.addEventListener("keydown", c), () => x.removeEventListener("keydown", c);
1725
+ }, [t, A, O, R, C]);
1726
+ const j = $(() => {
1727
+ I.current = !1, h(!1), i({ x: 0, y: 0 }), P.current = { x: 0, y: 0 }, W.current && cancelAnimationFrame(W.current);
1728
+ }, []), V = $(
1729
+ (x) => {
1730
+ x.preventDefault(), I.current = !0, h(!0), F.current = { x: x.clientX, y: x.clientY }, P.current = { x: 0, y: 0 }, x.target.setPointerCapture(x.pointerId);
1731
+ const c = () => {
1732
+ if (!I.current) return;
1733
+ const g = t.current;
1734
+ if (g) {
1735
+ const { x: L, y: B } = P.current, S = Math.sqrt(L * L + B * B);
1736
+ if (S > tt) {
1737
+ const G = Math.min(S / Fe, 1) * wn;
1738
+ g.scrollLeft += L / S * G, g.scrollTop += B / S * G;
1739
+ }
1740
+ }
1741
+ W.current = requestAnimationFrame(c);
1742
+ };
1743
+ W.current = requestAnimationFrame(c);
1744
+ },
1745
+ [t]
1746
+ ), K = $(
1747
+ (x) => {
1748
+ if (!I.current) return;
1749
+ const c = x.clientX - F.current.x, g = x.clientY - F.current.y;
1750
+ P.current = { x: c, y: g };
1751
+ const L = Math.sqrt(c * c + g * g);
1752
+ if (L < tt)
1753
+ i({ x: 0, y: 0 });
1754
+ else {
1755
+ const S = Math.min(L, Fe) / Fe * vn;
1756
+ i({
1757
+ x: c / L * S,
1758
+ y: g / L * S
1759
+ });
1760
+ }
1761
+ },
1762
+ []
1763
+ ), Y = $(
1764
+ (x) => {
1765
+ switch (x.key) {
1766
+ case "ArrowUp":
1767
+ x.preventDefault(), A();
1768
+ break;
1769
+ case "ArrowDown":
1770
+ x.preventDefault(), O();
1771
+ break;
1772
+ case "ArrowLeft":
1773
+ x.preventDefault(), R();
1774
+ break;
1775
+ case "ArrowRight":
1776
+ x.preventDefault(), C();
1777
+ break;
1778
+ }
1779
+ },
1780
+ [A, O, R, C]
1781
+ );
1782
+ return d ? /* @__PURE__ */ r(
1783
+ "div",
1784
+ {
1785
+ className: `inno-scroll-nav ${n ?? ""}`,
1786
+ role: "toolbar",
1787
+ "aria-label": "Scroll navigation",
1788
+ onKeyDown: Y,
1789
+ children: [
1790
+ /* @__PURE__ */ e(
1791
+ "button",
1792
+ {
1793
+ type: "button",
1794
+ className: `inno-scroll-nav-btn inno-scroll-nav-up ${o.canUp ? "" : "inno-scroll-nav-btn-disabled"}`,
1795
+ "aria-label": "Scroll up",
1796
+ disabled: !o.canUp,
1797
+ onPointerDown: () => z(A),
1798
+ onPointerUp: _,
1799
+ onPointerLeave: _,
1800
+ tabIndex: o.canUp ? 0 : -1,
1801
+ children: /* @__PURE__ */ e(bn, {})
1802
+ }
1803
+ ),
1804
+ /* @__PURE__ */ e(
1805
+ "button",
1806
+ {
1807
+ type: "button",
1808
+ className: `inno-scroll-nav-btn inno-scroll-nav-left ${o.canLeft ? "" : "inno-scroll-nav-btn-disabled"}`,
1809
+ "aria-label": "Scroll left",
1810
+ disabled: !o.canLeft,
1811
+ onPointerDown: () => z(R),
1812
+ onPointerUp: _,
1813
+ onPointerLeave: _,
1814
+ tabIndex: o.canLeft ? 0 : -1,
1815
+ children: /* @__PURE__ */ e(kn, {})
1816
+ }
1817
+ ),
1818
+ /* @__PURE__ */ e(
1819
+ "button",
1820
+ {
1821
+ ref: b,
1822
+ type: "button",
1823
+ className: `inno-scroll-nav-joystick ${f ? "inno-scroll-nav-joystick-active" : ""}`,
1824
+ "aria-label": "Drag to scroll freely",
1825
+ onPointerDown: V,
1826
+ onPointerMove: K,
1827
+ onPointerUp: j,
1828
+ onPointerCancel: j,
1829
+ tabIndex: 0,
1830
+ children: /* @__PURE__ */ e(
1831
+ "span",
1832
+ {
1833
+ className: "inno-scroll-nav-joystick-dot",
1834
+ style: {
1835
+ transform: `translate(${a.x}px, ${a.y}px)`
1836
+ }
1837
+ }
1838
+ )
1839
+ }
1840
+ ),
1841
+ /* @__PURE__ */ e(
1842
+ "button",
1843
+ {
1844
+ type: "button",
1845
+ className: `inno-scroll-nav-btn inno-scroll-nav-right ${o.canRight ? "" : "inno-scroll-nav-btn-disabled"}`,
1846
+ "aria-label": "Scroll right",
1847
+ disabled: !o.canRight,
1848
+ onPointerDown: () => z(C),
1849
+ onPointerUp: _,
1850
+ onPointerLeave: _,
1851
+ tabIndex: o.canRight ? 0 : -1,
1852
+ children: /* @__PURE__ */ e(Nn, {})
1853
+ }
1854
+ ),
1855
+ /* @__PURE__ */ e(
1856
+ "button",
1857
+ {
1858
+ type: "button",
1859
+ className: `inno-scroll-nav-btn inno-scroll-nav-down ${o.canDown ? "" : "inno-scroll-nav-btn-disabled"}`,
1860
+ "aria-label": "Scroll down",
1861
+ disabled: !o.canDown,
1862
+ onPointerDown: () => z(O),
1863
+ onPointerUp: _,
1864
+ onPointerLeave: _,
1865
+ tabIndex: o.canDown ? 0 : -1,
1866
+ children: /* @__PURE__ */ e(yn, {})
1867
+ }
1868
+ )
1869
+ ]
1870
+ }
1871
+ ) : null;
1872
+ }
1873
+ function Cn(t) {
1874
+ switch (t) {
1875
+ case "day":
1876
+ case "week":
1877
+ return "time";
1878
+ default:
1879
+ return "day";
1880
+ }
1881
+ }
1882
+ function Mn({
1883
+ onEventClick: t,
1884
+ onSlotClick: n,
1885
+ onSlotSelect: o,
1886
+ onAddEvent: s,
1887
+ className: a,
1888
+ showHeader: i = !0,
1889
+ minSelectionMinutes: f = 30,
1890
+ showMoreMode: h,
1891
+ showMoreEventsInPopover: d = !1,
1892
+ isLoading: w = !1,
1893
+ slots: k,
1894
+ classNames: b,
1895
+ settingsContent: I,
1896
+ filterContent: F,
1897
+ headerActions: P,
1898
+ renderPopover: W,
1899
+ calendarRef: E,
1900
+ headerConfig: y,
1901
+ eventDetailMode: A,
1902
+ renderEventDetail: O
1903
+ }) {
1904
+ const R = h ?? (d ? "popover" : "expand"), {
1905
+ view: C,
1906
+ setView: _,
1907
+ selectedDate: z,
1908
+ setSelectedDate: j,
1909
+ slotDuration: V,
1910
+ filteredEvents: K,
1911
+ users: Y,
1912
+ visibleHours: x,
1913
+ workingHours: c,
1914
+ badgeVariant: g,
1915
+ showWorkingHoursOnly: L,
1916
+ clearFocusEventId: B
1917
+ } = It(), S = X(() => {
1918
+ if (!L || !c)
1919
+ return {
1920
+ startHour: x.start,
1921
+ endHour: x.end
1922
+ };
1923
+ let p = 24, M = 0;
1924
+ for (const U of Object.keys(c)) {
1925
+ const te = c[Number(U)];
1926
+ !te || te.enabled === !1 || (te.from < p && (p = te.from), te.to > M && (M = te.to));
1927
+ }
1928
+ return p >= M ? {
1929
+ startHour: x.start,
1930
+ endHour: x.end
1931
+ } : { startHour: p, endHour: M };
1932
+ }, [L, c, x]), re = S, G = ae(null);
1933
+ wt(
1934
+ E,
1935
+ () => ({
1936
+ scrollToToday: () => {
1937
+ const p = /* @__PURE__ */ new Date();
1938
+ j(p, C), requestAnimationFrame(() => {
1939
+ requestAnimationFrame(() => {
1940
+ const M = G.current?.querySelector(
1941
+ ".ic-timeline-scroll-container, [class*='overflow-auto']"
1942
+ );
1943
+ if (!M) return;
1944
+ const Ne = (p.getHours() - S.startHour) * 96;
1945
+ Ne > 0 && M.scrollTo({
1946
+ top: Math.max(0, Ne - 100),
1947
+ // Offset to show some context
1948
+ behavior: "smooth"
1949
+ });
1950
+ });
1951
+ });
1952
+ },
1953
+ scrollToWorkingHours: () => {
1954
+ let p = 8;
1955
+ if (c)
1956
+ for (const M of Object.keys(c)) {
1957
+ const U = c[Number(M)];
1958
+ U?.enabled && U.from < p && (p = Math.max(U.from - 1, 0));
1959
+ }
1960
+ requestAnimationFrame(() => {
1961
+ requestAnimationFrame(() => {
1962
+ const M = G.current?.querySelector(
1963
+ ".ic-timeline-scroll-container, [class*='overflow-auto']"
1964
+ );
1965
+ if (!M) return;
1966
+ const te = (p - S.startHour) * 96;
1967
+ M.scrollTo({
1968
+ top: Math.max(0, te),
1969
+ behavior: "smooth"
1970
+ });
1971
+ });
1972
+ });
1973
+ },
1974
+ getViewRect: () => G.current?.getBoundingClientRect() ?? null,
1975
+ focusEvent: (p) => {
1976
+ B(), requestAnimationFrame(() => {
1977
+ B();
1978
+ });
1979
+ const M = G.current?.querySelector(
1980
+ `[data-event-id="${p}"]`
1981
+ );
1982
+ M && setTimeout(() => M.click(), 150);
1983
+ }
1984
+ }),
1985
+ [
1986
+ j,
1987
+ C,
1988
+ S,
1989
+ c,
1990
+ B
1991
+ ]
1992
+ );
1993
+ const Ce = X(() => Cn(C), [C]), ee = $(
1994
+ (p) => {
1995
+ if (o) {
1996
+ o(p);
1997
+ return;
1998
+ }
1999
+ if (n) {
2000
+ const M = p.startDate.getHours();
2001
+ n(p.startDate, M);
2002
+ }
2003
+ },
2004
+ [o, n]
2005
+ ), Q = $(
2006
+ (p) => {
2007
+ _("day"), j(p, "day");
2008
+ },
2009
+ [j, _]
2010
+ ), ke = $(
2011
+ (p) => {
2012
+ _("month"), j(p, "month");
2013
+ },
2014
+ [j, _]
2015
+ ), se = $(
2016
+ (p) => {
2017
+ t?.(p);
2018
+ },
2019
+ [t]
2020
+ ), le = $(
2021
+ (p, M, U) => {
2022
+ n?.(p, M);
2023
+ },
2024
+ [n]
2025
+ ), Me = () => {
2026
+ const p = K, M = se, U = W;
2027
+ switch (C) {
2028
+ case "day":
2029
+ return /* @__PURE__ */ e(
2030
+ St,
2031
+ {
2032
+ events: p,
2033
+ date: z,
2034
+ visibleHours: re,
2035
+ workingHours: c,
2036
+ slotDuration: V,
2037
+ badgeVariant: g,
2038
+ onEventClick: M,
2039
+ renderPopover: U,
2040
+ ...k && { slots: k },
2041
+ ...b && { classNames: b }
2042
+ }
2043
+ );
2044
+ case "week":
2045
+ return /* @__PURE__ */ e(
2046
+ Mt,
2047
+ {
2048
+ events: p,
2049
+ date: z,
2050
+ visibleHours: re,
2051
+ workingHours: c,
2052
+ slotDuration: V,
2053
+ badgeVariant: g,
2054
+ onEventClick: M,
2055
+ renderPopover: U,
2056
+ ...k && { slots: k },
2057
+ ...b && { classNames: b }
2058
+ }
2059
+ );
2060
+ case "month":
2061
+ return /* @__PURE__ */ e(
2062
+ Ve,
2063
+ {
2064
+ events: p,
2065
+ date: z,
2066
+ badgeVariant: g,
2067
+ onEventClick: M,
2068
+ onDayClick: Q,
2069
+ renderPopover: U,
2070
+ showMoreMode: R,
2071
+ ...k && { slots: k },
2072
+ ...b && { classNames: b }
2073
+ }
2074
+ );
2075
+ case "year":
2076
+ return /* @__PURE__ */ e(
2077
+ gn,
2078
+ {
2079
+ events: p,
2080
+ year: z.getFullYear(),
2081
+ onMonthClick: ke,
2082
+ onDayClick: Q,
2083
+ ...k && { slots: k },
2084
+ ...b && { classNames: b }
2085
+ }
2086
+ );
2087
+ case "agenda":
2088
+ return /* @__PURE__ */ e(
2089
+ Ct,
2090
+ {
2091
+ events: p,
2092
+ date: z,
2093
+ onEventClick: M,
2094
+ renderPopover: U,
2095
+ ...k && { slots: k },
2096
+ ...b && { classNames: b }
2097
+ }
2098
+ );
2099
+ // Resource views — delegate to TimelineView with matching day count
2100
+ case "resource-day":
2101
+ return /* @__PURE__ */ e(
2102
+ Le,
2103
+ {
2104
+ daysToShow: 1,
2105
+ events: p,
2106
+ users: Y,
2107
+ selectedDate: z,
2108
+ visibleHours: {
2109
+ from: S.startHour,
2110
+ to: S.endHour
2111
+ },
2112
+ onEventClick: M,
2113
+ onSlotSelect: ee,
2114
+ onSlotClick: le,
2115
+ renderPopover: U,
2116
+ ...k && { slots: k },
2117
+ ...b && { classNames: b }
2118
+ }
2119
+ );
2120
+ case "resource-week":
2121
+ return /* @__PURE__ */ e(
2122
+ Le,
2123
+ {
2124
+ daysToShow: 7,
2125
+ events: p,
2126
+ users: Y,
2127
+ selectedDate: z,
2128
+ visibleHours: {
2129
+ from: S.startHour,
2130
+ to: S.endHour
2131
+ },
2132
+ onEventClick: M,
2133
+ onSlotSelect: ee,
2134
+ onSlotClick: le,
2135
+ renderPopover: U,
2136
+ ...k && { slots: k },
2137
+ ...b && { classNames: b }
2138
+ }
2139
+ );
2140
+ // Timeline views
2141
+ case "timeline-day":
2142
+ return /* @__PURE__ */ e(
2143
+ Le,
2144
+ {
2145
+ daysToShow: 1,
2146
+ events: p,
2147
+ users: Y,
2148
+ selectedDate: z,
2149
+ visibleHours: {
2150
+ from: S.startHour,
2151
+ to: S.endHour
2152
+ },
2153
+ onEventClick: M,
2154
+ onSlotSelect: ee,
2155
+ onSlotClick: le,
2156
+ renderPopover: U,
2157
+ ...k && { slots: k },
2158
+ ...b && { classNames: b }
2159
+ }
2160
+ );
2161
+ case "timeline-3day":
2162
+ return /* @__PURE__ */ e(
2163
+ Le,
2164
+ {
2165
+ daysToShow: 3,
2166
+ events: p,
2167
+ users: Y,
2168
+ selectedDate: z,
2169
+ visibleHours: {
2170
+ from: S.startHour,
2171
+ to: S.endHour
2172
+ },
2173
+ onEventClick: M,
2174
+ onSlotSelect: ee,
2175
+ onSlotClick: le,
2176
+ renderPopover: U,
2177
+ ...k && { slots: k },
2178
+ ...b && { classNames: b }
2179
+ }
2180
+ );
2181
+ case "timeline-week":
2182
+ return /* @__PURE__ */ e(
2183
+ Le,
2184
+ {
2185
+ daysToShow: 7,
2186
+ events: p,
2187
+ users: Y,
2188
+ selectedDate: z,
2189
+ visibleHours: {
2190
+ from: S.startHour,
2191
+ to: S.endHour
2192
+ },
2193
+ onEventClick: M,
2194
+ onSlotSelect: ee,
2195
+ onSlotClick: le,
2196
+ renderPopover: U,
2197
+ ...k && { slots: k },
2198
+ ...b && { classNames: b }
2199
+ }
2200
+ );
2201
+ default:
2202
+ return /* @__PURE__ */ e(
2203
+ Ve,
2204
+ {
2205
+ events: p,
2206
+ date: z,
2207
+ badgeVariant: g,
2208
+ onEventClick: M,
2209
+ onDayClick: Q,
2210
+ ...k && { slots: k },
2211
+ ...b && { classNames: b }
2212
+ }
2213
+ );
2214
+ }
2215
+ }, xe = ae(null);
2216
+ return ce(() => {
2217
+ G.current = xe.current;
2218
+ }), /* @__PURE__ */ e(
2219
+ zt,
2220
+ {
2221
+ mode: Ce,
2222
+ onSelect: ee,
2223
+ minDurationMinutes: f,
2224
+ slotDurationMinutes: V,
2225
+ enabled: !!(o || n),
2226
+ children: /* @__PURE__ */ r(
2227
+ "div",
2228
+ {
2229
+ className: m(
2230
+ "inno-calendar-root flex flex-col h-full p-4",
2231
+ b?.root,
2232
+ a
2233
+ ),
2234
+ children: [
2235
+ i && /* @__PURE__ */ e(
2236
+ Dt,
2237
+ {
2238
+ currentDate: z,
2239
+ view: C,
2240
+ events: K,
2241
+ onViewChange: _,
2242
+ onNavigateToday: () => j(/* @__PURE__ */ new Date(), C),
2243
+ onNavigatePrev: () => {
2244
+ const p = new Date(z);
2245
+ C === "day" || C === "timeline-day" || C === "resource-day" ? p.setDate(p.getDate() - 1) : C === "timeline-3day" ? p.setDate(p.getDate() - 3) : C === "week" || C === "timeline-week" || C === "resource-week" ? p.setDate(p.getDate() - 7) : C === "month" ? p.setMonth(p.getMonth() - 1) : C === "year" ? p.setFullYear(p.getFullYear() - 1) : p.setDate(p.getDate() - 7), j(p, C);
2246
+ },
2247
+ onNavigateNext: () => {
2248
+ const p = new Date(z);
2249
+ C === "day" || C === "timeline-day" || C === "resource-day" ? p.setDate(p.getDate() + 1) : C === "timeline-3day" ? p.setDate(p.getDate() + 3) : C === "week" || C === "timeline-week" || C === "resource-week" ? p.setDate(p.getDate() + 7) : C === "month" ? p.setMonth(p.getMonth() + 1) : C === "year" ? p.setFullYear(p.getFullYear() + 1) : p.setDate(p.getDate() + 7), j(p, C);
2250
+ },
2251
+ availableViews: [
2252
+ "day",
2253
+ "week",
2254
+ "month",
2255
+ // 'year', NOTE: Intentionally blocked cause it would severe performance issues when there are many events
2256
+ "agenda"
2257
+ ],
2258
+ showTimelineViews: !0,
2259
+ showSettings: !!I,
2260
+ ...!P && s && { onAddEvent: s },
2261
+ actions: P,
2262
+ settingsContent: I,
2263
+ filterContent: F,
2264
+ ...y && { headerConfig: y }
2265
+ }
2266
+ ),
2267
+ /* @__PURE__ */ r("div", { className: "relative flex-1 min-h-0", children: [
2268
+ /* @__PURE__ */ e(
2269
+ "div",
2270
+ {
2271
+ ref: xe,
2272
+ className: m(
2273
+ "h-full border rounded-lg bg-white overflow-x-auto",
2274
+ b?.viewContainer
2275
+ ),
2276
+ children: Me()
2277
+ }
2278
+ ),
2279
+ w && /* @__PURE__ */ e("div", { className: "inno-calendar-loading-overlay", children: /* @__PURE__ */ e("div", { className: "inno-calendar-spinner" }) }),
2280
+ /* @__PURE__ */ e(Dn, { containerRef: xe })
2281
+ ] })
2282
+ ]
2283
+ }
2284
+ )
2285
+ }
2286
+ );
2287
+ }
2288
+ function Sn({
2289
+ events: t,
2290
+ users: n = [],
2291
+ scheduleTypes: o = [],
2292
+ initialView: s = "week",
2293
+ initialDate: a,
2294
+ initialSelectedUserId: i,
2295
+ initialScheduleTypeIds: f,
2296
+ initialParticipantIds: h,
2297
+ initialWorkingHoursView: d,
2298
+ initialSearchQuery: w,
2299
+ preferencesConfig: k,
2300
+ onEventClick: b,
2301
+ onSlotClick: I,
2302
+ onSlotSelect: F,
2303
+ onAddEvent: P,
2304
+ onEventDrop: W,
2305
+ onDateChange: E,
2306
+ onViewChange: y,
2307
+ className: A,
2308
+ showHeader: O = !0,
2309
+ minSelectionMinutes: R = 30,
2310
+ showMoreMode: C,
2311
+ showMoreEventsInPopover: _ = !1,
2312
+ isLoading: z = !1,
2313
+ renderPopover: j,
2314
+ slots: V,
2315
+ classNames: K,
2316
+ settingsContent: Y,
2317
+ filterContent: x,
2318
+ headerActions: c,
2319
+ focusEventId: g,
2320
+ headerConfig: L,
2321
+ eventDetailMode: B,
2322
+ renderEventDetail: S
2323
+ }, re) {
2324
+ return /* @__PURE__ */ e(Tt, { ...W && { onEventDrop: W }, children: /* @__PURE__ */ e(
2325
+ Ht,
2326
+ {
2327
+ initialEvents: t,
2328
+ initialUsers: n,
2329
+ initialScheduleTypes: o,
2330
+ initialView: s,
2331
+ ...a && { initialDate: a },
2332
+ ...i && { initialSelectedUserId: i },
2333
+ ...f && { initialScheduleTypeIds: f },
2334
+ ...h && { initialParticipantIds: h },
2335
+ ...d && { initialWorkingHoursView: d },
2336
+ ...w && { initialSearchQuery: w },
2337
+ ...k && { preferencesConfig: k },
2338
+ ...E && { onDateChange: E },
2339
+ ...y && { onViewChange: y },
2340
+ ...g && { initialFocusEventId: g },
2341
+ children: /* @__PURE__ */ e(
2342
+ Mn,
2343
+ {
2344
+ ...b && { onEventClick: b },
2345
+ ...I && { onSlotClick: I },
2346
+ ...F && { onSlotSelect: F },
2347
+ ...P && { onAddEvent: P },
2348
+ ...j && { renderPopover: j },
2349
+ className: A,
2350
+ showHeader: O,
2351
+ minSelectionMinutes: R,
2352
+ ...C && { showMoreMode: C },
2353
+ showMoreEventsInPopover: _,
2354
+ isLoading: z,
2355
+ ...V && { slots: V },
2356
+ ...K && { classNames: K },
2357
+ settingsContent: Y,
2358
+ filterContent: x,
2359
+ headerActions: c,
2360
+ calendarRef: re,
2361
+ ...L && { headerConfig: L },
2362
+ ...B && { eventDetailMode: B },
2363
+ ...S && { renderEventDetail: S }
2364
+ }
2365
+ )
2366
+ }
2367
+ ) });
2368
+ }
2369
+ const Dr = Ae(Sn), ge = Ae(
2370
+ ({ className: t, children: n, ...o }, s) => /* @__PURE__ */ e(
2371
+ "select",
2372
+ {
2373
+ ref: s,
2374
+ className: m(
2375
+ "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm",
2376
+ "ring-offset-background",
2377
+ "focus:outline-none focus:ring-1 focus:ring-ring",
2378
+ "disabled:cursor-not-allowed disabled:opacity-50",
2379
+ "[&>option]:bg-background",
2380
+ t
2381
+ ),
2382
+ ...o,
2383
+ children: n
2384
+ }
2385
+ )
2386
+ );
2387
+ ge.displayName = "Select";
2388
+ const de = Ae(({ className: t, ...n }, o) => /* @__PURE__ */ e(
2389
+ "label",
2390
+ {
2391
+ ref: o,
2392
+ className: m(
2393
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
2394
+ t
2395
+ ),
2396
+ ...n
2397
+ }
2398
+ ));
2399
+ de.displayName = "Label";
2400
+ function En({ className: t }) {
2401
+ return /* @__PURE__ */ r(
2402
+ "svg",
2403
+ {
2404
+ className: t,
2405
+ xmlns: "http://www.w3.org/2000/svg",
2406
+ width: "24",
2407
+ height: "24",
2408
+ viewBox: "0 0 24 24",
2409
+ fill: "none",
2410
+ stroke: "currentColor",
2411
+ strokeWidth: "2",
2412
+ strokeLinecap: "round",
2413
+ strokeLinejoin: "round",
2414
+ children: [
2415
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2416
+ /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2417
+ /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2418
+ ]
2419
+ }
2420
+ );
2421
+ }
2422
+ function Ln({ className: t }) {
2423
+ return /* @__PURE__ */ r(
2424
+ "svg",
2425
+ {
2426
+ className: t,
2427
+ xmlns: "http://www.w3.org/2000/svg",
2428
+ width: "24",
2429
+ height: "24",
2430
+ viewBox: "0 0 24 24",
2431
+ fill: "none",
2432
+ stroke: "currentColor",
2433
+ strokeWidth: "2",
2434
+ strokeLinecap: "round",
2435
+ strokeLinejoin: "round",
2436
+ children: [
2437
+ /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2438
+ /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2439
+ ]
2440
+ }
2441
+ );
2442
+ }
2443
+ const Tn = [
2444
+ { value: 15, label: "15 minutes" },
2445
+ { value: 30, label: "30 minutes" },
2446
+ { value: 60, label: "1 hour" }
2447
+ ];
2448
+ function Cr({
2449
+ value: t,
2450
+ onChange: n,
2451
+ isLocked: o = !1,
2452
+ className: s,
2453
+ labels: a = {}
2454
+ }) {
2455
+ const i = {
2456
+ title: "Slot duration",
2457
+ lockedMessage: "This setting is locked by the administrator",
2458
+ infoMessage: "Set the time slot duration for day and week calendar views.",
2459
+ ...a
2460
+ }, f = (h) => {
2461
+ o || n(Number(h.target.value));
2462
+ };
2463
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col gap-3", s), children: [
2464
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2465
+ /* @__PURE__ */ e(de, { className: "text-sm font-semibold", children: i.title }),
2466
+ o ? /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2467
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(Ln, { className: "size-3 text-muted-foreground" }) }),
2468
+ /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ e("p", { children: i.lockedMessage }) })
2469
+ ] }) }) : /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2470
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(En, { className: "size-3 text-muted-foreground" }) }),
2471
+ /* @__PURE__ */ e(fe, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: i.infoMessage }) })
2472
+ ] }) })
2473
+ ] }),
2474
+ /* @__PURE__ */ e(
2475
+ ge,
2476
+ {
2477
+ value: t.toString(),
2478
+ onChange: f,
2479
+ disabled: o,
2480
+ className: "h-9 w-[128px] text-sm",
2481
+ children: Tn.map((h) => /* @__PURE__ */ e("option", { value: h.value.toString(), children: h.label }, h.value))
2482
+ }
2483
+ )
2484
+ ] });
2485
+ }
2486
+ function Hn({ className: t }) {
2487
+ return /* @__PURE__ */ r(
2488
+ "svg",
2489
+ {
2490
+ className: t,
2491
+ xmlns: "http://www.w3.org/2000/svg",
2492
+ width: "24",
2493
+ height: "24",
2494
+ viewBox: "0 0 24 24",
2495
+ fill: "none",
2496
+ stroke: "currentColor",
2497
+ strokeWidth: "2",
2498
+ strokeLinecap: "round",
2499
+ strokeLinejoin: "round",
2500
+ children: [
2501
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2502
+ /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2503
+ /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2504
+ ]
2505
+ }
2506
+ );
2507
+ }
2508
+ function In({ className: t }) {
2509
+ return /* @__PURE__ */ r(
2510
+ "svg",
2511
+ {
2512
+ className: t,
2513
+ xmlns: "http://www.w3.org/2000/svg",
2514
+ width: "24",
2515
+ height: "24",
2516
+ viewBox: "0 0 24 24",
2517
+ fill: "none",
2518
+ stroke: "currentColor",
2519
+ strokeWidth: "2",
2520
+ strokeLinecap: "round",
2521
+ strokeLinejoin: "round",
2522
+ children: [
2523
+ /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2524
+ /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2525
+ ]
2526
+ }
2527
+ );
2528
+ }
2529
+ const zn = [
2530
+ { value: "dot", label: "Dot indicator" },
2531
+ { value: "colored", label: "Full color" },
2532
+ { value: "mixed", label: "Mixed" }
2533
+ ];
2534
+ function Mr({
2535
+ value: t,
2536
+ onChange: n,
2537
+ isLocked: o = !1,
2538
+ className: s,
2539
+ labels: a = {}
2540
+ }) {
2541
+ const i = {
2542
+ title: "Event display",
2543
+ lockedMessage: "This setting is locked by the administrator",
2544
+ infoMessage: "Choose how events are displayed. Dot shows a small indicator, colored fills the entire event, mixed uses both.",
2545
+ options: {
2546
+ dot: "Dot indicator",
2547
+ colored: "Full color",
2548
+ mixed: "Mixed"
2549
+ },
2550
+ ...a
2551
+ }, f = (d) => i.options?.[d] ?? d, h = (d) => {
2552
+ o || n(d.target.value);
2553
+ };
2554
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col gap-3", s), children: [
2555
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2556
+ /* @__PURE__ */ e(de, { className: "text-sm font-semibold", children: i.title }),
2557
+ o ? /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2558
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(In, { className: "size-3 text-muted-foreground" }) }),
2559
+ /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ e("p", { children: i.lockedMessage }) })
2560
+ ] }) }) : /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2561
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(Hn, { className: "size-3 text-muted-foreground" }) }),
2562
+ /* @__PURE__ */ e(fe, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: i.infoMessage }) })
2563
+ ] }) })
2564
+ ] }),
2565
+ /* @__PURE__ */ e(
2566
+ ge,
2567
+ {
2568
+ value: t,
2569
+ onChange: h,
2570
+ disabled: o,
2571
+ className: "h-9 w-[128px] text-sm",
2572
+ children: zn.map((d) => /* @__PURE__ */ e("option", { value: d.value, children: f(d.value) }, d.value))
2573
+ }
2574
+ )
2575
+ ] });
2576
+ }
2577
+ function jn({ className: t }) {
2578
+ return /* @__PURE__ */ r(
2579
+ "svg",
2580
+ {
2581
+ className: t,
2582
+ xmlns: "http://www.w3.org/2000/svg",
2583
+ width: "24",
2584
+ height: "24",
2585
+ viewBox: "0 0 24 24",
2586
+ fill: "none",
2587
+ stroke: "currentColor",
2588
+ strokeWidth: "2",
2589
+ strokeLinecap: "round",
2590
+ strokeLinejoin: "round",
2591
+ children: [
2592
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2593
+ /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2594
+ /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2595
+ ]
2596
+ }
2597
+ );
2598
+ }
2599
+ function An({ className: t }) {
2600
+ return /* @__PURE__ */ r(
2601
+ "svg",
2602
+ {
2603
+ className: t,
2604
+ xmlns: "http://www.w3.org/2000/svg",
2605
+ width: "24",
2606
+ height: "24",
2607
+ viewBox: "0 0 24 24",
2608
+ fill: "none",
2609
+ stroke: "currentColor",
2610
+ strokeWidth: "2",
2611
+ strokeLinecap: "round",
2612
+ strokeLinejoin: "round",
2613
+ children: [
2614
+ /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2615
+ /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2616
+ ]
2617
+ }
2618
+ );
2619
+ }
2620
+ function Pn() {
2621
+ return Array.from({ length: 25 }, (t, n) => ({
2622
+ value: n,
2623
+ label: `${String(n).padStart(2, "0")}:00`
2624
+ }));
2625
+ }
2626
+ function Sr({
2627
+ value: t,
2628
+ onChange: n,
2629
+ isLocked: o = !1,
2630
+ className: s,
2631
+ labels: a = {}
2632
+ }) {
2633
+ const i = {
2634
+ title: "Visible hours",
2635
+ from: "From",
2636
+ to: "To",
2637
+ lockedMessage: "This setting is locked by the administrator",
2638
+ infoMessage: "Set the visible hour range for day and week views. Hours outside this range will be hidden.",
2639
+ ...a
2640
+ }, f = Pn(), h = (w) => {
2641
+ if (o) return;
2642
+ const k = Number(w.target.value);
2643
+ k < t.endHour && n({ ...t, startHour: k });
2644
+ }, d = (w) => {
2645
+ if (o) return;
2646
+ const k = Number(w.target.value);
2647
+ k > t.startHour && n({ ...t, endHour: k });
2648
+ };
2649
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col gap-3", s), children: [
2650
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2651
+ /* @__PURE__ */ e(de, { className: "text-sm font-semibold", children: i.title }),
2652
+ o ? /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2653
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(An, { className: "size-3 text-muted-foreground" }) }),
2654
+ /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ e("p", { children: i.lockedMessage }) })
2655
+ ] }) }) : /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2656
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(jn, { className: "size-3 text-muted-foreground" }) }),
2657
+ /* @__PURE__ */ e(fe, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: i.infoMessage }) })
2658
+ ] }) })
2659
+ ] }),
2660
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2661
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
2662
+ /* @__PURE__ */ e(de, { className: "text-xs text-muted-foreground", children: i.from }),
2663
+ /* @__PURE__ */ e(
2664
+ ge,
2665
+ {
2666
+ value: t.startHour.toString(),
2667
+ onChange: h,
2668
+ disabled: o,
2669
+ className: "h-9 w-[88px] text-sm",
2670
+ children: f.map((w) => /* @__PURE__ */ e(
2671
+ "option",
2672
+ {
2673
+ value: w.value.toString(),
2674
+ disabled: w.value >= t.endHour,
2675
+ children: w.label
2676
+ },
2677
+ w.value
2678
+ ))
2679
+ }
2680
+ )
2681
+ ] }),
2682
+ /* @__PURE__ */ e("span", { className: "mt-5 text-muted-foreground", children: "—" }),
2683
+ /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
2684
+ /* @__PURE__ */ e(de, { className: "text-xs text-muted-foreground", children: i.to }),
2685
+ /* @__PURE__ */ e(
2686
+ ge,
2687
+ {
2688
+ value: t.endHour.toString(),
2689
+ onChange: d,
2690
+ disabled: o,
2691
+ className: "h-9 w-[88px] text-sm",
2692
+ children: f.map((w) => /* @__PURE__ */ e(
2693
+ "option",
2694
+ {
2695
+ value: w.value.toString(),
2696
+ disabled: w.value <= t.startHour,
2697
+ children: w.label
2698
+ },
2699
+ w.value
2700
+ ))
2701
+ }
2702
+ )
2703
+ ] })
2704
+ ] })
2705
+ ] });
2706
+ }
2707
+ function Wn({ className: t }) {
2708
+ return /* @__PURE__ */ r(
2709
+ "svg",
2710
+ {
2711
+ className: t,
2712
+ xmlns: "http://www.w3.org/2000/svg",
2713
+ width: "24",
2714
+ height: "24",
2715
+ viewBox: "0 0 24 24",
2716
+ fill: "none",
2717
+ stroke: "currentColor",
2718
+ strokeWidth: "2",
2719
+ strokeLinecap: "round",
2720
+ strokeLinejoin: "round",
2721
+ children: [
2722
+ /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2723
+ /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2724
+ /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2725
+ ]
2726
+ }
2727
+ );
2728
+ }
2729
+ function $n({ className: t }) {
2730
+ return /* @__PURE__ */ r(
2731
+ "svg",
2732
+ {
2733
+ className: t,
2734
+ xmlns: "http://www.w3.org/2000/svg",
2735
+ width: "24",
2736
+ height: "24",
2737
+ viewBox: "0 0 24 24",
2738
+ fill: "none",
2739
+ stroke: "currentColor",
2740
+ strokeWidth: "2",
2741
+ strokeLinecap: "round",
2742
+ strokeLinejoin: "round",
2743
+ children: [
2744
+ /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2745
+ /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2746
+ ]
2747
+ }
2748
+ );
2749
+ }
2750
+ function Fn({ className: t }) {
2751
+ return /* @__PURE__ */ e(
2752
+ "svg",
2753
+ {
2754
+ className: t,
2755
+ xmlns: "http://www.w3.org/2000/svg",
2756
+ width: "24",
2757
+ height: "24",
2758
+ viewBox: "0 0 24 24",
2759
+ fill: "none",
2760
+ stroke: "currentColor",
2761
+ strokeWidth: "2",
2762
+ strokeLinecap: "round",
2763
+ strokeLinejoin: "round",
2764
+ children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
2765
+ }
2766
+ );
2767
+ }
2768
+ const On = [
2769
+ "monday",
2770
+ "tuesday",
2771
+ "wednesday",
2772
+ "thursday",
2773
+ "friday",
2774
+ "saturday",
2775
+ "sunday"
2776
+ ];
2777
+ function _n() {
2778
+ return Array.from({ length: 25 }, (t, n) => ({
2779
+ value: n,
2780
+ label: `${String(n).padStart(2, "0")}:00`
2781
+ }));
2782
+ }
2783
+ const nt = {
2784
+ sunday: "Sun",
2785
+ monday: "Mon",
2786
+ tuesday: "Tue",
2787
+ wednesday: "Wed",
2788
+ thursday: "Thu",
2789
+ friday: "Fri",
2790
+ saturday: "Sat"
2791
+ };
2792
+ function Bn({ dayLabel: t, config: n, onChange: o, disabled: s, hourOptions: a }) {
2793
+ const i = () => {
2794
+ s || o({ ...n, enabled: !n.enabled });
2795
+ }, f = (d) => {
2796
+ if (s) return;
2797
+ const w = Number(d.target.value);
2798
+ w < n.to && o({ ...n, from: w });
2799
+ }, h = (d) => {
2800
+ if (s) return;
2801
+ const w = Number(d.target.value);
2802
+ w > n.from && o({ ...n, to: w });
2803
+ };
2804
+ return /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2805
+ /* @__PURE__ */ e(
2806
+ "button",
2807
+ {
2808
+ type: "button",
2809
+ role: "checkbox",
2810
+ "aria-checked": n.enabled,
2811
+ "aria-label": `Enable ${t}`,
2812
+ onClick: i,
2813
+ disabled: s,
2814
+ className: m(
2815
+ "flex size-5 shrink-0 items-center justify-center rounded border transition-colors",
2816
+ n.enabled ? "border-primary bg-primary text-primary-foreground" : "border-input bg-background",
2817
+ s && "cursor-not-allowed opacity-50"
2818
+ ),
2819
+ children: n.enabled && /* @__PURE__ */ e(Fn, { className: "size-3" })
2820
+ }
2821
+ ),
2822
+ /* @__PURE__ */ e("span", { className: m("w-10 text-sm", !n.enabled && "text-muted-foreground"), children: t }),
2823
+ /* @__PURE__ */ e(
2824
+ ge,
2825
+ {
2826
+ value: n.from.toString(),
2827
+ onChange: f,
2828
+ disabled: s || !n.enabled,
2829
+ className: "h-8 w-[76px] text-xs",
2830
+ children: a.map((d) => /* @__PURE__ */ e("option", { value: d.value.toString(), disabled: d.value >= n.to, children: d.label }, d.value))
2831
+ }
2832
+ ),
2833
+ /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "—" }),
2834
+ /* @__PURE__ */ e(
2835
+ ge,
2836
+ {
2837
+ value: n.to.toString(),
2838
+ onChange: h,
2839
+ disabled: s || !n.enabled,
2840
+ className: "h-8 w-[76px] text-xs",
2841
+ children: a.map((d) => /* @__PURE__ */ e("option", { value: d.value.toString(), disabled: d.value <= n.from, children: d.label }, d.value))
2842
+ }
2843
+ )
2844
+ ] });
2845
+ }
2846
+ function Er({
2847
+ value: t,
2848
+ onChange: n,
2849
+ isLocked: o = !1,
2850
+ className: s,
2851
+ labels: a = {}
2852
+ }) {
2853
+ const i = {
2854
+ title: "Working hours",
2855
+ lockedMessage: "This setting is locked by the administrator",
2856
+ infoMessage: "Configure working hours for each day of the week. Non-working hours will be grayed out in day and week views.",
2857
+ days: nt,
2858
+ ...a
2859
+ }, f = _n(), h = (d, w) => {
2860
+ o || n({ ...t, [d]: w });
2861
+ };
2862
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col gap-3", s), children: [
2863
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2864
+ /* @__PURE__ */ e(de, { className: "text-sm font-semibold", children: i.title }),
2865
+ o ? /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2866
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e($n, { className: "size-3 text-muted-foreground" }) }),
2867
+ /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ e("p", { children: i.lockedMessage }) })
2868
+ ] }) }) : /* @__PURE__ */ e(ue, { delayDuration: 100, children: /* @__PURE__ */ r(he, { children: [
2869
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(Wn, { className: "size-3 text-muted-foreground" }) }),
2870
+ /* @__PURE__ */ e(fe, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: i.infoMessage }) })
2871
+ ] }) })
2872
+ ] }),
2873
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: On.map((d) => /* @__PURE__ */ e(
2874
+ Bn,
2875
+ {
2876
+ dayLabel: i.days?.[d] ?? nt[d],
2877
+ config: t[d],
2878
+ onChange: (w) => h(d, w),
2879
+ disabled: o,
2880
+ hourOptions: f
2881
+ },
2882
+ d
2883
+ )) })
2884
+ ] });
2885
+ }
2886
+ const Lr = {
2887
+ sunday: { enabled: !1, from: 8, to: 18 },
2888
+ monday: { enabled: !0, from: 8, to: 18 },
2889
+ tuesday: { enabled: !0, from: 8, to: 18 },
2890
+ wednesday: { enabled: !0, from: 8, to: 18 },
2891
+ thursday: { enabled: !0, from: 8, to: 18 },
2892
+ friday: { enabled: !0, from: 8, to: 18 },
2893
+ saturday: { enabled: !1, from: 8, to: 18 }
2894
+ };
2895
+ function Oe({ className: t }) {
2896
+ return /* @__PURE__ */ e(
2897
+ "svg",
2898
+ {
2899
+ className: t,
2900
+ xmlns: "http://www.w3.org/2000/svg",
2901
+ viewBox: "0 0 24 24",
2902
+ fill: "none",
2903
+ stroke: "currentColor",
2904
+ strokeWidth: "3",
2905
+ strokeLinecap: "round",
2906
+ strokeLinejoin: "round",
2907
+ children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" })
2908
+ }
2909
+ );
2910
+ }
2911
+ function Rn({ className: t }) {
2912
+ return /* @__PURE__ */ r(
2913
+ "svg",
2914
+ {
2915
+ className: t,
2916
+ xmlns: "http://www.w3.org/2000/svg",
2917
+ viewBox: "0 0 24 24",
2918
+ fill: "none",
2919
+ stroke: "currentColor",
2920
+ strokeWidth: "2",
2921
+ strokeLinecap: "round",
2922
+ strokeLinejoin: "round",
2923
+ children: [
2924
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
2925
+ /* @__PURE__ */ e("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
2926
+ ]
2927
+ }
2928
+ );
2929
+ }
2930
+ function Un({ className: t }) {
2931
+ return /* @__PURE__ */ r(
2932
+ "svg",
2933
+ {
2934
+ className: t,
2935
+ xmlns: "http://www.w3.org/2000/svg",
2936
+ viewBox: "0 0 24 24",
2937
+ fill: "none",
2938
+ stroke: "currentColor",
2939
+ strokeWidth: "2",
2940
+ strokeLinecap: "round",
2941
+ strokeLinejoin: "round",
2942
+ children: [
2943
+ /* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2944
+ /* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2945
+ ]
2946
+ }
2947
+ );
2948
+ }
2949
+ function _e({ checked: t, onCheckedChange: n, className: o, children: s }) {
2950
+ return /* @__PURE__ */ e(
2951
+ "button",
2952
+ {
2953
+ type: "button",
2954
+ role: "checkbox",
2955
+ "aria-checked": t,
2956
+ onClick: () => n(!t),
2957
+ className: o,
2958
+ children: s
2959
+ }
2960
+ );
2961
+ }
2962
+ function Vn({ src: t, alt: n, fallback: o, className: s }) {
2963
+ const [a, i] = oe(!1);
2964
+ return !t || a ? /* @__PURE__ */ e(
2965
+ "div",
2966
+ {
2967
+ className: m(
2968
+ "flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",
2969
+ s
2970
+ ),
2971
+ children: o || "?"
2972
+ }
2973
+ ) : /* @__PURE__ */ e(
2974
+ "img",
2975
+ {
2976
+ src: t,
2977
+ alt: n || "",
2978
+ className: m("object-cover", s),
2979
+ onError: () => i(!0)
2980
+ }
2981
+ );
2982
+ }
2983
+ function rt({ value: t, onChange: n, placeholder: o, className: s }) {
2984
+ return /* @__PURE__ */ r("div", { className: m("relative", s), children: [
2985
+ /* @__PURE__ */ e(Rn, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
2986
+ /* @__PURE__ */ e(
2987
+ "input",
2988
+ {
2989
+ type: "text",
2990
+ value: t,
2991
+ onChange: (a) => n(a.target.value),
2992
+ placeholder: o,
2993
+ 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"
2994
+ }
2995
+ )
2996
+ ] });
2997
+ }
2998
+ function ot(t, n, o, s = 0.3) {
2999
+ if (!n.trim()) return t;
3000
+ const a = n.toLowerCase();
3001
+ return t.filter((i) => o(i).some((h) => h ? h.toLowerCase().includes(a) : !1));
3002
+ }
3003
+ const Yn = {
3004
+ title: "Filters",
3005
+ subtitle: "Filter calendar events",
3006
+ scheduleTypes: "Event Types",
3007
+ participants: "Participants",
3008
+ clearAll: "Clear all",
3009
+ selectAll: "Select all",
3010
+ unselectAll: "Unselect all",
3011
+ searchScheduleTypes: "Search event types...",
3012
+ searchParticipants: "Search participants...",
3013
+ noScheduleTypes: "No event types found",
3014
+ noParticipants: "No participants found"
3015
+ };
3016
+ function Tr({
3017
+ scheduleTypes: t,
3018
+ users: n,
3019
+ selectedScheduleTypeIds: o,
3020
+ onScheduleTypeChange: s,
3021
+ selectedUserIds: a,
3022
+ onUserChange: i,
3023
+ onClearAll: f,
3024
+ className: h,
3025
+ scheduleTypesLoading: d = !1,
3026
+ usersLoading: w = !1,
3027
+ labels: k,
3028
+ getScheduleTypeName: b
3029
+ }) {
3030
+ const I = { ...Yn, ...k }, [F, P] = oe(""), [W, E] = oe(""), y = X(() => F.trim() ? ot(t, F, (c) => [
3031
+ c.name,
3032
+ b?.(c) || c.name
3033
+ ]) : t, [t, F, b]), A = X(() => W.trim() ? ot(n, W, (c) => [c.name, c.email || ""]) : n, [n, W]), O = y.length > 0 && y.every((c) => o.includes(c.id)), R = A.length > 0 && A.every((c) => a.includes(c.id)), C = o.length + a.length, _ = (c, g) => {
3034
+ const L = g ? [...o, c] : o.filter((B) => B !== c);
3035
+ s(L);
3036
+ }, z = () => {
3037
+ if (O) {
3038
+ const c = new Set(y.map((g) => g.id));
3039
+ s(o.filter((g) => !c.has(g)));
3040
+ } else {
3041
+ const c = /* @__PURE__ */ new Set([
3042
+ ...o,
3043
+ ...y.map((g) => g.id)
3044
+ ]);
3045
+ s(Array.from(c));
3046
+ }
3047
+ }, j = (c, g) => {
3048
+ const L = g ? [...a, c] : a.filter((B) => B !== c);
3049
+ i(L);
3050
+ }, V = () => {
3051
+ if (R) {
3052
+ const c = new Set(A.map((g) => g.id));
3053
+ i(a.filter((g) => !c.has(g)));
3054
+ } else {
3055
+ const c = /* @__PURE__ */ new Set([...a, ...A.map((g) => g.id)]);
3056
+ i(Array.from(c));
3057
+ }
3058
+ }, K = () => {
3059
+ s([]), i([]), f?.();
3060
+ }, Y = (c) => b ? b(c) : c.name, x = (c) => c.colorHex || c.color || "#069AD7";
3061
+ return /* @__PURE__ */ r(
3062
+ "div",
3063
+ {
3064
+ className: m(
3065
+ "flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",
3066
+ h
3067
+ ),
3068
+ children: [
3069
+ /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-2 px-4 pb-2 pt-4", children: [
3070
+ /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
3071
+ /* @__PURE__ */ e("h3", { className: "text-base font-semibold text-foreground", children: I.title }),
3072
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: I.subtitle })
3073
+ ] }),
3074
+ C > 0 && /* @__PURE__ */ r(
3075
+ "button",
3076
+ {
3077
+ type: "button",
3078
+ onClick: K,
3079
+ 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",
3080
+ children: [
3081
+ /* @__PURE__ */ e(Un, { className: "h-3.5 w-3.5" }),
3082
+ I.clearAll
3083
+ ]
3084
+ }
3085
+ )
3086
+ ] }),
3087
+ /* @__PURE__ */ e("div", { className: "h-px w-full bg-border/60" }),
3088
+ /* @__PURE__ */ r("section", { className: "flex flex-col", children: [
3089
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between px-4 py-3", children: [
3090
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-foreground", children: I.scheduleTypes }),
3091
+ /* @__PURE__ */ e(
3092
+ "button",
3093
+ {
3094
+ type: "button",
3095
+ onClick: z,
3096
+ className: "text-xs font-medium text-primary transition-colors hover:text-primary/80",
3097
+ children: O ? I.unselectAll : I.selectAll
3098
+ }
3099
+ )
3100
+ ] }),
3101
+ t.length > 6 && /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
3102
+ rt,
3103
+ {
3104
+ value: F,
3105
+ onChange: P,
3106
+ placeholder: I.searchScheduleTypes
3107
+ }
3108
+ ) }),
3109
+ /* @__PURE__ */ r("div", { className: "flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin", children: [
3110
+ d ? (
3111
+ // Loading skeletons
3112
+ Array.from({ length: 4 }).map((c, g) => /* @__PURE__ */ r(
3113
+ "div",
3114
+ {
3115
+ className: "flex animate-pulse items-center gap-2 rounded-md border border-border/60 bg-muted/40 p-2",
3116
+ children: [
3117
+ /* @__PURE__ */ e("div", { className: "h-5 w-5 rounded bg-muted-foreground/20" }),
3118
+ /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-muted-foreground/20" })
3119
+ ]
3120
+ },
3121
+ `skeleton-${g}`
3122
+ ))
3123
+ ) : y.map((c) => {
3124
+ const g = o.includes(c.id), L = x(c);
3125
+ return /* @__PURE__ */ r(
3126
+ _e,
3127
+ {
3128
+ checked: g,
3129
+ onCheckedChange: (B) => _(c.id, B),
3130
+ className: m(
3131
+ "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",
3132
+ g && "border-primary bg-primary/5"
3133
+ ),
3134
+ children: [
3135
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
3136
+ /* @__PURE__ */ e(
3137
+ "span",
3138
+ {
3139
+ className: m(
3140
+ "flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",
3141
+ g && "border-primary bg-primary text-primary-foreground"
3142
+ ),
3143
+ children: g && /* @__PURE__ */ e(Oe, { className: "h-3 w-3" })
3144
+ }
3145
+ ),
3146
+ /* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: Y(c) })
3147
+ ] }),
3148
+ /* @__PURE__ */ e(
3149
+ "div",
3150
+ {
3151
+ className: "h-4 w-4 rounded-full border",
3152
+ style: {
3153
+ backgroundColor: L,
3154
+ borderColor: L
3155
+ }
3156
+ }
3157
+ )
3158
+ ]
3159
+ },
3160
+ c.id
3161
+ );
3162
+ }),
3163
+ !d && y.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: I.noScheduleTypes })
3164
+ ] })
3165
+ ] }),
3166
+ /* @__PURE__ */ e("div", { className: "h-px w-full bg-border/60" }),
3167
+ /* @__PURE__ */ r("section", { className: "flex flex-col", children: [
3168
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between px-4 py-3", children: [
3169
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-foreground", children: I.participants }),
3170
+ /* @__PURE__ */ e(
3171
+ _e,
3172
+ {
3173
+ checked: R,
3174
+ onCheckedChange: () => V(),
3175
+ className: m(
3176
+ "flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",
3177
+ R && "border-primary bg-primary text-primary-foreground"
3178
+ ),
3179
+ children: R && /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" })
3180
+ }
3181
+ )
3182
+ ] }),
3183
+ /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
3184
+ rt,
3185
+ {
3186
+ value: W,
3187
+ onChange: E,
3188
+ placeholder: I.searchParticipants
3189
+ }
3190
+ ) }),
3191
+ /* @__PURE__ */ r("div", { className: "flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin", children: [
3192
+ w ? (
3193
+ // Loading skeletons
3194
+ Array.from({ length: 4 }).map((c, g) => /* @__PURE__ */ r(
3195
+ "div",
3196
+ {
3197
+ className: "flex animate-pulse items-center gap-3 rounded-md border border-border/60 bg-muted/40 p-3",
3198
+ children: [
3199
+ /* @__PURE__ */ e("div", { className: "h-5 w-5 rounded bg-muted-foreground/20" }),
3200
+ /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded-full bg-muted-foreground/20" }),
3201
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
3202
+ /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-muted-foreground/20" }),
3203
+ /* @__PURE__ */ e("div", { className: "h-2 w-32 rounded bg-muted-foreground/10" })
3204
+ ] })
3205
+ ]
3206
+ },
3207
+ `p-skeleton-${g}`
3208
+ ))
3209
+ ) : A.map((c) => {
3210
+ const g = a.includes(c.id);
3211
+ return /* @__PURE__ */ r(
3212
+ _e,
3213
+ {
3214
+ checked: g,
3215
+ onCheckedChange: (L) => j(c.id, L),
3216
+ className: m(
3217
+ "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",
3218
+ g && "border-primary bg-zinc-50"
3219
+ ),
3220
+ children: [
3221
+ /* @__PURE__ */ e(
3222
+ "span",
3223
+ {
3224
+ className: m(
3225
+ "flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",
3226
+ g && "border-primary bg-primary text-primary-foreground"
3227
+ ),
3228
+ children: g && /* @__PURE__ */ e(Oe, { className: "h-2.5 w-2.5" })
3229
+ }
3230
+ ),
3231
+ /* @__PURE__ */ r("div", { className: "flex flex-1 items-start gap-2", children: [
3232
+ /* @__PURE__ */ e(
3233
+ Vn,
3234
+ {
3235
+ src: c.avatar ?? null,
3236
+ alt: c.name,
3237
+ fallback: c.name?.[0]?.toUpperCase() ?? "?",
3238
+ className: "h-10 w-10 rounded-lg"
3239
+ }
3240
+ ),
3241
+ /* @__PURE__ */ r("div", { className: "flex max-w-[140px] flex-col gap-0.5 overflow-hidden", children: [
3242
+ /* @__PURE__ */ e("span", { className: "line-clamp-1 text-sm font-medium text-foreground", children: c.name }),
3243
+ /* @__PURE__ */ e(
3244
+ "span",
3245
+ {
3246
+ className: "truncate text-[11px] text-muted-foreground",
3247
+ title: c.email,
3248
+ children: c.email
3249
+ }
3250
+ )
3251
+ ] })
3252
+ ] })
3253
+ ]
3254
+ },
3255
+ c.id
3256
+ );
3257
+ }),
3258
+ !w && A.length === 0 && /* @__PURE__ */ e("p", { className: "px-4 text-xs text-muted-foreground", children: I.noParticipants })
3259
+ ] })
3260
+ ] })
3261
+ ]
3262
+ }
3263
+ );
3264
+ }
3265
+ function Kn({ className: t }) {
3266
+ return /* @__PURE__ */ r(
3267
+ "svg",
3268
+ {
3269
+ className: t,
3270
+ xmlns: "http://www.w3.org/2000/svg",
3271
+ width: "24",
3272
+ height: "24",
3273
+ viewBox: "0 0 24 24",
3274
+ fill: "none",
3275
+ stroke: "currentColor",
3276
+ strokeWidth: "2",
3277
+ strokeLinecap: "round",
3278
+ strokeLinejoin: "round",
3279
+ children: [
3280
+ /* @__PURE__ */ e("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" }),
3281
+ /* @__PURE__ */ e("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
3282
+ ]
3283
+ }
3284
+ );
3285
+ }
3286
+ function Hr({
3287
+ scheduleTypes: t,
3288
+ value: n,
3289
+ onChange: o,
3290
+ allLabel: s = "All types",
3291
+ className: a,
3292
+ label: i
3293
+ }) {
3294
+ const f = (d) => {
3295
+ o(d.target.value);
3296
+ }, h = t.find((d) => String(d.id) === n);
3297
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col gap-1", a), children: [
3298
+ i && /* @__PURE__ */ e(de, { className: "text-xs text-muted-foreground", children: i }),
3299
+ /* @__PURE__ */ r("div", { className: "relative", children: [
3300
+ h ? /* @__PURE__ */ e(
3301
+ "span",
3302
+ {
3303
+ className: "pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",
3304
+ style: { backgroundColor: h.color }
3305
+ }
3306
+ ) : /* @__PURE__ */ e(Kn, { className: "pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3307
+ /* @__PURE__ */ r(
3308
+ ge,
3309
+ {
3310
+ value: n,
3311
+ onChange: f,
3312
+ className: "h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",
3313
+ children: [
3314
+ /* @__PURE__ */ e("option", { value: "all", children: s }),
3315
+ t.map((d) => /* @__PURE__ */ e("option", { value: String(d.id), children: d.label }, d.id))
3316
+ ]
3317
+ }
3318
+ )
3319
+ ] })
3320
+ ] });
3321
+ }
3322
+ function Gn({ className: t }) {
3323
+ return /* @__PURE__ */ r(
3324
+ "svg",
3325
+ {
3326
+ className: t,
3327
+ xmlns: "http://www.w3.org/2000/svg",
3328
+ width: "24",
3329
+ height: "24",
3330
+ viewBox: "0 0 24 24",
3331
+ fill: "none",
3332
+ stroke: "currentColor",
3333
+ strokeWidth: "2",
3334
+ strokeLinecap: "round",
3335
+ strokeLinejoin: "round",
3336
+ children: [
3337
+ /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
3338
+ /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
3339
+ /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
3340
+ /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
3341
+ ]
3342
+ }
3343
+ );
3344
+ }
3345
+ function Ir({
3346
+ users: t,
3347
+ value: n,
3348
+ onChange: o,
3349
+ allLabel: s = "All users",
3350
+ className: a,
3351
+ label: i
3352
+ }) {
3353
+ const f = (h) => {
3354
+ o(h.target.value);
3355
+ };
3356
+ return /* @__PURE__ */ r("div", { className: m("flex flex-col gap-1", a), children: [
3357
+ i && /* @__PURE__ */ e(de, { className: "text-xs text-muted-foreground", children: i }),
3358
+ /* @__PURE__ */ r("div", { className: "relative", children: [
3359
+ /* @__PURE__ */ e(Gn, { className: "pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3360
+ /* @__PURE__ */ r(
3361
+ ge,
3362
+ {
3363
+ value: n,
3364
+ onChange: f,
3365
+ className: "h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",
3366
+ children: [
3367
+ /* @__PURE__ */ e("option", { value: "all", children: s }),
3368
+ t.map((h) => /* @__PURE__ */ e("option", { value: h.id, children: h.name }, h.id))
3369
+ ]
3370
+ }
3371
+ )
3372
+ ] })
3373
+ ] });
3374
+ }
3375
+ function Jn({ className: t }) {
3376
+ return /* @__PURE__ */ r(
3377
+ "svg",
3378
+ {
3379
+ xmlns: "http://www.w3.org/2000/svg",
3380
+ viewBox: "0 0 24 24",
3381
+ fill: "none",
3382
+ stroke: "currentColor",
3383
+ strokeWidth: 1.8,
3384
+ strokeLinecap: "round",
3385
+ strokeLinejoin: "round",
3386
+ className: t,
3387
+ children: [
3388
+ /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3389
+ /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3390
+ /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
3391
+ /* @__PURE__ */ e("path", { d: "M3 10h18" }),
3392
+ /* @__PURE__ */ e("path", { d: "M8 14h.01" }),
3393
+ /* @__PURE__ */ e("path", { d: "M12 14h.01" }),
3394
+ /* @__PURE__ */ e("path", { d: "M16 14h.01" }),
3395
+ /* @__PURE__ */ e("path", { d: "M8 18h.01" }),
3396
+ /* @__PURE__ */ e("path", { d: "M12 18h.01" }),
3397
+ /* @__PURE__ */ e("path", { d: "M16 18h.01" })
3398
+ ]
3399
+ }
3400
+ );
3401
+ }
3402
+ function qn({ className: t }) {
3403
+ return /* @__PURE__ */ r(
3404
+ "svg",
3405
+ {
3406
+ xmlns: "http://www.w3.org/2000/svg",
3407
+ viewBox: "0 0 24 24",
3408
+ fill: "none",
3409
+ stroke: "currentColor",
3410
+ strokeWidth: 2,
3411
+ strokeLinecap: "round",
3412
+ strokeLinejoin: "round",
3413
+ className: t,
3414
+ children: [
3415
+ /* @__PURE__ */ e("path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }),
3416
+ /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3417
+ /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3418
+ /* @__PURE__ */ e("path", { d: "M3 10h5" }),
3419
+ /* @__PURE__ */ e("path", { d: "M17.5 17.5 16 16.3V14" }),
3420
+ /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "6" })
3421
+ ]
3422
+ }
3423
+ );
3424
+ }
3425
+ function Xn({ className: t }) {
3426
+ return /* @__PURE__ */ e(
3427
+ "svg",
3428
+ {
3429
+ xmlns: "http://www.w3.org/2000/svg",
3430
+ viewBox: "0 0 24 24",
3431
+ fill: "none",
3432
+ stroke: "currentColor",
3433
+ strokeWidth: 2,
3434
+ strokeLinecap: "round",
3435
+ strokeLinejoin: "round",
3436
+ className: t,
3437
+ children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
3438
+ }
3439
+ );
3440
+ }
3441
+ function Qn({ className: t }) {
3442
+ return /* @__PURE__ */ r(
3443
+ "svg",
3444
+ {
3445
+ xmlns: "http://www.w3.org/2000/svg",
3446
+ viewBox: "0 0 24 24",
3447
+ fill: "none",
3448
+ stroke: "currentColor",
3449
+ strokeWidth: 2,
3450
+ strokeLinecap: "round",
3451
+ strokeLinejoin: "round",
3452
+ className: t,
3453
+ children: [
3454
+ /* @__PURE__ */ e("path", { d: "M15 3h6v6" }),
3455
+ /* @__PURE__ */ e("path", { d: "M10 14 21 3" }),
3456
+ /* @__PURE__ */ e("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
3457
+ ]
3458
+ }
3459
+ );
3460
+ }
3461
+ function Zn(t) {
3462
+ const n = t.getFullYear(), o = String(t.getMonth() + 1).padStart(2, "0"), s = String(t.getDate()).padStart(2, "0");
3463
+ return `${n}-${o}-${s}`;
3464
+ }
3465
+ function st(t) {
3466
+ const n = t.getHours(), o = t.getMinutes(), s = n >= 12 ? "PM" : "AM", a = n % 12 || 12, i = String(o).padStart(2, "0");
3467
+ return `${a}:${i} ${s}`;
3468
+ }
3469
+ function er(t) {
3470
+ const n = st(t.startDate), o = st(t.endDate);
3471
+ return `${n} - ${o}`;
3472
+ }
3473
+ function tr(t) {
3474
+ const n = ht(/* @__PURE__ */ new Date(), 1);
3475
+ return t.getFullYear() === n.getFullYear() && t.getMonth() === n.getMonth() && t.getDate() === n.getDate();
3476
+ }
3477
+ function nr(t) {
3478
+ if (ie(t)) return "Today";
3479
+ if (tr(t)) return "Tomorrow";
3480
+ const n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], o = [
3481
+ "Jan",
3482
+ "Feb",
3483
+ "Mar",
3484
+ "Apr",
3485
+ "May",
3486
+ "Jun",
3487
+ "Jul",
3488
+ "Aug",
3489
+ "Sep",
3490
+ "Oct",
3491
+ "Nov",
3492
+ "Dec"
3493
+ ], s = n[t.getDay()], a = o[t.getMonth()], i = t.getDate();
3494
+ return `${s}, ${a} ${i}`;
3495
+ }
3496
+ function rr(t, n) {
3497
+ const o = /* @__PURE__ */ new Map();
3498
+ for (const s of t) {
3499
+ const a = Zn(s.startDate), i = o.get(a) ?? [];
3500
+ i.push(s), o.set(a, i);
3501
+ }
3502
+ return Array.from(o.entries()).map(([s, a]) => {
3503
+ const i = [...a].sort(
3504
+ (h, d) => h.startDate.getTime() - d.startDate.getTime()
3505
+ ), f = n > 0 ? i.slice(0, n) : i;
3506
+ return {
3507
+ date: new Date(s),
3508
+ dateKey: s,
3509
+ events: f,
3510
+ hasMore: n > 0 && i.length > n
3511
+ };
3512
+ }).sort((s, a) => s.date.getTime() - a.date.getTime());
3513
+ }
3514
+ function or(t) {
3515
+ const n = Pe(/* @__PURE__ */ new Date()), o = ut(/* @__PURE__ */ new Date());
3516
+ return t.filter((s) => s.startDate >= n && s.startDate <= o).length;
3517
+ }
3518
+ function Be({ className: t }) {
3519
+ return /* @__PURE__ */ e("div", { className: m("animate-pulse rounded-md bg-muted", t) });
3520
+ }
3521
+ function sr({ event: t, onClick: n }) {
3522
+ return /* @__PURE__ */ r(
3523
+ "button",
3524
+ {
3525
+ type: "button",
3526
+ onClick: () => n?.(t),
3527
+ className: m(
3528
+ "w-full text-left rounded-lg transition-colors",
3529
+ "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3530
+ "flex items-start gap-3 p-2"
3531
+ ),
3532
+ children: [
3533
+ /* @__PURE__ */ e(
3534
+ "div",
3535
+ {
3536
+ className: "shrink-0 rounded-full mt-1.5 size-2",
3537
+ style: { backgroundColor: t.color ?? "#3b82f6" }
3538
+ }
3539
+ ),
3540
+ /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
3541
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium truncate", children: t.title }),
3542
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground truncate", children: er(t) })
3543
+ ] }),
3544
+ n && /* @__PURE__ */ e(Xn, { className: "shrink-0 size-4 text-muted-foreground/50 mt-1" })
3545
+ ]
3546
+ }
3547
+ );
3548
+ }
3549
+ function ar({ group: t, onEventClick: n }) {
3550
+ return /* @__PURE__ */ r("div", { className: "space-y-1", children: [
3551
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between px-2 py-1.5", children: [
3552
+ /* @__PURE__ */ e("h3", { className: m("text-xs font-semibold", ie(t.date) && "text-primary"), children: nr(t.date) }),
3553
+ t.hasMore && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground", children: [
3554
+ "+",
3555
+ t.events.length,
3556
+ " more"
3557
+ ] })
3558
+ ] }),
3559
+ /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t.events.map((o) => /* @__PURE__ */ e(sr, { event: o, onClick: n }, o.id)) })
3560
+ ] });
3561
+ }
3562
+ function zr({
3563
+ events: t,
3564
+ isLoading: n = !1,
3565
+ className: o,
3566
+ daysAhead: s = 7,
3567
+ maxEventsPerDay: a = 3,
3568
+ onEventClick: i,
3569
+ onNavigateToAgenda: f
3570
+ }) {
3571
+ const [h, d] = oe(!1), w = X(() => {
3572
+ const P = Pe(/* @__PURE__ */ new Date()), W = ht(P, s);
3573
+ return t.filter((E) => E.endDate >= P && E.startDate < W);
3574
+ }, [t, s]), k = X(
3575
+ () => rr(w, a),
3576
+ [w, a]
3577
+ ), b = X(() => or(t), [t]), I = (P) => {
3578
+ d(!1), i?.(P);
3579
+ }, F = () => {
3580
+ d(!1), f?.();
3581
+ };
3582
+ return /* @__PURE__ */ r(lt, { open: h, onOpenChange: d, children: [
3583
+ /* @__PURE__ */ r(
3584
+ ct,
3585
+ {
3586
+ className: m(
3587
+ "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",
3588
+ o
3589
+ ),
3590
+ children: [
3591
+ /* @__PURE__ */ e(Jn, { className: "h-4 w-4" }),
3592
+ b > 0 && /* @__PURE__ */ e(
3593
+ Et,
3594
+ {
3595
+ variant: "destructive",
3596
+ 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",
3597
+ children: b > 99 ? "99+" : b
3598
+ }
3599
+ )
3600
+ ]
3601
+ }
3602
+ ),
3603
+ /* @__PURE__ */ r(dt, { className: "w-80 rounded-xl p-0", align: "end", side: "bottom", sideOffset: 8, children: [
3604
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between border-b p-4", children: [
3605
+ /* @__PURE__ */ r("div", { children: [
3606
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: "Upcoming" }),
3607
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: b > 0 ? `${b} event${b > 1 ? "s" : ""} today` : "No events today" })
3608
+ ] }),
3609
+ f && /* @__PURE__ */ r(
3610
+ "button",
3611
+ {
3612
+ type: "button",
3613
+ onClick: F,
3614
+ className: "text-xs text-primary hover:underline flex items-center gap-1",
3615
+ children: [
3616
+ "View all",
3617
+ /* @__PURE__ */ e(Qn, { className: "size-3" })
3618
+ ]
3619
+ }
3620
+ )
3621
+ ] }),
3622
+ /* @__PURE__ */ e("div", { className: "max-h-80 overflow-y-auto p-2", children: n ? /* @__PURE__ */ e("div", { className: "space-y-2 p-2", children: Array.from({ length: 3 }).map((P, W) => /* @__PURE__ */ r("div", { className: "flex space-x-3", children: [
3623
+ /* @__PURE__ */ e(Be, { className: "h-2 w-2 rounded-full mt-2" }),
3624
+ /* @__PURE__ */ r("div", { className: "flex-1 space-y-2", children: [
3625
+ /* @__PURE__ */ e(Be, { className: "h-4 w-full" }),
3626
+ /* @__PURE__ */ e(Be, { className: "h-3 w-3/4" })
3627
+ ] })
3628
+ ] }, W)) }) : k.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
3629
+ /* @__PURE__ */ e(qn, { className: "mb-2 h-8 w-8 text-muted-foreground/50" }),
3630
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "No upcoming events" }),
3631
+ /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground/70", children: [
3632
+ "Your schedule is clear for the next ",
3633
+ s,
3634
+ " days"
3635
+ ] })
3636
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-3 divide-y", children: k.map((P) => /* @__PURE__ */ e(
3637
+ ar,
3638
+ {
3639
+ group: P,
3640
+ onEventClick: I
3641
+ },
3642
+ P.dateKey
3643
+ )) }) })
3644
+ ] })
3645
+ ] });
3646
+ }
3647
+ function ir({ className: t }) {
3648
+ return /* @__PURE__ */ r(
3649
+ "svg",
3650
+ {
3651
+ xmlns: "http://www.w3.org/2000/svg",
3652
+ width: "24",
3653
+ height: "24",
3654
+ viewBox: "0 0 24 24",
3655
+ fill: "none",
3656
+ stroke: "currentColor",
3657
+ strokeWidth: "2",
3658
+ strokeLinecap: "round",
3659
+ strokeLinejoin: "round",
3660
+ className: t,
3661
+ children: [
3662
+ /* @__PURE__ */ e("path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }),
3663
+ /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3664
+ /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3665
+ /* @__PURE__ */ e("path", { d: "M3 10h5" }),
3666
+ /* @__PURE__ */ e("path", { d: "M17.5 17.5 16 16.25V14" }),
3667
+ /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "6" })
3668
+ ]
3669
+ }
3670
+ );
3671
+ }
3672
+ function ft({ className: t }) {
3673
+ return /* @__PURE__ */ e(
3674
+ "svg",
3675
+ {
3676
+ xmlns: "http://www.w3.org/2000/svg",
3677
+ width: "24",
3678
+ height: "24",
3679
+ viewBox: "0 0 24 24",
3680
+ fill: "none",
3681
+ stroke: "currentColor",
3682
+ strokeWidth: "2",
3683
+ strokeLinecap: "round",
3684
+ strokeLinejoin: "round",
3685
+ className: t,
3686
+ children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
3687
+ }
3688
+ );
3689
+ }
3690
+ function lr(t) {
3691
+ const n = /* @__PURE__ */ new Date();
3692
+ return n.setDate(n.getDate() + 1), t.getFullYear() === n.getFullYear() && t.getMonth() === n.getMonth() && t.getDate() === n.getDate();
3693
+ }
3694
+ function at(t) {
3695
+ const n = t.getHours(), o = t.getMinutes(), s = n >= 12 ? "PM" : "AM";
3696
+ return `${n % 12 || 12}:${o.toString().padStart(2, "0")} ${s}`;
3697
+ }
3698
+ function cr(t) {
3699
+ return new Intl.DateTimeFormat("en-US", {
3700
+ weekday: "long",
3701
+ month: "short",
3702
+ day: "numeric"
3703
+ }).format(t);
3704
+ }
3705
+ function dr(t) {
3706
+ const n = at(t.startDate), o = at(t.endDate);
3707
+ return `${n} - ${o}`;
3708
+ }
3709
+ function ur(t) {
3710
+ return ie(t) ? "Today" : lr(t) ? "Tomorrow" : cr(t);
3711
+ }
3712
+ function hr(t, n) {
3713
+ const o = /* @__PURE__ */ new Map();
3714
+ for (const s of t) {
3715
+ const a = Wt(s.startDate), i = o.get(a) ?? [];
3716
+ i.push(s), o.set(a, i);
3717
+ }
3718
+ return Array.from(o.entries()).map(([s, a]) => {
3719
+ const i = [...a].sort(
3720
+ (h, d) => h.startDate.getTime() - d.startDate.getTime()
3721
+ ), f = n > 0 ? i.slice(0, n) : i;
3722
+ return {
3723
+ date: new Date(s),
3724
+ dateKey: s,
3725
+ events: f,
3726
+ hasMore: n > 0 && i.length > n
3727
+ };
3728
+ }).sort((s, a) => s.date.getTime() - a.date.getTime());
3729
+ }
3730
+ function mr({ event: t, onClick: n, compact: o }) {
3731
+ return /* @__PURE__ */ r(
3732
+ "button",
3733
+ {
3734
+ type: "button",
3735
+ onClick: () => n?.(t),
3736
+ className: m(
3737
+ "w-full text-left rounded-lg transition-colors",
3738
+ "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3739
+ "flex items-start gap-3",
3740
+ o ? "p-2" : "p-3"
3741
+ ),
3742
+ children: [
3743
+ /* @__PURE__ */ e(
3744
+ "div",
3745
+ {
3746
+ className: m("shrink-0 rounded-full mt-1", o ? "size-2" : "size-2.5"),
3747
+ style: { backgroundColor: t.color ?? "#3b82f6" }
3748
+ }
3749
+ ),
3750
+ /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
3751
+ /* @__PURE__ */ e("p", { className: m("font-medium truncate", o ? "text-xs" : "text-sm"), children: t.title }),
3752
+ /* @__PURE__ */ e("p", { className: m("text-muted-foreground truncate", o ? "text-[10px]" : "text-xs"), children: dr(t) })
3753
+ ] }),
3754
+ n && /* @__PURE__ */ e(
3755
+ ft,
3756
+ {
3757
+ className: m("shrink-0 text-muted-foreground/50", o ? "size-3" : "size-4")
3758
+ }
3759
+ )
3760
+ ]
3761
+ }
3762
+ );
3763
+ }
3764
+ function fr({
3765
+ group: t,
3766
+ onEventClick: n,
3767
+ onViewMore: o,
3768
+ compact: s
3769
+ }) {
3770
+ return /* @__PURE__ */ r("div", { className: "space-y-1", children: [
3771
+ /* @__PURE__ */ r("div", { className: m("flex items-center justify-between px-2", s ? "py-1" : "py-1.5"), children: [
3772
+ /* @__PURE__ */ e(
3773
+ "h3",
3774
+ {
3775
+ className: m(
3776
+ "font-semibold",
3777
+ s ? "text-xs" : "text-sm",
3778
+ ie(t.date) && "text-primary"
3779
+ ),
3780
+ children: ur(t.date)
3781
+ }
3782
+ ),
3783
+ t.hasMore && o && /* @__PURE__ */ e(
3784
+ "button",
3785
+ {
3786
+ type: "button",
3787
+ onClick: () => o(t.date),
3788
+ className: m("text-primary hover:underline", s ? "text-[10px]" : "text-xs"),
3789
+ children: "+more"
3790
+ }
3791
+ )
3792
+ ] }),
3793
+ /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t.events.map((a) => /* @__PURE__ */ e(mr, { event: a, onClick: n, compact: s }, a.id)) })
3794
+ ] });
3795
+ }
3796
+ function jr({
3797
+ events: t,
3798
+ daysAhead: n = 7,
3799
+ maxEventsPerDay: o = 3,
3800
+ onEventClick: s,
3801
+ onViewAll: a,
3802
+ className: i,
3803
+ emptyState: f,
3804
+ title: h = "Upcoming",
3805
+ showHeader: d = !0,
3806
+ compact: w = !1
3807
+ }) {
3808
+ const k = it(), b = k?.filteredEvents, I = k?.currentDate ?? /* @__PURE__ */ new Date(), F = t ?? b ?? [], P = X(() => {
3809
+ const y = Pe(I), A = new Date(y);
3810
+ return A.setDate(A.getDate() + n), F.filter((O) => O.endDate >= y && O.startDate < A);
3811
+ }, [F, n, I]), W = X(
3812
+ () => hr(P, o),
3813
+ [P, o]
3814
+ ), E = P.length;
3815
+ return W.length === 0 ? /* @__PURE__ */ r("div", { className: m("rounded-lg border bg-card", i), children: [
3816
+ d && /* @__PURE__ */ e(
3817
+ "div",
3818
+ {
3819
+ className: m(
3820
+ "border-b px-4 flex items-center justify-between",
3821
+ w ? "py-2" : "py-3"
3822
+ ),
3823
+ children: /* @__PURE__ */ e("h2", { className: m("font-semibold", w ? "text-sm" : "text-base"), children: h })
3824
+ }
3825
+ ),
3826
+ /* @__PURE__ */ e(
3827
+ "div",
3828
+ {
3829
+ className: m(
3830
+ "flex flex-col items-center justify-center text-center",
3831
+ w ? "py-6 px-4" : "py-10 px-6"
3832
+ ),
3833
+ children: f ?? /* @__PURE__ */ r(pe, { children: [
3834
+ /* @__PURE__ */ e(
3835
+ ir,
3836
+ {
3837
+ className: m("text-muted-foreground/50 mb-2", w ? "size-8" : "size-10")
3838
+ }
3839
+ ),
3840
+ /* @__PURE__ */ e("p", { className: m("text-muted-foreground", w ? "text-xs" : "text-sm"), children: "No upcoming events" })
3841
+ ] })
3842
+ }
3843
+ )
3844
+ ] }) : /* @__PURE__ */ r("div", { className: m("rounded-lg border bg-card overflow-hidden", i), children: [
3845
+ d && /* @__PURE__ */ r(
3846
+ "div",
3847
+ {
3848
+ className: m(
3849
+ "border-b px-4 flex items-center justify-between",
3850
+ w ? "py-2" : "py-3"
3851
+ ),
3852
+ children: [
3853
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
3854
+ /* @__PURE__ */ e("h2", { className: m("font-semibold", w ? "text-sm" : "text-base"), children: h }),
3855
+ /* @__PURE__ */ e(
3856
+ "span",
3857
+ {
3858
+ className: m(
3859
+ "text-muted-foreground bg-muted rounded-full px-2",
3860
+ w ? "text-[10px] py-0" : "text-xs py-0.5"
3861
+ ),
3862
+ children: E
3863
+ }
3864
+ )
3865
+ ] }),
3866
+ a && /* @__PURE__ */ r(
3867
+ "button",
3868
+ {
3869
+ type: "button",
3870
+ onClick: () => a(),
3871
+ className: m(
3872
+ "text-primary hover:underline flex items-center gap-0.5",
3873
+ w ? "text-xs" : "text-sm"
3874
+ ),
3875
+ children: [
3876
+ "View all",
3877
+ /* @__PURE__ */ e(ft, { className: "size-3" })
3878
+ ]
3879
+ }
3880
+ )
3881
+ ]
3882
+ }
3883
+ ),
3884
+ /* @__PURE__ */ e(
3885
+ "div",
3886
+ {
3887
+ className: m(
3888
+ "divide-y overflow-auto",
3889
+ w ? "p-2 max-h-[280px]" : "p-3 max-h-[400px]"
3890
+ ),
3891
+ children: W.map((y) => /* @__PURE__ */ e(
3892
+ fr,
3893
+ {
3894
+ group: y,
3895
+ onEventClick: s,
3896
+ onViewMore: a ? (A) => a(A) : void 0,
3897
+ compact: w
3898
+ },
3899
+ y.dateKey
3900
+ ))
3901
+ }
3902
+ )
3903
+ ] });
3904
+ }
3905
+ export {
3906
+ zr as A,
3907
+ Mr as B,
3908
+ kr as C,
3909
+ Lr as D,
3910
+ Nr as E,
3911
+ Dr as I,
3912
+ Hr as S,
3913
+ Le as T,
3914
+ Ir as U,
3915
+ Sr as V,
3916
+ Er as W,
3917
+ gn as Y,
3918
+ jr as a,
3919
+ Tr as b,
3920
+ Cr as c
3921
+ };
3922
+ //# sourceMappingURL=agenda-widget-B7ryNQOt.js.map