@taskctrl/canvas-timeline 0.5.0 → 0.6.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
- import { jsx as se, jsxs as xe, Fragment as $t } from "react/jsx-runtime";
2
- import me, { useRef as x, useMemo as Q, useCallback as ne, useEffect as he, forwardRef as pi, useState as tt, useImperativeHandle as vi } from "react";
3
- import { flushSync as bi } from "react-dom";
4
- import ve from "dayjs";
5
- const Ce = {
1
+ import { jsx as le, jsxs as Ve, Fragment as Qt } from "react/jsx-runtime";
2
+ import me, { useRef as U, useMemo as ee, useCallback as oe, useEffect as ce, forwardRef as Ci, useState as Ze, useImperativeHandle as Ei } from "react";
3
+ import { flushSync as Hi } from "react-dom";
4
+ import We from "dayjs";
5
+ const He = {
6
6
  primary: "#269bf7",
7
7
  trainColors: {},
8
8
  status: { red: "#EF5350", yellow: "#FBBF24", green: "#31c48d" },
@@ -12,7 +12,7 @@ const Ce = {
12
12
  sidebar: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" },
13
13
  header: { bg: "#F9FAFB", border: "#E5E7EB", text: "#6c737f" }
14
14
  };
15
- class ft {
15
+ class yt {
16
16
  constructor(e) {
17
17
  Object.defineProperty(this, "visibleTimeStart", {
18
18
  enumerable: !0,
@@ -143,7 +143,7 @@ class ft {
143
143
  return this.groupYOffsets[this.groupCount] ?? 0;
144
144
  }
145
145
  }
146
- class yi {
146
+ class Di {
147
147
  constructor() {
148
148
  Object.defineProperty(this, "root", {
149
149
  enumerable: !0,
@@ -164,15 +164,15 @@ class yi {
164
164
  if (e.length === 0)
165
165
  return null;
166
166
  let t = 1 / 0, n = -1 / 0;
167
- for (const u of e)
168
- u.start < t && (t = u.start), u.end > n && (n = u.end);
169
- const o = (t + n) / 2, d = [], l = [], c = [];
170
- for (const u of e)
171
- u.end < o ? d.push(u) : u.start > o ? l.push(u) : c.push(u);
167
+ for (const a of e)
168
+ a.start < t && (t = a.start), a.end > n && (n = a.end);
169
+ const o = (t + n) / 2, d = [], s = [], c = [];
170
+ for (const a of e)
171
+ a.end < o ? d.push(a) : a.start > o ? s.push(a) : c.push(a);
172
172
  return {
173
173
  center: o,
174
174
  left: this.buildNode(d),
175
- right: this.buildNode(l),
175
+ right: this.buildNode(s),
176
176
  overlapping: c
177
177
  };
178
178
  }
@@ -188,7 +188,7 @@ class yi {
188
188
  }
189
189
  }
190
190
  }
191
- class Ti {
191
+ class Ii {
192
192
  constructor(e, t) {
193
193
  Object.defineProperty(this, "lineHeight", {
194
194
  enumerable: !0,
@@ -217,62 +217,62 @@ class Ti {
217
217
  const o = this.lineHeight * this.itemHeightRatio, d = o * 0.6;
218
218
  if (!t) {
219
219
  for (const c of e) {
220
- const u = (n == null ? void 0 : n.isParent(c.id)) ?? !1;
221
- this.layoutCache.set(c.id, { stackLevel: 0, itemHeight: u ? d : o }), this.groupMaxStack.set(c.group, 0);
220
+ const a = (n == null ? void 0 : n.isParent(c.id)) ?? !1;
221
+ this.layoutCache.set(c.id, { stackLevel: 0, itemHeight: a ? d : o }), this.groupMaxStack.set(c.group, 0);
222
222
  }
223
223
  return this.layoutCache;
224
224
  }
225
- const l = /* @__PURE__ */ new Map();
225
+ const s = /* @__PURE__ */ new Map();
226
226
  for (const c of e) {
227
- let u = l.get(c.group);
228
- u || (u = [], l.set(c.group, u)), u.push(c);
227
+ let a = s.get(c.group);
228
+ a || (a = [], s.set(c.group, a)), a.push(c);
229
229
  }
230
- for (const [c, u] of l)
231
- n ? this.computeHierarchyLayout(u, n, o, d, c) : this.computeFlatLayout(u, o, c);
230
+ for (const [c, a] of s)
231
+ n ? this.computeHierarchyLayout(a, n, o, d, c) : this.computeFlatLayout(a, o, c);
232
232
  return this.layoutCache;
233
233
  }
234
234
  computeFlatLayout(e, t, n) {
235
- e.sort((l, c) => {
236
- const u = l.start_time - c.start_time;
237
- return u !== 0 ? u : c.end_time - c.start_time - (l.end_time - l.start_time);
235
+ e.sort((s, c) => {
236
+ const a = s.start_time - c.start_time;
237
+ return a !== 0 ? a : c.end_time - c.start_time - (s.end_time - s.start_time);
238
238
  });
239
239
  const o = [];
240
240
  let d = 0;
241
- for (const l of e) {
241
+ for (const s of e) {
242
242
  let c = -1;
243
- for (let u = 0; u < o.length; u++)
244
- if (o[u] <= l.start_time) {
245
- c = u;
243
+ for (let a = 0; a < o.length; a++)
244
+ if (o[a] <= s.start_time) {
245
+ c = a;
246
246
  break;
247
247
  }
248
- c === -1 ? (c = o.length, o.push(l.end_time)) : o[c] = l.end_time, c > d && (d = c), this.layoutCache.set(l.id, { stackLevel: c, itemHeight: t });
248
+ c === -1 ? (c = o.length, o.push(s.end_time)) : o[c] = s.end_time, c > d && (d = c), this.layoutCache.set(s.id, { stackLevel: c, itemHeight: t });
249
249
  }
250
250
  this.groupMaxStack.set(n, d);
251
251
  }
252
252
  computeHierarchyLayout(e, t, n, o, d) {
253
- const l = [], c = [];
254
- for (const m of e)
255
- t.isParent(m.id) ? c.push(m) : l.push(m);
256
- l.sort((m, b) => {
257
- const T = m.start_time - b.start_time;
258
- return T !== 0 ? T : b.end_time - b.start_time - (m.end_time - m.start_time);
253
+ const s = [], c = [];
254
+ for (const p of e)
255
+ t.isParent(p.id) ? c.push(p) : s.push(p);
256
+ s.sort((p, f) => {
257
+ const M = p.start_time - f.start_time;
258
+ return M !== 0 ? M : f.end_time - f.start_time - (p.end_time - p.start_time);
259
259
  });
260
- const u = [];
261
- let p = 0;
262
- for (const m of l) {
263
- let b = -1;
264
- for (let T = 0; T < u.length; T++)
265
- if (u[T] <= m.start_time) {
266
- b = T;
260
+ const a = [];
261
+ let b = 0;
262
+ for (const p of s) {
263
+ let f = -1;
264
+ for (let M = 0; M < a.length; M++)
265
+ if (a[M] <= p.start_time) {
266
+ f = M;
267
267
  break;
268
268
  }
269
- b === -1 ? (b = u.length, u.push(m.end_time)) : u[b] = m.end_time, b > p && (p = b), this.layoutCache.set(m.id, { stackLevel: b, itemHeight: n });
269
+ f === -1 ? (f = a.length, a.push(p.end_time)) : a[f] = p.end_time, f > b && (b = f), this.layoutCache.set(p.id, { stackLevel: f, itemHeight: n });
270
270
  }
271
- c.sort((m, b) => t.getNestingDepth(b.id) - t.getNestingDepth(m.id));
272
- let M = l.length > 0 ? p + 1 : 0;
273
- for (const m of c)
274
- this.layoutCache.set(m.id, { stackLevel: M, itemHeight: o }), M > p && (p = M), M++;
275
- this.groupMaxStack.set(d, p);
271
+ c.sort((p, f) => t.getNestingDepth(f.id) - t.getNestingDepth(p.id));
272
+ let H = s.length > 0 ? b + 1 : 0;
273
+ for (const p of c)
274
+ this.layoutCache.set(p.id, { stackLevel: H, itemHeight: o }), H > b && (b = H), H++;
275
+ this.groupMaxStack.set(d, b);
276
276
  }
277
277
  getLayout(e) {
278
278
  return this.layoutCache.get(e);
@@ -281,7 +281,7 @@ class Ti {
281
281
  return ((this.groupMaxStack.get(e) ?? 0) + 1) * this.lineHeight;
282
282
  }
283
283
  }
284
- class Si {
284
+ class Ri {
285
285
  constructor() {
286
286
  Object.defineProperty(this, "parentToChildren", {
287
287
  enumerable: !0,
@@ -322,10 +322,10 @@ class Si {
322
322
  if (n.has(o)) {
323
323
  const d = this.childToParent.get(t);
324
324
  this.childToParent.delete(t);
325
- const l = this.parentToChildren.get(d);
326
- if (l) {
327
- const c = l.indexOf(t);
328
- c !== -1 && l.splice(c, 1), l.length === 0 && this.parentToChildren.delete(d);
325
+ const s = this.parentToChildren.get(d);
326
+ if (s) {
327
+ const c = s.indexOf(t);
328
+ c !== -1 && s.splice(c, 1), s.length === 0 && this.parentToChildren.delete(d);
329
329
  }
330
330
  break;
331
331
  }
@@ -359,8 +359,8 @@ class Si {
359
359
  return { start: 0, end: 0 };
360
360
  let n = t.start_time, o = t.end_time;
361
361
  const d = this.getDescendants(e);
362
- for (const l of d) {
363
- const c = this.itemMap.get(l);
362
+ for (const s of d) {
363
+ const c = this.itemMap.get(s);
364
364
  c && (c.start_time < n && (n = c.start_time), c.end_time > o && (o = c.end_time));
365
365
  }
366
366
  return { start: n, end: o };
@@ -379,9 +379,9 @@ class Si {
379
379
  if (!n)
380
380
  return [];
381
381
  const o = t - n.start_time;
382
- return this.getDescendants(e).map((l) => {
383
- const c = this.itemMap.get(l);
384
- return { itemId: l, newStart: c.start_time + o };
382
+ return this.getDescendants(e).map((s) => {
383
+ const c = this.itemMap.get(s);
384
+ return { itemId: s, newStart: c.start_time + o };
385
385
  });
386
386
  }
387
387
  getResizeConstraint(e, t) {
@@ -391,76 +391,76 @@ class Si {
391
391
  if (t === "left") {
392
392
  let o = 1 / 0;
393
393
  for (const d of n) {
394
- const l = this.itemMap.get(d);
395
- l && l.start_time < o && (o = l.start_time);
394
+ const s = this.itemMap.get(d);
395
+ s && s.start_time < o && (o = s.start_time);
396
396
  }
397
397
  return { min: -1 / 0, max: o };
398
398
  } else {
399
399
  let o = -1 / 0;
400
400
  for (const d of n) {
401
- const l = this.itemMap.get(d);
402
- l && l.end_time > o && (o = l.end_time);
401
+ const s = this.itemMap.get(d);
402
+ s && s.end_time > o && (o = s.end_time);
403
403
  }
404
404
  return { min: o, max: 1 / 0 };
405
405
  }
406
406
  }
407
407
  }
408
- function ki(i, e, t, n, o, d) {
409
- const { x: l, y: c, width: u, height: p } = t, M = d.primary;
410
- i.globalAlpha = 0.15, i.fillStyle = M, i.fillRect(l, c, u, p), i.globalAlpha = 1, i.strokeStyle = M, i.lineWidth = 1.5, i.strokeRect(l, c, u, p);
411
- const m = Math.min(p * 0.5, 6), b = c + p / 2;
412
- i.fillStyle = M, i.beginPath(), i.moveTo(l, b), i.lineTo(l + m, b - m), i.lineTo(l + m * 2, b), i.lineTo(l + m, b + m), i.closePath(), i.fill(), i.beginPath(), i.moveTo(l + u, b), i.lineTo(l + u - m, b - m), i.lineTo(l + u - m * 2, b), i.lineTo(l + u - m, b + m), i.closePath(), i.fill();
413
- const T = e.title;
414
- if (T && u > 30) {
408
+ function Oi(i, e, t, n, o, d) {
409
+ const { x: s, y: c, width: a, height: b } = t, H = d.primary;
410
+ i.globalAlpha = 0.15, i.fillStyle = H, i.fillRect(s, c, a, b), i.globalAlpha = 1, i.strokeStyle = H, i.lineWidth = 1.5, i.strokeRect(s, c, a, b);
411
+ const p = Math.min(b * 0.5, 6), f = c + b / 2;
412
+ i.fillStyle = H, i.beginPath(), i.moveTo(s, f), i.lineTo(s + p, f - p), i.lineTo(s + p * 2, f), i.lineTo(s + p, f + p), i.closePath(), i.fill(), i.beginPath(), i.moveTo(s + a, f), i.lineTo(s + a - p, f - p), i.lineTo(s + a - p * 2, f), i.lineTo(s + a - p, f + p), i.closePath(), i.fill();
413
+ const M = e.title;
414
+ if (M && a > 30) {
415
415
  i.fillStyle = d.item.text, i.font = '500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', i.textBaseline = "middle";
416
- const H = i.measureText(T).width, O = u - m * 4 - 4;
417
- if (O > 20) {
418
- const j = H > O ? T.slice(0, Math.floor(T.length * O / H)) + "..." : T;
419
- i.fillText(j, l + u / 2 - Math.min(H, O) / 2, b);
416
+ const T = i.measureText(M).width, h = a - p * 4 - 4;
417
+ if (h > 20) {
418
+ const E = T > h ? M.slice(0, Math.floor(M.length * h / T)) + "..." : M;
419
+ i.fillText(E, s + a / 2 - Math.min(T, h) / 2, f);
420
420
  }
421
421
  }
422
- n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(l - 1, c - 1, u + 2, p + 2));
422
+ n.selected && (i.strokeStyle = d.item.selectedRing, i.lineWidth = 2, i.strokeRect(s - 1, c - 1, a + 2, b + 2));
423
423
  }
424
- function $e(i, e, t, n, o, d) {
425
- const l = t.xToTime(i), c = /* @__PURE__ */ new Map();
426
- for (let m = 0; m < d.length; m++)
427
- c.set(d[m].id, m);
428
- const u = n.query(l, l);
429
- let p = null, M = -1 / 0;
430
- for (const m of u) {
431
- const b = c.get(m.group);
432
- if (b === void 0)
424
+ function Ue(i, e, t, n, o, d) {
425
+ const s = t.xToTime(i), c = /* @__PURE__ */ new Map();
426
+ for (let p = 0; p < d.length; p++)
427
+ c.set(d[p].id, p);
428
+ const a = n.query(s, s);
429
+ let b = null, H = -1 / 0;
430
+ for (const p of a) {
431
+ const f = c.get(p.group);
432
+ if (f === void 0)
433
433
  continue;
434
- const T = o.getLayout(m.id);
435
- if (!T)
434
+ const M = o.getLayout(p.id);
435
+ if (!M)
436
436
  continue;
437
- const H = t.timeToX(m.start_time), O = t.timeToX(m.end_time) - H;
438
- if (i < H || i > H + O)
437
+ const T = t.timeToX(p.start_time), h = t.timeToX(p.end_time) - T;
438
+ if (i < T || i > T + h)
439
439
  continue;
440
- const re = t.groupIndexToY(b) + T.stackLevel * t.lineHeight + (t.lineHeight - T.itemHeight) / 2, w = T.itemHeight;
441
- e < re || e > re + w || re > M && (M = re, p = m);
440
+ const P = t.groupIndexToY(f) + M.stackLevel * t.lineHeight + (t.lineHeight - M.itemHeight) / 2, W = M.itemHeight;
441
+ e < P || e > P + W || P > H && (H = P, b = p);
442
442
  }
443
- return p;
443
+ return b;
444
444
  }
445
- function mt(i, e, t) {
445
+ function Tt(i, e, t) {
446
446
  const n = e.yToGroupIndex(i);
447
447
  return t[n] ?? null;
448
448
  }
449
- function Bt(i, e, t, n = 6) {
449
+ function Gt(i, e, t, n = 6) {
450
450
  const o = t.timeToX(e.start_time), d = t.timeToX(e.end_time);
451
451
  return i - o <= n ? "left" : d - i <= n ? "right" : "body";
452
452
  }
453
- function gt(i, e, t) {
453
+ function St(i, e, t) {
454
454
  const n = window.devicePixelRatio || 1, o = Math.round(e * n), d = Math.round(t * n);
455
455
  (i.width !== o || i.height !== d) && (i.width = o, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
456
- const l = i.getContext("2d");
457
- return l.setTransform(n, 0, 0, n, 0, 0), l;
456
+ const s = i.getContext("2d");
457
+ return s.setTransform(n, 0, 0, n, 0, 0), s;
458
458
  }
459
- function pt(i, e) {
459
+ function Mt(i, e) {
460
460
  const t = window.devicePixelRatio || 1;
461
461
  i.clearRect(0, 0, e.width / t, e.height / t);
462
462
  }
463
- class wi {
463
+ class Pi {
464
464
  constructor(e) {
465
465
  Object.defineProperty(this, "dirty", {
466
466
  enumerable: !0,
@@ -496,77 +496,224 @@ class wi {
496
496
  }));
497
497
  }
498
498
  }
499
- class Mi {
500
- draw(e, t, n, o, d, l, c) {
501
- const { firstVisible: u, lastVisible: p } = t.getVisibleGroupRange();
502
- for (let w = u; w <= p; w++) {
503
- const X = t.groupIndexToY(w), E = t.groupIndexToHeight(w), R = n[w];
504
- if (!R)
499
+ var lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
500
+ function at(i) {
501
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
502
+ }
503
+ var ei = { exports: {} };
504
+ (function(i, e) {
505
+ (function(t, n) {
506
+ i.exports = n();
507
+ })(lt, function() {
508
+ var t = "minute", n = /[+-]\d\d(?::?\d\d)?/g, o = /([+-]|\d\d)/g;
509
+ return function(d, s, c) {
510
+ var a = s.prototype;
511
+ c.utc = function(h) {
512
+ var E = { date: h, utc: !0, args: arguments };
513
+ return new s(E);
514
+ }, a.utc = function(h) {
515
+ var E = c(this.toDate(), { locale: this.$L, utc: !0 });
516
+ return h ? E.add(this.utcOffset(), t) : E;
517
+ }, a.local = function() {
518
+ return c(this.toDate(), { locale: this.$L, utc: !1 });
519
+ };
520
+ var b = a.parse;
521
+ a.parse = function(h) {
522
+ h.utc && (this.$u = !0), this.$utils().u(h.$offset) || (this.$offset = h.$offset), b.call(this, h);
523
+ };
524
+ var H = a.init;
525
+ a.init = function() {
526
+ if (this.$u) {
527
+ var h = this.$d;
528
+ this.$y = h.getUTCFullYear(), this.$M = h.getUTCMonth(), this.$D = h.getUTCDate(), this.$W = h.getUTCDay(), this.$H = h.getUTCHours(), this.$m = h.getUTCMinutes(), this.$s = h.getUTCSeconds(), this.$ms = h.getUTCMilliseconds();
529
+ } else H.call(this);
530
+ };
531
+ var p = a.utcOffset;
532
+ a.utcOffset = function(h, E) {
533
+ var P = this.$utils().u;
534
+ if (P(h)) return this.$u ? 0 : P(this.$offset) ? p.call(this) : this.$offset;
535
+ if (typeof h == "string" && (h = function(w) {
536
+ w === void 0 && (w = "");
537
+ var $ = w.match(n);
538
+ if (!$) return null;
539
+ var B = ("" + $[0]).match(o) || ["-", 0, 0], I = B[0], A = 60 * +B[1] + +B[2];
540
+ return A === 0 ? 0 : I === "+" ? A : -A;
541
+ }(h), h === null)) return this;
542
+ var W = Math.abs(h) <= 16 ? 60 * h : h;
543
+ if (W === 0) return this.utc(E);
544
+ var y = this.clone();
545
+ if (E) return y.$offset = W, y.$u = !1, y;
546
+ var D = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
547
+ return (y = this.local().add(W + D, t)).$offset = W, y.$x.$localOffset = D, y;
548
+ };
549
+ var f = a.format;
550
+ a.format = function(h) {
551
+ var E = h || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
552
+ return f.call(this, E);
553
+ }, a.valueOf = function() {
554
+ var h = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
555
+ return this.$d.valueOf() - 6e4 * h;
556
+ }, a.isUTC = function() {
557
+ return !!this.$u;
558
+ }, a.toISOString = function() {
559
+ return this.toDate().toISOString();
560
+ }, a.toString = function() {
561
+ return this.toDate().toUTCString();
562
+ };
563
+ var M = a.toDate;
564
+ a.toDate = function(h) {
565
+ return h === "s" && this.$offset ? c(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : M.call(this);
566
+ };
567
+ var T = a.diff;
568
+ a.diff = function(h, E, P) {
569
+ if (h && this.$u === h.$u) return T.call(this, h, E, P);
570
+ var W = this.local(), y = c(h).local();
571
+ return T.call(W, y, E, P);
572
+ };
573
+ };
574
+ });
575
+ })(ei);
576
+ var Xi = ei.exports;
577
+ const $i = /* @__PURE__ */ at(Xi);
578
+ var ti = { exports: {} };
579
+ (function(i, e) {
580
+ (function(t, n) {
581
+ i.exports = n();
582
+ })(lt, function() {
583
+ var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {};
584
+ return function(o, d, s) {
585
+ var c, a = function(f, M, T) {
586
+ T === void 0 && (T = {});
587
+ var h = new Date(f), E = function(P, W) {
588
+ W === void 0 && (W = {});
589
+ var y = W.timeZoneName || "short", D = P + "|" + y, w = n[D];
590
+ return w || (w = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: P, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: y }), n[D] = w), w;
591
+ }(M, T);
592
+ return E.formatToParts(h);
593
+ }, b = function(f, M) {
594
+ for (var T = a(f, M), h = [], E = 0; E < T.length; E += 1) {
595
+ var P = T[E], W = P.type, y = P.value, D = t[W];
596
+ D >= 0 && (h[D] = parseInt(y, 10));
597
+ }
598
+ var w = h[3], $ = w === 24 ? 0 : w, B = h[0] + "-" + h[1] + "-" + h[2] + " " + $ + ":" + h[4] + ":" + h[5] + ":000", I = +f;
599
+ return (s.utc(B).valueOf() - (I -= I % 1e3)) / 6e4;
600
+ }, H = d.prototype;
601
+ H.tz = function(f, M) {
602
+ f === void 0 && (f = c);
603
+ var T, h = this.utcOffset(), E = this.toDate(), P = E.toLocaleString("en-US", { timeZone: f }), W = Math.round((E - new Date(P)) / 1e3 / 60), y = 15 * -Math.round(E.getTimezoneOffset() / 15) - W;
604
+ if (!Number(y)) T = this.utcOffset(0, M);
605
+ else if (T = s(P, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(y, !0), M) {
606
+ var D = T.utcOffset();
607
+ T = T.add(h - D, "minute");
608
+ }
609
+ return T.$x.$timezone = f, T;
610
+ }, H.offsetName = function(f) {
611
+ var M = this.$x.$timezone || s.tz.guess(), T = a(this.valueOf(), M, { timeZoneName: f }).find(function(h) {
612
+ return h.type.toLowerCase() === "timezonename";
613
+ });
614
+ return T && T.value;
615
+ };
616
+ var p = H.startOf;
617
+ H.startOf = function(f, M) {
618
+ if (!this.$x || !this.$x.$timezone) return p.call(this, f, M);
619
+ var T = s(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
620
+ return p.call(T, f, M).tz(this.$x.$timezone, !0);
621
+ }, s.tz = function(f, M, T) {
622
+ var h = T && M, E = T || M || c, P = b(+s(), E);
623
+ if (typeof f != "string") return s(f).tz(E);
624
+ var W = function($, B, I) {
625
+ var A = $ - 60 * B * 1e3, F = b(A, I);
626
+ if (B === F) return [A, B];
627
+ var se = b(A -= 60 * (F - B) * 1e3, I);
628
+ return F === se ? [A, F] : [$ - 60 * Math.min(F, se) * 1e3, Math.max(F, se)];
629
+ }(s.utc(f, h).valueOf(), P, E), y = W[0], D = W[1], w = s(y).utcOffset(D);
630
+ return w.$x.$timezone = E, w;
631
+ }, s.tz.guess = function() {
632
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
633
+ }, s.tz.setDefault = function(f) {
634
+ c = f;
635
+ };
636
+ };
637
+ });
638
+ })(ti);
639
+ var Fi = ti.exports;
640
+ const Yi = /* @__PURE__ */ at(Fi);
641
+ We.extend($i);
642
+ We.extend(Yi);
643
+ function Te(i, e) {
644
+ return e ? We(i).tz(e) : We(i);
645
+ }
646
+ class _i {
647
+ draw(e, t, n, o, d, s, c, a) {
648
+ const { firstVisible: b, lastVisible: H } = t.getVisibleGroupRange();
649
+ for (let y = b; y <= H; y++) {
650
+ const D = t.groupIndexToY(y), w = t.groupIndexToHeight(y), $ = n[y];
651
+ if (!$)
505
652
  continue;
506
- let z;
507
- const B = l == null ? void 0 : l(R);
508
- B != null && B.backgroundColor ? z = B.backgroundColor : z = w % 2 === 0 ? "#FFFFFF" : o.grid.rowAlt, e.fillStyle = z, e.fillRect(0, X, t.canvasWidth, E), e.strokeStyle = (B == null ? void 0 : B.borderBottomColor) ?? o.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, X + E), e.lineTo(t.canvasWidth, X + E), e.stroke();
653
+ let B;
654
+ const I = s == null ? void 0 : s($);
655
+ I != null && I.backgroundColor ? B = I.backgroundColor : B = y % 2 === 0 ? "#FFFFFF" : o.grid.rowAlt, e.fillStyle = B, e.fillRect(0, D, t.canvasWidth, w), e.strokeStyle = (I == null ? void 0 : I.borderBottomColor) ?? o.grid.line, e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, D + w), e.lineTo(t.canvasWidth, D + w), e.stroke();
509
656
  }
510
657
  if (c && c.length > 0)
511
- for (const w of c) {
512
- const X = t.timeToX(w.start), E = t.timeToX(w.end);
513
- if (E < 0 || X > t.canvasWidth)
658
+ for (const y of c) {
659
+ const D = t.timeToX(y.start), w = t.timeToX(y.end);
660
+ if (w < 0 || D > t.canvasWidth)
514
661
  continue;
515
- const R = Math.max(0, X), z = Math.min(t.canvasWidth, E) - R, B = w.opacity ?? 0.12, _ = parseInt(w.color.slice(1, 3), 16), G = parseInt(w.color.slice(3, 5), 16), q = parseInt(w.color.slice(5, 7), 16);
516
- e.fillStyle = `rgb(${Math.round(_ * B + 255 * (1 - B))},${Math.round(G * B + 255 * (1 - B))},${Math.round(q * B + 255 * (1 - B))})`, e.fillRect(R, 0, z, t.canvasHeight);
662
+ const $ = Math.max(0, D), B = Math.min(t.canvasWidth, w) - $, I = y.opacity ?? 0.12, A = parseInt(y.color.slice(1, 3), 16), F = parseInt(y.color.slice(3, 5), 16), se = parseInt(y.color.slice(5, 7), 16);
663
+ e.fillStyle = `rgb(${Math.round(A * I + 255 * (1 - I))},${Math.round(F * I + 255 * (1 - I))},${Math.round(se * I + 255 * (1 - I))})`, e.fillRect($, 0, B, t.canvasHeight);
517
664
  }
518
- const M = t.visibleTimeStart, m = t.visibleTimeEnd, H = 864e5 / (m - M) * t.canvasWidth;
519
- let O = "day";
520
- H < 2 ? O = "month" : H < 8 && (O = "week");
665
+ const p = t.visibleTimeStart, f = t.visibleTimeEnd, h = 864e5 / (f - p) * t.canvasWidth;
666
+ let E = "day";
667
+ h < 2 ? E = "month" : h < 8 && (E = "week");
521
668
  {
522
- let w = ve(M).startOf("day");
523
- const X = ve(m).endOf("day");
524
- let E = null, R = 1, z = 0;
525
- const B = [], _ = (G) => {
526
- E !== null && (e.fillStyle = E, R !== 1 && (e.globalAlpha = R), e.fillRect(z, 0, G - z, t.canvasHeight), R !== 1 && (e.globalAlpha = 1), E = null, R = 1);
669
+ let y = Te(p, a).startOf("day");
670
+ const D = Te(f, a).endOf("day");
671
+ let w = null, $ = 1, B = 0;
672
+ const I = [], A = (F) => {
673
+ w !== null && (e.fillStyle = w, $ !== 1 && (e.globalAlpha = $), e.fillRect(B, 0, F - B, t.canvasHeight), $ !== 1 && (e.globalAlpha = 1), w = null, $ = 1);
527
674
  };
528
- for (; w.isBefore(X); ) {
529
- const G = t.timeToX(w.valueOf()), q = w.toDate(), J = d == null ? void 0 : d(q);
530
- let oe = null, ue = 1;
531
- if (J != null && J.backgroundColor)
532
- oe = J.backgroundColor, ue = J.opacity ?? 1;
675
+ for (; y.isBefore(D); ) {
676
+ const F = t.timeToX(y.valueOf()), se = y.toDate(), K = d == null ? void 0 : d(se);
677
+ let te = null, be = 1;
678
+ if (K != null && K.backgroundColor)
679
+ te = K.backgroundColor, be = K.opacity ?? 1;
533
680
  else {
534
- const ye = w.day();
535
- (ye === 0 || ye === 6) && (oe = o.grid.weekend);
681
+ const Se = y.day();
682
+ (Se === 0 || Se === 6) && (te = o.grid.weekend);
536
683
  }
537
- J != null && J.borderColor && B.push({ x: G, color: J.borderColor }), oe === E && ue === R || (_(G), oe !== null && (E = oe, R = ue, z = G)), w = w.add(1, "day");
684
+ K != null && K.borderColor && I.push({ x: F, color: K.borderColor }), te === w && be === $ || (A(F), te !== null && (w = te, $ = be, B = F)), y = y.add(1, "day");
538
685
  }
539
- E !== null && _(t.timeToX(w.valueOf()));
540
- for (const G of B)
541
- e.strokeStyle = G.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(G.x, 0), e.lineTo(G.x, t.canvasHeight), e.stroke();
686
+ w !== null && A(t.timeToX(y.valueOf()));
687
+ for (const F of I)
688
+ e.strokeStyle = F.color, e.lineWidth = 0.5, e.beginPath(), e.moveTo(F.x, 0), e.lineTo(F.x, t.canvasHeight), e.stroke();
542
689
  }
543
- let j = ve(M).startOf(O);
544
- const re = ve(m).add(1, O);
545
- for (e.strokeStyle = o.grid.line, e.lineWidth = 0.5, e.beginPath(); j.isBefore(re); ) {
546
- const w = t.timeToX(j.valueOf());
547
- e.moveTo(w, 0), e.lineTo(w, t.canvasHeight), j = j.add(1, O);
690
+ let P = Te(p, a).startOf(E);
691
+ const W = Te(f, a).add(1, E);
692
+ for (e.strokeStyle = o.grid.line, e.lineWidth = 0.5, e.beginPath(); P.isBefore(W); ) {
693
+ const y = t.timeToX(P.valueOf());
694
+ e.moveTo(y, 0), e.lineTo(y, t.canvasHeight), P = P.add(1, E);
548
695
  }
549
696
  if (e.stroke(), c && c.length > 0)
550
- for (const w of c) {
551
- const X = t.timeToX(w.start), E = t.timeToX(w.end);
552
- if (!(E < 0 || X > t.canvasWidth) && (e.strokeStyle = w.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), X >= 0 && X <= t.canvasWidth && (e.moveTo(X, 0), e.lineTo(X, t.canvasHeight)), E >= 0 && E <= t.canvasWidth && (e.moveTo(E, 0), e.lineTo(E, t.canvasHeight)), e.stroke(), e.globalAlpha = 1, w.label)) {
553
- const R = Math.max(0, X), z = Math.min(t.canvasWidth, E) - R;
697
+ for (const y of c) {
698
+ const D = t.timeToX(y.start), w = t.timeToX(y.end);
699
+ if (!(w < 0 || D > t.canvasWidth) && (e.strokeStyle = y.color, e.globalAlpha = 0.4, e.lineWidth = 1, e.beginPath(), D >= 0 && D <= t.canvasWidth && (e.moveTo(D, 0), e.lineTo(D, t.canvasHeight)), w >= 0 && w <= t.canvasWidth && (e.moveTo(w, 0), e.lineTo(w, t.canvasHeight)), e.stroke(), e.globalAlpha = 1, y.label)) {
700
+ const $ = Math.max(0, D), B = Math.min(t.canvasWidth, w) - $;
554
701
  e.save(), e.font = '600 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
555
- const B = e.measureText(w.label).width, _ = 6, G = B + _ * 2, q = 18, J = R + (z - G) / 2, oe = 4;
556
- e.fillStyle = w.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(J, oe, G, q, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(w.label, J + _, oe + q / 2), e.restore();
702
+ const I = e.measureText(y.label).width, A = 6, F = I + A * 2, se = 18, K = $ + (B - F) / 2, te = 4;
703
+ e.fillStyle = y.color, e.globalAlpha = 0.9, e.beginPath(), e.roundRect(K, te, F, se, 3), e.fill(), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.fillText(y.label, K + A, te + se / 2), e.restore();
557
704
  }
558
705
  }
559
706
  }
560
707
  }
561
- const Yt = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
562
- function xt(i, e) {
708
+ const Nt = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
709
+ function ii(i, e) {
563
710
  return {
564
711
  /**
565
712
  * Draws a filled rounded rectangle.
566
713
  * Default corner radius is 3px.
567
714
  */
568
- roundRect(t, n, o, d, l = 3) {
569
- i.beginPath(), i.roundRect(t, n, o, d, l), i.fill();
715
+ roundRect(t, n, o, d, s = 3) {
716
+ i.beginPath(), i.roundRect(t, n, o, d, s), i.fill();
570
717
  },
571
718
  /**
572
719
  * Draws text at (x, y) using the standard item font.
@@ -574,13 +721,13 @@ function xt(i, e) {
574
721
  * and appends '...' so it fits within maxWidth.
575
722
  */
576
723
  fillText(t, n, o, d) {
577
- if (i.font = Yt, d !== void 0 && i.measureText(t).width > d) {
578
- let l = 0, c = t.length;
579
- for (; l < c; ) {
580
- const u = Math.ceil((l + c) / 2), p = t.slice(0, u) + "...";
581
- i.measureText(p).width <= d ? l = u : c = u - 1;
724
+ if (i.font = Nt, d !== void 0 && i.measureText(t).width > d) {
725
+ let s = 0, c = t.length;
726
+ for (; s < c; ) {
727
+ const a = Math.ceil((s + c) / 2), b = t.slice(0, a) + "...";
728
+ i.measureText(b).width <= d ? s = a : c = a - 1;
582
729
  }
583
- i.fillText(t.slice(0, l) + "...", n, o);
730
+ i.fillText(t.slice(0, s) + "...", n, o);
584
731
  } else
585
732
  i.fillText(t, n, o);
586
733
  },
@@ -589,8 +736,8 @@ function xt(i, e) {
589
736
  * spanning the given x position and width.
590
737
  */
591
738
  gradient(t, n, o, d) {
592
- const l = i.createLinearGradient(t, 0, t + n, 0);
593
- return l.addColorStop(0, o), l.addColorStop(0.5, o), l.addColorStop(0.5, d), l.addColorStop(1, d), l;
739
+ const s = i.createLinearGradient(t, 0, t + n, 0);
740
+ return s.addColorStop(0, o), s.addColorStop(0.5, o), s.addColorStop(0.5, d), s.addColorStop(1, d), s;
594
741
  },
595
742
  /**
596
743
  * Draws a vertical colored bar on the left edge of the item bounds.
@@ -606,16 +753,16 @@ function xt(i, e) {
606
753
  */
607
754
  icon(t, n, o, d = 14) {
608
755
  i.save();
609
- const l = d / 2;
756
+ const s = d / 2;
610
757
  if (t === "check") {
611
- i.fillStyle = "#31c48d", i.beginPath(), i.arc(n + l, o + l, l, 0, Math.PI * 2), i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = d * 0.12, i.beginPath();
612
- const c = n + l, u = o + l;
613
- i.moveTo(c - l * 0.45, u), i.lineTo(c - l * 0.1, u + l * 0.42), i.lineTo(c + l * 0.45, u - l * 0.35), i.stroke();
758
+ i.fillStyle = "#31c48d", i.beginPath(), i.arc(n + s, o + s, s, 0, Math.PI * 2), i.fill(), i.strokeStyle = "#ffffff", i.lineWidth = d * 0.12, i.beginPath();
759
+ const c = n + s, a = o + s;
760
+ i.moveTo(c - s * 0.45, a), i.lineTo(c - s * 0.1, a + s * 0.42), i.lineTo(c + s * 0.45, a - s * 0.35), i.stroke();
614
761
  } else if (t === "danger-red" || t === "danger-yellow") {
615
762
  const c = t === "danger-red" ? "#EF5350" : "#FBBF24";
616
- i.fillStyle = c, i.beginPath(), i.moveTo(n + l, o), i.lineTo(n + d, o + d), i.lineTo(n, o + d), i.closePath(), i.fill(), i.fillStyle = "#ffffff";
617
- const u = d * 0.12, p = n + l - u / 2;
618
- i.fillRect(p, o + d * 0.35, u, d * 0.35), i.beginPath(), i.arc(n + l, o + d * 0.82, u * 0.7, 0, Math.PI * 2), i.fill();
763
+ i.fillStyle = c, i.beginPath(), i.moveTo(n + s, o), i.lineTo(n + d, o + d), i.lineTo(n, o + d), i.closePath(), i.fill(), i.fillStyle = "#ffffff";
764
+ const a = d * 0.12, b = n + s - a / 2;
765
+ i.fillRect(b, o + d * 0.35, a, d * 0.35), i.beginPath(), i.arc(n + s, o + d * 0.82, a * 0.7, 0, Math.PI * 2), i.fill();
619
766
  }
620
767
  i.restore();
621
768
  },
@@ -623,104 +770,104 @@ function xt(i, e) {
623
770
  * Draws a pill-shaped badge with centered white text on a colored background.
624
771
  */
625
772
  badge(t, n, o, d) {
626
- i.save(), i.font = Yt;
627
- const c = i.measureText(t).width, u = 8, M = 12 + 3 * 2, m = c + u * 2, b = M / 2;
628
- i.fillStyle = d, i.beginPath(), i.roundRect(n, o, m, M, b), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + m / 2, o + M / 2), i.restore();
773
+ i.save(), i.font = Nt;
774
+ const c = i.measureText(t).width, a = 8, H = 12 + 3 * 2, p = c + a * 2, f = H / 2;
775
+ i.fillStyle = d, i.beginPath(), i.roundRect(n, o, p, H, f), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + p / 2, o + H / 2), i.restore();
629
776
  }
630
777
  };
631
778
  }
632
- class Ei {
633
- draw(e, t, n, o, d, l, c, u, p, M, m, b, T, H) {
634
- const O = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, j = t.visibleTimeStart - O, re = t.visibleTimeEnd + O, w = d.query(j, re), X = /* @__PURE__ */ new Map();
635
- for (let _ = 0; _ < n.length; _++)
636
- X.set(n[_].id, _);
637
- const E = new Set(M), R = /* @__PURE__ */ new Map(), z = -t.lineHeight, B = t.canvasHeight + t.lineHeight;
638
- for (const _ of w) {
639
- const G = X.get(_.group);
640
- if (G === void 0)
779
+ class Wi {
780
+ draw(e, t, n, o, d, s, c, a, b, H, p, f, M, T) {
781
+ const h = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, E = t.visibleTimeStart - h, P = t.visibleTimeEnd + h, W = d.query(E, P), y = /* @__PURE__ */ new Map();
782
+ for (let I = 0; I < n.length; I++)
783
+ y.set(n[I].id, I);
784
+ const D = new Set(H), w = /* @__PURE__ */ new Map(), $ = -t.lineHeight, B = t.canvasHeight + t.lineHeight;
785
+ for (const I of W) {
786
+ const A = y.get(I.group);
787
+ if (A === void 0)
641
788
  continue;
642
- const q = l.getLayout(_.id);
643
- if (!q)
789
+ const F = s.getLayout(I.id);
790
+ if (!F)
644
791
  continue;
645
- const oe = t.groupIndexToY(G) + q.stackLevel * t.lineHeight + (t.lineHeight - q.itemHeight) / 2, ue = q.itemHeight;
646
- if (oe + ue < z || oe > B)
792
+ const K = t.groupIndexToY(A) + F.stackLevel * t.lineHeight + (t.lineHeight - F.itemHeight) / 2, te = F.itemHeight;
793
+ if (K + te < $ || K > B)
647
794
  continue;
648
- const ye = t.timeToX(_.start_time), Oe = t.timeToX(_.end_time) - ye, Te = { x: ye, y: oe, width: Oe, height: ue };
649
- R.set(_.id, Te);
795
+ const be = t.timeToX(I.start_time), Se = t.timeToX(I.end_time) - be, Me = { x: be, y: K, width: Se, height: te };
796
+ w.set(I.id, Me);
650
797
  const Xe = {
651
- selected: E.has(_.id),
652
- hovered: m === _.id,
798
+ selected: D.has(I.id),
799
+ hovered: p === I.id,
653
800
  dragging: !1,
654
- filtered: _.filtered !== !1
801
+ filtered: I.filtered !== !1
655
802
  };
656
803
  e.save();
657
- const Ve = xt(e, Te);
658
- let He;
659
- T && (H != null && H.isParent(_.id)) ? He = T : u && (_.type === "control_area_group" || _.type === "construction_train") ? He = u : He = c, He(e, _, Te, Xe, Ve), e.restore();
804
+ const qe = ii(e, Me);
805
+ let De;
806
+ M && (T != null && T.isParent(I.id)) ? De = M : a && (I.type === "control_area_group" || I.type === "construction_train") ? De = a : De = c, De(e, I, Me, Xe, qe), e.restore();
660
807
  }
661
- if (b && b.length > 0) {
662
- const _ = /* @__PURE__ */ new Set();
663
- for (const G of b)
664
- R.has(G.fromItemId) || _.add(G.fromItemId), R.has(G.toItemId) || _.add(G.toItemId);
665
- if (_.size > 0) {
666
- const G = /* @__PURE__ */ new Map();
667
- for (const q of o)
668
- _.has(q.id) && G.set(q.id, q);
669
- for (const [q, J] of G) {
670
- const oe = X.get(J.group);
671
- if (oe === void 0)
808
+ if (f && f.length > 0) {
809
+ const I = /* @__PURE__ */ new Set();
810
+ for (const A of f)
811
+ w.has(A.fromItemId) || I.add(A.fromItemId), w.has(A.toItemId) || I.add(A.toItemId);
812
+ if (I.size > 0) {
813
+ const A = /* @__PURE__ */ new Map();
814
+ for (const F of o)
815
+ I.has(F.id) && A.set(F.id, F);
816
+ for (const [F, se] of A) {
817
+ const K = y.get(se.group);
818
+ if (K === void 0)
672
819
  continue;
673
- const ue = l.getLayout(q);
674
- if (!ue)
820
+ const te = s.getLayout(F);
821
+ if (!te)
675
822
  continue;
676
- const Oe = t.groupIndexToY(oe) + ue.stackLevel * t.lineHeight + (t.lineHeight - ue.itemHeight) / 2, Te = t.timeToX(J.start_time), Xe = t.timeToX(J.end_time) - Te;
677
- R.set(q, { x: Te, y: Oe, width: Xe, height: ue.itemHeight });
823
+ const Se = t.groupIndexToY(K) + te.stackLevel * t.lineHeight + (t.lineHeight - te.itemHeight) / 2, Me = t.timeToX(se.start_time), Xe = t.timeToX(se.end_time) - Me;
824
+ w.set(F, { x: Me, y: Se, width: Xe, height: te.itemHeight });
678
825
  }
679
826
  }
680
- this.drawDependencies(e, b, R, m, p);
827
+ this.drawDependencies(e, f, w, p, b);
681
828
  }
682
829
  }
683
830
  drawDependencies(e, t, n, o, d) {
684
- for (const l of t) {
685
- const c = n.get(l.fromItemId), u = n.get(l.toItemId);
686
- if (!c || !u)
831
+ for (const s of t) {
832
+ const c = n.get(s.fromItemId), a = n.get(s.toItemId);
833
+ if (!c || !a)
687
834
  continue;
688
- const p = o === l.fromItemId || o === l.toItemId;
689
- e.strokeStyle = p ? d.primary : l.color ?? "#94A3B8", e.lineWidth = p ? 2 : 1.5, e.setLineDash([]);
690
- const M = c.x + c.width, m = c.y + c.height / 2, b = u.x, T = u.y + u.height / 2, H = Math.abs(b - M), O = Math.max(H * 0.4, 30);
691
- e.beginPath(), e.moveTo(M, m), e.bezierCurveTo(M + O, m, b - O, T, b, T), e.stroke();
692
- const j = 6;
693
- e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(b, T), e.lineTo(b - j, T - j / 2), e.lineTo(b - j, T + j / 2), e.closePath(), e.fill();
835
+ const b = o === s.fromItemId || o === s.toItemId;
836
+ e.strokeStyle = b ? d.primary : s.color ?? "#94A3B8", e.lineWidth = b ? 2 : 1.5, e.setLineDash([]);
837
+ const H = c.x + c.width, p = c.y + c.height / 2, f = a.x, M = a.y + a.height / 2, T = Math.abs(f - H), h = Math.max(T * 0.4, 30);
838
+ e.beginPath(), e.moveTo(H, p), e.bezierCurveTo(H + h, p, f - h, M, f, M), e.stroke();
839
+ const E = 6;
840
+ e.fillStyle = e.strokeStyle, e.beginPath(), e.moveTo(f, M), e.lineTo(f - E, M - E / 2), e.lineTo(f - E, M + E / 2), e.closePath(), e.fill();
694
841
  }
695
842
  }
696
843
  }
697
- class Ci {
844
+ class Bi {
698
845
  draw(e, t, n, o) {
699
- const { cursorX: d, snapX: l, markers: c, interaction: u } = o;
846
+ const { cursorX: d, snapX: s, markers: c, interaction: a } = o;
700
847
  if (c)
701
- for (const p of c) {
702
- const M = t.timeToX(p.date);
703
- if (e.fillStyle = p.color, e.fillRect(M - p.width / 2, 0, p.width, t.canvasHeight), p.label) {
848
+ for (const b of c) {
849
+ const H = t.timeToX(b.date);
850
+ if (e.fillStyle = b.color, e.fillRect(H - b.width / 2, 0, b.width, t.canvasHeight), b.label) {
704
851
  e.save(), e.font = '500 10px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
705
- const m = e.measureText(p.label).width, b = 8, T = 200, H = Math.min(m + b * 2, T), O = 20, j = M - H / 2, re = 4;
706
- e.fillStyle = p.color, e.beginPath(), e.roundRect(j, re, H, O, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
707
- const w = T - b * 2, X = m > w ? p.label.slice(0, Math.floor(p.label.length * w / m)) + "…" : p.label;
708
- e.fillText(X, j + b, re + O / 2), e.restore();
852
+ const p = e.measureText(b.label).width, f = 8, M = 200, T = Math.min(p + f * 2, M), h = 20, E = H - T / 2, P = 4;
853
+ e.fillStyle = b.color, e.beginPath(), e.roundRect(E, P, T, h, 3), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle";
854
+ const W = M - f * 2, y = p > W ? b.label.slice(0, Math.floor(b.label.length * W / p)) + "…" : b.label;
855
+ e.fillText(y, E + f, P + h / 2), e.restore();
709
856
  }
710
857
  }
711
- if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), l != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(l, 0), e.lineTo(l, t.canvasHeight), e.stroke(), e.setLineDash([])), u) {
712
- u.groupChanged && u.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, u.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
713
- const p = xt(e, u.bounds);
714
- u.renderer(e, u.item, u.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, p), e.restore();
858
+ if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), s != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(s, 0), e.lineTo(s, t.canvasHeight), e.stroke(), e.setLineDash([])), a) {
859
+ a.groupChanged && a.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, a.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
860
+ const b = ii(e, a.bounds);
861
+ a.renderer(e, a.item, a.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, b), e.restore();
715
862
  }
716
863
  }
717
864
  }
718
- const Lt = 120;
719
- function Hi(i) {
865
+ const Zt = 120;
866
+ function Li(i) {
720
867
  let e = i.deltaY || i.deltaX;
721
- return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Lt, Math.min(Lt, e));
868
+ return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Zt, Math.min(Zt, e));
722
869
  }
723
- class Ii {
870
+ class zi {
724
871
  constructor(e, t, n, o, d) {
725
872
  Object.defineProperty(this, "onZoom", {
726
873
  enumerable: !0,
@@ -753,15 +900,15 @@ class Ii {
753
900
  this.visibleTimeStart = e, this.visibleTimeEnd = t;
754
901
  }
755
902
  handleWheelZoom(e, t) {
756
- const n = Hi(e), o = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + o * n / 500 : 1 / (1 + o * -n / 500), l = this.visibleTimeEnd - this.visibleTimeStart;
757
- let c = Math.round(l * d);
903
+ const n = Li(e), o = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + o * n / 500 : 1 / (1 + o * -n / 500), s = this.visibleTimeEnd - this.visibleTimeStart;
904
+ let c = Math.round(s * d);
758
905
  c = Math.max(this.minZoom, Math.min(this.maxZoom, c));
759
- const u = Math.round(this.visibleTimeStart + (l - c) * t), p = u + c;
760
- this.onZoom(u, p);
906
+ const a = Math.round(this.visibleTimeStart + (s - c) * t), b = a + c;
907
+ this.onZoom(a, b);
761
908
  }
762
909
  }
763
- const Ri = 4;
764
- class Pi {
910
+ const xi = 4;
911
+ class Ai {
765
912
  constructor(e) {
766
913
  Object.defineProperty(this, "state", {
767
914
  enumerable: !0,
@@ -794,7 +941,7 @@ class Pi {
794
941
  }, this.activated = !1;
795
942
  }
796
943
  update(e, t) {
797
- this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= Ri && (this.activated = !0));
944
+ this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= xi && (this.activated = !0));
798
945
  }
799
946
  setCurrentGroup(e) {
800
947
  this.state && (this.state.currentGroup = e);
@@ -808,8 +955,8 @@ class Pi {
808
955
  endResize(e) {
809
956
  if (!this.state)
810
957
  return null;
811
- const t = this.state.deltaX / e, n = this.state.mode === "resize-left" ? "left" : "right", d = (n === "left" ? this.state.item.start_time : this.state.item.end_time) + t, l = Math.round(d / this.dragSnap) * this.dragSnap;
812
- return this.state = null, this.activated = !1, { newTime: l, edge: n };
958
+ const t = this.state.deltaX / e, n = this.state.mode === "resize-left" ? "left" : "right", d = (n === "left" ? this.state.item.start_time : this.state.item.end_time) + t, s = Math.round(d / this.dragSnap) * this.dragSnap;
959
+ return this.state = null, this.activated = !1, { newTime: s, edge: n };
813
960
  }
814
961
  cancel() {
815
962
  this.state = null, this.activated = !1;
@@ -828,125 +975,121 @@ class Pi {
828
975
  return this.state !== null;
829
976
  }
830
977
  }
831
- function vt(i, e, t) {
978
+ function wt(i, e, t) {
832
979
  const n = [];
833
980
  for (const o of i)
834
981
  o.id !== e && (n.push(t(o.start_time)), n.push(t(o.end_time)));
835
982
  return n;
836
983
  }
837
- function it(i, e, t, n, o) {
984
+ function st(i, e, t, n, o) {
838
985
  if (e.length === 0)
839
986
  return null;
840
- let d = e[0], l = Math.abs(i - d);
987
+ let d = e[0], s = Math.abs(i - d);
841
988
  for (let c = 1; c < e.length; c++) {
842
- const u = Math.abs(i - e[c]);
843
- u < l && (l = u, d = e[c]);
989
+ const a = Math.abs(i - e[c]);
990
+ a < s && (s = a, d = e[c]);
844
991
  }
845
- return l <= t ? d : null;
992
+ return s <= t ? d : null;
846
993
  }
847
- var Vt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
848
- function Zt(i) {
849
- return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
850
- }
851
- var qt = { exports: {} };
994
+ var ni = { exports: {} };
852
995
  (function(i, e) {
853
996
  (function(t, n) {
854
997
  i.exports = n();
855
- })(Vt, function() {
998
+ })(lt, function() {
856
999
  var t = "day";
857
1000
  return function(n, o, d) {
858
- var l = function(p) {
859
- return p.add(4 - p.isoWeekday(), t);
1001
+ var s = function(b) {
1002
+ return b.add(4 - b.isoWeekday(), t);
860
1003
  }, c = o.prototype;
861
1004
  c.isoWeekYear = function() {
862
- return l(this).year();
863
- }, c.isoWeek = function(p) {
864
- if (!this.$utils().u(p)) return this.add(7 * (p - this.isoWeek()), t);
865
- var M, m, b, T, H = l(this), O = (M = this.isoWeekYear(), m = this.$u, b = (m ? d.utc : d)().year(M).startOf("year"), T = 4 - b.isoWeekday(), b.isoWeekday() > 4 && (T += 7), b.add(T, t));
866
- return H.diff(O, "week") + 1;
867
- }, c.isoWeekday = function(p) {
868
- return this.$utils().u(p) ? this.day() || 7 : this.day(this.day() % 7 ? p : p - 7);
1005
+ return s(this).year();
1006
+ }, c.isoWeek = function(b) {
1007
+ if (!this.$utils().u(b)) return this.add(7 * (b - this.isoWeek()), t);
1008
+ var H, p, f, M, T = s(this), h = (H = this.isoWeekYear(), p = this.$u, f = (p ? d.utc : d)().year(H).startOf("year"), M = 4 - f.isoWeekday(), f.isoWeekday() > 4 && (M += 7), f.add(M, t));
1009
+ return T.diff(h, "week") + 1;
1010
+ }, c.isoWeekday = function(b) {
1011
+ return this.$utils().u(b) ? this.day() || 7 : this.day(this.day() % 7 ? b : b - 7);
869
1012
  };
870
- var u = c.startOf;
871
- c.startOf = function(p, M) {
872
- var m = this.$utils(), b = !!m.u(M) || M;
873
- return m.p(p) === "isoweek" ? b ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : u.bind(this)(p, M);
1013
+ var a = c.startOf;
1014
+ c.startOf = function(b, H) {
1015
+ var p = this.$utils(), f = !!p.u(H) || H;
1016
+ return p.p(b) === "isoweek" ? f ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : a.bind(this)(b, H);
874
1017
  };
875
1018
  };
876
1019
  });
877
- })(qt);
878
- var Di = qt.exports;
879
- const Oi = /* @__PURE__ */ Zt(Di), At = 200;
880
- function jt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o, canvasHeight: d, theme: l, groupRenderer: c, onScroll: u }) {
881
- var X;
882
- const p = x(null), M = x(!1), m = Q(() => {
883
- const E = new Array(i.length + 1);
884
- E[0] = 0;
885
- for (let R = 0; R < i.length; R++)
886
- E[R + 1] = E[R] + ((n == null ? void 0 : n[R]) ?? t);
887
- return E;
888
- }, [i.length, n, t]), b = m[i.length] ?? 0, T = d, H = ne((E) => {
889
- if (i.length === 0 || E <= 0)
1020
+ })(ni);
1021
+ var ji = ni.exports;
1022
+ const Gi = /* @__PURE__ */ at(ji), Ut = 200;
1023
+ function Vt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o, canvasHeight: d, theme: s, groupRenderer: c, onScroll: a }) {
1024
+ var y;
1025
+ const b = U(null), H = U(!1), p = ee(() => {
1026
+ const D = new Array(i.length + 1);
1027
+ D[0] = 0;
1028
+ for (let w = 0; w < i.length; w++)
1029
+ D[w + 1] = D[w] + ((n == null ? void 0 : n[w]) ?? t);
1030
+ return D;
1031
+ }, [i.length, n, t]), f = p[i.length] ?? 0, M = d, T = oe((D) => {
1032
+ if (i.length === 0 || D <= 0)
890
1033
  return 0;
891
- if (E >= b)
1034
+ if (D >= f)
892
1035
  return i.length - 1;
893
- let R = 0, z = i.length - 1;
894
- for (; R < z; ) {
895
- const B = R + z >>> 1;
896
- m[B + 1] > E ? z = B : R = B + 1;
1036
+ let w = 0, $ = i.length - 1;
1037
+ for (; w < $; ) {
1038
+ const B = w + $ >>> 1;
1039
+ p[B + 1] > D ? $ = B : w = B + 1;
897
1040
  }
898
- return R;
899
- }, [i.length, m, b]), O = H(o - At), j = H(o + d + At), re = ne((E) => {
900
- M.current || u(E.currentTarget.scrollTop);
901
- }, [u]);
902
- he(() => {
903
- p.current && (M.current = !0, p.current.scrollTop = o, requestAnimationFrame(() => {
904
- M.current = !1;
1041
+ return w;
1042
+ }, [i.length, p, f]), h = T(o - Ut), E = T(o + d + Ut), P = oe((D) => {
1043
+ H.current || a(D.currentTarget.scrollTop);
1044
+ }, [a]);
1045
+ ce(() => {
1046
+ b.current && (H.current = !0, b.current.scrollTop = o, requestAnimationFrame(() => {
1047
+ H.current = !1;
905
1048
  }));
906
1049
  }, [o]);
907
- const w = [];
908
- for (let E = O; E <= j; E++) {
909
- const R = i[E];
910
- if (!R)
1050
+ const W = [];
1051
+ for (let D = h; D <= E; D++) {
1052
+ const w = i[D];
1053
+ if (!w)
911
1054
  continue;
912
- const z = m[E], B = m[E + 1] - z;
913
- w.push(se("div", { style: {
1055
+ const $ = p[D], B = p[D + 1] - $;
1056
+ W.push(le("div", { style: {
914
1057
  position: "absolute",
915
- top: z,
1058
+ top: $,
916
1059
  height: B,
917
1060
  width: "100%",
918
1061
  overflow: "hidden",
919
1062
  display: "flex",
920
1063
  alignItems: "stretch",
921
- borderBottom: `1px solid ${((X = l.grid) == null ? void 0 : X.line) ?? "#E5E5E5"}`,
1064
+ borderBottom: `1px solid ${((y = s.grid) == null ? void 0 : y.line) ?? "#E5E5E5"}`,
922
1065
  boxSizing: "border-box"
923
- }, children: c(R) }, R.id));
1066
+ }, children: c(w) }, w.id));
924
1067
  }
925
- return se("div", { ref: p, onScroll: re, style: {
1068
+ return le("div", { ref: b, onScroll: P, style: {
926
1069
  width: e,
927
- height: T,
928
- overflowY: b > d ? "auto" : "hidden",
1070
+ height: M,
1071
+ overflowY: f > d ? "auto" : "hidden",
929
1072
  overflowX: "hidden",
930
1073
  position: "relative",
931
- borderRight: `1px solid ${l.sidebar.border}`,
932
- backgroundColor: l.sidebar.bg
933
- }, children: se("div", { style: { height: b, position: "relative" }, children: w }) });
1074
+ borderRight: `1px solid ${s.sidebar.border}`,
1075
+ backgroundColor: s.sidebar.bg
1076
+ }, children: le("div", { style: { height: f, position: "relative" }, children: W }) });
934
1077
  }
935
- function Xi(i) {
1078
+ function Ni(i) {
936
1079
  return null;
937
1080
  }
938
- Xi.displayName = "TodayMarker";
939
- function Gt(i) {
1081
+ Ni.displayName = "TodayMarker";
1082
+ function qt(i) {
940
1083
  return { date: Math.floor(Date.now() / 6e4) * 6e4, color: i.color ?? "#FD7171", width: i.width ?? 6, label: i.label };
941
1084
  }
942
- function _i(i) {
1085
+ function Zi(i) {
943
1086
  return i.interval ?? 1e4;
944
1087
  }
945
- function Fi(i) {
1088
+ function Ui(i) {
946
1089
  return null;
947
1090
  }
948
- Fi.displayName = "CustomMarker";
949
- function Nt(i) {
1091
+ Ui.displayName = "CustomMarker";
1092
+ function Kt(i) {
950
1093
  return {
951
1094
  date: i.date,
952
1095
  color: i.color ?? "#3B82F6",
@@ -954,571 +1097,583 @@ function Nt(i) {
954
1097
  label: i.label
955
1098
  };
956
1099
  }
957
- ve.extend(Oi);
958
- function Wi(i) {
1100
+ We.extend(Gi);
1101
+ function Vi(i) {
959
1102
  return i ? {
960
- ...Ce,
1103
+ ...He,
961
1104
  ...i,
962
- status: { ...Ce.status, ...i.status },
963
- grid: { ...Ce.grid, ...i.grid },
964
- item: { ...Ce.item, ...i.item },
965
- marker: { ...Ce.marker, ...i.marker },
966
- sidebar: { ...Ce.sidebar, ...i.sidebar },
967
- header: { ...Ce.header, ...i.header }
968
- } : Ce;
1105
+ status: { ...He.status, ...i.status },
1106
+ grid: { ...He.grid, ...i.grid },
1107
+ item: { ...He.item, ...i.item },
1108
+ marker: { ...He.marker, ...i.marker },
1109
+ sidebar: { ...He.sidebar, ...i.sidebar },
1110
+ header: { ...He.header, ...i.header }
1111
+ } : He;
969
1112
  }
970
- const zt = 32, Ui = me.memo(pi(function(e, t) {
971
- const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: l, sidebarWidth: c, lineHeight: u, itemHeightRatio: p, stackItems: M, canMove: m, canChangeGroup: b, canResize: T, dragSnap: H, minZoom: O, maxZoom: j, theme: re, dayStyle: w, rowStyle: X, showCursorLine: E, itemRenderer: R, groupRenderer: z, sidebarGroupRenderer: B, dependencies: _, highlights: G, onItemClick: q, onItemDoubleClick: J, onItemContextMenu: oe, onItemMove: ue, onItemResize: ye, moveResizeValidator: Oe, onItemHover: Te, onCanvasDoubleClick: Xe, onCanvasContextMenu: Ve, onTimeChange: He, onZoom: bt, selected: yt = [], rightSidebarWidth: nt, rightSidebarGroupRenderer: Tt, onReady: Ze, devBadge: Kt, children: ke } = e, Se = Q(() => Wi(re), [re]), St = ne((r, s) => {
972
- for (let h = 0; h < s.length; h++)
973
- if (s[h].id === r)
974
- return h;
1113
+ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1114
+ const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: s, sidebarWidth: c, lineHeight: a, itemHeightRatio: b, stackItems: H, canMove: p, canChangeGroup: f, canResize: M, dragSnap: T, minZoom: h, maxZoom: E, theme: P, dayStyle: W, rowStyle: y, showCursorLine: D, itemRenderer: w, groupRenderer: $, sidebarGroupRenderer: B, dependencies: I, highlights: A, onItemClick: F, onItemDoubleClick: se, onItemContextMenu: K, onItemMove: te, onItemResize: be, moveResizeValidator: Se, onItemHover: Me, onCanvasDoubleClick: Xe, onCanvasContextMenu: qe, onTimeChange: De, onZoom: kt, selected: Ct = [], rightSidebarWidth: ut, rightSidebarGroupRenderer: Et, onReady: Ke, maxHeight: Be, timezone: Je, devBadge: oi, children: ke } = e, we = ee(() => Vi(P), [P]), Ht = oe((r, l) => {
1115
+ for (let m = 0; m < l.length; m++)
1116
+ if (l[m].id === r)
1117
+ return m;
975
1118
  return 0;
976
- }, []), Jt = yt.join(","), rt = Q(() => yt, [Jt]), kt = x(null), wt = x(null), Mt = x(null), Ye = x(null), Et = x(null), Qt = x(null), [ei, ti] = tt(800);
977
- he(() => {
978
- const r = Et.current;
1119
+ }, []), si = Ct.join(","), ct = ee(() => Ct, [si]), Dt = U(null), It = U(null), Rt = U(null), Le = U(null), Ot = U(null), Pt = U(null), [li, ai] = Ze(800), [ui, ci] = Ze(null);
1120
+ ce(() => {
1121
+ const r = Ot.current;
979
1122
  if (!r)
980
1123
  return;
981
- const s = new ResizeObserver((h) => {
982
- const f = h[0];
983
- f && ti(f.contentRect.width);
1124
+ const l = new ResizeObserver((m) => {
1125
+ const g = m[0];
1126
+ g && ai(g.contentRect.width);
984
1127
  });
985
- return s.observe(r), () => s.disconnect();
986
- }, []);
987
- const we = Math.max(0, ei - c - (nt ?? 0)), Ie = Q(() => {
988
- const r = new Si();
1128
+ return l.observe(r), () => l.disconnect();
1129
+ }, []), ce(() => {
1130
+ const r = Pt.current;
1131
+ if (!r || !Be)
1132
+ return;
1133
+ const l = new ResizeObserver((m) => {
1134
+ const g = m[0];
1135
+ g && ci(g.contentRect.height);
1136
+ });
1137
+ return l.observe(r), () => l.disconnect();
1138
+ }, [Be]);
1139
+ const Ce = Math.max(0, li - c - (ut ?? 0)), Ie = ee(() => {
1140
+ const r = new Ri();
989
1141
  return r.rebuild(o), r;
990
- }, [o]), ot = Q(() => {
991
- const r = new yi();
992
- return r.buildFromItems(o, (s) => Ie.getEffectiveSpan(s.id).start, (s) => Ie.getEffectiveSpan(s.id).end), r;
993
- }, [o, Ie]), Le = Q(() => {
994
- const r = new Ti(u, p);
995
- return r.computeLayout(o, M, Ie), r;
996
- }, [o, u, p, M, Ie]), Re = Q(() => n.map((r) => Le.getGroupHeight(r.id)), [n, Le]), Me = Q(() => Re.reduce((r, s) => r + s, 0), [Re]), F = x(new ft({
1142
+ }, [o]), dt = ee(() => {
1143
+ const r = new Di();
1144
+ return r.buildFromItems(o, (l) => Ie.getEffectiveSpan(l.id).start, (l) => Ie.getEffectiveSpan(l.id).end), r;
1145
+ }, [o, Ie]), ze = ee(() => {
1146
+ const r = new Ii(a, b);
1147
+ return r.computeLayout(o, H, Ie), r;
1148
+ }, [o, a, b, H, Ie]), Re = ee(() => n.map((r) => ze.getGroupHeight(r.id)), [n, ze]), Qe = ee(() => Re.reduce((r, l) => r + l, 0), [Re]), Xt = typeof Be == "number" ? Be : ui, ye = Xt ? Math.min(Qe, Xt) : Qe, L = U(new yt({
997
1149
  visibleTimeStart: e.visibleTimeStart ?? d,
998
- visibleTimeEnd: e.visibleTimeEnd ?? l,
999
- canvasWidth: we,
1000
- canvasHeight: Me,
1150
+ visibleTimeEnd: e.visibleTimeEnd ?? s,
1151
+ canvasWidth: Ce,
1152
+ canvasHeight: ye,
1001
1153
  sidebarWidth: c,
1002
- lineHeight: u,
1154
+ lineHeight: a,
1003
1155
  groupCount: n.length,
1004
1156
  buffer: e.buffer ?? 3,
1005
1157
  scrollTop: 0,
1006
1158
  groupHeights: Re
1007
- })), st = x(null), Ae = x(void 0), be = x(null), Pe = x(!1), Ct = 4, [Ht, ii] = tt(e.visibleTimeStart ?? d), [It, ni] = tt(e.visibleTimeEnd ?? l), [Rt, qe] = tt(0), je = x(null), _e = ne(() => {
1008
- const r = F.current;
1009
- ii(r.visibleTimeStart), ni(r.visibleTimeEnd), qe(r.scrollTop), je.current = null;
1010
- }, []), lt = ne(() => {
1011
- je.current === null && (je.current = setTimeout(_e, zt));
1012
- }, [_e]);
1013
- he(() => () => {
1014
- je.current !== null && clearTimeout(je.current);
1159
+ })), ft = U(null), xe = U(void 0), ve = U(null), Oe = U(!1), $t = 4, [Ft, di] = Ze(e.visibleTimeStart ?? d), [Yt, fi] = Ze(e.visibleTimeEnd ?? s), [_t, et] = Ze(0), Ae = U(null), $e = oe(() => {
1160
+ const r = L.current;
1161
+ di(r.visibleTimeStart), fi(r.visibleTimeEnd), et(r.scrollTop), Ae.current = null;
1162
+ }, []), ht = oe(() => {
1163
+ Ae.current === null && (Ae.current = setTimeout($e, Jt));
1164
+ }, [$e]);
1165
+ ce(() => () => {
1166
+ Ae.current !== null && clearTimeout(Ae.current);
1015
1167
  }, []);
1016
- const Pt = Q(() => e.summaryRenderer ? e.summaryRenderer : (r, s, h, f, a) => {
1017
- ki(r, s, h, f, a, Se);
1018
- }, [e.summaryRenderer, Se]), Fe = Q(() => new Mi(), []), We = Q(() => new Ei(), []), Be = Q(() => new Ci(), []), ee = Q(() => new Pi(H), [H]), Ue = Q(() => {
1168
+ const Wt = ee(() => e.summaryRenderer ? e.summaryRenderer : (r, l, m, g, u) => {
1169
+ Oi(r, l, m, g, u, we);
1170
+ }, [e.summaryRenderer, we]), Fe = ee(() => new _i(), []), Ye = ee(() => new Wi(), []), _e = ee(() => new Bi(), []), ie = ee(() => new Ai(T), [T]), tt = ee(() => {
1019
1171
  const r = [];
1020
- return me.Children.forEach(ke, (s) => {
1021
- var f;
1022
- if (!me.isValidElement(s))
1172
+ return me.Children.forEach(ke, (l) => {
1173
+ var g;
1174
+ if (!me.isValidElement(l))
1023
1175
  return;
1024
- const h = (f = s.type) == null ? void 0 : f.displayName;
1025
- h === "TodayMarker" ? r.push(Gt(s.props)) : h === "CustomMarker" && r.push(Nt(s.props));
1176
+ const m = (g = l.type) == null ? void 0 : g.displayName;
1177
+ m === "TodayMarker" ? r.push(qt(l.props)) : m === "CustomMarker" && r.push(Kt(l.props));
1026
1178
  }), r;
1027
- }, [ke]), Ke = Q(() => Ue.map((r) => `${r.date}|${r.color}|${r.width}|${r.label ?? ""}`).join(";"), [Ue]), Ge = x(Ue);
1028
- Ge.current = Ue;
1029
- const at = Q(() => {
1179
+ }, [ke]), it = ee(() => tt.map((r) => `${r.date}|${r.color}|${r.width}|${r.label ?? ""}`).join(";"), [tt]), je = U(tt);
1180
+ je.current = tt;
1181
+ const mt = ee(() => {
1030
1182
  let r = 0;
1031
- return me.Children.forEach(ke, (s) => {
1032
- var f;
1033
- if (!me.isValidElement(s))
1183
+ return me.Children.forEach(ke, (l) => {
1184
+ var g;
1185
+ if (!me.isValidElement(l))
1034
1186
  return;
1035
- ((f = s.type) == null ? void 0 : f.displayName) === "TodayMarker" && (r = _i(s.props));
1187
+ ((g = l.type) == null ? void 0 : g.displayName) === "TodayMarker" && (r = Zi(l.props));
1036
1188
  }), r;
1037
- }, [ke]), Y = x({
1189
+ }, [ke]), x = U({
1038
1190
  groups: n,
1039
1191
  items: o,
1040
- intervalTree: ot,
1041
- layoutEngine: Le,
1042
- itemRenderer: R,
1043
- groupRenderer: z,
1044
- theme: Se,
1045
- selected: rt,
1046
- dependencies: _,
1047
- highlights: G,
1048
- dayStyle: w,
1049
- rowStyle: X,
1050
- showCursorLine: E,
1051
- canvasWidth: we,
1052
- canvasHeight: Me,
1053
- lineHeight: u,
1054
- itemHeightRatio: p,
1055
- onTimeChange: He,
1056
- onZoom: bt,
1057
- onItemHover: Te,
1058
- onItemClick: q,
1059
- onItemDoubleClick: J,
1060
- onItemContextMenu: oe,
1061
- onItemMove: ue,
1062
- onItemResize: ye,
1192
+ intervalTree: dt,
1193
+ layoutEngine: ze,
1194
+ itemRenderer: w,
1195
+ groupRenderer: $,
1196
+ theme: we,
1197
+ selected: ct,
1198
+ dependencies: I,
1199
+ highlights: A,
1200
+ dayStyle: W,
1201
+ rowStyle: y,
1202
+ showCursorLine: D,
1203
+ canvasWidth: Ce,
1204
+ canvasHeight: ye,
1205
+ lineHeight: a,
1206
+ itemHeightRatio: b,
1207
+ onTimeChange: De,
1208
+ onZoom: kt,
1209
+ onItemHover: Me,
1210
+ onItemClick: F,
1211
+ onItemDoubleClick: se,
1212
+ onItemContextMenu: K,
1213
+ onItemMove: te,
1214
+ onItemResize: be,
1063
1215
  onCanvasDoubleClick: Xe,
1064
- onCanvasContextMenu: Ve,
1065
- canMove: m,
1066
- canResize: T,
1067
- canChangeGroup: b,
1068
- dragSnap: H,
1216
+ onCanvasContextMenu: qe,
1217
+ canMove: p,
1218
+ canResize: M,
1219
+ canChangeGroup: f,
1220
+ dragSnap: T,
1069
1221
  sidebarWidth: c,
1070
- moveResizeValidator: Oe,
1071
- summaryRenderer: Pt,
1072
- hierarchyEngine: Ie
1222
+ moveResizeValidator: Se,
1223
+ summaryRenderer: Wt,
1224
+ hierarchyEngine: Ie,
1225
+ timezone: Je
1073
1226
  });
1074
- Y.current = {
1227
+ x.current = {
1075
1228
  groups: n,
1076
1229
  items: o,
1077
- intervalTree: ot,
1078
- layoutEngine: Le,
1079
- itemRenderer: R,
1080
- groupRenderer: z,
1081
- theme: Se,
1082
- selected: rt,
1083
- dependencies: _,
1084
- highlights: G,
1085
- dayStyle: w,
1086
- rowStyle: X,
1087
- showCursorLine: E,
1088
- canvasWidth: we,
1089
- canvasHeight: Me,
1090
- lineHeight: u,
1091
- itemHeightRatio: p,
1092
- onTimeChange: He,
1093
- onZoom: bt,
1094
- onItemHover: Te,
1095
- onItemClick: q,
1096
- onItemDoubleClick: J,
1097
- onItemContextMenu: oe,
1098
- onItemMove: ue,
1099
- onItemResize: ye,
1230
+ intervalTree: dt,
1231
+ layoutEngine: ze,
1232
+ itemRenderer: w,
1233
+ groupRenderer: $,
1234
+ theme: we,
1235
+ selected: ct,
1236
+ dependencies: I,
1237
+ highlights: A,
1238
+ dayStyle: W,
1239
+ rowStyle: y,
1240
+ showCursorLine: D,
1241
+ canvasWidth: Ce,
1242
+ canvasHeight: ye,
1243
+ lineHeight: a,
1244
+ itemHeightRatio: b,
1245
+ onTimeChange: De,
1246
+ onZoom: kt,
1247
+ onItemHover: Me,
1248
+ onItemClick: F,
1249
+ onItemDoubleClick: se,
1250
+ onItemContextMenu: K,
1251
+ onItemMove: te,
1252
+ onItemResize: be,
1100
1253
  onCanvasDoubleClick: Xe,
1101
- onCanvasContextMenu: Ve,
1102
- canMove: m,
1103
- canResize: T,
1104
- canChangeGroup: b,
1105
- dragSnap: H,
1254
+ onCanvasContextMenu: qe,
1255
+ canMove: p,
1256
+ canResize: M,
1257
+ canChangeGroup: f,
1258
+ dragSnap: T,
1106
1259
  sidebarWidth: c,
1107
- moveResizeValidator: Oe,
1108
- summaryRenderer: Pt,
1109
- hierarchyEngine: Ie
1260
+ moveResizeValidator: Se,
1261
+ summaryRenderer: Wt,
1262
+ hierarchyEngine: Ie,
1263
+ timezone: Je
1110
1264
  };
1111
- const ri = ne(() => {
1112
- const r = kt.current;
1265
+ const hi = oe(() => {
1266
+ const r = Dt.current;
1113
1267
  if (!r)
1114
1268
  return;
1115
- const s = Y.current, h = gt(r, s.canvasWidth, s.canvasHeight);
1116
- pt(h, r), Fe.draw(h, F.current, s.groups, s.theme, s.dayStyle, s.rowStyle, s.highlights);
1117
- }, [Fe]), oi = ne(() => {
1118
- const r = wt.current;
1269
+ const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1270
+ Mt(m, r), Fe.draw(m, L.current, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights, l.timezone);
1271
+ }, [Fe]), mi = oe(() => {
1272
+ const r = It.current;
1119
1273
  if (!r)
1120
1274
  return;
1121
- const s = Y.current, h = gt(r, s.canvasWidth, s.canvasHeight);
1122
- pt(h, r), We.draw(h, F.current, s.groups, s.items, s.intervalTree, s.layoutEngine, s.itemRenderer, s.groupRenderer, s.theme, s.selected, Ae.current, s.dependencies, s.summaryRenderer, s.hierarchyEngine);
1123
- }, [We]), Dt = ne((r, s, h) => {
1124
- const f = F.current, a = Y.current, g = a.canvasWidth / (f.visibleTimeEnd - f.visibleTimeStart), y = s / g, k = [];
1125
- h === "move" ? (k.push(f.timeToX(r.start_time + y)), k.push(f.timeToX(r.end_time + y))) : h === "resize-left" ? k.push(f.timeToX(r.start_time + y)) : k.push(f.timeToX(r.end_time + y));
1126
- const I = (f.visibleTimeEnd - f.visibleTimeStart) * 0.1, P = a.intervalTree.query(f.visibleTimeStart - I, f.visibleTimeEnd + I), N = vt(P, r.id, (U) => f.timeToX(U));
1127
- for (const U of k) {
1128
- const Z = it(U, N, 8, g, a.dragSnap);
1129
- if (Z !== null)
1130
- return Z;
1275
+ const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1276
+ Mt(m, r), Ye.draw(m, L.current, l.groups, l.items, l.intervalTree, l.layoutEngine, l.itemRenderer, l.groupRenderer, l.theme, l.selected, xe.current, l.dependencies, l.summaryRenderer, l.hierarchyEngine);
1277
+ }, [Ye]), Bt = oe((r, l, m) => {
1278
+ const g = L.current, u = x.current, v = u.canvasWidth / (g.visibleTimeEnd - g.visibleTimeStart), k = l / v, R = [];
1279
+ m === "move" ? (R.push(g.timeToX(r.start_time + k)), R.push(g.timeToX(r.end_time + k))) : m === "resize-left" ? R.push(g.timeToX(r.start_time + k)) : R.push(g.timeToX(r.end_time + k));
1280
+ const X = (g.visibleTimeEnd - g.visibleTimeStart) * 0.1, Y = u.intervalTree.query(g.visibleTimeStart - X, g.visibleTimeEnd + X), N = wt(Y, r.id, (J) => g.timeToX(J));
1281
+ for (const J of R) {
1282
+ const q = st(J, N, 8, v, u.dragSnap);
1283
+ if (q !== null)
1284
+ return q;
1131
1285
  }
1132
- const te = h === "resize-right" ? r.end_time + y : r.start_time + y, W = Math.round(te / a.dragSnap) * a.dragSnap;
1133
- return f.timeToX(W);
1134
- }, []), si = ne(() => {
1135
- const r = Mt.current;
1286
+ const ne = m === "resize-right" ? r.end_time + k : r.start_time + k, z = Math.round(ne / u.dragSnap) * u.dragSnap;
1287
+ return g.timeToX(z);
1288
+ }, []), gi = oe(() => {
1289
+ const r = Rt.current;
1136
1290
  if (!r)
1137
1291
  return;
1138
- const s = Y.current, h = gt(r, s.canvasWidth, s.canvasHeight);
1139
- pt(h, r);
1140
- const f = F.current, a = ee.getState();
1141
- let g = null;
1142
- if (a) {
1143
- const y = f.timeToX(a.item.start_time), k = f.timeToX(a.item.end_time) - y;
1144
- let I, P;
1145
- a.mode === "resize-left" ? (I = y + a.deltaX, P = k - a.deltaX) : a.mode === "resize-right" ? (I = y, P = k + a.deltaX) : (I = y + a.deltaX, P = k);
1146
- const N = St(a.currentGroup, s.groups), te = f.groupIndexToY(N), W = a.currentGroup !== a.originalGroup;
1147
- g = {
1148
- item: a.item,
1149
- mode: a.mode,
1150
- bounds: { x: I, y: te + (s.lineHeight - s.lineHeight * s.itemHeightRatio) / 2, width: P, height: s.lineHeight * s.itemHeightRatio },
1151
- renderer: s.itemRenderer,
1152
- targetGroupY: te,
1153
- groupChanged: W
1292
+ const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1293
+ Mt(m, r);
1294
+ const g = L.current, u = ie.getState();
1295
+ let v = null;
1296
+ if (u) {
1297
+ const k = g.timeToX(u.item.start_time), R = g.timeToX(u.item.end_time) - k;
1298
+ let X, Y;
1299
+ u.mode === "resize-left" ? (X = k + u.deltaX, Y = R - u.deltaX) : u.mode === "resize-right" ? (X = k, Y = R + u.deltaX) : (X = k + u.deltaX, Y = R);
1300
+ const N = Ht(u.currentGroup, l.groups), ne = g.groupIndexToY(N), z = u.currentGroup !== u.originalGroup;
1301
+ v = {
1302
+ item: u.item,
1303
+ mode: u.mode,
1304
+ bounds: { x: X, y: ne + (l.lineHeight - l.lineHeight * l.itemHeightRatio) / 2, width: Y, height: l.lineHeight * l.itemHeightRatio },
1305
+ renderer: l.itemRenderer,
1306
+ targetGroupY: ne,
1307
+ groupChanged: z
1154
1308
  };
1155
1309
  }
1156
- Be.draw(h, f, s.theme, {
1157
- cursorX: s.showCursorLine ? st.current : null,
1158
- snapX: a ? Dt(a.item, a.deltaX, a.mode) : null,
1159
- markers: Ge.current,
1160
- interaction: g
1310
+ _e.draw(m, g, l.theme, {
1311
+ cursorX: l.showCursorLine ? ft.current : null,
1312
+ snapX: u ? Bt(u.item, u.deltaX, u.mode) : null,
1313
+ markers: je.current,
1314
+ interaction: v
1161
1315
  });
1162
- }, [Be, ee, Dt, St]), ut = x(null);
1163
- ut.current || (ut.current = new wi((r) => {
1164
- r.grid && ri(), r.items && oi(), r.overlay && si();
1316
+ }, [_e, ie, Bt, Ht]), gt = U(null);
1317
+ gt.current || (gt.current = new Pi((r) => {
1318
+ r.grid && hi(), r.items && mi(), r.overlay && gi();
1165
1319
  }));
1166
- const C = ut.current;
1167
- he(() => () => C.dispose(), [C]), he(() => {
1168
- if (!at)
1320
+ const O = gt.current;
1321
+ ce(() => () => O.dispose(), [O]), ce(() => {
1322
+ if (!mt)
1169
1323
  return;
1170
1324
  const r = setInterval(() => {
1171
- const s = [];
1172
- me.Children.forEach(ke, (h) => {
1173
- var a;
1174
- if (!me.isValidElement(h))
1325
+ const l = [];
1326
+ me.Children.forEach(ke, (m) => {
1327
+ var u;
1328
+ if (!me.isValidElement(m))
1175
1329
  return;
1176
- const f = (a = h.type) == null ? void 0 : a.displayName;
1177
- f === "TodayMarker" ? s.push(Gt(h.props)) : f === "CustomMarker" && s.push(Nt(h.props));
1178
- }), Ge.current = s, C.markDirty("overlay");
1179
- }, at);
1330
+ const g = (u = m.type) == null ? void 0 : u.displayName;
1331
+ g === "TodayMarker" ? l.push(qt(m.props)) : g === "CustomMarker" && l.push(Kt(m.props));
1332
+ }), je.current = l, O.markDirty("overlay");
1333
+ }, mt);
1180
1334
  return () => clearInterval(r);
1181
- }, [at, ke, C]), he(() => {
1182
- F.current.update({
1183
- canvasWidth: we,
1184
- canvasHeight: Me,
1335
+ }, [mt, ke, O]), ce(() => {
1336
+ L.current.update({
1337
+ canvasWidth: Ce,
1338
+ canvasHeight: ye,
1185
1339
  sidebarWidth: c,
1186
- lineHeight: u,
1340
+ lineHeight: a,
1187
1341
  groupCount: n.length,
1188
1342
  groupHeights: Re
1189
- }), C.markAllDirty();
1190
- }, [we, Me, c, u, n.length, Re, C]), he(() => {
1191
- C.markDirty("grid"), C.markDirty("items");
1192
- }, [o, n, rt, Se, w, X, ot, Le, C]);
1193
- const Je = Q(() => {
1343
+ }), O.markAllDirty();
1344
+ }, [Ce, ye, c, a, n.length, Re, O]), ce(() => {
1345
+ O.markDirty("grid"), O.markDirty("items");
1346
+ }, [o, n, ct, we, W, y, dt, ze, O]);
1347
+ const nt = ee(() => {
1194
1348
  var r;
1195
- return ((r = e.highlights) == null ? void 0 : r.map((s) => `${s.start}|${s.end}|${s.color}|${s.label ?? ""}|${s.opacity ?? ""}`).join(";")) ?? "";
1196
- }, [e.highlights]), Ot = x(Je);
1197
- he(() => {
1198
- Je !== Ot.current && (Ot.current = Je, C.markDirty("grid"));
1199
- }, [Je, C]);
1200
- const Xt = x(Ke);
1201
- he(() => {
1202
- Ke !== Xt.current && (Xt.current = Ke, C.markDirty("overlay"));
1203
- }, [Ke, C]);
1204
- const _t = x(e.visibleTimeStart), Ft = x(e.visibleTimeEnd);
1205
- e.visibleTimeStart !== void 0 && e.visibleTimeStart !== _t.current && (_t.current = e.visibleTimeStart, F.current.update({ visibleTimeStart: e.visibleTimeStart }), C.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== Ft.current && (Ft.current = e.visibleTimeEnd, F.current.update({ visibleTimeEnd: e.visibleTimeEnd }), C.markAllDirty());
1206
- const Ne = x(null), ct = ne((r) => {
1207
- Ne.current === null && (Ne.current = setTimeout(() => {
1208
- var f, a;
1209
- Ne.current = null;
1210
- const s = F.current, h = Y.current;
1211
- r === "zoom" ? (f = h.onZoom) == null || f.call(h, s.visibleTimeStart, s.visibleTimeEnd) : (a = h.onTimeChange) == null || a.call(h, s.visibleTimeStart, s.visibleTimeEnd);
1212
- }, zt));
1349
+ return ((r = e.highlights) == null ? void 0 : r.map((l) => `${l.start}|${l.end}|${l.color}|${l.label ?? ""}|${l.opacity ?? ""}`).join(";")) ?? "";
1350
+ }, [e.highlights]), Lt = U(nt);
1351
+ ce(() => {
1352
+ nt !== Lt.current && (Lt.current = nt, O.markDirty("grid"));
1353
+ }, [nt, O]);
1354
+ const zt = U(it);
1355
+ ce(() => {
1356
+ it !== zt.current && (zt.current = it, O.markDirty("overlay"));
1357
+ }, [it, O]);
1358
+ const xt = U(e.visibleTimeStart), At = U(e.visibleTimeEnd);
1359
+ e.visibleTimeStart !== void 0 && e.visibleTimeStart !== xt.current && (xt.current = e.visibleTimeStart, L.current.update({ visibleTimeStart: e.visibleTimeStart }), O.markAllDirty()), e.visibleTimeEnd !== void 0 && e.visibleTimeEnd !== At.current && (At.current = e.visibleTimeEnd, L.current.update({ visibleTimeEnd: e.visibleTimeEnd }), O.markAllDirty());
1360
+ const Ge = U(null), pt = oe((r) => {
1361
+ Ge.current === null && (Ge.current = setTimeout(() => {
1362
+ var g, u;
1363
+ Ge.current = null;
1364
+ const l = L.current, m = x.current;
1365
+ r === "zoom" ? (g = m.onZoom) == null || g.call(m, l.visibleTimeStart, l.visibleTimeEnd) : (u = m.onTimeChange) == null || u.call(m, l.visibleTimeStart, l.visibleTimeEnd);
1366
+ }, Jt));
1213
1367
  }, []);
1214
- he(() => () => {
1215
- Ne.current !== null && clearTimeout(Ne.current);
1368
+ ce(() => () => {
1369
+ Ge.current !== null && clearTimeout(Ge.current);
1216
1370
  }, []);
1217
- const Qe = x(null), dt = Q(() => new Ii((r, s) => {
1218
- var h;
1219
- F.current.update({ visibleTimeStart: r, visibleTimeEnd: s }), (h = Qe.current) == null || h.updateBounds(r, s), C.markAllDirty(), lt(), ct("zoom");
1220
- }, d, l, O, j), []);
1221
- Qe.current = dt;
1222
- const et = ne((r) => {
1223
- const s = F.current, h = s.getTotalHeight(), f = Math.max(0, h - s.canvasHeight), a = Math.max(0, Math.min(f, s.scrollTop + r));
1224
- a !== s.scrollTop && (s.update({ scrollTop: a }), C.markDirty("grid"), C.markDirty("items"), C.markDirty("overlay"), qe(a));
1225
- }, [C]), ze = ne((r) => {
1226
- var y, k, I;
1227
- const s = F.current, h = s.canvasWidth / (s.visibleTimeEnd - s.visibleTimeStart), f = r / h, a = s.visibleTimeStart + f, g = s.visibleTimeEnd + f;
1228
- s.update({ visibleTimeStart: a, visibleTimeEnd: g }), (y = Qe.current) == null || y.updateBounds(a, g), C.markAllDirty(), bi(() => _e()), (I = (k = Y.current).onTimeChange) == null || I.call(k, a, g);
1229
- }, [C, _e]);
1230
- he(() => {
1231
- const r = Ye.current;
1371
+ const rt = U(null), vt = ee(() => new zi((r, l) => {
1372
+ var m;
1373
+ L.current.update({ visibleTimeStart: r, visibleTimeEnd: l }), (m = rt.current) == null || m.updateBounds(r, l), O.markAllDirty(), ht(), pt("zoom");
1374
+ }, d, s, h, E), []);
1375
+ rt.current = vt;
1376
+ const ot = oe((r) => {
1377
+ const l = L.current, m = l.getTotalHeight(), g = Math.max(0, m - l.canvasHeight), u = Math.max(0, Math.min(g, l.scrollTop + r));
1378
+ u !== l.scrollTop && (l.update({ scrollTop: u }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(u));
1379
+ }, [O]), Ne = oe((r) => {
1380
+ var k, R, X;
1381
+ const l = L.current, m = l.canvasWidth / (l.visibleTimeEnd - l.visibleTimeStart), g = r / m, u = l.visibleTimeStart + g, v = l.visibleTimeEnd + g;
1382
+ l.update({ visibleTimeStart: u, visibleTimeEnd: v }), (k = rt.current) == null || k.updateBounds(u, v), O.markAllDirty(), Hi(() => $e()), (X = (R = x.current).onTimeChange) == null || X.call(R, u, v);
1383
+ }, [O, $e]);
1384
+ ce(() => {
1385
+ const r = Le.current;
1232
1386
  if (!r)
1233
1387
  return;
1234
- const s = (h) => {
1235
- if (h.ctrlKey || h.metaKey || h.altKey) {
1236
- h.preventDefault();
1237
- const f = r.getBoundingClientRect(), a = (h.clientX - f.left) / f.width;
1238
- dt.handleWheelZoom(h, a);
1239
- } else if (h.shiftKey)
1240
- h.preventDefault(), ze(h.deltaY || h.deltaX);
1388
+ const l = (m) => {
1389
+ if (m.ctrlKey || m.metaKey || m.altKey) {
1390
+ m.preventDefault();
1391
+ const g = r.getBoundingClientRect(), u = (m.clientX - g.left) / g.width;
1392
+ vt.handleWheelZoom(m, u);
1393
+ } else if (m.shiftKey)
1394
+ m.preventDefault(), Ne(m.deltaY || m.deltaX);
1241
1395
  else {
1242
- const f = h.deltaX;
1243
- f !== 0 && Math.abs(f) > Math.abs(h.deltaY) ? (h.preventDefault(), ze(f)) : h.deltaY !== 0 && et(h.deltaY);
1396
+ const g = m.deltaX;
1397
+ g !== 0 && Math.abs(g) > Math.abs(m.deltaY) ? (m.preventDefault(), Ne(g)) : m.deltaY !== 0 && (Qe > ye && m.preventDefault(), ot(m.deltaY));
1244
1398
  }
1245
1399
  };
1246
- return r.addEventListener("wheel", s, { passive: !1 }), () => r.removeEventListener("wheel", s);
1247
- }, [dt, et, ze]);
1248
- const Ee = x({ lastDistance: null, lastCenter: null });
1249
- he(() => {
1250
- const r = Ye.current;
1400
+ return r.addEventListener("wheel", l, { passive: !1 }), () => r.removeEventListener("wheel", l);
1401
+ }, [vt, ot, Ne, Qe, ye]);
1402
+ const Ee = U({ lastDistance: null, lastCenter: null });
1403
+ ce(() => {
1404
+ const r = Le.current;
1251
1405
  if (!r)
1252
1406
  return;
1253
- const s = (y, k) => Math.abs(y.clientX - k.clientX), h = (y, k, I) => (y.clientX + k.clientX) / 2 - I.left, f = (y) => {
1254
- y.touches.length === 2 && (y.preventDefault(), Ee.current.lastDistance = s(y.touches[0], y.touches[1]), Ee.current.lastCenter = null);
1255
- }, a = (y) => {
1256
- var k;
1257
- if (y.touches.length === 2 && Ee.current.lastDistance !== null) {
1258
- y.preventDefault();
1259
- const I = s(y.touches[0], y.touches[1]), P = r.getBoundingClientRect(), te = h(y.touches[0], y.touches[1], P) / P.width;
1260
- if (I !== 0 && Ee.current.lastDistance !== 0) {
1261
- const W = Ee.current.lastDistance / I, U = F.current, Z = U.visibleTimeEnd - U.visibleTimeStart;
1262
- let ce = Z * W;
1263
- ce = Math.max(O, Math.min(j, ce));
1264
- const $ = U.visibleTimeStart + Z * te, S = $ - ce * te, v = $ + ce * (1 - te);
1265
- U.update({ visibleTimeStart: S, visibleTimeEnd: v }), (k = Qe.current) == null || k.updateBounds(S, v), C.markAllDirty(), lt(), ct("zoom");
1407
+ const l = (k, R) => Math.abs(k.clientX - R.clientX), m = (k, R, X) => (k.clientX + R.clientX) / 2 - X.left, g = (k) => {
1408
+ k.touches.length === 2 && (k.preventDefault(), Ee.current.lastDistance = l(k.touches[0], k.touches[1]), Ee.current.lastCenter = null);
1409
+ }, u = (k) => {
1410
+ var R;
1411
+ if (k.touches.length === 2 && Ee.current.lastDistance !== null) {
1412
+ k.preventDefault();
1413
+ const X = l(k.touches[0], k.touches[1]), Y = r.getBoundingClientRect(), ne = m(k.touches[0], k.touches[1], Y) / Y.width;
1414
+ if (X !== 0 && Ee.current.lastDistance !== 0) {
1415
+ const z = Ee.current.lastDistance / X, J = L.current, q = J.visibleTimeEnd - J.visibleTimeStart;
1416
+ let de = q * z;
1417
+ de = Math.max(h, Math.min(E, de));
1418
+ const Z = J.visibleTimeStart + q * ne, C = Z - de * ne, S = Z + de * (1 - ne);
1419
+ J.update({ visibleTimeStart: C, visibleTimeEnd: S }), (R = rt.current) == null || R.updateBounds(C, S), O.markAllDirty(), ht(), pt("zoom");
1266
1420
  }
1267
- Ee.current.lastDistance = I;
1421
+ Ee.current.lastDistance = X;
1268
1422
  }
1269
- }, g = () => {
1423
+ }, v = () => {
1270
1424
  Ee.current.lastDistance = null, Ee.current.lastCenter = null;
1271
1425
  };
1272
- return r.addEventListener("touchstart", f, { passive: !1 }), r.addEventListener("touchmove", a, { passive: !1 }), r.addEventListener("touchend", g), () => {
1273
- r.removeEventListener("touchstart", f), r.removeEventListener("touchmove", a), r.removeEventListener("touchend", g);
1426
+ return r.addEventListener("touchstart", g, { passive: !1 }), r.addEventListener("touchmove", u, { passive: !1 }), r.addEventListener("touchend", v), () => {
1427
+ r.removeEventListener("touchstart", g), r.removeEventListener("touchmove", u), r.removeEventListener("touchend", v);
1274
1428
  };
1275
- }, [C, lt, ct]);
1276
- const li = ne((r) => {
1277
- var I;
1278
- const s = r.currentTarget, h = s.getBoundingClientRect(), f = r.clientX - h.left, a = r.clientY - h.top;
1279
- if (st.current = f, be.current) {
1280
- const P = r.clientX - be.current.startX, N = r.clientY - be.current.startY;
1281
- if (!Pe.current && (Math.abs(P) >= Ct || Math.abs(N) >= Ct) && (Pe.current = !0, s.style.cursor = "grabbing", s.setPointerCapture(r.pointerId)), Pe.current) {
1282
- const te = r.clientX - be.current.lastX, W = r.clientY - be.current.lastY;
1283
- be.current.lastX = r.clientX, be.current.lastY = r.clientY, Math.abs(te) > 0 && ze(-te), Math.abs(W) > 0 && et(-W);
1429
+ }, [O, ht, pt]);
1430
+ const pi = oe((r) => {
1431
+ var X;
1432
+ const l = r.currentTarget, m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top;
1433
+ if (ft.current = g, ve.current) {
1434
+ const Y = r.clientX - ve.current.startX, N = r.clientY - ve.current.startY;
1435
+ if (!Oe.current && (Math.abs(Y) >= $t || Math.abs(N) >= $t) && (Oe.current = !0, l.style.cursor = "grabbing", l.setPointerCapture(r.pointerId)), Oe.current) {
1436
+ const ne = r.clientX - ve.current.lastX, z = r.clientY - ve.current.lastY;
1437
+ ve.current.lastX = r.clientX, ve.current.lastY = r.clientY, Math.abs(ne) > 0 && Ne(-ne), Math.abs(z) > 0 && ot(-z);
1284
1438
  }
1285
1439
  return;
1286
1440
  }
1287
- if (ee.isPending()) {
1288
- if (ee.update(f, a), ee.isActive()) {
1289
- const P = ee.getState();
1290
- if (P && P.mode === "move" && Y.current.canChangeGroup) {
1291
- const N = mt(a, F.current, Y.current.groups);
1292
- N && ee.setCurrentGroup(N.id);
1441
+ if (ie.isPending()) {
1442
+ if (ie.update(g, u), ie.isActive()) {
1443
+ const Y = ie.getState();
1444
+ if (Y && Y.mode === "move" && x.current.canChangeGroup) {
1445
+ const N = Tt(u, L.current, x.current.groups);
1446
+ N && ie.setCurrentGroup(N.id);
1293
1447
  }
1294
- C.markDirty("overlay");
1448
+ O.markDirty("overlay");
1295
1449
  }
1296
1450
  return;
1297
1451
  }
1298
- Y.current.showCursorLine && C.markDirty("overlay");
1299
- const g = Y.current, y = $e(f, a, F.current, g.intervalTree, g.layoutEngine, g.groups), k = y == null ? void 0 : y.id;
1300
- if (k !== Ae.current && (Ae.current = k, C.markDirty("items"), (I = g.onItemHover) == null || I.call(g, k ?? null, r.nativeEvent)), y) {
1301
- const P = Bt(f, y, F.current), N = g.canResize;
1302
- P === "left" && (N === "left" || N === "both") || P === "right" && (N === "right" || N === "both") ? s.style.cursor = "col-resize" : g.canMove ? s.style.cursor = "grab" : s.style.cursor = "default";
1452
+ x.current.showCursorLine && O.markDirty("overlay");
1453
+ const v = x.current, k = Ue(g, u, L.current, v.intervalTree, v.layoutEngine, v.groups), R = k == null ? void 0 : k.id;
1454
+ if (R !== xe.current && (xe.current = R, O.markDirty("items"), (X = v.onItemHover) == null || X.call(v, R ?? null, r.nativeEvent)), k) {
1455
+ const Y = Gt(g, k, L.current), N = v.canResize;
1456
+ Y === "left" && (N === "left" || N === "both") || Y === "right" && (N === "right" || N === "both") ? l.style.cursor = "col-resize" : v.canMove ? l.style.cursor = "grab" : l.style.cursor = "default";
1303
1457
  } else
1304
- s.style.cursor = "default";
1305
- }, [ee, C, ze, et]), ai = ne((r) => {
1306
- const s = Y.current, h = r.currentTarget.getBoundingClientRect(), f = r.clientX - h.left, a = r.clientY - h.top, g = $e(f, a, F.current, s.intervalTree, s.layoutEngine, s.groups);
1307
- if (!g) {
1308
- be.current = { startX: r.clientX, startY: r.clientY, lastX: r.clientX, lastY: r.clientY }, Pe.current = !1;
1458
+ l.style.cursor = "default";
1459
+ }, [ie, O, Ne, ot]), vi = oe((r) => {
1460
+ const l = x.current, m = r.currentTarget.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, l.intervalTree, l.layoutEngine, l.groups);
1461
+ if (!v) {
1462
+ ve.current = { startX: r.clientX, startY: r.clientY, lastX: r.clientX, lastY: r.clientY }, Oe.current = !1;
1309
1463
  return;
1310
1464
  }
1311
- const y = Bt(f, g, F.current), k = s.canResize;
1312
- y === "left" && (k === "left" || k === "both") ? ee.startInteraction(g, "resize-left", f, a) : y === "right" && (k === "right" || k === "both") ? ee.startInteraction(g, "resize-right", f, a) : s.canMove && ee.startInteraction(g, "move", f, a);
1313
- }, [ee]), ui = ne((r) => {
1314
- var y, k, I, P, N, te;
1315
- const s = r.currentTarget;
1316
- if (be.current) {
1317
- const W = Pe.current;
1318
- if (be.current = null, Pe.current = !1, s.style.cursor = "default", W)
1465
+ const k = Gt(g, v, L.current), R = l.canResize;
1466
+ k === "left" && (R === "left" || R === "both") ? ie.startInteraction(v, "resize-left", g, u) : k === "right" && (R === "right" || R === "both") ? ie.startInteraction(v, "resize-right", g, u) : l.canMove && ie.startInteraction(v, "move", g, u);
1467
+ }, [ie]), bi = oe((r) => {
1468
+ var k, R, X, Y, N, ne;
1469
+ const l = r.currentTarget;
1470
+ if (ve.current) {
1471
+ const z = Oe.current;
1472
+ if (ve.current = null, Oe.current = !1, l.style.cursor = "default", z)
1319
1473
  return;
1320
1474
  }
1321
- if (ee.isActive()) {
1322
- const W = ee.getState(), U = F.current, Z = U.canvasWidth / (U.visibleTimeEnd - U.visibleTimeStart);
1323
- if (W) {
1324
- const ce = Y.current.moveResizeValidator;
1325
- if (W.mode === "move") {
1326
- const $ = ee.endMove(Z);
1327
- if ($) {
1328
- const S = F.current, v = Y.current, ge = W.deltaX / Z, L = S.timeToX(W.item.start_time + ge), fe = S.timeToX(W.item.end_time + ge), ae = (S.visibleTimeEnd - S.visibleTimeStart) * 0.1, D = v.intervalTree.query(S.visibleTimeStart - ae, S.visibleTimeEnd + ae), ie = vt(D, W.item.id, (de) => S.timeToX(de));
1329
- let V = $.newStartTime;
1330
- const A = it(L, ie, 8, Z, v.dragSnap);
1331
- if (A !== null)
1332
- V = S.xToTime(A);
1475
+ if (ie.isActive()) {
1476
+ const z = ie.getState(), J = L.current, q = J.canvasWidth / (J.visibleTimeEnd - J.visibleTimeStart);
1477
+ if (z) {
1478
+ const de = x.current.moveResizeValidator;
1479
+ if (z.mode === "move") {
1480
+ const Z = ie.endMove(q);
1481
+ if (Z) {
1482
+ const C = L.current, S = x.current, ge = z.deltaX / q, j = C.timeToX(z.item.start_time + ge), he = C.timeToX(z.item.end_time + ge), ue = (C.visibleTimeEnd - C.visibleTimeStart) * 0.1, _ = S.intervalTree.query(C.visibleTimeStart - ue, C.visibleTimeEnd + ue), re = wt(_, z.item.id, (fe) => C.timeToX(fe));
1483
+ let V = Z.newStartTime;
1484
+ const G = st(j, re, 8, q, S.dragSnap);
1485
+ if (G !== null)
1486
+ V = C.xToTime(G);
1333
1487
  else {
1334
- const de = it(fe, ie, 8, Z, v.dragSnap);
1335
- if (de !== null) {
1336
- const pe = W.item.end_time - W.item.start_time;
1337
- V = S.xToTime(de) - pe;
1488
+ const fe = st(he, re, 8, q, S.dragSnap);
1489
+ if (fe !== null) {
1490
+ const pe = z.item.end_time - z.item.start_time;
1491
+ V = C.xToTime(fe) - pe;
1338
1492
  }
1339
1493
  }
1340
- const K = ce ? ce("move", W.item.id, V) : V, le = Y.current.hierarchyEngine.getMoveDelta(W.item.id, K);
1341
- (k = (y = Y.current).onItemMove) == null || k.call(y, W.item.id, K, $.newGroupId, le.length > 0 ? le : void 0);
1494
+ const Q = de ? de("move", z.item.id, V) : V, ae = x.current.hierarchyEngine.getMoveDelta(z.item.id, Q);
1495
+ (R = (k = x.current).onItemMove) == null || R.call(k, z.item.id, Q, Z.newGroupId, ae.length > 0 ? ae : void 0);
1342
1496
  }
1343
1497
  } else {
1344
- const $ = ee.endResize(Z);
1345
- if ($) {
1346
- const S = F.current, v = Y.current, ge = W.deltaX / Z, L = $.edge === "left" ? W.item.start_time + ge : W.item.end_time + ge, fe = S.timeToX(L), ae = (S.visibleTimeEnd - S.visibleTimeStart) * 0.1, D = v.intervalTree.query(S.visibleTimeStart - ae, S.visibleTimeEnd + ae), ie = vt(D, W.item.id, (de) => S.timeToX(de)), V = it(fe, ie, 8, Z, v.dragSnap);
1347
- let A = V !== null ? S.xToTime(V) : $.newTime;
1348
- const K = Y.current.hierarchyEngine.getResizeConstraint(W.item.id, $.edge);
1349
- $.edge === "left" && A > K.max ? A = K.max : $.edge === "right" && A < K.min && (A = K.min);
1350
- const le = ce ? ce("resize", W.item.id, A, $.edge) : A;
1351
- (P = (I = Y.current).onItemResize) == null || P.call(I, W.item.id, le, $.edge);
1498
+ const Z = ie.endResize(q);
1499
+ if (Z) {
1500
+ const C = L.current, S = x.current, ge = z.deltaX / q, j = Z.edge === "left" ? z.item.start_time + ge : z.item.end_time + ge, he = C.timeToX(j), ue = (C.visibleTimeEnd - C.visibleTimeStart) * 0.1, _ = S.intervalTree.query(C.visibleTimeStart - ue, C.visibleTimeEnd + ue), re = wt(_, z.item.id, (fe) => C.timeToX(fe)), V = st(he, re, 8, q, S.dragSnap);
1501
+ let G = V !== null ? C.xToTime(V) : Z.newTime;
1502
+ const Q = x.current.hierarchyEngine.getResizeConstraint(z.item.id, Z.edge);
1503
+ Z.edge === "left" && G > Q.max ? G = Q.max : Z.edge === "right" && G < Q.min && (G = Q.min);
1504
+ const ae = de ? de("resize", z.item.id, G, Z.edge) : G;
1505
+ (Y = (X = x.current).onItemResize) == null || Y.call(X, z.item.id, ae, Z.edge);
1352
1506
  }
1353
1507
  }
1354
1508
  }
1355
- s.style.cursor = "default", C.markDirty("overlay");
1509
+ l.style.cursor = "default", O.markDirty("overlay");
1356
1510
  return;
1357
1511
  }
1358
- ee.isPending() && ee.cancel();
1359
- const h = s.getBoundingClientRect(), f = r.clientX - h.left, a = r.clientY - h.top, g = $e(f, a, F.current, Y.current.intervalTree, Y.current.layoutEngine, Y.current.groups);
1360
- g && ((te = (N = Y.current).onItemClick) == null || te.call(N, g.id, r.nativeEvent));
1361
- }, [ee, C]), ci = ne((r) => {
1362
- var y, k;
1363
- const s = r.currentTarget.getBoundingClientRect(), h = r.clientX - s.left, f = r.clientY - s.top, a = Y.current, g = $e(h, f, F.current, a.intervalTree, a.layoutEngine, a.groups);
1364
- if (g)
1365
- (y = a.onItemDoubleClick) == null || y.call(a, g.id, r.nativeEvent);
1512
+ ie.isPending() && ie.cancel();
1513
+ const m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, x.current.intervalTree, x.current.layoutEngine, x.current.groups);
1514
+ v && ((ne = (N = x.current).onItemClick) == null || ne.call(N, v.id, r.nativeEvent));
1515
+ }, [ie, O]), yi = oe((r) => {
1516
+ var k, R;
1517
+ const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
1518
+ if (v)
1519
+ (k = u.onItemDoubleClick) == null || k.call(u, v.id, r.nativeEvent);
1366
1520
  else {
1367
- const I = mt(f, F.current, a.groups), P = F.current.xToTime(h);
1368
- I && ((k = a.onCanvasDoubleClick) == null || k.call(a, I.id, P));
1521
+ const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
1522
+ X && ((R = u.onCanvasDoubleClick) == null || R.call(u, X.id, Y));
1369
1523
  }
1370
- }, []), di = ne((r) => {
1371
- var y, k;
1524
+ }, []), Ti = oe((r) => {
1525
+ var k, R;
1372
1526
  r.preventDefault();
1373
- const s = r.currentTarget.getBoundingClientRect(), h = r.clientX - s.left, f = r.clientY - s.top, a = Y.current, g = $e(h, f, F.current, a.intervalTree, a.layoutEngine, a.groups);
1374
- if (g)
1375
- (y = a.onItemContextMenu) == null || y.call(a, g.id, r.nativeEvent);
1527
+ const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
1528
+ if (v)
1529
+ (k = u.onItemContextMenu) == null || k.call(u, v.id, r.nativeEvent);
1376
1530
  else {
1377
- const I = mt(f, F.current, a.groups), P = F.current.xToTime(h);
1378
- I && ((k = a.onCanvasContextMenu) == null || k.call(a, I.id, P, r.nativeEvent));
1531
+ const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
1532
+ X && ((R = u.onCanvasContextMenu) == null || R.call(u, X.id, Y, r.nativeEvent));
1379
1533
  }
1380
- }, []), hi = ne(() => {
1381
- var r, s;
1382
- be.current = null, Pe.current = !1, st.current = null, Ye.current && (Ye.current.style.cursor = "default"), Ae.current !== void 0 && (Ae.current = void 0, C.markDirty("items"), (s = (r = Y.current).onItemHover) == null || s.call(r, null, new PointerEvent("pointerleave"))), Y.current.showCursorLine && C.markDirty("overlay");
1383
- }, [C]), fi = Q(() => {
1534
+ }, []), Si = oe(() => {
1535
+ var r, l;
1536
+ ve.current = null, Oe.current = !1, ft.current = null, Le.current && (Le.current.style.cursor = "default"), xe.current !== void 0 && (xe.current = void 0, O.markDirty("items"), (l = (r = x.current).onItemHover) == null || l.call(r, null, new PointerEvent("pointerleave"))), x.current.showCursorLine && O.markDirty("overlay");
1537
+ }, [O]), Mi = ee(() => {
1384
1538
  const r = [];
1385
- return me.Children.forEach(ke, (s) => {
1386
- var f;
1387
- if (!me.isValidElement(s))
1539
+ return me.Children.forEach(ke, (l) => {
1540
+ var g;
1541
+ if (!me.isValidElement(l))
1388
1542
  return;
1389
- if (((f = s.type) == null ? void 0 : f.displayName) === "TimelineHeaders") {
1390
- const a = s.props;
1391
- r.push(me.cloneElement(s, {
1392
- visibleTimeStart: a.visibleTimeStart ?? Ht,
1393
- visibleTimeEnd: a.visibleTimeEnd ?? It,
1394
- canvasWidth: a.canvasWidth ?? we,
1395
- sidebarWidth: a.sidebarWidth ?? c,
1396
- theme: a.theme ?? Se,
1397
- onZoomToInterval: a.onZoomToInterval ?? ((g, y) => {
1398
- var k, I, P, N;
1399
- F.current.update({ visibleTimeStart: g, visibleTimeEnd: y }), C.markAllDirty(), _e(), (I = (k = Y.current).onTimeChange) == null || I.call(k, g, y), (N = (P = Y.current).onZoom) == null || N.call(P, g, y);
1543
+ if (((g = l.type) == null ? void 0 : g.displayName) === "TimelineHeaders") {
1544
+ const u = l.props;
1545
+ r.push(me.cloneElement(l, {
1546
+ visibleTimeStart: u.visibleTimeStart ?? Ft,
1547
+ visibleTimeEnd: u.visibleTimeEnd ?? Yt,
1548
+ canvasWidth: u.canvasWidth ?? Ce,
1549
+ sidebarWidth: u.sidebarWidth ?? c,
1550
+ theme: u.theme ?? we,
1551
+ timezone: u.timezone ?? Je,
1552
+ onZoomToInterval: u.onZoomToInterval ?? ((v, k) => {
1553
+ var R, X, Y, N;
1554
+ L.current.update({ visibleTimeStart: v, visibleTimeEnd: k }), O.markAllDirty(), $e(), (X = (R = x.current).onTimeChange) == null || X.call(R, v, k), (N = (Y = x.current).onZoom) == null || N.call(Y, v, k);
1400
1555
  })
1401
1556
  }));
1402
1557
  }
1403
1558
  }), r;
1404
- }, [ke, Ht, It, we, c, Se, C, _e]), Wt = x(!1);
1405
- he(() => {
1406
- Wt.current || (Wt.current = !0, C.markAllDirty());
1407
- }, [C]), vi(t, () => ({
1408
- captureToCanvas({ timeStart: r, timeEnd: s, scale: h, sidebarWidth: f }) {
1409
- const a = Y.current, g = 28, y = g * 3, k = a.groups.map((L) => a.layoutEngine.getGroupHeight(L.id)), I = [0];
1410
- for (let L = 0; L < k.length; L++)
1411
- I.push(I[L] + k[L]);
1412
- const P = I[k.length], N = F.current, te = a.canvasWidth / (N.visibleTimeEnd - N.visibleTimeStart), W = s - r, U = Math.max(a.canvasWidth, Math.round(W * te)), Z = (f + U) * h, ce = (y + P) * h, $ = document.createElement("canvas");
1413
- $.width = Z, $.height = ce;
1414
- const S = $.getContext("2d");
1415
- S.scale(h, h);
1416
- for (let L = 0; L < a.groups.length; L++) {
1417
- const fe = a.groups[L], ae = k[L], D = y + I[L];
1418
- if (a.rowStyle) {
1419
- const K = a.rowStyle(fe);
1420
- K != null && K.backgroundColor && (S.fillStyle = K.backgroundColor, S.fillRect(0, D, f, ae));
1559
+ }, [ke, Ft, Yt, Ce, c, we, Je, O, $e]), jt = U(!1);
1560
+ ce(() => {
1561
+ jt.current || (jt.current = !0, O.markAllDirty());
1562
+ }, [O]), Ei(t, () => ({
1563
+ captureToCanvas({ timeStart: r, timeEnd: l, scale: m, sidebarWidth: g }) {
1564
+ const u = x.current, v = 28, k = v * 3, R = u.groups.map((j) => u.layoutEngine.getGroupHeight(j.id)), X = [0];
1565
+ for (let j = 0; j < R.length; j++)
1566
+ X.push(X[j] + R[j]);
1567
+ const Y = X[R.length], N = L.current, ne = u.canvasWidth / (N.visibleTimeEnd - N.visibleTimeStart), z = l - r, J = Math.max(u.canvasWidth, Math.round(z * ne)), q = (g + J) * m, de = (k + Y) * m, Z = document.createElement("canvas");
1568
+ Z.width = q, Z.height = de;
1569
+ const C = Z.getContext("2d");
1570
+ C.scale(m, m);
1571
+ for (let j = 0; j < u.groups.length; j++) {
1572
+ const he = u.groups[j], ue = R[j], _ = k + X[j];
1573
+ if (u.rowStyle) {
1574
+ const Q = u.rowStyle(he);
1575
+ Q != null && Q.backgroundColor && (C.fillStyle = Q.backgroundColor, C.fillRect(0, _, g, ue));
1421
1576
  }
1422
- const ie = fe.type;
1423
- let V = "400", A = 8;
1424
- ie === "project" ? V = "700" : ie === "CAG" ? V = "600" : ie === "CA" && (V = "400", A = 24), S.fillStyle = "#111", S.font = `${V} 12px sans-serif`, S.textBaseline = "middle", S.fillText(fe.title, A, D + ae / 2, f - A - 4);
1577
+ const re = he.type;
1578
+ let V = "400", G = 8;
1579
+ re === "project" ? V = "700" : re === "CAG" ? V = "600" : re === "CA" && (V = "400", G = 24), C.fillStyle = "#111", C.font = `${V} 12px sans-serif`, C.textBaseline = "middle", C.fillText(he.title, G, _ + ue / 2, g - G - 4);
1425
1580
  }
1426
- const v = (L, fe, ae) => {
1427
- var V, A;
1428
- S.fillStyle = ((V = a.theme.header) == null ? void 0 : V.bg) ?? "#f5f5f5", S.fillRect(f, L, U, g), S.strokeStyle = ((A = a.theme.grid) == null ? void 0 : A.line) ?? "#e0e0e0", S.lineWidth = 1, S.strokeRect(f, L, U, g);
1429
- let D = ve(r).startOf(ae);
1430
- D.valueOf() < r && (D = D.add(1, ae));
1431
- const ie = U / (s - r);
1432
- for (; D.valueOf() < s; ) {
1433
- const K = D.add(1, ae), le = f + (D.valueOf() - r) * ie, pe = f + (Math.min(K.valueOf(), s) - r) * ie - le;
1434
- S.beginPath(), S.moveTo(le, L), S.lineTo(le, L + g), S.stroke(), S.fillStyle = "#333", S.font = "600 11px sans-serif", S.textBaseline = "middle", S.textAlign = "center", S.fillText(fe(D), le + pe / 2, L + g / 2, pe - 4), D = K;
1581
+ const S = (j, he, ue) => {
1582
+ var V, G;
1583
+ C.fillStyle = ((V = u.theme.header) == null ? void 0 : V.bg) ?? "#f5f5f5", C.fillRect(g, j, J, v), C.strokeStyle = ((G = u.theme.grid) == null ? void 0 : G.line) ?? "#e0e0e0", C.lineWidth = 1, C.strokeRect(g, j, J, v);
1584
+ let _ = Te(r, u.timezone).startOf(ue);
1585
+ _.valueOf() < r && (_ = _.add(1, ue));
1586
+ const re = J / (l - r);
1587
+ for (; _.valueOf() < l; ) {
1588
+ const Q = _.add(1, ue), ae = g + (_.valueOf() - r) * re, pe = g + (Math.min(Q.valueOf(), l) - r) * re - ae;
1589
+ C.beginPath(), C.moveTo(ae, j), C.lineTo(ae, j + v), C.stroke(), C.fillStyle = "#333", C.font = "600 11px sans-serif", C.textBaseline = "middle", C.textAlign = "center", C.fillText(he(_), ae + pe / 2, j + v / 2, pe - 4), _ = Q;
1435
1590
  }
1436
- S.textAlign = "start";
1591
+ C.textAlign = "start";
1437
1592
  };
1438
- v(0, (L) => L.format("YYYY"), "year"), v(g, (L) => L.format("MM"), "month"), v(g * 2, (L) => String(L.isoWeek()), "week");
1439
- const ge = new ft({
1593
+ S(0, (j) => j.format("YYYY"), "year"), S(v, (j) => j.format("MM"), "month"), S(v * 2, (j) => String(j.isoWeek()), "week");
1594
+ const ge = new yt({
1440
1595
  visibleTimeStart: r,
1441
- visibleTimeEnd: s,
1442
- canvasWidth: U,
1443
- canvasHeight: P,
1596
+ visibleTimeEnd: l,
1597
+ canvasWidth: J,
1598
+ canvasHeight: Y,
1444
1599
  sidebarWidth: 0,
1445
- lineHeight: a.lineHeight,
1446
- groupCount: a.groups.length,
1600
+ lineHeight: u.lineHeight,
1601
+ groupCount: u.groups.length,
1447
1602
  buffer: 1,
1448
1603
  scrollTop: 0,
1449
- groupHeights: k
1604
+ groupHeights: R
1450
1605
  });
1451
- return S.save(), S.translate(f, y), S.beginPath(), S.rect(0, 0, U, P), S.clip(), Fe.draw(S, ge, a.groups, a.theme, a.dayStyle, a.rowStyle, a.highlights), We.draw(S, ge, a.groups, a.items, a.intervalTree, a.layoutEngine, a.itemRenderer, a.groupRenderer, a.theme, a.selected, void 0, a.dependencies, a.summaryRenderer, a.hierarchyEngine), Be.draw(S, ge, a.theme, {
1606
+ return C.save(), C.translate(g, k), C.beginPath(), C.rect(0, 0, J, Y), C.clip(), Fe.draw(C, ge, u.groups, u.theme, u.dayStyle, u.rowStyle, u.highlights, u.timezone), Ye.draw(C, ge, u.groups, u.items, u.intervalTree, u.layoutEngine, u.itemRenderer, u.groupRenderer, u.theme, u.selected, void 0, u.dependencies, u.summaryRenderer, u.hierarchyEngine), _e.draw(C, ge, u.theme, {
1452
1607
  cursorX: null,
1453
1608
  snapX: null,
1454
- markers: Ge.current,
1609
+ markers: je.current,
1455
1610
  interaction: null
1456
- }), S.restore(), $;
1611
+ }), C.restore(), Z;
1457
1612
  }
1458
- }), [Fe, We, Be]), he(() => {
1613
+ }), [Fe, Ye, _e]), ce(() => {
1459
1614
  const r = {
1460
- captureToCanvas({ timeStart: s, timeEnd: h, scale: f, sidebarWidth: a }) {
1461
- var ae;
1462
- const g = Y.current, y = 28, k = y * 3, I = g.groups.map((D) => g.layoutEngine.getGroupHeight(D.id)), P = [0];
1463
- for (let D = 0; D < I.length; D++)
1464
- P.push(P[D] + I[D]);
1465
- const N = P[I.length], te = F.current, W = g.canvasWidth / (te.visibleTimeEnd - te.visibleTimeStart), U = h - s, Z = Math.max(g.canvasWidth, Math.round(U * W)), ce = a + Z, $ = k + N, S = document.createElement("canvas");
1466
- S.width = ce * f, S.height = $ * f;
1467
- const v = S.getContext("2d");
1468
- v.scale(f, f), v.fillStyle = "#FFFFFF", v.fillRect(0, 0, ce, $), v.save(), v.beginPath(), v.rect(0, 0, a, $), v.clip(), v.fillStyle = "#F9FAFB", v.fillRect(0, 0, a, k), v.strokeStyle = "#E5E7EB", v.lineWidth = 1, v.strokeRect(0, 0, a, k);
1469
- for (let D = 0; D < g.groups.length; D++) {
1470
- const ie = g.groups[D], V = I[D], A = k + P[D], K = (ae = g.rowStyle) == null ? void 0 : ae.call(g, ie);
1471
- v.fillStyle = (K == null ? void 0 : K.backgroundColor) ?? (D % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), v.fillRect(0, A, a, V), v.strokeStyle = "#E5E5E5", v.lineWidth = 0.5, v.beginPath(), v.moveTo(0, A + V), v.lineTo(a, A + V), v.stroke();
1472
- const le = ie.type ?? "";
1473
- let de = 8, pe = "400", De = 11;
1474
- le === "project" ? (pe = "700", De = 12) : le === "control_area_group" ? pe = "600" : le === "control_area" && (de = 24), v.fillStyle = "#374151", v.font = `${pe} ${De}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, v.textBaseline = "middle";
1475
- const gi = typeof ie.title == "string" ? ie.title : String(ie.title);
1476
- v.fillText(gi, de, A + V / 2, a - de - 8);
1615
+ captureToCanvas({ timeStart: l, timeEnd: m, scale: g, sidebarWidth: u }) {
1616
+ var ue;
1617
+ const v = x.current, k = 28, R = k * 3, X = v.groups.map((_) => v.layoutEngine.getGroupHeight(_.id)), Y = [0];
1618
+ for (let _ = 0; _ < X.length; _++)
1619
+ Y.push(Y[_] + X[_]);
1620
+ const N = Y[X.length], ne = L.current, z = v.canvasWidth / (ne.visibleTimeEnd - ne.visibleTimeStart), J = m - l, q = Math.max(v.canvasWidth, Math.round(J * z)), de = u + q, Z = R + N, C = document.createElement("canvas");
1621
+ C.width = de * g, C.height = Z * g;
1622
+ const S = C.getContext("2d");
1623
+ S.scale(g, g), S.fillStyle = "#FFFFFF", S.fillRect(0, 0, de, Z), S.save(), S.beginPath(), S.rect(0, 0, u, Z), S.clip(), S.fillStyle = "#F9FAFB", S.fillRect(0, 0, u, R), S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.strokeRect(0, 0, u, R);
1624
+ for (let _ = 0; _ < v.groups.length; _++) {
1625
+ const re = v.groups[_], V = X[_], G = R + Y[_], Q = (ue = v.rowStyle) == null ? void 0 : ue.call(v, re);
1626
+ S.fillStyle = (Q == null ? void 0 : Q.backgroundColor) ?? (_ % 2 === 0 ? "#FFFFFF" : "#F7F7F7"), S.fillRect(0, G, u, V), S.strokeStyle = "#E5E5E5", S.lineWidth = 0.5, S.beginPath(), S.moveTo(0, G + V), S.lineTo(u, G + V), S.stroke();
1627
+ const ae = re.type ?? "";
1628
+ let fe = 8, pe = "400", Pe = 11;
1629
+ ae === "project" ? (pe = "700", Pe = 12) : ae === "control_area_group" ? pe = "600" : ae === "control_area" && (fe = 24), S.fillStyle = "#374151", S.font = `${pe} ${Pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, S.textBaseline = "middle";
1630
+ const ki = typeof re.title == "string" ? re.title : String(re.title);
1631
+ S.fillText(ki, fe, G + V / 2, u - fe - 8);
1477
1632
  }
1478
- v.strokeStyle = "#E5E7EB", v.lineWidth = 1, v.beginPath(), v.moveTo(a, 0), v.lineTo(a, $), v.stroke(), v.restore(), v.save(), v.beginPath(), v.rect(a, 0, Z, k), v.clip();
1479
- const ge = h - s, L = [
1633
+ S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.beginPath(), S.moveTo(u, 0), S.lineTo(u, Z), S.stroke(), S.restore(), S.save(), S.beginPath(), S.rect(u, 0, q, R), S.clip();
1634
+ const ge = m - l, j = [
1480
1635
  { unit: "year", row: 0 },
1481
1636
  { unit: "month", row: 1 },
1482
1637
  { unit: "week", row: 2 }
1483
1638
  ];
1484
- for (const { unit: D, row: ie } of L) {
1485
- const V = ie * y;
1486
- v.fillStyle = "#F9FAFB", v.fillRect(a, V, Z, y);
1487
- let A = ve(s).startOf(D);
1488
- const K = ve(h).add(1, D);
1489
- for (; A.isBefore(K); ) {
1490
- const le = A.add(1, D), de = a + (A.valueOf() - s) / ge * Z, pe = (le.valueOf() - A.valueOf()) / ge * Z;
1491
- v.strokeStyle = "#E5E7EB", v.lineWidth = 0.5, v.strokeRect(de, V, pe, y);
1492
- let De;
1493
- D === "year" ? De = A.format("YYYY") : D === "month" ? De = A.format("MM") : De = `${A.week()}`, v.fillStyle = "#6c737f", v.font = D === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', v.textBaseline = "middle", v.textAlign = "center", pe > 20 && v.fillText(De, de + pe / 2, V + y / 2), A = le;
1639
+ for (const { unit: _, row: re } of j) {
1640
+ const V = re * k;
1641
+ S.fillStyle = "#F9FAFB", S.fillRect(u, V, q, k);
1642
+ let G = Te(l, v.timezone).startOf(_);
1643
+ const Q = Te(m, v.timezone).add(1, _);
1644
+ for (; G.isBefore(Q); ) {
1645
+ const ae = G.add(1, _), fe = u + (G.valueOf() - l) / ge * q, pe = (ae.valueOf() - G.valueOf()) / ge * q;
1646
+ S.strokeStyle = "#E5E7EB", S.lineWidth = 0.5, S.strokeRect(fe, V, pe, k);
1647
+ let Pe;
1648
+ _ === "year" ? Pe = G.format("YYYY") : _ === "month" ? Pe = G.format("MM") : Pe = `${G.week()}`, S.fillStyle = "#6c737f", S.font = _ === "year" ? '600 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif' : '400 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', S.textBaseline = "middle", S.textAlign = "center", pe > 20 && S.fillText(Pe, fe + pe / 2, V + k / 2), G = ae;
1494
1649
  }
1495
1650
  }
1496
- v.textAlign = "start", v.restore(), v.save(), v.beginPath(), v.rect(a, k, Z, N), v.clip(), v.translate(a, k);
1497
- const fe = new ft({
1498
- visibleTimeStart: s,
1499
- visibleTimeEnd: h,
1500
- canvasWidth: Z,
1651
+ S.textAlign = "start", S.restore(), S.save(), S.beginPath(), S.rect(u, R, q, N), S.clip(), S.translate(u, R);
1652
+ const he = new yt({
1653
+ visibleTimeStart: l,
1654
+ visibleTimeEnd: m,
1655
+ canvasWidth: q,
1501
1656
  canvasHeight: N,
1502
1657
  sidebarWidth: 0,
1503
- lineHeight: g.lineHeight,
1504
- groupCount: g.groups.length,
1658
+ lineHeight: v.lineHeight,
1659
+ groupCount: v.groups.length,
1505
1660
  buffer: 1,
1506
1661
  scrollTop: 0,
1507
- groupHeights: I
1662
+ groupHeights: X
1508
1663
  });
1509
- return Fe.draw(v, fe, g.groups, g.theme, g.dayStyle, g.rowStyle, g.highlights), We.draw(v, fe, g.groups, g.items, g.intervalTree, g.layoutEngine, g.itemRenderer, g.groupRenderer, g.theme, g.selected, void 0, g.dependencies, g.summaryRenderer, g.hierarchyEngine), Be.draw(v, fe, g.theme, { cursorX: null, markers: Ge.current }), v.restore(), S;
1664
+ return Fe.draw(S, he, v.groups, v.theme, v.dayStyle, v.rowStyle, v.highlights, v.timezone), Ye.draw(S, he, v.groups, v.items, v.intervalTree, v.layoutEngine, v.itemRenderer, v.groupRenderer, v.theme, v.selected, void 0, v.dependencies, v.summaryRenderer, v.hierarchyEngine), _e.draw(S, he, v.theme, { cursorX: null, markers: je.current }), S.restore(), C;
1510
1665
  }
1511
1666
  };
1512
- Ze == null || Ze(r);
1513
- }, [Ze, Fe, We, Be]);
1514
- const mi = {
1667
+ Ke == null || Ke(r);
1668
+ }, [Ke, Fe, Ye, _e]);
1669
+ const wi = {
1515
1670
  position: "relative",
1516
- width: we,
1517
- height: Me,
1671
+ width: Ce,
1672
+ height: ye,
1518
1673
  overflow: "hidden",
1519
1674
  cursor: "default"
1520
- }, ht = { position: "absolute", top: 0, left: 0 };
1521
- return xe("div", { ref: Et, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [Kt ? xe("div", { style: {
1675
+ }, bt = { position: "absolute", top: 0, left: 0 };
1676
+ return Ve("div", { ref: Ot, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [oi ? Ve("div", { style: {
1522
1677
  position: "absolute",
1523
1678
  top: 0,
1524
1679
  left: 0,
@@ -1532,30 +1687,31 @@ const zt = 32, Ui = me.memo(pi(function(e, t) {
1532
1687
  borderBottomRightRadius: 4,
1533
1688
  pointerEvents: "none",
1534
1689
  userSelect: "none"
1535
- }, children: ["v", "0.5.0", " · ", "15:09:31"] }) : null, fi, xe("div", { ref: Qt, style: { display: "flex", overflow: "hidden" }, children: [se(jt, { groups: n, width: c, lineHeight: u, groupHeights: Re, scrollTop: Rt, canvasHeight: Me, theme: Se, groupRenderer: B, onScroll: (r) => {
1536
- F.current.update({ scrollTop: r }), C.markDirty("grid"), C.markDirty("items"), C.markDirty("overlay"), qe(r);
1537
- } }), xe("div", { ref: Ye, style: mi, onPointerMove: li, onPointerDown: ai, onPointerUp: ui, onDoubleClick: ci, onContextMenu: di, onPointerLeave: hi, children: [se("canvas", { ref: kt, style: { ...ht, zIndex: 0 } }), se("canvas", { ref: wt, style: { ...ht, zIndex: 1 } }), se("canvas", { ref: Mt, style: { ...ht, zIndex: 2 } })] }), nt && Tt ? se(jt, { groups: n, width: nt, lineHeight: u, groupHeights: Re, scrollTop: Rt, canvasHeight: Me, theme: Se, groupRenderer: Tt, onScroll: (r) => {
1538
- F.current.update({ scrollTop: r }), C.markDirty("grid"), C.markDirty("items"), C.markDirty("overlay"), qe(r);
1690
+ }, children: ["v", "0.6.0", " · ", "06:59:26"] }) : null, Mi, Ve("div", { ref: Pt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [le(Vt, { groups: n, width: c, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: B, onScroll: (r) => {
1691
+ L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
1692
+ } }), Ve("div", { ref: Le, style: wi, onPointerMove: pi, onPointerDown: vi, onPointerUp: bi, onDoubleClick: yi, onContextMenu: Ti, onPointerLeave: Si, children: [le("canvas", { ref: Dt, style: { ...bt, zIndex: 0 } }), le("canvas", { ref: It, style: { ...bt, zIndex: 1 } }), le("canvas", { ref: Rt, style: { ...bt, zIndex: 2 } })] }), ut && Et ? le(Vt, { groups: n, width: ut, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: Et, onScroll: (r) => {
1693
+ L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
1539
1694
  } }) : null] })] });
1540
1695
  }));
1541
- function Bi({ children: i, theme: e, className: t, classNames: n, style: o, visibleTimeStart: d, visibleTimeEnd: l, canvasWidth: c, sidebarWidth: u = 0, onZoomToInterval: p }) {
1542
- const M = me.Children.map(i, (m) => {
1696
+ function qi({ children: i, theme: e, className: t, classNames: n, style: o, visibleTimeStart: d, visibleTimeEnd: s, canvasWidth: c, sidebarWidth: a = 0, onZoomToInterval: b, timezone: H }) {
1697
+ const p = me.Children.map(i, (f) => {
1543
1698
  var T;
1544
- if (!me.isValidElement(m))
1545
- return m;
1546
- if (((T = m.type) == null ? void 0 : T.displayName) === "DateHeader") {
1547
- const H = m.props, O = me.cloneElement(m, {
1548
- visibleTimeStart: H.visibleTimeStart ?? d,
1549
- visibleTimeEnd: H.visibleTimeEnd ?? l,
1550
- canvasWidth: H.canvasWidth ?? c,
1551
- theme: H.theme ?? e,
1552
- onZoomToInterval: H.onIntervalClick ?? H.onZoomToInterval ?? p
1699
+ if (!me.isValidElement(f))
1700
+ return f;
1701
+ if (((T = f.type) == null ? void 0 : T.displayName) === "DateHeader") {
1702
+ const h = f.props, E = me.cloneElement(f, {
1703
+ visibleTimeStart: h.visibleTimeStart ?? d,
1704
+ visibleTimeEnd: h.visibleTimeEnd ?? s,
1705
+ canvasWidth: h.canvasWidth ?? c,
1706
+ theme: h.theme ?? e,
1707
+ onZoomToInterval: h.onIntervalClick ?? h.onZoomToInterval ?? b,
1708
+ timezone: h.timezone ?? H
1553
1709
  });
1554
- return xe("div", { style: { display: "flex" }, children: [se("div", { style: { width: u, flexShrink: 0 } }), se("div", { style: { flex: 1, overflow: "hidden" }, children: O })] });
1710
+ return Ve("div", { style: { display: "flex" }, children: [le("div", { style: { width: a, flexShrink: 0 } }), le("div", { style: { flex: 1, overflow: "hidden" }, children: E })] });
1555
1711
  }
1556
- return m;
1712
+ return f;
1557
1713
  });
1558
- return se("div", { className: t, style: {
1714
+ return le("div", { className: t, style: {
1559
1715
  position: "sticky",
1560
1716
  top: 0,
1561
1717
  zIndex: 20,
@@ -1565,64 +1721,64 @@ function Bi({ children: i, theme: e, className: t, classNames: n, style: o, visi
1565
1721
  borderTop: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
1566
1722
  borderBottom: `1px solid ${(e == null ? void 0 : e.header.border) ?? "#E5E7EB"}`,
1567
1723
  ...o
1568
- }, children: M });
1724
+ }, children: p });
1569
1725
  }
1570
- Bi.displayName = "TimelineHeaders";
1571
- var Ut = { exports: {} };
1726
+ qi.displayName = "TimelineHeaders";
1727
+ var ri = { exports: {} };
1572
1728
  (function(i, e) {
1573
1729
  (function(t, n) {
1574
1730
  i.exports = n();
1575
- })(Vt, function() {
1731
+ })(lt, function() {
1576
1732
  var t = "week", n = "year";
1577
- return function(o, d, l) {
1733
+ return function(o, d, s) {
1578
1734
  var c = d.prototype;
1579
- c.week = function(u) {
1580
- if (u === void 0 && (u = null), u !== null) return this.add(7 * (u - this.week()), "day");
1581
- var p = this.$locale().yearStart || 1;
1735
+ c.week = function(a) {
1736
+ if (a === void 0 && (a = null), a !== null) return this.add(7 * (a - this.week()), "day");
1737
+ var b = this.$locale().yearStart || 1;
1582
1738
  if (this.month() === 11 && this.date() > 25) {
1583
- var M = l(this).startOf(n).add(1, n).date(p), m = l(this).endOf(t);
1584
- if (M.isBefore(m)) return 1;
1739
+ var H = s(this).startOf(n).add(1, n).date(b), p = s(this).endOf(t);
1740
+ if (H.isBefore(p)) return 1;
1585
1741
  }
1586
- var b = l(this).startOf(n).date(p).startOf(t).subtract(1, "millisecond"), T = this.diff(b, t, !0);
1587
- return T < 0 ? l(this).startOf("week").week() : Math.ceil(T);
1588
- }, c.weeks = function(u) {
1589
- return u === void 0 && (u = null), this.week(u);
1742
+ var f = s(this).startOf(n).date(b).startOf(t).subtract(1, "millisecond"), M = this.diff(f, t, !0);
1743
+ return M < 0 ? s(this).startOf("week").week() : Math.ceil(M);
1744
+ }, c.weeks = function(a) {
1745
+ return a === void 0 && (a = null), this.week(a);
1590
1746
  };
1591
1747
  };
1592
1748
  });
1593
- })(Ut);
1594
- var Yi = Ut.exports;
1595
- const Li = /* @__PURE__ */ Zt(Yi);
1596
- ve.extend(Li);
1597
- const Ai = {
1749
+ })(ri);
1750
+ var Ki = ri.exports;
1751
+ const Ji = /* @__PURE__ */ at(Ki);
1752
+ We.extend(Ji);
1753
+ const Qi = {
1598
1754
  year: 30,
1599
1755
  month: 30,
1600
1756
  week: 20,
1601
1757
  day: 15,
1602
1758
  hour: 30
1603
1759
  };
1604
- function ji({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: o, height: d = 28, className: l, labelFormat: c, onIntervalClick: u, minCellWidth: p, onZoomToInterval: M }) {
1605
- const m = Q(() => {
1760
+ function en({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: o, height: d = 28, className: s, labelFormat: c, onIntervalClick: a, minCellWidth: b, onZoomToInterval: H, timezone: p }) {
1761
+ const f = ee(() => {
1606
1762
  if (!e || !t || !n)
1607
1763
  return [];
1608
- const T = t - e, H = p ?? Ai[i];
1609
- if (H > 0) {
1610
- const w = ve(e).startOf(i);
1611
- if ((w.add(1, i).valueOf() - w.valueOf()) / T * n < H)
1764
+ const T = t - e, h = b ?? Qi[i];
1765
+ if (h > 0) {
1766
+ const y = Te(e, p).startOf(i);
1767
+ if ((y.add(1, i).valueOf() - y.valueOf()) / T * n < h)
1612
1768
  return [];
1613
1769
  }
1614
- const O = [];
1615
- let j = ve(e).startOf(i).subtract(1, i);
1616
- const re = ve(t).add(2, i).valueOf();
1617
- for (; j.valueOf() < re; ) {
1618
- const w = j.add(1, i), X = j.valueOf(), E = w.valueOf(), R = (X - e) / T * n, z = (E - X) / T * n, B = Gi(j, w, i, c);
1619
- O.push({ start: X, end: E, label: B, left: R, width: z }), j = w;
1770
+ const E = [];
1771
+ let P = Te(e, p).startOf(i).subtract(1, i);
1772
+ const W = Te(t, p).add(2, i).valueOf();
1773
+ for (; P.valueOf() < W; ) {
1774
+ const y = P.add(1, i), D = P.valueOf(), w = y.valueOf(), $ = (D - e) / T * n, B = (w - D) / T * n, I = tn(P, y, i, c);
1775
+ E.push({ start: D, end: w, label: I, left: $, width: B }), P = y;
1620
1776
  }
1621
- return O;
1622
- }, [e, t, n, i, c, p]), b = ne((T, H) => {
1623
- u ? u(T, H) : M && M(T, H);
1624
- }, [u, M]);
1625
- return m.length === 0 ? null : se("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: m.map((T) => se("div", { className: l, onClick: () => b(T.start, T.end), style: {
1777
+ return E;
1778
+ }, [e, t, n, i, c, b, p]), M = oe((T, h) => {
1779
+ a ? a(T, h) : H && H(T, h);
1780
+ }, [a, H]);
1781
+ return f.length === 0 ? null : le("div", { style: { display: "flex", position: "relative", height: d, overflow: "hidden" }, children: f.map((T) => le("div", { className: s, onClick: () => M(T.start, T.end), style: {
1626
1782
  position: "absolute",
1627
1783
  left: T.left,
1628
1784
  width: T.width,
@@ -1641,13 +1797,13 @@ function ji({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
1641
1797
  userSelect: "none",
1642
1798
  padding: "0 4px",
1643
1799
  boxSizing: "border-box"
1644
- }, children: se("span", { children: T.label }) }, T.start)) });
1800
+ }, children: le("span", { children: T.label }) }, T.start)) });
1645
1801
  }
1646
- ji.displayName = "DateHeader";
1647
- function Gi(i, e, t, n, o) {
1648
- return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : Ni(i, t);
1802
+ en.displayName = "DateHeader";
1803
+ function tn(i, e, t, n, o) {
1804
+ return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : nn(i, t);
1649
1805
  }
1650
- function Ni(i, e) {
1806
+ function nn(i, e) {
1651
1807
  switch (e) {
1652
1808
  case "year":
1653
1809
  return i.format("YYYY");
@@ -1661,24 +1817,24 @@ function Ni(i, e) {
1661
1817
  return i.format("HH:mm");
1662
1818
  }
1663
1819
  }
1664
- function zi({ width: i, children: e, style: t }) {
1820
+ function rn({ width: i, children: e, style: t }) {
1665
1821
  const n = () => ({ style: { width: i, ...t } });
1666
- return e ? se($t, { children: e({ getRootProps: n }) }) : se("div", { style: { width: i } });
1822
+ return e ? le(Qt, { children: e({ getRootProps: n }) }) : le("div", { style: { width: i } });
1667
1823
  }
1668
- zi.displayName = "SidebarHeader";
1669
- function $i({ children: i }) {
1670
- return se($t, { children: i });
1824
+ rn.displayName = "SidebarHeader";
1825
+ function on({ children: i }) {
1826
+ return le(Qt, { children: i });
1671
1827
  }
1672
- $i.displayName = "CustomHeader";
1828
+ on.displayName = "CustomHeader";
1673
1829
  export {
1674
- Ui as CanvasTimeline,
1675
- $i as CustomHeader,
1676
- Fi as CustomMarker,
1677
- Ce as DEFAULT_THEME,
1678
- ji as DateHeader,
1679
- Si as HierarchyEngine,
1680
- zi as SidebarHeader,
1681
- Bi as TimelineHeaders,
1682
- Xi as TodayMarker
1830
+ cn as CanvasTimeline,
1831
+ on as CustomHeader,
1832
+ Ui as CustomMarker,
1833
+ He as DEFAULT_THEME,
1834
+ en as DateHeader,
1835
+ Ri as HierarchyEngine,
1836
+ rn as SidebarHeader,
1837
+ qi as TimelineHeaders,
1838
+ Ni as TodayMarker
1683
1839
  };
1684
1840
  //# sourceMappingURL=canvas-timeline.es.js.map