velo-plot 1.12.0 → 1.15.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.
Files changed (101) hide show
  1. package/README.md +14 -0
  2. package/dist/{index.core-xiNcuFfJ.js → ChartCore-BimVvUEg.js} +922 -929
  3. package/dist/ChartCore-BimVvUEg.js.map +1 -0
  4. package/dist/core/chart/ChartCore.d.ts +1 -0
  5. package/dist/core/chart/exporter/SVGExporter.d.ts +7 -2
  6. package/dist/core/chart/types.d.ts +2 -0
  7. package/dist/core/render/pixelSnap.d.ts +8 -0
  8. package/dist/core/stacked/index.d.ts +3 -1
  9. package/dist/core/stacked/paneResize.d.ts +15 -18
  10. package/dist/core/stacked/stackExport.d.ts +18 -0
  11. package/dist/core/stacked/types.d.ts +34 -5
  12. package/dist/createStackedChart-CjsKcOvX.js +1088 -0
  13. package/dist/createStackedChart-CjsKcOvX.js.map +1 -0
  14. package/dist/index-CUGS98p4.js +277 -0
  15. package/dist/index-CUGS98p4.js.map +1 -0
  16. package/dist/index-ChgIdk3N.js +229 -0
  17. package/dist/index-ChgIdk3N.js.map +1 -0
  18. package/dist/index.core-C_-CFftD.js +167 -0
  19. package/dist/index.core-C_-CFftD.js.map +1 -0
  20. package/dist/math-Ddm2EZjj.js +85 -0
  21. package/dist/math-Ddm2EZjj.js.map +1 -0
  22. package/dist/plugins/analysis.js +132 -130
  23. package/dist/plugins/analysis.js.map +1 -1
  24. package/dist/plugins/anomaly-detection.d.ts +1 -0
  25. package/dist/plugins/anomaly-detection.js +221 -0
  26. package/dist/plugins/anomaly-detection.js.map +1 -0
  27. package/dist/plugins/broken-axis.d.ts +3 -0
  28. package/dist/plugins/broken-axis.js +262 -0
  29. package/dist/plugins/broken-axis.js.map +1 -0
  30. package/dist/plugins/caching.d.ts +3 -0
  31. package/dist/plugins/caching.js +182 -0
  32. package/dist/plugins/caching.js.map +1 -0
  33. package/dist/plugins/data-transform.d.ts +3 -0
  34. package/dist/plugins/data-transform.js +146 -0
  35. package/dist/plugins/data-transform.js.map +1 -0
  36. package/dist/plugins/debug.js +12 -11
  37. package/dist/plugins/debug.js.map +1 -1
  38. package/dist/plugins/forecasting.d.ts +1 -0
  39. package/dist/plugins/forecasting.js +236 -0
  40. package/dist/plugins/forecasting.js.map +1 -0
  41. package/dist/plugins/latex.d.ts +1 -0
  42. package/dist/plugins/latex.js +454 -0
  43. package/dist/plugins/latex.js.map +1 -0
  44. package/dist/plugins/lazy-load.d.ts +3 -0
  45. package/dist/plugins/lazy-load.js +189 -0
  46. package/dist/plugins/lazy-load.js.map +1 -0
  47. package/dist/plugins/ml-integration.d.ts +3 -0
  48. package/dist/plugins/ml-integration.js +355 -0
  49. package/dist/plugins/ml-integration.js.map +1 -0
  50. package/dist/plugins/offscreen.d.ts +3 -0
  51. package/dist/plugins/offscreen.js +169 -0
  52. package/dist/plugins/offscreen.js.map +1 -0
  53. package/dist/plugins/pattern-recognition.d.ts +3 -0
  54. package/dist/plugins/pattern-recognition.js +690 -0
  55. package/dist/plugins/pattern-recognition.js.map +1 -0
  56. package/dist/plugins/radar.d.ts +3 -0
  57. package/dist/plugins/radar.js +103 -0
  58. package/dist/plugins/radar.js.map +1 -0
  59. package/dist/plugins/regression.d.ts +3 -0
  60. package/dist/plugins/regression.js +634 -0
  61. package/dist/plugins/regression.js.map +1 -0
  62. package/dist/plugins/roi.d.ts +1 -0
  63. package/dist/plugins/roi.js +223 -0
  64. package/dist/plugins/roi.js.map +1 -0
  65. package/dist/plugins/snapshot/types.d.ts +1 -1
  66. package/dist/plugins/snapshot.d.ts +3 -0
  67. package/dist/plugins/snapshot.js +90 -0
  68. package/dist/plugins/snapshot.js.map +1 -0
  69. package/dist/plugins/sync/index.d.ts +2 -1
  70. package/dist/plugins/sync.js +13 -269
  71. package/dist/plugins/sync.js.map +1 -1
  72. package/dist/plugins/video-recorder.d.ts +3 -0
  73. package/dist/plugins/video-recorder.js +104 -0
  74. package/dist/plugins/video-recorder.js.map +1 -0
  75. package/dist/plugins/virtualization.d.ts +3 -0
  76. package/dist/plugins/virtualization.js +6 -0
  77. package/dist/plugins/virtualization.js.map +1 -0
  78. package/dist/react.d.ts +1 -0
  79. package/dist/react.js +31 -0
  80. package/dist/react.js.map +1 -0
  81. package/dist/utils-BK5UUXxj.js +172 -0
  82. package/dist/utils-BK5UUXxj.js.map +1 -0
  83. package/dist/velo-plot.full.js +920 -6003
  84. package/dist/velo-plot.full.js.map +1 -1
  85. package/dist/velo-plot.js +23 -22
  86. package/dist/velo-plot.js.map +1 -1
  87. package/package.json +9 -2
  88. package/dist/core/OverlayRenderer.test.d.ts +0 -1
  89. package/dist/core/chart/ChartScaling.test.d.ts +0 -1
  90. package/dist/core/chart/NavigationUtils.test.d.ts +0 -1
  91. package/dist/core/format/axisFormat.test.d.ts +0 -1
  92. package/dist/core/indicator/buildIndicatorSeries.test.d.ts +0 -1
  93. package/dist/core/series/SeriesBounds.test.d.ts +0 -1
  94. package/dist/core/stacked/createStackedChart.test.d.ts +0 -1
  95. package/dist/core/stacked/paneAxis.test.d.ts +0 -1
  96. package/dist/core/stacked/paneResize.test.d.ts +0 -1
  97. package/dist/core/sync/index.test.d.ts +0 -1
  98. package/dist/index.core-xiNcuFfJ.js.map +0 -1
  99. package/dist/plugins/tools/tooltip/format.test.d.ts +0 -1
  100. package/dist/utils-Dbro9-qM.js +0 -254
  101. package/dist/utils-Dbro9-qM.js.map +0 -1
@@ -0,0 +1,1088 @@
1
+ import De, { useState as le, useRef as fe, useEffect as ce, useCallback as re, forwardRef as Ie, useImperativeHandle as Fe, useMemo as Ne } from "react";
2
+ import { c as $e, s as Me, K as oe, b as Ye, Q as Be } from "./ChartCore-BimVvUEg.js";
3
+ import { c as We } from "./index-CUGS98p4.js";
4
+ var de = { exports: {} }, ae = {};
5
+ /**
6
+ * @license React
7
+ * react-jsx-runtime.production.js
8
+ *
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+ var Ae;
15
+ function Xe() {
16
+ if (Ae) return ae;
17
+ Ae = 1;
18
+ var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
19
+ function t(a, i, u) {
20
+ var y = null;
21
+ if (u !== void 0 && (y = "" + u), i.key !== void 0 && (y = "" + i.key), "key" in i) {
22
+ u = {};
23
+ for (var _ in i)
24
+ _ !== "key" && (u[_] = i[_]);
25
+ } else u = i;
26
+ return i = u.ref, {
27
+ $$typeof: e,
28
+ type: a,
29
+ key: y,
30
+ ref: i !== void 0 ? i : null,
31
+ props: u
32
+ };
33
+ }
34
+ return ae.Fragment = n, ae.jsx = t, ae.jsxs = t, ae;
35
+ }
36
+ var ie = {};
37
+ /**
38
+ * @license React
39
+ * react-jsx-runtime.development.js
40
+ *
41
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */
46
+ var _e;
47
+ function He() {
48
+ return _e || (_e = 1, process.env.NODE_ENV !== "production" && function() {
49
+ function e(r) {
50
+ if (r == null) return null;
51
+ if (typeof r == "function")
52
+ return r.$$typeof === T ? null : r.displayName || r.name || null;
53
+ if (typeof r == "string") return r;
54
+ switch (r) {
55
+ case l:
56
+ return "Fragment";
57
+ case j:
58
+ return "Profiler";
59
+ case c:
60
+ return "StrictMode";
61
+ case g:
62
+ return "Suspense";
63
+ case A:
64
+ return "SuspenseList";
65
+ case C:
66
+ return "Activity";
67
+ }
68
+ if (typeof r == "object")
69
+ switch (typeof r.tag == "number" && console.error(
70
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
71
+ ), r.$$typeof) {
72
+ case L:
73
+ return "Portal";
74
+ case x:
75
+ return r.displayName || "Context";
76
+ case P:
77
+ return (r._context.displayName || "Context") + ".Consumer";
78
+ case w:
79
+ var d = r.render;
80
+ return r = r.displayName, r || (r = d.displayName || d.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
81
+ case f:
82
+ return d = r.displayName || null, d !== null ? d : e(r.type) || "Memo";
83
+ case v:
84
+ d = r._payload, r = r._init;
85
+ try {
86
+ return e(r(d));
87
+ } catch {
88
+ }
89
+ }
90
+ return null;
91
+ }
92
+ function n(r) {
93
+ return "" + r;
94
+ }
95
+ function t(r) {
96
+ try {
97
+ n(r);
98
+ var d = !1;
99
+ } catch {
100
+ d = !0;
101
+ }
102
+ if (d) {
103
+ d = console;
104
+ var S = d.error, M = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
105
+ return S.call(
106
+ d,
107
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
+ M
109
+ ), n(r);
110
+ }
111
+ }
112
+ function a(r) {
113
+ if (r === l) return "<>";
114
+ if (typeof r == "object" && r !== null && r.$$typeof === v)
115
+ return "<...>";
116
+ try {
117
+ var d = e(r);
118
+ return d ? "<" + d + ">" : "<...>";
119
+ } catch {
120
+ return "<...>";
121
+ }
122
+ }
123
+ function i() {
124
+ var r = R.A;
125
+ return r === null ? null : r.getOwner();
126
+ }
127
+ function u() {
128
+ return Error("react-stack-top-frame");
129
+ }
130
+ function y(r) {
131
+ if ($.call(r, "key")) {
132
+ var d = Object.getOwnPropertyDescriptor(r, "key").get;
133
+ if (d && d.isReactWarning) return !1;
134
+ }
135
+ return r.key !== void 0;
136
+ }
137
+ function _(r, d) {
138
+ function S() {
139
+ G || (G = !0, console.error(
140
+ "%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)",
141
+ d
142
+ ));
143
+ }
144
+ S.isReactWarning = !0, Object.defineProperty(r, "key", {
145
+ get: S,
146
+ configurable: !0
147
+ });
148
+ }
149
+ function b() {
150
+ var r = e(this.type);
151
+ return Z[r] || (Z[r] = !0, console.error(
152
+ "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."
153
+ )), r = this.props.ref, r !== void 0 ? r : null;
154
+ }
155
+ function E(r, d, S, M, ee, ne) {
156
+ var z = S.ref;
157
+ return r = {
158
+ $$typeof: p,
159
+ type: r,
160
+ key: d,
161
+ props: S,
162
+ _owner: M
163
+ }, (z !== void 0 ? z : null) !== null ? Object.defineProperty(r, "ref", {
164
+ enumerable: !1,
165
+ get: b
166
+ }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
167
+ configurable: !1,
168
+ enumerable: !1,
169
+ writable: !0,
170
+ value: 0
171
+ }), Object.defineProperty(r, "_debugInfo", {
172
+ configurable: !1,
173
+ enumerable: !1,
174
+ writable: !0,
175
+ value: null
176
+ }), Object.defineProperty(r, "_debugStack", {
177
+ configurable: !1,
178
+ enumerable: !1,
179
+ writable: !0,
180
+ value: ee
181
+ }), Object.defineProperty(r, "_debugTask", {
182
+ configurable: !1,
183
+ enumerable: !1,
184
+ writable: !0,
185
+ value: ne
186
+ }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
187
+ }
188
+ function D(r, d, S, M, ee, ne) {
189
+ var z = d.children;
190
+ if (z !== void 0)
191
+ if (M)
192
+ if (Y(z)) {
193
+ for (M = 0; M < z.length; M++)
194
+ F(z[M]);
195
+ Object.freeze && Object.freeze(z);
196
+ } else
197
+ console.error(
198
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
+ );
200
+ else F(z);
201
+ if ($.call(d, "key")) {
202
+ z = e(r);
203
+ var B = Object.keys(d).filter(function(ue) {
204
+ return ue !== "key";
205
+ });
206
+ M = 0 < B.length ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}", K[z + M] || (B = 0 < B.length ? "{" + B.join(": ..., ") + ": ...}" : "{}", console.error(
207
+ `A props object containing a "key" prop is being spread into JSX:
208
+ let props = %s;
209
+ <%s {...props} />
210
+ React keys must be passed directly to JSX without using spread:
211
+ let props = %s;
212
+ <%s key={someKey} {...props} />`,
213
+ M,
214
+ z,
215
+ B,
216
+ z
217
+ ), K[z + M] = !0);
218
+ }
219
+ if (z = null, S !== void 0 && (t(S), z = "" + S), y(d) && (t(d.key), z = "" + d.key), "key" in d) {
220
+ S = {};
221
+ for (var W in d)
222
+ W !== "key" && (S[W] = d[W]);
223
+ } else S = d;
224
+ return z && _(
225
+ S,
226
+ typeof r == "function" ? r.displayName || r.name || "Unknown" : r
227
+ ), E(
228
+ r,
229
+ z,
230
+ S,
231
+ i(),
232
+ ee,
233
+ ne
234
+ );
235
+ }
236
+ function F(r) {
237
+ k(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === v && (r._payload.status === "fulfilled" ? k(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
238
+ }
239
+ function k(r) {
240
+ return typeof r == "object" && r !== null && r.$$typeof === p;
241
+ }
242
+ var I = De, p = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), P = Symbol.for("react.consumer"), x = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), A = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), T = Symbol.for("react.client.reference"), R = I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, Y = Array.isArray, q = console.createTask ? console.createTask : function() {
243
+ return null;
244
+ };
245
+ I = {
246
+ react_stack_bottom_frame: function(r) {
247
+ return r();
248
+ }
249
+ };
250
+ var G, Z = {}, V = I.react_stack_bottom_frame.bind(
251
+ I,
252
+ u
253
+ )(), Q = q(a(u)), K = {};
254
+ ie.Fragment = l, ie.jsx = function(r, d, S) {
255
+ var M = 1e4 > R.recentlyCreatedOwnerStacks++;
256
+ return D(
257
+ r,
258
+ d,
259
+ S,
260
+ !1,
261
+ M ? Error("react-stack-top-frame") : V,
262
+ M ? q(a(r)) : Q
263
+ );
264
+ }, ie.jsxs = function(r, d, S) {
265
+ var M = 1e4 > R.recentlyCreatedOwnerStacks++;
266
+ return D(
267
+ r,
268
+ d,
269
+ S,
270
+ !0,
271
+ M ? Error("react-stack-top-frame") : V,
272
+ M ? q(a(r)) : Q
273
+ );
274
+ };
275
+ }()), ie;
276
+ }
277
+ process.env.NODE_ENV === "production" ? de.exports = Xe() : de.exports = He();
278
+ var se = de.exports;
279
+ function Ue(e, n = {}) {
280
+ const [t, a] = le(null), [i, u] = le(!1), [y, _] = le(null), [b, E] = le(null), D = fe(n);
281
+ D.current = n, ce(() => {
282
+ const l = e.current;
283
+ if (l) {
284
+ try {
285
+ const c = $e({
286
+ ...D.current,
287
+ container: l
288
+ });
289
+ c.on("zoom", () => {
290
+ E(c.getViewBounds());
291
+ }), a(c), u(!0), E(c.getViewBounds()), _(null);
292
+ } catch (c) {
293
+ console.error("[useSciPlot] Failed to initialize chart:", c), _(c instanceof Error ? c : new Error(String(c))), u(!1);
294
+ }
295
+ return () => {
296
+ t && (t.destroy(), a(null), u(!1));
297
+ };
298
+ }
299
+ }, [e]);
300
+ const F = re(
301
+ (l) => {
302
+ t && (t.addSeries(l), E(t.getViewBounds()));
303
+ },
304
+ [t]
305
+ ), k = re(
306
+ (l, c) => {
307
+ t && t.updateSeries(l, c);
308
+ },
309
+ [t]
310
+ ), I = re(
311
+ (l) => {
312
+ t && t.removeSeries(l);
313
+ },
314
+ [t]
315
+ ), p = re(
316
+ (l) => {
317
+ t && t.zoom(l);
318
+ },
319
+ [t]
320
+ ), L = re(() => {
321
+ t && (t.resetZoom(), E(t.getViewBounds()));
322
+ }, [t]);
323
+ return {
324
+ chart: t,
325
+ isReady: i,
326
+ error: y,
327
+ bounds: b,
328
+ addSeries: F,
329
+ updateSeries: k,
330
+ removeSeries: I,
331
+ zoom: p,
332
+ resetZoom: L
333
+ };
334
+ }
335
+ const xt = Ie(
336
+ function({
337
+ series: n = [],
338
+ zoom: t,
339
+ onZoomChange: a,
340
+ cursor: i,
341
+ width: u = "100%",
342
+ height: y = 400,
343
+ className: _ = "",
344
+ style: b = {},
345
+ debug: E = !1,
346
+ ...D
347
+ }, F) {
348
+ const k = fe(null), I = fe(/* @__PURE__ */ new Map()), {
349
+ chart: p,
350
+ isReady: L,
351
+ bounds: l,
352
+ addSeries: c,
353
+ updateSeries: j,
354
+ removeSeries: P,
355
+ resetZoom: x
356
+ } = Ue(k, D);
357
+ Fe(
358
+ F,
359
+ () => ({
360
+ getChart: () => p,
361
+ resetZoom: x,
362
+ getBounds: () => l
363
+ }),
364
+ [p, x, l]
365
+ ), ce(() => {
366
+ if (!L || !p) return;
367
+ const g = new Map(n.map((f) => [f.id, f])), A = I.current;
368
+ A.forEach((f, v) => {
369
+ g.has(v) || P(v);
370
+ }), g.forEach((f, v) => {
371
+ const C = A.get(v);
372
+ if (C)
373
+ (C.x !== f.x || C.y !== f.y) && j(v, {
374
+ x: f.x,
375
+ y: f.y
376
+ });
377
+ else {
378
+ const T = {
379
+ id: f.id,
380
+ type: "line",
381
+ data: { x: f.x, y: f.y },
382
+ style: {
383
+ color: f.color ?? "#ff0055",
384
+ width: f.width ?? 1.5
385
+ },
386
+ visible: f.visible ?? !0
387
+ };
388
+ c(T), g.size === 1 && p.autoScale();
389
+ }
390
+ }), I.current = g;
391
+ }, [n, L, p, c, j, P]), ce(() => {
392
+ !L || !p || !t || p.zoom(t);
393
+ }, [L, p, t]), ce(() => {
394
+ !L || !p || !a || p.on("zoom", (g) => {
395
+ a({
396
+ xMin: g.x[0],
397
+ xMax: g.x[1],
398
+ yMin: g.y[0],
399
+ yMax: g.y[1]
400
+ });
401
+ });
402
+ }, [L, p, a]), ce(() => {
403
+ !L || !p || (i != null && i.enabled ? p.enableCursor(i) : p.disableCursor());
404
+ }, [L, p, i]);
405
+ const w = Ne(
406
+ () => ({
407
+ position: "relative",
408
+ width: typeof u == "number" ? `${u}px` : u,
409
+ height: typeof y == "number" ? `${y}px` : y,
410
+ ...b
411
+ }),
412
+ [u, y, b]
413
+ );
414
+ return /* @__PURE__ */ se.jsx(
415
+ "div",
416
+ {
417
+ ref: k,
418
+ className: `velo-plot-container ${_}`,
419
+ style: w,
420
+ children: E && l && /* @__PURE__ */ se.jsxs(
421
+ "div",
422
+ {
423
+ style: {
424
+ position: "absolute",
425
+ top: 8,
426
+ right: 8,
427
+ background: "rgba(0,0,0,0.7)",
428
+ color: "#0f0",
429
+ padding: "4px 8px",
430
+ borderRadius: 4,
431
+ fontSize: 11,
432
+ fontFamily: "monospace"
433
+ },
434
+ children: [
435
+ /* @__PURE__ */ se.jsxs("div", { children: [
436
+ "X: [",
437
+ l.xMin.toFixed(3),
438
+ ", ",
439
+ l.xMax.toFixed(3),
440
+ "]"
441
+ ] }),
442
+ /* @__PURE__ */ se.jsxs("div", { children: [
443
+ "Y: [",
444
+ l.yMin.toExponential(2),
445
+ ", ",
446
+ l.yMax.toExponential(2),
447
+ "]"
448
+ ] }),
449
+ /* @__PURE__ */ se.jsxs("div", { children: [
450
+ "Series: ",
451
+ n.length
452
+ ] })
453
+ ]
454
+ }
455
+ )
456
+ }
457
+ );
458
+ }
459
+ ), Pe = 5, me = 1 / 6, qe = { top: 4, bottom: 8, left: 4 }, ze = { bottom: 55 };
460
+ function Ge(e) {
461
+ if (typeof e == "number") return e;
462
+ switch (e) {
463
+ case "8k":
464
+ return 8;
465
+ case "4k":
466
+ return 4;
467
+ case "2k":
468
+ return 2;
469
+ default:
470
+ return 1;
471
+ }
472
+ }
473
+ function Ve(e) {
474
+ return new Promise((n, t) => {
475
+ const a = new Image();
476
+ a.onload = () => n(a), a.onerror = t, a.src = e;
477
+ });
478
+ }
479
+ function Te(e, n) {
480
+ const t = e.getBoundingClientRect();
481
+ return {
482
+ x: t.left - n.left,
483
+ y: t.top - n.top,
484
+ width: t.width,
485
+ height: t.height
486
+ };
487
+ }
488
+ async function Je(e, n, t, a, i, u = {}) {
489
+ var l;
490
+ const {
491
+ format: y = "png",
492
+ quality: _ = 0.92,
493
+ resolution: b = "standard",
494
+ includeBackground: E = !0,
495
+ includeDividers: D = !0,
496
+ transparent: F = !1
497
+ } = u, k = Ge(b), p = (((l = t[0]) == null ? void 0 : l.getDPR()) ?? (typeof window < "u" ? window.devicePixelRatio : 1)) * k, L = t.map((c) => c.getDPR());
498
+ try {
499
+ if (k > 1) {
500
+ for (const f of t)
501
+ f.setDPR(p), f.render();
502
+ await new Promise((f) => requestAnimationFrame(f)), await new Promise((f) => setTimeout(f, 50));
503
+ }
504
+ const c = e.getBoundingClientRect(), j = Math.max(1, Math.round(c.width * p)), P = Math.max(1, Math.round(c.height * p)), x = document.createElement("canvas");
505
+ x.width = j, x.height = P;
506
+ const w = x.getContext("2d");
507
+ if (!w) throw new Error("Failed to create export canvas");
508
+ !F && E && (w.fillStyle = i || "#ffffff", w.fillRect(0, 0, j, P));
509
+ const g = y === "jpeg" ? "jpeg" : "png";
510
+ for (let f = 0; f < n.length; f++) {
511
+ const v = Te(n[f], c), C = t[f].exportImage(g), T = await Ve(C);
512
+ w.drawImage(
513
+ T,
514
+ Math.round(v.x * p),
515
+ Math.round(v.y * p),
516
+ Math.round(v.width * p),
517
+ Math.round(v.height * p)
518
+ );
519
+ }
520
+ if (D && a.length) {
521
+ w.fillStyle = "rgba(128, 128, 128, 0.35)";
522
+ for (const f of a) {
523
+ const v = Te(f, c);
524
+ w.fillRect(
525
+ Math.round(v.x * p),
526
+ Math.round(v.y * p),
527
+ Math.max(1, Math.round(v.width * p)),
528
+ Math.max(1, Math.round(v.height * p))
529
+ );
530
+ }
531
+ }
532
+ const A = y === "jpeg" ? "image/jpeg" : y === "webp" ? "image/webp" : "image/png";
533
+ return x.toDataURL(A, _);
534
+ } finally {
535
+ if (k > 1)
536
+ for (let c = 0; c < t.length; c++)
537
+ t[c].setDPR(L[c]), t[c].render();
538
+ }
539
+ }
540
+ const N = "velo-pane-divider", U = "velo-pane-resizing";
541
+ function Ze(e) {
542
+ if (typeof document > "u") return;
543
+ let n = document.getElementById("velo-pane-divider-styles");
544
+ n || (n = document.createElement("style"), n.id = "velo-pane-divider-styles", document.head.appendChild(n));
545
+ const a = e === "horizontal" ? "ew-resize" : "ns-resize";
546
+ n.textContent = `
547
+ .${N} {
548
+ flex: 0 0 var(--velo-divider-size, 6px);
549
+ position: relative;
550
+ cursor: ${a};
551
+ touch-action: none;
552
+ z-index: 20;
553
+ background: transparent;
554
+ user-select: none;
555
+ }
556
+ .${N}::after {
557
+ content: "";
558
+ position: absolute;
559
+ background: rgba(128, 128, 128, 0.35);
560
+ transition: background 0.15s;
561
+ }
562
+ .${N}[data-direction="vertical"]::after {
563
+ left: 0;
564
+ right: 0;
565
+ top: 50%;
566
+ transform: translateY(-50%);
567
+ height: 1px;
568
+ }
569
+ .${N}[data-direction="horizontal"]::after {
570
+ top: 0;
571
+ bottom: 0;
572
+ left: 50%;
573
+ transform: translateX(-50%);
574
+ width: 1px;
575
+ }
576
+ .${N}:hover::after,
577
+ .${U} .${N}::after {
578
+ background: rgba(0, 242, 255, 0.65);
579
+ }
580
+ .${N}[data-direction="vertical"]:hover::after,
581
+ .${U} .${N}[data-direction="vertical"]::after {
582
+ height: 2px;
583
+ }
584
+ .${N}[data-direction="horizontal"]:hover::after,
585
+ .${U} .${N}[data-direction="horizontal"]::after {
586
+ width: 2px;
587
+ }
588
+ .${N}-handle {
589
+ position: absolute;
590
+ left: 50%;
591
+ top: 50%;
592
+ transform: translate(-50%, -50%);
593
+ width: 32px;
594
+ height: 12px;
595
+ display: flex;
596
+ align-items: center;
597
+ justify-content: center;
598
+ opacity: 0;
599
+ transition: opacity 0.15s;
600
+ pointer-events: none;
601
+ color: rgba(0, 242, 255, 0.9);
602
+ font-size: 10px;
603
+ line-height: 1;
604
+ }
605
+ .${N}:hover .${N}-handle,
606
+ .${U} .${N}-handle {
607
+ opacity: 1;
608
+ }
609
+ .${U} {
610
+ cursor: ${a} !important;
611
+ }
612
+ .${U} * {
613
+ cursor: ${a} !important;
614
+ }
615
+ .${U} [data-pane-id] {
616
+ position: relative !important;
617
+ overflow: hidden !important;
618
+ }
619
+ `;
620
+ }
621
+ function Qe(e, n, t) {
622
+ const a = document.createElement("div");
623
+ a.className = N, a.dataset.dividerIndex = String(e), a.dataset.direction = t, a.style.setProperty("--velo-divider-size", `${n}px`);
624
+ const i = document.createElement("div");
625
+ return i.className = `${N}-handle`, i.textContent = t === "horizontal" ? "⇔" : "⇕", a.appendChild(i), a;
626
+ }
627
+ function Ke(e, n) {
628
+ const t = n === "horizontal" ? "min-width:0;" : "min-height:0;";
629
+ return typeof e == "number" ? `flex:${e} 1 0;${t}` : `flex:1 1 ${e};${t}`;
630
+ }
631
+ function Oe(e, n, t = me, a = 0) {
632
+ if (n < 1 || e <= 0) return 1;
633
+ const i = e * t, u = Math.max(a, i);
634
+ return Math.min(u, e / n);
635
+ }
636
+ function et(e, n, t = me, a = 0) {
637
+ return Oe(e, n, t, a);
638
+ }
639
+ function tt(e, n) {
640
+ const t = e.length;
641
+ if (t === 0) return e;
642
+ const a = Math.max(1, Math.round(n)), i = e.reduce((b, E) => b + E, 0);
643
+ if (i <= 0) {
644
+ const b = Math.floor(a / t), E = e.map(() => b);
645
+ return E[t - 1] = a - b * (t - 1), E;
646
+ }
647
+ const u = e.map((b) => b / i * a), y = [];
648
+ let _ = 0;
649
+ for (let b = 0; b < t - 1; b++)
650
+ y.push(Math.max(1, Math.round(u[b]))), _ += y[b];
651
+ return y.push(Math.max(1, a - _)), y;
652
+ }
653
+ function nt(e, n, t, a, i = {}) {
654
+ const u = i.direction ?? "vertical", y = u === "horizontal";
655
+ Ze(u);
656
+ const _ = i.minPaneRatio ?? me, b = i.minPanePx ?? 0, E = i.dividerSize ?? 6, D = n.length, F = (l) => y ? et(l, D, _, b) : Oe(l, D, _, b), k = [], I = [];
657
+ if (n.length < 2)
658
+ return { dividers: k, destroy: () => {
659
+ } };
660
+ const p = () => {
661
+ const l = k.length * E, c = y ? e.clientWidth : e.clientHeight;
662
+ return Math.max(1, c - l);
663
+ }, L = (l, c, j, P) => {
664
+ var T;
665
+ const x = p(), w = F(x), g = P.reduce(
666
+ (R, $, Y) => Y === l || Y === c ? R : R + $,
667
+ 0
668
+ ), A = x - g;
669
+ let f = P[l] + j;
670
+ f = Math.max(w, Math.min(A - w, f));
671
+ const v = A - f;
672
+ P[l] = f, P[c] = v;
673
+ const C = a.reduce((R, $) => R + $, 0);
674
+ if (a[l] = f / x * C, a[c] = v / x * C, (T = i.onDragMove) == null || T.call(i, P, l, c), i.onResize) {
675
+ const R = {};
676
+ for (let $ = 0; $ < t.length; $++)
677
+ R[t[$]] = a[$];
678
+ i.onResize(R);
679
+ }
680
+ };
681
+ for (let l = 0; l < n.length - 1; l++) {
682
+ const c = Qe(l, E, u);
683
+ n[l].after(c), k.push(c);
684
+ const P = (x) => {
685
+ var v, C;
686
+ x.preventDefault(), c.setPointerCapture(x.pointerId), e.classList.add(U);
687
+ const w = ((v = i.onDragStart) == null ? void 0 : v.call(i, l, l + 1)) ?? n.map(
688
+ (T) => y ? T.getBoundingClientRect().width : T.getBoundingClientRect().height
689
+ );
690
+ (C = i.onDragMove) == null || C.call(i, w, l, l + 1);
691
+ let g = y ? x.clientX : x.clientY;
692
+ const A = (T) => {
693
+ const R = y ? T.clientX : T.clientY, $ = R - g;
694
+ g = R, $ !== 0 && L(l, l + 1, $, w);
695
+ }, f = (T) => {
696
+ var R;
697
+ c.releasePointerCapture(T.pointerId), e.classList.remove(U), c.removeEventListener("pointermove", A), c.removeEventListener("pointerup", f), c.removeEventListener("pointercancel", f), (R = i.onDragEnd) == null || R.call(i, w);
698
+ };
699
+ c.addEventListener("pointermove", A), c.addEventListener("pointerup", f), c.addEventListener("pointercancel", f);
700
+ };
701
+ c.addEventListener("pointerdown", P), I.push(() => c.removeEventListener("pointerdown", P));
702
+ }
703
+ return {
704
+ dividers: k,
705
+ destroy: () => {
706
+ for (const l of I) l();
707
+ for (const l of k) l.remove();
708
+ e.classList.remove(U);
709
+ }
710
+ };
711
+ }
712
+ function rt(e, n, t = "vertical") {
713
+ for (let a = 0; a < e.length; a++)
714
+ e[a].style.cssText = `${Ke(n[a], t)}position:relative;overflow:hidden;`;
715
+ }
716
+ function ot(e) {
717
+ return typeof e == "number" ? e : 1;
718
+ }
719
+ function at(e, n = 6) {
720
+ if (!Number.isFinite(e) || e <= 0) return n;
721
+ const t = Math.floor(e / 36);
722
+ return Math.max(2, Math.min(n, t));
723
+ }
724
+ function it(e, n = 8) {
725
+ if (!Number.isFinite(e) || e <= 0) return n;
726
+ const t = Math.floor(e / 72);
727
+ return Math.max(2, Math.min(n, t));
728
+ }
729
+ function st(e) {
730
+ var t;
731
+ return e ? ((t = (Array.isArray(e) ? e : [e])[0]) == null ? void 0 : t.tickCount) ?? 6 : 6;
732
+ }
733
+ function ct(e) {
734
+ const n = e.wrapper.clientHeight, t = e.wrapper.clientWidth, a = at(n, e.baseYTickCount);
735
+ if (e.chart.updateYAxis("default", { tickCount: a }), e.showXAxis) {
736
+ const i = it(t, e.baseXTickCount);
737
+ e.chart.updateXAxis({ tickCount: i });
738
+ }
739
+ }
740
+ function ke(e) {
741
+ for (const n of e) ct(n);
742
+ }
743
+ function Le(e) {
744
+ const n = e ? Array.isArray(e) ? e : [e] : [{}];
745
+ let t = 0, a = 0;
746
+ for (const i of n)
747
+ i.position === "right" ? a++ : t++;
748
+ return { left: Math.max(1, t), right: a };
749
+ }
750
+ function lt(e, n) {
751
+ var a;
752
+ let t = 0;
753
+ for (const i of e) {
754
+ const { left: u } = Le((a = i.chart) == null ? void 0 : a.yAxis);
755
+ t = Math.max(t, (u - 1) * 65);
756
+ }
757
+ return n + t;
758
+ }
759
+ function ut(e, n) {
760
+ var a;
761
+ let t = 0;
762
+ for (const i of e) {
763
+ const { right: u } = Le((a = i.chart) == null ? void 0 : a.yAxis);
764
+ t = Math.max(t, u * 65);
765
+ }
766
+ return n + t;
767
+ }
768
+ function ft(e, n) {
769
+ const t = n === "horizontal" ? "min-width:0;" : "min-height:0;";
770
+ return typeof e == "number" ? `flex:${e} 1 0;${t}` : `flex:1 1 ${e};${t}`;
771
+ }
772
+ function dt(e) {
773
+ if (!(e != null && e.length)) return [];
774
+ const n = [];
775
+ for (const t of e)
776
+ t.type === "indicator" ? n.push(...Ye(t)) : n.push(t);
777
+ return n;
778
+ }
779
+ function mt(e, n, t, a, i, u, y, _, b) {
780
+ var C, T, R, $, Y, q, G, Z, V, Q, K, r, d;
781
+ const E = a === 0, D = a === i - 1, F = b === "horizontal", I = !F && t.sharedXAxis !== "none" && !y, L = F && (t.sharedYAxis ?? "left") !== "none" && !_, c = (t.gap ?? 0) > 0 ? qe : { top: 0, bottom: 0, left: 0 }, j = F ? {
782
+ top: u.top,
783
+ right: D ? u.right : c.left ?? 0,
784
+ left: L ? c.left ?? 4 : u.left,
785
+ bottom: u.bottom
786
+ } : {
787
+ top: E ? u.top : c.top,
788
+ right: u.right,
789
+ left: u.left,
790
+ bottom: I ? c.bottom : D ? ((T = (C = t.layout) == null ? void 0 : C.margins) == null ? void 0 : T.bottom) ?? ze.bottom : u.bottom
791
+ }, P = ((R = e.chart) == null ? void 0 : R.xAxis) ?? {}, x = {
792
+ ...P,
793
+ showLine: y ? P.showLine ?? !0 : !1,
794
+ showTicks: y ? P.showTicks ?? !0 : !1,
795
+ showLabels: y ? P.showLabels ?? !0 : !1
796
+ }, w = (($ = e.chart) == null ? void 0 : $.yAxis) ?? {}, A = (Array.isArray(w) ? w : [w]).map((S) => ({
797
+ ...S,
798
+ showLine: _ ? S.showLine ?? !0 : !1,
799
+ showTicks: _ ? S.showTicks ?? !0 : !1,
800
+ showLabels: _ ? S.showLabels ?? !0 : !1
801
+ })), f = Array.isArray((Y = e.chart) == null ? void 0 : Y.yAxis) ? A : A[0];
802
+ return (e.interactive ?? !0) || (n.style.pointerEvents = "none"), {
803
+ ...e.chart,
804
+ id: e.id,
805
+ container: n,
806
+ showLegend: ((q = e.chart) == null ? void 0 : q.showLegend) ?? t.showLegend ?? !1,
807
+ theme: ((G = e.chart) == null ? void 0 : G.theme) ?? t.theme,
808
+ devicePixelRatio: t.devicePixelRatio ?? ((Z = e.chart) == null ? void 0 : Z.devicePixelRatio),
809
+ loading: ((V = e.chart) == null ? void 0 : V.loading) ?? !1,
810
+ xAxis: x,
811
+ yAxis: f,
812
+ layout: Me({
813
+ ...t.layout,
814
+ ...(Q = e.chart) == null ? void 0 : Q.layout,
815
+ margins: { ...j, ...(K = t.layout) == null ? void 0 : K.margins, ...(d = (r = e.chart) == null ? void 0 : r.layout) == null ? void 0 : d.margins }
816
+ })
817
+ };
818
+ }
819
+ function Ce(e, n, t, a) {
820
+ const i = n > 0 && t > 0 ? a === "horizontal" ? `margin-left:${n}px;` : `margin-top:${n}px;` : "";
821
+ return `${ft(e, a)}position:relative;overflow:hidden;${i}`;
822
+ }
823
+ function ht(e, n, t) {
824
+ return e === !1 ? {
825
+ axis: "none",
826
+ syncCursor: !1,
827
+ syncZoom: !1,
828
+ syncPan: !1,
829
+ bidirectional: !0,
830
+ masterId: void 0
831
+ } : {
832
+ axis: t === "horizontal" ? "y" : "x",
833
+ bidirectional: !0,
834
+ masterId: n,
835
+ syncCursor: !0,
836
+ syncZoom: !0,
837
+ syncPan: !0,
838
+ ...typeof e == "object" ? e : {}
839
+ };
840
+ }
841
+ function bt(e) {
842
+ var ge, ye, ve, xe, be, we, Re, Se;
843
+ const { container: n, panes: t } = e;
844
+ if (!n) throw new Error("[StackedChart] container is required");
845
+ if (t.length < 1 || t.length > Pe)
846
+ throw new Error(`[StackedChart] panes must be 1–${Pe}`);
847
+ const a = e.masterPaneId ?? t[0].id, i = e.direction ?? "vertical", u = i === "horizontal", y = e.sharedXAxis ?? "bottom", _ = e.sharedYAxis ?? "left", b = e.gap ?? 0, E = e.resizable, D = !!E, F = typeof E == "object" ? E.dividerSize ?? 6 : 6, k = Me(e.layout), I = ((ge = k.margins) == null ? void 0 : ge.left) ?? oe.left, p = ((ye = k.margins) == null ? void 0 : ye.right) ?? oe.right, L = ((ve = k.margins) == null ? void 0 : ve.top) ?? oe.top, l = lt(t, I), c = ut(t, p);
848
+ n.replaceChildren(), n.style.display = "flex", n.style.flexDirection = u ? "row" : "column", n.style.width = "100%";
849
+ const j = n.offsetHeight || parseInt(getComputedStyle(n).height, 10), P = n.offsetWidth || parseInt(getComputedStyle(n).width, 10);
850
+ u ? (P > 0 ? (n.style.width = `${P}px`, n.style.minWidth = `${P}px`) : n.style.width || (n.style.minWidth = "480px"), n.style.height = j > 0 ? `${j}px` : "320px", n.style.minHeight = n.style.height) : j > 0 ? (n.style.height = `${j}px`, n.style.minHeight = `${j}px`) : n.style.height || (n.style.minHeight = "320px"), n.style.overflow = "hidden", n.style.position = "relative";
851
+ const x = t.map((o) => o.id), w = t.map((o) => ot(o.height)), g = /* @__PURE__ */ new Map(), A = [], f = [];
852
+ let v = null, C = !1, T = 0, R = 0, $ = null;
853
+ const Y = (o) => {
854
+ const s = Array.from({ length: A.length }, (m, h) => h);
855
+ for (const m of s) {
856
+ const h = g.get(x[m]);
857
+ h && h.resize();
858
+ }
859
+ ke(
860
+ s.map((m) => f[m]).filter(Boolean)
861
+ );
862
+ }, q = () => {
863
+ T || (T = requestAnimationFrame(() => {
864
+ T = 0, !C && Y();
865
+ }));
866
+ }, G = new ResizeObserver(() => {
867
+ C || q();
868
+ });
869
+ G.observe(n);
870
+ const Z = () => {
871
+ for (let o = 0; o < A.length; o++)
872
+ A[o].style.cssText = Ce(w[o], b, o, i);
873
+ }, V = () => {
874
+ const o = (A.length - 1) * F;
875
+ return u ? Math.max(1, n.clientWidth - o) : Math.max(1, n.clientHeight - o);
876
+ }, Q = () => {
877
+ for (const o of A) {
878
+ const s = o.firstElementChild;
879
+ s && (s.style.cssText = "position:absolute;inset:0;width:100%;height:100%;");
880
+ }
881
+ }, K = () => {
882
+ const o = V(), s = A.map(
883
+ (h) => u ? h.getBoundingClientRect().width : h.getBoundingClientRect().height
884
+ ), m = s.reduce((h, O) => h + O, 0);
885
+ return m > 0 ? s.map((h) => h * (o / m)) : s;
886
+ }, r = (o) => {
887
+ for (let s = 0; s < A.length; s++) {
888
+ const m = Math.max(1, Math.round(o[s])), h = b > 0 && s > 0 ? u ? `margin-left:${b}px;` : `margin-top:${b}px;` : "", O = u ? "width" : "height";
889
+ A[s].style.cssText = `${O}:${m}px;flex:0 0 auto;min-height:0;min-width:0;position:relative;overflow:hidden;${h}`;
890
+ }
891
+ }, d = () => {
892
+ if (R = 0, !C || !$) return;
893
+ const { sizes: o, leadingIdx: s, trailingIdx: m } = $;
894
+ r(o);
895
+ for (const h of [s, m]) {
896
+ const O = g.get(x[h]);
897
+ O && (O.resize(), ke([f[h]]));
898
+ }
899
+ }, S = (o, s, m) => {
900
+ $ = { sizes: o, leadingIdx: s, trailingIdx: m }, !R && (R = requestAnimationFrame(d));
901
+ }, M = (o) => {
902
+ const s = o.reduce((h, O) => h + O, 0);
903
+ if (s <= 0) return;
904
+ const m = w.reduce((h, O) => h + O, 0);
905
+ for (let h = 0; h < w.length; h++)
906
+ w[h] = o[h] / s * m;
907
+ }, ee = (o) => {
908
+ var s;
909
+ for (const m of g.values())
910
+ (s = m.setResizeSuspended) == null || s.call(m, o);
911
+ }, ne = (o, s) => {
912
+ var m, h, O, J, X, te;
913
+ for (let H = 0; H < x.length; H++)
914
+ H === o || H === s || (h = (m = g.get(x[H])) == null ? void 0 : m.setResizeSuspended) == null || h.call(m, !0);
915
+ (J = (O = g.get(x[o])) == null ? void 0 : O.setResizeSuspended) == null || J.call(O, !1), (te = (X = g.get(x[s])) == null ? void 0 : X.setResizeSuspended) == null || te.call(X, !1);
916
+ }, z = u ? ((be = (xe = e.layout) == null ? void 0 : xe.margins) == null ? void 0 : be.bottom) ?? ze.bottom : oe.bottom;
917
+ for (let o = 0; o < t.length; o++) {
918
+ const s = t[o], m = o === 0, h = o === t.length - 1, O = u ? s.showXAxis ?? !0 : s.showXAxis ?? (y === "bottom" ? h : !0), J = u ? s.showYAxis ?? (_ === "left" ? m : !0) : s.showYAxis ?? !0, X = document.createElement("div");
919
+ X.dataset.paneId = s.id, X.style.cssText = Ce(w[o], b, o, i);
920
+ const te = document.createElement("div");
921
+ te.style.cssText = "position:absolute;inset:0;width:100%;height:100%;", X.appendChild(te), n.appendChild(X), A.push(X);
922
+ const H = $e(
923
+ mt(
924
+ s,
925
+ te,
926
+ e,
927
+ o,
928
+ t.length,
929
+ {
930
+ left: u && !J ? oe.left : l,
931
+ right: c,
932
+ top: L,
933
+ bottom: z
934
+ },
935
+ O,
936
+ J,
937
+ i
938
+ )
939
+ ), Ee = dt(s.series);
940
+ if (Ee.length)
941
+ for (const je of Ee) H.addSeries(je);
942
+ s.yRange && s.yRange !== "auto" && H.zoom({ y: s.yRange, animate: !1 }), g.set(s.id, H), f.push({
943
+ chart: H,
944
+ wrapper: X,
945
+ baseYTickCount: st((we = s.chart) == null ? void 0 : we.yAxis),
946
+ baseXTickCount: ((Se = (Re = s.chart) == null ? void 0 : Re.xAxis) == null ? void 0 : Se.tickCount) ?? 8,
947
+ showXAxis: O
948
+ });
949
+ }
950
+ if (D && t.length > 1) {
951
+ const o = typeof E == "object" ? {
952
+ minPaneRatio: E.minPaneRatio,
953
+ minPanePx: E.minPanePx,
954
+ dividerSize: E.dividerSize
955
+ } : {};
956
+ v = nt(
957
+ n,
958
+ A,
959
+ x,
960
+ w,
961
+ {
962
+ direction: i,
963
+ ...o,
964
+ onDragStart: (s, m) => (C = !0, ee(!0), ne(s, m), K()),
965
+ onDragMove: (s, m, h) => {
966
+ S(s, m, h);
967
+ },
968
+ onDragEnd: (s) => {
969
+ R && (cancelAnimationFrame(R), R = 0), $ = null, C = !1;
970
+ const m = tt(s, V());
971
+ M(m), Q(), Z(), ee(!1), Y();
972
+ }
973
+ }
974
+ );
975
+ }
976
+ const B = g.get(a);
977
+ if (!B)
978
+ throw new Error(`[StackedChart] masterPaneId "${a}" not found in panes`);
979
+ const W = We(
980
+ Array.from(g.values()),
981
+ ht(e.sync, a, i)
982
+ ), ue = () => {
983
+ const o = B.theme ?? B.baseTheme;
984
+ return (o == null ? void 0 : o.backgroundColor) ?? "#ffffff";
985
+ }, he = () => {
986
+ const s = Date.now();
987
+ return new Promise((h) => {
988
+ const O = () => {
989
+ const J = Be();
990
+ if (J.pending === 0 && !J.isProcessing || Date.now() - s > 8e3) {
991
+ h();
992
+ return;
993
+ }
994
+ setTimeout(O, 50);
995
+ };
996
+ O();
997
+ }).then(() => new Promise((h) => {
998
+ requestAnimationFrame(() => {
999
+ Y(), h();
1000
+ });
1001
+ }));
1002
+ }, pe = async (o = {}) => {
1003
+ await he();
1004
+ for (const m of g.values()) m.render();
1005
+ await new Promise((m) => requestAnimationFrame(m));
1006
+ const s = await Je(
1007
+ n,
1008
+ A,
1009
+ Array.from(g.values()),
1010
+ (v == null ? void 0 : v.dividers) ?? [],
1011
+ ue(),
1012
+ o
1013
+ );
1014
+ if (o.download) {
1015
+ const m = o.format === "jpeg" ? "jpg" : o.format ?? "png", h = document.createElement("a");
1016
+ h.download = `${o.fileName ?? "velo-plot-stack"}.${m}`, h.href = s, document.body.appendChild(h), h.click(), document.body.removeChild(h);
1017
+ }
1018
+ return s;
1019
+ };
1020
+ return {
1021
+ container: n,
1022
+ getPane(o) {
1023
+ return g.get(o);
1024
+ },
1025
+ getPanes() {
1026
+ return Array.from(g.values());
1027
+ },
1028
+ getMaster() {
1029
+ return B;
1030
+ },
1031
+ getGroup() {
1032
+ return W;
1033
+ },
1034
+ fitAll(o) {
1035
+ W.fitAll(o);
1036
+ },
1037
+ resetAll() {
1038
+ W.resetAll();
1039
+ },
1040
+ resize() {
1041
+ Y();
1042
+ },
1043
+ getPaneRatios() {
1044
+ const o = {};
1045
+ for (let s = 0; s < x.length; s++)
1046
+ o[x[s]] = w[s];
1047
+ return o;
1048
+ },
1049
+ setPaneRatios(o) {
1050
+ for (let s = 0; s < x.length; s++) {
1051
+ const m = x[s];
1052
+ o[m] !== void 0 && (w[s] = o[m]);
1053
+ }
1054
+ rt(A, w, i), Y();
1055
+ },
1056
+ setSyncAxis(o) {
1057
+ W.syncAxis(o);
1058
+ },
1059
+ getSyncAxis() {
1060
+ return W.getOptions().axis ?? "x";
1061
+ },
1062
+ setSyncOptions(o) {
1063
+ W.updateOptions(o);
1064
+ },
1065
+ whenReady() {
1066
+ return he();
1067
+ },
1068
+ exportImage(o) {
1069
+ return pe(o);
1070
+ },
1071
+ snapshot(o) {
1072
+ return pe(o);
1073
+ },
1074
+ destroy() {
1075
+ T && cancelAnimationFrame(T), R && cancelAnimationFrame(R), G.disconnect(), v == null || v.destroy(), W.destroy();
1076
+ for (const o of g.values()) o.destroy();
1077
+ g.clear(), n.replaceChildren();
1078
+ }
1079
+ };
1080
+ }
1081
+ export {
1082
+ xt as S,
1083
+ Pe as a,
1084
+ me as b,
1085
+ bt as c,
1086
+ Ue as u
1087
+ };
1088
+ //# sourceMappingURL=createStackedChart-CjsKcOvX.js.map