@abdullahjaswal/tickyr-charts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4561 @@
1
+ import { r as e, t } from "./chunk-BmowowmI.js";
2
+ import { A as n, B as r, Ct as i, Dt as a, Et as o, F as s, Fn as c, G as l, H as u, Ht as d, I as f, In as p, L as m, M as h, Mn as g, N as _, Nt as v, P as y, R as b, St as x, Tn as S, Tt as C, U as w, V as T, W as E, Y as D, Yt as O, at as k, ct as A, dn as j, dt as M, fn as N, ft as P, j as F, jt as I, k as L, kn as R, kt as z, lt as B, ot as V, pn as H, q as U, qt as W, st as G, ut as K, wn as ee, wt as te, z as ne } from "./accessibility-B-2UbONR.js";
3
+ import * as q from "react";
4
+ import { Fragment as re, jsx as J, jsxs as Y } from "react/jsx-runtime";
5
+ var ie = /* @__PURE__ */ t(((t2) => {
6
+ var n2 = e("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
7
+ t2.c = function(e2) {
8
+ return n2.H.useMemoCache(e2);
9
+ };
10
+ })), X = /* @__PURE__ */ t(((t2) => {
11
+ process.env.NODE_ENV !== "production" && (function() {
12
+ var n2 = e("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
13
+ t2.c = function(e2) {
14
+ var t3 = n2.H;
15
+ return t3 === null && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."), t3.useMemoCache(e2);
16
+ };
17
+ })();
18
+ })), Z = (/* @__PURE__ */ t(((e2, t2) => {
19
+ process.env.NODE_ENV === "production" ? t2.exports = ie() : t2.exports = X();
20
+ })))(), Q = Object.freeze({
21
+ theme: "inherit",
22
+ palette: "Monochrome",
23
+ locale: "USA",
24
+ timeZone: void 0,
25
+ visualStyle: "Fill",
26
+ outlineFillColor: "auto",
27
+ outlineFillOpacity: 15,
28
+ cornerRadius: 3,
29
+ borderWidth: 1.4,
30
+ accents: false,
31
+ osTheme: "light",
32
+ appTheme: "light"
33
+ }), ae = q.createContext(Q);
34
+ ae.displayName = "ChartsContext";
35
+ function oe(e2) {
36
+ let t2 = (0, Z.c)(19), n2, r2;
37
+ t2[0] === e2.palettes ? (n2 = t2[1], r2 = t2[2]) : (n2 = () => {
38
+ if (e2.palettes !== void 0) for (let t3 of e2.palettes) R(t3);
39
+ }, r2 = [e2.palettes], t2[0] = e2.palettes, t2[1] = n2, t2[2] = r2), q.useEffect(n2, r2);
40
+ let i2 = e2.theme ?? Q.theme, a2 = e2.palette ?? Q.palette, o2 = e2.locale ?? Q.locale, s2 = e2.visualStyle ?? Q.visualStyle, c2 = e2.outlineFillColor ?? Q.outlineFillColor, l2 = e2.outlineFillOpacity ?? Q.outlineFillOpacity, u2 = e2.cornerRadius ?? Q.cornerRadius, d2 = e2.borderWidth ?? Q.borderWidth, f2 = e2.accents ?? Q.accents, p2 = e2.osTheme ?? Q.osTheme, m2 = e2.appTheme ?? Q.appTheme, h2;
41
+ t2[3] !== e2.timeZone || t2[4] !== f2 || t2[5] !== p2 || t2[6] !== m2 || t2[7] !== i2 || t2[8] !== a2 || t2[9] !== o2 || t2[10] !== s2 || t2[11] !== c2 || t2[12] !== l2 || t2[13] !== u2 || t2[14] !== d2 ? (h2 = {
42
+ theme: i2,
43
+ palette: a2,
44
+ locale: o2,
45
+ timeZone: e2.timeZone,
46
+ visualStyle: s2,
47
+ outlineFillColor: c2,
48
+ outlineFillOpacity: l2,
49
+ cornerRadius: u2,
50
+ borderWidth: d2,
51
+ accents: f2,
52
+ osTheme: p2,
53
+ appTheme: m2
54
+ }, t2[3] = e2.timeZone, t2[4] = f2, t2[5] = p2, t2[6] = m2, t2[7] = i2, t2[8] = a2, t2[9] = o2, t2[10] = s2, t2[11] = c2, t2[12] = l2, t2[13] = u2, t2[14] = d2, t2[15] = h2) : h2 = t2[15];
55
+ let g2 = h2, _2;
56
+ return t2[16] !== e2.children || t2[17] !== g2 ? (_2 = /* @__PURE__ */ J(ae.Provider, {
57
+ value: g2,
58
+ children: e2.children
59
+ }), t2[16] = e2.children, t2[17] = g2, t2[18] = _2) : _2 = t2[18], _2;
60
+ }
61
+ function $() {
62
+ return q.useContext(ae);
63
+ }
64
+ function se(e2) {
65
+ let t2 = (0, Z.c)(4), n2 = $(), r2 = e2 ?? n2.theme, i2;
66
+ return t2[0] !== n2.appTheme || t2[1] !== n2.osTheme || t2[2] !== r2 ? (i2 = H(r2, n2.appTheme, n2.osTheme), t2[0] = n2.appTheme, t2[1] = n2.osTheme, t2[2] = r2, t2[3] = i2) : i2 = t2[3], i2;
67
+ }
68
+ function ce(e2) {
69
+ return {
70
+ length: 0,
71
+ capacity: e2,
72
+ times: new Float64Array(e2),
73
+ opens: new Float64Array(e2),
74
+ highs: new Float64Array(e2),
75
+ lows: new Float64Array(e2),
76
+ closes: new Float64Array(e2),
77
+ volumes: new Float64Array(e2)
78
+ };
79
+ }
80
+ function le(e2) {
81
+ let t2 = e2.length;
82
+ for (let n2 = 1; n2 < t2; n2++) e2.times[n2 - 1] = e2.times[n2], e2.opens[n2 - 1] = e2.opens[n2], e2.highs[n2 - 1] = e2.highs[n2], e2.lows[n2 - 1] = e2.lows[n2], e2.closes[n2 - 1] = e2.closes[n2], e2.volumes[n2 - 1] = e2.volumes[n2];
83
+ e2.length = t2 - 1;
84
+ }
85
+ function ue(e2, t2, n2, r2) {
86
+ if (t2.kind === C.NoEvent) return;
87
+ if (t2.kind === C.MutateLast) {
88
+ if (e2.length === 0) return;
89
+ let t3 = e2.length - 1;
90
+ n2 > e2.highs[t3] && (e2.highs[t3] = n2), n2 < e2.lows[t3] && (e2.lows[t3] = n2), e2.closes[t3] = n2, e2.volumes[t3] = e2.volumes[t3] + r2;
91
+ return;
92
+ }
93
+ e2.length >= e2.capacity && le(e2);
94
+ let i2 = e2.length;
95
+ e2.times[i2] = t2.bucketStartMs, e2.opens[i2] = n2, e2.highs[i2] = n2, e2.lows[i2] = n2, e2.closes[i2] = n2, e2.volumes[i2] = r2, e2.length = i2 + 1;
96
+ }
97
+ function de(e2) {
98
+ let t2 = e2.capacity ?? 5e3, n2 = q.useRef(ce(t2)), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(o()), s2 = q.useRef([]), [c2, l2] = q.useState(false), [u2, d2] = q.useState(0);
99
+ q.useEffect(() => {
100
+ let o2 = false;
101
+ return (async () => {
102
+ let c3 = await te(e2.market);
103
+ if (o2) {
104
+ c3.free();
105
+ return;
106
+ }
107
+ i2.current = c3;
108
+ let u3 = await x({
109
+ timeframeMinutes: e2.timeframeMinutes,
110
+ capacity: t2,
111
+ market: c3,
112
+ minPriceRaw: e2.minPriceRaw,
113
+ maxPriceRaw: e2.maxPriceRaw,
114
+ maxVolumeRaw: e2.maxVolumeRaw
115
+ });
116
+ if (o2) {
117
+ u3.free(), c3.free();
118
+ return;
119
+ }
120
+ if (r2.current = u3, e2.anomalyPolicy !== void 0) {
121
+ let t3 = e2.anomalyPolicy;
122
+ u3.setAnomalyPolicy(t3.maxRelativePriceJump ?? -1, t3.rejectZeroVolumeTrade ?? false, t3.clockSkewToleranceMs ?? -1, t3.maxGapMs ?? -1);
123
+ }
124
+ e2.onAudit !== void 0 && u3.setAuditCallback(e2.onAudit), e2.onTelemetry !== void 0 && u3.setTelemetryCallback(e2.onTelemetry);
125
+ let f3 = s2.current;
126
+ if (f3.length > 0) {
127
+ let e3 = n2.current, t3 = a2.current;
128
+ for (let n3 = 0; n3 < f3.length; n3++) {
129
+ let [r3, i3, a3] = f3[n3];
130
+ try {
131
+ u3.pushTick(r3, i3, a3, t3), ue(e3, t3, i3, a3);
132
+ } catch {
133
+ }
134
+ }
135
+ f3.length = 0;
136
+ }
137
+ l2(true), d2((e3) => e3 + 1);
138
+ })(), () => {
139
+ o2 = true;
140
+ let e3 = r2.current;
141
+ e3 !== null && (e3.free(), r2.current = null);
142
+ let t3 = i2.current;
143
+ t3 !== null && (t3.free(), i2.current = null);
144
+ };
145
+ }, [
146
+ e2.market,
147
+ e2.timeframeMinutes,
148
+ t2,
149
+ e2.minPriceRaw,
150
+ e2.maxPriceRaw,
151
+ e2.maxVolumeRaw,
152
+ e2.anomalyPolicy,
153
+ e2.onAudit,
154
+ e2.onTelemetry
155
+ ]);
156
+ let f2 = q.useCallback((e3, t3, i3) => {
157
+ let o2 = r2.current;
158
+ if (o2 === null) {
159
+ s2.current.push([
160
+ e3,
161
+ t3,
162
+ i3
163
+ ]);
164
+ return;
165
+ }
166
+ let c3 = a2.current;
167
+ o2.pushTick(e3, t3, i3, c3), ue(n2.current, c3, t3, i3), d2((e4) => e4 + 1);
168
+ }, []), p2 = q.useCallback(() => {
169
+ let e3 = r2.current;
170
+ e3 !== null && e3.reset(), n2.current.length = 0, s2.current.length = 0, d2((e4) => e4 + 1);
171
+ }, []);
172
+ return {
173
+ candles: q.useMemo(() => {
174
+ let e3 = n2.current, t3 = e3.length;
175
+ return {
176
+ times: e3.times.subarray(0, t3),
177
+ opens: e3.opens.subarray(0, t3),
178
+ highs: e3.highs.subarray(0, t3),
179
+ lows: e3.lows.subarray(0, t3),
180
+ closes: e3.closes.subarray(0, t3),
181
+ volumes: e3.volumes.subarray(0, t3)
182
+ };
183
+ }, [u2]),
184
+ length: n2.current.length,
185
+ pushTick: f2,
186
+ reset: p2,
187
+ ready: c2
188
+ };
189
+ }
190
+ var fe = q.createContext(null);
191
+ function pe() {
192
+ return q.useContext(fe);
193
+ }
194
+ function me(e2) {
195
+ let t2 = q.useRef(null);
196
+ t2.current === null && (t2.current = A());
197
+ let n2 = t2.current, [r2, i2] = q.useState(0);
198
+ q.useEffect(() => n2.subscribe(() => i2((e3) => e3 + 1)), [n2]);
199
+ let a2 = q.useMemo(() => B({
200
+ syncDomain: e2.syncDomain,
201
+ syncPanZoom: e2.syncPanZoom,
202
+ syncCrosshair: e2.syncCrosshair,
203
+ syncYScale: e2.syncYScale,
204
+ referencePoint: e2.referencePoint,
205
+ syncSelection: e2.syncSelection,
206
+ syncTooltip: e2.syncTooltip,
207
+ brush: e2.brush,
208
+ navigator: e2.navigator
209
+ }), [
210
+ e2.syncDomain,
211
+ e2.syncPanZoom,
212
+ e2.syncCrosshair,
213
+ e2.syncYScale,
214
+ e2.referencePoint,
215
+ e2.syncSelection,
216
+ e2.syncTooltip,
217
+ e2.brush,
218
+ e2.navigator
219
+ ]), o2 = q.useRef(null), s2 = q.useRef(null);
220
+ q.useEffect(() => {
221
+ n2.selectedTime !== o2.current && (o2.current = n2.selectedTime, e2.onSelectionChange?.(n2.selectedTime)), n2.brush !== s2.current && (s2.current = n2.brush, e2.onBrushChange?.(n2.brush));
222
+ }, [
223
+ r2,
224
+ e2.onSelectionChange,
225
+ e2.onBrushChange,
226
+ n2,
227
+ e2
228
+ ]);
229
+ let c2 = q.useMemo(() => ({
230
+ options: a2,
231
+ state: n2,
232
+ version: r2
233
+ }), [
234
+ a2,
235
+ n2,
236
+ r2
237
+ ]);
238
+ return /* @__PURE__ */ J(fe.Provider, {
239
+ value: c2,
240
+ children: e2.children
241
+ });
242
+ }
243
+ var he = 12, ge = 140, _e = 56;
244
+ function ve(e2) {
245
+ return e2 === "light" ? {
246
+ bg: "rgb(255, 255, 255)",
247
+ fg: "rgb(20, 22, 26)",
248
+ subtleFg: "rgba(20, 22, 26, 0.56)",
249
+ border: "rgba(15, 18, 23, 0.08)",
250
+ shadow: "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)"
251
+ } : {
252
+ bg: "rgb(34, 36, 42)",
253
+ fg: "rgb(240, 242, 246)",
254
+ subtleFg: "rgba(240, 242, 246, 0.62)",
255
+ border: "rgba(255, 255, 255, 0.08)",
256
+ shadow: "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)"
257
+ };
258
+ }
259
+ function ye(e2) {
260
+ let t2 = (0, Z.c)(58), { t: n2, seriesValues: r2, pointerX: i2, pointerY: a2, containerWidth: o2, containerHeight: s2, theme: c2, formatter: l2 } = e2, u2;
261
+ t2[0] === c2 ? u2 = t2[1] : (u2 = ve(c2), t2[0] = c2, t2[1] = u2);
262
+ let d2 = u2, f2, p2, m2, h2, g2, _2;
263
+ if (t2[2] !== d2.bg || t2[3] !== d2.border || t2[4] !== d2.fg || t2[5] !== d2.shadow || t2[6] !== d2.subtleFg || t2[7] !== s2 || t2[8] !== o2 || t2[9] !== l2 || t2[10] !== i2 || t2[11] !== a2 || t2[12] !== r2 || t2[13] !== n2) {
264
+ let e3 = r2.filter(be), c3 = i2 > o2 - ge, u3 = a2 > s2 - _e, v3;
265
+ t2[20] !== s2 || t2[21] !== o2 || t2[22] !== i2 || t2[23] !== a2 || t2[24] !== u3 || t2[25] !== c3 ? (v3 = c3 ? { right: `${o2 - i2 + he}px` } : { left: `${i2 + he}px` }, u3 ? v3.bottom = `${s2 - a2 + he}px` : v3.top = `${a2 + he}px`, t2[20] = s2, t2[21] = o2, t2[22] = i2, t2[23] = a2, t2[24] = u3, t2[25] = c3, t2[26] = v3) : v3 = t2[26];
266
+ let y3 = `1px solid ${d2.border}`;
267
+ t2[27] !== d2.bg || t2[28] !== d2.fg || t2[29] !== d2.shadow || t2[30] !== v3 || t2[31] !== y3 ? (m2 = {
268
+ position: "absolute",
269
+ ...v3,
270
+ pointerEvents: "none",
271
+ background: d2.bg,
272
+ color: d2.fg,
273
+ padding: "8px 11px",
274
+ borderRadius: 6,
275
+ border: y3,
276
+ fontSize: 12,
277
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
278
+ lineHeight: 1.35,
279
+ whiteSpace: "nowrap",
280
+ boxShadow: d2.shadow,
281
+ zIndex: 1
282
+ }, t2[27] = d2.bg, t2[28] = d2.fg, t2[29] = d2.shadow, t2[30] = v3, t2[31] = y3, t2[32] = m2) : m2 = t2[32], h2 = "status", g2 = "polite";
283
+ let b2;
284
+ t2[33] === d2.subtleFg ? b2 = t2[34] : (b2 = {
285
+ color: d2.subtleFg,
286
+ fontSize: 10.5,
287
+ letterSpacing: "0.02em",
288
+ textTransform: "uppercase",
289
+ fontWeight: 500,
290
+ marginBottom: 2
291
+ }, t2[33] = d2.subtleFg, t2[34] = b2);
292
+ let x2;
293
+ t2[35] !== l2 || t2[36] !== n2 ? (x2 = l2.formatDate(n2), t2[35] = l2, t2[36] = n2, t2[37] = x2) : x2 = t2[37];
294
+ let S2;
295
+ t2[38] !== l2 || t2[39] !== n2 ? (S2 = l2.formatTime(n2), t2[38] = l2, t2[39] = n2, t2[40] = S2) : S2 = t2[40], t2[41] !== S2 || t2[42] !== b2 || t2[43] !== x2 ? (_2 = /* @__PURE__ */ Y("div", {
296
+ style: b2,
297
+ children: [
298
+ x2,
299
+ " ",
300
+ S2
301
+ ]
302
+ }), t2[41] = S2, t2[42] = b2, t2[43] = x2, t2[44] = _2) : _2 = t2[44], t2[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f2 = {
303
+ display: "flex",
304
+ flexDirection: "column",
305
+ gap: 3
306
+ }, t2[45] = f2) : f2 = t2[45];
307
+ let C2;
308
+ t2[46] !== d2.subtleFg || t2[47] !== l2 ? (C2 = (e4) => /* @__PURE__ */ Y("div", {
309
+ style: {
310
+ display: "flex",
311
+ alignItems: "center",
312
+ gap: 7,
313
+ fontVariantNumeric: "tabular-nums"
314
+ },
315
+ children: [
316
+ /* @__PURE__ */ J("span", {
317
+ "aria-hidden": "true",
318
+ style: {
319
+ width: 9,
320
+ height: 9,
321
+ borderRadius: 2,
322
+ background: e4.color,
323
+ display: "inline-block",
324
+ flex: "0 0 auto"
325
+ }
326
+ }),
327
+ /* @__PURE__ */ J("span", {
328
+ style: {
329
+ color: d2.subtleFg,
330
+ fontWeight: 500
331
+ },
332
+ children: e4.label
333
+ }),
334
+ /* @__PURE__ */ J("span", {
335
+ style: {
336
+ marginLeft: "auto",
337
+ fontWeight: 600
338
+ },
339
+ children: l2.formatPrice(e4.value)
340
+ })
341
+ ]
342
+ }, e4.id), t2[46] = d2.subtleFg, t2[47] = l2, t2[48] = C2) : C2 = t2[48], p2 = e3.map(C2), t2[2] = d2.bg, t2[3] = d2.border, t2[4] = d2.fg, t2[5] = d2.shadow, t2[6] = d2.subtleFg, t2[7] = s2, t2[8] = o2, t2[9] = l2, t2[10] = i2, t2[11] = a2, t2[12] = r2, t2[13] = n2, t2[14] = f2, t2[15] = p2, t2[16] = m2, t2[17] = h2, t2[18] = g2, t2[19] = _2;
343
+ } else f2 = t2[14], p2 = t2[15], m2 = t2[16], h2 = t2[17], g2 = t2[18], _2 = t2[19];
344
+ let v2;
345
+ t2[49] !== f2 || t2[50] !== p2 ? (v2 = /* @__PURE__ */ J("div", {
346
+ style: f2,
347
+ children: p2
348
+ }), t2[49] = f2, t2[50] = p2, t2[51] = v2) : v2 = t2[51];
349
+ let y2;
350
+ return t2[52] !== m2 || t2[53] !== h2 || t2[54] !== g2 || t2[55] !== _2 || t2[56] !== v2 ? (y2 = /* @__PURE__ */ Y("div", {
351
+ style: m2,
352
+ role: h2,
353
+ "aria-live": g2,
354
+ children: [_2, v2]
355
+ }), t2[52] = m2, t2[53] = h2, t2[54] = g2, t2[55] = _2, t2[56] = v2, t2[57] = y2) : y2 = t2[57], y2;
356
+ }
357
+ function be(e2) {
358
+ return !Number.isNaN(e2.value);
359
+ }
360
+ var xe = "12px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
361
+ function Se(e2) {
362
+ let t2 = (0, Z.c)(21), n2 = e2.theme === "dark", r2 = n2 ? "rgb(34,36,42)" : "rgb(255,255,255)", i2 = n2 ? "rgba(255,255,255,0.94)" : "rgba(0,0,0,0.92)", a2 = n2 ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)", o2 = `${e2.pointerX + 12}px`, s2 = `${e2.pointerY + 12}px`, c2 = `1px solid ${a2}`, l2 = n2 ? "0 4px 14px rgba(0,0,0,0.5)" : "0 4px 14px rgba(0,0,0,0.12)", u2;
363
+ t2[0] !== r2 || t2[1] !== i2 || t2[2] !== o2 || t2[3] !== s2 || t2[4] !== c2 || t2[5] !== l2 ? (u2 = {
364
+ position: "absolute",
365
+ left: o2,
366
+ top: s2,
367
+ pointerEvents: "none",
368
+ background: r2,
369
+ color: i2,
370
+ border: c2,
371
+ borderRadius: 6,
372
+ padding: "6px 10px",
373
+ fontSize: 11,
374
+ fontFamily: xe,
375
+ fontVariantNumeric: "tabular-nums",
376
+ boxShadow: l2
377
+ }, t2[0] = r2, t2[1] = i2, t2[2] = o2, t2[3] = s2, t2[4] = c2, t2[5] = l2, t2[6] = u2) : u2 = t2[6];
378
+ let d2;
379
+ t2[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d2 = {
380
+ fontWeight: 600,
381
+ textTransform: "uppercase",
382
+ fontSize: 10,
383
+ letterSpacing: "0.06em",
384
+ opacity: 0.7
385
+ }, t2[7] = d2) : d2 = t2[7];
386
+ let f2 = e2.kind === "high" ? "High" : "Low", p2;
387
+ t2[8] === f2 ? p2 = t2[9] : (p2 = /* @__PURE__ */ J("div", {
388
+ style: d2,
389
+ children: f2
390
+ }), t2[8] = f2, t2[9] = p2);
391
+ let m2;
392
+ t2[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m2 = { fontWeight: 600 }, t2[10] = m2) : m2 = t2[10];
393
+ let h2;
394
+ t2[11] !== e2.formatter || t2[12] !== e2.price ? (h2 = e2.formatter.formatPrice(e2.price), t2[11] = e2.formatter, t2[12] = e2.price, t2[13] = h2) : h2 = t2[13];
395
+ let g2;
396
+ t2[14] !== e2.barIdx || t2[15] !== h2 ? (g2 = /* @__PURE__ */ Y("div", {
397
+ style: m2,
398
+ children: [
399
+ h2,
400
+ " \xB7 bar #",
401
+ e2.barIdx
402
+ ]
403
+ }), t2[14] = e2.barIdx, t2[15] = h2, t2[16] = g2) : g2 = t2[16];
404
+ let _2;
405
+ return t2[17] !== g2 || t2[18] !== u2 || t2[19] !== p2 ? (_2 = /* @__PURE__ */ Y("div", {
406
+ style: u2,
407
+ children: [p2, g2]
408
+ }), t2[17] = g2, t2[18] = u2, t2[19] = p2, t2[20] = _2) : _2 = t2[20], _2;
409
+ }
410
+ function Ce(e2, t2) {
411
+ return e2 === false ? null : typeof e2 == "function" ? e2(t2) : /* @__PURE__ */ J(Se, { ...t2 });
412
+ }
413
+ function we(e2, t2) {
414
+ return e2 === false ? null : typeof e2 == "function" ? e2(t2) : /* @__PURE__ */ J(ye, { ...t2 });
415
+ }
416
+ var Te = q.forwardRef(function(e2, t2) {
417
+ let n2 = $(), r2 = q.useRef(null), a2 = q.useRef(null), o2 = q.useRef(null), s2 = q.useRef(null);
418
+ q.useImperativeHandle(t2, () => ({ onTick: (e3, t3, n3 = 0) => {
419
+ s2.current?.onTick(e3, t3, n3);
420
+ } }), []);
421
+ let [c2, u2] = q.useState(null), [d2, f2] = q.useState(null), [p2, m2] = q.useState(null), [h2, g2] = q.useState("live"), [_2, v2] = q.useState(false), [y2, b2] = q.useState([]), x2 = q.useMemo(() => ({
422
+ theme: n2.theme,
423
+ palette: n2.palette,
424
+ locale: n2.locale,
425
+ timeZone: n2.timeZone,
426
+ visualStyle: n2.visualStyle,
427
+ outlineFillColor: n2.outlineFillColor,
428
+ outlineFillOpacity: n2.outlineFillOpacity,
429
+ cornerRadius: n2.cornerRadius,
430
+ borderWidth: n2.borderWidth,
431
+ accents: n2.accents,
432
+ osTheme: n2.osTheme,
433
+ appTheme: n2.appTheme
434
+ }), [
435
+ n2.theme,
436
+ n2.palette,
437
+ n2.locale,
438
+ n2.timeZone,
439
+ n2.visualStyle,
440
+ n2.outlineFillColor,
441
+ n2.outlineFillOpacity,
442
+ n2.cornerRadius,
443
+ n2.borderWidth,
444
+ n2.accents,
445
+ n2.osTheme,
446
+ n2.appTheme
447
+ ]);
448
+ q.useEffect(() => {
449
+ l();
450
+ }, []), q.useEffect(() => {
451
+ let t3 = a2.current;
452
+ if (t3 === null) return;
453
+ let n3 = new w({
454
+ container: r2.current,
455
+ staticCanvas: t3,
456
+ dynamicCanvas: o2.current,
457
+ initialProps: e2,
458
+ initialProvider: x2,
459
+ onContextChange: u2,
460
+ onHoverChange: f2,
461
+ onExtremeHoverChange: m2,
462
+ onLiveStateChange: g2,
463
+ onReducedMotionChange: v2,
464
+ onResolvedIndicatorsChange: b2
465
+ });
466
+ return s2.current = n3, () => {
467
+ s2.current = null, n3.dispose();
468
+ };
469
+ }, []), q.useEffect(() => {
470
+ s2.current?.update(e2, x2);
471
+ });
472
+ let C2 = pe();
473
+ q.useEffect(() => {
474
+ C2 !== null && C2.options.syncCrosshair && C2.state.setCrosshairTime(d2 === null ? null : d2.t);
475
+ }, [C2, d2]), q.useEffect(() => {
476
+ C2 !== null && C2.options.syncCrosshair && d2 === null && s2.current?.applyExternalCrosshair(C2.state.crosshairTime);
477
+ }, [
478
+ C2,
479
+ C2?.version,
480
+ d2
481
+ ]);
482
+ let T2 = q.useCallback((e3) => {
483
+ s2.current?.handlePointerMove(e3.nativeEvent);
484
+ }, []), D2 = q.useCallback(() => {
485
+ s2.current?.handlePointerLeave();
486
+ }, []), O2 = q.useCallback((e3) => {
487
+ C2 === null || !C2.options.syncSelection || d2 === null || C2.state.setSelectedTime(d2.t);
488
+ }, [C2, d2]), k2 = e2.width ?? 800, A2 = e2.height ?? 300, j2 = e2.sparkline === true || e2.sparkline !== false && k2 < 150, N2 = e2.ariaLabel ?? c2?.ariaLabel ?? "Line chart", P2 = q.useMemo(() => {
489
+ if (d2 === null || c2 === null) return [];
490
+ let t3 = [], { personalization: n3, series: r3, secondarySeriesList: a3, stackedLayout: o3, primaryColorOverride: s3 } = c2, l2 = n3.palette[n3.theme], u3 = ee(S(n3.palette, n3.theme), l2, r3.length > 0 && i(r3.values, r3.length - 1) >= i(r3.values, 0)), f3 = s3 ?? M(u3);
491
+ t3.push({
492
+ id: e2.series?.[0]?.id ?? "primary",
493
+ label: e2.series?.[0]?.label ?? e2.series?.[0]?.id ?? "Price",
494
+ color: f3,
495
+ value: d2.value
496
+ });
497
+ for (let n4 = 0; n4 < a3.length; n4++) {
498
+ let r4 = a3[n4], s4 = e2.series?.[n4 + 1], c3 = r4.ingested.length > 0 ? K(r4.ingested.times, d2.t) : -1, l3 = o3 === null ? r4.ingested.values : o3.tops[n4 + 1], u4 = c3 >= 0 ? i(l3, c3) : NaN;
499
+ t3.push({
500
+ id: s4?.id ?? `series-${n4 + 1}`,
501
+ label: s4?.label ?? s4?.id ?? `Series ${n4 + 2}`,
502
+ color: r4.color,
503
+ value: u4
504
+ });
505
+ }
506
+ if (o3 === null && d2.idx >= 0 && d2.idx < r3.length) for (let e3 = 0; e3 < y2.length; e3++) {
507
+ let n4 = y2[e3];
508
+ if (n4.kind === "single") {
509
+ let r4 = "";
510
+ switch (n4.spec.type) {
511
+ case "sma":
512
+ r4 = `SMA(${n4.spec.period})`;
513
+ break;
514
+ case "ema":
515
+ r4 = `EMA(${n4.spec.period})`;
516
+ break;
517
+ case "wma":
518
+ r4 = `WMA(${n4.spec.period})`;
519
+ break;
520
+ }
521
+ if (r4 === "") continue;
522
+ t3.push({
523
+ id: `${r4}-${e3}`,
524
+ label: r4,
525
+ color: n4.color,
526
+ value: i(n4.values, d2.idx)
527
+ });
528
+ } else {
529
+ let r4 = n4.spec.period, a4 = n4.spec.multiplier;
530
+ t3.push({
531
+ id: `bb-upper-${e3}`,
532
+ label: `BB Upper(${r4}, ${a4})`,
533
+ color: n4.color,
534
+ value: i(n4.upper, d2.idx)
535
+ }), t3.push({
536
+ id: `bb-mid-${e3}`,
537
+ label: `BB Mid(${r4}, ${a4})`,
538
+ color: n4.color,
539
+ value: i(n4.middle, d2.idx)
540
+ }), t3.push({
541
+ id: `bb-lower-${e3}`,
542
+ label: `BB Lower(${r4}, ${a4})`,
543
+ color: n4.color,
544
+ value: i(n4.lower, d2.idx)
545
+ });
546
+ }
547
+ }
548
+ return t3;
549
+ }, [
550
+ d2,
551
+ c2,
552
+ e2.series,
553
+ y2
554
+ ]), F2 = d2 === null || c2 === null ? null : we(e2.tooltip, {
555
+ t: d2.t,
556
+ value: d2.value,
557
+ idx: d2.idx,
558
+ seriesValues: P2,
559
+ pointerX: d2.pointerX,
560
+ pointerY: d2.pointerY,
561
+ containerWidth: k2,
562
+ containerHeight: A2,
563
+ theme: c2.personalization.theme,
564
+ palette: c2.personalization.palette,
565
+ locale: c2.resolvedLocaleBase,
566
+ timeZone: c2.resolvedTimeZone,
567
+ formatter: c2.formatter
568
+ }), I2 = p2 === null || c2 === null ? null : Ce(e2.extremeTooltip, {
569
+ kind: p2.kind,
570
+ barIdx: p2.idx,
571
+ price: p2.price,
572
+ t: p2.t,
573
+ pointerX: p2.pointerX,
574
+ pointerY: p2.pointerY,
575
+ containerWidth: k2,
576
+ containerHeight: A2,
577
+ theme: c2.personalization.theme,
578
+ palette: c2.personalization.palette,
579
+ locale: c2.resolvedLocaleBase,
580
+ timeZone: c2.resolvedTimeZone,
581
+ formatter: c2.formatter
582
+ }), L2 = h2 !== "live", R2 = c2 !== null && L2 && (c2.personalization.staleVisualization === "desaturate-pulse" || c2.personalization.staleVisualization === "desaturate-pulse + banner"), z2 = c2 !== null && L2 && (c2.personalization.staleVisualization === "banner" || c2.personalization.staleVisualization === "desaturate-pulse + banner"), B2 = {
583
+ position: "absolute",
584
+ inset: 0,
585
+ width: "100%",
586
+ height: "100%"
587
+ }, V2 = R2 ? {
588
+ filter: "saturate(0.5)",
589
+ ..._2 ? { opacity: 0.9 } : { animation: "tickyr-stale-pulse 1.2s ease-in-out infinite" }
590
+ } : {}, H2 = {
591
+ ...B2,
592
+ ...V2
593
+ }, U2 = {
594
+ ...B2,
595
+ pointerEvents: "none",
596
+ ...V2
597
+ }, W2 = c2 === null ? null : c2.personalization.palette[c2.personalization.theme], G2 = W2 === null ? "" : M(W2.warn, 1), te2 = e2.chartBgColor ?? (c2?.personalization.theme === "dark" ? "#0c0d0e" : "#fafafa"), ne2 = h2 === "disconnected" ? "Connection lost" : "Live data paused", re2 = e2.staleBanner === false, ie2 = null;
598
+ if (z2 && !re2 && c2 !== null) if (typeof e2.staleBanner == "function") {
599
+ let t3 = e2.staleBanner({
600
+ state: h2,
601
+ liveSince: e2.liveSince,
602
+ theme: c2.personalization.theme,
603
+ palette: c2.personalization.palette
604
+ });
605
+ ie2 = /* @__PURE__ */ J("div", {
606
+ style: {
607
+ position: "absolute",
608
+ top: 8,
609
+ left: "50%",
610
+ transform: "translate(-50%, 0)",
611
+ pointerEvents: "none",
612
+ zIndex: 2,
613
+ ..._2 ? {} : { animation: "tickyr-stale-banner-in 0.3s ease-out" }
614
+ },
615
+ "aria-live": "polite",
616
+ children: t3
617
+ });
618
+ } else ie2 = /* @__PURE__ */ Y("div", {
619
+ style: {
620
+ position: "absolute",
621
+ top: 8,
622
+ left: "50%",
623
+ transform: "translate(-50%, 0)",
624
+ background: G2,
625
+ color: te2,
626
+ padding: "5px 12px",
627
+ borderRadius: 999,
628
+ fontSize: 11,
629
+ fontWeight: 600,
630
+ fontFamily: E,
631
+ letterSpacing: "0.02em",
632
+ whiteSpace: "nowrap",
633
+ pointerEvents: "none",
634
+ display: "inline-flex",
635
+ alignItems: "center",
636
+ gap: 6,
637
+ boxShadow: c2.personalization.theme === "dark" ? "0 2px 8px rgba(0,0,0,0.4)" : "0 2px 8px rgba(0,0,0,0.15)",
638
+ zIndex: 2,
639
+ ..._2 ? {} : { animation: "tickyr-stale-banner-in 0.3s ease-out" }
640
+ },
641
+ "aria-live": "polite",
642
+ children: [/* @__PURE__ */ J("span", {
643
+ "aria-hidden": "true",
644
+ style: {
645
+ fontSize: 12,
646
+ lineHeight: 1
647
+ },
648
+ children: "\u23F8"
649
+ }), /* @__PURE__ */ J("span", { children: ne2 })]
650
+ });
651
+ let X2 = typeof e2.connectionIndicator == "function" ? e2.connectionIndicator : void 0, Z2 = null;
652
+ if (c2 !== null) {
653
+ let t3 = c2.personalization, n3 = t3.connectionIndicator;
654
+ if (X2 !== void 0 || n3 !== "off") {
655
+ let r3 = t3.legendPosition, i2 = r3 === "top-left" || r3 === "bottom-left", a3 = {
656
+ position: "absolute",
657
+ pointerEvents: "none",
658
+ zIndex: 3,
659
+ ...r3 === "top-left" || r3 === "top-right" ? { top: 4 } : { bottom: 4 },
660
+ ...i2 ? { left: 4 } : { right: 4 }
661
+ };
662
+ if (X2 !== void 0) Z2 = /* @__PURE__ */ J("div", {
663
+ style: a3,
664
+ children: X2({
665
+ state: h2,
666
+ liveSince: e2.liveSince,
667
+ position: r3,
668
+ theme: t3.theme,
669
+ palette: t3.palette
670
+ })
671
+ });
672
+ else {
673
+ let e3 = t3.palette[t3.theme], r4 = M(h2 === "live" ? e3.up : h2 === "stale" ? e3.warn : e3.down, 1), i3 = t3.theme === "dark" ? "#0c0d0e" : "#fafafa", o3 = h2 === "live" ? "live" : h2 === "stale" ? "stale" : "offline", s3 = t3.visualStyle === "Outline", c3 = n3 === "dot";
674
+ Z2 = /* @__PURE__ */ Y("div", {
675
+ style: {
676
+ ...a3,
677
+ display: "inline-flex",
678
+ alignItems: "center",
679
+ gap: c3 ? 5 : 0,
680
+ padding: c3 ? "0 7px" : "0 10px",
681
+ height: c3 ? 18 : 22,
682
+ borderRadius: 999,
683
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
684
+ fontSize: 10,
685
+ fontWeight: 600,
686
+ ...s3 ? {
687
+ background: i3,
688
+ color: r4,
689
+ border: `${c3 ? 1 : 1.4}px solid ${r4}`
690
+ } : {
691
+ background: r4,
692
+ color: i3,
693
+ border: "none"
694
+ },
695
+ ...h2 !== "live" && !_2 ? { animation: "tickyr-stale-pulse 1s ease-in-out infinite" } : {}
696
+ },
697
+ "aria-live": "polite",
698
+ role: "status",
699
+ children: [c3 && /* @__PURE__ */ J("span", {
700
+ "aria-hidden": "true",
701
+ style: {
702
+ width: 6,
703
+ height: 6,
704
+ borderRadius: 999,
705
+ background: s3 ? r4 : i3
706
+ }
707
+ }), /* @__PURE__ */ J("span", { children: o3 })]
708
+ });
709
+ }
710
+ }
711
+ }
712
+ let Q2 = null;
713
+ if (c2 !== null && c2.personalization.legend !== "off") {
714
+ let t3 = c2.personalization, n3 = t3.palette[t3.theme], r3 = [];
715
+ if (e2.series !== void 0 && e2.series.length > 0) {
716
+ let t4 = e2.series[0], i2 = n3.categorical[0];
717
+ r3.push({
718
+ id: t4.id,
719
+ label: t4.label ?? t4.id,
720
+ color: t4.color ?? M(i2)
721
+ });
722
+ }
723
+ for (let t4 = 0; t4 < c2.secondarySeriesList.length; t4++) {
724
+ let n4 = c2.secondarySeriesList[t4], i2 = e2.series?.[t4 + 1];
725
+ r3.push({
726
+ id: i2?.id ?? `series-${t4 + 1}`,
727
+ label: i2?.label ?? i2?.id ?? `Series ${t4 + 2}`,
728
+ color: n4.color
729
+ });
730
+ }
731
+ for (let e3 = 0; e3 < y2.length; e3++) {
732
+ let t4 = y2[e3], n4;
733
+ switch (t4.spec.type) {
734
+ case "sma":
735
+ n4 = `SMA(${t4.spec.period})`;
736
+ break;
737
+ case "ema":
738
+ n4 = `EMA(${t4.spec.period})`;
739
+ break;
740
+ case "wma":
741
+ n4 = `WMA(${t4.spec.period})`;
742
+ break;
743
+ case "bollinger":
744
+ n4 = `BB(${t4.spec.period}, ${t4.spec.multiplier})`;
745
+ break;
746
+ }
747
+ r3.push({
748
+ id: `${t4.spec.type}-${e3}`,
749
+ label: n4,
750
+ color: t4.color
751
+ });
752
+ }
753
+ if (r3.length > 0) {
754
+ let e3 = t3.legendPosition === "top-left" || t3.legendPosition === "bottom-left", i2 = t3.legendPosition === "top-left" || t3.legendPosition === "top-right", a3 = t3.connectionIndicator !== "off" || X2 !== void 0, o3 = i2 && a3 ? 30 : 4, s3 = t3.legend !== "on-hover" || d2 !== null || p2 !== null, c3 = t3.theme === "dark" ? "rgba(20,21,23,0.78)" : "rgba(250,250,250,0.78)", l2 = M(n3.neutral, 0.92);
755
+ Q2 = /* @__PURE__ */ J("div", {
756
+ style: {
757
+ position: "absolute",
758
+ zIndex: 2,
759
+ pointerEvents: "none",
760
+ display: "flex",
761
+ flexWrap: "wrap",
762
+ alignItems: "center",
763
+ gap: 8,
764
+ padding: "5px 9px",
765
+ borderRadius: 6,
766
+ background: c3,
767
+ backdropFilter: "blur(2px)",
768
+ font: `500 11px/1.1 ${E}`,
769
+ letterSpacing: "0.01em",
770
+ color: l2,
771
+ transition: "opacity 0.15s ease-out",
772
+ opacity: +!!s3,
773
+ ...i2 ? { top: o3 } : { bottom: o3 },
774
+ ...e3 ? { left: 4 } : { right: 4 }
775
+ },
776
+ "aria-label": "Legend",
777
+ children: r3.map((e4) => /* @__PURE__ */ Y("span", {
778
+ style: {
779
+ display: "inline-flex",
780
+ alignItems: "center",
781
+ gap: 5
782
+ },
783
+ children: [/* @__PURE__ */ J("span", {
784
+ "aria-hidden": "true",
785
+ style: {
786
+ width: 10,
787
+ height: 10,
788
+ borderRadius: 2,
789
+ background: e4.color,
790
+ display: "inline-block",
791
+ flex: "0 0 auto"
792
+ }
793
+ }), /* @__PURE__ */ J("span", { children: e4.label })]
794
+ }, e4.id))
795
+ });
796
+ }
797
+ }
798
+ return j2 ? /* @__PURE__ */ J("canvas", {
799
+ ref: a2,
800
+ role: "img",
801
+ "aria-label": N2,
802
+ style: {
803
+ width: `${k2}px`,
804
+ height: `${A2}px`,
805
+ display: "block"
806
+ }
807
+ }) : /* @__PURE__ */ Y("div", {
808
+ ref: r2,
809
+ role: "img",
810
+ "aria-label": N2,
811
+ onPointerMove: T2,
812
+ onPointerLeave: D2,
813
+ onClick: O2,
814
+ style: {
815
+ position: "relative",
816
+ width: `${k2}px`,
817
+ height: `${A2}px`,
818
+ display: "block"
819
+ },
820
+ children: [
821
+ /* @__PURE__ */ J("canvas", {
822
+ ref: a2,
823
+ "aria-hidden": "true",
824
+ style: H2
825
+ }),
826
+ /* @__PURE__ */ J("canvas", {
827
+ ref: o2,
828
+ "aria-hidden": "true",
829
+ style: U2
830
+ }),
831
+ Z2,
832
+ ie2,
833
+ Q2,
834
+ F2,
835
+ I2
836
+ ]
837
+ });
838
+ }), Ee = "min", De = "flat", Oe = 0.6;
839
+ function ke(e2) {
840
+ let t2 = (0, Z.c)(36), n2, r2, i2, a2, o2, s2, c2;
841
+ t2[0] === e2 ? (n2 = t2[1], r2 = t2[2], i2 = t2[3], a2 = t2[4], o2 = t2[5], s2 = t2[6], c2 = t2[7]) : ({ baseline: a2, fillType: o2, fillOpacity: s2, thresholdFill: c2, stacked: i2, ariaLabel: n2, ...r2 } = e2, t2[0] = e2, t2[1] = n2, t2[2] = r2, t2[3] = i2, t2[4] = a2, t2[5] = o2, t2[6] = s2, t2[7] = c2);
842
+ let l2 = a2 === void 0 ? Ee : a2, u2 = o2 === void 0 ? De : o2, d2 = s2 === void 0 ? Oe : s2, f2 = i2 === true ? "additive" : i2 === "normalized" ? "normalized" : false, p2 = $(), m2 = e2.theme ?? p2.theme, h2 = e2.palette ?? p2.palette, g2 = e2.visualStyle ?? p2.visualStyle, _2;
843
+ t2[8] !== p2.appTheme || t2[9] !== p2.osTheme || t2[10] !== m2 || t2[11] !== h2 || t2[12] !== g2 ? (_2 = N({
844
+ theme: m2,
845
+ palette: h2,
846
+ osTheme: p2.osTheme,
847
+ appTheme: p2.appTheme,
848
+ visualStyle: g2
849
+ }), t2[8] = p2.appTheme, t2[9] = p2.osTheme, t2[10] = m2, t2[11] = h2, t2[12] = g2, t2[13] = _2) : _2 = t2[13];
850
+ let v2 = _2, y2 = v2.palette[v2.theme], b2;
851
+ bb0: {
852
+ if (c2 === false || c2 === void 0) {
853
+ b2 = void 0;
854
+ break bb0;
855
+ }
856
+ let e3;
857
+ t2[14] === c2 ? e3 = t2[15] : (e3 = c2 === true ? {} : c2, t2[14] = c2, t2[15] = e3);
858
+ let n3 = e3, r3;
859
+ t2[16] !== n3.aboveColor || t2[17] !== y2 ? (r3 = n3.aboveColor ?? M(y2.up), t2[16] = n3.aboveColor, t2[17] = y2, t2[18] = r3) : r3 = t2[18];
860
+ let i3 = r3, a3;
861
+ t2[19] !== n3.belowColor || t2[20] !== y2 ? (a3 = n3.belowColor ?? M(y2.down), t2[19] = n3.belowColor, t2[20] = y2, t2[21] = a3) : a3 = t2[21];
862
+ let o3 = a3, s3;
863
+ t2[22] !== i3 || t2[23] !== o3 || t2[24] !== n3.value ? (s3 = {
864
+ value: n3.value,
865
+ aboveColor: i3,
866
+ belowColor: o3
867
+ }, t2[22] = i3, t2[23] = o3, t2[24] = n3.value, t2[25] = s3) : s3 = t2[25], b2 = s3;
868
+ }
869
+ let x2 = b2, S2;
870
+ t2[26] !== l2 || t2[27] !== d2 || t2[28] !== u2 || t2[29] !== f2 || t2[30] !== x2 ? (S2 = {
871
+ baseline: l2,
872
+ fillType: u2,
873
+ fillOpacity: d2
874
+ }, x2 !== void 0 && (S2.threshold = x2), f2 !== false && (S2.stacked = f2), t2[26] = l2, t2[27] = d2, t2[28] = u2, t2[29] = f2, t2[30] = x2, t2[31] = S2) : S2 = t2[31];
875
+ let C2 = S2, w2 = n2 ?? "Area chart", T2;
876
+ return t2[32] !== C2 || t2[33] !== r2 || t2[34] !== w2 ? (T2 = /* @__PURE__ */ J(Te, {
877
+ ...r2,
878
+ ariaLabel: w2,
879
+ areaFill: C2
880
+ }), t2[32] = C2, t2[33] = r2, t2[34] = w2, t2[35] = T2) : T2 = t2[35], T2;
881
+ }
882
+ function Ae(e2) {
883
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), a2 = q.useRef(null), o2 = q.useRef(null), [s2, c2] = q.useState(null), [l2, u2] = q.useState(null), d2 = q.useMemo(() => ({
884
+ theme: t2.theme,
885
+ palette: t2.palette,
886
+ locale: t2.locale,
887
+ timeZone: t2.timeZone,
888
+ visualStyle: t2.visualStyle,
889
+ outlineFillColor: t2.outlineFillColor,
890
+ outlineFillOpacity: t2.outlineFillOpacity,
891
+ cornerRadius: t2.cornerRadius,
892
+ borderWidth: t2.borderWidth,
893
+ accents: t2.accents,
894
+ osTheme: t2.osTheme,
895
+ appTheme: t2.appTheme
896
+ }), [
897
+ t2.theme,
898
+ t2.palette,
899
+ t2.locale,
900
+ t2.timeZone,
901
+ t2.visualStyle,
902
+ t2.outlineFillColor,
903
+ t2.outlineFillOpacity,
904
+ t2.cornerRadius,
905
+ t2.borderWidth,
906
+ t2.accents,
907
+ t2.osTheme,
908
+ t2.appTheme
909
+ ]);
910
+ q.useEffect(() => {
911
+ let t3 = r2.current;
912
+ if (t3 === null) return;
913
+ let i2 = new T({
914
+ container: n2.current,
915
+ staticCanvas: t3,
916
+ dynamicCanvas: a2.current,
917
+ initialProps: e2,
918
+ initialProvider: d2,
919
+ onContextChange: c2,
920
+ onHoverChange: u2
921
+ });
922
+ return o2.current = i2, () => {
923
+ o2.current = null, i2.dispose();
924
+ };
925
+ }, []), q.useEffect(() => {
926
+ o2.current?.update(e2, d2);
927
+ });
928
+ let f2 = q.useCallback((e3) => {
929
+ o2.current?.handlePointerMove(e3.nativeEvent);
930
+ }, []), p2 = q.useCallback(() => {
931
+ o2.current?.handlePointerLeave();
932
+ }, []), m2 = e2.width ?? 800, h2 = e2.height ?? 300, g2 = e2.sparkline === true || e2.sparkline !== false && m2 < 150, _2 = e2.ariaLabel ?? s2?.ariaLabel ?? "Bar chart", v2 = q.useMemo(() => {
933
+ if (l2 === null || s2 === null) return [];
934
+ let t3 = [], { personalization: n3, secondarySeriesList: r3, primaryColor: a3 } = s2, o3 = n3.palette[n3.theme], c3 = a3 ?? M(l2.value >= 0 ? o3.up : o3.down, 1);
935
+ t3.push({
936
+ id: e2.series?.[0]?.id ?? "primary",
937
+ label: e2.series?.[0]?.label ?? e2.series?.[0]?.id ?? "Value",
938
+ color: c3,
939
+ value: l2.value
940
+ });
941
+ for (let n4 = 0; n4 < r3.length; n4++) {
942
+ let a4 = r3[n4], o4 = e2.series?.[n4 + 1], s3 = a4.ingested.length > 0 ? K(a4.ingested.times, l2.t) : -1, c4 = s3 >= 0 ? i(a4.ingested.values, s3) : NaN;
943
+ t3.push({
944
+ id: o4?.id ?? `series-${n4 + 1}`,
945
+ label: o4?.label ?? o4?.id ?? `Series ${n4 + 2}`,
946
+ color: a4.color,
947
+ value: c4
948
+ });
949
+ }
950
+ return t3;
951
+ }, [
952
+ l2,
953
+ s2,
954
+ e2.series
955
+ ]), y2 = l2 === null || s2 === null ? null : (() => {
956
+ let t3 = {
957
+ t: l2.t,
958
+ idx: l2.idx,
959
+ seriesValues: v2,
960
+ pointerX: l2.pointerX,
961
+ pointerY: l2.pointerY,
962
+ containerWidth: m2,
963
+ containerHeight: h2,
964
+ theme: s2.personalization.theme,
965
+ palette: s2.personalization.palette,
966
+ locale: s2.resolvedLocaleBase,
967
+ timeZone: s2.resolvedTimeZone,
968
+ formatter: s2.formatter
969
+ };
970
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : /* @__PURE__ */ J(ye, {
971
+ t: l2.t,
972
+ value: l2.value,
973
+ idx: l2.idx,
974
+ seriesValues: v2,
975
+ pointerX: l2.pointerX,
976
+ pointerY: l2.pointerY,
977
+ containerWidth: m2,
978
+ containerHeight: h2,
979
+ theme: s2.personalization.theme,
980
+ palette: s2.personalization.palette,
981
+ locale: s2.resolvedLocaleBase,
982
+ timeZone: s2.resolvedTimeZone,
983
+ formatter: s2.formatter
984
+ });
985
+ })(), b2 = q.useMemo(() => {
986
+ if (s2 === null || e2.series === void 0 || e2.series.length < 2) return [];
987
+ let t3 = s2.personalization.palette[s2.personalization.theme], n3 = [], r3 = e2.series[0], i2 = s2.primaryColor ?? M(t3.up, 1);
988
+ n3.push({
989
+ color: i2,
990
+ label: r3.label ?? r3.id
991
+ });
992
+ for (let t4 = 0; t4 < s2.secondarySeriesList.length; t4++) {
993
+ let r4 = s2.secondarySeriesList[t4], i3 = e2.series[t4 + 1];
994
+ n3.push({
995
+ color: r4.color,
996
+ label: i3.label ?? i3.id
997
+ });
998
+ }
999
+ return n3;
1000
+ }, [s2, e2.series]), x2 = null;
1001
+ if (s2 !== null && b2.length > 0) {
1002
+ let e3 = s2.personalization, t3 = e3.legend, n3 = e3.legendPosition;
1003
+ t3 !== "off" && (t3 === "always" || t3 === "on-hover" && l2 !== null) && (x2 = /* @__PURE__ */ J("div", {
1004
+ style: {
1005
+ position: "absolute",
1006
+ ...n3 === "top-left" || n3 === "top-right" ? { top: 6 } : { bottom: 6 },
1007
+ ...n3 === "top-left" || n3 === "bottom-left" ? { left: 8 } : { right: 8 },
1008
+ pointerEvents: "none",
1009
+ display: "flex",
1010
+ gap: 12,
1011
+ alignItems: "center",
1012
+ padding: "4px 8px",
1013
+ background: e3.theme === "dark" ? "rgba(34,36,42,0.85)" : "rgba(255,255,255,0.85)",
1014
+ border: `1px solid ${e3.theme === "dark" ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)"}`,
1015
+ borderRadius: 6,
1016
+ fontSize: 11,
1017
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
1018
+ color: e3.theme === "dark" ? "rgb(240,242,246)" : "rgb(20,22,26)"
1019
+ },
1020
+ role: "presentation",
1021
+ children: b2.map((e4, t4) => /* @__PURE__ */ Y("span", {
1022
+ style: {
1023
+ display: "inline-flex",
1024
+ alignItems: "center",
1025
+ gap: 5
1026
+ },
1027
+ children: [/* @__PURE__ */ J("span", {
1028
+ "aria-hidden": "true",
1029
+ style: {
1030
+ width: 10,
1031
+ height: 10,
1032
+ borderRadius: 2,
1033
+ background: e4.color,
1034
+ display: "inline-block",
1035
+ flex: "0 0 auto"
1036
+ }
1037
+ }), /* @__PURE__ */ J("span", { children: e4.label })]
1038
+ }, t4))
1039
+ }));
1040
+ }
1041
+ return g2 ? /* @__PURE__ */ J("div", {
1042
+ ref: n2,
1043
+ style: {
1044
+ position: "relative",
1045
+ width: m2,
1046
+ height: h2
1047
+ },
1048
+ "aria-label": _2,
1049
+ children: /* @__PURE__ */ J("canvas", {
1050
+ ref: r2,
1051
+ style: {
1052
+ display: "block",
1053
+ width: m2,
1054
+ height: h2
1055
+ },
1056
+ "aria-hidden": "true"
1057
+ })
1058
+ }) : /* @__PURE__ */ Y("div", {
1059
+ ref: n2,
1060
+ style: {
1061
+ position: "relative",
1062
+ width: m2,
1063
+ height: h2
1064
+ },
1065
+ "aria-label": _2,
1066
+ onPointerMove: f2,
1067
+ onPointerLeave: p2,
1068
+ children: [
1069
+ /* @__PURE__ */ J("canvas", {
1070
+ ref: r2,
1071
+ style: {
1072
+ display: "block",
1073
+ width: m2,
1074
+ height: h2
1075
+ },
1076
+ "aria-hidden": "true"
1077
+ }),
1078
+ /* @__PURE__ */ J("canvas", {
1079
+ ref: a2,
1080
+ style: {
1081
+ display: "block",
1082
+ width: m2,
1083
+ height: h2,
1084
+ position: "absolute",
1085
+ inset: 0,
1086
+ pointerEvents: "none"
1087
+ },
1088
+ "aria-hidden": "true"
1089
+ }),
1090
+ x2,
1091
+ y2
1092
+ ]
1093
+ });
1094
+ }
1095
+ var je = 12, Me = 180, Ne = 124;
1096
+ function Pe(e2, t2) {
1097
+ return e2 === "light" ? {
1098
+ bg: "rgb(255, 255, 255)",
1099
+ fg: "rgb(20, 22, 26)",
1100
+ subtleFg: "rgba(20, 22, 26, 0.56)",
1101
+ border: "rgba(15, 18, 23, 0.08)",
1102
+ shadow: "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)",
1103
+ upFg: "rgb(20, 22, 26)",
1104
+ downFg: "rgb(20, 22, 26)"
1105
+ } : {
1106
+ bg: "rgb(34, 36, 42)",
1107
+ fg: "rgb(240, 242, 246)",
1108
+ subtleFg: "rgba(240, 242, 246, 0.62)",
1109
+ border: "rgba(255, 255, 255, 0.08)",
1110
+ shadow: "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)",
1111
+ upFg: "rgb(240, 242, 246)",
1112
+ downFg: "rgb(240, 242, 246)"
1113
+ };
1114
+ }
1115
+ function Fe(e2) {
1116
+ let t2 = (0, Z.c)(125), { t: n2, o: r2, h: i2, l: a2, c: o2, direction: s2, pointerX: c2, pointerY: l2, containerWidth: u2, containerHeight: d2, theme: f2, palette: p2, formatter: m2 } = e2, h2;
1117
+ t2[0] !== p2 || t2[1] !== f2 ? (h2 = Pe(f2, p2), t2[0] = p2, t2[1] = f2, t2[2] = h2) : h2 = t2[2];
1118
+ let g2 = h2, _2 = c2 > u2 - Me, v2 = l2 > d2 - Ne, y2;
1119
+ t2[3] !== d2 || t2[4] !== u2 || t2[5] !== c2 || t2[6] !== l2 || t2[7] !== v2 || t2[8] !== _2 ? (y2 = _2 ? { right: `${u2 - c2 + je}px` } : { left: `${c2 + je}px` }, v2 ? y2.bottom = `${d2 - l2 + je}px` : y2.top = `${l2 + je}px`, t2[3] = d2, t2[4] = u2, t2[5] = c2, t2[6] = l2, t2[7] = v2, t2[8] = _2, t2[9] = y2) : y2 = t2[9];
1120
+ let b2 = o2 - r2, x2, S2, C2, w2, T2, E2, D2, O2, k2, A2, j2, M2;
1121
+ if (t2[10] !== o2 || t2[11] !== b2 || t2[12] !== g2.bg || t2[13] !== g2.border || t2[14] !== g2.downFg || t2[15] !== g2.fg || t2[16] !== g2.shadow || t2[17] !== g2.subtleFg || t2[18] !== g2.upFg || t2[19] !== s2 || t2[20] !== m2 || t2[21] !== i2 || t2[22] !== a2 || t2[23] !== r2 || t2[24] !== y2 || t2[25] !== n2) {
1122
+ let e3 = Math.abs(b2);
1123
+ x2 = r2 === 0 ? 0 : b2 / r2 * 100;
1124
+ let c3 = s2 === "up" ? g2.upFg : s2 === "down" ? g2.downFg : g2.subtleFg;
1125
+ S2 = b2 > 0 ? "+" : b2 < 0 ? "\u2212" : "";
1126
+ let l3 = `1px solid ${g2.border}`;
1127
+ t2[38] !== g2.bg || t2[39] !== g2.fg || t2[40] !== g2.shadow || t2[41] !== y2 || t2[42] !== l3 ? (k2 = {
1128
+ position: "absolute",
1129
+ ...y2,
1130
+ pointerEvents: "none",
1131
+ background: g2.bg,
1132
+ color: g2.fg,
1133
+ padding: "8px 11px",
1134
+ borderRadius: 6,
1135
+ border: l3,
1136
+ fontSize: 12,
1137
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
1138
+ lineHeight: 1.35,
1139
+ whiteSpace: "nowrap",
1140
+ boxShadow: g2.shadow,
1141
+ zIndex: 1,
1142
+ minWidth: 160
1143
+ }, t2[38] = g2.bg, t2[39] = g2.fg, t2[40] = g2.shadow, t2[41] = y2, t2[42] = l3, t2[43] = k2) : k2 = t2[43], A2 = "status", j2 = "polite";
1144
+ let u3;
1145
+ t2[44] === g2.subtleFg ? u3 = t2[45] : (u3 = {
1146
+ color: g2.subtleFg,
1147
+ fontSize: 10.5,
1148
+ letterSpacing: "0.02em",
1149
+ textTransform: "uppercase",
1150
+ fontWeight: 500,
1151
+ marginBottom: 4
1152
+ }, t2[44] = g2.subtleFg, t2[45] = u3);
1153
+ let d3;
1154
+ t2[46] !== m2 || t2[47] !== n2 ? (d3 = m2.formatDate(n2), t2[46] = m2, t2[47] = n2, t2[48] = d3) : d3 = t2[48];
1155
+ let f3;
1156
+ t2[49] !== m2 || t2[50] !== n2 ? (f3 = m2.formatTime(n2), t2[49] = m2, t2[50] = n2, t2[51] = f3) : f3 = t2[51], t2[52] !== u3 || t2[53] !== d3 || t2[54] !== f3 ? (M2 = /* @__PURE__ */ Y("div", {
1157
+ style: u3,
1158
+ children: [
1159
+ d3,
1160
+ " ",
1161
+ f3
1162
+ ]
1163
+ }), t2[52] = u3, t2[53] = d3, t2[54] = f3, t2[55] = M2) : M2 = t2[55];
1164
+ let p3;
1165
+ t2[56] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p3 = {
1166
+ display: "grid",
1167
+ gridTemplateColumns: "auto 1fr",
1168
+ columnGap: 12,
1169
+ rowGap: 2,
1170
+ fontVariantNumeric: "tabular-nums"
1171
+ }, t2[56] = p3) : p3 = t2[56];
1172
+ let h3;
1173
+ t2[57] === g2.subtleFg ? h3 = t2[58] : (h3 = /* @__PURE__ */ J("span", {
1174
+ style: {
1175
+ color: g2.subtleFg,
1176
+ fontWeight: 500
1177
+ },
1178
+ children: "O"
1179
+ }), t2[57] = g2.subtleFg, t2[58] = h3);
1180
+ let _3;
1181
+ t2[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_3 = {
1182
+ textAlign: "right",
1183
+ fontWeight: 600
1184
+ }, t2[59] = _3) : _3 = t2[59];
1185
+ let v3;
1186
+ t2[60] !== m2 || t2[61] !== r2 ? (v3 = m2.formatPrice(r2), t2[60] = m2, t2[61] = r2, t2[62] = v3) : v3 = t2[62];
1187
+ let N3;
1188
+ t2[63] === v3 ? N3 = t2[64] : (N3 = /* @__PURE__ */ J("span", {
1189
+ style: _3,
1190
+ children: v3
1191
+ }), t2[63] = v3, t2[64] = N3);
1192
+ let P3;
1193
+ t2[65] === g2.subtleFg ? P3 = t2[66] : (P3 = /* @__PURE__ */ J("span", {
1194
+ style: {
1195
+ color: g2.subtleFg,
1196
+ fontWeight: 500
1197
+ },
1198
+ children: "H"
1199
+ }), t2[65] = g2.subtleFg, t2[66] = P3);
1200
+ let F3;
1201
+ t2[67] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F3 = {
1202
+ textAlign: "right",
1203
+ fontWeight: 600
1204
+ }, t2[67] = F3) : F3 = t2[67];
1205
+ let I3;
1206
+ t2[68] !== m2 || t2[69] !== i2 ? (I3 = m2.formatPrice(i2), t2[68] = m2, t2[69] = i2, t2[70] = I3) : I3 = t2[70];
1207
+ let L2;
1208
+ t2[71] === I3 ? L2 = t2[72] : (L2 = /* @__PURE__ */ J("span", {
1209
+ style: F3,
1210
+ children: I3
1211
+ }), t2[71] = I3, t2[72] = L2);
1212
+ let R2;
1213
+ t2[73] === g2.subtleFg ? R2 = t2[74] : (R2 = /* @__PURE__ */ J("span", {
1214
+ style: {
1215
+ color: g2.subtleFg,
1216
+ fontWeight: 500
1217
+ },
1218
+ children: "L"
1219
+ }), t2[73] = g2.subtleFg, t2[74] = R2);
1220
+ let z2;
1221
+ t2[75] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z2 = {
1222
+ textAlign: "right",
1223
+ fontWeight: 600
1224
+ }, t2[75] = z2) : z2 = t2[75];
1225
+ let B2;
1226
+ t2[76] !== m2 || t2[77] !== a2 ? (B2 = m2.formatPrice(a2), t2[76] = m2, t2[77] = a2, t2[78] = B2) : B2 = t2[78];
1227
+ let V2;
1228
+ t2[79] === B2 ? V2 = t2[80] : (V2 = /* @__PURE__ */ J("span", {
1229
+ style: z2,
1230
+ children: B2
1231
+ }), t2[79] = B2, t2[80] = V2);
1232
+ let H2;
1233
+ t2[81] === g2.subtleFg ? H2 = t2[82] : (H2 = /* @__PURE__ */ J("span", {
1234
+ style: {
1235
+ color: g2.subtleFg,
1236
+ fontWeight: 500
1237
+ },
1238
+ children: "C"
1239
+ }), t2[81] = g2.subtleFg, t2[82] = H2);
1240
+ let U2;
1241
+ t2[83] === c3 ? U2 = t2[84] : (U2 = {
1242
+ textAlign: "right",
1243
+ fontWeight: 600,
1244
+ color: c3
1245
+ }, t2[83] = c3, t2[84] = U2);
1246
+ let W2;
1247
+ t2[85] !== o2 || t2[86] !== m2 ? (W2 = m2.formatPrice(o2), t2[85] = o2, t2[86] = m2, t2[87] = W2) : W2 = t2[87];
1248
+ let G2;
1249
+ t2[88] !== U2 || t2[89] !== W2 ? (G2 = /* @__PURE__ */ J("span", {
1250
+ style: U2,
1251
+ children: W2
1252
+ }), t2[88] = U2, t2[89] = W2, t2[90] = G2) : G2 = t2[90], t2[91] !== h3 || t2[92] !== N3 || t2[93] !== P3 || t2[94] !== L2 || t2[95] !== R2 || t2[96] !== V2 || t2[97] !== H2 || t2[98] !== G2 ? (w2 = /* @__PURE__ */ Y("div", {
1253
+ style: p3,
1254
+ children: [
1255
+ h3,
1256
+ N3,
1257
+ P3,
1258
+ L2,
1259
+ R2,
1260
+ V2,
1261
+ H2,
1262
+ G2
1263
+ ]
1264
+ }), t2[91] = h3, t2[92] = N3, t2[93] = P3, t2[94] = L2, t2[95] = R2, t2[96] = V2, t2[97] = H2, t2[98] = G2, t2[99] = w2) : w2 = t2[99];
1265
+ let K2 = `1px solid ${g2.border}`;
1266
+ t2[100] !== g2.subtleFg || t2[101] !== K2 ? (D2 = {
1267
+ marginTop: 4,
1268
+ paddingTop: 4,
1269
+ borderTop: K2,
1270
+ color: g2.subtleFg,
1271
+ fontWeight: 500,
1272
+ display: "flex",
1273
+ justifyContent: "space-between",
1274
+ gap: 12,
1275
+ fontVariantNumeric: "tabular-nums"
1276
+ }, t2[100] = g2.subtleFg, t2[101] = K2, t2[102] = D2) : D2 = t2[102], t2[103] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O2 = /* @__PURE__ */ J("span", { children: "\u0394" }), t2[103] = O2) : O2 = t2[103], t2[104] === c3 ? C2 = t2[105] : (C2 = {
1277
+ color: c3,
1278
+ fontWeight: 600
1279
+ }, t2[104] = c3, t2[105] = C2), T2 = S2, E2 = m2.formatPrice(e3), t2[10] = o2, t2[11] = b2, t2[12] = g2.bg, t2[13] = g2.border, t2[14] = g2.downFg, t2[15] = g2.fg, t2[16] = g2.shadow, t2[17] = g2.subtleFg, t2[18] = g2.upFg, t2[19] = s2, t2[20] = m2, t2[21] = i2, t2[22] = a2, t2[23] = r2, t2[24] = y2, t2[25] = n2, t2[26] = x2, t2[27] = S2, t2[28] = C2, t2[29] = w2, t2[30] = T2, t2[31] = E2, t2[32] = D2, t2[33] = O2, t2[34] = k2, t2[35] = A2, t2[36] = j2, t2[37] = M2;
1280
+ } else x2 = t2[26], S2 = t2[27], C2 = t2[28], w2 = t2[29], T2 = t2[30], E2 = t2[31], D2 = t2[32], O2 = t2[33], k2 = t2[34], A2 = t2[35], j2 = t2[36], M2 = t2[37];
1281
+ let N2;
1282
+ t2[106] === x2 ? N2 = t2[107] : (N2 = Math.abs(x2).toFixed(2), t2[106] = x2, t2[107] = N2);
1283
+ let P2;
1284
+ t2[108] !== S2 || t2[109] !== C2 || t2[110] !== N2 || t2[111] !== T2 || t2[112] !== E2 ? (P2 = /* @__PURE__ */ Y("span", {
1285
+ style: C2,
1286
+ children: [
1287
+ T2,
1288
+ E2,
1289
+ " (",
1290
+ S2,
1291
+ N2,
1292
+ "%)"
1293
+ ]
1294
+ }), t2[108] = S2, t2[109] = C2, t2[110] = N2, t2[111] = T2, t2[112] = E2, t2[113] = P2) : P2 = t2[113];
1295
+ let F2;
1296
+ t2[114] !== P2 || t2[115] !== D2 || t2[116] !== O2 ? (F2 = /* @__PURE__ */ Y("div", {
1297
+ style: D2,
1298
+ children: [O2, P2]
1299
+ }), t2[114] = P2, t2[115] = D2, t2[116] = O2, t2[117] = F2) : F2 = t2[117];
1300
+ let I2;
1301
+ return t2[118] !== w2 || t2[119] !== F2 || t2[120] !== k2 || t2[121] !== A2 || t2[122] !== j2 || t2[123] !== M2 ? (I2 = /* @__PURE__ */ Y("div", {
1302
+ style: k2,
1303
+ role: A2,
1304
+ "aria-live": j2,
1305
+ children: [
1306
+ M2,
1307
+ w2,
1308
+ F2
1309
+ ]
1310
+ }), t2[118] = w2, t2[119] = F2, t2[120] = k2, t2[121] = A2, t2[122] = j2, t2[123] = M2, t2[124] = I2) : I2 = t2[124], I2;
1311
+ }
1312
+ var Ie = 12, Le = 180, Re = 96;
1313
+ function ze(e2) {
1314
+ return e2 === "light" ? {
1315
+ bg: "rgb(255, 255, 255)",
1316
+ fg: "rgb(20, 22, 26)",
1317
+ subtleFg: "rgba(20, 22, 26, 0.56)",
1318
+ border: "rgba(15, 18, 23, 0.08)",
1319
+ shadow: "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)"
1320
+ } : {
1321
+ bg: "rgb(34, 36, 42)",
1322
+ fg: "rgb(240, 242, 246)",
1323
+ subtleFg: "rgba(240, 242, 246, 0.62)",
1324
+ border: "rgba(255, 255, 255, 0.08)",
1325
+ shadow: "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)"
1326
+ };
1327
+ }
1328
+ function Be(e2) {
1329
+ let t2 = (0, Z.c)(72), { bar: n2, avg20: r2, percentile: i2, pointerX: a2, pointerY: o2, containerWidth: s2, containerHeight: c2, theme: l2, formatter: u2 } = e2, d2;
1330
+ t2[0] === l2 ? d2 = t2[1] : (d2 = ze(l2), t2[0] = l2, t2[1] = d2);
1331
+ let f2 = d2, p2 = a2 > s2 - Le, m2 = o2 > c2 - Re, h2;
1332
+ t2[2] !== c2 || t2[3] !== s2 || t2[4] !== a2 || t2[5] !== o2 || t2[6] !== m2 || t2[7] !== p2 ? (h2 = p2 ? { right: `${s2 - a2 + Ie}px` } : { left: `${a2 + Ie}px` }, m2 ? h2.bottom = `${c2 - o2 + Ie}px` : h2.top = `${o2 + Ie}px`, t2[2] = c2, t2[3] = s2, t2[4] = a2, t2[5] = o2, t2[6] = m2, t2[7] = p2, t2[8] = h2) : h2 = t2[8];
1333
+ let g2 = r2 > 0 ? n2.v / r2 : 1, _2 = (g2 - 1) * 100, v2;
1334
+ t2[9] === _2 ? v2 = t2[10] : (v2 = _2.toFixed(0), t2[9] = _2, t2[10] = v2);
1335
+ let y2 = v2, b2 = g2 > 1 ? "+" : g2 < 1 ? "\u2212" : "", x2;
1336
+ t2[11] === y2 ? x2 = t2[12] : (x2 = Math.abs(Number(y2)), t2[11] = y2, t2[12] = x2);
1337
+ let S2 = x2, C2 = `1px solid ${f2.border}`, w2;
1338
+ t2[13] !== f2.bg || t2[14] !== f2.fg || t2[15] !== f2.shadow || t2[16] !== h2 || t2[17] !== C2 ? (w2 = {
1339
+ position: "absolute",
1340
+ ...h2,
1341
+ pointerEvents: "none",
1342
+ background: f2.bg,
1343
+ color: f2.fg,
1344
+ padding: "8px 11px",
1345
+ borderRadius: 6,
1346
+ border: C2,
1347
+ fontSize: 12,
1348
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
1349
+ lineHeight: 1.35,
1350
+ whiteSpace: "nowrap",
1351
+ boxShadow: f2.shadow,
1352
+ zIndex: 1,
1353
+ minWidth: 160
1354
+ }, t2[13] = f2.bg, t2[14] = f2.fg, t2[15] = f2.shadow, t2[16] = h2, t2[17] = C2, t2[18] = w2) : w2 = t2[18];
1355
+ let T2;
1356
+ t2[19] === f2.subtleFg ? T2 = t2[20] : (T2 = {
1357
+ color: f2.subtleFg,
1358
+ fontSize: 10.5,
1359
+ letterSpacing: "0.02em",
1360
+ textTransform: "uppercase",
1361
+ fontWeight: 500,
1362
+ marginBottom: 4
1363
+ }, t2[19] = f2.subtleFg, t2[20] = T2);
1364
+ let E2;
1365
+ t2[21] !== n2.t || t2[22] !== u2 ? (E2 = u2.formatDate(n2.t), t2[21] = n2.t, t2[22] = u2, t2[23] = E2) : E2 = t2[23];
1366
+ let D2;
1367
+ t2[24] !== n2.t || t2[25] !== u2 ? (D2 = u2.formatTime(n2.t), t2[24] = n2.t, t2[25] = u2, t2[26] = D2) : D2 = t2[26];
1368
+ let O2;
1369
+ t2[27] !== T2 || t2[28] !== E2 || t2[29] !== D2 ? (O2 = /* @__PURE__ */ Y("div", {
1370
+ style: T2,
1371
+ children: [
1372
+ E2,
1373
+ " ",
1374
+ D2
1375
+ ]
1376
+ }), t2[27] = T2, t2[28] = E2, t2[29] = D2, t2[30] = O2) : O2 = t2[30];
1377
+ let k2;
1378
+ t2[31] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k2 = {
1379
+ display: "grid",
1380
+ gridTemplateColumns: "auto 1fr",
1381
+ columnGap: 12,
1382
+ rowGap: 2,
1383
+ fontVariantNumeric: "tabular-nums"
1384
+ }, t2[31] = k2) : k2 = t2[31];
1385
+ let A2;
1386
+ t2[32] === f2.subtleFg ? A2 = t2[33] : (A2 = /* @__PURE__ */ J("span", {
1387
+ style: {
1388
+ color: f2.subtleFg,
1389
+ fontWeight: 500
1390
+ },
1391
+ children: "Volume"
1392
+ }), t2[32] = f2.subtleFg, t2[33] = A2);
1393
+ let j2;
1394
+ t2[34] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j2 = {
1395
+ textAlign: "right",
1396
+ fontWeight: 600
1397
+ }, t2[34] = j2) : j2 = t2[34];
1398
+ let M2;
1399
+ t2[35] !== n2.v || t2[36] !== u2 ? (M2 = u2.formatNumber(n2.v), t2[35] = n2.v, t2[36] = u2, t2[37] = M2) : M2 = t2[37];
1400
+ let N2;
1401
+ t2[38] === M2 ? N2 = t2[39] : (N2 = /* @__PURE__ */ J("span", {
1402
+ style: j2,
1403
+ children: M2
1404
+ }), t2[38] = M2, t2[39] = N2);
1405
+ let P2;
1406
+ t2[40] === f2.subtleFg ? P2 = t2[41] : (P2 = /* @__PURE__ */ J("span", {
1407
+ style: {
1408
+ color: f2.subtleFg,
1409
+ fontWeight: 500
1410
+ },
1411
+ children: "20-bar avg"
1412
+ }), t2[40] = f2.subtleFg, t2[41] = P2);
1413
+ let F2;
1414
+ t2[42] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F2 = {
1415
+ textAlign: "right",
1416
+ fontWeight: 600
1417
+ }, t2[42] = F2) : F2 = t2[42];
1418
+ let I2;
1419
+ t2[43] !== r2 || t2[44] !== u2 ? (I2 = u2.formatNumber(r2), t2[43] = r2, t2[44] = u2, t2[45] = I2) : I2 = t2[45];
1420
+ let L2;
1421
+ t2[46] === I2 ? L2 = t2[47] : (L2 = /* @__PURE__ */ J("span", {
1422
+ style: F2,
1423
+ children: I2
1424
+ }), t2[46] = I2, t2[47] = L2);
1425
+ let R2;
1426
+ t2[48] !== A2 || t2[49] !== N2 || t2[50] !== P2 || t2[51] !== L2 ? (R2 = /* @__PURE__ */ Y("div", {
1427
+ style: k2,
1428
+ children: [
1429
+ A2,
1430
+ N2,
1431
+ P2,
1432
+ L2
1433
+ ]
1434
+ }), t2[48] = A2, t2[49] = N2, t2[50] = P2, t2[51] = L2, t2[52] = R2) : R2 = t2[52];
1435
+ let z2 = `1px solid ${f2.border}`, B2;
1436
+ t2[53] !== f2.subtleFg || t2[54] !== z2 ? (B2 = {
1437
+ marginTop: 4,
1438
+ paddingTop: 4,
1439
+ borderTop: z2,
1440
+ color: f2.subtleFg,
1441
+ fontWeight: 500,
1442
+ display: "flex",
1443
+ justifyContent: "space-between",
1444
+ gap: 12,
1445
+ fontVariantNumeric: "tabular-nums"
1446
+ }, t2[53] = f2.subtleFg, t2[54] = z2, t2[55] = B2) : B2 = t2[55];
1447
+ let V2, H2;
1448
+ t2[56] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V2 = /* @__PURE__ */ J("span", { children: "vs. avg" }), H2 = { fontWeight: 600 }, t2[56] = V2, t2[57] = H2) : (V2 = t2[56], H2 = t2[57]);
1449
+ let U2;
1450
+ t2[58] === i2 ? U2 = t2[59] : (U2 = Math.round(i2 * 100), t2[58] = i2, t2[59] = U2);
1451
+ let W2;
1452
+ t2[60] !== S2 || t2[61] !== b2 || t2[62] !== U2 ? (W2 = /* @__PURE__ */ Y("span", {
1453
+ style: H2,
1454
+ children: [
1455
+ b2,
1456
+ S2,
1457
+ "% \xB7 p",
1458
+ U2
1459
+ ]
1460
+ }), t2[60] = S2, t2[61] = b2, t2[62] = U2, t2[63] = W2) : W2 = t2[63];
1461
+ let G2;
1462
+ t2[64] !== B2 || t2[65] !== W2 ? (G2 = /* @__PURE__ */ Y("div", {
1463
+ style: B2,
1464
+ children: [V2, W2]
1465
+ }), t2[64] = B2, t2[65] = W2, t2[66] = G2) : G2 = t2[66];
1466
+ let K2;
1467
+ return t2[67] !== R2 || t2[68] !== G2 || t2[69] !== w2 || t2[70] !== O2 ? (K2 = /* @__PURE__ */ Y("div", {
1468
+ style: w2,
1469
+ role: "status",
1470
+ "aria-live": "polite",
1471
+ children: [
1472
+ O2,
1473
+ R2,
1474
+ G2
1475
+ ]
1476
+ }), t2[67] = R2, t2[68] = G2, t2[69] = w2, t2[70] = O2, t2[71] = K2) : K2 = t2[71], K2;
1477
+ }
1478
+ var Ve = q.forwardRef(function(e2, t2) {
1479
+ let n2 = $(), a2 = q.useRef(null), o2 = q.useRef(null), s2 = q.useRef(null), c2 = q.useRef(null), [l2, u2] = q.useState(null), [d2, f2] = q.useState(null), [p2, m2] = q.useState(null), [h2, g2] = q.useState(null), [_2, v2] = q.useState("live"), [y2, b2] = q.useState(false), [x2, S2] = q.useState(false), [C2, w2] = q.useState(void 0), [T2, E2] = q.useState(void 0), [D2, O2] = q.useState(0), [k2, A2] = q.useState(false), j2 = q.useMemo(() => ({
1480
+ theme: n2.theme,
1481
+ palette: n2.palette,
1482
+ locale: n2.locale,
1483
+ timeZone: n2.timeZone,
1484
+ visualStyle: n2.visualStyle,
1485
+ outlineFillColor: n2.outlineFillColor,
1486
+ outlineFillOpacity: n2.outlineFillOpacity,
1487
+ cornerRadius: n2.cornerRadius,
1488
+ borderWidth: n2.borderWidth,
1489
+ accents: n2.accents,
1490
+ osTheme: n2.osTheme,
1491
+ appTheme: n2.appTheme
1492
+ }), [
1493
+ n2.theme,
1494
+ n2.palette,
1495
+ n2.locale,
1496
+ n2.timeZone,
1497
+ n2.visualStyle,
1498
+ n2.outlineFillColor,
1499
+ n2.outlineFillOpacity,
1500
+ n2.cornerRadius,
1501
+ n2.borderWidth,
1502
+ n2.accents,
1503
+ n2.osTheme,
1504
+ n2.appTheme
1505
+ ]);
1506
+ q.useEffect(() => {
1507
+ r();
1508
+ }, []), q.useEffect(() => {
1509
+ let t3 = o2.current;
1510
+ if (t3 === null) return;
1511
+ let n3 = new ne({
1512
+ container: a2.current,
1513
+ staticCanvas: t3,
1514
+ dynamicCanvas: s2.current,
1515
+ initialProps: e2,
1516
+ initialProvider: j2,
1517
+ onContextChange: u2,
1518
+ onHoverChange: f2,
1519
+ onExtremeHoverChange: m2,
1520
+ onLiveStateChange: v2,
1521
+ onReducedMotionChange: b2,
1522
+ onArmedToolChange: S2,
1523
+ onSelectedDrawingIdChange: w2,
1524
+ onHoverDrawingIdChange: E2,
1525
+ onMarkerHoverChange: g2,
1526
+ onThemeFadeKeyChange: O2,
1527
+ onOverDividerChange: A2
1528
+ });
1529
+ return c2.current = n3, () => {
1530
+ c2.current = null, n3.dispose();
1531
+ };
1532
+ }, []), q.useEffect(() => {
1533
+ c2.current?.update(e2, j2);
1534
+ }), q.useImperativeHandle(t2, () => ({
1535
+ startDrawing(e3) {
1536
+ c2.current?.startDrawing(e3);
1537
+ },
1538
+ cancelDrawing() {
1539
+ c2.current?.cancelDrawing();
1540
+ },
1541
+ get isDrawing() {
1542
+ return c2.current?.isDrawing() ?? false;
1543
+ },
1544
+ onTick(e3, t3, n3 = 0) {
1545
+ c2.current?.onTick(e3, t3, n3);
1546
+ }
1547
+ }), []);
1548
+ let N2 = q.useCallback((e3) => {
1549
+ c2.current?.handlePointerMove(e3.nativeEvent);
1550
+ }, []), F2 = q.useCallback((e3) => {
1551
+ c2.current?.handlePointerDown(e3.nativeEvent);
1552
+ }, []), I2 = q.useCallback((e3) => {
1553
+ c2.current?.handlePointerUp(e3.nativeEvent);
1554
+ }, []), L2 = q.useCallback(() => {
1555
+ c2.current?.handlePointerLeave();
1556
+ }, []), R2 = q.useCallback((e3) => {
1557
+ c2.current?.handleWheel(e3.nativeEvent);
1558
+ }, []), z2 = e2.width ?? 800, B2 = e2.height ?? 360, V2 = e2.sparkline === true || e2.sparkline !== false && z2 < 150, H2 = e2.ariaLabel ?? l2?.ariaLabel ?? "Candle chart", U2 = d2 === null || l2 === null ? null : (() => {
1559
+ if (d2.pane === "volume" && Number.isFinite(d2.v)) {
1560
+ if (e2.volumeBarTooltip === false) return null;
1561
+ let t4 = l2.arr;
1562
+ if (t4.volumes === null) return null;
1563
+ let n3 = t4.length, r2 = Math.max(0, d2.idx - 19), a3 = 0, o3 = 0;
1564
+ for (let e3 = r2; e3 <= d2.idx; e3++) {
1565
+ let n4 = i(t4.volumes, e3);
1566
+ Number.isFinite(n4) && (a3 += n4, o3++);
1567
+ }
1568
+ let s3 = o3 > 0 ? a3 / o3 : d2.v, c3 = 0, u3 = 0;
1569
+ for (let e3 = 0; e3 < n3; e3++) {
1570
+ let n4 = i(t4.volumes, e3);
1571
+ Number.isFinite(n4) && (u3++, n4 < d2.v && c3++);
1572
+ }
1573
+ let f3 = u3 > 0 ? c3 / u3 : 0, p3 = {
1574
+ bar: {
1575
+ t: d2.t,
1576
+ v: d2.v,
1577
+ idx: d2.idx
1578
+ },
1579
+ avg20: s3,
1580
+ percentile: f3,
1581
+ pointerX: d2.pointerX,
1582
+ pointerY: d2.pointerY,
1583
+ containerWidth: z2,
1584
+ containerHeight: B2,
1585
+ theme: l2.personalization.theme,
1586
+ palette: l2.personalization.palette,
1587
+ locale: l2.resolvedLocaleBase,
1588
+ timeZone: l2.resolvedTimeZone,
1589
+ formatter: l2.formatter
1590
+ };
1591
+ return typeof e2.volumeBarTooltip == "function" ? e2.volumeBarTooltip({
1592
+ bar: p3.bar,
1593
+ avg20: p3.avg20,
1594
+ percentile: p3.percentile
1595
+ }) : /* @__PURE__ */ J(Be, { ...p3 });
1596
+ }
1597
+ let t3 = {
1598
+ t: d2.t,
1599
+ idx: d2.idx,
1600
+ o: d2.o,
1601
+ h: d2.h,
1602
+ l: d2.l,
1603
+ c: d2.c,
1604
+ direction: d2.direction,
1605
+ pointerX: d2.pointerX,
1606
+ pointerY: d2.pointerY,
1607
+ containerWidth: z2,
1608
+ containerHeight: B2,
1609
+ theme: l2.personalization.theme,
1610
+ palette: l2.personalization.palette,
1611
+ locale: l2.resolvedLocaleBase,
1612
+ timeZone: l2.resolvedTimeZone,
1613
+ formatter: l2.formatter
1614
+ };
1615
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : /* @__PURE__ */ J(Fe, { ...t3 });
1616
+ })(), W2 = p2 === null || l2 === null ? null : Ce(e2.extremeTooltip, {
1617
+ kind: p2.kind,
1618
+ barIdx: p2.idx,
1619
+ price: p2.price,
1620
+ t: p2.t,
1621
+ pointerX: p2.pointerX,
1622
+ pointerY: p2.pointerY,
1623
+ containerWidth: z2,
1624
+ containerHeight: B2,
1625
+ theme: l2.personalization.theme,
1626
+ palette: l2.personalization.palette,
1627
+ locale: l2.resolvedLocaleBase,
1628
+ timeZone: l2.resolvedTimeZone,
1629
+ formatter: l2.formatter
1630
+ }), G2 = (() => {
1631
+ if (h2 === null || l2 === null) return null;
1632
+ let t3 = h2.pointerX, n3 = h2.pointerY, r2 = l2.arr, a3 = r2.length > 0 ? i(r2.closes, r2.length - 1) : 0, o3 = l2.formatter, s3 = null;
1633
+ switch (h2.kind) {
1634
+ case "signal": {
1635
+ if (typeof e2.signalTooltip != "function" || e2.signals === void 0) return null;
1636
+ let r3 = e2.signals[h2.idx];
1637
+ if (r3 === void 0) return null;
1638
+ s3 = e2.signalTooltip({
1639
+ marker: r3,
1640
+ pointerX: t3,
1641
+ pointerY: n3,
1642
+ formatter: o3
1643
+ });
1644
+ break;
1645
+ }
1646
+ case "order": {
1647
+ if (typeof e2.orderTooltip != "function" || e2.orders === void 0) return null;
1648
+ let r3 = e2.orders[h2.idx];
1649
+ if (r3 === void 0) return null;
1650
+ s3 = e2.orderTooltip({
1651
+ marker: r3,
1652
+ pointerX: t3,
1653
+ pointerY: n3,
1654
+ formatter: o3
1655
+ });
1656
+ break;
1657
+ }
1658
+ case "position":
1659
+ if (typeof e2.positionTooltip != "function" || e2.position === void 0) return null;
1660
+ s3 = e2.positionTooltip({
1661
+ marker: e2.position,
1662
+ lastClose: a3,
1663
+ pointerX: t3,
1664
+ pointerY: n3,
1665
+ formatter: o3
1666
+ });
1667
+ break;
1668
+ case "event": {
1669
+ if (typeof e2.eventTooltip != "function" || e2.events === void 0) return null;
1670
+ let r3 = e2.events[h2.idx];
1671
+ if (r3 === void 0) return null;
1672
+ s3 = e2.eventTooltip({
1673
+ marker: r3,
1674
+ pointerX: t3,
1675
+ pointerY: n3,
1676
+ formatter: o3
1677
+ });
1678
+ break;
1679
+ }
1680
+ }
1681
+ return s3 === null ? null : /* @__PURE__ */ J("div", {
1682
+ style: {
1683
+ position: "absolute",
1684
+ left: t3 + 12,
1685
+ top: n3 + 12,
1686
+ pointerEvents: "none",
1687
+ zIndex: 3
1688
+ },
1689
+ children: s3
1690
+ });
1691
+ })(), K2 = _2 !== "live", ee2 = l2 !== null && K2 && (l2.personalization.staleVisualization === "desaturate-pulse" || l2.personalization.staleVisualization === "desaturate-pulse + banner"), te2 = l2 !== null && K2 && (l2.personalization.staleVisualization === "banner" || l2.personalization.staleVisualization === "desaturate-pulse + banner"), re2 = ee2 ? {
1692
+ filter: "saturate(0.5)",
1693
+ ...y2 ? { opacity: 0.9 } : { animation: "tickyr-stale-pulse 1.2s ease-in-out infinite" }
1694
+ } : {}, ie2 = null;
1695
+ if (l2 !== null) {
1696
+ let e3 = l2.personalization, t3 = e3.connectionIndicator;
1697
+ if (t3 !== "off") {
1698
+ let n3 = e3.legendPosition === "top-left" || e3.legendPosition === "bottom-left", r2 = {
1699
+ position: "absolute",
1700
+ pointerEvents: "none",
1701
+ zIndex: 3,
1702
+ ...e3.legendPosition === "top-left" || e3.legendPosition === "top-right" ? { top: "4px" } : { bottom: "4px" },
1703
+ ...n3 ? { left: "4px" } : { right: "4px" }
1704
+ }, i2 = e3.palette[e3.theme], a3 = M(_2 === "live" ? i2.up : _2 === "stale" ? i2.warn : i2.down, 1), o3 = e3.theme === "dark" ? "#0c0d0e" : "#fafafa", s3 = _2 === "live" ? "live" : _2 === "stale" ? "stale" : "offline", c3 = e3.visualStyle === "Outline", l3 = t3 === "dot";
1705
+ ie2 = /* @__PURE__ */ Y("div", {
1706
+ style: {
1707
+ ...r2,
1708
+ display: "inline-flex",
1709
+ alignItems: "center",
1710
+ gap: l3 ? 5 : 0,
1711
+ padding: l3 ? "0 7px" : "0 10px",
1712
+ height: l3 ? 18 : 22,
1713
+ borderRadius: 999,
1714
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
1715
+ fontSize: 10,
1716
+ fontWeight: 600,
1717
+ ...c3 ? {
1718
+ background: o3,
1719
+ color: a3,
1720
+ border: `${l3 ? 1 : 1.4}px solid ${a3}`
1721
+ } : {
1722
+ background: a3,
1723
+ color: o3,
1724
+ border: "none"
1725
+ },
1726
+ ..._2 !== "live" && !y2 ? { animation: "tickyr-stale-pulse 1s ease-in-out infinite" } : {}
1727
+ },
1728
+ "aria-live": "polite",
1729
+ role: "status",
1730
+ "aria-label": "Connection status",
1731
+ children: [l3 && /* @__PURE__ */ J("span", {
1732
+ "aria-hidden": "true",
1733
+ style: {
1734
+ width: 6,
1735
+ height: 6,
1736
+ borderRadius: 999,
1737
+ background: c3 ? a3 : o3
1738
+ }
1739
+ }), /* @__PURE__ */ J("span", { children: s3 })]
1740
+ });
1741
+ }
1742
+ }
1743
+ let X2 = null;
1744
+ if (te2 && e2.staleBanner !== false && l2 !== null) {
1745
+ let t3 = l2.personalization.palette[l2.personalization.theme], n3 = M(t3.warn, 1), r2 = _2 === "disconnected" ? "Connection lost" : "Live data paused";
1746
+ if (typeof e2.staleBanner == "function") {
1747
+ let t4 = e2.staleBanner({
1748
+ state: _2,
1749
+ liveSince: e2.liveSince,
1750
+ theme: l2.personalization.theme,
1751
+ palette: l2.personalization.palette
1752
+ });
1753
+ X2 = /* @__PURE__ */ J("div", {
1754
+ style: {
1755
+ position: "absolute",
1756
+ top: 8,
1757
+ left: "50%",
1758
+ transform: "translate(-50%, 0)",
1759
+ pointerEvents: "none",
1760
+ zIndex: 2,
1761
+ ...y2 ? {} : { animation: "tickyr-stale-banner-in 0.3s ease-out" }
1762
+ },
1763
+ "aria-live": "polite",
1764
+ children: t4
1765
+ });
1766
+ } else X2 = /* @__PURE__ */ J("div", {
1767
+ style: {
1768
+ position: "absolute",
1769
+ top: 8,
1770
+ left: "50%",
1771
+ transform: "translate(-50%, 0)",
1772
+ pointerEvents: "none",
1773
+ zIndex: 2,
1774
+ ...y2 ? {} : { animation: "tickyr-stale-banner-in 0.3s ease-out" }
1775
+ },
1776
+ "aria-live": "polite",
1777
+ role: "status",
1778
+ children: /* @__PURE__ */ Y("div", {
1779
+ style: {
1780
+ display: "inline-flex",
1781
+ alignItems: "center",
1782
+ gap: 6,
1783
+ padding: "4px 10px",
1784
+ borderRadius: 999,
1785
+ background: P(n3, 0.15),
1786
+ color: n3,
1787
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
1788
+ fontSize: 12,
1789
+ fontWeight: 500,
1790
+ letterSpacing: 0.2,
1791
+ border: `1px solid ${P(n3, 0.4)}`
1792
+ },
1793
+ children: [/* @__PURE__ */ J("span", {
1794
+ "aria-hidden": "true",
1795
+ style: {
1796
+ display: "inline-flex",
1797
+ alignItems: "center"
1798
+ },
1799
+ children: /* @__PURE__ */ Y("svg", {
1800
+ width: "10",
1801
+ height: "10",
1802
+ viewBox: "0 0 10 10",
1803
+ fill: "currentColor",
1804
+ children: [/* @__PURE__ */ J("rect", {
1805
+ x: "2",
1806
+ y: "1.5",
1807
+ width: "2",
1808
+ height: "7",
1809
+ rx: "0.5"
1810
+ }), /* @__PURE__ */ J("rect", {
1811
+ x: "6",
1812
+ y: "1.5",
1813
+ width: "2",
1814
+ height: "7",
1815
+ rx: "0.5"
1816
+ })]
1817
+ })
1818
+ }), /* @__PURE__ */ J("span", { children: r2 })]
1819
+ })
1820
+ });
1821
+ }
1822
+ if (V2) return /* @__PURE__ */ Y("div", {
1823
+ ref: a2,
1824
+ style: {
1825
+ position: "relative",
1826
+ width: z2,
1827
+ height: B2
1828
+ },
1829
+ "aria-label": H2,
1830
+ children: [/* @__PURE__ */ J("canvas", {
1831
+ ref: o2,
1832
+ style: {
1833
+ display: "block",
1834
+ width: z2,
1835
+ height: B2,
1836
+ ...re2
1837
+ },
1838
+ "aria-hidden": "true"
1839
+ }), X2]
1840
+ });
1841
+ let Z2 = `s-${D2}`;
1842
+ return /* @__PURE__ */ Y("div", {
1843
+ ref: a2,
1844
+ style: {
1845
+ position: "relative",
1846
+ width: z2,
1847
+ height: B2,
1848
+ cursor: k2 ? "row-resize" : void 0
1849
+ },
1850
+ "aria-label": H2,
1851
+ onPointerMove: N2,
1852
+ onPointerDown: F2,
1853
+ onPointerUp: I2,
1854
+ onPointerLeave: L2,
1855
+ onWheel: R2,
1856
+ children: [
1857
+ /* @__PURE__ */ J("canvas", {
1858
+ ref: o2,
1859
+ style: {
1860
+ display: "block",
1861
+ width: z2,
1862
+ height: B2,
1863
+ ...re2,
1864
+ ...D2 > 0 && !y2 ? { animation: "tickyr-theme-fade 200ms ease-out" } : {}
1865
+ },
1866
+ "aria-hidden": "true"
1867
+ }, Z2),
1868
+ /* @__PURE__ */ J("canvas", {
1869
+ ref: s2,
1870
+ style: {
1871
+ display: "block",
1872
+ width: z2,
1873
+ height: B2,
1874
+ position: "absolute",
1875
+ inset: 0,
1876
+ pointerEvents: "none",
1877
+ ...re2
1878
+ },
1879
+ "aria-hidden": "true"
1880
+ }),
1881
+ U2,
1882
+ W2,
1883
+ G2,
1884
+ ie2,
1885
+ X2
1886
+ ]
1887
+ });
1888
+ });
1889
+ function He(e2) {
1890
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
1891
+ theme: t2.theme,
1892
+ palette: t2.palette,
1893
+ locale: t2.locale,
1894
+ timeZone: t2.timeZone,
1895
+ visualStyle: t2.visualStyle,
1896
+ outlineFillColor: t2.outlineFillColor,
1897
+ outlineFillOpacity: t2.outlineFillOpacity,
1898
+ cornerRadius: t2.cornerRadius,
1899
+ borderWidth: t2.borderWidth,
1900
+ accents: t2.accents,
1901
+ osTheme: t2.osTheme,
1902
+ appTheme: t2.appTheme
1903
+ }), [
1904
+ t2.theme,
1905
+ t2.palette,
1906
+ t2.locale,
1907
+ t2.timeZone,
1908
+ t2.visualStyle,
1909
+ t2.outlineFillColor,
1910
+ t2.outlineFillOpacity,
1911
+ t2.cornerRadius,
1912
+ t2.borderWidth,
1913
+ t2.accents,
1914
+ t2.osTheme,
1915
+ t2.appTheme
1916
+ ]);
1917
+ q.useEffect(() => {
1918
+ let t3 = r2.current;
1919
+ if (t3 === null) return;
1920
+ let o3 = new b({
1921
+ container: n2.current,
1922
+ staticCanvas: t3,
1923
+ dynamicCanvas: i2.current,
1924
+ initialProps: e2,
1925
+ initialProvider: u2,
1926
+ onContextChange: s2,
1927
+ onHoverChange: l2
1928
+ });
1929
+ return a2.current = o3, () => {
1930
+ a2.current = null, o3.dispose();
1931
+ };
1932
+ }, []), q.useEffect(() => {
1933
+ a2.current?.update(e2, u2);
1934
+ });
1935
+ let d2 = q.useCallback((e3) => {
1936
+ a2.current?.handlePointerMove(e3.nativeEvent);
1937
+ }, []), f2 = q.useCallback(() => {
1938
+ a2.current?.handlePointerLeave();
1939
+ }, []), p2 = e2.width ?? 800, m2 = e2.height ?? 300, h2 = e2.sparkline === true || e2.sparkline !== false && p2 < 150, g2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Scatter chart", _2 = c2 === null || o2 === null ? null : (() => {
1940
+ let t3 = o2.seriesList[c2.seriesIdx], n3 = t3?.id ?? "primary", r3 = t3?.label ?? "Value", i3 = t3?.color ?? "", a3 = {
1941
+ x: c2.x,
1942
+ y: c2.y,
1943
+ size: c2.size,
1944
+ idx: c2.idx,
1945
+ seriesIdx: c2.seriesIdx,
1946
+ seriesId: n3,
1947
+ seriesLabel: r3,
1948
+ seriesColor: i3,
1949
+ pointerX: c2.pointerX,
1950
+ pointerY: c2.pointerY,
1951
+ containerWidth: p2,
1952
+ containerHeight: m2,
1953
+ theme: o2.personalization.theme,
1954
+ palette: o2.personalization.palette,
1955
+ locale: o2.resolvedLocaleBase,
1956
+ timeZone: o2.resolvedTimeZone,
1957
+ formatter: o2.formatter
1958
+ };
1959
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(a3) : Ue(a3);
1960
+ })(), v2 = (() => {
1961
+ if (o2 === null) return null;
1962
+ let e3 = o2.seriesList;
1963
+ if (e3.length < 2) return null;
1964
+ let t3 = o2.personalization, n3 = t3.legend;
1965
+ if (n3 !== "always" && !(n3 === "on-hover" && c2 !== null)) return null;
1966
+ let r3 = t3.legendPosition;
1967
+ return /* @__PURE__ */ J("div", {
1968
+ style: {
1969
+ position: "absolute",
1970
+ ...r3 === "top-left" || r3 === "top-right" ? { top: 6 } : { bottom: 6 },
1971
+ ...r3 === "top-left" || r3 === "bottom-left" ? { left: 8 } : { right: 8 },
1972
+ pointerEvents: "none",
1973
+ display: "flex",
1974
+ gap: 12,
1975
+ alignItems: "center",
1976
+ padding: "4px 8px",
1977
+ background: t3.theme === "dark" ? "rgba(34,36,42,0.85)" : "rgba(255,255,255,0.85)",
1978
+ border: `1px solid ${t3.theme === "dark" ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)"}`,
1979
+ borderRadius: 6,
1980
+ fontSize: 11,
1981
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
1982
+ color: t3.theme === "dark" ? "rgb(240,242,246)" : "rgb(20,22,26)"
1983
+ },
1984
+ role: "presentation",
1985
+ children: e3.map((e4) => /* @__PURE__ */ Y("span", {
1986
+ style: {
1987
+ display: "inline-flex",
1988
+ alignItems: "center",
1989
+ gap: 5
1990
+ },
1991
+ children: [/* @__PURE__ */ J("span", {
1992
+ "aria-hidden": "true",
1993
+ style: {
1994
+ width: 10,
1995
+ height: 10,
1996
+ borderRadius: 5,
1997
+ background: e4.color,
1998
+ display: "inline-block",
1999
+ flex: "0 0 auto"
2000
+ }
2001
+ }), /* @__PURE__ */ J("span", { children: e4.label })]
2002
+ }, e4.id))
2003
+ });
2004
+ })();
2005
+ return h2 ? /* @__PURE__ */ J("div", {
2006
+ ref: n2,
2007
+ style: {
2008
+ position: "relative",
2009
+ width: p2,
2010
+ height: m2
2011
+ },
2012
+ "aria-label": g2,
2013
+ children: /* @__PURE__ */ J("canvas", {
2014
+ ref: r2,
2015
+ style: {
2016
+ display: "block",
2017
+ width: p2,
2018
+ height: m2
2019
+ },
2020
+ "aria-hidden": "true"
2021
+ })
2022
+ }) : /* @__PURE__ */ Y("div", {
2023
+ ref: n2,
2024
+ style: {
2025
+ position: "relative",
2026
+ width: p2,
2027
+ height: m2
2028
+ },
2029
+ "aria-label": g2,
2030
+ onPointerMove: d2,
2031
+ onPointerLeave: f2,
2032
+ children: [
2033
+ /* @__PURE__ */ J("canvas", {
2034
+ ref: r2,
2035
+ style: {
2036
+ display: "block",
2037
+ width: p2,
2038
+ height: m2
2039
+ },
2040
+ "aria-hidden": "true"
2041
+ }),
2042
+ /* @__PURE__ */ J("canvas", {
2043
+ ref: i2,
2044
+ style: {
2045
+ display: "block",
2046
+ width: p2,
2047
+ height: m2,
2048
+ position: "absolute",
2049
+ inset: 0,
2050
+ pointerEvents: "none"
2051
+ },
2052
+ "aria-hidden": "true"
2053
+ }),
2054
+ v2,
2055
+ _2
2056
+ ]
2057
+ });
2058
+ }
2059
+ function Ue(e2) {
2060
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", r2 = t2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", i2 = t2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", a2 = t2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", o2 = t2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)";
2061
+ return /* @__PURE__ */ Y("div", {
2062
+ role: "tooltip",
2063
+ style: {
2064
+ position: "absolute",
2065
+ left: Math.min(e2.containerWidth - 140, e2.pointerX + 12),
2066
+ top: Math.min(e2.containerHeight - 70, e2.pointerY + 12),
2067
+ background: n2,
2068
+ color: r2,
2069
+ border: `1px solid ${a2}`,
2070
+ borderRadius: 6,
2071
+ boxShadow: o2,
2072
+ padding: "6px 8px",
2073
+ fontSize: 12,
2074
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2075
+ pointerEvents: "none",
2076
+ minWidth: 120
2077
+ },
2078
+ children: [
2079
+ /* @__PURE__ */ Y("div", {
2080
+ style: {
2081
+ color: i2,
2082
+ fontSize: 10,
2083
+ marginBottom: 2,
2084
+ display: "flex",
2085
+ alignItems: "center",
2086
+ gap: 5
2087
+ },
2088
+ children: [/* @__PURE__ */ J("span", {
2089
+ "aria-hidden": "true",
2090
+ style: {
2091
+ width: 8,
2092
+ height: 8,
2093
+ borderRadius: 4,
2094
+ background: e2.seriesColor,
2095
+ display: "inline-block"
2096
+ }
2097
+ }), /* @__PURE__ */ Y("span", { children: [
2098
+ e2.seriesLabel,
2099
+ " \xB7 #",
2100
+ e2.idx
2101
+ ] })]
2102
+ }),
2103
+ /* @__PURE__ */ Y("div", { children: ["x: ", e2.formatter.formatNumber(e2.x, 2)] }),
2104
+ /* @__PURE__ */ Y("div", { children: ["y: ", e2.formatter.formatNumber(e2.y, 2)] }),
2105
+ e2.size !== null && /* @__PURE__ */ Y("div", { children: ["size: ", e2.formatter.formatNumber(e2.size, 2)] })
2106
+ ]
2107
+ });
2108
+ }
2109
+ function We(e2) {
2110
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
2111
+ theme: t2.theme,
2112
+ palette: t2.palette,
2113
+ locale: t2.locale,
2114
+ timeZone: t2.timeZone,
2115
+ visualStyle: t2.visualStyle,
2116
+ outlineFillColor: t2.outlineFillColor,
2117
+ outlineFillOpacity: t2.outlineFillOpacity,
2118
+ cornerRadius: t2.cornerRadius,
2119
+ borderWidth: t2.borderWidth,
2120
+ accents: t2.accents,
2121
+ osTheme: t2.osTheme,
2122
+ appTheme: t2.appTheme
2123
+ }), [
2124
+ t2.theme,
2125
+ t2.palette,
2126
+ t2.locale,
2127
+ t2.timeZone,
2128
+ t2.visualStyle,
2129
+ t2.outlineFillColor,
2130
+ t2.outlineFillOpacity,
2131
+ t2.cornerRadius,
2132
+ t2.borderWidth,
2133
+ t2.accents,
2134
+ t2.osTheme,
2135
+ t2.appTheme
2136
+ ]);
2137
+ q.useEffect(() => {
2138
+ let t3 = r2.current;
2139
+ if (t3 === null) return;
2140
+ let o3 = new m({
2141
+ container: n2.current,
2142
+ staticCanvas: t3,
2143
+ dynamicCanvas: i2.current,
2144
+ initialProps: e2,
2145
+ initialProvider: u2,
2146
+ onContextChange: s2,
2147
+ onHoverChange: l2
2148
+ });
2149
+ return a2.current = o3, () => {
2150
+ a2.current = null, o3.dispose();
2151
+ };
2152
+ }, []), q.useEffect(() => {
2153
+ a2.current?.update(e2, u2);
2154
+ });
2155
+ let d2 = q.useCallback((e3) => {
2156
+ a2.current?.handlePointerMove(e3.nativeEvent);
2157
+ }, []), f2 = q.useCallback(() => {
2158
+ a2.current?.handlePointerLeave();
2159
+ }, []), p2 = e2.width ?? 800, h2 = e2.height ?? 300, g2 = e2.sparkline === true || e2.sparkline !== false && p2 < 150, _2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Histogram", v2 = c2 === null || o2 === null ? null : (() => {
2160
+ let t3 = {
2161
+ binIdx: c2.binIdx,
2162
+ binStart: c2.binStart,
2163
+ binEnd: c2.binEnd,
2164
+ count: c2.count,
2165
+ value: c2.value,
2166
+ pointerX: c2.pointerX,
2167
+ pointerY: c2.pointerY,
2168
+ containerWidth: p2,
2169
+ containerHeight: h2,
2170
+ theme: o2.personalization.theme,
2171
+ palette: o2.personalization.palette,
2172
+ locale: o2.resolvedLocaleBase,
2173
+ timeZone: o2.resolvedTimeZone,
2174
+ formatter: o2.formatter
2175
+ };
2176
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : Ge(t3, o2.yAxisMode);
2177
+ })();
2178
+ return g2 ? /* @__PURE__ */ J("div", {
2179
+ ref: n2,
2180
+ style: {
2181
+ position: "relative",
2182
+ width: p2,
2183
+ height: h2
2184
+ },
2185
+ "aria-label": _2,
2186
+ children: /* @__PURE__ */ J("canvas", {
2187
+ ref: r2,
2188
+ style: {
2189
+ display: "block",
2190
+ width: p2,
2191
+ height: h2
2192
+ },
2193
+ "aria-hidden": "true"
2194
+ })
2195
+ }) : /* @__PURE__ */ Y("div", {
2196
+ ref: n2,
2197
+ style: {
2198
+ position: "relative",
2199
+ width: p2,
2200
+ height: h2
2201
+ },
2202
+ "aria-label": _2,
2203
+ onPointerMove: d2,
2204
+ onPointerLeave: f2,
2205
+ children: [
2206
+ /* @__PURE__ */ J("canvas", {
2207
+ ref: r2,
2208
+ style: {
2209
+ display: "block",
2210
+ width: p2,
2211
+ height: h2
2212
+ },
2213
+ "aria-hidden": "true"
2214
+ }),
2215
+ /* @__PURE__ */ J("canvas", {
2216
+ ref: i2,
2217
+ style: {
2218
+ display: "block",
2219
+ width: p2,
2220
+ height: h2,
2221
+ position: "absolute",
2222
+ inset: 0,
2223
+ pointerEvents: "none"
2224
+ },
2225
+ "aria-hidden": "true"
2226
+ }),
2227
+ v2
2228
+ ]
2229
+ });
2230
+ }
2231
+ function Ge(e2, t2) {
2232
+ let n2 = e2.theme === "dark", r2 = n2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", i2 = n2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", a2 = n2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", o2 = n2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", s2 = n2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)", c2 = Math.min(e2.containerWidth - 160, e2.pointerX + 12), l2 = Math.min(e2.containerHeight - 80, e2.pointerY + 12), u2 = t2 === "frequency" ? "count" : t2 === "density" ? "density" : "cumulative";
2233
+ return /* @__PURE__ */ Y("div", {
2234
+ role: "tooltip",
2235
+ style: {
2236
+ position: "absolute",
2237
+ left: c2,
2238
+ top: l2,
2239
+ background: r2,
2240
+ color: i2,
2241
+ border: `1px solid ${o2}`,
2242
+ borderRadius: 6,
2243
+ boxShadow: s2,
2244
+ padding: "6px 8px",
2245
+ fontSize: 12,
2246
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2247
+ pointerEvents: "none",
2248
+ minWidth: 140
2249
+ },
2250
+ children: [
2251
+ /* @__PURE__ */ Y("div", {
2252
+ style: {
2253
+ color: a2,
2254
+ fontSize: 10,
2255
+ marginBottom: 2
2256
+ },
2257
+ children: ["Bin #", e2.binIdx]
2258
+ }),
2259
+ /* @__PURE__ */ Y("div", { children: [
2260
+ "range: ",
2261
+ e2.formatter.formatNumber(e2.binStart, 2),
2262
+ " \u2013",
2263
+ " ",
2264
+ e2.formatter.formatNumber(e2.binEnd, 2)
2265
+ ] }),
2266
+ /* @__PURE__ */ Y("div", { children: ["count: ", e2.formatter.formatNumber(e2.count, 0)] }),
2267
+ t2 !== "frequency" && /* @__PURE__ */ Y("div", { children: [
2268
+ u2,
2269
+ ": ",
2270
+ e2.formatter.formatNumber(e2.value, 4)
2271
+ ] })
2272
+ ]
2273
+ });
2274
+ }
2275
+ function Ke(e2) {
2276
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
2277
+ theme: t2.theme,
2278
+ palette: t2.palette,
2279
+ locale: t2.locale,
2280
+ timeZone: t2.timeZone,
2281
+ visualStyle: t2.visualStyle,
2282
+ outlineFillColor: t2.outlineFillColor,
2283
+ outlineFillOpacity: t2.outlineFillOpacity,
2284
+ cornerRadius: t2.cornerRadius,
2285
+ borderWidth: t2.borderWidth,
2286
+ accents: t2.accents,
2287
+ osTheme: t2.osTheme,
2288
+ appTheme: t2.appTheme
2289
+ }), [
2290
+ t2.theme,
2291
+ t2.palette,
2292
+ t2.locale,
2293
+ t2.timeZone,
2294
+ t2.visualStyle,
2295
+ t2.outlineFillColor,
2296
+ t2.outlineFillOpacity,
2297
+ t2.cornerRadius,
2298
+ t2.borderWidth,
2299
+ t2.accents,
2300
+ t2.osTheme,
2301
+ t2.appTheme
2302
+ ]);
2303
+ q.useEffect(() => {
2304
+ let t3 = r2.current;
2305
+ if (t3 === null) return;
2306
+ let o3 = new f({
2307
+ container: n2.current,
2308
+ staticCanvas: t3,
2309
+ dynamicCanvas: i2.current,
2310
+ initialProps: e2,
2311
+ initialProvider: u2,
2312
+ onContextChange: s2,
2313
+ onHoverChange: l2
2314
+ });
2315
+ return a2.current = o3, () => {
2316
+ a2.current = null, o3.dispose();
2317
+ };
2318
+ }, []), q.useEffect(() => {
2319
+ a2.current?.update(e2, u2);
2320
+ });
2321
+ let d2 = q.useCallback((e3) => {
2322
+ a2.current?.handlePointerMove(e3.nativeEvent);
2323
+ }, []), p2 = q.useCallback(() => {
2324
+ a2.current?.handlePointerLeave();
2325
+ }, []), m2 = e2.width ?? 800, h2 = e2.height ?? 300, g2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Heatmap", _2 = c2 === null || o2 === null ? null : (() => {
2326
+ let t3 = {
2327
+ row: c2.row,
2328
+ col: c2.col,
2329
+ value: c2.value,
2330
+ rowLabel: c2.rowLabel,
2331
+ colLabel: c2.colLabel,
2332
+ pointerX: c2.pointerX,
2333
+ pointerY: c2.pointerY,
2334
+ containerWidth: m2,
2335
+ containerHeight: h2,
2336
+ theme: o2.personalization.theme,
2337
+ palette: o2.personalization.palette,
2338
+ locale: o2.resolvedLocaleBase,
2339
+ timeZone: o2.resolvedTimeZone,
2340
+ formatter: o2.formatter
2341
+ };
2342
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : qe(t3);
2343
+ })();
2344
+ return /* @__PURE__ */ Y("div", {
2345
+ ref: n2,
2346
+ style: {
2347
+ position: "relative",
2348
+ width: m2,
2349
+ height: h2
2350
+ },
2351
+ "aria-label": g2,
2352
+ onPointerMove: d2,
2353
+ onPointerLeave: p2,
2354
+ children: [
2355
+ /* @__PURE__ */ J("canvas", {
2356
+ ref: r2,
2357
+ style: {
2358
+ display: "block",
2359
+ width: m2,
2360
+ height: h2
2361
+ },
2362
+ "aria-hidden": "true"
2363
+ }),
2364
+ /* @__PURE__ */ J("canvas", {
2365
+ ref: i2,
2366
+ style: {
2367
+ display: "block",
2368
+ width: m2,
2369
+ height: h2,
2370
+ position: "absolute",
2371
+ inset: 0,
2372
+ pointerEvents: "none"
2373
+ },
2374
+ "aria-hidden": "true"
2375
+ }),
2376
+ _2
2377
+ ]
2378
+ });
2379
+ }
2380
+ function qe(e2) {
2381
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", r2 = t2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", i2 = t2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", a2 = t2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", o2 = t2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)";
2382
+ return /* @__PURE__ */ Y("div", {
2383
+ role: "tooltip",
2384
+ style: {
2385
+ position: "absolute",
2386
+ left: Math.min(e2.containerWidth - 160, e2.pointerX + 12),
2387
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
2388
+ background: n2,
2389
+ color: r2,
2390
+ border: `1px solid ${a2}`,
2391
+ borderRadius: 6,
2392
+ boxShadow: o2,
2393
+ padding: "6px 8px",
2394
+ fontSize: 12,
2395
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2396
+ pointerEvents: "none",
2397
+ minWidth: 140
2398
+ },
2399
+ children: [/* @__PURE__ */ Y("div", {
2400
+ style: {
2401
+ color: i2,
2402
+ fontSize: 10,
2403
+ marginBottom: 2
2404
+ },
2405
+ children: [
2406
+ e2.rowLabel,
2407
+ " \xB7 ",
2408
+ e2.colLabel
2409
+ ]
2410
+ }), /* @__PURE__ */ J("div", { children: e2.value === null ? /* @__PURE__ */ J("span", {
2411
+ style: { color: i2 },
2412
+ children: "(no data)"
2413
+ }) : /* @__PURE__ */ Y("span", { children: ["value: ", e2.formatter.formatNumber(e2.value, 3)] }) })]
2414
+ });
2415
+ }
2416
+ function Je(e2) {
2417
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, c2] = q.useState(null), [l2, u2] = q.useState(null), d2 = q.useMemo(() => ({
2418
+ theme: t2.theme,
2419
+ palette: t2.palette,
2420
+ locale: t2.locale,
2421
+ timeZone: t2.timeZone,
2422
+ visualStyle: t2.visualStyle,
2423
+ outlineFillColor: t2.outlineFillColor,
2424
+ outlineFillOpacity: t2.outlineFillOpacity,
2425
+ cornerRadius: t2.cornerRadius,
2426
+ borderWidth: t2.borderWidth,
2427
+ accents: t2.accents,
2428
+ osTheme: t2.osTheme,
2429
+ appTheme: t2.appTheme
2430
+ }), [
2431
+ t2.theme,
2432
+ t2.palette,
2433
+ t2.locale,
2434
+ t2.timeZone,
2435
+ t2.visualStyle,
2436
+ t2.outlineFillColor,
2437
+ t2.outlineFillOpacity,
2438
+ t2.cornerRadius,
2439
+ t2.borderWidth,
2440
+ t2.accents,
2441
+ t2.osTheme,
2442
+ t2.appTheme
2443
+ ]);
2444
+ q.useEffect(() => {
2445
+ let t3 = r2.current;
2446
+ if (t3 === null) return;
2447
+ let o3 = new s({
2448
+ container: n2.current,
2449
+ staticCanvas: t3,
2450
+ dynamicCanvas: i2.current,
2451
+ initialProps: e2,
2452
+ initialProvider: d2,
2453
+ onContextChange: c2,
2454
+ onHoverChange: u2
2455
+ });
2456
+ return a2.current = o3, () => {
2457
+ a2.current = null, o3.dispose();
2458
+ };
2459
+ }, []), q.useEffect(() => {
2460
+ a2.current?.update(e2, d2);
2461
+ });
2462
+ let f2 = q.useCallback((e3) => {
2463
+ a2.current?.handlePointerMove(e3.nativeEvent);
2464
+ }, []), p2 = q.useCallback(() => {
2465
+ a2.current?.handlePointerLeave();
2466
+ }, []), m2 = e2.width ?? 800, h2 = e2.height ?? 300, g2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Depth chart", _2 = l2 === null || o2 === null ? null : (() => {
2467
+ let t3 = {
2468
+ side: l2.side,
2469
+ price: l2.price,
2470
+ cumulativeVolume: l2.cumulativeVolume,
2471
+ pctFromMid: l2.pctFromMid,
2472
+ pointerX: l2.pointerX,
2473
+ pointerY: l2.pointerY,
2474
+ containerWidth: m2,
2475
+ containerHeight: h2,
2476
+ theme: o2.personalization.theme,
2477
+ palette: o2.personalization.palette,
2478
+ locale: o2.resolvedLocaleBase,
2479
+ timeZone: o2.resolvedTimeZone,
2480
+ formatter: o2.formatter
2481
+ };
2482
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : Ye(t3);
2483
+ })();
2484
+ return /* @__PURE__ */ Y("div", {
2485
+ ref: n2,
2486
+ style: {
2487
+ position: "relative",
2488
+ width: m2,
2489
+ height: h2
2490
+ },
2491
+ "aria-label": g2,
2492
+ onPointerMove: f2,
2493
+ onPointerLeave: p2,
2494
+ children: [
2495
+ /* @__PURE__ */ J("canvas", {
2496
+ ref: r2,
2497
+ style: {
2498
+ display: "block",
2499
+ width: m2,
2500
+ height: h2
2501
+ },
2502
+ "aria-hidden": "true"
2503
+ }),
2504
+ /* @__PURE__ */ J("canvas", {
2505
+ ref: i2,
2506
+ style: {
2507
+ display: "block",
2508
+ width: m2,
2509
+ height: h2,
2510
+ position: "absolute",
2511
+ inset: 0,
2512
+ pointerEvents: "none"
2513
+ },
2514
+ "aria-hidden": "true"
2515
+ }),
2516
+ _2
2517
+ ]
2518
+ });
2519
+ }
2520
+ function Ye(e2) {
2521
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", r2 = t2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", i2 = t2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", a2 = t2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", o2 = t2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)", s2 = Math.min(e2.containerWidth - 180, e2.pointerX + 12), c2 = Math.min(e2.containerHeight - 90, e2.pointerY + 12), l2 = e2.side === "bid" ? "BID" : "ASK", u2 = e2.pctFromMid >= 0 ? "+" : "";
2522
+ return /* @__PURE__ */ Y("div", {
2523
+ role: "tooltip",
2524
+ style: {
2525
+ position: "absolute",
2526
+ left: s2,
2527
+ top: c2,
2528
+ background: n2,
2529
+ color: r2,
2530
+ border: `1px solid ${a2}`,
2531
+ borderRadius: 6,
2532
+ boxShadow: o2,
2533
+ padding: "6px 8px",
2534
+ fontSize: 12,
2535
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2536
+ pointerEvents: "none",
2537
+ minWidth: 160
2538
+ },
2539
+ children: [
2540
+ /* @__PURE__ */ Y("div", {
2541
+ style: {
2542
+ color: i2,
2543
+ fontSize: 10,
2544
+ marginBottom: 2
2545
+ },
2546
+ children: [
2547
+ l2,
2548
+ " \xB7 ",
2549
+ u2,
2550
+ (e2.pctFromMid * 100).toFixed(2),
2551
+ "%"
2552
+ ]
2553
+ }),
2554
+ /* @__PURE__ */ Y("div", { children: ["price: ", e2.formatter.formatNumber(e2.price, 4)] }),
2555
+ /* @__PURE__ */ Y("div", { children: ["cumulative: ", e2.formatter.formatNumber(e2.cumulativeVolume, 3)] })
2556
+ ]
2557
+ });
2558
+ }
2559
+ function Xe(e2) {
2560
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
2561
+ theme: t2.theme,
2562
+ palette: t2.palette,
2563
+ locale: t2.locale,
2564
+ timeZone: t2.timeZone,
2565
+ visualStyle: t2.visualStyle,
2566
+ outlineFillColor: t2.outlineFillColor,
2567
+ outlineFillOpacity: t2.outlineFillOpacity,
2568
+ cornerRadius: t2.cornerRadius,
2569
+ borderWidth: t2.borderWidth,
2570
+ accents: t2.accents,
2571
+ osTheme: t2.osTheme,
2572
+ appTheme: t2.appTheme
2573
+ }), [
2574
+ t2.theme,
2575
+ t2.palette,
2576
+ t2.locale,
2577
+ t2.timeZone,
2578
+ t2.visualStyle,
2579
+ t2.outlineFillColor,
2580
+ t2.outlineFillOpacity,
2581
+ t2.cornerRadius,
2582
+ t2.borderWidth,
2583
+ t2.accents,
2584
+ t2.osTheme,
2585
+ t2.appTheme
2586
+ ]), d2 = e2.innerRadiusDefault;
2587
+ q.useEffect(() => {
2588
+ let t3 = r2.current;
2589
+ if (t3 === null) return;
2590
+ let o3 = new y({
2591
+ container: n2.current,
2592
+ staticCanvas: t3,
2593
+ dynamicCanvas: i2.current,
2594
+ initialProps: e2,
2595
+ initialProvider: u2,
2596
+ innerRadiusDefault: d2,
2597
+ onContextChange: s2,
2598
+ onHoverChange: l2
2599
+ });
2600
+ return a2.current = o3, () => {
2601
+ a2.current = null, o3.dispose();
2602
+ };
2603
+ }, []), q.useEffect(() => {
2604
+ a2.current?.update(e2, u2);
2605
+ });
2606
+ let f2 = q.useCallback((e3) => {
2607
+ a2.current?.handlePointerMove(e3.nativeEvent);
2608
+ }, []), p2 = q.useCallback(() => {
2609
+ a2.current?.handlePointerLeave();
2610
+ }, []), m2 = e2.width ?? 480, h2 = e2.height ?? 360, g2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Pie chart", _2 = c2 === null || o2 === null ? null : (() => {
2611
+ let t3 = {
2612
+ idx: c2.idx,
2613
+ name: c2.name,
2614
+ value: c2.value,
2615
+ percent: c2.percent,
2616
+ color: c2.color,
2617
+ pointerX: c2.pointerX,
2618
+ pointerY: c2.pointerY,
2619
+ containerWidth: m2,
2620
+ containerHeight: h2,
2621
+ theme: o2.personalization.theme,
2622
+ palette: o2.personalization.palette,
2623
+ locale: o2.resolvedLocaleBase,
2624
+ timeZone: o2.resolvedTimeZone,
2625
+ formatter: o2.formatter
2626
+ };
2627
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : $e(t3);
2628
+ })(), v2 = (() => {
2629
+ if (e2.centerLabel === void 0 || e2.centerLabel === false || o2 === null || o2.innerRadiusFraction <= 0) return null;
2630
+ let t3 = {
2631
+ totalValue: o2.totalValue,
2632
+ formatter: o2.formatter,
2633
+ theme: o2.personalization.theme,
2634
+ palette: o2.personalization.palette
2635
+ }, n3;
2636
+ return n3 = e2.centerLabel === true ? /* @__PURE__ */ Y("div", {
2637
+ style: {
2638
+ textAlign: "center",
2639
+ lineHeight: 1.2
2640
+ },
2641
+ children: [/* @__PURE__ */ J("div", {
2642
+ style: {
2643
+ fontSize: 11,
2644
+ opacity: 0.65
2645
+ },
2646
+ children: "Total"
2647
+ }), /* @__PURE__ */ J("div", {
2648
+ style: {
2649
+ fontSize: 18,
2650
+ fontWeight: 600
2651
+ },
2652
+ children: o2.formatter.formatNumber(o2.totalValue, 2)
2653
+ })]
2654
+ }) : typeof e2.centerLabel == "string" ? e2.centerLabel : e2.centerLabel(t3), /* @__PURE__ */ J("div", {
2655
+ style: {
2656
+ position: "absolute",
2657
+ inset: 0,
2658
+ display: "flex",
2659
+ alignItems: "center",
2660
+ justifyContent: "center",
2661
+ pointerEvents: "none",
2662
+ color: o2.personalization.theme === "dark" ? "rgb(240,242,246)" : "rgb(20,22,26)",
2663
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"
2664
+ },
2665
+ children: n3
2666
+ });
2667
+ })();
2668
+ return /* @__PURE__ */ Y("div", {
2669
+ ref: n2,
2670
+ style: {
2671
+ position: "relative",
2672
+ width: m2,
2673
+ height: h2
2674
+ },
2675
+ "aria-label": g2,
2676
+ onPointerMove: f2,
2677
+ onPointerLeave: p2,
2678
+ children: [
2679
+ /* @__PURE__ */ J("canvas", {
2680
+ ref: r2,
2681
+ style: {
2682
+ display: "block",
2683
+ width: m2,
2684
+ height: h2
2685
+ },
2686
+ "aria-hidden": "true"
2687
+ }),
2688
+ /* @__PURE__ */ J("canvas", {
2689
+ ref: i2,
2690
+ style: {
2691
+ display: "block",
2692
+ width: m2,
2693
+ height: h2,
2694
+ position: "absolute",
2695
+ inset: 0,
2696
+ pointerEvents: "none"
2697
+ },
2698
+ "aria-hidden": "true"
2699
+ }),
2700
+ v2,
2701
+ _2
2702
+ ]
2703
+ });
2704
+ }
2705
+ function Ze(e2) {
2706
+ let t2 = (0, Z.c)(2), n2;
2707
+ return t2[0] === e2 ? n2 = t2[1] : (n2 = /* @__PURE__ */ J(Xe, {
2708
+ ...e2,
2709
+ innerRadiusDefault: 0
2710
+ }), t2[0] = e2, t2[1] = n2), n2;
2711
+ }
2712
+ function Qe(e2) {
2713
+ let t2 = (0, Z.c)(2), n2;
2714
+ return t2[0] === e2 ? n2 = t2[1] : (n2 = /* @__PURE__ */ J(Xe, {
2715
+ ...e2,
2716
+ innerRadiusDefault: 0.5
2717
+ }), t2[0] = e2, t2[1] = n2), n2;
2718
+ }
2719
+ function $e(e2) {
2720
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", r2 = t2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", i2 = t2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", a2 = t2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", o2 = t2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)";
2721
+ return /* @__PURE__ */ Y("div", {
2722
+ role: "tooltip",
2723
+ style: {
2724
+ position: "absolute",
2725
+ left: Math.min(e2.containerWidth - 180, e2.pointerX + 12),
2726
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
2727
+ background: n2,
2728
+ color: r2,
2729
+ border: `1px solid ${a2}`,
2730
+ borderRadius: 6,
2731
+ boxShadow: o2,
2732
+ padding: "6px 8px",
2733
+ fontSize: 12,
2734
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2735
+ pointerEvents: "none",
2736
+ minWidth: 160
2737
+ },
2738
+ children: [
2739
+ /* @__PURE__ */ Y("div", {
2740
+ style: {
2741
+ color: i2,
2742
+ fontSize: 10,
2743
+ marginBottom: 2,
2744
+ display: "flex",
2745
+ alignItems: "center",
2746
+ gap: 5
2747
+ },
2748
+ children: [/* @__PURE__ */ J("span", {
2749
+ "aria-hidden": "true",
2750
+ style: {
2751
+ width: 10,
2752
+ height: 10,
2753
+ borderRadius: 5,
2754
+ background: e2.color,
2755
+ display: "inline-block"
2756
+ }
2757
+ }), /* @__PURE__ */ J("span", { children: e2.name })]
2758
+ }),
2759
+ /* @__PURE__ */ Y("div", { children: ["value: ", e2.formatter.formatNumber(e2.value, 2)] }),
2760
+ /* @__PURE__ */ Y("div", { children: [
2761
+ "percent: ",
2762
+ (e2.percent * 100).toFixed(1),
2763
+ "%"
2764
+ ] })
2765
+ ]
2766
+ });
2767
+ }
2768
+ function et(e2) {
2769
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
2770
+ theme: t2.theme,
2771
+ palette: t2.palette,
2772
+ locale: t2.locale,
2773
+ timeZone: t2.timeZone,
2774
+ visualStyle: t2.visualStyle,
2775
+ outlineFillColor: t2.outlineFillColor,
2776
+ outlineFillOpacity: t2.outlineFillOpacity,
2777
+ cornerRadius: t2.cornerRadius,
2778
+ borderWidth: t2.borderWidth,
2779
+ accents: t2.accents,
2780
+ osTheme: t2.osTheme,
2781
+ appTheme: t2.appTheme
2782
+ }), [
2783
+ t2.theme,
2784
+ t2.palette,
2785
+ t2.locale,
2786
+ t2.timeZone,
2787
+ t2.visualStyle,
2788
+ t2.outlineFillColor,
2789
+ t2.outlineFillOpacity,
2790
+ t2.cornerRadius,
2791
+ t2.borderWidth,
2792
+ t2.accents,
2793
+ t2.osTheme,
2794
+ t2.appTheme
2795
+ ]);
2796
+ q.useEffect(() => {
2797
+ let t3 = r2.current;
2798
+ if (t3 === null) return;
2799
+ let o3 = new _({
2800
+ container: n2.current,
2801
+ staticCanvas: t3,
2802
+ dynamicCanvas: i2.current,
2803
+ initialProps: e2,
2804
+ initialProvider: u2,
2805
+ onContextChange: s2,
2806
+ onHoverChange: l2
2807
+ });
2808
+ return a2.current = o3, () => {
2809
+ a2.current = null, o3.dispose();
2810
+ };
2811
+ }, []), q.useEffect(() => {
2812
+ a2.current?.update(e2, u2);
2813
+ });
2814
+ let d2 = q.useCallback((e3) => {
2815
+ a2.current?.handlePointerMove(e3.nativeEvent);
2816
+ }, []), f2 = q.useCallback(() => {
2817
+ a2.current?.handlePointerLeave();
2818
+ }, []), p2 = q.useCallback((e3) => {
2819
+ a2.current?.handleClick(e3.nativeEvent);
2820
+ }, []), m2 = e2.width ?? 600, h2 = e2.height ?? 400, g2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Treemap", v2 = c2 === null || o2 === null ? null : (() => {
2821
+ let t3 = {
2822
+ idx: c2.idx,
2823
+ name: c2.name,
2824
+ value: c2.value,
2825
+ percent: c2.percent,
2826
+ depth: c2.depth,
2827
+ path: c2.path,
2828
+ color: c2.color,
2829
+ pointerX: c2.pointerX,
2830
+ pointerY: c2.pointerY,
2831
+ containerWidth: m2,
2832
+ containerHeight: h2,
2833
+ theme: o2.personalization.theme,
2834
+ palette: o2.personalization.palette,
2835
+ locale: o2.resolvedLocaleBase,
2836
+ timeZone: o2.resolvedTimeZone,
2837
+ formatter: o2.formatter
2838
+ };
2839
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : tt(t3);
2840
+ })(), y2 = (() => {
2841
+ if (o2 === null || !o2.showBreadcrumb) return null;
2842
+ let e3 = o2.personalization.theme === "dark", t3 = ["root", ...o2.currentPath];
2843
+ return /* @__PURE__ */ J("div", {
2844
+ style: {
2845
+ position: "absolute",
2846
+ left: 8,
2847
+ top: 6,
2848
+ display: "flex",
2849
+ gap: 4,
2850
+ alignItems: "center",
2851
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2852
+ fontSize: 11,
2853
+ color: e3 ? "rgba(240,242,246,0.85)" : "rgba(20,22,26,0.75)",
2854
+ background: e3 ? "rgba(34,36,42,0.85)" : "rgba(255,255,255,0.85)",
2855
+ border: `1px solid ${e3 ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)"}`,
2856
+ borderRadius: 4,
2857
+ padding: "3px 6px",
2858
+ pointerEvents: "auto"
2859
+ },
2860
+ role: "navigation",
2861
+ children: t3.map((e4, n3) => /* @__PURE__ */ Y(q.Fragment, { children: [n3 > 0 && /* @__PURE__ */ J("span", {
2862
+ style: { opacity: 0.5 },
2863
+ children: "\u203A"
2864
+ }), /* @__PURE__ */ J("button", {
2865
+ type: "button",
2866
+ onClick: () => a2.current?.setPath(t3.slice(1, n3 + 1)),
2867
+ style: {
2868
+ background: "none",
2869
+ border: "none",
2870
+ padding: 0,
2871
+ color: "inherit",
2872
+ fontSize: "inherit",
2873
+ cursor: n3 === t3.length - 1 ? "default" : "pointer",
2874
+ fontWeight: n3 === t3.length - 1 ? 600 : 400
2875
+ },
2876
+ children: e4
2877
+ })] }, n3))
2878
+ });
2879
+ })();
2880
+ return /* @__PURE__ */ Y("div", {
2881
+ ref: n2,
2882
+ style: {
2883
+ position: "relative",
2884
+ width: m2,
2885
+ height: h2
2886
+ },
2887
+ "aria-label": g2,
2888
+ onPointerMove: d2,
2889
+ onPointerLeave: f2,
2890
+ onClick: p2,
2891
+ children: [
2892
+ /* @__PURE__ */ J("canvas", {
2893
+ ref: r2,
2894
+ style: {
2895
+ display: "block",
2896
+ width: m2,
2897
+ height: h2
2898
+ },
2899
+ "aria-hidden": "true"
2900
+ }),
2901
+ /* @__PURE__ */ J("canvas", {
2902
+ ref: i2,
2903
+ style: {
2904
+ display: "block",
2905
+ width: m2,
2906
+ height: h2,
2907
+ position: "absolute",
2908
+ inset: 0,
2909
+ pointerEvents: "none"
2910
+ },
2911
+ "aria-hidden": "true"
2912
+ }),
2913
+ y2,
2914
+ v2
2915
+ ]
2916
+ });
2917
+ }
2918
+ function tt(e2) {
2919
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", r2 = t2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", i2 = t2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", a2 = t2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", o2 = t2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)";
2920
+ return /* @__PURE__ */ Y("div", {
2921
+ role: "tooltip",
2922
+ style: {
2923
+ position: "absolute",
2924
+ left: Math.min(e2.containerWidth - 200, e2.pointerX + 12),
2925
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
2926
+ background: n2,
2927
+ color: r2,
2928
+ border: `1px solid ${a2}`,
2929
+ borderRadius: 6,
2930
+ boxShadow: o2,
2931
+ padding: "6px 8px",
2932
+ fontSize: 12,
2933
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
2934
+ pointerEvents: "none",
2935
+ minWidth: 180
2936
+ },
2937
+ children: [
2938
+ /* @__PURE__ */ J("div", {
2939
+ style: {
2940
+ color: i2,
2941
+ fontSize: 10,
2942
+ marginBottom: 2
2943
+ },
2944
+ children: e2.path.join(" \u203A ")
2945
+ }),
2946
+ /* @__PURE__ */ Y("div", {
2947
+ style: {
2948
+ display: "flex",
2949
+ alignItems: "center",
2950
+ gap: 5
2951
+ },
2952
+ children: [/* @__PURE__ */ J("span", {
2953
+ "aria-hidden": "true",
2954
+ style: {
2955
+ width: 10,
2956
+ height: 10,
2957
+ borderRadius: 2,
2958
+ background: e2.color,
2959
+ display: "inline-block"
2960
+ }
2961
+ }), /* @__PURE__ */ J("span", {
2962
+ style: { fontWeight: 600 },
2963
+ children: e2.name
2964
+ })]
2965
+ }),
2966
+ /* @__PURE__ */ Y("div", { children: ["value: ", e2.formatter.formatNumber(e2.value, 2)] }),
2967
+ /* @__PURE__ */ Y("div", { children: [
2968
+ "percent: ",
2969
+ (e2.percent * 100).toFixed(1),
2970
+ "%"
2971
+ ] })
2972
+ ]
2973
+ });
2974
+ }
2975
+ function nt(e2) {
2976
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
2977
+ theme: t2.theme,
2978
+ palette: t2.palette,
2979
+ locale: t2.locale,
2980
+ timeZone: t2.timeZone,
2981
+ visualStyle: t2.visualStyle,
2982
+ outlineFillColor: t2.outlineFillColor,
2983
+ outlineFillOpacity: t2.outlineFillOpacity,
2984
+ cornerRadius: t2.cornerRadius,
2985
+ borderWidth: t2.borderWidth,
2986
+ accents: t2.accents,
2987
+ osTheme: t2.osTheme,
2988
+ appTheme: t2.appTheme
2989
+ }), [
2990
+ t2.theme,
2991
+ t2.palette,
2992
+ t2.locale,
2993
+ t2.timeZone,
2994
+ t2.visualStyle,
2995
+ t2.outlineFillColor,
2996
+ t2.outlineFillOpacity,
2997
+ t2.cornerRadius,
2998
+ t2.borderWidth,
2999
+ t2.accents,
3000
+ t2.osTheme,
3001
+ t2.appTheme
3002
+ ]);
3003
+ q.useEffect(() => {
3004
+ let t3 = r2.current;
3005
+ if (t3 === null) return;
3006
+ let o3 = new h({
3007
+ container: n2.current,
3008
+ staticCanvas: t3,
3009
+ dynamicCanvas: i2.current,
3010
+ initialProps: e2,
3011
+ initialProvider: u2,
3012
+ onContextChange: s2,
3013
+ onHoverChange: l2
3014
+ });
3015
+ return a2.current = o3, () => {
3016
+ a2.current = null, o3.dispose();
3017
+ };
3018
+ }, []), q.useEffect(() => {
3019
+ a2.current?.update(e2, u2);
3020
+ });
3021
+ let d2 = q.useCallback((e3) => {
3022
+ a2.current?.handlePointerMove(e3.nativeEvent);
3023
+ }, []), f2 = q.useCallback(() => {
3024
+ a2.current?.handlePointerLeave();
3025
+ }, []), p2 = q.useCallback((e3) => {
3026
+ a2.current?.handleClick(e3.nativeEvent);
3027
+ }, []), m2 = e2.width ?? 480, g2 = e2.height ?? 480, _2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Sunburst", v2 = c2 === null || o2 === null ? null : (() => {
3028
+ let t3 = {
3029
+ idx: c2.idx,
3030
+ name: c2.name,
3031
+ value: c2.value,
3032
+ percent: c2.percent,
3033
+ depth: c2.depth,
3034
+ path: c2.path,
3035
+ color: c2.color,
3036
+ pointerX: c2.pointerX,
3037
+ pointerY: c2.pointerY,
3038
+ containerWidth: m2,
3039
+ containerHeight: g2,
3040
+ theme: o2.personalization.theme,
3041
+ palette: o2.personalization.palette,
3042
+ locale: o2.resolvedLocaleBase,
3043
+ timeZone: o2.resolvedTimeZone,
3044
+ formatter: o2.formatter
3045
+ };
3046
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : rt(t3);
3047
+ })(), y2 = (() => {
3048
+ if (e2.centerLabel === void 0 || e2.centerLabel === false || o2 === null) return null;
3049
+ let t3 = o2.personalization.theme === "dark", n3;
3050
+ return n3 = e2.centerLabel === true ? /* @__PURE__ */ Y("div", {
3051
+ style: {
3052
+ textAlign: "center",
3053
+ lineHeight: 1.2
3054
+ },
3055
+ children: [/* @__PURE__ */ J("div", {
3056
+ style: {
3057
+ fontSize: 10,
3058
+ opacity: 0.6
3059
+ },
3060
+ children: "Total"
3061
+ }), /* @__PURE__ */ J("div", {
3062
+ style: {
3063
+ fontSize: 18,
3064
+ fontWeight: 600
3065
+ },
3066
+ children: o2.formatter.formatNumber(o2.totalValue, 0)
3067
+ })]
3068
+ }) : e2.centerLabel, /* @__PURE__ */ J("div", {
3069
+ style: {
3070
+ position: "absolute",
3071
+ inset: 0,
3072
+ display: "flex",
3073
+ alignItems: "center",
3074
+ justifyContent: "center",
3075
+ pointerEvents: "none",
3076
+ color: t3 ? "rgb(240,242,246)" : "rgb(20,22,26)",
3077
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"
3078
+ },
3079
+ children: n3
3080
+ });
3081
+ })();
3082
+ return /* @__PURE__ */ Y("div", {
3083
+ ref: n2,
3084
+ style: {
3085
+ position: "relative",
3086
+ width: m2,
3087
+ height: g2
3088
+ },
3089
+ "aria-label": _2,
3090
+ onPointerMove: d2,
3091
+ onPointerLeave: f2,
3092
+ onClick: p2,
3093
+ children: [
3094
+ /* @__PURE__ */ J("canvas", {
3095
+ ref: r2,
3096
+ style: {
3097
+ display: "block",
3098
+ width: m2,
3099
+ height: g2
3100
+ },
3101
+ "aria-hidden": "true"
3102
+ }),
3103
+ /* @__PURE__ */ J("canvas", {
3104
+ ref: i2,
3105
+ style: {
3106
+ display: "block",
3107
+ width: m2,
3108
+ height: g2,
3109
+ position: "absolute",
3110
+ inset: 0,
3111
+ pointerEvents: "none"
3112
+ },
3113
+ "aria-hidden": "true"
3114
+ }),
3115
+ y2,
3116
+ v2
3117
+ ]
3118
+ });
3119
+ }
3120
+ function rt(e2) {
3121
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34, 36, 42)" : "rgb(255, 255, 255)", r2 = t2 ? "rgb(240, 242, 246)" : "rgb(20, 22, 26)", i2 = t2 ? "rgba(240, 242, 246, 0.62)" : "rgba(20, 22, 26, 0.56)", a2 = t2 ? "rgba(255, 255, 255, 0.08)" : "rgba(15, 18, 23, 0.08)", o2 = t2 ? "0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.40)" : "0 8px 24px rgba(15, 18, 23, 0.10), 0 2px 6px rgba(15, 18, 23, 0.06)";
3122
+ return /* @__PURE__ */ Y("div", {
3123
+ role: "tooltip",
3124
+ style: {
3125
+ position: "absolute",
3126
+ left: Math.min(e2.containerWidth - 200, e2.pointerX + 12),
3127
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
3128
+ background: n2,
3129
+ color: r2,
3130
+ border: `1px solid ${a2}`,
3131
+ borderRadius: 6,
3132
+ boxShadow: o2,
3133
+ padding: "6px 8px",
3134
+ fontSize: 12,
3135
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
3136
+ pointerEvents: "none",
3137
+ minWidth: 180
3138
+ },
3139
+ children: [
3140
+ /* @__PURE__ */ J("div", {
3141
+ style: {
3142
+ color: i2,
3143
+ fontSize: 10,
3144
+ marginBottom: 2
3145
+ },
3146
+ children: e2.path.join(" \u203A ")
3147
+ }),
3148
+ /* @__PURE__ */ Y("div", {
3149
+ style: {
3150
+ display: "flex",
3151
+ alignItems: "center",
3152
+ gap: 5
3153
+ },
3154
+ children: [/* @__PURE__ */ J("span", {
3155
+ "aria-hidden": "true",
3156
+ style: {
3157
+ width: 10,
3158
+ height: 10,
3159
+ borderRadius: 5,
3160
+ background: e2.color,
3161
+ display: "inline-block"
3162
+ }
3163
+ }), /* @__PURE__ */ J("span", {
3164
+ style: { fontWeight: 600 },
3165
+ children: e2.name
3166
+ })]
3167
+ }),
3168
+ /* @__PURE__ */ Y("div", { children: ["value: ", e2.formatter.formatNumber(e2.value, 2)] }),
3169
+ /* @__PURE__ */ Y("div", { children: [
3170
+ "percent: ",
3171
+ (e2.percent * 100).toFixed(1),
3172
+ "%"
3173
+ ] })
3174
+ ]
3175
+ });
3176
+ }
3177
+ function it(e2) {
3178
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
3179
+ theme: t2.theme,
3180
+ palette: t2.palette,
3181
+ locale: t2.locale,
3182
+ timeZone: t2.timeZone,
3183
+ visualStyle: t2.visualStyle,
3184
+ outlineFillColor: t2.outlineFillColor,
3185
+ outlineFillOpacity: t2.outlineFillOpacity,
3186
+ cornerRadius: t2.cornerRadius,
3187
+ borderWidth: t2.borderWidth,
3188
+ accents: t2.accents,
3189
+ osTheme: t2.osTheme,
3190
+ appTheme: t2.appTheme
3191
+ }), [
3192
+ t2.theme,
3193
+ t2.palette,
3194
+ t2.locale,
3195
+ t2.timeZone,
3196
+ t2.visualStyle,
3197
+ t2.outlineFillColor,
3198
+ t2.outlineFillOpacity,
3199
+ t2.cornerRadius,
3200
+ t2.borderWidth,
3201
+ t2.accents,
3202
+ t2.osTheme,
3203
+ t2.appTheme
3204
+ ]);
3205
+ q.useEffect(() => {
3206
+ let t3 = r2.current;
3207
+ if (t3 === null) return;
3208
+ let o3 = new F({
3209
+ container: n2.current,
3210
+ staticCanvas: t3,
3211
+ dynamicCanvas: i2.current,
3212
+ initialProps: e2,
3213
+ initialProvider: u2,
3214
+ onContextChange: s2,
3215
+ onHoverChange: l2
3216
+ });
3217
+ return a2.current = o3, () => {
3218
+ a2.current = null, o3.dispose();
3219
+ };
3220
+ }, []), q.useEffect(() => {
3221
+ a2.current?.update(e2, u2);
3222
+ });
3223
+ let d2 = q.useCallback((e3) => {
3224
+ a2.current?.handlePointerMove(e3.nativeEvent);
3225
+ }, []), f2 = q.useCallback(() => {
3226
+ a2.current?.handlePointerLeave();
3227
+ }, []), p2 = e2.width ?? 800, m2 = e2.height ?? 400, h2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Renko chart", g2 = c2 === null || o2 === null ? null : (() => {
3228
+ let t3 = {
3229
+ idx: c2.idx,
3230
+ direction: c2.direction,
3231
+ bottomPrice: c2.bottomPrice,
3232
+ topPrice: c2.topPrice,
3233
+ sourceTime: c2.sourceTime,
3234
+ pointerX: c2.pointerX,
3235
+ pointerY: c2.pointerY,
3236
+ containerWidth: p2,
3237
+ containerHeight: m2,
3238
+ theme: o2.personalization.theme,
3239
+ palette: o2.personalization.palette,
3240
+ locale: o2.resolvedLocaleBase,
3241
+ timeZone: o2.resolvedTimeZone,
3242
+ formatter: o2.formatter
3243
+ };
3244
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : at(t3);
3245
+ })();
3246
+ return /* @__PURE__ */ Y("div", {
3247
+ ref: n2,
3248
+ style: {
3249
+ position: "relative",
3250
+ width: p2,
3251
+ height: m2
3252
+ },
3253
+ "aria-label": h2,
3254
+ onPointerMove: d2,
3255
+ onPointerLeave: f2,
3256
+ children: [
3257
+ /* @__PURE__ */ J("canvas", {
3258
+ ref: r2,
3259
+ style: {
3260
+ display: "block",
3261
+ width: p2,
3262
+ height: m2
3263
+ },
3264
+ "aria-hidden": "true"
3265
+ }),
3266
+ /* @__PURE__ */ J("canvas", {
3267
+ ref: i2,
3268
+ style: {
3269
+ display: "block",
3270
+ width: p2,
3271
+ height: m2,
3272
+ position: "absolute",
3273
+ inset: 0,
3274
+ pointerEvents: "none"
3275
+ },
3276
+ "aria-hidden": "true"
3277
+ }),
3278
+ g2
3279
+ ]
3280
+ });
3281
+ }
3282
+ function at(e2) {
3283
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34,36,42)" : "rgb(255,255,255)", r2 = t2 ? "rgb(240,242,246)" : "rgb(20,22,26)", i2 = t2 ? "rgba(240,242,246,0.62)" : "rgba(20,22,26,0.56)", a2 = t2 ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)";
3284
+ return /* @__PURE__ */ Y("div", {
3285
+ role: "tooltip",
3286
+ style: {
3287
+ position: "absolute",
3288
+ left: Math.min(e2.containerWidth - 180, e2.pointerX + 12),
3289
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
3290
+ background: n2,
3291
+ color: r2,
3292
+ border: `1px solid ${a2}`,
3293
+ borderRadius: 6,
3294
+ padding: "6px 8px",
3295
+ fontSize: 12,
3296
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
3297
+ pointerEvents: "none",
3298
+ minWidth: 160
3299
+ },
3300
+ children: [
3301
+ /* @__PURE__ */ Y("div", {
3302
+ style: {
3303
+ color: i2,
3304
+ fontSize: 10,
3305
+ marginBottom: 2
3306
+ },
3307
+ children: [
3308
+ e2.direction > 0 ? "\u25B2 Up brick" : "\u25BC Down brick",
3309
+ " \xB7 #",
3310
+ e2.idx
3311
+ ]
3312
+ }),
3313
+ /* @__PURE__ */ Y("div", { children: [
3314
+ "range: ",
3315
+ e2.formatter.formatNumber(e2.bottomPrice, 2),
3316
+ " \u2013",
3317
+ " ",
3318
+ e2.formatter.formatNumber(e2.topPrice, 2)
3319
+ ] }),
3320
+ /* @__PURE__ */ Y("div", { children: ["source: ", e2.formatter.formatDate(e2.sourceTime)] })
3321
+ ]
3322
+ });
3323
+ }
3324
+ function ot(e2) {
3325
+ let t2 = $(), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), o2 = q.useRef(null), [s2, c2] = q.useState(null), [l2, u2] = q.useState(null), d2 = q.useMemo(() => ({
3326
+ theme: t2.theme,
3327
+ palette: t2.palette,
3328
+ locale: t2.locale,
3329
+ timeZone: t2.timeZone,
3330
+ visualStyle: t2.visualStyle,
3331
+ outlineFillColor: t2.outlineFillColor,
3332
+ outlineFillOpacity: t2.outlineFillOpacity,
3333
+ cornerRadius: t2.cornerRadius,
3334
+ borderWidth: t2.borderWidth,
3335
+ accents: t2.accents,
3336
+ osTheme: t2.osTheme,
3337
+ appTheme: t2.appTheme
3338
+ }), [
3339
+ t2.theme,
3340
+ t2.palette,
3341
+ t2.locale,
3342
+ t2.timeZone,
3343
+ t2.visualStyle,
3344
+ t2.outlineFillColor,
3345
+ t2.outlineFillOpacity,
3346
+ t2.cornerRadius,
3347
+ t2.borderWidth,
3348
+ t2.accents,
3349
+ t2.osTheme,
3350
+ t2.appTheme
3351
+ ]);
3352
+ q.useEffect(() => {
3353
+ let t3 = i2.current;
3354
+ if (t3 === null) return;
3355
+ let s3 = new n({
3356
+ container: r2.current,
3357
+ staticCanvas: t3,
3358
+ dynamicCanvas: a2.current,
3359
+ initialProps: e2,
3360
+ initialProvider: d2,
3361
+ onContextChange: c2,
3362
+ onHoverChange: u2
3363
+ });
3364
+ return o2.current = s3, () => {
3365
+ o2.current = null, s3.dispose();
3366
+ };
3367
+ }, []), q.useEffect(() => {
3368
+ o2.current?.update(e2, d2);
3369
+ });
3370
+ let f2 = q.useCallback((e3) => {
3371
+ o2.current?.handlePointerMove(e3.nativeEvent);
3372
+ }, []), p2 = q.useCallback(() => {
3373
+ o2.current?.handlePointerLeave();
3374
+ }, []), m2 = e2.width ?? 800, h2 = e2.height ?? 400, g2 = e2.ariaLabel ?? s2?.ariaLabel ?? "Kagi chart", _2 = l2 === null || s2 === null ? null : (() => {
3375
+ let t3 = {
3376
+ idx: l2.idx,
3377
+ direction: l2.direction,
3378
+ thick: l2.thick,
3379
+ startPrice: l2.startPrice,
3380
+ endPrice: l2.endPrice,
3381
+ pointerX: l2.pointerX,
3382
+ pointerY: l2.pointerY,
3383
+ containerWidth: m2,
3384
+ containerHeight: h2,
3385
+ theme: s2.personalization.theme,
3386
+ palette: s2.personalization.palette,
3387
+ locale: s2.resolvedLocaleBase,
3388
+ timeZone: s2.resolvedTimeZone,
3389
+ formatter: s2.formatter
3390
+ };
3391
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : st(t3);
3392
+ })();
3393
+ return /* @__PURE__ */ Y("div", {
3394
+ ref: r2,
3395
+ style: {
3396
+ position: "relative",
3397
+ width: m2,
3398
+ height: h2
3399
+ },
3400
+ "aria-label": g2,
3401
+ onPointerMove: f2,
3402
+ onPointerLeave: p2,
3403
+ children: [
3404
+ /* @__PURE__ */ J("canvas", {
3405
+ ref: i2,
3406
+ style: {
3407
+ display: "block",
3408
+ width: m2,
3409
+ height: h2
3410
+ },
3411
+ "aria-hidden": "true"
3412
+ }),
3413
+ /* @__PURE__ */ J("canvas", {
3414
+ ref: a2,
3415
+ style: {
3416
+ display: "block",
3417
+ width: m2,
3418
+ height: h2,
3419
+ position: "absolute",
3420
+ inset: 0,
3421
+ pointerEvents: "none"
3422
+ },
3423
+ "aria-hidden": "true"
3424
+ }),
3425
+ _2
3426
+ ]
3427
+ });
3428
+ }
3429
+ function st(e2) {
3430
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34,36,42)" : "rgb(255,255,255)", r2 = t2 ? "rgb(240,242,246)" : "rgb(20,22,26)", i2 = t2 ? "rgba(240,242,246,0.62)" : "rgba(20,22,26,0.56)", a2 = t2 ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)";
3431
+ return /* @__PURE__ */ Y("div", {
3432
+ role: "tooltip",
3433
+ style: {
3434
+ position: "absolute",
3435
+ left: Math.min(e2.containerWidth - 180, e2.pointerX + 12),
3436
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
3437
+ background: n2,
3438
+ color: r2,
3439
+ border: `1px solid ${a2}`,
3440
+ borderRadius: 6,
3441
+ padding: "6px 8px",
3442
+ fontSize: 12,
3443
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
3444
+ pointerEvents: "none",
3445
+ minWidth: 160
3446
+ },
3447
+ children: [/* @__PURE__ */ Y("div", {
3448
+ style: {
3449
+ color: i2,
3450
+ fontSize: 10,
3451
+ marginBottom: 2
3452
+ },
3453
+ children: [
3454
+ e2.thick ? "Yang" : "Yin",
3455
+ " \xB7 ",
3456
+ e2.direction > 0 ? "\u25B2" : "\u25BC",
3457
+ " \xB7 leg #",
3458
+ e2.idx
3459
+ ]
3460
+ }), /* @__PURE__ */ Y("div", { children: [
3461
+ e2.formatter.formatNumber(e2.startPrice, 2),
3462
+ " \u2192",
3463
+ " ",
3464
+ e2.formatter.formatNumber(e2.endPrice, 2)
3465
+ ] })]
3466
+ });
3467
+ }
3468
+ function ct(e2) {
3469
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
3470
+ theme: t2.theme,
3471
+ palette: t2.palette,
3472
+ locale: t2.locale,
3473
+ timeZone: t2.timeZone,
3474
+ visualStyle: t2.visualStyle,
3475
+ outlineFillColor: t2.outlineFillColor,
3476
+ outlineFillOpacity: t2.outlineFillOpacity,
3477
+ cornerRadius: t2.cornerRadius,
3478
+ borderWidth: t2.borderWidth,
3479
+ accents: t2.accents,
3480
+ osTheme: t2.osTheme,
3481
+ appTheme: t2.appTheme
3482
+ }), [
3483
+ t2.theme,
3484
+ t2.palette,
3485
+ t2.locale,
3486
+ t2.timeZone,
3487
+ t2.visualStyle,
3488
+ t2.outlineFillColor,
3489
+ t2.outlineFillOpacity,
3490
+ t2.cornerRadius,
3491
+ t2.borderWidth,
3492
+ t2.accents,
3493
+ t2.osTheme,
3494
+ t2.appTheme
3495
+ ]);
3496
+ q.useEffect(() => {
3497
+ let t3 = r2.current;
3498
+ if (t3 === null) return;
3499
+ let o3 = new L({
3500
+ container: n2.current,
3501
+ staticCanvas: t3,
3502
+ dynamicCanvas: i2.current,
3503
+ initialProps: e2,
3504
+ initialProvider: u2,
3505
+ onContextChange: s2,
3506
+ onHoverChange: l2
3507
+ });
3508
+ return a2.current = o3, () => {
3509
+ a2.current = null, o3.dispose();
3510
+ };
3511
+ }, []), q.useEffect(() => {
3512
+ a2.current?.update(e2, u2);
3513
+ });
3514
+ let d2 = q.useCallback((e3) => {
3515
+ a2.current?.handlePointerMove(e3.nativeEvent);
3516
+ }, []), f2 = q.useCallback(() => {
3517
+ a2.current?.handlePointerLeave();
3518
+ }, []), p2 = e2.width ?? 800, m2 = e2.height ?? 400, h2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Point and figure chart", g2 = c2 === null || o2 === null ? null : (() => {
3519
+ let t3 = {
3520
+ idx: c2.idx,
3521
+ direction: c2.direction,
3522
+ bottomBox: c2.bottomBox,
3523
+ topBox: c2.topBox,
3524
+ pointerX: c2.pointerX,
3525
+ pointerY: c2.pointerY,
3526
+ containerWidth: p2,
3527
+ containerHeight: m2,
3528
+ theme: o2.personalization.theme,
3529
+ palette: o2.personalization.palette,
3530
+ locale: o2.resolvedLocaleBase,
3531
+ timeZone: o2.resolvedTimeZone,
3532
+ formatter: o2.formatter
3533
+ };
3534
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : lt(t3);
3535
+ })();
3536
+ return /* @__PURE__ */ Y("div", {
3537
+ ref: n2,
3538
+ style: {
3539
+ position: "relative",
3540
+ width: p2,
3541
+ height: m2
3542
+ },
3543
+ "aria-label": h2,
3544
+ onPointerMove: d2,
3545
+ onPointerLeave: f2,
3546
+ children: [
3547
+ /* @__PURE__ */ J("canvas", {
3548
+ ref: r2,
3549
+ style: {
3550
+ display: "block",
3551
+ width: p2,
3552
+ height: m2
3553
+ },
3554
+ "aria-hidden": "true"
3555
+ }),
3556
+ /* @__PURE__ */ J("canvas", {
3557
+ ref: i2,
3558
+ style: {
3559
+ display: "block",
3560
+ width: p2,
3561
+ height: m2,
3562
+ position: "absolute",
3563
+ inset: 0,
3564
+ pointerEvents: "none"
3565
+ },
3566
+ "aria-hidden": "true"
3567
+ }),
3568
+ g2
3569
+ ]
3570
+ });
3571
+ }
3572
+ function lt(e2) {
3573
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34,36,42)" : "rgb(255,255,255)", r2 = t2 ? "rgb(240,242,246)" : "rgb(20,22,26)", i2 = t2 ? "rgba(240,242,246,0.62)" : "rgba(20,22,26,0.56)", a2 = t2 ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)";
3574
+ return /* @__PURE__ */ Y("div", {
3575
+ role: "tooltip",
3576
+ style: {
3577
+ position: "absolute",
3578
+ left: Math.min(e2.containerWidth - 180, e2.pointerX + 12),
3579
+ top: Math.min(e2.containerHeight - 80, e2.pointerY + 12),
3580
+ background: n2,
3581
+ color: r2,
3582
+ border: `1px solid ${a2}`,
3583
+ borderRadius: 6,
3584
+ padding: "6px 8px",
3585
+ fontSize: 12,
3586
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
3587
+ pointerEvents: "none",
3588
+ minWidth: 160
3589
+ },
3590
+ children: [/* @__PURE__ */ Y("div", {
3591
+ style: {
3592
+ color: i2,
3593
+ fontSize: 10,
3594
+ marginBottom: 2
3595
+ },
3596
+ children: [
3597
+ e2.direction > 0 ? "X (up column)" : "O (down column)",
3598
+ " \xB7 #",
3599
+ e2.idx
3600
+ ]
3601
+ }), /* @__PURE__ */ Y("div", { children: [
3602
+ "range: ",
3603
+ e2.formatter.formatNumber(e2.bottomBox, 2),
3604
+ " \u2013",
3605
+ " ",
3606
+ e2.formatter.formatNumber(e2.topBox, 2)
3607
+ ] })]
3608
+ });
3609
+ }
3610
+ var ut = class extends Error {
3611
+ name = "SankeyCycleError";
3612
+ };
3613
+ function dt(e2) {
3614
+ let t2 = e2.nodes.length, n2 = e2.links.length, r2 = Array.from({ length: t2 }, () => ""), i2 = Array.from({ length: t2 }, () => ""), a2 = Array.from({ length: t2 }, () => null), o2 = Array.from({ length: t2 }, () => null), s2 = /* @__PURE__ */ new Map();
3615
+ for (let n3 = 0; n3 < t2; n3++) {
3616
+ let t3 = e2.nodes[n3];
3617
+ r2[n3] = t3.id, i2[n3] = t3.name ?? t3.id, a2[n3] = t3.color ?? null, o2[n3] = t3.label ?? null, s2.set(t3.id, n3);
3618
+ }
3619
+ let c2 = new Int32Array(n2), l2 = new Int32Array(n2), u2 = new Float64Array(n2), d2 = Array.from({ length: n2 }, () => null), f2 = new Float64Array(n2).fill(NaN);
3620
+ for (let r3 = 0; r3 < n2; r3++) {
3621
+ let n3 = e2.links[r3], i3 = typeof n3.source == "number" ? n3.source : s2.get(n3.source), a3 = typeof n3.target == "number" ? n3.target : s2.get(n3.target);
3622
+ if (i3 === void 0 || a3 === void 0 || i3 < 0 || a3 < 0 || i3 >= t2 || a3 >= t2) throw Error(`SankeyChart: link[${r3}] references unknown node (source=${String(n3.source)}, target=${String(n3.target)}).`);
3623
+ c2[r3] = i3, l2[r3] = a3, u2[r3] = n3.value, d2[r3] = n3.color ?? null, n3.opacity !== void 0 && (f2[r3] = n3.opacity);
3624
+ }
3625
+ let p2 = new Int32Array(t2);
3626
+ for (let e3 = 0; e3 < n2; e3++) {
3627
+ let t3 = l2[e3];
3628
+ p2[t3] = p2[t3] + 1;
3629
+ }
3630
+ let m2 = new Int32Array(t2), h2 = [];
3631
+ for (let e3 = 0; e3 < t2; e3++) p2[e3] === 0 && h2.push(e3);
3632
+ let g2 = Array.from({ length: t2 }, () => []);
3633
+ for (let e3 = 0; e3 < n2; e3++) g2[c2[e3]].push(e3);
3634
+ let _2 = 0;
3635
+ for (; h2.length > 0; ) {
3636
+ let e3 = h2.shift();
3637
+ _2++;
3638
+ let t3 = g2[e3];
3639
+ for (let n3 = 0; n3 < t3.length; n3++) {
3640
+ let r3 = l2[t3[n3]], i3 = m2[e3] + 1;
3641
+ i3 > m2[r3] && (m2[r3] = i3);
3642
+ let a3 = p2[r3] - 1;
3643
+ p2[r3] = a3, a3 === 0 && h2.push(r3);
3644
+ }
3645
+ }
3646
+ if (_2 < t2) throw new ut("SankeyChart: input contains a cycle (the flow graph must be acyclic).");
3647
+ let v2 = 0;
3648
+ for (let e3 = 0; e3 < t2; e3++) m2[e3] > v2 && (v2 = m2[e3]);
3649
+ let y2 = new Float64Array(t2), b2 = new Float64Array(t2), x2 = new Float64Array(t2);
3650
+ for (let e3 = 0; e3 < n2; e3++) b2[l2[e3]] += u2[e3], x2[c2[e3]] += u2[e3];
3651
+ for (let e3 = 0; e3 < t2; e3++) y2[e3] = Math.max(b2[e3], x2[e3]);
3652
+ return {
3653
+ nodeCount: t2,
3654
+ linkCount: n2,
3655
+ nodeIds: r2,
3656
+ nodeNames: i2,
3657
+ nodeColorOverrides: a2,
3658
+ nodeLabelOverrides: o2,
3659
+ nodeValues: y2,
3660
+ depths: m2,
3661
+ maxDepth: v2,
3662
+ linkSources: c2,
3663
+ linkTargets: l2,
3664
+ linkValues: u2,
3665
+ linkColorOverrides: d2,
3666
+ linkOpacityOverrides: f2
3667
+ };
3668
+ }
3669
+ function ft(e2, t2) {
3670
+ let { x0: n2, y0: r2, x1: i2, y1: a2, nodeWidth: o2, nodePadding: s2, alignment: c2, iterations: l2 } = t2, u2 = i2 - n2, d2 = a2 - r2, f2 = e2.nodeCount, p2 = e2.maxDepth + 1, m2 = new Float64Array(f2), h2 = new Float64Array(f2);
3671
+ if (p2 === 1) {
3672
+ let e3 = (n2 + i2) / 2;
3673
+ for (let t3 = 0; t3 < f2; t3++) m2[t3] = e3 - o2 / 2, h2[t3] = e3 + o2 / 2;
3674
+ } else {
3675
+ let t3 = p2 > 1 ? (u2 - o2) / (p2 - 1) : 0;
3676
+ for (let r3 = 0; r3 < f2; r3++) {
3677
+ let a3 = e2.depths[r3], l3;
3678
+ switch (c2) {
3679
+ case "left":
3680
+ l3 = n2 + a3 * (o2 + s2);
3681
+ break;
3682
+ case "right":
3683
+ l3 = i2 - o2 - (e2.maxDepth - a3) * (o2 + s2);
3684
+ break;
3685
+ case "center":
3686
+ l3 = n2 + (u2 - (p2 * o2 + (p2 - 1) * s2)) / 2 + a3 * (o2 + s2);
3687
+ break;
3688
+ default:
3689
+ l3 = n2 + a3 * t3;
3690
+ }
3691
+ m2[r3] = l3, h2[r3] = l3 + o2;
3692
+ }
3693
+ }
3694
+ let g2 = new Float64Array(f2), _2 = new Float64Array(f2), v2 = Array.from({ length: p2 }, () => []);
3695
+ for (let t3 = 0; t3 < f2; t3++) v2[e2.depths[t3]].push(t3);
3696
+ for (let t3 = 0; t3 < p2; t3++) {
3697
+ let n3 = v2[t3];
3698
+ if (n3.length === 0) continue;
3699
+ let i3 = (n3.length - 1) * s2, a3 = Math.max(0, d2 - i3), o3 = 0;
3700
+ for (let t4 = 0; t4 < n3.length; t4++) o3 += e2.nodeValues[n3[t4]];
3701
+ let c3 = o3 > 0 ? a3 / o3 : 0, l3 = r2;
3702
+ for (let t4 = 0; t4 < n3.length; t4++) {
3703
+ let r3 = n3[t4], i4 = e2.nodeValues[r3] * c3;
3704
+ g2[r3] = l3, _2[r3] = l3 + i4, l3 += i4 + s2;
3705
+ }
3706
+ }
3707
+ for (let t3 = 0; t3 < l2; t3++) pt(e2, v2, g2, _2, "incoming", d2, r2, s2), pt(e2, v2, g2, _2, "outgoing", d2, r2, s2);
3708
+ let y2 = new Float64Array(e2.linkCount), b2 = new Float64Array(e2.linkCount), x2 = new Float64Array(e2.linkCount), S2 = new Float64Array(e2.linkCount), C2 = Array.from({ length: f2 }, () => []), w2 = Array.from({ length: f2 }, () => []);
3709
+ for (let t3 = 0; t3 < e2.linkCount; t3++) C2[e2.linkSources[t3]].push(t3), w2[e2.linkTargets[t3]].push(t3);
3710
+ for (let t3 = 0; t3 < f2; t3++) C2[t3].sort((t4, n3) => g2[e2.linkTargets[t4]] - g2[e2.linkTargets[n3]]), w2[t3].sort((t4, n3) => g2[e2.linkSources[t4]] - g2[e2.linkSources[n3]]);
3711
+ for (let t3 = 0; t3 < f2; t3++) {
3712
+ let n3 = _2[t3] - g2[t3], r3 = e2.nodeValues[t3];
3713
+ if (r3 <= 0) continue;
3714
+ let i3 = n3 / r3, a3 = g2[t3], o3 = C2[t3];
3715
+ for (let t4 = 0; t4 < o3.length; t4++) {
3716
+ let n4 = o3[t4], r4 = e2.linkValues[n4] * i3;
3717
+ y2[n4] = a3, b2[n4] = a3 + r4, a3 += r4;
3718
+ }
3719
+ a3 = g2[t3];
3720
+ let s3 = w2[t3];
3721
+ for (let t4 = 0; t4 < s3.length; t4++) {
3722
+ let n4 = s3[t4], r4 = e2.linkValues[n4] * i3;
3723
+ x2[n4] = a3, S2[n4] = a3 + r4, a3 += r4;
3724
+ }
3725
+ }
3726
+ return {
3727
+ nodeX0: m2,
3728
+ nodeY0: g2,
3729
+ nodeX1: h2,
3730
+ nodeY1: _2,
3731
+ linkSourceY0: y2,
3732
+ linkSourceY1: b2,
3733
+ linkTargetY0: x2,
3734
+ linkTargetY1: S2
3735
+ };
3736
+ }
3737
+ function pt(e2, t2, n2, r2, i2, a2, o2, s2) {
3738
+ for (let c2 = 0; c2 < t2.length; c2++) {
3739
+ let l2 = t2[c2];
3740
+ if (l2.length === 0) continue;
3741
+ for (let t3 = 0; t3 < l2.length; t3++) {
3742
+ let a3 = l2[t3], o3 = 0, s3 = 0;
3743
+ for (let t4 = 0; t4 < e2.linkCount; t4++) {
3744
+ if (!(i2 === "incoming" ? e2.linkTargets[t4] === a3 : e2.linkSources[t4] === a3)) continue;
3745
+ let c3 = i2 === "incoming" ? e2.linkSources[t4] : e2.linkTargets[t4], l3 = (n2[c3] + r2[c3]) / 2, u3 = e2.linkValues[t4];
3746
+ o3 += l3 * u3, s3 += u3;
3747
+ }
3748
+ if (s3 > 0) {
3749
+ let e3 = o3 / s3, t4 = r2[a3] - n2[a3];
3750
+ n2[a3] = e3 - t4 / 2, r2[a3] = e3 + t4 / 2;
3751
+ }
3752
+ }
3753
+ let u2 = [...l2];
3754
+ u2.sort((e3, t3) => n2[e3] - n2[t3]);
3755
+ let d2 = o2;
3756
+ for (let e3 = 0; e3 < u2.length; e3++) {
3757
+ let t3 = u2[e3], i3 = r2[t3] - n2[t3];
3758
+ n2[t3] < d2 && (n2[t3] = d2, r2[t3] = d2 + i3), d2 = r2[t3] + s2;
3759
+ }
3760
+ let f2 = u2[u2.length - 1];
3761
+ if (r2[f2] > o2 + a2) {
3762
+ let e3 = r2[f2] - (o2 + a2), t3 = -e3;
3763
+ for (let i3 = 0; i3 < u2.length; i3++) {
3764
+ let a3 = u2[i3], o3 = r2[a3] - n2[a3];
3765
+ n2[a3] = n2[a3] - e3 + Math.max(0, t3 - (n2[a3] - e3)), r2[a3] = n2[a3] + o3, t3 = r2[a3] + s2;
3766
+ }
3767
+ }
3768
+ }
3769
+ }
3770
+ var mt = {
3771
+ nodeCount: 0,
3772
+ linkCount: 0,
3773
+ nodeIds: [],
3774
+ nodeNames: [],
3775
+ nodeColorOverrides: [],
3776
+ nodeLabelOverrides: [],
3777
+ nodeValues: new Float64Array(),
3778
+ depths: new Int32Array(),
3779
+ maxDepth: 0,
3780
+ linkSources: new Int32Array(),
3781
+ linkTargets: new Int32Array(),
3782
+ linkValues: new Float64Array(),
3783
+ linkColorOverrides: [],
3784
+ linkOpacityOverrides: new Float64Array()
3785
+ }, ht = class {
3786
+ staticCanvas;
3787
+ dynamicCanvas;
3788
+ callbacks;
3789
+ props;
3790
+ providerCtx;
3791
+ handle = null;
3792
+ dynCfg = {
3793
+ crosshairVisible: false,
3794
+ crosshairLineStyle: "dashed",
3795
+ crosshairMarker: "circle"
3796
+ };
3797
+ graph = mt;
3798
+ personalization;
3799
+ resolvedLocale;
3800
+ formatter;
3801
+ resolvedNodeAlignment = "justify";
3802
+ resolvedLinkColor = { kind: "source" };
3803
+ resolvedValueDisplay = "off";
3804
+ resolvedLabelPosition = "auto";
3805
+ resolvedLabelContent;
3806
+ resolvedColorScale = "flat-categorical";
3807
+ nodeColors = [];
3808
+ staticDrawAbort = { cancelled: false };
3809
+ disposed = false;
3810
+ visGate;
3811
+ constructor(e2) {
3812
+ this.staticCanvas = e2.staticCanvas, this.dynamicCanvas = e2.dynamicCanvas, this.callbacks = {
3813
+ onContextChange: e2.onContextChange,
3814
+ onHoverChange: e2.onHoverChange
3815
+ }, this.props = e2.initialProps, this.providerCtx = e2.initialProvider, this.visGate = new k(e2.container ?? null, () => void this.runStaticDraw()), this.resolveDerived(), this.applyDynamicCfgFromProps(), this.runStaticDraw();
3816
+ }
3817
+ update(e2, t2) {
3818
+ this.disposed || e2 === this.props && t2 === this.providerCtx || (this.props = e2, this.providerCtx = t2, this.resolveDerived(), this.applyDynamicCfgFromProps(), this.runStaticDraw());
3819
+ }
3820
+ handlePointerMove(e2) {
3821
+ let t2 = this.handle;
3822
+ if (t2 === null || this.graph.nodeCount === 0) return;
3823
+ let n2 = e2.currentTarget;
3824
+ if (n2 === null) return;
3825
+ let r2 = n2.getBoundingClientRect(), i2 = e2.clientX - r2.left, a2 = e2.clientY - r2.top, o2 = t2.layout.layout;
3826
+ for (let e3 = 0; e3 < this.graph.nodeCount; e3++) if (i2 >= o2.nodeX0[e3] && i2 <= o2.nodeX1[e3] && a2 >= o2.nodeY0[e3] && a2 <= o2.nodeY1[e3]) {
3827
+ let n3 = {
3828
+ pointerX: i2,
3829
+ pointerY: a2,
3830
+ target: {
3831
+ kind: "node",
3832
+ idx: e3,
3833
+ id: this.graph.nodeIds[e3],
3834
+ name: this.graph.nodeNames[e3],
3835
+ value: this.graph.nodeValues[e3]
3836
+ },
3837
+ color: this.nodeColors[e3] ?? "rgba(128,128,128,1)"
3838
+ };
3839
+ this.setHover(n3), vt(t2, n3, this.dynCfg);
3840
+ return;
3841
+ }
3842
+ for (let e3 = 0; e3 < this.graph.linkCount; e3++) {
3843
+ let n3 = this.graph.linkSources[e3], r3 = this.graph.linkTargets[e3], s2 = o2.nodeX1[n3], c2 = o2.nodeX0[r3];
3844
+ if (i2 < s2 || i2 > c2) continue;
3845
+ let l2 = s2 === c2 ? 0 : (i2 - s2) / (c2 - s2), u2 = gt(o2.linkSourceY0[e3], o2.linkTargetY0[e3], l2), d2 = gt(o2.linkSourceY1[e3], o2.linkTargetY1[e3], l2);
3846
+ if (a2 >= u2 && a2 <= d2) {
3847
+ let o3 = {
3848
+ pointerX: i2,
3849
+ pointerY: a2,
3850
+ target: {
3851
+ kind: "link",
3852
+ idx: e3,
3853
+ sourceId: this.graph.nodeIds[n3],
3854
+ targetId: this.graph.nodeIds[r3],
3855
+ value: this.graph.linkValues[e3]
3856
+ },
3857
+ color: this.nodeColors[n3] ?? "rgba(128,128,128,1)"
3858
+ };
3859
+ this.setHover(o3), vt(t2, o3, this.dynCfg);
3860
+ return;
3861
+ }
3862
+ }
3863
+ this.setHover(null), vt(t2, null, this.dynCfg);
3864
+ }
3865
+ handlePointerLeave() {
3866
+ this.setHover(null), this.handle !== null && vt(this.handle, null, this.dynCfg);
3867
+ }
3868
+ dispose() {
3869
+ this.disposed || (this.disposed = true, this.visGate.dispose(), this.staticDrawAbort.cancelled = true, this.handle = null);
3870
+ }
3871
+ setHover(e2) {
3872
+ this.callbacks.onHoverChange(e2);
3873
+ }
3874
+ resolveDerived() {
3875
+ let e2 = this.props, t2 = this.providerCtx, n2 = e2.width ?? 800, r2 = e2.height ?? 400;
3876
+ this.personalization = N({
3877
+ theme: e2.theme ?? t2.theme,
3878
+ palette: e2.palette ?? t2.palette,
3879
+ osTheme: t2.osTheme,
3880
+ appTheme: t2.appTheme,
3881
+ visualStyle: e2.visualStyle ?? t2.visualStyle,
3882
+ outlineFillColor: e2.outlineFillColor ?? t2.outlineFillColor,
3883
+ outlineFillOpacity: e2.outlineFillOpacity ?? t2.outlineFillOpacity,
3884
+ cornerRadius: e2.cornerRadius ?? t2.cornerRadius,
3885
+ borderWidth: e2.borderWidth ?? t2.borderWidth,
3886
+ locale: e2.locale ?? t2.locale,
3887
+ digitGrouping: e2.digitGrouping,
3888
+ numberAbbreviation: e2.numberAbbreviation,
3889
+ decimalPlaces: e2.decimalPlaces,
3890
+ currency: e2.currency,
3891
+ currencyDisplay: e2.currencyDisplay,
3892
+ percentPrecision: e2.percentPrecision,
3893
+ dateFormat: e2.dateFormat,
3894
+ timeFormat: e2.timeFormat,
3895
+ timeZone: e2.timeZone ?? t2.timeZone,
3896
+ glow: e2.glow,
3897
+ glowColor: e2.glowColor,
3898
+ pattern: e2.pattern,
3899
+ patternScale: e2.patternScale,
3900
+ patternColor: e2.patternColor,
3901
+ fastMode: e2.fastMode
3902
+ }), this.resolvedLocale = a(this.personalization.locale), this.formatter = g({
3903
+ locale: this.resolvedLocale,
3904
+ digitGrouping: this.personalization.digitGrouping,
3905
+ numberAbbreviation: this.personalization.numberAbbreviation,
3906
+ decimalPlaces: this.personalization.decimalPlaces,
3907
+ currency: this.personalization.currency ?? this.resolvedLocale.defaultCurrency,
3908
+ currencyDisplay: this.personalization.currencyDisplay,
3909
+ percentPrecision: this.personalization.percentPrecision,
3910
+ dateFormat: this.personalization.dateFormat,
3911
+ timeFormat: this.personalization.timeFormat,
3912
+ timeZone: this.personalization.timeZone
3913
+ }), this.graph = e2.data === void 0 ? mt : dt(e2.data), this.resolvedNodeAlignment = v(e2.nodeAlignment), this.resolvedLinkColor = I(e2.linkColor), this.resolvedValueDisplay = z(e2.valueDisplay), this.resolvedLabelPosition = O(e2.labelPosition), this.resolvedLabelContent = W(e2.labelContent), this.resolvedColorScale = d(e2.colorScale);
3914
+ let i2 = this.personalization.palette[this.personalization.theme], o2 = i2.categorical, s2 = Array.from({ length: this.graph.nodeCount }, () => "");
3915
+ for (let e3 = 0; e3 < this.graph.nodeCount; e3++) {
3916
+ let t3 = this.graph.nodeColorOverrides[e3];
3917
+ if (t3 != null) s2[e3] = t3;
3918
+ else if (this.resolvedColorScale === "depth-gradient") {
3919
+ let t4 = this.graph.depths[e3], n3 = o2[t4 % o2.length];
3920
+ s2[e3] = P(M(n3 === void 0 ? i2.up : n3, 1), Math.max(0.45, 1 - t4 * 0.15));
3921
+ } else {
3922
+ let t4 = o2[e3 % o2.length];
3923
+ s2[e3] = M(t4 === void 0 ? i2.up : t4, 1);
3924
+ }
3925
+ }
3926
+ this.nodeColors = s2, this.callbacks.onContextChange({
3927
+ personalization: this.personalization,
3928
+ formatter: this.formatter,
3929
+ resolvedLocaleBase: this.resolvedLocale.baseLocale,
3930
+ resolvedTimeZone: this.personalization.timeZone,
3931
+ graph: this.graph,
3932
+ ariaLabel: e2.ariaLabel ?? `Sankey chart, ${this.graph.nodeCount} nodes, ${this.graph.linkCount} links`,
3933
+ cssWidth: n2,
3934
+ cssHeight: r2
3935
+ });
3936
+ }
3937
+ applyDynamicCfgFromProps() {
3938
+ this.dynCfg = {
3939
+ crosshairVisible: this.props.crosshairVisible ?? false,
3940
+ crosshairLineStyle: this.props.crosshairLineStyle ?? "dashed",
3941
+ crosshairMarker: this.props.crosshairMarker ?? "circle"
3942
+ };
3943
+ }
3944
+ async runStaticDraw() {
3945
+ if (this.disposed || this.visGate.tryDefer()) return;
3946
+ let e2 = this.props, t2 = e2.width ?? 800, n2 = e2.height ?? 400, r2 = G({
3947
+ cssWidth: t2,
3948
+ cssHeight: n2,
3949
+ dpr: typeof window > "u" ? 1 : window.devicePixelRatio || 1,
3950
+ dprCap: e2.pixelDensityCap ?? 2,
3951
+ fastMode: e2.fastMode ?? false
3952
+ }), i2 = V(this.staticCanvas, r2);
3953
+ this.staticDrawAbort.cancelled = true;
3954
+ let a2 = { cancelled: false };
3955
+ this.staticDrawAbort = a2, (async () => {
3956
+ if (a2.cancelled || this.disposed) return;
3957
+ let o2 = this.resolvedLabelPosition === "outside" || this.resolvedLabelPosition === "leader-line" || this.resolvedLabelPosition === "auto" && (e2.nodeWidth ?? 16) <= 20 ? 80 : 8, s2 = o2, l2 = t2 - o2, d2 = n2 - 8, f2 = ft(this.graph, {
3958
+ x0: s2,
3959
+ y0: 8,
3960
+ x1: l2,
3961
+ y1: d2,
3962
+ nodeWidth: e2.nodeWidth ?? 16,
3963
+ nodePadding: e2.nodePadding ?? 8,
3964
+ alignment: this.resolvedNodeAlignment,
3965
+ iterations: e2.iterations ?? 6
3966
+ }), m2 = this.personalization.palette[this.personalization.theme], h2 = i2.ctx;
3967
+ if (h2.clearRect(0, 0, r2.cssWidth, r2.cssHeight), this.personalization.glow.strength > 0) {
3968
+ let e3 = this.personalization.cornerRadius;
3969
+ U(h2, {
3970
+ glow: this.personalization.glow,
3971
+ theme: this.personalization.theme,
3972
+ plotRect: {
3973
+ x: s2,
3974
+ y: 8,
3975
+ w: l2 - s2,
3976
+ h: d2 - 8
3977
+ },
3978
+ dpr: Math.min(typeof window < "u" ? window.devicePixelRatio ?? 1 : 1, 2)
3979
+ }, (t3, n3) => {
3980
+ if (n3) for (let n4 = 0; n4 < this.graph.nodeCount; n4++) {
3981
+ let r3 = this.nodeColors[n4] ?? "rgba(128,128,128,1)", i3 = f2.nodeX0[n4], a3 = f2.nodeY0[n4], o3 = f2.nodeX1[n4] - i3, s3 = f2.nodeY1[n4] - a3, c2 = Math.min(e3, o3 / 2, s3 / 2);
3982
+ t3.fillStyle = r3, t3.beginPath(), c2 > 0 ? t3.roundRect(i3, a3, o3, s3, c2) : t3.rect(i3, a3, o3, s3), t3.fill();
3983
+ }
3984
+ });
3985
+ }
3986
+ let g2 = e2.linkOpacity ?? 0.45;
3987
+ for (let e3 = 0; e3 < this.graph.linkCount; e3++) {
3988
+ let t3 = this.graph.linkSources[e3], n3 = this.graph.linkTargets[e3], r3 = f2.nodeX1[t3], i3 = f2.nodeX0[n3], a3 = f2.linkSourceY0[e3], o3 = f2.linkSourceY1[e3], s3 = f2.linkTargetY0[e3], c2 = f2.linkTargetY1[e3], l3 = this.graph.linkColorOverrides[e3], u2 = this.graph.linkOpacityOverrides[e3], d3 = Number.isFinite(u2) ? u2 : g2, p2;
3989
+ if (l3 != null) p2 = P(l3, d3);
3990
+ else switch (this.resolvedLinkColor.kind) {
3991
+ case "source":
3992
+ p2 = P(this.nodeColors[t3] ?? "rgba(128,128,128,1)", d3);
3993
+ break;
3994
+ case "target":
3995
+ p2 = P(this.nodeColors[n3] ?? "rgba(128,128,128,1)", d3);
3996
+ break;
3997
+ case "gradient": {
3998
+ let e4 = h2.createLinearGradient(r3, 0, i3, 0);
3999
+ e4.addColorStop(0, P(this.nodeColors[t3] ?? "rgba(128,128,128,1)", d3)), e4.addColorStop(1, P(this.nodeColors[n3] ?? "rgba(128,128,128,1)", d3)), p2 = e4;
4000
+ break;
4001
+ }
4002
+ case "neutral":
4003
+ p2 = P(M(m2.neutral, 1), d3);
4004
+ break;
4005
+ case "literal":
4006
+ p2 = P(this.resolvedLinkColor.color, d3);
4007
+ break;
4008
+ }
4009
+ h2.fillStyle = p2, h2.beginPath();
4010
+ let _3 = (r3 + i3) / 2;
4011
+ h2.moveTo(r3, a3), h2.bezierCurveTo(_3, a3, _3, s3, i3, s3), h2.lineTo(i3, c2), h2.bezierCurveTo(_3, c2, _3, o3, r3, o3), h2.closePath(), h2.fill();
4012
+ }
4013
+ let _2 = this.personalization.cornerRadius, v2 = this.personalization.borderWidth;
4014
+ for (let e3 = 0; e3 < this.graph.nodeCount; e3++) {
4015
+ let t3 = this.nodeColors[e3], n3, r3;
4016
+ if (this.personalization.visualStyle === "Outline") {
4017
+ let e4 = this.personalization.outlineFillColor === "auto" ? t3 : this.personalization.outlineFillColor, i4 = j(this.personalization);
4018
+ n3 = i4 <= 0 ? null : P(e4, i4), r3 = v2 > 0 ? t3 : null;
4019
+ } else n3 = t3, r3 = v2 > 0 ? t3 : null;
4020
+ let i3 = f2.nodeX0[e3], a3 = f2.nodeY0[e3], o3 = f2.nodeX1[e3] - i3, s3 = f2.nodeY1[e3] - a3, l3 = Math.min(_2, o3 / 2, s3 / 2), d3 = null;
4021
+ if (this.personalization.pattern.type !== "solid") {
4022
+ let e4 = this.personalization.pattern.color === "auto" ? p(t3, this.personalization.theme === "dark", this.personalization.visualStyle === "Outline") : this.personalization.pattern.color;
4023
+ d3 = c(h2, {
4024
+ ...this.personalization.pattern,
4025
+ color: e4
4026
+ }, t3, Math.min(typeof window < "u" ? window.devicePixelRatio ?? 1 : 1, 2));
4027
+ }
4028
+ u({
4029
+ ctx: h2,
4030
+ x: i3,
4031
+ y: a3,
4032
+ w: o3,
4033
+ h: s3,
4034
+ tl: l3,
4035
+ tr: l3,
4036
+ br: l3,
4037
+ bl: l3,
4038
+ fillStyle: n3,
4039
+ strokeStyle: r3,
4040
+ strokeWidth: v2,
4041
+ patternFill: d3
4042
+ });
4043
+ }
4044
+ let y2 = M(m2.neutral, 0.95);
4045
+ h2.font = "11px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", h2.textBaseline = "middle";
4046
+ let b2 = new Float64Array(this.graph.maxDepth + 1);
4047
+ for (let e3 = 0; e3 < this.graph.nodeCount; e3++) b2[this.graph.depths[e3]] += this.graph.nodeValues[e3];
4048
+ for (let e3 = 0; e3 < this.graph.nodeCount; e3++) {
4049
+ let t3 = f2.nodeX0[e3], n3 = f2.nodeX1[e3], r3 = (f2.nodeY0[e3] + f2.nodeY1[e3]) / 2, i3 = this.graph.nodeValues[e3], a3 = b2[this.graph.depths[e3]], o3 = _t(this.resolvedLabelContent, {
4050
+ name: this.graph.nodeLabelOverrides[e3] ?? this.graph.nodeNames[e3],
4051
+ value: i3,
4052
+ percent: a3 > 0 ? i3 / a3 : 0
4053
+ }, this.formatter);
4054
+ if (o3 === "") continue;
4055
+ let c2 = this.resolvedLabelPosition === "off" ? "off" : this.resolvedLabelPosition === "inside" ? "inside" : this.resolvedLabelPosition === "outside" || this.resolvedLabelPosition === "leader-line" ? "outside" : n3 - t3 >= 40 ? "inside" : "outside";
4056
+ if (c2 === "off") continue;
4057
+ h2.font = "11px system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
4058
+ let u2 = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
4059
+ if (h2.fillStyle = c2 === "inside" ? this.personalization.theme === "light" ? "rgb(255,255,255)" : "rgb(20,22,26)" : y2, c2 === "inside") {
4060
+ let e4 = Math.max(0, n3 - t3 - 4), i4 = 11, a4 = h2.measureText(o3).width;
4061
+ for (; a4 > e4 && i4 > 7; ) --i4, h2.font = `${i4}px ${u2}`, a4 = h2.measureText(o3).width;
4062
+ if (a4 > e4) continue;
4063
+ h2.textAlign = "center", h2.fillText(o3, (t3 + n3) / 2, r3);
4064
+ } else {
4065
+ let e4 = t3 < (s2 + l2) / 2, i4 = e4 ? t3 - 6 : n3 + 6, a4 = e4 ? Math.max(0, i4 - s2 - 2) : Math.max(0, l2 - i4 - 2), c3 = 11, d3 = h2.measureText(o3).width;
4066
+ for (; d3 > a4 && c3 > 7; ) --c3, h2.font = `${c3}px ${u2}`, d3 = h2.measureText(o3).width;
4067
+ if (d3 > a4) continue;
4068
+ h2.textAlign = e4 ? "right" : "left", h2.fillText(o3, i4, r3);
4069
+ }
4070
+ }
4071
+ if (this.resolvedValueDisplay === "always") {
4072
+ h2.fillStyle = y2, h2.textAlign = "center";
4073
+ for (let e3 = 0; e3 < this.graph.linkCount; e3++) {
4074
+ let t3 = this.graph.linkSources[e3], n3 = this.graph.linkTargets[e3], r3 = (f2.nodeX1[t3] + f2.nodeX0[n3]) / 2, i3 = (f2.linkSourceY0[e3] + f2.linkSourceY1[e3] + f2.linkTargetY0[e3] + f2.linkTargetY1[e3]) / 4;
4075
+ h2.fillText(this.formatter.formatNumber(this.graph.linkValues[e3], 2), r3, i3);
4076
+ }
4077
+ }
4078
+ let x2 = null;
4079
+ this.dynamicCanvas !== null && (x2 = V(this.dynamicCanvas, r2).ctx), this.handle = {
4080
+ dynamicCtx: x2,
4081
+ layout: {
4082
+ innerLeft: s2,
4083
+ innerRight: l2,
4084
+ innerTop: 8,
4085
+ innerBottom: d2,
4086
+ layout: f2,
4087
+ viewport: r2
4088
+ },
4089
+ crosshairLineColor: M(m2.neutral, 0.5),
4090
+ crosshairMarkerStroke: M(m2.neutral, 1),
4091
+ nodeColors: this.nodeColors
4092
+ };
4093
+ })();
4094
+ }
4095
+ };
4096
+ function gt(e2, t2, n2) {
4097
+ return e2 + (t2 - e2) * n2;
4098
+ }
4099
+ function _t(e2, t2, n2) {
4100
+ if (e2.kind === "function") return e2.fn(t2);
4101
+ switch (e2.preset) {
4102
+ case "name":
4103
+ return t2.name;
4104
+ case "value":
4105
+ return n2.formatNumber(t2.value, 2);
4106
+ case "percent":
4107
+ return `${(t2.percent * 100).toFixed(1)}%`;
4108
+ case "name + value":
4109
+ return `${t2.name} ${n2.formatNumber(t2.value, 2)}`;
4110
+ case "name + percent":
4111
+ return `${t2.name} ${(t2.percent * 100).toFixed(1)}%`;
4112
+ case "all":
4113
+ return `${t2.name} ${n2.formatNumber(t2.value, 2)} (${(t2.percent * 100).toFixed(1)}%)`;
4114
+ }
4115
+ }
4116
+ function vt(e2, t2, n2) {
4117
+ let r2 = e2.dynamicCtx;
4118
+ if (r2 === null) return;
4119
+ let i2 = e2.layout;
4120
+ r2.clearRect(0, 0, i2.viewport.cssWidth, i2.viewport.cssHeight), !(t2 === null || !n2.crosshairVisible) && D({
4121
+ ctx: r2,
4122
+ x: t2.pointerX,
4123
+ y: t2.pointerY,
4124
+ innerLeftPx: i2.innerLeft,
4125
+ innerRightPx: i2.innerRight,
4126
+ innerTopPx: i2.innerTop,
4127
+ innerBottomPx: i2.innerBottom,
4128
+ lineColor: e2.crosshairLineColor,
4129
+ lineWidth: 0,
4130
+ lineStyle: "solid",
4131
+ marker: n2.crosshairMarker,
4132
+ markerSize: 5,
4133
+ markerFill: t2.color,
4134
+ markerStroke: e2.crosshairMarkerStroke
4135
+ });
4136
+ }
4137
+ function yt(e2) {
4138
+ let t2 = $(), n2 = q.useRef(null), r2 = q.useRef(null), i2 = q.useRef(null), a2 = q.useRef(null), [o2, s2] = q.useState(null), [c2, l2] = q.useState(null), u2 = q.useMemo(() => ({
4139
+ theme: t2.theme,
4140
+ palette: t2.palette,
4141
+ locale: t2.locale,
4142
+ timeZone: t2.timeZone,
4143
+ visualStyle: t2.visualStyle,
4144
+ outlineFillColor: t2.outlineFillColor,
4145
+ outlineFillOpacity: t2.outlineFillOpacity,
4146
+ cornerRadius: t2.cornerRadius,
4147
+ borderWidth: t2.borderWidth,
4148
+ accents: t2.accents,
4149
+ osTheme: t2.osTheme,
4150
+ appTheme: t2.appTheme
4151
+ }), [
4152
+ t2.theme,
4153
+ t2.palette,
4154
+ t2.locale,
4155
+ t2.timeZone,
4156
+ t2.visualStyle,
4157
+ t2.outlineFillColor,
4158
+ t2.outlineFillOpacity,
4159
+ t2.cornerRadius,
4160
+ t2.borderWidth,
4161
+ t2.accents,
4162
+ t2.osTheme,
4163
+ t2.appTheme
4164
+ ]);
4165
+ q.useEffect(() => {
4166
+ let t3 = r2.current;
4167
+ if (t3 === null) return;
4168
+ let o3 = new ht({
4169
+ container: n2.current,
4170
+ staticCanvas: t3,
4171
+ dynamicCanvas: i2.current,
4172
+ initialProps: e2,
4173
+ initialProvider: u2,
4174
+ onContextChange: s2,
4175
+ onHoverChange: l2
4176
+ });
4177
+ return a2.current = o3, () => {
4178
+ a2.current = null, o3.dispose();
4179
+ };
4180
+ }, []), q.useEffect(() => {
4181
+ a2.current?.update(e2, u2);
4182
+ });
4183
+ let d2 = q.useCallback((e3) => {
4184
+ a2.current?.handlePointerMove(e3.nativeEvent);
4185
+ }, []), f2 = q.useCallback(() => {
4186
+ a2.current?.handlePointerLeave();
4187
+ }, []), p2 = e2.width ?? 800, m2 = e2.height ?? 400, h2 = e2.ariaLabel ?? o2?.ariaLabel ?? "Sankey chart", g2 = c2 === null || o2 === null ? null : (() => {
4188
+ let t3 = {
4189
+ target: c2.target,
4190
+ color: c2.color,
4191
+ pointerX: c2.pointerX,
4192
+ pointerY: c2.pointerY,
4193
+ containerWidth: p2,
4194
+ containerHeight: m2,
4195
+ theme: o2.personalization.theme,
4196
+ palette: o2.personalization.palette,
4197
+ locale: o2.resolvedLocaleBase,
4198
+ timeZone: o2.resolvedTimeZone,
4199
+ formatter: o2.formatter
4200
+ };
4201
+ return e2.tooltip === false ? null : typeof e2.tooltip == "function" ? e2.tooltip(t3) : bt(t3);
4202
+ })();
4203
+ return /* @__PURE__ */ Y("div", {
4204
+ ref: n2,
4205
+ style: {
4206
+ position: "relative",
4207
+ width: p2,
4208
+ height: m2
4209
+ },
4210
+ "aria-label": h2,
4211
+ onPointerMove: d2,
4212
+ onPointerLeave: f2,
4213
+ children: [
4214
+ /* @__PURE__ */ J("canvas", {
4215
+ ref: r2,
4216
+ style: {
4217
+ display: "block",
4218
+ width: p2,
4219
+ height: m2
4220
+ },
4221
+ "aria-hidden": "true"
4222
+ }),
4223
+ /* @__PURE__ */ J("canvas", {
4224
+ ref: i2,
4225
+ style: {
4226
+ display: "block",
4227
+ width: p2,
4228
+ height: m2,
4229
+ position: "absolute",
4230
+ inset: 0,
4231
+ pointerEvents: "none"
4232
+ },
4233
+ "aria-hidden": "true"
4234
+ }),
4235
+ g2
4236
+ ]
4237
+ });
4238
+ }
4239
+ function bt(e2) {
4240
+ let t2 = e2.theme === "dark", n2 = t2 ? "rgb(34,36,42)" : "rgb(255,255,255)", r2 = t2 ? "rgb(240,242,246)" : "rgb(20,22,26)", i2 = t2 ? "rgba(240,242,246,0.62)" : "rgba(20,22,26,0.56)", a2 = t2 ? "rgba(255,255,255,0.08)" : "rgba(15,18,23,0.08)";
4241
+ return /* @__PURE__ */ Y("div", {
4242
+ role: "tooltip",
4243
+ style: {
4244
+ position: "absolute",
4245
+ left: Math.min(e2.containerWidth - 200, e2.pointerX + 12),
4246
+ top: Math.min(e2.containerHeight - 90, e2.pointerY + 12),
4247
+ background: n2,
4248
+ color: r2,
4249
+ border: `1px solid ${a2}`,
4250
+ borderRadius: 6,
4251
+ padding: "6px 8px",
4252
+ fontSize: 12,
4253
+ fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
4254
+ pointerEvents: "none",
4255
+ minWidth: 180
4256
+ },
4257
+ children: [/* @__PURE__ */ Y("div", {
4258
+ style: {
4259
+ color: i2,
4260
+ fontSize: 10,
4261
+ marginBottom: 2,
4262
+ display: "flex",
4263
+ alignItems: "center",
4264
+ gap: 5
4265
+ },
4266
+ children: [/* @__PURE__ */ J("span", {
4267
+ "aria-hidden": "true",
4268
+ style: {
4269
+ width: 10,
4270
+ height: 10,
4271
+ borderRadius: 2,
4272
+ background: e2.color,
4273
+ display: "inline-block"
4274
+ }
4275
+ }), e2.target.kind === "node" ? /* @__PURE__ */ J("span", { children: "Node" }) : /* @__PURE__ */ J("span", { children: "Flow" })]
4276
+ }), e2.target.kind === "node" ? /* @__PURE__ */ Y(re, { children: [/* @__PURE__ */ J("div", {
4277
+ style: { fontWeight: 600 },
4278
+ children: e2.target.name
4279
+ }), /* @__PURE__ */ Y("div", { children: ["value: ", e2.formatter.formatNumber(e2.target.value, 2)] })] }) : /* @__PURE__ */ Y(re, { children: [/* @__PURE__ */ Y("div", { children: [
4280
+ e2.target.sourceId,
4281
+ " \u2192 ",
4282
+ e2.target.targetId
4283
+ ] }), /* @__PURE__ */ Y("div", { children: ["value: ", e2.formatter.formatNumber(e2.target.value, 2)] })] })]
4284
+ });
4285
+ }
4286
+ function xt(e2) {
4287
+ let t2 = (0, Z.c)(41), n2 = pe(), r2 = q.useRef(null), [i2, a2] = q.useState(null), o2 = e2.width ?? 600, s2 = e2.height ?? 28, c2 = e2.trackColor ?? "rgba(120,120,120,0.12)", l2 = e2.selectionColor ?? "rgba(80,160,120,0.28)", u2 = e2.handleColor ?? "rgba(80,160,120,0.95)", d2 = e2.domain.end - e2.domain.start, f2 = n2?.state.brush ?? null, p2;
4288
+ t2[0] !== e2.domain.start || t2[1] !== d2 || t2[2] !== o2 ? (p2 = (t3) => d2 <= 0 || o2 <= 0 ? e2.domain.start : e2.domain.start + t3 / o2 * d2, t2[0] = e2.domain.start, t2[1] = d2, t2[2] = o2, t2[3] = p2) : p2 = t2[3];
4289
+ let m2 = p2, h2;
4290
+ t2[4] !== e2.domain.start || t2[5] !== d2 || t2[6] !== o2 ? (h2 = (t3) => d2 <= 0 || o2 <= 0 ? 0 : (t3 - e2.domain.start) / d2 * o2, t2[4] = e2.domain.start, t2[5] = d2, t2[6] = o2, t2[7] = h2) : h2 = t2[7];
4291
+ let g2 = h2, _2;
4292
+ t2[8] !== f2 || t2[9] !== n2 || t2[10] !== g2 || t2[11] !== m2 ? (_2 = (e3) => {
4293
+ if (n2 === null) return;
4294
+ let t3 = r2.current?.getBoundingClientRect();
4295
+ if (t3 === void 0) return;
4296
+ let i3 = e3.clientX - t3.left;
4297
+ if (e3.currentTarget.setPointerCapture(e3.pointerId), f2 !== null) {
4298
+ let e4 = g2(f2.start), t4 = g2(f2.end);
4299
+ if (Math.abs(i3 - e4) < 6) {
4300
+ a2({
4301
+ kind: "left",
4302
+ startX: i3,
4303
+ startBrush: f2
4304
+ });
4305
+ return;
4306
+ }
4307
+ if (Math.abs(i3 - t4) < 6) {
4308
+ a2({
4309
+ kind: "right",
4310
+ startX: i3,
4311
+ startBrush: f2
4312
+ });
4313
+ return;
4314
+ }
4315
+ if (i3 > e4 && i3 < t4) {
4316
+ a2({
4317
+ kind: "move",
4318
+ startX: i3,
4319
+ startBrush: f2
4320
+ });
4321
+ return;
4322
+ }
4323
+ }
4324
+ let o3 = m2(i3);
4325
+ n2.state.setBrush({
4326
+ start: o3,
4327
+ end: o3
4328
+ }), a2({
4329
+ kind: "draw",
4330
+ startX: i3,
4331
+ startBrush: null
4332
+ });
4333
+ }, t2[8] = f2, t2[9] = n2, t2[10] = g2, t2[11] = m2, t2[12] = _2) : _2 = t2[12];
4334
+ let v2 = _2, y2;
4335
+ t2[13] !== i2 || t2[14] !== n2 || t2[15] !== e2.domain.end || t2[16] !== e2.domain.start || t2[17] !== d2 || t2[18] !== m2 ? (y2 = (t3) => {
4336
+ if (n2 === null || i2 === null) return;
4337
+ let a3 = r2.current?.getBoundingClientRect();
4338
+ if (a3 === void 0) return;
4339
+ let o3 = t3.clientX - a3.left;
4340
+ if (i2.kind === "draw") {
4341
+ let e3 = m2(i2.startX), t4 = m2(o3), r3 = Math.min(e3, t4), a4 = Math.max(e3, t4);
4342
+ n2.state.setBrush({
4343
+ start: r3,
4344
+ end: a4
4345
+ });
4346
+ return;
4347
+ }
4348
+ let s3 = i2.startBrush;
4349
+ if (s3 === null) return;
4350
+ let c3 = m2(o3) - m2(i2.startX);
4351
+ if (i2.kind === "left") {
4352
+ let e3 = s3.start + c3;
4353
+ e3 >= s3.end && (e3 = s3.end - 1e-4 * d2), n2.state.setBrush({
4354
+ start: e3,
4355
+ end: s3.end
4356
+ });
4357
+ } else if (i2.kind === "right") {
4358
+ let e3 = s3.end + c3;
4359
+ e3 <= s3.start && (e3 = s3.start + 1e-4 * d2), n2.state.setBrush({
4360
+ start: s3.start,
4361
+ end: e3
4362
+ });
4363
+ } else if (i2.kind === "move") {
4364
+ let t4 = s3.start + c3, r3 = s3.end + c3;
4365
+ if (t4 < e2.domain.start) {
4366
+ let n3 = e2.domain.start - t4;
4367
+ t4 += n3, r3 += n3;
4368
+ }
4369
+ if (r3 > e2.domain.end) {
4370
+ let n3 = r3 - e2.domain.end;
4371
+ t4 -= n3, r3 -= n3;
4372
+ }
4373
+ n2.state.setBrush({
4374
+ start: t4,
4375
+ end: r3
4376
+ });
4377
+ }
4378
+ }, t2[13] = i2, t2[14] = n2, t2[15] = e2.domain.end, t2[16] = e2.domain.start, t2[17] = d2, t2[18] = m2, t2[19] = y2) : y2 = t2[19];
4379
+ let b2 = y2, x2;
4380
+ t2[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x2 = () => {
4381
+ a2(null);
4382
+ }, t2[20] = x2) : x2 = t2[20];
4383
+ let S2 = x2, C2;
4384
+ t2[21] === n2?.state ? C2 = t2[22] : (C2 = () => {
4385
+ n2?.state.setBrush(null);
4386
+ }, t2[21] = n2?.state, t2[22] = C2);
4387
+ let w2 = C2;
4388
+ if (n2 === null) {
4389
+ let e3;
4390
+ return t2[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e3 = /* @__PURE__ */ J("div", {
4391
+ role: "presentation",
4392
+ style: { display: "none" }
4393
+ }), t2[23] = e3) : e3 = t2[23], e3;
4394
+ }
4395
+ let T2 = f2 === null ? 0 : g2(f2.start), E2 = f2 === null ? 0 : g2(f2.end), D2 = i2 === null ? "crosshair" : "grabbing", O2;
4396
+ t2[24] !== s2 || t2[25] !== D2 || t2[26] !== c2 || t2[27] !== o2 ? (O2 = {
4397
+ position: "relative",
4398
+ width: o2,
4399
+ height: s2,
4400
+ background: c2,
4401
+ borderRadius: 4,
4402
+ cursor: D2,
4403
+ userSelect: "none",
4404
+ touchAction: "none"
4405
+ }, t2[24] = s2, t2[25] = D2, t2[26] = c2, t2[27] = o2, t2[28] = O2) : O2 = t2[28];
4406
+ let k2;
4407
+ t2[29] !== f2 || t2[30] !== u2 || t2[31] !== T2 || t2[32] !== E2 || t2[33] !== l2 ? (k2 = f2 !== null && E2 > T2 && /* @__PURE__ */ Y(re, { children: [
4408
+ /* @__PURE__ */ J("div", { style: {
4409
+ position: "absolute",
4410
+ left: T2,
4411
+ top: 0,
4412
+ width: E2 - T2,
4413
+ height: "100%",
4414
+ background: l2,
4415
+ borderTop: `1px solid ${u2}`,
4416
+ borderBottom: `1px solid ${u2}`
4417
+ } }),
4418
+ /* @__PURE__ */ J("div", { style: {
4419
+ position: "absolute",
4420
+ left: T2 - 2,
4421
+ top: 0,
4422
+ width: 4,
4423
+ height: "100%",
4424
+ background: u2,
4425
+ borderRadius: 2,
4426
+ cursor: "ew-resize"
4427
+ } }),
4428
+ /* @__PURE__ */ J("div", { style: {
4429
+ position: "absolute",
4430
+ left: E2 - 2,
4431
+ top: 0,
4432
+ width: 4,
4433
+ height: "100%",
4434
+ background: u2,
4435
+ borderRadius: 2,
4436
+ cursor: "ew-resize"
4437
+ } })
4438
+ ] }), t2[29] = f2, t2[30] = u2, t2[31] = T2, t2[32] = E2, t2[33] = l2, t2[34] = k2) : k2 = t2[34];
4439
+ let A2;
4440
+ return t2[35] !== w2 || t2[36] !== v2 || t2[37] !== b2 || t2[38] !== O2 || t2[39] !== k2 ? (A2 = /* @__PURE__ */ J("div", {
4441
+ ref: r2,
4442
+ role: "slider",
4443
+ "aria-label": "Time-range brush",
4444
+ style: O2,
4445
+ onPointerDown: v2,
4446
+ onPointerMove: b2,
4447
+ onPointerUp: S2,
4448
+ onPointerCancel: S2,
4449
+ onDoubleClick: w2,
4450
+ children: k2
4451
+ }), t2[35] = w2, t2[36] = v2, t2[37] = b2, t2[38] = O2, t2[39] = k2, t2[40] = A2) : A2 = t2[40], A2;
4452
+ }
4453
+ function St(e2) {
4454
+ let t2 = (0, Z.c)(23), n2 = pe(), r2 = e2.width ?? 600, i2 = e2.height ?? 80, a2;
4455
+ bb0: {
4456
+ if (e2.domain !== void 0) {
4457
+ a2 = e2.domain;
4458
+ break bb0;
4459
+ }
4460
+ let n3 = e2.data;
4461
+ if ("times" in n3) {
4462
+ let e3 = n3.times, r4 = e3.length;
4463
+ if (r4 === 0) {
4464
+ let e4;
4465
+ t2[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e4 = {
4466
+ start: 0,
4467
+ end: 1
4468
+ }, t2[0] = e4) : e4 = t2[0], a2 = e4;
4469
+ break bb0;
4470
+ }
4471
+ let i4 = e3[r4 - 1], o4;
4472
+ t2[1] !== i4 || t2[2] !== e3[0] ? (o4 = {
4473
+ start: e3[0],
4474
+ end: i4
4475
+ }, t2[1] = i4, t2[2] = e3[0], t2[3] = o4) : o4 = t2[3], a2 = o4;
4476
+ break bb0;
4477
+ }
4478
+ let r3 = n3.points;
4479
+ if (r3.length === 0) {
4480
+ let e3;
4481
+ t2[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e3 = {
4482
+ start: 0,
4483
+ end: 1
4484
+ }, t2[4] = e3) : e3 = t2[4], a2 = e3;
4485
+ break bb0;
4486
+ }
4487
+ let i3 = r3[r3.length - 1], o3;
4488
+ t2[5] !== r3[0].t || t2[6] !== i3.t ? (o3 = {
4489
+ start: r3[0].t,
4490
+ end: i3.t
4491
+ }, t2[5] = r3[0].t, t2[6] = i3.t, t2[7] = o3) : o3 = t2[7], a2 = o3;
4492
+ }
4493
+ let o2 = a2;
4494
+ if (n2 === null) {
4495
+ let e3;
4496
+ return t2[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e3 = /* @__PURE__ */ J("div", {
4497
+ role: "presentation",
4498
+ style: { display: "none" }
4499
+ }), t2[8] = e3) : e3 = t2[8], e3;
4500
+ }
4501
+ let s2;
4502
+ t2[9] !== i2 || t2[10] !== r2 ? (s2 = {
4503
+ position: "relative",
4504
+ width: r2,
4505
+ height: i2,
4506
+ display: "flex",
4507
+ flexDirection: "column",
4508
+ gap: 0
4509
+ }, t2[9] = i2, t2[10] = r2, t2[11] = s2) : s2 = t2[11];
4510
+ let c2 = i2 - 20, l2;
4511
+ t2[12] !== e2.data || t2[13] !== c2 || t2[14] !== r2 ? (l2 = /* @__PURE__ */ J(Te, {
4512
+ data: e2.data,
4513
+ width: r2,
4514
+ height: c2,
4515
+ sparkline: true
4516
+ }), t2[12] = e2.data, t2[13] = c2, t2[14] = r2, t2[15] = l2) : l2 = t2[15];
4517
+ let u2;
4518
+ t2[16] !== o2 || t2[17] !== r2 ? (u2 = /* @__PURE__ */ J(xt, {
4519
+ domain: o2,
4520
+ width: r2,
4521
+ height: 20
4522
+ }), t2[16] = o2, t2[17] = r2, t2[18] = u2) : u2 = t2[18];
4523
+ let d2;
4524
+ return t2[19] !== s2 || t2[20] !== l2 || t2[21] !== u2 ? (d2 = /* @__PURE__ */ Y("div", {
4525
+ style: s2,
4526
+ role: "region",
4527
+ "aria-label": "Chart group navigator",
4528
+ children: [l2, u2]
4529
+ }), t2[19] = s2, t2[20] = l2, t2[21] = u2, t2[22] = d2) : d2 = t2[22], d2;
4530
+ }
4531
+ export {
4532
+ ye as C,
4533
+ se as D,
4534
+ de as E,
4535
+ oe as O,
4536
+ Ce as S,
4537
+ pe as T,
4538
+ Fe as _,
4539
+ ot as a,
4540
+ Te as b,
4541
+ et as c,
4542
+ Je as d,
4543
+ Ke as f,
4544
+ Be as g,
4545
+ Ve as h,
4546
+ ct as i,
4547
+ $ as k,
4548
+ Qe as l,
4549
+ He as m,
4550
+ xt as n,
4551
+ it as o,
4552
+ We as p,
4553
+ yt as r,
4554
+ nt as s,
4555
+ St as t,
4556
+ Ze as u,
4557
+ Ae as v,
4558
+ me as w,
4559
+ Se as x,
4560
+ ke as y
4561
+ };