@taskctrl/canvas-timeline 0.7.0 → 0.8.1

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