@gearbox-protocol/ui-kit 4.0.0-next.22 → 4.0.0-next.24
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.
- package/dist/cjs/components/base/history-chart/history-chart.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/graph/default-config.cjs +1 -1
- package/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/graph/graph-current-value.cjs +1 -1
- package/dist/cjs/components/graph/graph-tooltip.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/graph/index.cjs +1 -1
- package/dist/cjs/components/graph/y-axis-scale.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/base/history-chart/history-chart.js +16 -15
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +41 -25
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +38 -39
- package/dist/esm/components/graph/default-config.js +44 -24
- package/dist/esm/components/graph/formatters.js +123 -128
- package/dist/esm/components/graph/graph-current-value.js +11 -11
- package/dist/esm/components/graph/graph-tooltip.js +6 -6
- package/dist/esm/components/graph/graph.js +597 -547
- package/dist/esm/components/graph/index.js +32 -27
- package/dist/esm/components/graph/y-axis-scale.js +112 -0
- package/dist/esm/components/index.js +496 -491
- package/dist/esm/components/trading-view/trading-view.js +83 -82
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +94 -55
- package/dist/esm/index.js +649 -644
- package/dist/esm/locale/en.json.js +16 -4
- package/dist/types/components/base/history-chart/history-chart.d.ts +2 -1
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -2
- package/dist/types/components/graph/default-config.d.ts +23 -0
- package/dist/types/components/graph/formatters.d.ts +5 -1
- package/dist/types/components/graph/graph.d.ts +12 -4
- package/dist/types/components/graph/y-axis-scale.d.ts +48 -0
- package/dist/types/components/trading-view/trading-view.d.ts +5 -1
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +4 -2
- package/dist/types/locale/en.json.d.ts +14 -2
- package/package.json +3 -3
|
@@ -1,99 +1,111 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createChart as
|
|
3
|
-
import * as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import { useIsMobile as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { resolveCSSColor as
|
|
8
|
-
import { getDefaultOptions as
|
|
9
|
-
import { getXFormatters as
|
|
10
|
-
import { GraphCurrentValue as
|
|
11
|
-
import { GraphTooltip as
|
|
12
|
-
import { VertLine as
|
|
13
|
-
|
|
1
|
+
import { jsxs as ge, jsx as N } from "react/jsx-runtime";
|
|
2
|
+
import { createChart as ht, CrosshairMode as gt, LineStyle as ae, LineSeries as mt, AreaSeries as pt } from "lightweight-charts";
|
|
3
|
+
import * as Ve from "react";
|
|
4
|
+
import { useRef as K, useState as re, useEffect as A, useLayoutEffect as dt } from "react";
|
|
5
|
+
import { useIsMobile as bt } from "../../hooks/use-media-query.js";
|
|
6
|
+
import { cn as ee } from "../../utils/cn.js";
|
|
7
|
+
import { resolveCSSColor as ne, generateColorsFromBase as ve, hslToHex as St } from "../../utils/colors.js";
|
|
8
|
+
import { getDefaultOptions as Oe, getDefaultSeries as vt, AXIS_TICK_MARK_DENSITY as Se, getDefaultVerticalLine as Ct, AXIS_FONT_SIZE as yt, AXIS_EDGE_LABEL_PADDING_PX as Qe, AXIS_TOP_LABEL_PADDING_PX as Ye, AXIS_TIME_EDGE_PADDING_PX as xt } from "./default-config.js";
|
|
9
|
+
import { getXFormatters as Ue, formatExactValue as Le, isRatioUnit as _t, createAdaptiveYAxisFormatter as wt } from "./formatters.js";
|
|
10
|
+
import { GraphCurrentValue as Pt } from "./graph-current-value.js";
|
|
11
|
+
import { GraphTooltip as Tt } from "./graph-tooltip.js";
|
|
12
|
+
import { VertLine as Rt } from "./plugins/vertical-line.js";
|
|
13
|
+
import { pickMinMove as Nt, niceAxisRange as Vt } from "./y-axis-scale.js";
|
|
14
|
+
function ie(e) {
|
|
15
|
+
return e.id ?? e.label;
|
|
16
|
+
}
|
|
17
|
+
function et(e, i, u) {
|
|
18
|
+
if (!u)
|
|
19
|
+
return e.values().next().value;
|
|
20
|
+
const f = e.get(u);
|
|
21
|
+
if (f) return f;
|
|
22
|
+
const c = i.find((d) => d.id === u || d.label === u);
|
|
23
|
+
return c ? e.get(ie(c)) : void 0;
|
|
24
|
+
}
|
|
25
|
+
class Lt {
|
|
14
26
|
_yTop;
|
|
15
27
|
_yBottom;
|
|
16
28
|
_color;
|
|
17
|
-
constructor(
|
|
18
|
-
this._yTop =
|
|
29
|
+
constructor(i, u, f) {
|
|
30
|
+
this._yTop = i, this._yBottom = u, this._color = f;
|
|
19
31
|
}
|
|
20
|
-
draw(
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
32
|
+
draw(i) {
|
|
33
|
+
i.useBitmapCoordinateSpace((u) => {
|
|
34
|
+
const f = u.context, c = u.verticalPixelRatio, d = this._yTop === null ? 0 : this._yTop * c, S = this._yBottom === null ? u.bitmapSize.height : this._yBottom * c, w = Math.min(d, S), k = Math.max(d, S);
|
|
35
|
+
f.fillStyle = this._color, f.fillRect(0, w, u.bitmapSize.width, k - w);
|
|
24
36
|
});
|
|
25
37
|
}
|
|
26
38
|
}
|
|
27
|
-
class
|
|
39
|
+
class Mt {
|
|
28
40
|
_source;
|
|
29
41
|
_yTop = null;
|
|
30
42
|
_yBottom = null;
|
|
31
|
-
constructor(
|
|
32
|
-
this._source =
|
|
43
|
+
constructor(i) {
|
|
44
|
+
this._source = i;
|
|
33
45
|
}
|
|
34
46
|
update() {
|
|
35
|
-
const
|
|
36
|
-
this._yTop = this._source.priceTop === void 0 ? null :
|
|
47
|
+
const i = this._source.series;
|
|
48
|
+
this._yTop = this._source.priceTop === void 0 ? null : i.priceToCoordinate(this._source.priceTop), this._yBottom = this._source.priceBottom === void 0 ? null : i.priceToCoordinate(this._source.priceBottom);
|
|
37
49
|
}
|
|
38
50
|
/** Draw beneath the series line/area so the data stays readable. */
|
|
39
51
|
zOrder() {
|
|
40
52
|
return "bottom";
|
|
41
53
|
}
|
|
42
54
|
renderer() {
|
|
43
|
-
return new
|
|
55
|
+
return new Lt(this._yTop, this._yBottom, this._source.color);
|
|
44
56
|
}
|
|
45
57
|
}
|
|
46
|
-
class
|
|
58
|
+
class kt {
|
|
47
59
|
series;
|
|
48
60
|
priceTop;
|
|
49
61
|
priceBottom;
|
|
50
62
|
color;
|
|
51
63
|
_paneViews;
|
|
52
|
-
constructor(
|
|
53
|
-
this.series =
|
|
64
|
+
constructor(i, u, f, c) {
|
|
65
|
+
this.series = i, this.priceTop = u, this.priceBottom = f, this.color = c, this._paneViews = [new Mt(this)];
|
|
54
66
|
}
|
|
55
67
|
updateAllViews() {
|
|
56
|
-
for (const
|
|
68
|
+
for (const i of this._paneViews) i.update();
|
|
57
69
|
}
|
|
58
70
|
paneViews() {
|
|
59
71
|
return this._paneViews;
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
|
-
function
|
|
63
|
-
switch (
|
|
64
|
-
case
|
|
65
|
-
return [
|
|
66
|
-
case
|
|
67
|
-
return [2 *
|
|
68
|
-
case
|
|
69
|
-
return [6 *
|
|
70
|
-
case
|
|
71
|
-
return [
|
|
74
|
+
function It(e, i) {
|
|
75
|
+
switch (e) {
|
|
76
|
+
case ae.Dotted:
|
|
77
|
+
return [i, i];
|
|
78
|
+
case ae.Dashed:
|
|
79
|
+
return [2 * i, 2 * i];
|
|
80
|
+
case ae.LargeDashed:
|
|
81
|
+
return [6 * i, 6 * i];
|
|
82
|
+
case ae.SparseDotted:
|
|
83
|
+
return [i, 4 * i];
|
|
72
84
|
default:
|
|
73
85
|
return [];
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
|
-
class
|
|
88
|
+
class Dt {
|
|
77
89
|
_y;
|
|
78
90
|
_color;
|
|
79
91
|
_lineWidth;
|
|
80
92
|
_lineStyle;
|
|
81
|
-
constructor(
|
|
82
|
-
this._y =
|
|
93
|
+
constructor(i, u, f, c) {
|
|
94
|
+
this._y = i, this._color = u, this._lineWidth = f, this._lineStyle = c;
|
|
83
95
|
}
|
|
84
|
-
draw(
|
|
85
|
-
|
|
96
|
+
draw(i) {
|
|
97
|
+
i.useBitmapCoordinateSpace((u) => {
|
|
86
98
|
if (this._y === null) return;
|
|
87
|
-
const
|
|
88
|
-
|
|
99
|
+
const f = u.context, c = u.verticalPixelRatio, d = Math.max(1, Math.round(this._lineWidth * c)), S = Math.round(this._y * c);
|
|
100
|
+
f.save(), f.strokeStyle = this._color, f.lineWidth = d, f.setLineDash(It(this._lineStyle, d)), f.beginPath(), f.moveTo(0, S), f.lineTo(u.bitmapSize.width, S), f.stroke(), f.restore();
|
|
89
101
|
});
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
|
-
class
|
|
104
|
+
class Et {
|
|
93
105
|
_source;
|
|
94
106
|
_y = null;
|
|
95
|
-
constructor(
|
|
96
|
-
this._source =
|
|
107
|
+
constructor(i) {
|
|
108
|
+
this._source = i;
|
|
97
109
|
}
|
|
98
110
|
update() {
|
|
99
111
|
this._y = this._source.series.priceToCoordinate(this._source.price);
|
|
@@ -108,7 +120,7 @@ class Nt {
|
|
|
108
120
|
return "top";
|
|
109
121
|
}
|
|
110
122
|
renderer() {
|
|
111
|
-
return new
|
|
123
|
+
return new Dt(
|
|
112
124
|
this._y,
|
|
113
125
|
this._source.color,
|
|
114
126
|
this._source.lineWidth,
|
|
@@ -116,46 +128,46 @@ class Nt {
|
|
|
116
128
|
);
|
|
117
129
|
}
|
|
118
130
|
}
|
|
119
|
-
class
|
|
131
|
+
class Bt {
|
|
120
132
|
series;
|
|
121
133
|
price;
|
|
122
134
|
color;
|
|
123
135
|
lineWidth;
|
|
124
136
|
lineStyle;
|
|
125
137
|
_paneViews;
|
|
126
|
-
constructor(
|
|
127
|
-
this.series =
|
|
138
|
+
constructor(i, u, f, c, d) {
|
|
139
|
+
this.series = i, this.price = u, this.color = f, this.lineWidth = c, this.lineStyle = d, this._paneViews = [new Et(this)];
|
|
128
140
|
}
|
|
129
141
|
updateAllViews() {
|
|
130
|
-
for (const
|
|
142
|
+
for (const i of this._paneViews) i.update();
|
|
131
143
|
}
|
|
132
144
|
paneViews() {
|
|
133
145
|
return this._paneViews;
|
|
134
146
|
}
|
|
135
147
|
}
|
|
136
|
-
function
|
|
137
|
-
const
|
|
148
|
+
function Ft(e, i, u) {
|
|
149
|
+
const f = e.labelText ?? "", c = e.value, d = c === void 0 ? "" : typeof c == "number" ? i === "$" ? `$${Le(c, void 0, u)}` : i === "%" ? `${Le(c, void 0, u)}%` : Le(
|
|
138
150
|
c,
|
|
139
|
-
|
|
151
|
+
i !== "none" && i !== "%" && i !== "$" && !_t(i) ? i : void 0,
|
|
140
152
|
u
|
|
141
153
|
) : String(c);
|
|
142
|
-
return { labelText:
|
|
154
|
+
return { labelText: f, valueStr: d };
|
|
143
155
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
return
|
|
149
|
-
const c = u / 2,
|
|
150
|
-
return
|
|
156
|
+
const tt = 4;
|
|
157
|
+
function zt(e, i, u) {
|
|
158
|
+
const f = { left: e, transform: "translateX(-50%)" };
|
|
159
|
+
if (i <= 0 || !u || u <= 0)
|
|
160
|
+
return f;
|
|
161
|
+
const c = u / 2, d = tt + c, S = i - tt - c;
|
|
162
|
+
return S < d ? { left: i / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(e, d), S), transform: "translateX(-50%)" };
|
|
151
163
|
}
|
|
152
|
-
function
|
|
153
|
-
for (let u =
|
|
154
|
-
if (Number(
|
|
155
|
-
return
|
|
164
|
+
function At(e, i) {
|
|
165
|
+
for (let u = e.length - 1; u >= 0; u--)
|
|
166
|
+
if (Number(e[u].time) <= i)
|
|
167
|
+
return e[u].value;
|
|
156
168
|
return 0;
|
|
157
169
|
}
|
|
158
|
-
const
|
|
170
|
+
const Me = [
|
|
159
171
|
// 0 green (emerald)
|
|
160
172
|
{
|
|
161
173
|
line: "#02c39a",
|
|
@@ -270,95 +282,105 @@ const xe = [
|
|
|
270
282
|
top: "rgba(71, 85, 105, 0.56)",
|
|
271
283
|
bottom: "rgba(71, 85, 105, 0.04)"
|
|
272
284
|
}
|
|
273
|
-
],
|
|
274
|
-
function
|
|
275
|
-
if (
|
|
276
|
-
return
|
|
277
|
-
const u = (
|
|
278
|
-
return { line:
|
|
285
|
+
], Gt = 137.5;
|
|
286
|
+
function ot(e) {
|
|
287
|
+
if (e < Me.length)
|
|
288
|
+
return Me[e];
|
|
289
|
+
const u = (e - Me.length) * Gt % 360, f = St(u, 70, 50), { topColor: c, bottomColor: d } = ve(f);
|
|
290
|
+
return { line: f, top: c, bottom: d };
|
|
279
291
|
}
|
|
280
|
-
function
|
|
281
|
-
series:
|
|
282
|
-
className:
|
|
292
|
+
function oo({
|
|
293
|
+
series: e,
|
|
294
|
+
className: i,
|
|
283
295
|
showLegend: u = !1,
|
|
284
|
-
onUnselectSeries:
|
|
296
|
+
onUnselectSeries: f,
|
|
285
297
|
xMeasureUnit: c = "time",
|
|
286
|
-
yMeasureUnit:
|
|
287
|
-
optionsOverrides:
|
|
298
|
+
yMeasureUnit: d = "token",
|
|
299
|
+
optionsOverrides: S,
|
|
288
300
|
verticalLineOptions: w,
|
|
289
|
-
priceLineOptions:
|
|
290
|
-
zoneOptions:
|
|
291
|
-
currentValueDecimals:
|
|
292
|
-
useSharedPriceScale:
|
|
301
|
+
priceLineOptions: k,
|
|
302
|
+
zoneOptions: G,
|
|
303
|
+
currentValueDecimals: Ce,
|
|
304
|
+
useSharedPriceScale: Z = !1,
|
|
293
305
|
dualYAxis: D = !1,
|
|
294
|
-
defaultVisiblePriceScaleId:
|
|
295
|
-
leftPriceScaleTitle:
|
|
296
|
-
rightPriceScaleTitle:
|
|
297
|
-
showCurrentValue:
|
|
298
|
-
graphTitle:
|
|
299
|
-
yScaleMin:
|
|
300
|
-
yScaleMinMultiple:
|
|
301
|
-
visibleTimeFrom:
|
|
302
|
-
disableZoom:
|
|
303
|
-
hideDefaultTooltip:
|
|
306
|
+
defaultVisiblePriceScaleId: ke = "right",
|
|
307
|
+
leftPriceScaleTitle: Ie,
|
|
308
|
+
rightPriceScaleTitle: Xt,
|
|
309
|
+
showCurrentValue: rt = !0,
|
|
310
|
+
graphTitle: ye,
|
|
311
|
+
yScaleMin: De,
|
|
312
|
+
yScaleMinMultiple: Ee,
|
|
313
|
+
visibleTimeFrom: Q,
|
|
314
|
+
disableZoom: Be = !1,
|
|
315
|
+
hideDefaultTooltip: xe = !1
|
|
304
316
|
}) {
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
return
|
|
317
|
+
const E = K(null), V = K(/* @__PURE__ */ new Map()), _e = K(!1), Fe = K(!0), ze = K([]), le = K(0), B = K(null), we = K(null), Ae = K(null), P = bt(), se = Ve.useMemo(() => e.flatMap((t) => t.data), [e]), nt = Ve.useMemo(() => {
|
|
318
|
+
if (e.length > 0) {
|
|
319
|
+
const t = e[e.length - 1];
|
|
320
|
+
if (t.data.length > 0)
|
|
321
|
+
return t.data[t.data.length - 1];
|
|
310
322
|
}
|
|
311
|
-
}, [
|
|
312
|
-
if (!
|
|
313
|
-
const
|
|
314
|
-
for (const
|
|
315
|
-
|
|
316
|
-
return
|
|
317
|
-
}), [
|
|
318
|
-
|
|
319
|
-
const
|
|
323
|
+
}, [e]), [Ge, Pe] = re(() => {
|
|
324
|
+
if (!nt) return;
|
|
325
|
+
const t = /* @__PURE__ */ new Map();
|
|
326
|
+
for (const l of e)
|
|
327
|
+
l.data.length > 0 && t.set(l.label, l.data[l.data.length - 1]);
|
|
328
|
+
return t;
|
|
329
|
+
}), [We, J] = re(null), [Xe, $e] = re([]), [it, He] = re(0), je = K(/* @__PURE__ */ new Map()), [at, lt] = re({}), [Y, st] = re(0);
|
|
330
|
+
A(() => {
|
|
331
|
+
const t = () => {
|
|
320
332
|
try {
|
|
321
|
-
if (
|
|
322
|
-
const
|
|
323
|
-
|
|
333
|
+
if (B.current && He(B.current.clientWidth), E.current && B.current) {
|
|
334
|
+
const a = B.current.clientWidth, s = B.current.clientHeight;
|
|
335
|
+
E.current.resize(a, s);
|
|
336
|
+
try {
|
|
337
|
+
le.current = E.current.paneSize().height;
|
|
338
|
+
} catch {
|
|
339
|
+
}
|
|
324
340
|
}
|
|
325
341
|
} catch {
|
|
326
342
|
}
|
|
327
|
-
},
|
|
328
|
-
return
|
|
329
|
-
|
|
343
|
+
}, l = B.current, n = l ? new ResizeObserver(t) : null;
|
|
344
|
+
return Ae.current = n, l && n?.observe(l), () => {
|
|
345
|
+
l && n?.unobserve(l), n?.disconnect(), Ae.current = null;
|
|
330
346
|
};
|
|
331
|
-
}, []),
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
347
|
+
}, []), A(() => {
|
|
348
|
+
if (!we.current || _e.current) return;
|
|
349
|
+
const t = Oe(), l = ne(
|
|
334
350
|
"hsl(var(--muted-foreground))",
|
|
335
351
|
"rgb(163, 163, 163)"
|
|
336
|
-
), n =
|
|
337
|
-
...
|
|
352
|
+
), n = ht(we.current, {
|
|
353
|
+
...t,
|
|
338
354
|
leftPriceScale: {
|
|
339
|
-
...
|
|
355
|
+
...t.leftPriceScale || {},
|
|
340
356
|
visible: !1,
|
|
341
|
-
textColor:
|
|
357
|
+
textColor: l
|
|
342
358
|
},
|
|
343
359
|
rightPriceScale: {
|
|
344
|
-
...
|
|
345
|
-
visible: !
|
|
346
|
-
textColor:
|
|
360
|
+
...t.rightPriceScale || {},
|
|
361
|
+
visible: !P,
|
|
362
|
+
textColor: l
|
|
347
363
|
},
|
|
348
|
-
...
|
|
364
|
+
...P && {
|
|
349
365
|
crosshair: {
|
|
350
|
-
...
|
|
351
|
-
mode:
|
|
366
|
+
...t.crosshair,
|
|
367
|
+
mode: gt.Magnet
|
|
352
368
|
}
|
|
353
369
|
}
|
|
354
370
|
});
|
|
355
|
-
|
|
356
|
-
|
|
371
|
+
E.current = n, _e.current = !0;
|
|
372
|
+
try {
|
|
373
|
+
le.current = n.paneSize().height;
|
|
374
|
+
} catch {
|
|
375
|
+
le.current = 0;
|
|
376
|
+
}
|
|
377
|
+
return st((a) => a + 1), () => {
|
|
378
|
+
n.remove(), E.current = null, _e.current = !1, V.current.clear();
|
|
357
379
|
};
|
|
358
|
-
}, [
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
380
|
+
}, [P]), A(() => {
|
|
381
|
+
const t = E.current;
|
|
382
|
+
t && t.applyOptions(
|
|
383
|
+
Be ? {
|
|
362
384
|
handleScale: {
|
|
363
385
|
mouseWheel: !1,
|
|
364
386
|
pinch: !1,
|
|
@@ -386,231 +408,236 @@ function Xt({
|
|
|
386
408
|
}
|
|
387
409
|
}
|
|
388
410
|
);
|
|
389
|
-
}, [
|
|
390
|
-
const
|
|
391
|
-
!
|
|
392
|
-
}, [
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
395
|
-
const n =
|
|
411
|
+
}, [Y, Be]), A(() => {
|
|
412
|
+
const t = E.current;
|
|
413
|
+
!t || !S || t.applyOptions(S);
|
|
414
|
+
}, [Y, S]), A(() => {
|
|
415
|
+
const t = E.current;
|
|
416
|
+
if (!t || e.length === 0) return;
|
|
417
|
+
const n = e.filter((r) => r.data.length > 0).length <= 1 ? De : Ee, a = c === "time" ? Ue(c, se) : Ue(c), s = /* @__PURE__ */ new Map();
|
|
396
418
|
{
|
|
397
419
|
let r = 0;
|
|
398
|
-
for (const o of
|
|
399
|
-
o.data.length !== 0 && (
|
|
420
|
+
for (const o of e)
|
|
421
|
+
o.data.length !== 0 && (s.set(
|
|
400
422
|
o.label,
|
|
401
423
|
o.priceScaleId ?? (r === 0 ? "left" : "right")
|
|
402
424
|
), r++);
|
|
403
425
|
}
|
|
404
|
-
const
|
|
405
|
-
const {
|
|
406
|
-
formatter: I,
|
|
407
|
-
tickmarksFormatter: T,
|
|
408
|
-
updateVisibleRange: G,
|
|
409
|
-
updateLastValues: We
|
|
410
|
-
} = gt(r, o, {
|
|
426
|
+
const h = (r, o, g) => {
|
|
427
|
+
const { formatter: F, tickmarksFormatter: R, updateVisibleRange: M } = wt(r, o, {
|
|
411
428
|
yScaleMin: n
|
|
412
|
-
})
|
|
413
|
-
return
|
|
414
|
-
},
|
|
429
|
+
});
|
|
430
|
+
return { formatter: F, tickmarksFormatter: R, updateVisibleRange: M, labels: g };
|
|
431
|
+
}, m = [];
|
|
415
432
|
if (D)
|
|
416
433
|
for (const r of ["left", "right"]) {
|
|
417
|
-
const o = /* @__PURE__ */ new Set(),
|
|
418
|
-
let
|
|
419
|
-
for (const
|
|
420
|
-
if (
|
|
421
|
-
o.size === 0 &&
|
|
422
|
-
for (const
|
|
434
|
+
const o = /* @__PURE__ */ new Set(), g = [];
|
|
435
|
+
let F = d;
|
|
436
|
+
for (const R of e)
|
|
437
|
+
if (R.data.length !== 0 && s.get(R.label) === r) {
|
|
438
|
+
o.size === 0 && R.yMeasureUnit && (F = R.yMeasureUnit), o.add(R.label);
|
|
439
|
+
for (const M of R.data) g.push(M.value);
|
|
423
440
|
}
|
|
424
|
-
o.size > 0 &&
|
|
441
|
+
o.size > 0 && m.push(h(g, F, o));
|
|
425
442
|
}
|
|
426
443
|
else {
|
|
427
|
-
const r =
|
|
428
|
-
|
|
444
|
+
const r = se.map((g) => g.value), o = new Set(
|
|
445
|
+
e.filter((g) => g.data.length > 0).map((g) => g.label)
|
|
429
446
|
);
|
|
430
|
-
|
|
447
|
+
m.push(h(r, d, o));
|
|
431
448
|
}
|
|
432
|
-
|
|
449
|
+
ze.current = m;
|
|
433
450
|
const y = /* @__PURE__ */ new Map();
|
|
434
|
-
for (const r of
|
|
451
|
+
for (const r of m)
|
|
435
452
|
for (const o of r.labels)
|
|
436
453
|
y.set(o, r);
|
|
437
|
-
const
|
|
438
|
-
|
|
454
|
+
const x = Oe();
|
|
455
|
+
t.applyOptions({
|
|
439
456
|
localization: {
|
|
440
|
-
...
|
|
457
|
+
...x.localization || {},
|
|
441
458
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
442
459
|
timeFormatter: (r) => (
|
|
443
460
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
444
|
-
|
|
461
|
+
a.timeFormatter(parseFloat(r), void 0)
|
|
445
462
|
)
|
|
446
463
|
},
|
|
447
464
|
timeScale: {
|
|
448
|
-
...
|
|
449
|
-
...
|
|
465
|
+
...x.timeScale || {},
|
|
466
|
+
...S?.timeScale,
|
|
450
467
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
451
|
-
tickMarkFormatter:
|
|
468
|
+
tickMarkFormatter: a.tickMarkFormatter,
|
|
452
469
|
minBarSpacing: 0
|
|
453
470
|
}
|
|
454
471
|
});
|
|
455
|
-
const
|
|
472
|
+
const v = !D && e.length > 1 && !Z, W = D ? P : e.length > 1 && !Z || P, L = ne(
|
|
456
473
|
"hsl(var(--muted-foreground))",
|
|
457
474
|
"rgb(163, 163, 163)"
|
|
458
475
|
);
|
|
459
|
-
|
|
476
|
+
t.applyOptions({
|
|
460
477
|
...D && {
|
|
461
|
-
defaultVisiblePriceScaleId:
|
|
478
|
+
defaultVisiblePriceScaleId: ke
|
|
462
479
|
},
|
|
463
480
|
leftPriceScale: {
|
|
464
|
-
...
|
|
465
|
-
...
|
|
466
|
-
visible: D && !
|
|
467
|
-
textColor:
|
|
468
|
-
...D &&
|
|
481
|
+
...x.leftPriceScale || {},
|
|
482
|
+
...S?.leftPriceScale,
|
|
483
|
+
visible: D && !P,
|
|
484
|
+
textColor: L,
|
|
485
|
+
...D && Ie && {
|
|
469
486
|
// lightweight-charts uses scale margins; title shown via localization if needed
|
|
470
487
|
}
|
|
471
488
|
},
|
|
472
489
|
rightPriceScale: {
|
|
473
|
-
...
|
|
474
|
-
...
|
|
475
|
-
visible: D ? !
|
|
476
|
-
textColor:
|
|
477
|
-
...p && !D && {
|
|
478
|
-
scaleMargins: {
|
|
479
|
-
top: 0.3,
|
|
480
|
-
bottom: 0
|
|
481
|
-
}
|
|
482
|
-
}
|
|
490
|
+
...x.rightPriceScale || {},
|
|
491
|
+
...S?.rightPriceScale,
|
|
492
|
+
visible: D ? !P : !W,
|
|
493
|
+
textColor: L
|
|
483
494
|
}
|
|
484
495
|
});
|
|
485
|
-
const
|
|
486
|
-
for (const r of
|
|
487
|
-
if (!
|
|
488
|
-
const o =
|
|
489
|
-
o && (
|
|
496
|
+
const U = new Set(V.current.keys()), X = new Set(e.map(ie));
|
|
497
|
+
for (const r of U)
|
|
498
|
+
if (!X.has(r)) {
|
|
499
|
+
const o = V.current.get(r);
|
|
500
|
+
o && (t.removeSeries(o), V.current.delete(r));
|
|
490
501
|
}
|
|
491
|
-
const
|
|
492
|
-
let
|
|
493
|
-
const
|
|
494
|
-
if (
|
|
495
|
-
for (const r of
|
|
502
|
+
const p = vt(), I = [];
|
|
503
|
+
let T = 0;
|
|
504
|
+
const $ = e.find((r) => r.data.length > 0), C = /* @__PURE__ */ new Map();
|
|
505
|
+
if (k && k.length > 0)
|
|
506
|
+
for (const r of k) {
|
|
496
507
|
if (!Number.isFinite(r.price)) continue;
|
|
497
|
-
const o = r.seriesLabel ??
|
|
508
|
+
const o = r.seriesLabel ?? $?.label;
|
|
498
509
|
if (!o) continue;
|
|
499
|
-
const
|
|
500
|
-
|
|
510
|
+
const g = C.get(o) ?? [];
|
|
511
|
+
g.push(r.price), C.set(o, g);
|
|
501
512
|
}
|
|
502
|
-
if (
|
|
503
|
-
for (const r of
|
|
504
|
-
const o = r.seriesLabel ??
|
|
513
|
+
if (G && G.length > 0)
|
|
514
|
+
for (const r of G) {
|
|
515
|
+
const o = r.seriesLabel ?? $?.label;
|
|
505
516
|
if (!o) continue;
|
|
506
|
-
const
|
|
507
|
-
Number.isFinite(r.priceTop) &&
|
|
517
|
+
const g = C.get(o) ?? [];
|
|
518
|
+
Number.isFinite(r.priceTop) && g.push(r.priceTop), Number.isFinite(r.priceBottom) && g.push(r.priceBottom), C.set(o, g);
|
|
508
519
|
}
|
|
509
|
-
for (let r = 0; r <
|
|
510
|
-
const o =
|
|
511
|
-
let
|
|
520
|
+
for (let r = 0; r < e.length; r++) {
|
|
521
|
+
const o = e[r], g = ie(o), F = ot(r), R = o.lineColor ?? o.color ?? F.line;
|
|
522
|
+
let M, O;
|
|
512
523
|
if (o.lineColor ?? o.color)
|
|
513
524
|
if (o.topColor && o.bottomColor)
|
|
514
|
-
|
|
525
|
+
M = o.topColor, O = o.bottomColor;
|
|
515
526
|
else if (o.topColor) {
|
|
516
|
-
const
|
|
517
|
-
|
|
527
|
+
const b = ve(R);
|
|
528
|
+
M = o.topColor, O = b.bottomColor;
|
|
518
529
|
} else if (o.bottomColor)
|
|
519
|
-
|
|
530
|
+
M = ve(R).topColor, O = o.bottomColor;
|
|
520
531
|
else {
|
|
521
|
-
const
|
|
522
|
-
|
|
532
|
+
const b = ve(R);
|
|
533
|
+
M = b.topColor, O = b.bottomColor;
|
|
523
534
|
}
|
|
524
535
|
else
|
|
525
|
-
|
|
536
|
+
M = o.topColor || F.top, O = o.bottomColor || F.bottom;
|
|
526
537
|
if (o.data.length === 0) {
|
|
527
|
-
const
|
|
528
|
-
|
|
538
|
+
const b = V.current.get(g);
|
|
539
|
+
b && (t.removeSeries(b), V.current.delete(g));
|
|
529
540
|
continue;
|
|
530
541
|
}
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
priceScaleId:
|
|
534
|
-
|
|
535
|
-
seriesIndex: le
|
|
542
|
+
const pe = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, ce = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, ue = pe < 0, q = o.data.some((b) => b.value === 0), de = !ue && q, fe = Nt(ce - pe), he = D ? o.priceScaleId ?? (T === 0 ? "left" : "right") : Z || !v || T === 0 ? "right" : `scale-${T}`;
|
|
543
|
+
v && I.push({
|
|
544
|
+
priceScaleId: he || "right",
|
|
545
|
+
seriesIndex: T
|
|
536
546
|
});
|
|
537
|
-
const
|
|
538
|
-
const
|
|
539
|
-
if (
|
|
540
|
-
|
|
541
|
-
for (const
|
|
542
|
-
|
|
547
|
+
const Te = (Z || !v) && n !== void 0 && typeof n == "number", ct = C.get(o.label) ?? [], ut = (b) => {
|
|
548
|
+
const _ = b();
|
|
549
|
+
if (_?.priceRange) {
|
|
550
|
+
Te && (_.priceRange.minValue = n);
|
|
551
|
+
for (const j of ct)
|
|
552
|
+
j < _.priceRange.minValue && (_.priceRange.minValue = j), j > _.priceRange.maxValue && (_.priceRange.maxValue = j);
|
|
553
|
+
const oe = Te ? n : de && _.priceRange.minValue >= 0 ? 0 : void 0, be = le.current > 0 ? le.current : B.current?.clientHeight ?? 0;
|
|
554
|
+
if (be > 0) {
|
|
555
|
+
const j = Vt({
|
|
556
|
+
min: _.priceRange.minValue,
|
|
557
|
+
max: _.priceRange.maxValue,
|
|
558
|
+
floor: oe,
|
|
559
|
+
scaleHeightPx: be,
|
|
560
|
+
fontSizePx: yt,
|
|
561
|
+
tickMarkDensity: Se,
|
|
562
|
+
minMove: fe,
|
|
563
|
+
edgePaddingPx: Qe,
|
|
564
|
+
edgePaddingTopPx: Ye
|
|
565
|
+
});
|
|
566
|
+
_.priceRange.minValue = j.min, _.priceRange.maxValue = j.max;
|
|
567
|
+
}
|
|
568
|
+
_.margins = {
|
|
569
|
+
above: Ye,
|
|
570
|
+
below: Qe
|
|
571
|
+
};
|
|
543
572
|
}
|
|
544
|
-
return
|
|
545
|
-
},
|
|
546
|
-
lineColor:
|
|
547
|
-
topColor:
|
|
548
|
-
bottomColor:
|
|
549
|
-
priceScaleId:
|
|
573
|
+
return _;
|
|
574
|
+
}, Ze = y.get(o.label) ?? m[0], qe = Ze.formatter, ft = Ze.tickmarksFormatter, Re = {
|
|
575
|
+
lineColor: R,
|
|
576
|
+
topColor: M,
|
|
577
|
+
bottomColor: O,
|
|
578
|
+
priceScaleId: he,
|
|
550
579
|
...o.seriesType === "line" && {
|
|
551
|
-
lineStyle: o.lineStyle ??
|
|
580
|
+
lineStyle: o.lineStyle ?? ae.Solid
|
|
552
581
|
},
|
|
553
582
|
priceFormat: {
|
|
554
583
|
type: "custom",
|
|
555
|
-
minMove:
|
|
556
|
-
formatter:
|
|
557
|
-
|
|
558
|
-
) :
|
|
559
|
-
tickmarksFormatter:
|
|
584
|
+
minMove: fe,
|
|
585
|
+
formatter: Te && typeof n == "number" ? (b) => qe(
|
|
586
|
+
b < n ? n : b
|
|
587
|
+
) : qe,
|
|
588
|
+
tickmarksFormatter: ft
|
|
560
589
|
},
|
|
561
|
-
autoscaleInfoProvider:
|
|
562
|
-
},
|
|
563
|
-
let
|
|
564
|
-
const
|
|
565
|
-
...
|
|
566
|
-
time:
|
|
590
|
+
autoscaleInfoProvider: ut
|
|
591
|
+
}, Je = o.seriesType === "line";
|
|
592
|
+
let z = V.current.get(g);
|
|
593
|
+
const te = o.data.map((b) => ({
|
|
594
|
+
...b,
|
|
595
|
+
time: b.time
|
|
567
596
|
}));
|
|
568
|
-
if (
|
|
569
|
-
const
|
|
570
|
-
for (let
|
|
571
|
-
|
|
572
|
-
|
|
597
|
+
if (Q !== void 0 && te.length > 0 && Number(te[0].time) > Q) {
|
|
598
|
+
const b = Number(te[0].time), _ = b - Q, oe = 86400, be = _ > 180 * oe ? 7 * oe : _ > 30 * oe ? oe : 6 * 3600, j = [];
|
|
599
|
+
for (let Ne = Q; Ne < b; Ne += be)
|
|
600
|
+
j.push({ time: Ne });
|
|
601
|
+
te.unshift(...j);
|
|
573
602
|
}
|
|
574
|
-
|
|
575
|
-
...
|
|
576
|
-
...
|
|
577
|
-
}) :
|
|
578
|
-
...
|
|
579
|
-
...
|
|
580
|
-
}),
|
|
603
|
+
z && z.seriesType() !== (Je ? "Line" : "Area") && (t.removeSeries(z), V.current.delete(g), z = void 0), z ? (z.applyOptions(Re), z.setData(te)) : (Je ? z = t.addSeries(mt, {
|
|
604
|
+
...p,
|
|
605
|
+
...Re
|
|
606
|
+
}) : z = t.addSeries(pt, {
|
|
607
|
+
...p,
|
|
608
|
+
...Re
|
|
609
|
+
}), z.setData(te), V.current.set(g, z)), T++;
|
|
581
610
|
}
|
|
582
611
|
if (D)
|
|
583
612
|
try {
|
|
584
|
-
const r =
|
|
585
|
-
visible: !
|
|
613
|
+
const r = t.priceScale("left"), o = t.priceScale("right"), g = {
|
|
614
|
+
visible: !P,
|
|
586
615
|
autoScale: !0,
|
|
587
|
-
scaleMargins: { top: 0
|
|
616
|
+
scaleMargins: { top: 0, bottom: 0 },
|
|
588
617
|
alignLabels: !0,
|
|
589
618
|
entireTextOnly: !1,
|
|
590
|
-
|
|
591
|
-
|
|
619
|
+
tickMarkDensity: Se,
|
|
620
|
+
textColor: L,
|
|
621
|
+
...S?.rightPriceScale
|
|
592
622
|
};
|
|
593
|
-
r?.applyOptions(
|
|
623
|
+
r?.applyOptions(g), o?.applyOptions(g);
|
|
594
624
|
} catch {
|
|
595
625
|
}
|
|
596
|
-
else if (
|
|
597
|
-
for (const r of
|
|
626
|
+
else if (v && I.length > 0)
|
|
627
|
+
for (const r of I)
|
|
598
628
|
try {
|
|
599
|
-
const o =
|
|
629
|
+
const o = t.priceScale(r.priceScaleId);
|
|
600
630
|
o && o.applyOptions({
|
|
601
631
|
visible: !1,
|
|
602
632
|
autoScale: !0,
|
|
603
633
|
scaleMargins: {
|
|
604
|
-
top: 0
|
|
605
|
-
bottom: 0
|
|
606
|
-
...r.shouldPreventNegativeAxis && {
|
|
607
|
-
top: 0.3,
|
|
608
|
-
bottom: 0
|
|
609
|
-
}
|
|
634
|
+
top: 0,
|
|
635
|
+
bottom: 0
|
|
610
636
|
},
|
|
611
637
|
alignLabels: !0,
|
|
612
638
|
entireTextOnly: !1,
|
|
613
|
-
|
|
639
|
+
tickMarkDensity: Se,
|
|
640
|
+
textColor: L
|
|
614
641
|
});
|
|
615
642
|
} catch (o) {
|
|
616
643
|
console.warn(
|
|
@@ -618,381 +645,403 @@ function Xt({
|
|
|
618
645
|
o
|
|
619
646
|
);
|
|
620
647
|
}
|
|
621
|
-
else if (!
|
|
648
|
+
else if (!v)
|
|
622
649
|
try {
|
|
623
|
-
const r =
|
|
650
|
+
const r = t.priceScale("right");
|
|
624
651
|
r && r.applyOptions({
|
|
625
|
-
visible: !
|
|
652
|
+
visible: !P,
|
|
626
653
|
autoScale: !0,
|
|
627
654
|
scaleMargins: {
|
|
628
|
-
top: 0
|
|
629
|
-
|
|
630
|
-
bottom: n !== void 0 || p ? 0 : 0.1,
|
|
631
|
-
...p && {
|
|
632
|
-
top: 0.3
|
|
633
|
-
}
|
|
655
|
+
top: 0,
|
|
656
|
+
bottom: 0
|
|
634
657
|
},
|
|
635
658
|
alignLabels: !0,
|
|
636
659
|
entireTextOnly: !1,
|
|
637
|
-
|
|
638
|
-
|
|
660
|
+
tickMarkDensity: Se,
|
|
661
|
+
textColor: L,
|
|
662
|
+
...S?.rightPriceScale
|
|
639
663
|
});
|
|
640
664
|
} catch {
|
|
641
665
|
}
|
|
642
|
-
if (n !== void 0 && !
|
|
666
|
+
if (n !== void 0 && !P && (Z || !v) && t.applyOptions({
|
|
643
667
|
handleScroll: {
|
|
644
668
|
vertTouchDrag: !1
|
|
645
669
|
}
|
|
646
|
-
}),
|
|
647
|
-
const r =
|
|
670
|
+
}), se.length > 0) {
|
|
671
|
+
const r = se.map((o) => Number(o.time)).filter((o) => Number.isFinite(o));
|
|
648
672
|
if (r.length > 0) {
|
|
649
|
-
const o = Math.min(...r),
|
|
650
|
-
if (Number(
|
|
673
|
+
const o = Math.min(...r), g = Q !== void 0 ? Math.min(Q, o) : o, F = Math.max(...r);
|
|
674
|
+
if (Number(g) <= Number(F)) {
|
|
675
|
+
const R = () => {
|
|
676
|
+
const M = t.timeScale(), O = D && !P, pe = D ? !P : !W, ce = !O, ue = !pe;
|
|
677
|
+
if (M.applyOptions({
|
|
678
|
+
fixLeftEdge: !ce,
|
|
679
|
+
fixRightEdge: !ue
|
|
680
|
+
}), !ce && !ue) return;
|
|
681
|
+
const q = M.getVisibleLogicalRange(), de = M.width();
|
|
682
|
+
if (!q || !(de > 0)) return;
|
|
683
|
+
const fe = q.to - q.from;
|
|
684
|
+
if (!(fe > 0)) return;
|
|
685
|
+
const he = xt * fe / de;
|
|
686
|
+
M.setVisibleLogicalRange({
|
|
687
|
+
from: ce ? q.from - he : q.from,
|
|
688
|
+
to: ue ? q.to + he : q.to
|
|
689
|
+
});
|
|
690
|
+
};
|
|
651
691
|
try {
|
|
652
|
-
|
|
692
|
+
t.timeScale().setVisibleRange({ from: g, to: F }), R();
|
|
653
693
|
} catch {
|
|
654
694
|
try {
|
|
655
|
-
|
|
695
|
+
t.timeScale().fitContent(), R();
|
|
656
696
|
} catch {
|
|
657
697
|
}
|
|
658
698
|
}
|
|
699
|
+
}
|
|
659
700
|
}
|
|
660
701
|
}
|
|
661
|
-
|
|
662
|
-
const
|
|
663
|
-
for (const r of
|
|
664
|
-
r.data.length > 0 &&
|
|
665
|
-
|
|
702
|
+
Fe.current && (Fe.current = !1), S && t.applyOptions(S);
|
|
703
|
+
const H = /* @__PURE__ */ new Map();
|
|
704
|
+
for (const r of e)
|
|
705
|
+
r.data.length > 0 && H.set(r.label, r.data[r.data.length - 1]);
|
|
706
|
+
Pe(H.size > 0 ? H : void 0);
|
|
666
707
|
}, [
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
708
|
+
Y,
|
|
709
|
+
e,
|
|
710
|
+
se,
|
|
670
711
|
c,
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
712
|
+
d,
|
|
713
|
+
P,
|
|
714
|
+
Z,
|
|
674
715
|
D,
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
]),
|
|
684
|
-
const
|
|
685
|
-
if (!
|
|
686
|
-
const
|
|
716
|
+
ke,
|
|
717
|
+
Ie,
|
|
718
|
+
De,
|
|
719
|
+
Ee,
|
|
720
|
+
Q,
|
|
721
|
+
k,
|
|
722
|
+
G,
|
|
723
|
+
S
|
|
724
|
+
]), A(() => {
|
|
725
|
+
const t = E.current;
|
|
726
|
+
if (!t || e.length === 0) return;
|
|
727
|
+
const l = e.length === 1;
|
|
687
728
|
let n;
|
|
688
|
-
for (const
|
|
689
|
-
if (
|
|
690
|
-
n =
|
|
729
|
+
for (const s of e)
|
|
730
|
+
if (s.data.length > 0) {
|
|
731
|
+
n = s.data[s.data.length - 1].time;
|
|
691
732
|
break;
|
|
692
733
|
}
|
|
693
734
|
if (!n) return;
|
|
694
|
-
const
|
|
695
|
-
const { time:
|
|
696
|
-
if (!y || !
|
|
697
|
-
const
|
|
698
|
-
for (const p of
|
|
699
|
-
p.data.length > 0 &&
|
|
700
|
-
if (
|
|
701
|
-
|
|
702
|
-
else if (
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
const
|
|
706
|
-
|
|
735
|
+
const a = (s) => {
|
|
736
|
+
const { time: h = n, seriesData: m, point: y } = s || {}, x = e[0], v = x ? V.current.get(ie(x)) : void 0;
|
|
737
|
+
if (!y || !h) {
|
|
738
|
+
const X = /* @__PURE__ */ new Map();
|
|
739
|
+
for (const p of e)
|
|
740
|
+
p.data.length > 0 && X.set(p.label, p.data[p.data.length - 1]);
|
|
741
|
+
if (Pe(X.size > 0 ? X : void 0), l || Z || xe)
|
|
742
|
+
J(null);
|
|
743
|
+
else if (v && n) {
|
|
744
|
+
const p = e[0];
|
|
745
|
+
if (p && p.data.length > 0) {
|
|
746
|
+
const T = t.timeScale().timeToCoordinate(n), $ = p.data[p.data.length - 1].value, C = v.priceToCoordinate($);
|
|
747
|
+
T !== null && C !== null && J({ x: T, y: C });
|
|
707
748
|
}
|
|
708
749
|
}
|
|
709
750
|
return;
|
|
710
751
|
}
|
|
711
|
-
const
|
|
712
|
-
let L;
|
|
713
|
-
for (let
|
|
714
|
-
const p =
|
|
715
|
-
if (!
|
|
716
|
-
const
|
|
717
|
-
let
|
|
718
|
-
if (
|
|
719
|
-
|
|
720
|
-
else if (
|
|
721
|
-
const
|
|
722
|
-
|
|
752
|
+
const W = /* @__PURE__ */ new Map();
|
|
753
|
+
let L, U = v;
|
|
754
|
+
for (let X = 0; X < e.length; X++) {
|
|
755
|
+
const p = e[X], I = V.current.get(ie(p));
|
|
756
|
+
if (!I) continue;
|
|
757
|
+
const T = m?.get(I), $ = T && "value" in T ? T.value : void 0;
|
|
758
|
+
let C;
|
|
759
|
+
if ($ !== void 0)
|
|
760
|
+
C = $;
|
|
761
|
+
else if (l) {
|
|
762
|
+
const H = Number(h), r = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
|
|
763
|
+
H < r ? C = Number.NaN : C = p.data[p.data.length - 1]?.value ?? 0;
|
|
723
764
|
} else {
|
|
724
|
-
const
|
|
725
|
-
if (Number(
|
|
726
|
-
|
|
765
|
+
const H = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
|
|
766
|
+
if (Number(h) < H) continue;
|
|
767
|
+
C = At(p.data, Number(h));
|
|
727
768
|
}
|
|
728
|
-
Number.isNaN(
|
|
769
|
+
Number.isNaN(C) || (L === void 0 && (L = C, U = I), W.set(p.label, { value: C, time: h }));
|
|
729
770
|
}
|
|
730
|
-
if (
|
|
731
|
-
const p =
|
|
732
|
-
if (p !== null &&
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
const
|
|
771
|
+
if (Pe(W), L !== void 0 && U) {
|
|
772
|
+
const p = t.timeScale().timeToCoordinate(h), I = U.priceToCoordinate(L);
|
|
773
|
+
if (p !== null && I !== null) {
|
|
774
|
+
const T = B.current;
|
|
775
|
+
if (T) {
|
|
776
|
+
const $ = T.querySelector(
|
|
736
777
|
".LightweightChart"
|
|
737
778
|
);
|
|
738
|
-
if (
|
|
739
|
-
const
|
|
740
|
-
|
|
779
|
+
if ($) {
|
|
780
|
+
const C = $.getBoundingClientRect(), H = T.getBoundingClientRect(), r = p + (C.left - H.left), o = I + (C.top - H.top);
|
|
781
|
+
J({ x: r, y: o });
|
|
741
782
|
} else
|
|
742
|
-
|
|
783
|
+
J({ x: p, y: I });
|
|
743
784
|
} else
|
|
744
|
-
|
|
785
|
+
J({ x: p, y: I });
|
|
745
786
|
} else
|
|
746
|
-
|
|
787
|
+
J(null);
|
|
747
788
|
} else
|
|
748
|
-
|
|
789
|
+
J(null);
|
|
749
790
|
};
|
|
750
|
-
return
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
const
|
|
754
|
-
|
|
791
|
+
return t.subscribeCrosshairMove(a), P && t.subscribeClick(a), !l && !Z && !xe && requestAnimationFrame(() => {
|
|
792
|
+
const s = e[0], h = s ? V.current.get(ie(s)) : void 0;
|
|
793
|
+
if (h && n && s.data.length > 0) {
|
|
794
|
+
const y = t.timeScale().timeToCoordinate(n), x = s.data[s.data.length - 1].value, v = h.priceToCoordinate(x);
|
|
795
|
+
y !== null && v !== null && J({ x: y, y: v });
|
|
755
796
|
}
|
|
756
797
|
}), () => {
|
|
757
|
-
|
|
798
|
+
t.unsubscribeCrosshairMove(a), P && t.unsubscribeClick(a);
|
|
758
799
|
};
|
|
759
|
-
}, [
|
|
760
|
-
const
|
|
761
|
-
if (!
|
|
762
|
-
const
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
766
|
-
if (!
|
|
767
|
-
const
|
|
768
|
-
for (const y of
|
|
769
|
-
const
|
|
770
|
-
for (const
|
|
771
|
-
if (y.labels.has(
|
|
772
|
-
for (const
|
|
773
|
-
const
|
|
774
|
-
|
|
800
|
+
}, [e, Z, P, xe]), A(() => {
|
|
801
|
+
const t = E.current;
|
|
802
|
+
if (!t || e.length === 0) return;
|
|
803
|
+
const l = t.timeScale(), n = () => {
|
|
804
|
+
const a = ze.current;
|
|
805
|
+
if (a.length === 0) return;
|
|
806
|
+
const s = l.getVisibleRange();
|
|
807
|
+
if (!s) return;
|
|
808
|
+
const h = Number(s.from), m = Number(s.to);
|
|
809
|
+
for (const y of a) {
|
|
810
|
+
const x = [];
|
|
811
|
+
for (const v of e)
|
|
812
|
+
if (y.labels.has(v.label))
|
|
813
|
+
for (const W of v.data) {
|
|
814
|
+
const L = Number(W.time);
|
|
815
|
+
L >= h && L <= m && x.push(W.value);
|
|
775
816
|
}
|
|
776
|
-
|
|
817
|
+
x.length > 0 && y.updateVisibleRange(x);
|
|
777
818
|
}
|
|
778
819
|
};
|
|
779
|
-
return
|
|
780
|
-
|
|
820
|
+
return l.subscribeVisibleLogicalRangeChange(n), () => {
|
|
821
|
+
l.unsubscribeVisibleLogicalRangeChange(
|
|
781
822
|
n
|
|
782
823
|
);
|
|
783
824
|
};
|
|
784
|
-
}, [
|
|
785
|
-
const
|
|
786
|
-
if (
|
|
787
|
-
const
|
|
788
|
-
for (const
|
|
789
|
-
const
|
|
790
|
-
...
|
|
791
|
-
...
|
|
825
|
+
}, [e]), A(() => {
|
|
826
|
+
const t = E.current, l = Array.from(V.current.values()), n = [];
|
|
827
|
+
if (t && l.length > 0 && w) {
|
|
828
|
+
const a = Ct(), s = l[0];
|
|
829
|
+
for (const h of w) {
|
|
830
|
+
const m = {
|
|
831
|
+
...a,
|
|
832
|
+
...h.options || {}
|
|
792
833
|
};
|
|
793
|
-
|
|
794
|
-
const y = new
|
|
795
|
-
|
|
834
|
+
m.color && (m.color = ne(m.color, m.color));
|
|
835
|
+
const y = new Rt(t, s, h.xCoordinate, m);
|
|
836
|
+
s.attachPrimitive(y), n.push(y);
|
|
796
837
|
}
|
|
797
838
|
}
|
|
798
839
|
return () => {
|
|
799
|
-
if (
|
|
800
|
-
const
|
|
801
|
-
for (const
|
|
840
|
+
if (l.length > 0) {
|
|
841
|
+
const a = l[0];
|
|
842
|
+
for (const s of n)
|
|
802
843
|
try {
|
|
803
|
-
|
|
844
|
+
a.detachPrimitive(s);
|
|
804
845
|
} catch {
|
|
805
846
|
}
|
|
806
847
|
}
|
|
807
848
|
};
|
|
808
|
-
}, [w,
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
811
|
-
const n =
|
|
849
|
+
}, [w, e, Y]), A(() => {
|
|
850
|
+
const t = [], l = [];
|
|
851
|
+
if (k && k.length > 0) {
|
|
852
|
+
const n = ne(
|
|
812
853
|
"hsl(var(--destructive))",
|
|
813
854
|
"rgb(239, 68, 68)"
|
|
814
855
|
);
|
|
815
|
-
for (const
|
|
816
|
-
if (!Number.isFinite(
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
856
|
+
for (const a of k) {
|
|
857
|
+
if (!Number.isFinite(a.price)) continue;
|
|
858
|
+
const s = et(
|
|
859
|
+
V.current,
|
|
860
|
+
e,
|
|
861
|
+
a.seriesLabel
|
|
862
|
+
);
|
|
863
|
+
if (!s) continue;
|
|
864
|
+
const h = a.color ? ne(a.color, a.color) : n, m = a.lineWidth ?? 1, y = a.lineStyle ?? ae.Dashed, x = s.createPriceLine({
|
|
865
|
+
price: a.price,
|
|
821
866
|
color: h,
|
|
822
|
-
lineWidth:
|
|
823
|
-
lineStyle:
|
|
824
|
-
axisLabelVisible:
|
|
825
|
-
title:
|
|
867
|
+
lineWidth: m,
|
|
868
|
+
lineStyle: y,
|
|
869
|
+
axisLabelVisible: a.axisLabelVisible ?? !0,
|
|
870
|
+
title: a.title ?? ""
|
|
826
871
|
});
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
872
|
+
t.push({ series: s, line: x });
|
|
873
|
+
const v = new Bt(
|
|
874
|
+
s,
|
|
875
|
+
a.price,
|
|
831
876
|
h,
|
|
832
|
-
|
|
833
|
-
|
|
877
|
+
m,
|
|
878
|
+
y
|
|
834
879
|
);
|
|
835
|
-
|
|
880
|
+
s.attachPrimitive(v), l.push({ series: s, primitive: v });
|
|
836
881
|
}
|
|
837
882
|
}
|
|
838
883
|
return () => {
|
|
839
|
-
for (const { series: n, primitive:
|
|
884
|
+
for (const { series: n, primitive: a } of l)
|
|
840
885
|
try {
|
|
841
|
-
n.detachPrimitive(
|
|
886
|
+
n.detachPrimitive(a);
|
|
842
887
|
} catch {
|
|
843
888
|
}
|
|
844
|
-
for (const { series: n, line:
|
|
889
|
+
for (const { series: n, line: a } of t)
|
|
845
890
|
try {
|
|
846
|
-
n.removePriceLine(
|
|
891
|
+
n.removePriceLine(a);
|
|
847
892
|
} catch {
|
|
848
893
|
}
|
|
849
894
|
};
|
|
850
|
-
}, [
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
853
|
-
const
|
|
854
|
-
for (const
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
895
|
+
}, [k, e, Y]), A(() => {
|
|
896
|
+
const t = [];
|
|
897
|
+
if (G && G.length > 0) {
|
|
898
|
+
const l = "rgba(239, 68, 68, 0.12)";
|
|
899
|
+
for (const n of G) {
|
|
900
|
+
const a = et(
|
|
901
|
+
V.current,
|
|
902
|
+
e,
|
|
903
|
+
n.seriesLabel
|
|
904
|
+
);
|
|
905
|
+
if (!a) continue;
|
|
906
|
+
const s = n.color ? ne(n.color, l) : l, h = new kt(
|
|
907
|
+
a,
|
|
908
|
+
n.priceTop,
|
|
909
|
+
n.priceBottom,
|
|
910
|
+
s
|
|
862
911
|
);
|
|
863
|
-
|
|
912
|
+
a.attachPrimitive(h), t.push({ series: a, zone: h });
|
|
864
913
|
}
|
|
865
914
|
}
|
|
866
915
|
return () => {
|
|
867
|
-
for (const { series:
|
|
916
|
+
for (const { series: l, zone: n } of t)
|
|
868
917
|
try {
|
|
869
|
-
|
|
918
|
+
l.detachPrimitive(n);
|
|
870
919
|
} catch {
|
|
871
920
|
}
|
|
872
921
|
};
|
|
873
|
-
}, [
|
|
874
|
-
const
|
|
875
|
-
if (!
|
|
876
|
-
|
|
922
|
+
}, [G, e, Y]), A(() => {
|
|
923
|
+
const t = E.current;
|
|
924
|
+
if (!t || !w?.length) {
|
|
925
|
+
$e([]);
|
|
877
926
|
return;
|
|
878
927
|
}
|
|
879
|
-
const
|
|
880
|
-
const
|
|
881
|
-
|
|
928
|
+
const l = () => {
|
|
929
|
+
const s = t.timeScale(), h = w.map((m) => s.timeToCoordinate(m.xCoordinate) ?? null);
|
|
930
|
+
$e(h), B.current && He(B.current.clientWidth);
|
|
882
931
|
};
|
|
883
|
-
|
|
884
|
-
const n =
|
|
885
|
-
|
|
932
|
+
l();
|
|
933
|
+
const n = t.timeScale(), a = () => {
|
|
934
|
+
l();
|
|
886
935
|
};
|
|
887
|
-
return n.subscribeVisibleLogicalRangeChange(
|
|
888
|
-
n.unsubscribeVisibleLogicalRangeChange(
|
|
936
|
+
return n.subscribeVisibleLogicalRangeChange(a), () => {
|
|
937
|
+
n.unsubscribeVisibleLogicalRangeChange(a);
|
|
889
938
|
};
|
|
890
|
-
}, [w,
|
|
891
|
-
|
|
892
|
-
const
|
|
939
|
+
}, [w, e, Y]), dt(() => {
|
|
940
|
+
lt((t) => {
|
|
941
|
+
const l = {};
|
|
893
942
|
let n = !1;
|
|
894
|
-
for (const [
|
|
895
|
-
if (!
|
|
896
|
-
const
|
|
897
|
-
|
|
943
|
+
for (const [a, s] of je.current) {
|
|
944
|
+
if (!s) continue;
|
|
945
|
+
const h = s.offsetWidth;
|
|
946
|
+
l[a] = h, t[a] !== h && (n = !0);
|
|
898
947
|
}
|
|
899
|
-
return Object.keys(
|
|
948
|
+
return Object.keys(t).length !== Object.keys(l).length && (n = !0), n ? l : t;
|
|
900
949
|
});
|
|
901
950
|
});
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
return
|
|
951
|
+
const me = e.length === 1, Ke = Ve.useMemo(() => {
|
|
952
|
+
if (me && e.length > 0) {
|
|
953
|
+
const t = e[0];
|
|
954
|
+
if (t.data.length > 0)
|
|
955
|
+
return t.data[t.data.length - 1];
|
|
907
956
|
}
|
|
908
|
-
}, [
|
|
909
|
-
return /* @__PURE__ */
|
|
957
|
+
}, [me, e]);
|
|
958
|
+
return /* @__PURE__ */ ge(
|
|
910
959
|
"div",
|
|
911
960
|
{
|
|
912
|
-
ref:
|
|
913
|
-
className:
|
|
961
|
+
ref: B,
|
|
962
|
+
className: ee(
|
|
914
963
|
"relative z-[1] w-full h-full overflow-hidden p-0",
|
|
915
|
-
|
|
964
|
+
i
|
|
916
965
|
),
|
|
917
966
|
children: [
|
|
918
|
-
|
|
919
|
-
|
|
967
|
+
ye != null && ye !== !1 && me ? /* @__PURE__ */ N("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ N("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: ye }) }) : rt && me && Ke && /* @__PURE__ */ N(
|
|
968
|
+
Pt,
|
|
920
969
|
{
|
|
921
|
-
point:
|
|
970
|
+
point: Ke,
|
|
922
971
|
xMeasureUnit: c,
|
|
923
|
-
yMeasureUnit:
|
|
924
|
-
decimals:
|
|
972
|
+
yMeasureUnit: d,
|
|
973
|
+
decimals: Ce
|
|
925
974
|
}
|
|
926
975
|
),
|
|
927
|
-
|
|
928
|
-
|
|
976
|
+
Ge && We && /* @__PURE__ */ N(
|
|
977
|
+
Tt,
|
|
929
978
|
{
|
|
930
|
-
points:
|
|
979
|
+
points: Ge,
|
|
931
980
|
xMeasureUnit: c,
|
|
932
|
-
yMeasureUnit:
|
|
933
|
-
series:
|
|
934
|
-
position:
|
|
935
|
-
containerRef:
|
|
936
|
-
decimals:
|
|
981
|
+
yMeasureUnit: d,
|
|
982
|
+
series: e,
|
|
983
|
+
position: We,
|
|
984
|
+
containerRef: B,
|
|
985
|
+
decimals: Ce
|
|
937
986
|
}
|
|
938
987
|
),
|
|
939
|
-
u && /* @__PURE__ */
|
|
940
|
-
w && w.length > 0 &&
|
|
988
|
+
u && /* @__PURE__ */ N(Wt, { series: e, onUnselect: f }),
|
|
989
|
+
w && w.length > 0 && Xe.length === w.length && /* @__PURE__ */ N(
|
|
941
990
|
"div",
|
|
942
991
|
{
|
|
943
992
|
className: "absolute inset-0 z-[5] pointer-events-none",
|
|
944
993
|
"aria-hidden": !0,
|
|
945
|
-
children: w.map((
|
|
946
|
-
const n =
|
|
994
|
+
children: w.map((t, l) => {
|
|
995
|
+
const n = Xe[l], a = t.options ?? {};
|
|
947
996
|
if (n === null) return null;
|
|
948
|
-
const { labelText:
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
),
|
|
953
|
-
if (!(
|
|
954
|
-
const
|
|
997
|
+
const { labelText: s, valueStr: h } = Ft(
|
|
998
|
+
a,
|
|
999
|
+
d,
|
|
1000
|
+
Ce
|
|
1001
|
+
), m = a.tooltipText ?? "";
|
|
1002
|
+
if (!(s || h || m)) return null;
|
|
1003
|
+
const x = a.labelBackgroundColor ?? a.color ?? "hsl(var(--background))", v = a.labelTextColor ?? "hsl(var(--foreground))", W = `${String(t.xCoordinate)}-${s}-${m}`, L = zt(
|
|
955
1004
|
n,
|
|
956
|
-
|
|
957
|
-
|
|
1005
|
+
it,
|
|
1006
|
+
at[l]
|
|
958
1007
|
);
|
|
959
|
-
return /* @__PURE__ */
|
|
1008
|
+
return /* @__PURE__ */ ge(
|
|
960
1009
|
"div",
|
|
961
1010
|
{
|
|
962
|
-
ref: (
|
|
963
|
-
|
|
1011
|
+
ref: (U) => {
|
|
1012
|
+
je.current.set(l, U);
|
|
964
1013
|
},
|
|
965
|
-
className:
|
|
1014
|
+
className: ee(
|
|
966
1015
|
"group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
|
|
967
|
-
|
|
1016
|
+
m && "pointer-events-auto cursor-default"
|
|
968
1017
|
),
|
|
969
1018
|
style: {
|
|
970
|
-
...
|
|
971
|
-
backgroundColor:
|
|
972
|
-
color:
|
|
1019
|
+
...L,
|
|
1020
|
+
backgroundColor: x,
|
|
1021
|
+
color: v
|
|
973
1022
|
},
|
|
974
1023
|
children: [
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1024
|
+
s && /* @__PURE__ */ N("span", { className: "block", children: s }),
|
|
1025
|
+
h && /* @__PURE__ */ N("span", { className: ee("block", s && "mt-0.5"), children: h }),
|
|
1026
|
+
m && /* @__PURE__ */ N(
|
|
978
1027
|
"span",
|
|
979
1028
|
{
|
|
980
1029
|
className: "pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",
|
|
981
1030
|
role: "tooltip",
|
|
982
|
-
children:
|
|
1031
|
+
children: m
|
|
983
1032
|
}
|
|
984
1033
|
)
|
|
985
1034
|
]
|
|
986
1035
|
},
|
|
987
|
-
|
|
1036
|
+
W
|
|
988
1037
|
);
|
|
989
1038
|
})
|
|
990
1039
|
}
|
|
991
1040
|
),
|
|
992
|
-
/* @__PURE__ */
|
|
1041
|
+
/* @__PURE__ */ N(
|
|
993
1042
|
"div",
|
|
994
1043
|
{
|
|
995
|
-
ref:
|
|
1044
|
+
ref: we,
|
|
996
1045
|
className: "LightweightChart w-full h-full overflow-hidden"
|
|
997
1046
|
}
|
|
998
1047
|
)
|
|
@@ -1000,62 +1049,62 @@ function Xt({
|
|
|
1000
1049
|
}
|
|
1001
1050
|
);
|
|
1002
1051
|
}
|
|
1003
|
-
function
|
|
1004
|
-
series:
|
|
1005
|
-
onUnselect:
|
|
1052
|
+
function Wt({
|
|
1053
|
+
series: e,
|
|
1054
|
+
onUnselect: i,
|
|
1006
1055
|
inline: u = !1
|
|
1007
1056
|
}) {
|
|
1008
|
-
const
|
|
1009
|
-
return /* @__PURE__ */
|
|
1057
|
+
const f = e.every((c) => c.data.length === 0);
|
|
1058
|
+
return /* @__PURE__ */ N(
|
|
1010
1059
|
"div",
|
|
1011
1060
|
{
|
|
1012
|
-
className:
|
|
1061
|
+
className: ee(
|
|
1013
1062
|
"flex flex-wrap",
|
|
1014
1063
|
u ? "items-center justify-center gap-6" : "absolute top-0 left-2 z-[10] gap-2"
|
|
1015
1064
|
),
|
|
1016
|
-
children:
|
|
1017
|
-
const
|
|
1018
|
-
return /* @__PURE__ */
|
|
1065
|
+
children: e.map((c, d) => {
|
|
1066
|
+
const S = ot(d), w = (c.lineColor ?? c.color) || S.line, k = !f && c.data.length === 0;
|
|
1067
|
+
return /* @__PURE__ */ ge(
|
|
1019
1068
|
"div",
|
|
1020
1069
|
{
|
|
1021
|
-
className:
|
|
1070
|
+
className: ee(
|
|
1022
1071
|
"flex items-center gap-1.5",
|
|
1023
1072
|
!u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
|
|
1024
|
-
|
|
1073
|
+
k && "opacity-50"
|
|
1025
1074
|
),
|
|
1026
1075
|
children: [
|
|
1027
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ N(
|
|
1028
1077
|
"div",
|
|
1029
1078
|
{
|
|
1030
|
-
className:
|
|
1079
|
+
className: ee(
|
|
1031
1080
|
u ? "size-2 rounded-full" : "h-3 w-3 rounded-sm"
|
|
1032
1081
|
),
|
|
1033
1082
|
style: { backgroundColor: w }
|
|
1034
1083
|
}
|
|
1035
1084
|
),
|
|
1036
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ ge(
|
|
1037
1086
|
"span",
|
|
1038
1087
|
{
|
|
1039
|
-
className:
|
|
1088
|
+
className: ee(
|
|
1040
1089
|
"font-medium text-foreground",
|
|
1041
1090
|
u ? "text-sm" : "text-[10px] sm:text-xs"
|
|
1042
1091
|
),
|
|
1043
1092
|
children: [
|
|
1044
1093
|
c.label,
|
|
1045
|
-
|
|
1094
|
+
k && " (no data)"
|
|
1046
1095
|
]
|
|
1047
1096
|
}
|
|
1048
1097
|
),
|
|
1049
|
-
|
|
1098
|
+
i && /* @__PURE__ */ N(
|
|
1050
1099
|
"button",
|
|
1051
1100
|
{
|
|
1052
1101
|
type: "button",
|
|
1053
|
-
onClick: (
|
|
1054
|
-
|
|
1102
|
+
onClick: (G) => {
|
|
1103
|
+
G.stopPropagation(), i(c.label);
|
|
1055
1104
|
},
|
|
1056
1105
|
className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
|
|
1057
1106
|
"aria-label": `Remove ${c.label}`,
|
|
1058
|
-
children: /* @__PURE__ */
|
|
1107
|
+
children: /* @__PURE__ */ ge(
|
|
1059
1108
|
"svg",
|
|
1060
1109
|
{
|
|
1061
1110
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1070,9 +1119,9 @@ function Mt({
|
|
|
1070
1119
|
className: "text-muted-foreground hover:text-foreground",
|
|
1071
1120
|
"aria-hidden": "true",
|
|
1072
1121
|
children: [
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */
|
|
1122
|
+
/* @__PURE__ */ N("title", { children: "Close" }),
|
|
1123
|
+
/* @__PURE__ */ N("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1124
|
+
/* @__PURE__ */ N("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1076
1125
|
]
|
|
1077
1126
|
}
|
|
1078
1127
|
)
|
|
@@ -1080,19 +1129,20 @@ function Mt({
|
|
|
1080
1129
|
)
|
|
1081
1130
|
]
|
|
1082
1131
|
},
|
|
1083
|
-
c.label
|
|
1132
|
+
c.id ?? c.label
|
|
1084
1133
|
);
|
|
1085
1134
|
})
|
|
1086
1135
|
}
|
|
1087
1136
|
);
|
|
1088
1137
|
}
|
|
1089
1138
|
export {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1139
|
+
Me as DEFAULT_SERIES_COLORS,
|
|
1140
|
+
oo as Graph,
|
|
1141
|
+
Wt as GraphLegend,
|
|
1142
|
+
tt as VERTICAL_LINE_LABEL_EDGE_PADDING,
|
|
1143
|
+
ot as getSeriesColorPalette,
|
|
1144
|
+
At as getStepForwardValue,
|
|
1145
|
+
zt as getVerticalLineLabelStyle,
|
|
1146
|
+
Ft as getVerticalLineTooltipContent,
|
|
1147
|
+
ie as seriesIdentity
|
|
1098
1148
|
};
|