@kteneyck/cesium-timeline-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1195 @@
1
+ import Be, { useRef as T, useState as ve, useEffect as $, forwardRef as He, useCallback as oe, useImperativeHandle as Ue, useLayoutEffect as qe, useMemo as Se } from "react";
2
+ import * as C from "cesium";
3
+ import { splitForDisplay as Ge, formatDateTime as ke, drawTimeline as Ve, hitTestSwimLane as Ke, hitTestLaneLabel as Ze, isInSwimLaneRegion as Qe, zoomRange as et, TICK_AREA_HEIGHT as ze, DEFAULT_LANE_HEIGHT as Le, LANE_GAP as Ie, SWIM_LANE_SCROLL_SPEED as tt, MIN_SPAN_MS as nt, MAX_SPAN_MS as rt, toJulianDate as ge, defaultTheme as ot, generateTicks as st, timeToPosition as ct, snapToTick as it } from "@kteneyck/cesium-timeline-core";
4
+ export * from "@kteneyck/cesium-timeline-core";
5
+ import { TICK_AREA_HEIGHT as Tt } from "@kteneyck/cesium-timeline-core";
6
+ var Me = { exports: {} }, we = {};
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.js
10
+ *
11
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ var Fe;
17
+ function at() {
18
+ if (Fe) return we;
19
+ Fe = 1;
20
+ var D = Symbol.for("react.transitional.element"), k = Symbol.for("react.fragment");
21
+ function X(u, b, I) {
22
+ var q = null;
23
+ if (I !== void 0 && (q = "" + I), b.key !== void 0 && (q = "" + b.key), "key" in b) {
24
+ I = {};
25
+ for (var P in b)
26
+ P !== "key" && (I[P] = b[P]);
27
+ } else I = b;
28
+ return b = I.ref, {
29
+ $$typeof: D,
30
+ type: u,
31
+ key: q,
32
+ ref: b !== void 0 ? b : null,
33
+ props: I
34
+ };
35
+ }
36
+ return we.Fragment = k, we.jsx = X, we.jsxs = X, we;
37
+ }
38
+ var Te = {};
39
+ /**
40
+ * @license React
41
+ * react-jsx-runtime.development.js
42
+ *
43
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE file in the root directory of this source tree.
47
+ */
48
+ var Oe;
49
+ function ut() {
50
+ return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && (function() {
51
+ function D(t) {
52
+ if (t == null) return null;
53
+ if (typeof t == "function")
54
+ return t.$$typeof === Y ? null : t.displayName || t.name || null;
55
+ if (typeof t == "string") return t;
56
+ switch (t) {
57
+ case j:
58
+ return "Fragment";
59
+ case V:
60
+ return "Profiler";
61
+ case _:
62
+ return "StrictMode";
63
+ case y:
64
+ return "Suspense";
65
+ case E:
66
+ return "SuspenseList";
67
+ case U:
68
+ return "Activity";
69
+ }
70
+ if (typeof t == "object")
71
+ switch (typeof t.tag == "number" && console.error(
72
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
73
+ ), t.$$typeof) {
74
+ case x:
75
+ return "Portal";
76
+ case m:
77
+ return t.displayName || "Context";
78
+ case v:
79
+ return (t._context.displayName || "Context") + ".Consumer";
80
+ case g:
81
+ var l = t.render;
82
+ return t = t.displayName, t || (t = l.displayName || l.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
83
+ case ae:
84
+ return l = t.displayName || null, l !== null ? l : D(t.type) || "Memo";
85
+ case N:
86
+ l = t._payload, t = t._init;
87
+ try {
88
+ return D(t(l));
89
+ } catch {
90
+ }
91
+ }
92
+ return null;
93
+ }
94
+ function k(t) {
95
+ return "" + t;
96
+ }
97
+ function X(t) {
98
+ try {
99
+ k(t);
100
+ var l = !1;
101
+ } catch {
102
+ l = !0;
103
+ }
104
+ if (l) {
105
+ l = console;
106
+ var w = l.error, A = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
107
+ return w.call(
108
+ l,
109
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
+ A
111
+ ), k(t);
112
+ }
113
+ }
114
+ function u(t) {
115
+ if (t === j) return "<>";
116
+ if (typeof t == "object" && t !== null && t.$$typeof === N)
117
+ return "<...>";
118
+ try {
119
+ var l = D(t);
120
+ return l ? "<" + l + ">" : "<...>";
121
+ } catch {
122
+ return "<...>";
123
+ }
124
+ }
125
+ function b() {
126
+ var t = L.A;
127
+ return t === null ? null : t.getOwner();
128
+ }
129
+ function I() {
130
+ return Error("react-stack-top-frame");
131
+ }
132
+ function q(t) {
133
+ if (c.call(t, "key")) {
134
+ var l = Object.getOwnPropertyDescriptor(t, "key").get;
135
+ if (l && l.isReactWarning) return !1;
136
+ }
137
+ return t.key !== void 0;
138
+ }
139
+ function P(t, l) {
140
+ function w() {
141
+ re || (re = !0, console.error(
142
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
143
+ l
144
+ ));
145
+ }
146
+ w.isReactWarning = !0, Object.defineProperty(t, "key", {
147
+ get: w,
148
+ configurable: !0
149
+ });
150
+ }
151
+ function B() {
152
+ var t = D(this.type);
153
+ return W[t] || (W[t] = !0, console.error(
154
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
155
+ )), t = this.props.ref, t !== void 0 ? t : null;
156
+ }
157
+ function R(t, l, w, A, te, de) {
158
+ var S = w.ref;
159
+ return t = {
160
+ $$typeof: G,
161
+ type: t,
162
+ key: l,
163
+ props: w,
164
+ _owner: A
165
+ }, (S !== void 0 ? S : null) !== null ? Object.defineProperty(t, "ref", {
166
+ enumerable: !1,
167
+ get: B
168
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
169
+ configurable: !1,
170
+ enumerable: !1,
171
+ writable: !0,
172
+ value: 0
173
+ }), Object.defineProperty(t, "_debugInfo", {
174
+ configurable: !1,
175
+ enumerable: !1,
176
+ writable: !0,
177
+ value: null
178
+ }), Object.defineProperty(t, "_debugStack", {
179
+ configurable: !1,
180
+ enumerable: !1,
181
+ writable: !0,
182
+ value: te
183
+ }), Object.defineProperty(t, "_debugTask", {
184
+ configurable: !1,
185
+ enumerable: !1,
186
+ writable: !0,
187
+ value: de
188
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
189
+ }
190
+ function H(t, l, w, A, te, de) {
191
+ var S = l.children;
192
+ if (S !== void 0)
193
+ if (A)
194
+ if (J(S)) {
195
+ for (A = 0; A < S.length; A++)
196
+ ne(S[A]);
197
+ Object.freeze && Object.freeze(S);
198
+ } else
199
+ console.error(
200
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
+ );
202
+ else ne(S);
203
+ if (c.call(l, "key")) {
204
+ S = D(t);
205
+ var ue = Object.keys(l).filter(function(i) {
206
+ return i !== "key";
207
+ });
208
+ A = 0 < ue.length ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}", le[S + A] || (ue = 0 < ue.length ? "{" + ue.join(": ..., ") + ": ...}" : "{}", console.error(
209
+ `A props object containing a "key" prop is being spread into JSX:
210
+ let props = %s;
211
+ <%s {...props} />
212
+ React keys must be passed directly to JSX without using spread:
213
+ let props = %s;
214
+ <%s key={someKey} {...props} />`,
215
+ A,
216
+ S,
217
+ ue,
218
+ S
219
+ ), le[S + A] = !0);
220
+ }
221
+ if (S = null, w !== void 0 && (X(w), S = "" + w), q(l) && (X(l.key), S = "" + l.key), "key" in l) {
222
+ w = {};
223
+ for (var K in l)
224
+ K !== "key" && (w[K] = l[K]);
225
+ } else w = l;
226
+ return S && P(
227
+ w,
228
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
229
+ ), R(
230
+ t,
231
+ S,
232
+ w,
233
+ b(),
234
+ te,
235
+ de
236
+ );
237
+ }
238
+ function ne(t) {
239
+ Q(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === N && (t._payload.status === "fulfilled" ? Q(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
240
+ }
241
+ function Q(t) {
242
+ return typeof t == "object" && t !== null && t.$$typeof === G;
243
+ }
244
+ var ee = Be, G = Symbol.for("react.transitional.element"), x = Symbol.for("react.portal"), j = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), V = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), m = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), Y = Symbol.for("react.client.reference"), L = ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, c = Object.prototype.hasOwnProperty, J = Array.isArray, z = console.createTask ? console.createTask : function() {
245
+ return null;
246
+ };
247
+ ee = {
248
+ react_stack_bottom_frame: function(t) {
249
+ return t();
250
+ }
251
+ };
252
+ var re, W = {}, F = ee.react_stack_bottom_frame.bind(
253
+ ee,
254
+ I
255
+ )(), ce = z(u(I)), le = {};
256
+ Te.Fragment = j, Te.jsx = function(t, l, w) {
257
+ var A = 1e4 > L.recentlyCreatedOwnerStacks++;
258
+ return H(
259
+ t,
260
+ l,
261
+ w,
262
+ !1,
263
+ A ? Error("react-stack-top-frame") : F,
264
+ A ? z(u(t)) : ce
265
+ );
266
+ }, Te.jsxs = function(t, l, w) {
267
+ var A = 1e4 > L.recentlyCreatedOwnerStacks++;
268
+ return H(
269
+ t,
270
+ l,
271
+ w,
272
+ !0,
273
+ A ? Error("react-stack-top-frame") : F,
274
+ A ? z(u(t)) : ce
275
+ );
276
+ };
277
+ })()), Te;
278
+ }
279
+ var Pe;
280
+ function lt() {
281
+ return Pe || (Pe = 1, process.env.NODE_ENV === "production" ? Me.exports = at() : Me.exports = ut()), Me.exports;
282
+ }
283
+ var a = lt();
284
+ const dt = 520, ft = () => /* @__PURE__ */ a.jsxs("svg", { width: "14", height: "16", viewBox: "0 0 14 16", fill: "currentColor", "aria-hidden": "true", children: [
285
+ /* @__PURE__ */ a.jsx("rect", { x: "1", y: "0", width: "4", height: "16", rx: "1" }),
286
+ /* @__PURE__ */ a.jsx("rect", { x: "9", y: "0", width: "4", height: "16", rx: "1" })
287
+ ] }), Je = () => /* @__PURE__ */ a.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ a.jsx("polyline", { points: "3,5 7,9 11,5" }) }), Ne = () => /* @__PURE__ */ a.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ a.jsx("polyline", { points: "3,9 7,5 11,9" }) }), mt = ({
288
+ currentTime: D,
289
+ isPlaying: k,
290
+ multiplier: X,
291
+ dateTimeFormat: u,
292
+ isLive: b,
293
+ hasStartTime: I,
294
+ hasEndTime: q,
295
+ onPlayPause: P,
296
+ onJumpToStart: B,
297
+ onRewind: R,
298
+ onFastForward: H,
299
+ onJumpToEnd: ne,
300
+ onJumpToLive: Q,
301
+ onResetSpeed: ee,
302
+ onDateTimeClick: G,
303
+ theme: x,
304
+ swimLanesVisible: j,
305
+ onToggleSwimLanes: _
306
+ }) => {
307
+ const V = X < 0, v = X > 1, m = X === 1, g = Math.abs(X), y = T(null), [E, ae] = ve(!1);
308
+ $(() => {
309
+ const c = y.current;
310
+ if (!c) return;
311
+ const J = new ResizeObserver(([z]) => {
312
+ ae(z.contentRect.width < dt);
313
+ });
314
+ return J.observe(c), () => J.disconnect();
315
+ }, []);
316
+ const N = {
317
+ background: "none",
318
+ border: "1px solid transparent",
319
+ cursor: "pointer",
320
+ fontSize: "16px",
321
+ padding: "0",
322
+ display: "flex",
323
+ alignItems: "center",
324
+ justifyContent: "center",
325
+ minWidth: "32px",
326
+ width: "32px",
327
+ height: "32px",
328
+ borderRadius: "4px",
329
+ transition: "background-color 0.15s, color 0.15s",
330
+ fontFamily: "system-ui, -apple-system, sans-serif",
331
+ flexShrink: 0,
332
+ lineHeight: 1
333
+ }, U = (c) => ({
334
+ ...N,
335
+ color: c ? x.buttonActiveColor : x.buttonColor,
336
+ borderColor: c ? `${x.buttonActiveColor}33` : "transparent"
337
+ }), Y = (c, J) => {
338
+ c.currentTarget.style.backgroundColor = J ? `${x.buttonActiveColor}22` : x.buttonHoverColor + "44";
339
+ }, L = (c) => {
340
+ c.currentTarget.style.backgroundColor = "transparent";
341
+ };
342
+ return /* @__PURE__ */ a.jsxs(
343
+ "div",
344
+ {
345
+ ref: y,
346
+ style: {
347
+ display: E ? "flex" : "grid",
348
+ gridTemplateColumns: E ? void 0 : "1fr auto 1fr",
349
+ alignItems: "center",
350
+ padding: "6px 16px",
351
+ backgroundColor: x.controlBarBackground,
352
+ borderBottom: `1px solid ${x.controlBarBorder}`,
353
+ fontFamily: "system-ui, -apple-system, sans-serif"
354
+ },
355
+ children: [
356
+ /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexShrink: 0 }, children: [
357
+ /* @__PURE__ */ a.jsx(
358
+ "div",
359
+ {
360
+ onClick: G,
361
+ title: G ? "Click to jump to a date/time" : void 0,
362
+ style: {
363
+ color: x.labelColor,
364
+ fontFamily: "monospace",
365
+ lineHeight: 1.15,
366
+ cursor: G ? "pointer" : "default",
367
+ borderRadius: "4px",
368
+ padding: "2px 4px",
369
+ transition: "background 0.15s"
370
+ },
371
+ onMouseEnter: (c) => {
372
+ G && (c.currentTarget.style.background = x.buttonHoverColor + "44");
373
+ },
374
+ onMouseLeave: (c) => c.currentTarget.style.background = "transparent",
375
+ children: (() => {
376
+ const { timeFormat: c, dateFormat: J } = Ge(u);
377
+ return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
378
+ c && /* @__PURE__ */ a.jsx("div", { style: { fontSize: "2em", fontWeight: "bold", letterSpacing: "0.02em" }, children: ke(D, c) }),
379
+ J && /* @__PURE__ */ a.jsx("div", { style: { fontSize: "1.15em", letterSpacing: "0.03em", color: x.buttonActiveColor }, children: ke(D, J) })
380
+ ] });
381
+ })()
382
+ }
383
+ ),
384
+ /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px", justifyContent: "center" }, children: [
385
+ /* @__PURE__ */ a.jsx(
386
+ "button",
387
+ {
388
+ onClick: Q,
389
+ style: {
390
+ ...N,
391
+ fontSize: "11px",
392
+ fontWeight: "bold",
393
+ letterSpacing: "0.05em",
394
+ width: "52px",
395
+ minWidth: "52px",
396
+ height: "20px",
397
+ borderRadius: "3px",
398
+ color: b ? x.controlBarBackground : x.buttonActiveColor,
399
+ backgroundColor: b ? x.buttonActiveColor : "transparent",
400
+ borderColor: x.buttonActiveColor,
401
+ opacity: b ? 1 : 0.55
402
+ },
403
+ onMouseEnter: (c) => {
404
+ c.currentTarget.style.opacity = "1";
405
+ },
406
+ onMouseLeave: (c) => {
407
+ c.currentTarget.style.opacity = b ? "1" : "0.55";
408
+ },
409
+ title: b ? "Currently live" : "Jump to live (now)",
410
+ children: b ? "● LIVE" : "LIVE"
411
+ }
412
+ ),
413
+ /* @__PURE__ */ a.jsx("div", { style: { height: "20px", display: "flex", alignItems: "center" }, children: !m && /* @__PURE__ */ a.jsx(
414
+ "button",
415
+ {
416
+ onClick: () => ee(),
417
+ style: {
418
+ ...N,
419
+ fontSize: "11px",
420
+ color: x.buttonActiveColor,
421
+ borderColor: `${x.buttonActiveColor}44`,
422
+ width: "52px",
423
+ minWidth: "52px",
424
+ height: "20px"
425
+ },
426
+ onMouseEnter: (c) => Y(c, !0),
427
+ onMouseLeave: L,
428
+ title: "Reset to 1× speed",
429
+ children: V ? `◀ ${g}×` : `${g}× ▶`
430
+ }
431
+ ) })
432
+ ] })
433
+ ] }),
434
+ /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "2px", ...E ? { flex: 1, justifyContent: "center" } : {} }, children: [
435
+ I && /* @__PURE__ */ a.jsx(
436
+ "button",
437
+ {
438
+ onClick: B,
439
+ style: U(!1),
440
+ onMouseEnter: (c) => Y(c, !1),
441
+ onMouseLeave: L,
442
+ title: "Jump to start",
443
+ children: "⏮"
444
+ }
445
+ ),
446
+ /* @__PURE__ */ a.jsx(
447
+ "button",
448
+ {
449
+ onClick: R,
450
+ style: { ...U(V), width: "64px", minWidth: "64px", gap: "3px" },
451
+ onMouseEnter: (c) => Y(c, V),
452
+ onMouseLeave: L,
453
+ title: V ? `Reverse ${g}× — click to speed up, press play to stop` : "Rewind",
454
+ children: V ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
455
+ /* @__PURE__ */ a.jsxs("span", { style: { fontSize: "11px", fontWeight: "bold" }, children: [
456
+ g,
457
+ "×"
458
+ ] }),
459
+ "◀◀"
460
+ ] }) : "◀◀"
461
+ }
462
+ ),
463
+ /* @__PURE__ */ a.jsx(
464
+ "button",
465
+ {
466
+ onClick: () => P(!k),
467
+ style: {
468
+ ...N,
469
+ color: x.buttonActiveColor,
470
+ fontSize: "18px",
471
+ width: "40px",
472
+ minWidth: "40px",
473
+ height: "40px",
474
+ borderColor: `${x.buttonActiveColor}55`,
475
+ borderRadius: "50%",
476
+ paddingLeft: k ? "0" : "2px"
477
+ },
478
+ onMouseEnter: (c) => Y(c, !0),
479
+ onMouseLeave: L,
480
+ title: k ? "Pause" : V ? "Play (reset to 1×)" : "Play",
481
+ children: k ? /* @__PURE__ */ a.jsx(ft, {}) : "▶"
482
+ }
483
+ ),
484
+ /* @__PURE__ */ a.jsx(
485
+ "button",
486
+ {
487
+ onClick: H,
488
+ style: { ...U(v), width: "64px", minWidth: "64px", gap: "3px" },
489
+ onMouseEnter: (c) => Y(c, v),
490
+ onMouseLeave: L,
491
+ title: v ? `${g}× speed — click to increase, click again at max to reset` : "Fast forward",
492
+ children: v ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
493
+ "▶▶",
494
+ /* @__PURE__ */ a.jsxs("span", { style: { fontSize: "11px", fontWeight: "bold" }, children: [
495
+ g,
496
+ "×"
497
+ ] })
498
+ ] }) : "▶▶"
499
+ }
500
+ ),
501
+ q && /* @__PURE__ */ a.jsx(
502
+ "button",
503
+ {
504
+ onClick: ne,
505
+ style: U(!1),
506
+ onMouseEnter: (c) => Y(c, !1),
507
+ onMouseLeave: L,
508
+ title: "Jump to end",
509
+ children: "⏭"
510
+ }
511
+ )
512
+ ] }),
513
+ !E && /* @__PURE__ */ a.jsx("div", { style: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: _ != null && j != null && /* @__PURE__ */ a.jsx(
514
+ "button",
515
+ {
516
+ onClick: _,
517
+ style: {
518
+ ...N,
519
+ color: x.buttonActiveColor,
520
+ borderColor: `${x.buttonActiveColor}33`
521
+ },
522
+ onMouseEnter: (c) => Y(c, j),
523
+ onMouseLeave: L,
524
+ title: j ? "Collapse swim lanes" : "Expand swim lanes",
525
+ children: j ? /* @__PURE__ */ a.jsx(Je, {}) : /* @__PURE__ */ a.jsx(Ne, {})
526
+ }
527
+ ) }),
528
+ E && _ != null && j != null && /* @__PURE__ */ a.jsx(
529
+ "button",
530
+ {
531
+ onClick: _,
532
+ style: {
533
+ ...N,
534
+ color: x.buttonActiveColor,
535
+ borderColor: `${x.buttonActiveColor}33`,
536
+ marginLeft: "4px"
537
+ },
538
+ onMouseEnter: (c) => Y(c, j),
539
+ onMouseLeave: L,
540
+ title: j ? "Collapse swim lanes" : "Expand swim lanes",
541
+ children: j ? /* @__PURE__ */ a.jsx(Je, {}) : /* @__PURE__ */ a.jsx(Ne, {})
542
+ }
543
+ )
544
+ ]
545
+ }
546
+ );
547
+ }, We = He(
548
+ (D, k) => {
549
+ const {
550
+ currentTime: X,
551
+ defaultStartMs: u,
552
+ defaultEndMs: b,
553
+ theme: I,
554
+ maxTicks: q,
555
+ onTimeChange: P,
556
+ onDragStart: B,
557
+ onDragEnd: R,
558
+ swimLanes: H,
559
+ showSwimLanes: ne,
560
+ onSwimLaneItemClick: Q,
561
+ onSwimLaneItemHover: ee,
562
+ onSwimLaneItemDoubleClick: G,
563
+ onSwimLaneItemContextMenu: x,
564
+ onSwimLaneReorder: j
565
+ } = D, _ = T(null), V = T(I), v = T(q), m = T(u), g = T(b), y = T(C.JulianDate.toDate(X).getTime());
566
+ $(() => {
567
+ V.current = I;
568
+ }, [I]), $(() => {
569
+ v.current = q;
570
+ }, [q]);
571
+ const E = T(H ?? []), ae = T(ne ?? (H != null && H.length > 0)), N = T(0), U = T(null), Y = T(null), L = T(Q), c = T(ee), J = T(G), z = T(x), re = T(j);
572
+ $(() => {
573
+ L.current = Q;
574
+ }, [Q]), $(() => {
575
+ c.current = ee;
576
+ }, [ee]), $(() => {
577
+ J.current = G;
578
+ }, [G]), $(() => {
579
+ z.current = x;
580
+ }, [x]), $(() => {
581
+ re.current = j;
582
+ }, [j]), $(() => {
583
+ E.current = H ?? [], i();
584
+ }, [H]), $(() => {
585
+ ae.current = ne ?? (H != null && H.length > 0), i();
586
+ }, [ne, H]);
587
+ const W = T(null), F = T(null), ce = T(!1), le = T(0), t = T("none"), l = T(0), w = T(0), A = T(0), te = T("none"), de = T(0), S = T(0), ue = (e, n) => Math.hypot(n.clientX - e.clientX, n.clientY - e.clientY), K = oe(() => ({
588
+ startMs: m.current,
589
+ endMs: g.current,
590
+ currentMs: y.current,
591
+ theme: V.current,
592
+ maxTicks: v.current,
593
+ swimLanes: E.current,
594
+ showSwimLanes: ae.current,
595
+ scrollTop: N.current,
596
+ reorderState: Y.current
597
+ }), []);
598
+ Ue(k, () => ({
599
+ zoomTo(e, n, r) {
600
+ const s = Math.max(nt, Math.min(rt, n - e)), o = (e + n) / 2;
601
+ m.current = o - s / 2, g.current = o + s / 2, r !== void 0 && (y.current = r), i();
602
+ },
603
+ getVisibleRange() {
604
+ return { startMs: m.current, endMs: g.current };
605
+ },
606
+ startFollow(e) {
607
+ if (le.current = e, F.current !== null) return;
608
+ ce.current = !0;
609
+ let n = performance.now();
610
+ const r = () => {
611
+ const s = performance.now(), o = s - n;
612
+ n = s;
613
+ const f = o * le.current;
614
+ m.current += f, g.current += f, y.current += f, i(), F.current = requestAnimationFrame(r);
615
+ };
616
+ F.current = requestAnimationFrame(r);
617
+ },
618
+ stopFollow() {
619
+ ce.current = !1, F.current !== null && (cancelAnimationFrame(F.current), F.current = null);
620
+ },
621
+ correctFollow(e) {
622
+ if (!ce.current) return;
623
+ const n = e - y.current;
624
+ y.current = e, m.current += n, g.current += n;
625
+ },
626
+ // ── Swim lane CRUD ──────────────────────────────────────────────
627
+ appendSwimLane(e) {
628
+ E.current = [...E.current, e], i();
629
+ },
630
+ updateSwimLane(e, n) {
631
+ E.current = E.current.map(
632
+ (r) => r.id === e ? { ...r, ...n, id: r.id } : r
633
+ ), i();
634
+ },
635
+ removeSwimLane(e) {
636
+ E.current = E.current.filter((n) => n.id !== e), i();
637
+ },
638
+ reorderSwimLanes(e) {
639
+ const n = new Map(E.current.map((s) => [s.id, s])), r = [];
640
+ for (const s of e) {
641
+ const o = n.get(s);
642
+ o && r.push(o);
643
+ }
644
+ E.current = r, i();
645
+ }
646
+ }));
647
+ const i = oe(() => {
648
+ const e = _.current;
649
+ if (!e) return;
650
+ const n = e.getContext("2d");
651
+ if (!n) return;
652
+ const r = e.getBoundingClientRect(), s = r.width, o = r.height;
653
+ if (s === 0 || o === 0) return;
654
+ const f = window.devicePixelRatio || 1, h = Math.round(s * f), p = Math.round(o * f);
655
+ (e.width !== h || e.height !== p) && (e.width = h, e.height = p), n.save(), n.scale(f, f);
656
+ const O = Ve(n, s, o, K());
657
+ O !== N.current && (N.current = O), n.restore();
658
+ }, [K]);
659
+ qe(() => {
660
+ i();
661
+ const e = _.current;
662
+ if (!e) return;
663
+ const n = new ResizeObserver(() => i());
664
+ return n.observe(e), () => n.disconnect();
665
+ }, [i]), $(() => {
666
+ if (ce.current) return;
667
+ const e = C.JulianDate.toDate(X).getTime();
668
+ y.current !== e && (y.current = e, i());
669
+ }, [X, i]);
670
+ const me = oe((e) => {
671
+ if (W.current !== null) return;
672
+ const n = () => {
673
+ const r = _.current, s = g.current - m.current, o = e * s * 0.01;
674
+ if (m.current += o, g.current += o, r) {
675
+ const f = r.getBoundingClientRect(), h = Math.max(0, Math.min(f.width, w.current - f.left)), p = m.current + h / f.width * (g.current - m.current);
676
+ y.current = p, P(C.JulianDate.fromDate(new Date(p)));
677
+ }
678
+ i(), W.current = requestAnimationFrame(n);
679
+ };
680
+ W.current = requestAnimationFrame(n);
681
+ }, [i, P]), ie = oe(() => {
682
+ W.current !== null && (cancelAnimationFrame(W.current), W.current = null);
683
+ }, []), se = oe((e, n, r, s) => Ke(e, n, r, s, K()), [K]), xe = oe((e, n, r) => Ze(e, n, r, K()), [K]), he = oe((e, n) => Qe(e, n, K()), [K]), Re = oe((e) => {
684
+ e.preventDefault();
685
+ const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, s = e.clientY - n.top;
686
+ if (e.button === 0 && re.current) {
687
+ const o = xe(r, s, n.height);
688
+ if (o) {
689
+ const h = E.current.findIndex((p) => p.id === o.id);
690
+ Y.current = {
691
+ dragging: !0,
692
+ dragLaneId: o.id,
693
+ dragStartY: e.clientY,
694
+ currentY: e.clientY,
695
+ insertIndex: h
696
+ }, e.currentTarget.style.cursor = "grabbing";
697
+ return;
698
+ }
699
+ }
700
+ if (e.button === 0 && he(s, n.height)) {
701
+ const o = (y.current - m.current) / (g.current - m.current) * n.width;
702
+ if (!(Math.abs(r - o) <= 10) && se(r, s, n.width, n.height)) {
703
+ A.current = performance.now();
704
+ return;
705
+ }
706
+ }
707
+ if (e.button === 0) {
708
+ t.current = "scrub", w.current = e.clientX, e.currentTarget.style.cursor = "grabbing", B == null || B();
709
+ const o = m.current + r / n.width * (g.current - m.current);
710
+ y.current = o, i(), P(C.JulianDate.fromDate(new Date(o)));
711
+ } else if (e.button === 1)
712
+ t.current = "slide", l.current = e.clientX;
713
+ else if (e.button === 2) {
714
+ if (z.current && he(s, n.height))
715
+ return;
716
+ t.current = "zoom", l.current = e.clientX;
717
+ }
718
+ }, [i, P, B, xe, he, se]);
719
+ $(() => {
720
+ const e = (r) => {
721
+ const s = Y.current;
722
+ if (s && s.dragging) {
723
+ s.currentY = r.clientY;
724
+ const p = _.current;
725
+ if (p) {
726
+ const O = p.getBoundingClientRect(), Z = r.clientY - O.top;
727
+ let Ee = -N.current;
728
+ const _e = E.current;
729
+ let je = _e.length;
730
+ for (let ye = 0; ye < _e.length; ye++) {
731
+ const Ae = _e[ye].height ?? Le, $e = Ee + Ae / 2;
732
+ if (Z < $e) {
733
+ je = ye;
734
+ break;
735
+ }
736
+ Ee += Ae + Ie;
737
+ }
738
+ s.insertIndex = je;
739
+ }
740
+ i();
741
+ return;
742
+ }
743
+ if (t.current === "none") return;
744
+ const o = _.current;
745
+ if (!o) return;
746
+ const f = o.getBoundingClientRect(), h = f.width;
747
+ if (t.current === "scrub") {
748
+ w.current = r.clientX;
749
+ const p = r.clientX - f.left, O = h * 0.08;
750
+ p < O ? me(-1) : p > h - O ? me(1) : ie();
751
+ const Z = Math.max(0, Math.min(h, p)), fe = m.current + Z / h * (g.current - m.current);
752
+ y.current = fe, i(), P(C.JulianDate.fromDate(new Date(fe)));
753
+ } else if (t.current === "slide") {
754
+ const p = l.current - r.clientX;
755
+ if (l.current = r.clientX, p !== 0) {
756
+ const O = p / h * (g.current - m.current);
757
+ m.current += O, g.current += O, i();
758
+ }
759
+ } else if (t.current === "zoom") {
760
+ const p = l.current - r.clientX;
761
+ l.current = r.clientX, p !== 0 && pe(Math.pow(1.01, p));
762
+ }
763
+ }, n = () => {
764
+ var s;
765
+ const r = Y.current;
766
+ if (r && r.dragging) {
767
+ const o = Math.abs(r.currentY - r.dragStartY), f = E.current, h = f.findIndex((p) => p.id === r.dragLaneId);
768
+ if (o > 5 && h >= 0 && r.insertIndex !== h && r.insertIndex !== h + 1) {
769
+ const p = [...f], [O] = p.splice(h, 1), Z = r.insertIndex > h ? r.insertIndex - 1 : r.insertIndex;
770
+ p.splice(Z, 0, O), E.current = p, (s = re.current) == null || s.call(re, p.map((fe) => fe.id));
771
+ }
772
+ Y.current = null, _.current && (_.current.style.cursor = "default"), i();
773
+ return;
774
+ }
775
+ ie(), t.current = "none", _.current && (_.current.style.cursor = "default"), R == null || R();
776
+ };
777
+ return document.addEventListener("mousemove", e), document.addEventListener("mouseup", n), () => {
778
+ document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", n);
779
+ };
780
+ }, [i, P, R, me, ie]);
781
+ const pe = oe((e) => {
782
+ const n = et(m.current, g.current, e);
783
+ m.current = n.startMs, g.current = n.endMs, i();
784
+ }, [i]), be = oe((e) => {
785
+ e.preventDefault();
786
+ const n = _.current;
787
+ if (!n) return;
788
+ const r = n.getBoundingClientRect(), s = e.clientY - r.top, o = ae.current, f = E.current;
789
+ if (o && f.length > 0) {
790
+ const h = Math.max(0, r.height - ze);
791
+ if (s >= 0 && s < h) {
792
+ let p = 0;
793
+ for (const Z of f) p += (Z.height ?? Le) + Ie;
794
+ const O = Math.max(0, p - h);
795
+ if (O > 0) {
796
+ N.current = Math.max(0, Math.min(O, N.current + e.deltaY * tt)), i();
797
+ return;
798
+ }
799
+ }
800
+ }
801
+ pe(Math.pow(1.05, e.deltaY > 0 ? -1 : 1));
802
+ }, [pe, i]);
803
+ $(() => {
804
+ const e = _.current;
805
+ if (e)
806
+ return e.addEventListener("wheel", be, { passive: !1 }), () => e.removeEventListener("wheel", be);
807
+ }, [be]), $(() => {
808
+ const e = _.current;
809
+ if (!e) return;
810
+ const n = (o) => {
811
+ o.preventDefault();
812
+ const f = e.getBoundingClientRect();
813
+ if (o.touches.length === 1) {
814
+ const h = o.touches[0].clientX - f.left, p = Math.max(0, Math.min(f.width, h)), O = m.current + p / f.width * (g.current - m.current);
815
+ te.current = "scrub", de.current = o.touches[0].clientX, w.current = o.touches[0].clientX, y.current = O, i(), B == null || B(), P(C.JulianDate.fromDate(new Date(O)));
816
+ } else o.touches.length >= 2 && (te.current = "pinch", S.current = ue(o.touches[0], o.touches[1]));
817
+ }, r = (o) => {
818
+ o.preventDefault();
819
+ const f = e.getBoundingClientRect();
820
+ if (te.current === "scrub" && o.touches.length >= 1) {
821
+ const h = o.touches[0].clientX - f.left, p = f.width * 0.08;
822
+ if (w.current = o.touches[0].clientX, h < p) me(-1);
823
+ else if (h > f.width - p) me(1);
824
+ else {
825
+ ie();
826
+ const O = Math.max(0, Math.min(f.width, h)), Z = m.current + O / f.width * (g.current - m.current);
827
+ y.current = Z, i(), P(C.JulianDate.fromDate(new Date(Z)));
828
+ }
829
+ } else if (te.current === "slide" && o.touches.length >= 1) {
830
+ const h = de.current - o.touches[0].clientX;
831
+ if (de.current = o.touches[0].clientX, h !== 0) {
832
+ const p = h / f.width * (g.current - m.current);
833
+ m.current += p, g.current += p, i();
834
+ }
835
+ } else if (te.current === "pinch" && o.touches.length >= 2) {
836
+ const h = ue(o.touches[0], o.touches[1]);
837
+ h > 0 && S.current > 0 && pe(S.current / h), S.current = h;
838
+ }
839
+ }, s = (o) => {
840
+ ie(), te.current === "scrub" && (R == null || R()), o.touches.length === 0 ? te.current = "none" : o.touches.length === 1 && (te.current = "slide", de.current = o.touches[0].clientX);
841
+ };
842
+ return e.addEventListener("touchstart", n, { passive: !1 }), e.addEventListener("touchmove", r, { passive: !1 }), e.addEventListener("touchend", s, { passive: !1 }), () => {
843
+ e.removeEventListener("touchstart", n), e.removeEventListener("touchmove", r), e.removeEventListener("touchend", s);
844
+ };
845
+ }, [i, B, R, P, pe, me, ie]);
846
+ const Ce = oe((e) => {
847
+ var h, p, O;
848
+ if (t.current !== "none") return;
849
+ const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, s = e.clientY - n.top, o = (y.current - m.current) / (g.current - m.current) * n.width, f = Math.abs(r - o) <= 10;
850
+ if (he(s, n.height)) {
851
+ const Z = se(r, s, n.width, n.height), fe = U.current;
852
+ if (Z)
853
+ e.currentTarget.style.cursor = f ? "grab" : "pointer", (!fe || fe.item.id !== Z.item.id || fe.lane.id !== Z.lane.id) && (U.current = Z, (h = c.current) == null || h.call(c, { laneId: Z.lane.id, item: Z.item, originalEvent: e.nativeEvent }), i());
854
+ else if (fe && (U.current = null, (p = c.current) == null || p.call(c, null), i()), f)
855
+ e.currentTarget.style.cursor = "grab";
856
+ else {
857
+ const Ee = xe(r, s, n.height);
858
+ e.currentTarget.style.cursor = Ee && re.current ? "grab" : "default";
859
+ }
860
+ return;
861
+ }
862
+ U.current && (U.current = null, (O = c.current) == null || O.call(c, null), i()), e.currentTarget.style.cursor = f ? "grab" : "default";
863
+ }, [i, se, he, xe]), De = oe((e) => {
864
+ var h;
865
+ if (performance.now() - A.current > 300) return;
866
+ const r = e.currentTarget.getBoundingClientRect(), s = e.clientX - r.left, o = e.clientY - r.top, f = se(s, o, r.width, r.height);
867
+ f && ((h = L.current) == null || h.call(L, { laneId: f.lane.id, item: f.item, originalEvent: e.nativeEvent }));
868
+ }, [se]), d = oe((e) => {
869
+ var f;
870
+ const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, s = e.clientY - n.top, o = se(r, s, n.width, n.height);
871
+ o && ((f = J.current) == null || f.call(J, { laneId: o.lane.id, item: o.item, originalEvent: e.nativeEvent }));
872
+ }, [se]), M = oe((e) => {
873
+ const n = e.currentTarget.getBoundingClientRect(), r = e.clientX - n.left, s = e.clientY - n.top, o = se(r, s, n.width, n.height);
874
+ o && z.current ? (e.preventDefault(), z.current({ laneId: o.lane.id, item: o.item, originalEvent: e.nativeEvent })) : e.preventDefault();
875
+ }, [se]);
876
+ return $(() => () => {
877
+ W.current !== null && cancelAnimationFrame(W.current), F.current !== null && cancelAnimationFrame(F.current);
878
+ }, []), /* @__PURE__ */ a.jsx(
879
+ "canvas",
880
+ {
881
+ ref: _,
882
+ style: { width: "100%", flex: 1, minHeight: 0, display: "block", cursor: "default" },
883
+ onMouseDown: Re,
884
+ onMouseMove: Ce,
885
+ onClick: De,
886
+ onDoubleClick: d,
887
+ onMouseLeave: () => {
888
+ var e;
889
+ U.current && (U.current = null, (e = c.current) == null || e.call(c, null), i()), t.current === "none" && _.current && (_.current.style.cursor = "default");
890
+ },
891
+ onContextMenu: M
892
+ }
893
+ );
894
+ }
895
+ );
896
+ We.displayName = "TimelineCanvas";
897
+ const Xe = [2, 4, 8, 16, 32, 100, 1], Ye = [1, 2, 4, 8, 16, 32, 100], xt = ({
898
+ startTime: D,
899
+ endTime: k,
900
+ currentTime: X,
901
+ clock: u,
902
+ onTimeChange: b,
903
+ onPlayPause: I,
904
+ onMultiplierChange: q,
905
+ height: P,
906
+ showControls: B = !0,
907
+ enableDrag: R = !0,
908
+ dateTimeFormat: H,
909
+ onDateTimeClick: ne,
910
+ jumpToTime: Q,
911
+ maxTicks: ee,
912
+ ffSpeeds: G = Xe,
913
+ rwSpeeds: x = Ye,
914
+ theme: j,
915
+ className: _,
916
+ swimLanes: V,
917
+ showSwimLanes: v,
918
+ onShowSwimLanesChange: m,
919
+ swimLaneTransition: g = "animated",
920
+ onSwimLaneItemClick: y,
921
+ onSwimLaneItemHover: E,
922
+ onSwimLaneItemDoubleClick: ae,
923
+ onSwimLaneItemContextMenu: N,
924
+ onSwimLaneReorder: U
925
+ }) => {
926
+ const Y = () => Date.now(), L = D ? C.JulianDate.toDate(ge(D)).getTime() : Y() - 432e5, c = k ? C.JulianDate.toDate(ge(k)).getTime() : Y() + 12 * 3600 * 1e3, [J, z] = ve(
927
+ () => ge(X ?? D ?? C.JulianDate.fromDate(/* @__PURE__ */ new Date()))
928
+ ), [re, W] = ve((u == null ? void 0 : u.shouldAnimate) ?? !1), [F, ce] = ve((u == null ? void 0 : u.multiplier) ?? 1), [le, t] = ve(v ?? !0);
929
+ $(() => {
930
+ v != null && t(v);
931
+ }, [v]);
932
+ const l = () => {
933
+ const d = !le;
934
+ t(d), m == null || m(d);
935
+ }, w = V != null && V.length > 0, A = T(null), [te, de] = ve(0);
936
+ $(() => {
937
+ const d = A.current;
938
+ if (!d) return;
939
+ const M = new ResizeObserver(([e]) => de(e.borderBoxSize[0].blockSize));
940
+ return M.observe(d), () => M.disconnect();
941
+ }, [B]);
942
+ const ue = w && !le ? `${te + ze}px` : P != null ? `${P}px` : "100%", K = T(!1), i = T(null), me = { ...ot, ...j };
943
+ $(() => {
944
+ if (!u) return;
945
+ const d = () => {
946
+ if (!K.current) {
947
+ const M = C.JulianDate.clone(u.currentTime);
948
+ if (z(M), W(u.shouldAnimate), ce(u.multiplier), i.current) {
949
+ const { startMs: e, endMs: n } = i.current.getVisibleRange(), r = n - e, s = C.JulianDate.toDate(M).getTime(), o = s - e;
950
+ o <= r * 0.1 ? i.current.zoomTo(s - r * 0.1, s + r * 0.9, s) : o >= r * 0.9 && i.current.zoomTo(s - r * 0.9, s + r * 0.1, s);
951
+ }
952
+ }
953
+ };
954
+ return u.onTick.addEventListener(d), () => {
955
+ u.onTick.removeEventListener(d);
956
+ };
957
+ }, [u]), $(() => {
958
+ if (u) return;
959
+ const d = setInterval(() => {
960
+ if (K.current) return;
961
+ const M = C.JulianDate.fromDate(/* @__PURE__ */ new Date());
962
+ if (z(M), i.current) {
963
+ const { startMs: e, endMs: n } = i.current.getVisibleRange(), r = n - e, s = C.JulianDate.toDate(M).getTime(), o = s - e;
964
+ o <= r * 0.1 ? i.current.zoomTo(s - r * 0.1, s + r * 0.9, s) : o >= r * 0.9 && i.current.zoomTo(s - r * 0.9, s + r * 0.1, s);
965
+ }
966
+ }, 1e3);
967
+ return () => clearInterval(d);
968
+ }, [u]), $(() => {
969
+ if (!Q) return;
970
+ const d = ge(Q);
971
+ if (se(d), i.current) {
972
+ const { startMs: M, endMs: e } = i.current.getVisibleRange(), n = e - M, r = C.JulianDate.toDate(d).getTime();
973
+ i.current.zoomTo(r - n / 2, r + n / 2);
974
+ }
975
+ }, [Q]);
976
+ const ie = (d, M = !0) => {
977
+ u && (u.multiplier = d, M && (u.shouldAnimate = !0)), ce(d), M && W(!0), q == null || q(d);
978
+ }, se = (d) => {
979
+ z(d), u && (u.currentTime = C.JulianDate.clone(d)), b == null || b(d);
980
+ }, xe = (d) => {
981
+ d && F < 0 && ie(1, !1), u && (u.shouldAnimate = d), W(d), I == null || I(d);
982
+ }, he = () => {
983
+ const d = G.length > 0 ? G : Xe, M = F > 1 ? F : 1, e = d.indexOf(M), n = d[e < 0 || e === d.length - 1 ? 0 : e + 1];
984
+ ie(n);
985
+ }, Re = () => {
986
+ const d = x.length > 0 ? x : Ye, M = F < 0 ? Math.abs(F) : 0, e = d.indexOf(M), n = -d[e < 0 || e === d.length - 1 ? 0 : e + 1];
987
+ ie(n);
988
+ }, pe = () => {
989
+ var M;
990
+ const d = ge(D ?? C.JulianDate.fromDate(new Date(L)));
991
+ u && (u.currentTime = C.JulianDate.clone(d)), z(d), (M = i.current) == null || M.zoomTo(L, c);
992
+ }, be = () => {
993
+ var M;
994
+ const d = ge(k ?? C.JulianDate.fromDate(new Date(c)));
995
+ u && (u.currentTime = C.JulianDate.clone(d)), z(d), (M = i.current) == null || M.zoomTo(L, c);
996
+ }, Ce = () => {
997
+ var e;
998
+ const d = C.JulianDate.fromDate(/* @__PURE__ */ new Date());
999
+ u && (u.currentTime = C.JulianDate.clone(d)), z(d), ie(1);
1000
+ const M = Date.now();
1001
+ (e = i.current) == null || e.zoomTo(M - 12 * 3600 * 1e3, M + 12 * 3600 * 1e3);
1002
+ }, De = Math.abs(C.JulianDate.toDate(J).getTime() - Date.now()) < 1e4;
1003
+ return /* @__PURE__ */ a.jsxs(
1004
+ "div",
1005
+ {
1006
+ className: _,
1007
+ style: {
1008
+ width: "100%",
1009
+ height: ue,
1010
+ overflow: "hidden",
1011
+ display: "flex",
1012
+ flexDirection: "column",
1013
+ fontFamily: "system-ui, -apple-system, sans-serif",
1014
+ transition: g === "animated" ? "height 0.2s ease" : void 0
1015
+ },
1016
+ children: [
1017
+ B && /* @__PURE__ */ a.jsx("div", { ref: A, children: /* @__PURE__ */ a.jsx(
1018
+ mt,
1019
+ {
1020
+ currentTime: J,
1021
+ isPlaying: re,
1022
+ multiplier: F,
1023
+ isLive: De,
1024
+ hasStartTime: D != null,
1025
+ hasEndTime: k != null,
1026
+ onPlayPause: xe,
1027
+ onJumpToStart: pe,
1028
+ onRewind: Re,
1029
+ onFastForward: he,
1030
+ onJumpToEnd: be,
1031
+ onJumpToLive: Ce,
1032
+ onResetSpeed: () => ie(1),
1033
+ onDateTimeClick: ne,
1034
+ dateTimeFormat: H,
1035
+ theme: me,
1036
+ swimLanesVisible: w ? le : void 0,
1037
+ onToggleSwimLanes: w ? l : void 0
1038
+ }
1039
+ ) }),
1040
+ R !== !1 && /* @__PURE__ */ a.jsx(
1041
+ We,
1042
+ {
1043
+ ref: i,
1044
+ currentTime: J,
1045
+ defaultStartMs: L,
1046
+ defaultEndMs: c,
1047
+ theme: me,
1048
+ maxTicks: ee,
1049
+ onTimeChange: se,
1050
+ onDragStart: () => {
1051
+ K.current = !0;
1052
+ },
1053
+ onDragEnd: () => {
1054
+ K.current = !1;
1055
+ },
1056
+ swimLanes: V,
1057
+ showSwimLanes: le,
1058
+ onSwimLaneItemClick: y,
1059
+ onSwimLaneItemHover: E,
1060
+ onSwimLaneItemDoubleClick: ae,
1061
+ onSwimLaneItemContextMenu: N,
1062
+ onSwimLaneReorder: U
1063
+ }
1064
+ )
1065
+ ]
1066
+ }
1067
+ );
1068
+ }, gt = ({
1069
+ startTime: D,
1070
+ endTime: k,
1071
+ currentTime: X,
1072
+ width: u,
1073
+ height: b,
1074
+ tickInterval: I,
1075
+ showLabels: q,
1076
+ snapToTicks: P,
1077
+ enableDrag: B,
1078
+ theme: R,
1079
+ onTimeChange: H,
1080
+ onVisibleRangeChange: ne,
1081
+ onDragStart: Q,
1082
+ onDragEnd: ee
1083
+ }) => {
1084
+ const G = Se(
1085
+ () => st(D, k, I, u),
1086
+ [D, k, I, u]
1087
+ ), x = Se(
1088
+ () => ct(X, D, k, u),
1089
+ [X, D, k, u]
1090
+ ), j = T(null), _ = (v) => {
1091
+ if (!B) return;
1092
+ const m = v.currentTarget.getBoundingClientRect(), g = v.clientX - m.left, y = Math.max(0, Math.min(u, g));
1093
+ if (!(Math.abs(y - x) <= 10)) {
1094
+ let W = y;
1095
+ P && (W = it(y, G, 10));
1096
+ const F = new Date(D).getTime(), ce = new Date(k).getTime();
1097
+ H(C.JulianDate.fromDate(new Date(F + W / u * (ce - F))));
1098
+ return;
1099
+ }
1100
+ Q == null || Q();
1101
+ const ae = v.clientX, N = new Date(X).getTime(), U = new Date(D).getTime(), L = (new Date(k).getTime() - U) / u;
1102
+ let c = 0, J = !1;
1103
+ const z = (W) => {
1104
+ c = W.clientX - ae, J = !0, j.current || (j.current = requestAnimationFrame(() => {
1105
+ if (J) {
1106
+ const F = N + c * L;
1107
+ H(C.JulianDate.fromDate(new Date(F))), J = !1;
1108
+ }
1109
+ j.current = null;
1110
+ }));
1111
+ }, re = () => {
1112
+ document.removeEventListener("mousemove", z), document.removeEventListener("mouseup", re), j.current !== null && (cancelAnimationFrame(j.current), j.current = null), ee == null || ee();
1113
+ };
1114
+ document.addEventListener("mousemove", z), document.addEventListener("mouseup", re);
1115
+ }, V = (v) => {
1116
+ v.preventDefault();
1117
+ const m = v.shiftKey ? v.deltaY : v.deltaX !== 0 ? v.deltaX : v.deltaY;
1118
+ if (Math.abs(m) < 1) return;
1119
+ const g = new Date(D).getTime(), y = new Date(k).getTime(), E = m / u * (y - g) * 0.5;
1120
+ ne == null || ne(
1121
+ C.JulianDate.fromDate(new Date(g + E)),
1122
+ C.JulianDate.fromDate(new Date(y + E))
1123
+ );
1124
+ };
1125
+ return /* @__PURE__ */ a.jsxs(
1126
+ "svg",
1127
+ {
1128
+ width: "100%",
1129
+ height: b,
1130
+ style: { backgroundColor: R.backgroundColor, display: "block", cursor: "default" },
1131
+ onMouseDown: _,
1132
+ onWheel: V,
1133
+ children: [
1134
+ /* @__PURE__ */ a.jsx("rect", { width: u, height: b, fill: R.backgroundColor }),
1135
+ G.map((v, m) => /* @__PURE__ */ a.jsxs("g", { children: [
1136
+ /* @__PURE__ */ a.jsx(
1137
+ "line",
1138
+ {
1139
+ x1: v.position,
1140
+ y1: b - (v.isMajor ? R.majorTickHeight : R.minorTickHeight),
1141
+ x2: v.position,
1142
+ y2: b,
1143
+ stroke: v.isMajor ? R.majorTickColor : R.tickColor,
1144
+ strokeWidth: "1"
1145
+ }
1146
+ ),
1147
+ q && v.isMajor && v.label && /* @__PURE__ */ a.jsx(
1148
+ "text",
1149
+ {
1150
+ x: v.position,
1151
+ y: b - R.majorTickHeight - 5,
1152
+ textAnchor: "middle",
1153
+ fill: R.labelColor,
1154
+ fontSize: R.fontSize,
1155
+ fontFamily: "monospace",
1156
+ children: v.label
1157
+ }
1158
+ )
1159
+ ] }, m)),
1160
+ /* @__PURE__ */ a.jsx(
1161
+ "line",
1162
+ {
1163
+ x1: x,
1164
+ y1: 0,
1165
+ x2: x,
1166
+ y2: b,
1167
+ stroke: R.indicatorColor,
1168
+ strokeWidth: R.indicatorLineWidth,
1169
+ pointerEvents: "none"
1170
+ }
1171
+ ),
1172
+ B && /* @__PURE__ */ a.jsx(
1173
+ "rect",
1174
+ {
1175
+ x: Math.max(0, x - 10),
1176
+ y: 0,
1177
+ width: 20,
1178
+ height: b,
1179
+ fill: "transparent",
1180
+ style: { cursor: "ew-resize" },
1181
+ pointerEvents: "visiblePainted"
1182
+ }
1183
+ ),
1184
+ /* @__PURE__ */ a.jsx("circle", { cx: x, cy: 5, r: 4, fill: R.indicatorColor, pointerEvents: "none" })
1185
+ ]
1186
+ }
1187
+ );
1188
+ };
1189
+ export {
1190
+ Tt as TICK_AREA_HEIGHT,
1191
+ xt as Timeline,
1192
+ We as TimelineCanvas,
1193
+ mt as TimelineControls,
1194
+ gt as TimelineSVG
1195
+ };