@kteneyck/cesium-timeline-react 0.9.0 → 0.11.0

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