@innosolutions/inno-calendar 1.0.59 → 1.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/AGENT.md +1783 -1721
  2. package/README.md +279 -235
  3. package/dist/agenda-widget-D6E-NQK-.cjs +2 -0
  4. package/dist/agenda-widget-D6E-NQK-.cjs.map +1 -0
  5. package/dist/{agenda-widget-wrZfO67A.js → agenda-widget-DVj4CEZE.js} +1297 -1279
  6. package/dist/agenda-widget-DVj4CEZE.js.map +1 -0
  7. package/dist/components/event/event-card.d.ts.map +1 -1
  8. package/dist/components/index.cjs +1 -1
  9. package/dist/components/index.mjs +2 -2
  10. package/dist/components/primitives/scroll-navigator.d.ts +3 -1
  11. package/dist/components/primitives/scroll-navigator.d.ts.map +1 -1
  12. package/dist/components/views/timeline-view.d.ts +1 -1
  13. package/dist/components/views/timeline-view.d.ts.map +1 -1
  14. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  15. package/dist/core/context/slot-selection-context.d.ts +2 -0
  16. package/dist/core/context/slot-selection-context.d.ts.map +1 -1
  17. package/dist/core/index.cjs +1 -1
  18. package/dist/core/index.mjs +115 -114
  19. package/dist/core/types.d.ts +6 -18
  20. package/dist/core/types.d.ts.map +1 -1
  21. package/dist/core/utils/event-utils.d.ts.map +1 -1
  22. package/dist/core/utils/index.d.ts +1 -0
  23. package/dist/core/utils/index.d.ts.map +1 -1
  24. package/dist/core/utils/react-node-utils.d.ts +14 -0
  25. package/dist/core/utils/react-node-utils.d.ts.map +1 -0
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.mjs +207 -206
  28. package/dist/position-utils-BQpbtF6N.cjs +2 -0
  29. package/dist/position-utils-BQpbtF6N.cjs.map +1 -0
  30. package/dist/position-utils-DMVQFywD.js +936 -0
  31. package/dist/position-utils-DMVQFywD.js.map +1 -0
  32. package/dist/presets/index.cjs +1 -1
  33. package/dist/presets/index.mjs +1 -1
  34. package/dist/slot-selection-context-CRstOosL.js +604 -0
  35. package/dist/slot-selection-context-CRstOosL.js.map +1 -0
  36. package/dist/slot-selection-context-DBCZI2Dn.cjs +2 -0
  37. package/dist/slot-selection-context-DBCZI2Dn.cjs.map +1 -0
  38. package/dist/styles/index.css +1 -1
  39. package/dist/{tailwind-calendar-CVuxWXLY.js → tailwind-calendar-CNhXkxzW.js} +80 -80
  40. package/dist/{tailwind-calendar-CVuxWXLY.js.map → tailwind-calendar-CNhXkxzW.js.map} +1 -1
  41. package/dist/tailwind-calendar-VRvPJQwa.cjs +2 -0
  42. package/dist/{tailwind-calendar-DoG6s3PJ.cjs.map → tailwind-calendar-VRvPJQwa.cjs.map} +1 -1
  43. package/dist/{use-calendar-Clo9DFK4.js → use-calendar-D8XaVe44.js} +69 -69
  44. package/dist/{use-calendar-Clo9DFK4.js.map → use-calendar-D8XaVe44.js.map} +1 -1
  45. package/dist/use-calendar-DkT1_V3j.cjs +2 -0
  46. package/dist/{use-calendar-BEuelmSu.cjs.map → use-calendar-DkT1_V3j.cjs.map} +1 -1
  47. package/dist/{use-slot-selection-BCZKnZSM.js → use-slot-selection-CWRk_17s.js} +32 -32
  48. package/dist/{use-slot-selection-BCZKnZSM.js.map → use-slot-selection-CWRk_17s.js.map} +1 -1
  49. package/dist/use-slot-selection-Dj_tWg1O.cjs +2 -0
  50. package/dist/{use-slot-selection-Bwqwjiaq.cjs.map → use-slot-selection-Dj_tWg1O.cjs.map} +1 -1
  51. package/dist/utils.cjs +1 -1
  52. package/dist/utils.cjs.map +1 -1
  53. package/dist/utils.mjs +117 -920
  54. package/dist/utils.mjs.map +1 -1
  55. package/dist/week-view-C1Vu2ErD.cjs +11 -0
  56. package/dist/week-view-C1Vu2ErD.cjs.map +1 -0
  57. package/dist/{week-view-C1FxF_nk.js → week-view-DY167Wok.js} +1084 -1043
  58. package/dist/week-view-DY167Wok.js.map +1 -0
  59. package/package.json +138 -138
  60. package/dist/agenda-widget-BxZU4eGL.cjs +0 -2
  61. package/dist/agenda-widget-BxZU4eGL.cjs.map +0 -1
  62. package/dist/agenda-widget-wrZfO67A.js.map +0 -1
  63. package/dist/slot-selection-context-BwghpxKA.js +0 -597
  64. package/dist/slot-selection-context-BwghpxKA.js.map +0 -1
  65. package/dist/slot-selection-context-CHSaOPWP.cjs +0 -2
  66. package/dist/slot-selection-context-CHSaOPWP.cjs.map +0 -1
  67. package/dist/tailwind-calendar-DoG6s3PJ.cjs +0 -2
  68. package/dist/use-calendar-BEuelmSu.cjs +0 -2
  69. package/dist/use-slot-selection-Bwqwjiaq.cjs +0 -2
  70. package/dist/week-view-Bzpbti1B.cjs +0 -11
  71. package/dist/week-view-Bzpbti1B.cjs.map +0 -1
  72. package/dist/week-view-C1FxF_nk.js.map +0 -1
@@ -0,0 +1,936 @@
1
+ import { isValidElement as V } from "react";
2
+ function k(t) {
3
+ if (t == null || typeof t == "boolean") return "";
4
+ if (typeof t == "string") return t;
5
+ if (typeof t == "number") return String(t);
6
+ if (Array.isArray(t)) return t.map(k).join("");
7
+ if (V(t)) {
8
+ const e = t.props;
9
+ return k(e.children);
10
+ }
11
+ return "";
12
+ }
13
+ const at = [
14
+ "day",
15
+ "week",
16
+ "month",
17
+ "year",
18
+ "agenda",
19
+ "resource-day",
20
+ "resource-week",
21
+ "timeline-day",
22
+ "timeline-week"
23
+ ], st = {
24
+ startHour: 8,
25
+ endHour: 18,
26
+ firstDayOfWeek: 1,
27
+ // Monday
28
+ slotDuration: 30,
29
+ showWeekends: !0,
30
+ timeFormat: "24h",
31
+ badgeVariant: "colored",
32
+ showCanceledEvents: !1
33
+ }, ot = {
34
+ startHour: 0,
35
+ endHour: 24
36
+ }, ut = {
37
+ startHour: 8,
38
+ endHour: 18
39
+ }, it = {
40
+ day: {
41
+ type: "day",
42
+ slotMinTime: "00:00",
43
+ slotMaxTime: "24:00",
44
+ slotDuration: "00:30:00",
45
+ scrollTime: "08:00:00",
46
+ allDaySlot: !0
47
+ },
48
+ week: {
49
+ type: "week",
50
+ slotMinTime: "00:00",
51
+ slotMaxTime: "24:00",
52
+ slotDuration: "00:30:00",
53
+ scrollTime: "08:00:00",
54
+ dayMaxEventRows: 3,
55
+ allDaySlot: !0
56
+ },
57
+ month: {
58
+ type: "month",
59
+ dayMaxEventRows: 4,
60
+ eventMaxStack: 3,
61
+ allDaySlot: !1
62
+ },
63
+ year: {
64
+ type: "year",
65
+ dayMaxEventRows: 2,
66
+ allDaySlot: !1
67
+ },
68
+ agenda: {
69
+ type: "agenda",
70
+ allDaySlot: !1
71
+ },
72
+ "resource-day": {
73
+ type: "resource-day",
74
+ slotMinTime: "00:00",
75
+ slotMaxTime: "24:00",
76
+ slotDuration: "00:30:00",
77
+ scrollTime: "08:00:00",
78
+ allDaySlot: !0
79
+ },
80
+ "resource-week": {
81
+ type: "resource-week",
82
+ slotMinTime: "00:00",
83
+ slotMaxTime: "24:00",
84
+ slotDuration: "00:30:00",
85
+ scrollTime: "08:00:00",
86
+ allDaySlot: !0
87
+ },
88
+ "timeline-day": {
89
+ type: "timeline-day",
90
+ slotDuration: "01:00:00"
91
+ },
92
+ "timeline-3day": {
93
+ type: "timeline-3day",
94
+ slotDuration: "01:00:00"
95
+ },
96
+ "timeline-week": {
97
+ type: "timeline-week",
98
+ slotDuration: "01:00:00"
99
+ }
100
+ }, ct = {
101
+ blue: "#3b82f6",
102
+ green: "#22c55e",
103
+ red: "#ef4444",
104
+ yellow: "#eab308",
105
+ purple: "#a855f7",
106
+ orange: "#f97316",
107
+ pink: "#ec4899",
108
+ teal: "#14b8a6",
109
+ gray: "#6b7280",
110
+ indigo: "#6366f1"
111
+ }, lt = {
112
+ blue: { bg: "bg-blue-100", text: "text-blue-800", border: "border-blue-300" },
113
+ green: { bg: "bg-green-100", text: "text-green-800", border: "border-green-300" },
114
+ red: { bg: "bg-red-100", text: "text-red-800", border: "border-red-300" },
115
+ yellow: { bg: "bg-yellow-100", text: "text-yellow-800", border: "border-yellow-300" },
116
+ purple: { bg: "bg-purple-100", text: "text-purple-800", border: "border-purple-300" },
117
+ orange: { bg: "bg-orange-100", text: "text-orange-800", border: "border-orange-300" },
118
+ pink: { bg: "bg-pink-100", text: "text-pink-800", border: "border-pink-300" },
119
+ teal: { bg: "bg-teal-100", text: "text-teal-800", border: "border-teal-300" },
120
+ gray: { bg: "bg-gray-100", text: "text-gray-800", border: "border-gray-300" },
121
+ indigo: { bg: "bg-indigo-100", text: "text-indigo-800", border: "border-indigo-300" }
122
+ }, ft = {
123
+ "#3b82f6": "blue",
124
+ "#22c55e": "green",
125
+ "#ef4444": "red",
126
+ "#eab308": "yellow",
127
+ "#a855f7": "purple",
128
+ "#f97316": "orange",
129
+ "#ec4899": "pink",
130
+ "#14b8a6": "teal",
131
+ "#6b7280": "gray",
132
+ "#6366f1": "indigo"
133
+ }, gt = 24, dt = 60, P = 60 * 1e3, G = 60 * P, mt = 24 * G, x = 64, Dt = 32, ht = 56, yt = 200, z = 20;
134
+ function d(t) {
135
+ const e = new Date(t);
136
+ return e.setHours(0, 0, 0, 0), e;
137
+ }
138
+ function T(t) {
139
+ const e = new Date(t);
140
+ return e.setHours(23, 59, 59, 999), e;
141
+ }
142
+ function l(t, e) {
143
+ const n = new Date(t);
144
+ return n.setDate(n.getDate() + e), n;
145
+ }
146
+ function pt(t, e) {
147
+ return l(t, -e);
148
+ }
149
+ function p(t, e) {
150
+ return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
151
+ }
152
+ function W(t) {
153
+ return p(t, /* @__PURE__ */ new Date());
154
+ }
155
+ function Tt(t) {
156
+ return t.getDay();
157
+ }
158
+ function Y(t) {
159
+ const e = t.getDay();
160
+ return e === 0 || e === 6;
161
+ }
162
+ function m(t, e = 1) {
163
+ const n = new Date(t), r = n.getDay(), a = (r < e ? 7 : 0) + r - e;
164
+ return n.setDate(n.getDate() - a), n.setHours(0, 0, 0, 0), n;
165
+ }
166
+ function w(t, e = 1) {
167
+ const n = m(t, e);
168
+ return n.setDate(n.getDate() + 6), n.setHours(23, 59, 59, 999), n;
169
+ }
170
+ function I(t, e) {
171
+ return l(t, e * 7);
172
+ }
173
+ function wt(t, e) {
174
+ return l(t, -e * 7);
175
+ }
176
+ function Mt(t) {
177
+ const e = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate())), n = e.getUTCDay() || 7;
178
+ e.setUTCDate(e.getUTCDate() + 4 - n);
179
+ const r = new Date(Date.UTC(e.getUTCFullYear(), 0, 1));
180
+ return Math.ceil(((e.getTime() - r.getTime()) / 864e5 + 1) / 7);
181
+ }
182
+ function Et(t, e, n = 1) {
183
+ const r = m(t, n), a = m(e, n);
184
+ return p(r, a);
185
+ }
186
+ function E(t) {
187
+ const e = new Date(t);
188
+ return e.setDate(1), e.setHours(0, 0, 0, 0), e;
189
+ }
190
+ function S(t) {
191
+ const e = new Date(t.getFullYear(), t.getMonth() + 1, 0);
192
+ return e.setHours(23, 59, 59, 999), e;
193
+ }
194
+ function F(t, e) {
195
+ const n = new Date(t);
196
+ return n.setMonth(n.getMonth() + e), n;
197
+ }
198
+ function St(t, e) {
199
+ return F(t, -e);
200
+ }
201
+ function bt(t) {
202
+ return new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
203
+ }
204
+ function A(t, e) {
205
+ return t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth();
206
+ }
207
+ function v(t) {
208
+ return new Date(t.getFullYear(), 0, 1, 0, 0, 0, 0);
209
+ }
210
+ function j(t) {
211
+ return new Date(t.getFullYear(), 11, 31, 23, 59, 59, 999);
212
+ }
213
+ function C(t, e) {
214
+ const n = new Date(t);
215
+ return n.setFullYear(n.getFullYear() + e), n;
216
+ }
217
+ function Ht(t, e) {
218
+ return C(t, -e);
219
+ }
220
+ function kt(t, e) {
221
+ return t.getFullYear() === e.getFullYear();
222
+ }
223
+ function J(t, e) {
224
+ const n = new Date(t);
225
+ return n.setHours(n.getHours() + e), n;
226
+ }
227
+ function It(t, e) {
228
+ const n = new Date(t);
229
+ return n.setMinutes(n.getMinutes() + e), n;
230
+ }
231
+ function xt(t, e, n = 0, r = 0) {
232
+ const a = new Date(t);
233
+ return a.setHours(e, n, r, 0), a;
234
+ }
235
+ function Ft(t) {
236
+ return t.getHours() + t.getMinutes() / 60;
237
+ }
238
+ function $t(t, e) {
239
+ return t.getTime() < e.getTime();
240
+ }
241
+ function At(t, e) {
242
+ return t.getTime() > e.getTime();
243
+ }
244
+ function Ct(t, e, n) {
245
+ const r = t.getTime();
246
+ return r >= e.getTime() && r <= n.getTime();
247
+ }
248
+ function Ot(t) {
249
+ if (t.length !== 0)
250
+ return t.reduce((e, n) => n < e ? n : e);
251
+ }
252
+ function _t(t) {
253
+ if (t.length !== 0)
254
+ return t.reduce((e, n) => n > e ? n : e);
255
+ }
256
+ function O(t, e) {
257
+ return t.getTime() - e.getTime();
258
+ }
259
+ function Rt(t, e) {
260
+ return Math.floor(O(t, e) / 6e4);
261
+ }
262
+ function Ut(t, e) {
263
+ return Math.floor(O(t, e) / 36e5);
264
+ }
265
+ function Wt(t, e) {
266
+ const n = d(t), r = d(e);
267
+ return Math.floor(O(n, r) / 864e5);
268
+ }
269
+ function H(t, e = "24h") {
270
+ const n = t.getHours(), r = t.getMinutes();
271
+ if (e === "12h") {
272
+ const a = n >= 12 ? "PM" : "AM";
273
+ return `${n % 12 || 12}:${r.toString().padStart(2, "0")} ${a}`;
274
+ }
275
+ return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
276
+ }
277
+ function Yt(t) {
278
+ const e = t.getFullYear(), n = (t.getMonth() + 1).toString().padStart(2, "0"), r = t.getDate().toString().padStart(2, "0");
279
+ return `${e}-${n}-${r}`;
280
+ }
281
+ function vt(t) {
282
+ return new Date(t);
283
+ }
284
+ function K(t, e) {
285
+ const n = [];
286
+ let r = d(t);
287
+ const a = d(e);
288
+ for (; r <= a; )
289
+ n.push(new Date(r)), r = l(r, 1);
290
+ return n;
291
+ }
292
+ function Lt(t, e) {
293
+ const n = [];
294
+ let r = new Date(t);
295
+ for (; r <= e; )
296
+ n.push(new Date(r)), r = J(r, 1);
297
+ return n;
298
+ }
299
+ function Bt(t = "en-US", e = "short") {
300
+ const n = new Intl.DateTimeFormat(t, { weekday: e }), r = [], a = new Date(2024, 0, 7);
301
+ for (let s = 0; s < 7; s++)
302
+ r.push(n.format(l(a, s)));
303
+ return r;
304
+ }
305
+ function Nt(t = "en-US", e = "long") {
306
+ const n = new Intl.DateTimeFormat(t, { month: e }), r = [];
307
+ for (let a = 0; a < 12; a++)
308
+ r.push(n.format(new Date(2024, a, 1)));
309
+ return r;
310
+ }
311
+ function Vt(t) {
312
+ const e = [];
313
+ for (let n = t.startHour; n <= t.endHour; n++)
314
+ e.push(n);
315
+ return e;
316
+ }
317
+ function Pt(t, e = "24h") {
318
+ if (e === "12h") {
319
+ const n = t >= 12 ? "PM" : "AM";
320
+ return `${t % 12 || 12} ${n}`;
321
+ }
322
+ return `${String(t).padStart(2, "0")}:00`;
323
+ }
324
+ function Gt(t, e = 1) {
325
+ const n = m(t, e), r = [];
326
+ for (let a = 0; a < 7; a++)
327
+ r.push(l(n, a));
328
+ return r;
329
+ }
330
+ function zt(t, e = 1) {
331
+ const n = E(t), r = S(t), a = m(n, e), s = w(r, e), o = t.getMonth();
332
+ return K(a, s).map((c) => ({
333
+ date: c,
334
+ isCurrentMonth: c.getMonth() === o,
335
+ isWeekend: c.getDay() === 0 || c.getDay() === 6
336
+ }));
337
+ }
338
+ function _(t) {
339
+ if (t.isAllDay === !0) return !0;
340
+ if (t.isAllDay === !1) return !1;
341
+ const e = t.startDate.getHours(), n = t.startDate.getMinutes(), r = t.endDate.getHours(), a = t.endDate.getMinutes(), s = e === 0 && n === 0, o = r === 0 && a === 0 || // midnight next day
342
+ r === 23 && a >= 59;
343
+ return !!(s && o);
344
+ }
345
+ function jt(t) {
346
+ const e = [], n = [];
347
+ for (const r of t)
348
+ _(r) ? n.push(r) : p(r.startDate, r.endDate) ? e.push(r) : n.push(r);
349
+ return { singleDay: e, multiDay: n };
350
+ }
351
+ function Jt(t, e, n) {
352
+ return t.filter((r) => r.startDate <= n && r.endDate >= e);
353
+ }
354
+ function Kt(t, e, n) {
355
+ if (!n) return !0;
356
+ const r = t.getDay(), a = n[r];
357
+ return !a || !(a.enabled !== !1) || a.from === a.to ? !1 : e >= a.from && e < a.to;
358
+ }
359
+ function Xt(t, e) {
360
+ const n = t.getDay(), r = e[n];
361
+ return !r || !(r.enabled !== !1) || r.from === r.to ? null : { from: r.from, to: r.to };
362
+ }
363
+ function qt(t) {
364
+ const e = [];
365
+ for (let n = 0; n < 12; n++)
366
+ e.push(new Date(t, n, 1));
367
+ return e;
368
+ }
369
+ function X(t, e, n) {
370
+ const r = d(e), a = T(n);
371
+ return t.filter((s) => {
372
+ const o = s.startDate, u = s.endDate;
373
+ return o <= a && u >= r;
374
+ });
375
+ }
376
+ function q(t, e) {
377
+ return e.length === 0 ? t : t.filter(
378
+ (n) => n.scheduleTypeId !== void 0 && e.includes(n.scheduleTypeId)
379
+ );
380
+ }
381
+ function Q(t, e) {
382
+ return e.length === 0 ? t : t.filter(
383
+ (n) => n.resourceId !== void 0 && e.includes(n.resourceId)
384
+ );
385
+ }
386
+ function Z(t, e) {
387
+ if (!e.trim()) return t;
388
+ const n = e.toLowerCase();
389
+ return t.filter((r) => {
390
+ const a = k(r.title).toLowerCase().includes(n), s = k(r.description).toLowerCase().includes(n);
391
+ return a || s;
392
+ });
393
+ }
394
+ function tt(t) {
395
+ return t.filter((e) => !e.isCanceled);
396
+ }
397
+ function Qt(t, e) {
398
+ let n = [...t];
399
+ return e.dateRange && (n = X(
400
+ n,
401
+ e.dateRange.startDate,
402
+ e.dateRange.endDate
403
+ )), e.scheduleTypeIds && e.scheduleTypeIds.length > 0 && (n = q(n, e.scheduleTypeIds)), e.resourceIds && e.resourceIds.length > 0 && (n = Q(n, e.resourceIds)), e.search && (n = Z(n, e.search)), e.showCanceled || (n = tt(n)), n;
404
+ }
405
+ function Zt(t) {
406
+ return [...t].sort((e, n) => e.startDate.getTime() - n.startDate.getTime());
407
+ }
408
+ function te(t) {
409
+ return [...t].sort((e, n) => e.endDate.getTime() - n.endDate.getTime());
410
+ }
411
+ function ee(t) {
412
+ return [...t].sort((e, n) => {
413
+ const r = e.endDate.getTime() - e.startDate.getTime();
414
+ return n.endDate.getTime() - n.startDate.getTime() - r;
415
+ });
416
+ }
417
+ function ne(t) {
418
+ const e = /* @__PURE__ */ new Map();
419
+ for (const n of t) {
420
+ const r = d(n.startDate).toISOString(), a = e.get(r) ?? [];
421
+ a.push(n), e.set(r, a);
422
+ }
423
+ return e;
424
+ }
425
+ function re(t) {
426
+ const e = /* @__PURE__ */ new Map();
427
+ for (const n of t) {
428
+ const r = e.get(n.scheduleTypeId) ?? [];
429
+ r.push(n), e.set(n.scheduleTypeId, r);
430
+ }
431
+ return e;
432
+ }
433
+ function ae(t) {
434
+ const e = /* @__PURE__ */ new Map();
435
+ for (const n of t) {
436
+ const r = e.get(n.resourceId) ?? [];
437
+ r.push(n), e.set(n.resourceId, r);
438
+ }
439
+ return e;
440
+ }
441
+ function se(t, e) {
442
+ return t.filter((n) => {
443
+ const r = d(e), a = T(e);
444
+ return n.startDate <= a && n.endDate >= r;
445
+ });
446
+ }
447
+ function oe(t) {
448
+ return t.filter((e) => e.isAllDay);
449
+ }
450
+ function ue(t) {
451
+ return t.filter((e) => !e.isAllDay);
452
+ }
453
+ function ie(t) {
454
+ return t.filter((e) => e.isMultiDay ? !0 : !p(e.startDate, e.endDate));
455
+ }
456
+ function ce(t) {
457
+ return t.isMultiDay ? !0 : !p(t.startDate, t.endDate);
458
+ }
459
+ function le(t) {
460
+ return Math.floor((t.endDate.getTime() - t.startDate.getTime()) / 6e4);
461
+ }
462
+ function fe(t, e = "blue") {
463
+ return t.color ?? e;
464
+ }
465
+ function ge(t, e, n = "blue") {
466
+ if (t.color) return t.color;
467
+ if (t.scheduleTypeId !== void 0 && e) {
468
+ const r = e.get(t.scheduleTypeId);
469
+ if (r) return r;
470
+ }
471
+ return n;
472
+ }
473
+ function de(t) {
474
+ if (_(t)) {
475
+ if (p(t.startDate, t.endDate))
476
+ return "All day";
477
+ const n = t.startDate.toLocaleDateString(void 0, {
478
+ month: "short",
479
+ day: "numeric"
480
+ }), r = t.endDate.toLocaleDateString(void 0, {
481
+ month: "short",
482
+ day: "numeric"
483
+ });
484
+ return `All day · ${n} – ${r}`;
485
+ }
486
+ if (!p(t.startDate, t.endDate)) {
487
+ const n = t.startDate.toLocaleDateString(void 0, {
488
+ month: "short",
489
+ day: "numeric"
490
+ }), r = t.endDate.toLocaleDateString(void 0, {
491
+ month: "short",
492
+ day: "numeric"
493
+ });
494
+ return `${n}, ${H(t.startDate)} – ${r}, ${H(t.endDate)}`;
495
+ }
496
+ return `${H(t.startDate)} - ${H(t.endDate)}`;
497
+ }
498
+ function me(t) {
499
+ return !_(t);
500
+ }
501
+ function et(t, e, n = 1) {
502
+ switch (e) {
503
+ case "day":
504
+ case "resource-day":
505
+ case "timeline-day":
506
+ return {
507
+ startDate: d(t),
508
+ endDate: T(t)
509
+ };
510
+ case "week":
511
+ case "resource-week":
512
+ case "timeline-week":
513
+ return {
514
+ startDate: m(t, n),
515
+ endDate: w(t, n)
516
+ };
517
+ case "month": {
518
+ const r = E(t), a = S(t);
519
+ return {
520
+ startDate: m(r, n),
521
+ endDate: w(a, n)
522
+ };
523
+ }
524
+ case "timeline-3day":
525
+ return {
526
+ startDate: d(t),
527
+ endDate: T(l(t, 2))
528
+ };
529
+ case "year":
530
+ return {
531
+ startDate: v(t),
532
+ endDate: j(t)
533
+ };
534
+ case "agenda":
535
+ return {
536
+ startDate: d(t),
537
+ endDate: T(l(t, 29))
538
+ };
539
+ default:
540
+ return {
541
+ startDate: d(t),
542
+ endDate: T(t)
543
+ };
544
+ }
545
+ }
546
+ function De(t, e) {
547
+ switch (e) {
548
+ case "day":
549
+ case "resource-day":
550
+ case "timeline-day":
551
+ return l(t, 1);
552
+ case "timeline-3day":
553
+ return l(t, 3);
554
+ case "week":
555
+ case "resource-week":
556
+ case "timeline-week":
557
+ return I(t, 1);
558
+ case "month":
559
+ return F(t, 1);
560
+ case "year":
561
+ return C(t, 1);
562
+ case "agenda":
563
+ return I(t, 1);
564
+ default:
565
+ return l(t, 1);
566
+ }
567
+ }
568
+ function he(t, e) {
569
+ switch (e) {
570
+ case "day":
571
+ case "resource-day":
572
+ case "timeline-day":
573
+ return l(t, -1);
574
+ case "timeline-3day":
575
+ return l(t, -3);
576
+ case "week":
577
+ case "resource-week":
578
+ case "timeline-week":
579
+ return I(t, -1);
580
+ case "month":
581
+ return F(t, -1);
582
+ case "year":
583
+ return C(t, -1);
584
+ case "agenda":
585
+ return I(t, -1);
586
+ default:
587
+ return l(t, -1);
588
+ }
589
+ }
590
+ function ye() {
591
+ return d(/* @__PURE__ */ new Date());
592
+ }
593
+ function pe(t, e = 1) {
594
+ const n = E(t), r = S(t), a = m(n, e), s = w(r, e), o = [];
595
+ let u = a;
596
+ for (; u <= s; )
597
+ o.push({
598
+ date: new Date(u),
599
+ isToday: W(u),
600
+ isCurrentMonth: A(u, t),
601
+ isWeekend: Y(u),
602
+ dayOfWeek: u.getDay()
603
+ }), u = l(u, 1);
604
+ return o;
605
+ }
606
+ function Te(t, e = 1) {
607
+ const n = m(t, e), r = [];
608
+ for (let a = 0; a < 7; a++) {
609
+ const s = l(n, a);
610
+ r.push({
611
+ date: s,
612
+ isToday: W(s),
613
+ isCurrentMonth: A(s, t),
614
+ isWeekend: Y(s),
615
+ dayOfWeek: s.getDay()
616
+ });
617
+ }
618
+ return r;
619
+ }
620
+ function we(t) {
621
+ const e = v(t), n = [];
622
+ for (let r = 0; r < 12; r++) {
623
+ const a = F(e, r);
624
+ n.push({
625
+ date: a,
626
+ isToday: A(a, /* @__PURE__ */ new Date()),
627
+ isCurrentMonth: !0,
628
+ isWeekend: !1,
629
+ dayOfWeek: a.getDay()
630
+ });
631
+ }
632
+ return n;
633
+ }
634
+ function Me(t, e, n = 30) {
635
+ const r = [], a = 60 / n;
636
+ for (let s = t; s < e; s++)
637
+ for (let o = 0; o < a; o++) {
638
+ const u = o * n;
639
+ r.push({
640
+ hour: s,
641
+ minute: u,
642
+ label: `${s.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}`
643
+ });
644
+ }
645
+ return r;
646
+ }
647
+ function Ee(t, e, n = "24h") {
648
+ const r = [];
649
+ for (let a = t; a <= e; a++) {
650
+ let s;
651
+ if (n === "12h") {
652
+ const o = a >= 12 ? "PM" : "AM";
653
+ s = `${a % 12 || 12} ${o}`;
654
+ } else
655
+ s = `${a.toString().padStart(2, "0")}:00`;
656
+ r.push({ hour: a, label: s });
657
+ }
658
+ return r;
659
+ }
660
+ function Se(t, e, n = "en-US") {
661
+ const r = new Intl.DateTimeFormat(n, {
662
+ weekday: "short",
663
+ month: "short",
664
+ day: "numeric"
665
+ }), a = new Intl.DateTimeFormat(n, { month: "short", day: "numeric" });
666
+ switch (e) {
667
+ case "day":
668
+ case "resource-day":
669
+ case "timeline-day":
670
+ return r.format(t);
671
+ case "timeline-3day": {
672
+ const s = d(t), o = l(t, 2);
673
+ return `${a.format(s)} - ${a.format(o)}`;
674
+ }
675
+ case "week":
676
+ case "resource-week":
677
+ case "timeline-week": {
678
+ const s = m(t, 1), o = w(t, 1);
679
+ return `${a.format(s)} - ${a.format(o)}`;
680
+ }
681
+ case "month": {
682
+ const s = E(t), o = S(t);
683
+ return `${a.format(s)} - ${a.format(o)}`;
684
+ }
685
+ case "year":
686
+ return `Jan 1 - Dec 31, ${t.getFullYear()}`;
687
+ case "agenda": {
688
+ const s = E(t), o = S(t);
689
+ return `${a.format(s)} - ${a.format(o)}`;
690
+ }
691
+ default:
692
+ return "";
693
+ }
694
+ }
695
+ function be(t, e, n, r = 1) {
696
+ const a = et(e, n, r);
697
+ return t.filter((s) => s.startDate <= a.endDate && s.endDate >= a.startDate).length;
698
+ }
699
+ function He(t, e, n = "en-US") {
700
+ const r = new Intl.DateTimeFormat(n, { month: "long", year: "numeric" }), a = new Intl.DateTimeFormat(n, {
701
+ weekday: "long",
702
+ month: "long",
703
+ day: "numeric",
704
+ year: "numeric"
705
+ });
706
+ switch (e) {
707
+ case "day":
708
+ case "resource-day":
709
+ case "timeline-day":
710
+ return a.format(t);
711
+ case "week":
712
+ case "resource-week":
713
+ case "timeline-week": {
714
+ const s = m(t, 1), o = w(t, 1), u = new Intl.DateTimeFormat(n, { month: "short" }).format(s), c = new Intl.DateTimeFormat(n, { month: "short" }).format(o), i = s.getFullYear();
715
+ return u === c ? `${u} ${s.getDate()} - ${o.getDate()}, ${i}` : `${u} ${s.getDate()} - ${c} ${o.getDate()}, ${i}`;
716
+ }
717
+ case "month":
718
+ return r.format(t);
719
+ case "year":
720
+ return t.getFullYear().toString();
721
+ case "agenda":
722
+ return `Agenda - ${r.format(t)}`;
723
+ default:
724
+ return r.format(t);
725
+ }
726
+ }
727
+ function ke(t = 1, e = "short", n = "en-US") {
728
+ const r = new Intl.DateTimeFormat(n, { weekday: e }), a = [], s = new Date(2024, 0, 7);
729
+ for (let o = 0; o < 7; o++) {
730
+ const u = (t + o) % 7, c = l(s, u);
731
+ a.push({
732
+ dayOfWeek: u,
733
+ label: r.format(c)
734
+ });
735
+ }
736
+ return a;
737
+ }
738
+ function nt(t, e, n, r = x) {
739
+ const { startHour: a, endHour: s } = n, o = s - a, u = o * r, c = t.startDate.getHours() + t.startDate.getMinutes() / 60, i = t.endDate.getHours() + t.endDate.getMinutes() / 60, g = Math.max(c, a), y = Math.min(i, s), D = (g - a) / o * u, h = (y - a) / o * u, f = Math.max(h - D, z);
740
+ return {
741
+ top: D,
742
+ height: f,
743
+ left: 0,
744
+ width: 100,
745
+ zIndex: 1
746
+ };
747
+ }
748
+ function Ie(t, e, n, r = x) {
749
+ if (t.length === 0) return [];
750
+ const a = [...t].sort((i, g) => {
751
+ const y = i.startDate.getTime() - g.startDate.getTime();
752
+ if (y !== 0) return y;
753
+ const D = i.endDate.getTime() - i.startDate.getTime();
754
+ return g.endDate.getTime() - g.startDate.getTime() - D;
755
+ }), s = [];
756
+ let o = [], u = 0;
757
+ for (const i of a)
758
+ o.length === 0 || i.startDate.getTime() < u ? (o.push(i), u = Math.max(u, i.endDate.getTime())) : (s.push(o), o = [i], u = i.endDate.getTime());
759
+ o.length > 0 && s.push(o);
760
+ const c = [];
761
+ for (const i of s) {
762
+ const g = [];
763
+ for (const f of i) {
764
+ const L = f.startDate.getTime(), B = f.endDate.getTime();
765
+ let M = -1;
766
+ for (let b = 0; b < g.length; b++) {
767
+ const $ = g[b];
768
+ if (!$) continue;
769
+ const U = $[$.length - 1];
770
+ if (U && U.endTime <= L) {
771
+ M = b;
772
+ break;
773
+ }
774
+ }
775
+ M === -1 && (M = g.length, g.push([]));
776
+ const R = g[M];
777
+ R && R.push({ event: f, endTime: B });
778
+ const N = nt(f, e, n, r);
779
+ c.push({
780
+ event: f,
781
+ position: N,
782
+ column: M,
783
+ columnSpan: 1
784
+ });
785
+ }
786
+ const D = 100 / g.length, h = new Set(i.map((f) => f.id));
787
+ for (const f of c)
788
+ h.has(f.event.id) && (f.position.left = f.column * D, f.position.width = D * f.columnSpan, f.position.zIndex = f.column + 1);
789
+ }
790
+ return c;
791
+ }
792
+ function xe(t, e, n, r = x, a = 30) {
793
+ const { startHour: s, endHour: o } = n, u = o - s, c = u * r, i = t / c * u, y = (s + i) * 60, D = Math.round(y / a) * a, h = new Date(e);
794
+ return h.setHours(0, 0, 0, 0), h.setMinutes(D), h;
795
+ }
796
+ function Fe(t, e, n = x) {
797
+ const { startHour: r, endHour: a } = e, s = a - r, o = s * n, u = t.getHours() + t.getMinutes() / 60;
798
+ return (Math.max(r, Math.min(u, a)) - r) / s * o;
799
+ }
800
+ function $e(t, e) {
801
+ return t.startDate < e.endDate && t.endDate > e.startDate;
802
+ }
803
+ function Ae(t) {
804
+ if (t.length === 0) return [];
805
+ const e = [...t].sort((s, o) => s.startDate.getTime() - o.startDate.getTime()), n = [];
806
+ let r = [], a = 0;
807
+ for (const s of e)
808
+ r.length === 0 || s.startDate.getTime() < a ? (r.push(s), a = Math.max(a, s.endDate.getTime())) : (r.length > 0 && n.push(r), r = [s], a = s.endDate.getTime());
809
+ return r.length > 0 && n.push(r), n;
810
+ }
811
+ function Ce(t, e, n) {
812
+ const r = Math.max(0, Math.min(t, e)), a = Math.min(n, Math.max(t, e));
813
+ return {
814
+ top: r,
815
+ height: a - r
816
+ };
817
+ }
818
+ export {
819
+ Te as $,
820
+ O as A,
821
+ Rt as B,
822
+ at as C,
823
+ ut as D,
824
+ ct as E,
825
+ K as F,
826
+ Lt as G,
827
+ ft as H,
828
+ T as I,
829
+ S as J,
830
+ w as K,
831
+ j as L,
832
+ dt as M,
833
+ $e as N,
834
+ X as O,
835
+ Q as P,
836
+ q as Q,
837
+ Z as R,
838
+ tt as S,
839
+ Yt as T,
840
+ de as U,
841
+ Pt as V,
842
+ H as W,
843
+ Ee as X,
844
+ pe as Y,
845
+ zt as Z,
846
+ Me as _,
847
+ ht as a,
848
+ we as a0,
849
+ oe as a1,
850
+ Tt as a2,
851
+ bt as a3,
852
+ Ft as a4,
853
+ fe as a5,
854
+ le as a6,
855
+ be as a7,
856
+ se as a8,
857
+ Jt as a9,
858
+ Y as aA,
859
+ Kt as aB,
860
+ _t as aC,
861
+ Ot as aD,
862
+ De as aE,
863
+ he as aF,
864
+ ye as aG,
865
+ vt as aH,
866
+ k as aI,
867
+ ge as aJ,
868
+ jt as aK,
869
+ xt as aL,
870
+ me as aM,
871
+ ee as aN,
872
+ te as aO,
873
+ Zt as aP,
874
+ d as aQ,
875
+ E as aR,
876
+ m as aS,
877
+ v as aT,
878
+ pt as aU,
879
+ St as aV,
880
+ wt as aW,
881
+ Ht as aX,
882
+ Fe as aY,
883
+ xe as aZ,
884
+ Nt as aa,
885
+ ie as ab,
886
+ Ae as ac,
887
+ Se as ad,
888
+ ue as ae,
889
+ et as af,
890
+ He as ag,
891
+ Vt as ah,
892
+ Gt as ai,
893
+ Mt as aj,
894
+ ke as ak,
895
+ Bt as al,
896
+ Xt as am,
897
+ qt as an,
898
+ ne as ao,
899
+ ae as ap,
900
+ re as aq,
901
+ At as ar,
902
+ $t as as,
903
+ Ct as at,
904
+ ce as au,
905
+ p as av,
906
+ A as aw,
907
+ Et as ax,
908
+ kt as ay,
909
+ W as az,
910
+ x as b,
911
+ st as c,
912
+ yt as d,
913
+ Dt as e,
914
+ it as f,
915
+ ot as g,
916
+ lt as h,
917
+ gt as i,
918
+ z as j,
919
+ mt as k,
920
+ G as l,
921
+ P as m,
922
+ l as n,
923
+ J as o,
924
+ It as p,
925
+ F as q,
926
+ I as r,
927
+ C as s,
928
+ Qt as t,
929
+ nt as u,
930
+ Ie as v,
931
+ Ce as w,
932
+ _ as x,
933
+ Wt as y,
934
+ Ut as z
935
+ };
936
+ //# sourceMappingURL=position-utils-DMVQFywD.js.map