@mintplayer/web-components 2.4.0 → 2.5.0

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.
@@ -1,8 +1,8 @@
1
- function p(u) {
2
- return "events" in u || !("children" in u);
1
+ function p(i) {
2
+ return !("children" in i);
3
3
  }
4
- function f(u) {
5
- return "children" in u;
4
+ function f(i) {
5
+ return "children" in i;
6
6
  }
7
7
  const w = {
8
8
  navLabel: "Scheduler navigation",
@@ -17,10 +17,27 @@ const w = {
17
17
  viewDay: "Day",
18
18
  viewTimeline: "Timeline",
19
19
  resourcesHeader: "Resources",
20
+ unassignedResource: "(No resource)",
21
+ noResources: "No resources to show.",
20
22
  timelineGridLabel: "Resource timeline for week starting {date}",
21
23
  expandGroup: "Expand {title}",
22
24
  collapseGroup: "Collapse {title}",
25
+ addResourceBarLabel: "Add to the resource list",
26
+ addResource: "Add resource",
27
+ addGroup: "Add group",
28
+ addResourceToGroup: "Add resource to {title}",
29
+ addGroupToGroup: "Add subgroup to {title}",
30
+ removeResource: "Remove {title}",
31
+ resourceColor: "Colour for {title}",
23
32
  moreEvents: "+{count} more",
33
+ dayPopoverLabel: "Events on {date}",
34
+ dayPopoverCount: "{count} {events}",
35
+ eventSingular: "event",
36
+ eventPlural: "events",
37
+ dayPopoverEmpty: "No events.",
38
+ newEvent: "New event",
39
+ showDay: "Show day",
40
+ closePopover: "Close",
24
41
  viewChanged: "View changed to {view}.",
25
42
  eventAdded: "Event {title} added.",
26
43
  eventUpdated: "Event {title} updated.",
@@ -39,20 +56,78 @@ const w = {
39
56
  slotSingular: "slot",
40
57
  slotPlural: "slots",
41
58
  selectionCommitted: "Selection committed: {start}–{end}.",
59
+ gridInstructionsReadOnly: "Use the arrow keys to move between cells. Page Up and Page Down change the period. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
60
+ eventInstructionsReadOnly: "Left and Right arrows move between events.",
61
+ actionNotAllowed: "That action is not allowed here.",
42
62
  gridInstructions: "Use the arrow keys to move between cells. Hold Shift with the arrow keys to extend the selection, and press Enter to request a new event for the selection. Page Up and Page Down change the period. Alt with T, Y, M, W or D switches to today, year, month, week or day view.",
43
63
  eventInstructions: "Press Enter or M to move or resize the event with the arrow keys. Delete removes the event. Left and Right arrows move between events.",
44
64
  eventOnResource: "on {resource}"
45
65
  };
46
- function b(u, e) {
47
- return e ? u.replace(
66
+ function C(i, e) {
67
+ return e ? i.replace(
48
68
  /\{(\w+)\}/g,
49
69
  (t, n) => n in e ? String(e[n]) : t
50
- ) : u;
70
+ ) : i;
51
71
  }
52
- function I(u) {
53
- return u ? { ...w, ...u } : w;
72
+ function x(i) {
73
+ return i ? { ...w, ...i } : w;
54
74
  }
55
- const R = {
75
+ const y = [
76
+ "#3788d8",
77
+ // Blue
78
+ "#28a745",
79
+ // Green
80
+ "#dc3545",
81
+ // Red
82
+ "#ffc107",
83
+ // Yellow
84
+ "#17a2b8",
85
+ // Cyan
86
+ "#6f42c1",
87
+ // Purple
88
+ "#fd7e14",
89
+ // Orange
90
+ "#20c997",
91
+ // Teal
92
+ "#e83e8c",
93
+ // Pink
94
+ "#6c757d"
95
+ // Gray
96
+ ];
97
+ function F(i) {
98
+ return y[i % y.length];
99
+ }
100
+ function G(i) {
101
+ let e = i.replace("#", "");
102
+ e.length === 3 && (e = e.split("").map((s) => s + s).join(""));
103
+ const t = parseInt(e.substring(0, 2), 16), n = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16);
104
+ return (0.299 * t + 0.587 * n + 0.114 * r) / 255 > 0.5 ? "#000000" : "#ffffff";
105
+ }
106
+ function H(i, e) {
107
+ let t = i.replace("#", "");
108
+ t.length === 3 && (t = t.split("").map((l) => l + l).join(""));
109
+ const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16), s = Math.min(255, Math.round(n + (255 - n) * (e / 100))), a = Math.min(255, Math.round(r + (255 - r) * (e / 100))), u = Math.min(255, Math.round(o + (255 - o) * (e / 100)));
110
+ return `#${s.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}`;
111
+ }
112
+ function A(i, e) {
113
+ let t = i.replace("#", "");
114
+ t.length === 3 && (t = t.split("").map((l) => l + l).join(""));
115
+ const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16), s = Math.max(0, Math.round(n * (1 - e / 100))), a = Math.max(0, Math.round(r * (1 - e / 100))), u = Math.max(0, Math.round(o * (1 - e / 100)));
116
+ return `#${s.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${u.toString(16).padStart(2, "0")}`;
117
+ }
118
+ function $(i, e) {
119
+ let t = i.replace("#", "");
120
+ t.length === 3 && (t = t.split("").map((s) => s + s).join(""));
121
+ const n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
122
+ return `rgba(${n}, ${r}, ${o}, ${e})`;
123
+ }
124
+ const E = "#3788d8";
125
+ function U(i, e, t = E) {
126
+ if (i.color) return i.color;
127
+ const n = i.resourceId ? e.get(i.resourceId) : void 0;
128
+ return n?.eventColor ?? n?.color ?? t;
129
+ }
130
+ const L = {
56
131
  initialView: "week",
57
132
  initialDate: /* @__PURE__ */ new Date(),
58
133
  locale: "en-US",
@@ -77,38 +152,67 @@ const R = {
77
152
  center: "title",
78
153
  end: "year,month,week,day,timeline"
79
154
  },
80
- editable: !0,
81
- selectable: !0,
82
- selectMirror: !0,
83
- eventDurationEditable: !0,
84
- eventStartEditable: !0,
85
- dragRevertDuration: 500,
86
- dragScroll: !0,
87
- snapDuration: 1800,
88
155
  messages: w,
156
+ // Empty table, NOT DEFAULT_PERMISSIONS: per-capability fallback happens inside
157
+ // resolveCapability, so an unspecified capability keeps its documented default.
158
+ permissions: {},
159
+ defaultEventColor: E,
89
160
  nowIndicator: !0,
90
161
  weekNumbers: !1,
91
162
  weekText: "W",
92
- dayMaxEvents: !0
163
+ dayMaxEvents: !0,
164
+ moreLinkBehavior: "popover",
165
+ dayClickAction: "none",
166
+ requireEventResource: !1
167
+ }, k = {
168
+ createEvent: !0,
169
+ moveEvent: !0,
170
+ resizeEventStart: !0,
171
+ resizeEventEnd: !0,
172
+ deleteEvent: !0,
173
+ selectRange: !0,
174
+ createResource: !1,
175
+ updateResource: !1,
176
+ deleteResource: !1,
177
+ createGroup: !1
93
178
  };
94
- class T {
179
+ function P(i, e) {
180
+ if (e.readonly || e.permissions === !1 || !((typeof e.permissions == "object" && e.permissions !== null ? e.permissions : void 0)?.[i] ?? k[i])) return !1;
181
+ const r = e.event;
182
+ if (!r) return !0;
183
+ if (r.editable === !1) return !1;
184
+ switch (i) {
185
+ case "moveEvent":
186
+ return r.draggable !== !1;
187
+ case "resizeEventStart":
188
+ return M(r.resizable, "start");
189
+ case "resizeEventEnd":
190
+ return M(r.resizable, "end");
191
+ default:
192
+ return !0;
193
+ }
194
+ }
195
+ function M(i, e) {
196
+ return i === !1 ? !1 : i && typeof i == "object" ? i[e] !== !1 : !0;
197
+ }
198
+ class b {
95
199
  /**
96
200
  * Get the start of the week for a given date
97
201
  */
98
202
  getWeekStart(e, t = 1) {
99
- const n = new Date(e), s = n.getDay(), r = (s < t ? 7 : 0) + s - t;
100
- return n.setDate(n.getDate() - r), n.setHours(0, 0, 0, 0), n;
203
+ const n = new Date(e), r = n.getDay(), o = (r < t ? 7 : 0) + r - t;
204
+ return n.setDate(n.getDate() - o), n.setHours(0, 0, 0, 0), n;
101
205
  }
102
206
  /**
103
207
  * Get all days in a week starting from a given date
104
208
  */
105
209
  getWeekDays(e, t = 1) {
106
- const n = this.getWeekStart(e, t), s = [];
107
- for (let r = 0; r < 7; r++) {
108
- const o = new Date(n);
109
- o.setDate(n.getDate() + r), s.push(o);
210
+ const n = this.getWeekStart(e, t), r = [];
211
+ for (let o = 0; o < 7; o++) {
212
+ const s = new Date(n);
213
+ s.setDate(n.getDate() + o), r.push(s);
110
214
  }
111
- return s;
215
+ return r;
112
216
  }
113
217
  /**
114
218
  * Get the start of the month for a given date
@@ -126,25 +230,25 @@ class T {
126
230
  * Get all days in a month
127
231
  */
128
232
  getMonthDays(e) {
129
- const t = this.getMonthStart(e), n = this.getMonthEnd(e), s = [], r = new Date(t);
130
- for (; r <= n; )
131
- s.push(new Date(r)), r.setDate(r.getDate() + 1);
132
- return s;
233
+ const t = this.getMonthStart(e), n = this.getMonthEnd(e), r = [], o = new Date(t);
234
+ for (; o <= n; )
235
+ r.push(new Date(o)), o.setDate(o.getDate() + 1);
236
+ return r;
133
237
  }
134
238
  /**
135
239
  * Get weeks for a month view (includes days from adjacent months)
136
240
  */
137
241
  getMonthWeeks(e, t = 1) {
138
- const n = this.getMonthStart(e), s = this.getMonthEnd(e), r = this.getWeekStart(n, t), o = [];
139
- let a = new Date(r);
140
- for (let i = 0; i < 6; i++) {
141
- const c = [];
242
+ const n = this.getMonthStart(e), r = this.getMonthEnd(e), o = this.getWeekStart(n, t), s = [];
243
+ let a = new Date(o);
244
+ for (let u = 0; u < 6; u++) {
245
+ const l = [];
142
246
  for (let d = 0; d < 7; d++)
143
- c.push(new Date(a)), a.setDate(a.getDate() + 1);
144
- if (o.push(c), a > s && o.length >= 4)
247
+ l.push(new Date(a)), a.setDate(a.getDate() + 1);
248
+ if (s.push(l), a > r && s.length >= 4)
145
249
  break;
146
250
  }
147
- return o;
251
+ return s;
148
252
  }
149
253
  /**
150
254
  * Get the start of the year for a given date
@@ -164,59 +268,59 @@ class T {
164
268
  /**
165
269
  * Get time slots for a day
166
270
  */
167
- getTimeSlots(e, t = 1800, n = "00:00:00", s = "24:00:00") {
168
- const r = [], [o, a] = n.split(":").map(Number), [i, c] = s.split(":").map(Number), d = o * 3600 + a * 60, l = i * 3600 + c * 60;
169
- for (let h = d; h < l; h += t) {
271
+ getTimeSlots(e, t = 1800, n = "00:00:00", r = "24:00:00") {
272
+ const o = [], [s, a] = n.split(":").map(Number), [u, l] = r.split(":").map(Number), d = s * 3600 + a * 60, c = u * 3600 + l * 60;
273
+ for (let h = d; h < c; h += t) {
170
274
  const g = new Date(e);
171
275
  g.setHours(0, 0, 0, 0), g.setSeconds(h);
172
276
  const m = new Date(g);
173
- m.setSeconds(g.getSeconds() + t), r.push({ start: g, end: m });
277
+ m.setSeconds(g.getSeconds() + t), o.push({ start: g, end: m });
174
278
  }
175
- return r;
279
+ return o;
176
280
  }
177
281
  /**
178
282
  * Generate a scheduler grid for week view
179
283
  */
180
- getWeekGrid(e, t = 1, n = 1800, s = "00:00:00", r = "24:00:00", o = "24h") {
181
- const a = this.getWeekDays(e, t), i = [], c = [], d = this.getTimeSlots(a[0], n, s, r);
182
- for (const l of d) {
284
+ getWeekGrid(e, t = 1, n = 1800, r = "00:00:00", o = "24:00:00", s = "24h") {
285
+ const a = this.getWeekDays(e, t), u = [], l = [], d = this.getTimeSlots(a[0], n, r, o);
286
+ for (const c of d) {
183
287
  const h = [];
184
288
  for (const g of a) {
185
289
  const m = new Date(g);
186
- m.setHours(l.start.getHours(), l.start.getMinutes(), 0, 0);
290
+ m.setHours(c.start.getHours(), c.start.getMinutes(), 0, 0);
187
291
  const D = new Date(g);
188
- D.setHours(l.end.getHours(), l.end.getMinutes(), 0, 0);
292
+ D.setHours(c.end.getHours(), c.end.getMinutes(), 0, 0);
189
293
  const S = { start: m, end: D };
190
- h.push(S), c.push(S);
294
+ h.push(S), l.push(S);
191
295
  }
192
- i.push({
193
- time: l.start,
194
- label: this.formatTime(l.start, o),
296
+ u.push({
297
+ time: c.start,
298
+ label: this.formatTime(c.start, s),
195
299
  slots: h
196
300
  });
197
301
  }
198
- return { columns: a, rows: i, allSlots: c };
302
+ return { columns: a, rows: u, allSlots: l };
199
303
  }
200
304
  /**
201
305
  * Round a date to the nearest slot
202
306
  */
203
307
  roundToSlot(e, t) {
204
- const n = e.getTime(), s = t * 1e3, r = Math.round(n / s) * s;
205
- return new Date(r);
308
+ const n = e.getTime(), r = t * 1e3, o = Math.round(n / r) * r;
309
+ return new Date(o);
206
310
  }
207
311
  /**
208
312
  * Floor a date to the slot start
209
313
  */
210
314
  floorToSlot(e, t) {
211
- const n = e.getTime(), s = t * 1e3, r = Math.floor(n / s) * s;
212
- return new Date(r);
315
+ const n = e.getTime(), r = t * 1e3, o = Math.floor(n / r) * r;
316
+ return new Date(o);
213
317
  }
214
318
  /**
215
319
  * Ceiling a date to the slot end
216
320
  */
217
321
  ceilToSlot(e, t) {
218
- const n = e.getTime(), s = t * 1e3, r = Math.ceil(n / s) * s;
219
- return new Date(r);
322
+ const n = e.getTime(), r = t * 1e3, o = Math.ceil(n / r) * r;
323
+ return new Date(o);
220
324
  }
221
325
  /**
222
326
  * Detect time format preference based on locale
@@ -234,12 +338,12 @@ class T {
234
338
  * Format time according to format preference
235
339
  */
236
340
  formatTime(e, t = "24h") {
237
- const n = e.getHours(), s = e.getMinutes();
341
+ const n = e.getHours(), r = e.getMinutes();
238
342
  if (t === "12h") {
239
- const r = n >= 12 ? "PM" : "AM";
240
- return `${n % 12 || 12}:${s.toString().padStart(2, "0")} ${r}`;
343
+ const o = n >= 12 ? "PM" : "AM";
344
+ return `${n % 12 || 12}:${r.toString().padStart(2, "0")} ${o}`;
241
345
  }
242
- return `${n.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
346
+ return `${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}`;
243
347
  }
244
348
  /**
245
349
  * Format date for display
@@ -304,8 +408,8 @@ class T {
304
408
  getDaysDifference(e, t) {
305
409
  const n = new Date(e);
306
410
  n.setHours(0, 0, 0, 0);
307
- const s = new Date(t);
308
- return s.setHours(0, 0, 0, 0), Math.round((s.getTime() - n.getTime()) / (1e3 * 60 * 60 * 24));
411
+ const r = new Date(t);
412
+ return r.setHours(0, 0, 0, 0), Math.round((r.getTime() - n.getTime()) / (1e3 * 60 * 60 * 24));
309
413
  }
310
414
  /**
311
415
  * Add days to a date
@@ -340,8 +444,8 @@ class T {
340
444
  getWeekNumber(e) {
341
445
  const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), n = t.getUTCDay() || 7;
342
446
  t.setUTCDate(t.getUTCDate() + 4 - n);
343
- const s = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
344
- return Math.ceil(((t.getTime() - s.getTime()) / 864e5 + 1) / 7);
447
+ const r = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
448
+ return Math.ceil(((t.getTime() - r.getTime()) / 864e5 + 1) / 7);
345
449
  }
346
450
  /**
347
451
  * Get seconds from midnight for a date
@@ -356,21 +460,21 @@ class T {
356
460
  return Math.round((t.getTime() - e.getTime()) / 1e3);
357
461
  }
358
462
  }
359
- const y = new T();
360
- class E {
463
+ const T = new b();
464
+ class I {
361
465
  /**
362
466
  * Split an event into daily parts
363
467
  * Each part represents one day of a multi-day event
364
468
  */
365
469
  splitInParts(e) {
366
470
  const t = [];
367
- let n = new Date(e.start), s = 0;
368
- const r = this.getTotalDays(e.start, e.end);
369
- if (y.isSameDay(e.start, e.end)) {
370
- const o = "id" in e;
471
+ let n = new Date(e.start), r = 0;
472
+ const o = this.getTotalDays(e.start, e.end);
473
+ if (T.isSameDay(e.start, e.end)) {
474
+ const s = "id" in e;
371
475
  return t.push({
372
- id: o ? `${e.id}-0` : "preview-0",
373
- event: o ? e : null,
476
+ id: s ? `${e.id}-0` : "preview-0",
477
+ event: s ? e : null,
374
478
  start: e.start,
375
479
  end: e.end,
376
480
  isStart: !0,
@@ -378,36 +482,36 @@ class E {
378
482
  dayIndex: 0,
379
483
  totalDays: 1
380
484
  }), {
381
- event: o ? e : null,
485
+ event: s ? e : null,
382
486
  parts: t
383
487
  };
384
488
  }
385
- for (; !y.isSameDay(n, e.end); ) {
386
- const o = new Date(n);
387
- o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0);
489
+ for (; !T.isSameDay(n, e.end); ) {
490
+ const s = new Date(n);
491
+ s.setDate(s.getDate() + 1), s.setHours(0, 0, 0, 0);
388
492
  const a = "id" in e;
389
493
  t.push({
390
- id: a ? `${e.id}-${s}` : `preview-${s}`,
494
+ id: a ? `${e.id}-${r}` : `preview-${r}`,
391
495
  event: a ? e : null,
392
496
  start: new Date(n),
393
- end: o,
394
- isStart: s === 0,
497
+ end: s,
498
+ isStart: r === 0,
395
499
  isEnd: !1,
396
- dayIndex: s,
397
- totalDays: r
398
- }), n = o, s++;
500
+ dayIndex: r,
501
+ totalDays: o
502
+ }), n = s, r++;
399
503
  }
400
504
  if (e.end.getHours() !== 0 || e.end.getMinutes() !== 0 || e.end.getSeconds() !== 0) {
401
- const o = "id" in e;
505
+ const s = "id" in e;
402
506
  t.push({
403
- id: o ? `${e.id}-${s}` : `preview-${s}`,
404
- event: o ? e : null,
507
+ id: s ? `${e.id}-${r}` : `preview-${r}`,
508
+ event: s ? e : null,
405
509
  start: new Date(n),
406
510
  end: e.end,
407
511
  isStart: !1,
408
512
  isEnd: !0,
409
- dayIndex: s,
410
- totalDays: r
513
+ dayIndex: r,
514
+ totalDays: o
411
515
  });
412
516
  }
413
517
  return {
@@ -421,10 +525,10 @@ class E {
421
525
  getTotalDays(e, t) {
422
526
  const n = new Date(e);
423
527
  n.setHours(0, 0, 0, 0);
424
- const s = new Date(t);
425
- s.setHours(0, 0, 0, 0);
426
- const r = s.getTime() - n.getTime(), o = Math.ceil(r / (1e3 * 60 * 60 * 24));
427
- return t.getHours() !== 0 || t.getMinutes() !== 0 || t.getSeconds() !== 0 ? o + 1 : Math.max(1, o);
528
+ const r = new Date(t);
529
+ r.setHours(0, 0, 0, 0);
530
+ const o = r.getTime() - n.getTime(), s = Math.ceil(o / (1e3 * 60 * 60 * 24));
531
+ return t.getHours() !== 0 || t.getMinutes() !== 0 || t.getSeconds() !== 0 ? s + 1 : Math.max(1, s);
428
532
  }
429
533
  /**
430
534
  * Assign events to tracks (rails) to minimize overlapping
@@ -434,13 +538,13 @@ class E {
434
538
  if (e.length === 0)
435
539
  return [];
436
540
  const t = this.getUniqueTimestamps(e), n = [];
437
- for (const s of t) {
438
- const r = e.filter((o) => o.start.getTime() === s.getTime());
439
- for (const o of r) {
440
- const a = n.find((i) => this.isTrackFreeForEvent(i, o));
441
- a ? a.events.push(o) : n.push({
541
+ for (const r of t) {
542
+ const o = e.filter((s) => s.start.getTime() === r.getTime());
543
+ for (const s of o) {
544
+ const a = n.find((u) => this.isTrackFreeForEvent(u, s));
545
+ a ? a.events.push(s) : n.push({
442
546
  index: n.length,
443
- events: [o]
547
+ events: [s]
444
548
  });
445
549
  }
446
550
  }
@@ -461,19 +565,19 @@ class E {
461
565
  */
462
566
  getTimelinedParts(e) {
463
567
  const t = /* @__PURE__ */ new Map();
464
- for (const r of e)
465
- r.event && !t.has(r.event.id) && t.set(r.event.id, r.event);
466
- const n = Array.from(t.values()), s = this.getColspanLayout(n);
467
- return e.map((r) => {
468
- if (!r.event)
469
- return { part: r, trackIndex: 0, totalTracks: 1, colspan: 1 };
470
- const o = s.get(r.event.id);
471
- return o ? {
472
- part: r,
473
- trackIndex: o.col,
474
- totalTracks: o.columnCount,
475
- colspan: o.colspan
476
- } : { part: r, trackIndex: 0, totalTracks: 1, colspan: 1 };
568
+ for (const o of e)
569
+ o.event && !t.has(o.event.id) && t.set(o.event.id, o.event);
570
+ const n = Array.from(t.values()), r = this.getColspanLayout(n);
571
+ return e.map((o) => {
572
+ if (!o.event)
573
+ return { part: o, trackIndex: 0, totalTracks: 1, colspan: 1 };
574
+ const s = r.get(o.event.id);
575
+ return s ? {
576
+ part: o,
577
+ trackIndex: s.col,
578
+ totalTracks: s.columnCount,
579
+ colspan: s.colspan
580
+ } : { part: o, trackIndex: 0, totalTracks: 1, colspan: 1 };
477
581
  });
478
582
  }
479
583
  /**
@@ -488,14 +592,14 @@ class E {
488
592
  if (e.length === 0)
489
593
  return t;
490
594
  const n = this.buildOverlapGroups(e);
491
- for (const s of n) {
492
- const { assignments: r, columnCount: o } = this.assignColumns(s);
493
- for (const a of s) {
494
- const i = r.get(a.id) ?? 0, c = this.computeColspan(a, i, s, r, o);
595
+ for (const r of n) {
596
+ const { assignments: o, columnCount: s } = this.assignColumns(r);
597
+ for (const a of r) {
598
+ const u = o.get(a.id) ?? 0, l = this.computeColspan(a, u, r, o, s);
495
599
  t.set(a.id, {
496
- col: i,
497
- colspan: c,
498
- columnCount: o
600
+ col: u,
601
+ colspan: l,
602
+ columnCount: s
499
603
  });
500
604
  }
501
605
  }
@@ -510,23 +614,23 @@ class E {
510
614
  */
511
615
  buildOverlapGroups(e) {
512
616
  if (e.length === 0) return [];
513
- const t = [], n = /* @__PURE__ */ new Set(), s = [...e].sort((r, o) => r.start.getTime() - o.start.getTime());
514
- for (const r of s) {
515
- if (n.has(r.id)) continue;
516
- const o = [], a = [r];
517
- let i = 0;
518
- for (; i < a.length; ) {
519
- const c = a[i++];
520
- if (n.has(c.id)) continue;
521
- n.add(c.id), o.push(c);
522
- const d = c.end.getTime();
523
- for (const l of s)
524
- if (!n.has(l.id)) {
525
- if (l.start.getTime() >= d) break;
526
- this.eventsOverlap(c, l) && a.push(l);
617
+ const t = [], n = /* @__PURE__ */ new Set(), r = [...e].sort((o, s) => o.start.getTime() - s.start.getTime());
618
+ for (const o of r) {
619
+ if (n.has(o.id)) continue;
620
+ const s = [], a = [o];
621
+ let u = 0;
622
+ for (; u < a.length; ) {
623
+ const l = a[u++];
624
+ if (n.has(l.id)) continue;
625
+ n.add(l.id), s.push(l);
626
+ const d = l.end.getTime();
627
+ for (const c of r)
628
+ if (!n.has(c.id)) {
629
+ if (c.start.getTime() >= d) break;
630
+ this.eventsOverlap(l, c) && a.push(c);
527
631
  }
528
632
  }
529
- t.push(o);
633
+ t.push(s);
530
634
  }
531
635
  return t;
532
636
  }
@@ -537,31 +641,31 @@ class E {
537
641
  */
538
642
  assignColumns(e) {
539
643
  const t = /* @__PURE__ */ new Map(), n = [...e].sort(
540
- (r, o) => r.start.getTime() - o.start.getTime() || r.end.getTime() - o.end.getTime() || r.id.localeCompare(o.id)
541
- ), s = [];
542
- for (const r of n) {
543
- let o = -1;
544
- for (let a = 0; a < s.length; a++)
545
- if (s[a] <= r.start.getTime()) {
546
- o = a;
644
+ (o, s) => o.start.getTime() - s.start.getTime() || o.end.getTime() - s.end.getTime() || o.id.localeCompare(s.id)
645
+ ), r = [];
646
+ for (const o of n) {
647
+ let s = -1;
648
+ for (let a = 0; a < r.length; a++)
649
+ if (r[a] <= o.start.getTime()) {
650
+ s = a;
547
651
  break;
548
652
  }
549
- o === -1 ? (o = s.length, s.push(r.end.getTime())) : s[o] = r.end.getTime(), t.set(r.id, o);
653
+ s === -1 ? (s = r.length, r.push(o.end.getTime())) : r[s] = o.end.getTime(), t.set(o.id, s);
550
654
  }
551
- return { assignments: t, columnCount: s.length };
655
+ return { assignments: t, columnCount: r.length };
552
656
  }
553
657
  /**
554
658
  * Compute colspan for an event
555
659
  * An event can span multiple columns if there's no overlapping event to its right
556
660
  */
557
- computeColspan(e, t, n, s, r) {
558
- let o = 1 / 0;
661
+ computeColspan(e, t, n, r, o) {
662
+ let s = 1 / 0;
559
663
  for (const a of n) {
560
664
  if (a.id === e.id || !this.eventsOverlap(e, a)) continue;
561
- const i = s.get(a.id) ?? 0;
562
- i > t && (o = Math.min(o, i));
665
+ const u = r.get(a.id) ?? 0;
666
+ u > t && (s = Math.min(s, u));
563
667
  }
564
- return o !== 1 / 0 ? o - t : r - t;
668
+ return s !== 1 / 0 ? s - t : o - t;
565
669
  }
566
670
  /**
567
671
  * Check if two events overlap in time
@@ -574,29 +678,29 @@ class E {
574
678
  * @deprecated Use getColspanLayout instead for better layout
575
679
  */
576
680
  getRelativeTrackPosition(e, t, n) {
577
- const s = [];
578
- for (const o of e)
579
- o.events.some(
580
- (i) => i.start < t.end && i.end > t.start
581
- ) && s.push(o.index);
582
- s.sort((o, a) => o - a);
583
- const r = s.indexOf(n);
681
+ const r = [];
682
+ for (const s of e)
683
+ s.events.some(
684
+ (u) => u.start < t.end && u.end > t.start
685
+ ) && r.push(s.index);
686
+ r.sort((s, a) => s - a);
687
+ const o = r.indexOf(n);
584
688
  return {
585
- relativeIndex: r >= 0 ? r : 0,
586
- overlappingCount: Math.max(1, s.length)
689
+ relativeIndex: o >= 0 ? o : 0,
690
+ overlappingCount: Math.max(1, r.length)
587
691
  };
588
692
  }
589
693
  /**
590
694
  * Filter events that fall within a date range
591
695
  */
592
696
  filterByRange(e, t, n) {
593
- return e.filter((s) => s.start < n && s.end > t);
697
+ return e.filter((r) => r.start < n && r.end > t);
594
698
  }
595
699
  /**
596
700
  * Filter event parts that fall within a date range
597
701
  */
598
702
  filterPartsByRange(e, t, n) {
599
- return e.filter((s) => s.start < n && s.end > t);
703
+ return e.filter((r) => r.start < n && r.end > t);
600
704
  }
601
705
  /**
602
706
  * Get all unique timestamps from events (both start and end times)
@@ -605,7 +709,7 @@ class E {
605
709
  const t = /* @__PURE__ */ new Set();
606
710
  for (const n of e)
607
711
  t.add(n.start.getTime()), t.add(n.end.getTime());
608
- return Array.from(t).sort((n, s) => n - s).map((n) => new Date(n));
712
+ return Array.from(t).sort((n, r) => n - r).map((n) => new Date(n));
609
713
  }
610
714
  /**
611
715
  * Check if a track has space for an event (no overlapping)
@@ -619,8 +723,8 @@ class E {
619
723
  getEventsForDay(e, t) {
620
724
  const n = new Date(t);
621
725
  n.setHours(0, 0, 0, 0);
622
- const s = new Date(t);
623
- return s.setHours(23, 59, 59, 999), this.filterByRange(e, n, s);
726
+ const r = new Date(t);
727
+ return r.setHours(23, 59, 59, 999), this.filterByRange(e, n, r);
624
728
  }
625
729
  /**
626
730
  * Get event parts for a specific day
@@ -628,31 +732,31 @@ class E {
628
732
  getPartsForDay(e, t) {
629
733
  const n = new Date(t);
630
734
  n.setHours(0, 0, 0, 0);
631
- const s = new Date(t);
632
- return s.setHours(23, 59, 59, 999), this.filterPartsByRange(e, n, s);
735
+ const r = new Date(t);
736
+ return r.setHours(23, 59, 59, 999), this.filterPartsByRange(e, n, r);
633
737
  }
634
738
  }
635
- const x = new E();
636
- class k {
739
+ const O = new I();
740
+ class R {
637
741
  /**
638
742
  * Flatten a hierarchical resource structure for rendering
639
743
  */
640
- flatten(e, t = /* @__PURE__ */ new Set(), n = 0, s, r = !1) {
641
- const o = [];
744
+ flatten(e, t = /* @__PURE__ */ new Set(), n = 0, r, o = !1) {
745
+ const s = [];
642
746
  for (const a of e) {
643
- const i = !r;
644
- if (o.push({ item: a, depth: n, visible: i, parentId: s }), f(a)) {
645
- const c = t.has(a.id), d = this.flatten(
747
+ const u = !o;
748
+ if (s.push({ item: a, depth: n, visible: u, parentId: r }), f(a)) {
749
+ const l = t.has(a.id), d = this.flatten(
646
750
  a.children,
647
751
  t,
648
752
  n + 1,
649
753
  a.id,
650
- r || c
754
+ o || l
651
755
  );
652
- o.push(...d);
756
+ s.push(...d);
653
757
  }
654
758
  }
655
- return o;
759
+ return s;
656
760
  }
657
761
  /**
658
762
  * Get all resources (leaf nodes) from a hierarchical structure
@@ -664,11 +768,12 @@ class k {
664
768
  return t;
665
769
  }
666
770
  /**
667
- * Get all events from all resources
771
+ * @deprecated Since the scheduler normalized its event model, events are keyed
772
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
773
+ * longer drives what any view renders. Set `resourceId` on the event and update
774
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
775
+ * removal, and slated for deletion in the next major.
668
776
  */
669
- getAllEvents(e) {
670
- return this.getAllResources(e).flatMap((n) => n.events ?? []);
671
- }
672
777
  /**
673
778
  * Find a resource by ID
674
779
  */
@@ -677,8 +782,8 @@ class k {
677
782
  if (p(n) && n.id === t)
678
783
  return n;
679
784
  if (f(n)) {
680
- const s = this.findResourceById(n.children, t);
681
- if (s) return s;
785
+ const r = this.findResourceById(n.children, t);
786
+ if (r) return r;
682
787
  }
683
788
  }
684
789
  }
@@ -689,8 +794,8 @@ class k {
689
794
  for (const n of e)
690
795
  if (f(n)) {
691
796
  if (n.id === t) return n;
692
- const s = this.findGroupById(n.children, t);
693
- if (s) return s;
797
+ const r = this.findGroupById(n.children, t);
798
+ if (r) return r;
694
799
  }
695
800
  }
696
801
  /**
@@ -700,52 +805,33 @@ class k {
700
805
  return this.findResourceById(e, t) ?? this.findGroupById(e, t);
701
806
  }
702
807
  /**
703
- * Add an event to a resource
808
+ * @deprecated Since the scheduler normalized its event model, events are keyed
809
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
810
+ * longer drives what any view renders. Set `resourceId` on the event and update
811
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
812
+ * removal, and slated for deletion in the next major.
704
813
  */
705
- addEventToResource(e, t, n) {
706
- return this.mapResources(e, (s) => s.id === t ? {
707
- ...s,
708
- events: [...s.events ?? [], n]
709
- } : s);
710
- }
711
814
  /**
712
- * Update an event in a resource
815
+ * @deprecated Since the scheduler normalized its event model, events are keyed
816
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
817
+ * longer drives what any view renders. Set `resourceId` on the event and update
818
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
819
+ * removal, and slated for deletion in the next major.
713
820
  */
714
- updateEventInResource(e, t) {
715
- return this.mapResources(e, (n) => {
716
- const s = n.events?.findIndex((r) => r.id === t.id);
717
- if (s !== void 0 && s >= 0 && n.events) {
718
- const r = [...n.events];
719
- return r[s] = t, { ...n, events: r };
720
- }
721
- return n;
722
- });
723
- }
724
821
  /**
725
- * Remove an event from all resources
822
+ * @deprecated Since the scheduler normalized its event model, events are keyed
823
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
824
+ * longer drives what any view renders. Set `resourceId` on the event and update
825
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
826
+ * removal, and slated for deletion in the next major.
726
827
  */
727
- removeEvent(e, t) {
728
- return this.mapResources(e, (n) => n.events?.some((s) => s.id === t) ? {
729
- ...n,
730
- events: n.events.filter((s) => s.id !== t)
731
- } : n);
732
- }
733
828
  /**
734
- * Move an event from one resource to another
829
+ * @deprecated Since the scheduler normalized its event model, events are keyed
830
+ * by `resourceId` in one store — mutating a resource tree's nested `events` no
831
+ * longer drives what any view renders. Set `resourceId` on the event and update
832
+ * the `events` input instead. Unused by the component; kept to avoid a breaking
833
+ * removal, and slated for deletion in the next major.
735
834
  */
736
- moveEventToResource(e, t, n, s) {
737
- let r;
738
- for (const i of this.getAllResources(e))
739
- if (r = i.events?.find((c) => c.id === t), r) break;
740
- if (!r) return e;
741
- const o = {
742
- ...r,
743
- ...s,
744
- resourceId: n
745
- };
746
- let a = this.removeEvent(e, t);
747
- return a = this.addEventToResource(a, n, o), a;
748
- }
749
835
  /**
750
836
  * Toggle collapse state of a group
751
837
  */
@@ -756,7 +842,7 @@ class k {
756
842
  * Set collapse state of a group
757
843
  */
758
844
  setGroupCollapse(e, t, n) {
759
- return this.mapGroups(e, (s) => s.id === t ? { ...s, collapsed: n } : s);
845
+ return this.mapGroups(e, (r) => r.id === t ? { ...r, collapsed: n } : r);
760
846
  }
761
847
  /**
762
848
  * Collapse all groups
@@ -785,10 +871,10 @@ class k {
785
871
  mapGroups(e, t) {
786
872
  return e.map((n) => {
787
873
  if (f(n)) {
788
- const s = t(n);
874
+ const r = t(n);
789
875
  return {
790
- ...s,
791
- children: this.mapGroups(s.children, t)
876
+ ...r,
877
+ children: this.mapGroups(r.children, t)
792
878
  };
793
879
  }
794
880
  return n;
@@ -798,102 +884,57 @@ class k {
798
884
  * Get the total count of visible resources
799
885
  */
800
886
  getVisibleResourceCount(e, t = /* @__PURE__ */ new Set()) {
801
- return this.flatten(e, t).filter((s) => s.visible && p(s.item)).length;
887
+ return this.flatten(e, t).filter((r) => r.visible && p(r.item)).length;
802
888
  }
803
889
  /**
804
890
  * Sort resources by order property
805
891
  */
806
892
  sortByOrder(e) {
807
- return [...e].sort((n, s) => (n.order ?? 0) - (s.order ?? 0)).map((n) => f(n) ? {
893
+ return [...e].sort((n, r) => (n.order ?? 0) - (r.order ?? 0)).map((n) => f(n) ? {
808
894
  ...n,
809
895
  children: this.sortByOrder(n.children)
810
896
  } : n);
811
897
  }
812
898
  }
813
- const C = new k();
814
- function v(u = "evt") {
899
+ const Y = new R();
900
+ function v(i = "evt") {
815
901
  const e = Date.now().toString(36), t = Math.random().toString(36).substring(2, 9);
816
- return `${u}-${e}-${t}`;
902
+ return `${i}-${e}-${t}`;
817
903
  }
818
- function F() {
904
+ function B() {
819
905
  return v("evt");
820
906
  }
821
- function H() {
907
+ function W() {
822
908
  return v("res");
823
909
  }
824
- function $() {
910
+ function N() {
825
911
  return v("grp");
826
912
  }
827
- const M = [
828
- "#3788d8",
829
- // Blue
830
- "#28a745",
831
- // Green
832
- "#dc3545",
833
- // Red
834
- "#ffc107",
835
- // Yellow
836
- "#17a2b8",
837
- // Cyan
838
- "#6f42c1",
839
- // Purple
840
- "#fd7e14",
841
- // Orange
842
- "#20c997",
843
- // Teal
844
- "#e83e8c",
845
- // Pink
846
- "#6c757d"
847
- // Gray
848
- ];
849
- function G(u) {
850
- return M[u % M.length];
851
- }
852
- function U(u) {
853
- let e = u.replace("#", "");
854
- e.length === 3 && (e = e.split("").map((o) => o + o).join(""));
855
- const t = parseInt(e.substring(0, 2), 16), n = parseInt(e.substring(2, 4), 16), s = parseInt(e.substring(4, 6), 16);
856
- return (0.299 * t + 0.587 * n + 0.114 * s) / 255 > 0.5 ? "#000000" : "#ffffff";
857
- }
858
- function A(u, e) {
859
- let t = u.replace("#", "");
860
- t.length === 3 && (t = t.split("").map((c) => c + c).join(""));
861
- const n = parseInt(t.substring(0, 2), 16), s = parseInt(t.substring(2, 4), 16), r = parseInt(t.substring(4, 6), 16), o = Math.min(255, Math.round(n + (255 - n) * (e / 100))), a = Math.min(255, Math.round(s + (255 - s) * (e / 100))), i = Math.min(255, Math.round(r + (255 - r) * (e / 100)));
862
- return `#${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`;
863
- }
864
- function Y(u, e) {
865
- let t = u.replace("#", "");
866
- t.length === 3 && (t = t.split("").map((c) => c + c).join(""));
867
- const n = parseInt(t.substring(0, 2), 16), s = parseInt(t.substring(2, 4), 16), r = parseInt(t.substring(4, 6), 16), o = Math.max(0, Math.round(n * (1 - e / 100))), a = Math.max(0, Math.round(s * (1 - e / 100))), i = Math.max(0, Math.round(r * (1 - e / 100)));
868
- return `#${o.toString(16).padStart(2, "0")}${a.toString(16).padStart(2, "0")}${i.toString(16).padStart(2, "0")}`;
869
- }
870
- function O(u, e) {
871
- let t = u.replace("#", "");
872
- t.length === 3 && (t = t.split("").map((o) => o + o).join(""));
873
- const n = parseInt(t.substring(0, 2), 16), s = parseInt(t.substring(2, 4), 16), r = parseInt(t.substring(4, 6), 16);
874
- return `rgba(${n}, ${s}, ${r}, ${e})`;
875
- }
876
913
  export {
877
- R as D,
878
- k as R,
879
- E as T,
880
- M as a,
881
- w as b,
882
- T as c,
883
- y as d,
884
- O as e,
885
- Y as f,
886
- b as g,
887
- F as h,
888
- $ as i,
889
- v as j,
890
- H as k,
891
- G as l,
892
- U as m,
893
- p as n,
894
- f as o,
895
- A as p,
896
- C as q,
897
- I as r,
898
- x as t
914
+ L as D,
915
+ R,
916
+ I as T,
917
+ y as a,
918
+ E as b,
919
+ w as c,
920
+ T as d,
921
+ k as e,
922
+ b as f,
923
+ $ as g,
924
+ A as h,
925
+ C as i,
926
+ B as j,
927
+ N as k,
928
+ v as l,
929
+ W as m,
930
+ F as n,
931
+ G as o,
932
+ p,
933
+ f as q,
934
+ H as r,
935
+ P as s,
936
+ U as t,
937
+ x as u,
938
+ Y as v,
939
+ O as w
899
940
  };