@innosolutions/inno-calendar 1.0.70 → 1.0.71

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