@dwlf/charting 1.2.0 → 1.3.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.
- package/dist/charting/types.d.ts +9 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +281 -281
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -334,9 +334,9 @@ function xr(e, t = 50, r = 30, c = "daily") {
|
|
|
334
334
|
const W = Math.min(o, e.length), U = e.slice(u, W);
|
|
335
335
|
let S = [];
|
|
336
336
|
if (o > e.length && e.length) {
|
|
337
|
-
const Q = new Date(e[e.length - 1].date), J = Math.max(u, e.length), j = Math.max(0, o - J),
|
|
337
|
+
const Q = new Date(e[e.length - 1].date), J = Math.max(u, e.length), j = Math.max(0, o - J), T = J - (e.length - 1);
|
|
338
338
|
S = Array.from({ length: j }, (A, C) => {
|
|
339
|
-
const V =
|
|
339
|
+
const V = T + C, y = new Date(Q.getTime() + V * l).toISOString();
|
|
340
340
|
return {
|
|
341
341
|
date: n === "hourly" ? y : y.split("T")[0],
|
|
342
342
|
_virtual: !0
|
|
@@ -364,7 +364,7 @@ function xr(e, t = 50, r = 30, c = "daily") {
|
|
|
364
364
|
if (!p) return;
|
|
365
365
|
const U = W.clientX - h, S = a.current;
|
|
366
366
|
if (!S) return;
|
|
367
|
-
const Q = S.getBoundingClientRect(), J = { left: 10, right: 20 },
|
|
367
|
+
const Q = S.getBoundingClientRect(), J = { left: 10, right: 20 }, T = (Q.width - J.left - J.right) / b, A = Math.round(U / (T * 1.5));
|
|
368
368
|
if (A !== 0) {
|
|
369
369
|
const { start: C, end: V } = M(u - A, b);
|
|
370
370
|
i(C), m(V), P(W.clientX);
|
|
@@ -383,9 +383,9 @@ function xr(e, t = 50, r = 30, c = "daily") {
|
|
|
383
383
|
}
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
|
-
const
|
|
386
|
+
const T = (W.clientX - U.left - S.left) / Q, C = 1 + W.deltaY * 2e-3, V = C <= 0 ? 0.1 : C, ne = Math.max(5, Math.min(s, Math.round(b * V)));
|
|
387
387
|
if (ne === b) return;
|
|
388
|
-
const y = u +
|
|
388
|
+
const y = u + T * b, R = Math.round(y - T * ne), { start: be, end: H } = M(R, ne);
|
|
389
389
|
i(be), m(H);
|
|
390
390
|
},
|
|
391
391
|
[b, u, M, s]
|
|
@@ -767,14 +767,14 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
767
767
|
Ne(() => {
|
|
768
768
|
F.current = t, b.current = m, M.current = a, L.current = g, N.current = p;
|
|
769
769
|
}, [t, m, a, g, p]);
|
|
770
|
-
const x = k((
|
|
771
|
-
|
|
772
|
-
}, [e.id, u]), f = k((
|
|
773
|
-
|
|
774
|
-
}, [e.id, i]), Y = k((
|
|
775
|
-
P.current =
|
|
776
|
-
}, [e.time]), _ = k((
|
|
777
|
-
const A =
|
|
770
|
+
const x = k((T) => {
|
|
771
|
+
T.stopPropagation(), u == null || u(e.id);
|
|
772
|
+
}, [e.id, u]), f = k((T) => {
|
|
773
|
+
T.stopPropagation(), i == null || i(e.id);
|
|
774
|
+
}, [e.id, i]), Y = k((T) => {
|
|
775
|
+
P.current = T.clientX, D.current = e.time;
|
|
776
|
+
}, [e.time]), _ = k((T) => {
|
|
777
|
+
const A = T.clientX - P.current, C = F.current, V = b.current, ne = M.current, y = L.current, R = N.current, be = V && ne && R > 0 ? Ue(D.current, y, V) ?? D.current : D.current, H = C(be) + A;
|
|
778
778
|
let K = D.current;
|
|
779
779
|
if (C.invert) {
|
|
780
780
|
const ee = C.invert(H), oe = ee instanceof Date ? ee.getTime() : ee;
|
|
@@ -1033,8 +1033,8 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1033
1033
|
}, [t, r, o, m, p, a]);
|
|
1034
1034
|
const N = k((ie) => {
|
|
1035
1035
|
ie.stopPropagation(), u == null || u(e.id);
|
|
1036
|
-
}, [e.id, u]), x = k((ie,
|
|
1037
|
-
const Z = P.current, X = D.current, te = F.current, ce = b.current, re = M.current, le = L.current, Oe = !!(te && ce && le > 0) ? Ue(ie, re, te) : null, De = Z(Oe ?? ie) + v, we = X.scale(
|
|
1036
|
+
}, [e.id, u]), x = k((ie, I, v, z) => {
|
|
1037
|
+
const Z = P.current, X = D.current, te = F.current, ce = b.current, re = M.current, le = L.current, Oe = !!(te && ce && le > 0) ? Ue(ie, re, te) : null, De = Z(Oe ?? ie) + v, we = X.scale(I) + z;
|
|
1038
1038
|
let ke = ie;
|
|
1039
1039
|
if (Z.invert) {
|
|
1040
1040
|
const xe = Z.invert(De), Se = xe instanceof Date ? xe.getTime() : xe;
|
|
@@ -1043,7 +1043,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1043
1043
|
const $e = X.invert(we);
|
|
1044
1044
|
return {
|
|
1045
1045
|
time: Number.isFinite(ke) ? ke : ie,
|
|
1046
|
-
price: Number.isFinite($e) ? $e :
|
|
1046
|
+
price: Number.isFinite($e) ? $e : I
|
|
1047
1047
|
};
|
|
1048
1048
|
}, []), f = k((ie) => {
|
|
1049
1049
|
g.current = { x: ie.clientX, y: ie.clientY }, h.current = {
|
|
@@ -1053,10 +1053,10 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1053
1053
|
price2: e.price2
|
|
1054
1054
|
};
|
|
1055
1055
|
}, [e.time1, e.price1, e.time2, e.price2]), Y = k((ie) => {
|
|
1056
|
-
const
|
|
1056
|
+
const I = ie.clientX - g.current.x, v = ie.clientY - g.current.y, { time: z, price: Z } = x(
|
|
1057
1057
|
h.current.time1,
|
|
1058
1058
|
h.current.price1,
|
|
1059
|
-
|
|
1059
|
+
I,
|
|
1060
1060
|
v
|
|
1061
1061
|
);
|
|
1062
1062
|
i == null || i(e.id, { time1: z, price1: Z });
|
|
@@ -1064,10 +1064,10 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1064
1064
|
onDragStart: f,
|
|
1065
1065
|
onDragMove: Y
|
|
1066
1066
|
}), O = k((ie) => {
|
|
1067
|
-
const
|
|
1067
|
+
const I = ie.clientX - g.current.x, v = ie.clientY - g.current.y, { time: z, price: Z } = x(
|
|
1068
1068
|
h.current.time2,
|
|
1069
1069
|
h.current.price2,
|
|
1070
|
-
|
|
1070
|
+
I,
|
|
1071
1071
|
v
|
|
1072
1072
|
);
|
|
1073
1073
|
i == null || i(e.id, { time2: z, price2: Z });
|
|
@@ -1075,7 +1075,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1075
1075
|
onDragStart: f,
|
|
1076
1076
|
onDragMove: O
|
|
1077
1077
|
}), W = k((ie) => {
|
|
1078
|
-
const
|
|
1078
|
+
const I = ie.clientX - g.current.x, v = ie.clientY - g.current.y, z = x(h.current.time1, h.current.price1, I, v), Z = x(h.current.time2, h.current.price2, I, v);
|
|
1079
1079
|
i == null || i(e.id, { time1: z.time, price1: z.price, time2: Z.time, price2: Z.price });
|
|
1080
1080
|
}, [e.id, i, x]), { isDragging: U, handleMouseDown: S } = Xe({
|
|
1081
1081
|
onDragStart: f,
|
|
@@ -1098,11 +1098,11 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1098
1098
|
c
|
|
1099
1099
|
);
|
|
1100
1100
|
if (J === void 0 || j === void 0) return null;
|
|
1101
|
-
const
|
|
1102
|
-
if (!Number.isFinite(
|
|
1101
|
+
const T = r.scale(e.price1), A = r.scale(e.price2);
|
|
1102
|
+
if (!Number.isFinite(T) || !Number.isFinite(A)) return null;
|
|
1103
1103
|
const { ex1: C, ey1: V, ex2: ne, ey2: y } = Lr(
|
|
1104
1104
|
J,
|
|
1105
|
-
|
|
1105
|
+
T,
|
|
1106
1106
|
j,
|
|
1107
1107
|
A,
|
|
1108
1108
|
c,
|
|
@@ -1111,7 +1111,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1111
1111
|
e.extendRight
|
|
1112
1112
|
), R = C < -50 && ne < -50 || C > c + 50 && ne > c + 50, be = V < -50 && y < -50 || V > n + 50 && y > n + 50;
|
|
1113
1113
|
if (R || be) return null;
|
|
1114
|
-
const H = rt[e.lineStyle] || void 0, K = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", ee = l ? "#e2e8f0" : "#1f2937", oe = e.label || "", G = (J + j) / 2, se = (
|
|
1114
|
+
const H = rt[e.lineStyle] || void 0, K = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", ee = l ? "#e2e8f0" : "#1f2937", oe = e.label || "", G = (J + j) / 2, se = (T + A) / 2;
|
|
1115
1115
|
return /* @__PURE__ */ de(
|
|
1116
1116
|
"g",
|
|
1117
1117
|
{
|
|
@@ -1190,7 +1190,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1190
1190
|
"circle",
|
|
1191
1191
|
{
|
|
1192
1192
|
cx: J,
|
|
1193
|
-
cy:
|
|
1193
|
+
cy: T,
|
|
1194
1194
|
r: Ae,
|
|
1195
1195
|
fill: ee,
|
|
1196
1196
|
fillOpacity: 0.9,
|
|
@@ -1309,7 +1309,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1309
1309
|
const oe = ne(ee) + C, G = y.scale(P.current.price) + V;
|
|
1310
1310
|
let se = P.current.time;
|
|
1311
1311
|
if (ne.invert) {
|
|
1312
|
-
const
|
|
1312
|
+
const I = ne.invert(oe), v = I instanceof Date ? I.getTime() : I;
|
|
1313
1313
|
se = be ? be(Math.round(v)) : v;
|
|
1314
1314
|
}
|
|
1315
1315
|
const ie = y.invert(G);
|
|
@@ -1323,7 +1323,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1323
1323
|
const A = O >= -50 && O <= c + 50, C = E >= -50 && E <= n + 50;
|
|
1324
1324
|
if (!A && !C) return null;
|
|
1325
1325
|
}
|
|
1326
|
-
const q = rt[e.lineStyle] || void 0, W = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", U = l ? "#e2e8f0" : "#1f2937", S = e.showPrice ? e.price.toFixed(2) : "", Q = e.showTime ? g(e.time) : "", J = e.label || "", j = S ? Math.max(50, S.length * 7 + 16) : 0,
|
|
1326
|
+
const q = rt[e.lineStyle] || void 0, W = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", U = l ? "#e2e8f0" : "#1f2937", S = e.showPrice ? e.price.toFixed(2) : "", Q = e.showTime ? g(e.time) : "", J = e.label || "", j = S ? Math.max(50, S.length * 7 + 16) : 0, T = Q ? Math.max(60, Q.length * 7 + 16) : 0;
|
|
1327
1327
|
return /* @__PURE__ */ de(
|
|
1328
1328
|
"g",
|
|
1329
1329
|
{
|
|
@@ -1451,9 +1451,9 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1451
1451
|
/* @__PURE__ */ d(
|
|
1452
1452
|
"rect",
|
|
1453
1453
|
{
|
|
1454
|
-
x: O -
|
|
1454
|
+
x: O - T / 2,
|
|
1455
1455
|
y: n - 20,
|
|
1456
|
-
width:
|
|
1456
|
+
width: T,
|
|
1457
1457
|
height: 20,
|
|
1458
1458
|
fill: e.color,
|
|
1459
1459
|
fillOpacity: 0.9,
|
|
@@ -1563,10 +1563,10 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1563
1563
|
const N = k((G) => {
|
|
1564
1564
|
G.stopPropagation(), u == null || u(e.id);
|
|
1565
1565
|
}, [e.id, u]), x = k((G, se) => {
|
|
1566
|
-
const ie = P.current,
|
|
1566
|
+
const ie = P.current, I = F.current, v = b.current, z = M.current, Z = L.current, X = I && v && Z > 0 ? $t(G, z, I) ?? G : G, te = ie(X) + se;
|
|
1567
1567
|
if (!ie.invert) return G;
|
|
1568
1568
|
const ce = ie.invert(te), re = ce instanceof Date ? ce.getTime() : ce;
|
|
1569
|
-
return
|
|
1569
|
+
return I && v && Z > 0 ? v(Math.round(re)) : re;
|
|
1570
1570
|
}, []), f = k((G) => {
|
|
1571
1571
|
g.current = { x: G.clientX, y: G.clientY }, h.current = {
|
|
1572
1572
|
time1: e.time1,
|
|
@@ -1575,7 +1575,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1575
1575
|
price2: e.price2
|
|
1576
1576
|
};
|
|
1577
1577
|
}, [e.time1, e.price1, e.time2, e.price2]), Y = k((G) => {
|
|
1578
|
-
const se = G.clientX - g.current.x, ie = G.clientY - g.current.y,
|
|
1578
|
+
const se = G.clientX - g.current.x, ie = G.clientY - g.current.y, I = D.current, v = h.current, z = x(v.time1, se), Z = x(v.time2, se), X = I.invert(I.scale(v.price1) + ie), te = I.invert(I.scale(v.price2) + ie);
|
|
1579
1579
|
[z, Z, X, te].every(Number.isFinite) && (i == null || i(e.id, {
|
|
1580
1580
|
time1: z,
|
|
1581
1581
|
price1: X,
|
|
@@ -1583,7 +1583,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1583
1583
|
price2: te
|
|
1584
1584
|
}));
|
|
1585
1585
|
}, [e.id, i, x]), _ = k((G) => (se) => {
|
|
1586
|
-
const ie = se.clientX - g.current.x,
|
|
1586
|
+
const ie = se.clientX - g.current.x, I = se.clientY - g.current.y, v = D.current, z = h.current, Z = v.scale(z.price1), X = v.scale(z.price2), te = Z <= X, ce = {}, re = P.current, le = F.current, We = M.current, Oe = (le ? $t(z.time1, We, le) : void 0) ?? z.time1, Fe = (le ? $t(z.time2, We, le) : void 0) ?? z.time2, De = re(Oe), we = re(Fe), ke = De <= we;
|
|
1587
1587
|
if (G === "tl" || G === "bl") {
|
|
1588
1588
|
const $e = ke ? z.time1 : z.time2, xe = x($e, ie);
|
|
1589
1589
|
Number.isFinite(xe) && (ke ? ce.time1 = xe : ce.time2 = xe);
|
|
@@ -1592,10 +1592,10 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1592
1592
|
Number.isFinite(xe) && (ke ? ce.time2 = xe : ce.time1 = xe);
|
|
1593
1593
|
}
|
|
1594
1594
|
if (G === "tl" || G === "tr") {
|
|
1595
|
-
const $e = te ? z.price1 : z.price2, xe = v.invert(v.scale($e) +
|
|
1595
|
+
const $e = te ? z.price1 : z.price2, xe = v.invert(v.scale($e) + I);
|
|
1596
1596
|
Number.isFinite(xe) && (te ? ce.price1 = xe : ce.price2 = xe);
|
|
1597
1597
|
} else {
|
|
1598
|
-
const $e = te ? z.price2 : z.price1, xe = v.invert(v.scale($e) +
|
|
1598
|
+
const $e = te ? z.price2 : z.price1, xe = v.invert(v.scale($e) + I);
|
|
1599
1599
|
Number.isFinite(xe) && (te ? ce.price2 = xe : ce.price1 = xe);
|
|
1600
1600
|
}
|
|
1601
1601
|
i == null || i(e.id, ce);
|
|
@@ -1614,9 +1614,9 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1614
1614
|
if (o) return o(G);
|
|
1615
1615
|
}, Q = S(e.time1), J = S(e.time2);
|
|
1616
1616
|
if (o && (Q === void 0 || J === void 0)) return null;
|
|
1617
|
-
const j = t(Q ?? e.time1),
|
|
1618
|
-
if ([j,
|
|
1619
|
-
const V = Math.min(j,
|
|
1617
|
+
const j = t(Q ?? e.time1), T = t(J ?? e.time2), A = r.scale(e.price1), C = r.scale(e.price2);
|
|
1618
|
+
if ([j, T, A, C].some((G) => !Number.isFinite(G))) return null;
|
|
1619
|
+
const V = Math.min(j, T), ne = Math.max(j, T), y = Math.min(A, C), R = Math.max(A, C), be = ne - V, H = R - y;
|
|
1620
1620
|
if (ne < -50 || V > c + 50 || R < -50 || y > n + 50) return null;
|
|
1621
1621
|
const K = zr[e.lineStyle] || void 0, ee = l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)", oe = l ? "#e2e8f0" : "#1f2937";
|
|
1622
1622
|
return /* @__PURE__ */ de(
|
|
@@ -1790,8 +1790,8 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1790
1790
|
const A = w.invert(Q), C = A instanceof Date ? A.getTime() : A;
|
|
1791
1791
|
j = q ? q(Math.round(C)) : C;
|
|
1792
1792
|
}
|
|
1793
|
-
const
|
|
1794
|
-
Number.isFinite(j) && Number.isFinite(
|
|
1793
|
+
const T = O.invert(J);
|
|
1794
|
+
Number.isFinite(j) && Number.isFinite(T) && (l == null || l(e, j, T));
|
|
1795
1795
|
}, [e, l]), { isDragging: L, handleMouseDown: N } = Xe({
|
|
1796
1796
|
onDragStart: b,
|
|
1797
1797
|
onDragMove: M
|
|
@@ -1941,7 +1941,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1941
1941
|
const ee = K.clientX - p.current, oe = g.current, G = L(oe.time1, ee), se = L(oe.time2, ee);
|
|
1942
1942
|
Number.isFinite(G) && Number.isFinite(se) && (u == null || u(e.id, { time1: G, time2: se }));
|
|
1943
1943
|
}, [e.id, u, L]), f = k((K) => (ee) => {
|
|
1944
|
-
const oe = ee.clientX - p.current, G = g.current, se = h.current, ie = P.current,
|
|
1944
|
+
const oe = ee.clientX - p.current, G = g.current, se = h.current, ie = P.current, I = D.current, v = !!(ie && I), z = v ? M(G.time1) : G.time1, Z = v ? M(G.time2) : G.time2, X = z !== void 0 && Z !== void 0 ? se(z) <= se(Z) : G.time1 <= G.time2;
|
|
1945
1945
|
if (K === "left") {
|
|
1946
1946
|
const te = X ? G.time1 : G.time2, ce = L(te, oe);
|
|
1947
1947
|
Number.isFinite(ce) && (u == null || u(e.id, X ? { time1: ce } : { time2: ce }));
|
|
@@ -1965,9 +1965,9 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
1965
1965
|
}, U = W(e.time1), S = W(e.time2);
|
|
1966
1966
|
if (i && (U === void 0 || S === void 0))
|
|
1967
1967
|
return null;
|
|
1968
|
-
const Q = U ?? e.time1, J = S ?? e.time2, j = t(Q),
|
|
1969
|
-
if (!Number.isFinite(j) || !Number.isFinite(
|
|
1970
|
-
const A = Math.min(j,
|
|
1968
|
+
const Q = U ?? e.time1, J = S ?? e.time2, j = t(Q), T = t(J);
|
|
1969
|
+
if (!Number.isFinite(j) || !Number.isFinite(T)) return null;
|
|
1970
|
+
const A = Math.min(j, T), C = Math.max(j, T), V = C - A;
|
|
1971
1971
|
if (C < -50 || A > r + 50) return null;
|
|
1972
1972
|
const ne = qr[e.lineStyle] || void 0, y = n ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)", R = n ? "#e2e8f0" : "#1f2937", be = 6, H = 40;
|
|
1973
1973
|
return /* @__PURE__ */ de(
|
|
@@ -2225,18 +2225,18 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2225
2225
|
if (m) return m(re);
|
|
2226
2226
|
}, U = W(e.time1), S = W(e.time2);
|
|
2227
2227
|
if (m && (U === void 0 || S === void 0)) return null;
|
|
2228
|
-
const Q = t(U ?? e.time1), J = r.scale(e.price1), j = t(S ?? e.time2),
|
|
2229
|
-
if (!Number.isFinite(Q) || !Number.isFinite(J) || !Number.isFinite(j) || !Number.isFinite(
|
|
2228
|
+
const Q = t(U ?? e.time1), J = r.scale(e.price1), j = t(S ?? e.time2), T = r.scale(e.price2);
|
|
2229
|
+
if (!Number.isFinite(Q) || !Number.isFinite(J) || !Number.isFinite(j) || !Number.isFinite(T)) return null;
|
|
2230
2230
|
const A = 100;
|
|
2231
|
-
if (Q < -A && j < -A || Q > c + A && j > c + A || J < -A &&
|
|
2231
|
+
if (Q < -A && j < -A || Q > c + A && j > c + A || J < -A && T < -A || J > n + A && T > n + A) return null;
|
|
2232
2232
|
const V = jr[e.lineStyle] || void 0, ne = l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)", y = l ? "#e2e8f0" : "#1f2937", R = 6, be = e.fontSize * 1.3, H = e.text || "", K = H.split(`
|
|
2233
|
-
`), ee = K.length, oe = Math.max(...K.map((re) => re.length), 1), G = Math.max(24, oe * (e.fontSize * 0.6) + R * 2), se = ee === 1 ? e.fontSize + R * 2 : ee * be + R * 2, ie = l ? "rgba(30, 41, 59, 0.95)" : "rgba(255, 255, 255, 0.95)",
|
|
2233
|
+
`), ee = K.length, oe = Math.max(...K.map((re) => re.length), 1), G = Math.max(24, oe * (e.fontSize * 0.6) + R * 2), se = ee === 1 ? e.fontSize + R * 2 : ee * be + R * 2, ie = l ? "rgba(30, 41, 59, 0.95)" : "rgba(255, 255, 255, 0.95)", I = s ? l ? "#63b3ed" : "#3b82f6" : e.color, v = j - Q, z = T - J, Z = Math.sqrt(v * v + z * z);
|
|
2234
2234
|
let X = Q, te = J;
|
|
2235
2235
|
if (Z > 0 && H) {
|
|
2236
2236
|
const re = G / 2, le = se / 2, We = Math.abs(v) > 0 ? re / Math.abs(v) : Number.POSITIVE_INFINITY, Oe = Math.abs(z) > 0 ? le / Math.abs(z) : Number.POSITIVE_INFINITY, Fe = Math.min(We, Oe), De = Math.min(Z * Fe, Z * 0.4);
|
|
2237
2237
|
X = Q + v / Z * De, te = J + z / Z * De;
|
|
2238
2238
|
}
|
|
2239
|
-
const ce = Gr(X, te, j,
|
|
2239
|
+
const ce = Gr(X, te, j, T, 10 + e.lineWidth * 2);
|
|
2240
2240
|
return /* @__PURE__ */ de(
|
|
2241
2241
|
"g",
|
|
2242
2242
|
{
|
|
@@ -2251,7 +2251,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2251
2251
|
x1: X,
|
|
2252
2252
|
y1: te,
|
|
2253
2253
|
x2: j,
|
|
2254
|
-
y2:
|
|
2254
|
+
y2: T,
|
|
2255
2255
|
stroke: ne,
|
|
2256
2256
|
strokeWidth: e.lineWidth + 6,
|
|
2257
2257
|
strokeLinecap: "round"
|
|
@@ -2263,7 +2263,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2263
2263
|
x1: Q,
|
|
2264
2264
|
y1: J,
|
|
2265
2265
|
x2: j,
|
|
2266
|
-
y2:
|
|
2266
|
+
y2: T,
|
|
2267
2267
|
stroke: "transparent",
|
|
2268
2268
|
strokeWidth: Te,
|
|
2269
2269
|
style: { cursor: "pointer" }
|
|
@@ -2275,7 +2275,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2275
2275
|
x1: X,
|
|
2276
2276
|
y1: te,
|
|
2277
2277
|
x2: j,
|
|
2278
|
-
y2:
|
|
2278
|
+
y2: T,
|
|
2279
2279
|
stroke: e.color,
|
|
2280
2280
|
strokeWidth: e.lineWidth,
|
|
2281
2281
|
strokeDasharray: V,
|
|
@@ -2318,7 +2318,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2318
2318
|
width: G,
|
|
2319
2319
|
height: se,
|
|
2320
2320
|
fill: ie,
|
|
2321
|
-
stroke:
|
|
2321
|
+
stroke: I,
|
|
2322
2322
|
strokeWidth: 1,
|
|
2323
2323
|
rx: 4,
|
|
2324
2324
|
onMouseDown: s ? q("point1") : void 0,
|
|
@@ -2364,7 +2364,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2364
2364
|
"circle",
|
|
2365
2365
|
{
|
|
2366
2366
|
cx: j,
|
|
2367
|
-
cy:
|
|
2367
|
+
cy: T,
|
|
2368
2368
|
r: Ae,
|
|
2369
2369
|
fill: y,
|
|
2370
2370
|
stroke: e.color,
|
|
@@ -2496,19 +2496,19 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2496
2496
|
}, [e.id, i, x]), { isDragging: J, handleMouseDown: j } = Xe({
|
|
2497
2497
|
onDragStart: f,
|
|
2498
2498
|
onDragMove: Q
|
|
2499
|
-
}),
|
|
2499
|
+
}), T = _ || E || U || J, A = nt(e.time1, t, o, m, a, p), C = nt(e.time2, t, o, m, a, p);
|
|
2500
2500
|
if (A === void 0 || C === void 0) return null;
|
|
2501
2501
|
const V = r.scale(e.price1), ne = r.scale(e.price2);
|
|
2502
2502
|
if (!Number.isFinite(V) || !Number.isFinite(ne)) return null;
|
|
2503
2503
|
const y = r.scale(e.price1 + e.priceOffset), R = r.scale(e.price2 + e.priceOffset);
|
|
2504
2504
|
if (!Number.isFinite(y) || !Number.isFinite(R) || A < -50 && C < -50 || A > c + 50 && C > c + 50) return null;
|
|
2505
|
-
const H = Zt(A, V, C, ne, c, n, e.extendLeft, e.extendRight), K = Zt(A, y, C, R, c, n, e.extendLeft, e.extendRight), ee = Hr[e.lineStyle] || void 0, oe = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", G = l ? "#e2e8f0" : "#1f2937", se = e.label || "", ie = (A + C) / 2,
|
|
2505
|
+
const H = Zt(A, V, C, ne, c, n, e.extendLeft, e.extendRight), K = Zt(A, y, C, R, c, n, e.extendLeft, e.extendRight), ee = Hr[e.lineStyle] || void 0, oe = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", G = l ? "#e2e8f0" : "#1f2937", se = e.label || "", ie = (A + C) / 2, I = (V + ne) / 2, v = (y + R) / 2, z = `${H.ex1},${H.ey1} ${H.ex2},${H.ey2} ${K.ex2},${K.ey2} ${K.ex1},${K.ey1}`;
|
|
2506
2506
|
return /* @__PURE__ */ de(
|
|
2507
2507
|
"g",
|
|
2508
2508
|
{
|
|
2509
2509
|
className: "channel-annotation",
|
|
2510
2510
|
onClick: N,
|
|
2511
|
-
style: { cursor:
|
|
2511
|
+
style: { cursor: T ? "grabbing" : "pointer" },
|
|
2512
2512
|
children: [
|
|
2513
2513
|
/* @__PURE__ */ d(
|
|
2514
2514
|
"polygon",
|
|
@@ -2604,7 +2604,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2604
2604
|
"rect",
|
|
2605
2605
|
{
|
|
2606
2606
|
x: ie - se.length * 3.5 - 8,
|
|
2607
|
-
y:
|
|
2607
|
+
y: I - 10,
|
|
2608
2608
|
width: Math.max(30, se.length * 7 + 16),
|
|
2609
2609
|
height: 20,
|
|
2610
2610
|
fill: e.color,
|
|
@@ -2616,7 +2616,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2616
2616
|
"text",
|
|
2617
2617
|
{
|
|
2618
2618
|
x: ie,
|
|
2619
|
-
y:
|
|
2619
|
+
y: I,
|
|
2620
2620
|
dy: "0.35em",
|
|
2621
2621
|
textAnchor: "middle",
|
|
2622
2622
|
fontSize: 11,
|
|
@@ -2674,7 +2674,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2674
2674
|
"circle",
|
|
2675
2675
|
{
|
|
2676
2676
|
cx: ie,
|
|
2677
|
-
cy:
|
|
2677
|
+
cy: I,
|
|
2678
2678
|
r: gt,
|
|
2679
2679
|
fill: e.color,
|
|
2680
2680
|
fillOpacity: 0.6,
|
|
@@ -2725,29 +2725,29 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2725
2725
|
Ne(() => {
|
|
2726
2726
|
F.current = t, b.current = r, M.current = o, L.current = m, N.current = p, x.current = a;
|
|
2727
2727
|
}, [t, r, o, m, p, a]);
|
|
2728
|
-
const f = k((
|
|
2729
|
-
|
|
2730
|
-
}, [e.id, u]), Y = k((
|
|
2731
|
-
const X = F.current, te = b.current, ce = M.current, re = L.current, le = N.current, We = x.current, Oe = ce && re && We > 0 ? or(
|
|
2732
|
-
let we =
|
|
2728
|
+
const f = k((I) => {
|
|
2729
|
+
I.stopPropagation(), u == null || u(e.id);
|
|
2730
|
+
}, [e.id, u]), Y = k((I, v, z, Z) => {
|
|
2731
|
+
const X = F.current, te = b.current, ce = M.current, re = L.current, le = N.current, We = x.current, Oe = ce && re && We > 0 ? or(I, le, ce) ?? I : I, Fe = X(Oe) + z, De = te.scale(v) + Z;
|
|
2732
|
+
let we = I;
|
|
2733
2733
|
if (X.invert) {
|
|
2734
2734
|
const $e = X.invert(Fe), xe = $e instanceof Date ? $e.getTime() : $e;
|
|
2735
2735
|
we = re ? re(Math.round(xe)) : xe;
|
|
2736
2736
|
}
|
|
2737
2737
|
const ke = te.invert(De);
|
|
2738
2738
|
return {
|
|
2739
|
-
time: Number.isFinite(we) ? we :
|
|
2739
|
+
time: Number.isFinite(we) ? we : I,
|
|
2740
2740
|
price: Number.isFinite(ke) ? ke : v
|
|
2741
2741
|
};
|
|
2742
|
-
}, []), _ = k((
|
|
2743
|
-
h(1), P.current = { x:
|
|
2742
|
+
}, []), _ = k((I) => {
|
|
2743
|
+
h(1), P.current = { x: I.clientX, y: I.clientY }, D.current = {
|
|
2744
2744
|
time1: e.time1,
|
|
2745
2745
|
price1: e.price1,
|
|
2746
2746
|
time2: e.time2,
|
|
2747
2747
|
price2: e.price2
|
|
2748
2748
|
};
|
|
2749
|
-
}, [e.time1, e.price1, e.time2, e.price2]), w = k((
|
|
2750
|
-
const v =
|
|
2749
|
+
}, [e.time1, e.price1, e.time2, e.price2]), w = k((I) => {
|
|
2750
|
+
const v = I.clientX - P.current.x, z = I.clientY - P.current.y, { time: Z, price: X } = Y(
|
|
2751
2751
|
D.current.time1,
|
|
2752
2752
|
D.current.price1,
|
|
2753
2753
|
v,
|
|
@@ -2758,15 +2758,15 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2758
2758
|
onDragStart: _,
|
|
2759
2759
|
onDragMove: w,
|
|
2760
2760
|
onDragEnd: () => h(null)
|
|
2761
|
-
}), q = k((
|
|
2762
|
-
h(2), P.current = { x:
|
|
2761
|
+
}), q = k((I) => {
|
|
2762
|
+
h(2), P.current = { x: I.clientX, y: I.clientY }, D.current = {
|
|
2763
2763
|
time1: e.time1,
|
|
2764
2764
|
price1: e.price1,
|
|
2765
2765
|
time2: e.time2,
|
|
2766
2766
|
price2: e.price2
|
|
2767
2767
|
};
|
|
2768
|
-
}, [e.time1, e.price1, e.time2, e.price2]), W = k((
|
|
2769
|
-
const v =
|
|
2768
|
+
}, [e.time1, e.price1, e.time2, e.price2]), W = k((I) => {
|
|
2769
|
+
const v = I.clientX - P.current.x, z = I.clientY - P.current.y, { time: Z, price: X } = Y(
|
|
2770
2770
|
D.current.time2,
|
|
2771
2771
|
D.current.price2,
|
|
2772
2772
|
v,
|
|
@@ -2777,40 +2777,40 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2777
2777
|
onDragStart: q,
|
|
2778
2778
|
onDragMove: W,
|
|
2779
2779
|
onDragEnd: () => h(null)
|
|
2780
|
-
}), Q = k((
|
|
2781
|
-
h("whole"), P.current = { x:
|
|
2780
|
+
}), Q = k((I) => {
|
|
2781
|
+
h("whole"), P.current = { x: I.clientX, y: I.clientY }, D.current = {
|
|
2782
2782
|
time1: e.time1,
|
|
2783
2783
|
price1: e.price1,
|
|
2784
2784
|
time2: e.time2,
|
|
2785
2785
|
price2: e.price2
|
|
2786
2786
|
};
|
|
2787
|
-
}, [e.time1, e.price1, e.time2, e.price2]), J = k((
|
|
2788
|
-
const v =
|
|
2787
|
+
}, [e.time1, e.price1, e.time2, e.price2]), J = k((I) => {
|
|
2788
|
+
const v = I.clientX - P.current.x, z = I.clientY - P.current.y, Z = Y(D.current.time1, D.current.price1, v, z), X = Y(D.current.time2, D.current.price2, v, z);
|
|
2789
2789
|
i == null || i(e.id, {
|
|
2790
2790
|
time1: Z.time,
|
|
2791
2791
|
price1: Z.price,
|
|
2792
2792
|
time2: X.time,
|
|
2793
2793
|
price2: X.price
|
|
2794
2794
|
});
|
|
2795
|
-
}, [e.id, i, Y]), { isDragging: j, handleMouseDown:
|
|
2795
|
+
}, [e.id, i, Y]), { isDragging: j, handleMouseDown: T } = Xe({
|
|
2796
2796
|
onDragStart: Q,
|
|
2797
2797
|
onDragMove: J,
|
|
2798
2798
|
onDragEnd: () => h(null)
|
|
2799
2799
|
}), A = O || U || j, C = Ht(e.time1, t, o, m, a, p), V = Ht(e.time2, t, o, m, a, p), ne = Ee(() => {
|
|
2800
|
-
const
|
|
2800
|
+
const I = [...e.levels ?? [...Jr]];
|
|
2801
2801
|
if (e.showExtensions)
|
|
2802
2802
|
for (const v of Qr)
|
|
2803
|
-
|
|
2804
|
-
return
|
|
2803
|
+
I.includes(v) || I.push(v);
|
|
2804
|
+
return I.sort((v, z) => v - z), I;
|
|
2805
2805
|
}, [e.levels, e.showExtensions]);
|
|
2806
2806
|
if (C === void 0 || V === void 0) return null;
|
|
2807
2807
|
const y = r.scale(e.price1), R = r.scale(e.price2);
|
|
2808
2808
|
if (!Number.isFinite(y) || !Number.isFinite(R)) return null;
|
|
2809
2809
|
const be = e.price2 - e.price1, H = Math.min(C, V), K = e.extendRight ? c : Math.max(C, V), ee = K - H;
|
|
2810
2810
|
if (ee < 1) return null;
|
|
2811
|
-
const oe = ei[e.lineStyle] || void 0, G = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", se = l ? "#e2e8f0" : "#1f2937", ie = ne.map((
|
|
2812
|
-
const v = e.price1 + be *
|
|
2813
|
-
return { ratio:
|
|
2811
|
+
const oe = ei[e.lineStyle] || void 0, G = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", se = l ? "#e2e8f0" : "#1f2937", ie = ne.map((I) => {
|
|
2812
|
+
const v = e.price1 + be * I;
|
|
2813
|
+
return { ratio: I, price: v, y: r.scale(v) };
|
|
2814
2814
|
});
|
|
2815
2815
|
return /* @__PURE__ */ de(
|
|
2816
2816
|
"g",
|
|
@@ -2819,9 +2819,9 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2819
2819
|
onClick: f,
|
|
2820
2820
|
style: { cursor: A ? "grabbing" : "pointer" },
|
|
2821
2821
|
children: [
|
|
2822
|
-
e.fillOpacity > 0 && ie.map((
|
|
2822
|
+
e.fillOpacity > 0 && ie.map((I, v) => {
|
|
2823
2823
|
if (v === 0) return null;
|
|
2824
|
-
const z = ie[v - 1], Z = Math.min(
|
|
2824
|
+
const z = ie[v - 1], Z = Math.min(I.y, z.y), te = Math.max(I.y, z.y) - Z;
|
|
2825
2825
|
return te < 0.5 ? null : /* @__PURE__ */ d(
|
|
2826
2826
|
"rect",
|
|
2827
2827
|
{
|
|
@@ -2832,13 +2832,13 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2832
2832
|
fill: e.color,
|
|
2833
2833
|
fillOpacity: e.fillOpacity * (v % 2 === 0 ? 1 : 0.5),
|
|
2834
2834
|
stroke: "none",
|
|
2835
|
-
onMouseDown: s ?
|
|
2835
|
+
onMouseDown: s ? T : void 0,
|
|
2836
2836
|
style: { cursor: s ? "grab" : "pointer" }
|
|
2837
2837
|
},
|
|
2838
|
-
`fill-${
|
|
2838
|
+
`fill-${I.ratio}`
|
|
2839
2839
|
);
|
|
2840
2840
|
}),
|
|
2841
|
-
s && ie.map(({ ratio:
|
|
2841
|
+
s && ie.map(({ ratio: I, y: v }) => /* @__PURE__ */ d(
|
|
2842
2842
|
"line",
|
|
2843
2843
|
{
|
|
2844
2844
|
x1: H,
|
|
@@ -2849,11 +2849,11 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2849
2849
|
strokeWidth: e.lineWidth + 4,
|
|
2850
2850
|
strokeLinecap: "round"
|
|
2851
2851
|
},
|
|
2852
|
-
`glow-${
|
|
2852
|
+
`glow-${I}`
|
|
2853
2853
|
)),
|
|
2854
|
-
ie.map(({ ratio:
|
|
2854
|
+
ie.map(({ ratio: I, price: v, y: z }) => {
|
|
2855
2855
|
if (z < -50 || z > n + 50) return null;
|
|
2856
|
-
const Z = ti(
|
|
2856
|
+
const Z = ti(I), X = ri(v), te = `${Z} (${X})`, ce = Math.max(80, te.length * 6 + 16), re = I === 0 || I === 0.5 || I === 0.618 || I === 1, le = re ? 1 : 0.7;
|
|
2857
2857
|
return /* @__PURE__ */ de("g", { children: [
|
|
2858
2858
|
/* @__PURE__ */ d(
|
|
2859
2859
|
"line",
|
|
@@ -2865,7 +2865,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2865
2865
|
stroke: "transparent",
|
|
2866
2866
|
strokeWidth: Te,
|
|
2867
2867
|
style: { cursor: "pointer" },
|
|
2868
|
-
onMouseDown: s ?
|
|
2868
|
+
onMouseDown: s ? T : void 0
|
|
2869
2869
|
}
|
|
2870
2870
|
),
|
|
2871
2871
|
/* @__PURE__ */ d(
|
|
@@ -2910,7 +2910,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
2910
2910
|
}
|
|
2911
2911
|
)
|
|
2912
2912
|
] })
|
|
2913
|
-
] }, `level-${
|
|
2913
|
+
] }, `level-${I}`);
|
|
2914
2914
|
}),
|
|
2915
2915
|
/* @__PURE__ */ d(
|
|
2916
2916
|
"line",
|
|
@@ -3016,7 +3016,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3016
3016
|
r: gt,
|
|
3017
3017
|
fill: e.color,
|
|
3018
3018
|
fillOpacity: 0.6,
|
|
3019
|
-
onMouseDown:
|
|
3019
|
+
onMouseDown: T,
|
|
3020
3020
|
style: { cursor: "grab" }
|
|
3021
3021
|
}
|
|
3022
3022
|
)
|
|
@@ -3113,7 +3113,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3113
3113
|
}, [e.id, i, f]), { isDragging: S, handleMouseDown: Q } = Xe({
|
|
3114
3114
|
onDragStart: Y,
|
|
3115
3115
|
onDragMove: U
|
|
3116
|
-
}), J = w || q || S, j = nt(e.time1, t, m, a, p, g),
|
|
3116
|
+
}), J = w || q || S, j = nt(e.time1, t, m, a, p, g), T = nt(e.time2, t, m, a, p, g), A = Ee(() => {
|
|
3117
3117
|
const Me = e.price2 - e.price1, je = e.price1 !== 0 ? Me / e.price1 * 100 : 0, Ie = Math.abs(e.time2 - e.time1), He = si(o), Je = Math.max(1, Math.round(Ie / He)), ut = ci(Ie), ot = Me >= 0;
|
|
3118
3118
|
return {
|
|
3119
3119
|
priceDiff: Me,
|
|
@@ -3124,10 +3124,10 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3124
3124
|
isPositive: ot
|
|
3125
3125
|
};
|
|
3126
3126
|
}, [e.price1, e.price2, e.time1, e.time2, o]);
|
|
3127
|
-
if (j === void 0 ||
|
|
3127
|
+
if (j === void 0 || T === void 0) return null;
|
|
3128
3128
|
const C = r.scale(e.price1), V = r.scale(e.price2);
|
|
3129
3129
|
if (!Number.isFinite(C) || !Number.isFinite(V)) return null;
|
|
3130
|
-
const { priceDiff: ne, pricePct: y, barCount: R, timeStr: be, isPositive: H } = A, K = Math.min(j,
|
|
3130
|
+
const { priceDiff: ne, pricePct: y, barCount: R, timeStr: be, isPositive: H } = A, K = Math.min(j, T), ee = Math.max(j, T), oe = Math.min(C, V), G = Math.max(C, V), se = Math.max(ee - K, 1), ie = Math.max(G - oe, 1), I = H ? "rgba(34, 197, 94, 0.12)" : "rgba(239, 68, 68, 0.12)", v = H ? "#22c55e" : "#ef4444", z = H ? "#4ade80" : "#f87171", Z = l ? "rgba(23, 23, 23, 0.92)" : "rgba(30, 30, 30, 0.92)", X = `${ne >= 0 ? "+" : ""}${Vt(ne)}`, te = li(y), ce = `${R} bar${R !== 1 ? "s" : ""}`, re = `${X} (${te})`, le = `${ce} • ${be}`, We = 11, Oe = 16, Fe = Math.max(re.length, le.length) * 6.5 + 24, De = Oe * 2 + 14, we = (K + ee) / 2, ke = (oe + G) / 2;
|
|
3131
3131
|
let $e = we - Fe / 2, xe = ke - De / 2;
|
|
3132
3132
|
$e < 4 && ($e = 4), $e + Fe > c - 4 && ($e = c - Fe - 4), xe < 4 && (xe = 4), xe + De > n - 4 && (xe = n - De - 4);
|
|
3133
3133
|
const Se = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", Qe = s ? l ? "#63b3ed" : "#3b82f6" : v;
|
|
@@ -3157,7 +3157,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3157
3157
|
{
|
|
3158
3158
|
x1: j,
|
|
3159
3159
|
y1: C,
|
|
3160
|
-
x2:
|
|
3160
|
+
x2: T,
|
|
3161
3161
|
y2: V,
|
|
3162
3162
|
stroke: Se,
|
|
3163
3163
|
strokeWidth: 7,
|
|
@@ -3183,7 +3183,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3183
3183
|
y: oe,
|
|
3184
3184
|
width: se,
|
|
3185
3185
|
height: ie,
|
|
3186
|
-
fill:
|
|
3186
|
+
fill: I,
|
|
3187
3187
|
stroke: v,
|
|
3188
3188
|
strokeWidth: 1,
|
|
3189
3189
|
strokeDasharray: "6 3",
|
|
@@ -3195,7 +3195,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3195
3195
|
{
|
|
3196
3196
|
x1: j,
|
|
3197
3197
|
y1: C,
|
|
3198
|
-
x2:
|
|
3198
|
+
x2: T,
|
|
3199
3199
|
y2: V,
|
|
3200
3200
|
stroke: v,
|
|
3201
3201
|
strokeWidth: 1.5,
|
|
@@ -3221,7 +3221,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3221
3221
|
/* @__PURE__ */ d(
|
|
3222
3222
|
"circle",
|
|
3223
3223
|
{
|
|
3224
|
-
cx:
|
|
3224
|
+
cx: T,
|
|
3225
3225
|
cy: V,
|
|
3226
3226
|
r: s ? Ae : gt,
|
|
3227
3227
|
fill: Qe,
|
|
@@ -3277,9 +3277,9 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3277
3277
|
/* @__PURE__ */ d(
|
|
3278
3278
|
"line",
|
|
3279
3279
|
{
|
|
3280
|
-
x1:
|
|
3280
|
+
x1: T,
|
|
3281
3281
|
y1: oe,
|
|
3282
|
-
x2:
|
|
3282
|
+
x2: T,
|
|
3283
3283
|
y2: G,
|
|
3284
3284
|
stroke: v,
|
|
3285
3285
|
strokeWidth: 0.5,
|
|
@@ -3647,16 +3647,16 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3647
3647
|
if (!Number.isFinite(J)) return;
|
|
3648
3648
|
const j = J - U.v;
|
|
3649
3649
|
if (!Number.isFinite(j)) return;
|
|
3650
|
-
let
|
|
3650
|
+
let T = 0;
|
|
3651
3651
|
if (q.invert) {
|
|
3652
3652
|
const C = q.invert(S + w), V = C instanceof Date ? C.getTime() : C;
|
|
3653
3653
|
if (!Number.isFinite(V)) return;
|
|
3654
3654
|
const ne = o ? o(Math.round(V)) : V;
|
|
3655
3655
|
if (!Number.isFinite(ne)) return;
|
|
3656
|
-
|
|
3656
|
+
T = ne - U.t;
|
|
3657
3657
|
}
|
|
3658
3658
|
const A = W.map((C) => ({
|
|
3659
|
-
t: C.t +
|
|
3659
|
+
t: C.t + T,
|
|
3660
3660
|
v: C.v + j
|
|
3661
3661
|
}));
|
|
3662
3662
|
u == null || u(e.id, { points: A });
|
|
@@ -3842,7 +3842,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3842
3842
|
}, [e.id, i, x]), { isDragging: J, handleMouseDown: j } = Xe({
|
|
3843
3843
|
onDragStart: f,
|
|
3844
3844
|
onDragMove: Q
|
|
3845
|
-
}),
|
|
3845
|
+
}), T = _ || E || U || J, A = nt(e.time1, t, o, m, a, p), C = nt(e.time2, t, o, m, a, p), V = nt(e.time3, t, o, m, a, p);
|
|
3846
3846
|
if (A === void 0 || C === void 0 || V === void 0) return null;
|
|
3847
3847
|
const ne = r.scale(e.price1), y = r.scale(e.price2), R = r.scale(e.price3);
|
|
3848
3848
|
if (!Number.isFinite(ne) || !Number.isFinite(y) || !Number.isFinite(R)) return null;
|
|
@@ -3858,13 +3858,13 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3858
3858
|
endX: X + ce * De,
|
|
3859
3859
|
endY: te + re * De
|
|
3860
3860
|
};
|
|
3861
|
-
}, G = oe(A, ne, K, ee), se = oe(C, y, K, ee), ie = oe(V, R, K, ee),
|
|
3861
|
+
}, G = oe(A, ne, K, ee), se = oe(C, y, K, ee), ie = oe(V, R, K, ee), I = rt[e.lineStyle] || void 0, v = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", z = l ? "#e2e8f0" : "#1f2937", Z = `${C},${y} ${se.endX},${se.endY} ${ie.endX},${ie.endY} ${V},${R}`;
|
|
3862
3862
|
return /* @__PURE__ */ de(
|
|
3863
3863
|
"g",
|
|
3864
3864
|
{
|
|
3865
3865
|
className: "pitchfork-annotation",
|
|
3866
3866
|
onClick: N,
|
|
3867
|
-
style: { cursor:
|
|
3867
|
+
style: { cursor: T ? "grabbing" : "pointer" },
|
|
3868
3868
|
children: [
|
|
3869
3869
|
/* @__PURE__ */ d(
|
|
3870
3870
|
"polygon",
|
|
@@ -3989,7 +3989,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
3989
3989
|
y2: G.endY,
|
|
3990
3990
|
stroke: e.color,
|
|
3991
3991
|
strokeWidth: e.lineWidth,
|
|
3992
|
-
strokeDasharray:
|
|
3992
|
+
strokeDasharray: I,
|
|
3993
3993
|
strokeLinecap: "round"
|
|
3994
3994
|
}
|
|
3995
3995
|
),
|
|
@@ -4002,7 +4002,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
4002
4002
|
y2: se.endY,
|
|
4003
4003
|
stroke: e.color,
|
|
4004
4004
|
strokeWidth: e.lineWidth,
|
|
4005
|
-
strokeDasharray:
|
|
4005
|
+
strokeDasharray: I,
|
|
4006
4006
|
strokeLinecap: "round"
|
|
4007
4007
|
}
|
|
4008
4008
|
),
|
|
@@ -4015,7 +4015,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
4015
4015
|
y2: ie.endY,
|
|
4016
4016
|
stroke: e.color,
|
|
4017
4017
|
strokeWidth: e.lineWidth,
|
|
4018
|
-
strokeDasharray:
|
|
4018
|
+
strokeDasharray: I,
|
|
4019
4019
|
strokeLinecap: "round"
|
|
4020
4020
|
}
|
|
4021
4021
|
),
|
|
@@ -4252,20 +4252,20 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
4252
4252
|
}, [e.id, i, x]), { isDragging: J, handleMouseDown: j } = Xe({
|
|
4253
4253
|
onDragStart: f,
|
|
4254
4254
|
onDragMove: Q
|
|
4255
|
-
}),
|
|
4255
|
+
}), T = _ || E || U || J, A = At(e.time1, t, o, m, a, p), C = At(e.time2, t, o, m, a, p), V = At(e.time3, t, o, m, a, p);
|
|
4256
4256
|
if (A === void 0 || C === void 0 || V === void 0) return null;
|
|
4257
4257
|
const ne = r.scale(e.price1), y = r.scale(e.price2), R = r.scale(e.price3);
|
|
4258
4258
|
if (!Number.isFinite(ne) || !Number.isFinite(y) || !Number.isFinite(R)) return null;
|
|
4259
4259
|
const be = e.price2 - e.price1, ee = [...e.levels && e.levels.length > 0 ? e.levels : [0, 0.618, 1, 1.272, 1.618, 2, 2.618]].sort((v, z) => v - z).map((v) => {
|
|
4260
4260
|
const z = e.price3 + v * be, Z = r.scale(z);
|
|
4261
4261
|
return { level: v, price: z, y: Z };
|
|
4262
|
-
}).filter((v) => Number.isFinite(v.y)), oe = Math.min(A, C, V), G = hi[e.lineStyle] || void 0, se = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", ie = l ? "#e2e8f0" : "#1f2937",
|
|
4262
|
+
}).filter((v) => Number.isFinite(v.y)), oe = Math.min(A, C, V), G = hi[e.lineStyle] || void 0, se = s ? l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)" : "transparent", ie = l ? "#e2e8f0" : "#1f2937", I = l ? "#1e1e1e" : "#1f2937";
|
|
4263
4263
|
return /* @__PURE__ */ de(
|
|
4264
4264
|
"g",
|
|
4265
4265
|
{
|
|
4266
4266
|
className: "fib-extension-annotation",
|
|
4267
4267
|
onClick: N,
|
|
4268
|
-
style: { cursor:
|
|
4268
|
+
style: { cursor: T ? "grabbing" : "pointer" },
|
|
4269
4269
|
children: [
|
|
4270
4270
|
e.fillOpacity > 0 && ee.length >= 2 && ee.map((v, z) => {
|
|
4271
4271
|
if (z === 0) return null;
|
|
@@ -4416,7 +4416,7 @@ const Dr = [0, 1], kr = 0.15, Ge = (e) => Number.isFinite(e), cr = (e) => {
|
|
|
4416
4416
|
y: v.y - 10,
|
|
4417
4417
|
width: le,
|
|
4418
4418
|
height: 20,
|
|
4419
|
-
fill:
|
|
4419
|
+
fill: I,
|
|
4420
4420
|
fillOpacity: 0.9,
|
|
4421
4421
|
rx: 3,
|
|
4422
4422
|
stroke: e.color,
|
|
@@ -4589,16 +4589,16 @@ const pi = {
|
|
|
4589
4589
|
low: e.low
|
|
4590
4590
|
};
|
|
4591
4591
|
}, [e.time, e.high, e.low]), f = k((H, K) => {
|
|
4592
|
-
const ee = D.current, oe = F.current, G = b.current, se = M.current, ie = L.current,
|
|
4592
|
+
const ee = D.current, oe = F.current, G = b.current, se = M.current, ie = L.current, I = oe && G && ie > 0 && se ? oe(H) !== void 0 ? oe(H) : oe(findClosestTime(se, H)) ?? H : H, v = ee(I) + K;
|
|
4593
4593
|
if (!ee.invert) return H;
|
|
4594
4594
|
const z = ee.invert(v), Z = z instanceof Date ? z.getTime() : z;
|
|
4595
4595
|
return oe && G && ie > 0 && se ? G(Math.round(Z)) : Z;
|
|
4596
4596
|
}, []), Y = k((H) => {
|
|
4597
|
-
const K = H.clientX - g.current.x, ee = H.clientY - g.current.y, oe = P.current, G = h.current, se = f(G.time, K), ie = oe.invert(oe.scale(G.high) + ee),
|
|
4598
|
-
[se, ie,
|
|
4597
|
+
const K = H.clientX - g.current.x, ee = H.clientY - g.current.y, oe = P.current, G = h.current, se = f(G.time, K), ie = oe.invert(oe.scale(G.high) + ee), I = oe.invert(oe.scale(G.low) + ee);
|
|
4598
|
+
[se, ie, I].every(Number.isFinite) && (i == null || i(e.id, {
|
|
4599
4599
|
time: se,
|
|
4600
4600
|
high: ie,
|
|
4601
|
-
low:
|
|
4601
|
+
low: I
|
|
4602
4602
|
}));
|
|
4603
4603
|
}, [e.id, i, f]), { isDragging: _, handleMouseDown: w } = Xe({
|
|
4604
4604
|
onDragStart: x,
|
|
@@ -4609,7 +4609,7 @@ const pi = {
|
|
|
4609
4609
|
if (o) return o(H);
|
|
4610
4610
|
})(e.time), q = t(E ?? e.time), W = r.scale(e.high), U = r.scale(e.low);
|
|
4611
4611
|
if ([q, W, U].some((H) => !Number.isFinite(H))) return null;
|
|
4612
|
-
const S = q - 20, Q = q + 20, J = Math.min(W, U), j = Math.max(W, U),
|
|
4612
|
+
const S = q - 20, Q = q + 20, J = Math.min(W, U), j = Math.max(W, U), T = Q - S, A = j - J;
|
|
4613
4613
|
if (Q < -50 || S > c + 50 || j < -50 || J > n + 50) return null;
|
|
4614
4614
|
const C = bi(e), V = xi(e), ne = wi(e), y = e.state === "tested" ? rt.dashed : rt[e.lineStyle], R = l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)", be = e.label || (e.direction === "bullish" ? "Buy OB" : "Sell OB");
|
|
4615
4615
|
return /* @__PURE__ */ de(
|
|
@@ -4624,7 +4624,7 @@ const pi = {
|
|
|
4624
4624
|
{
|
|
4625
4625
|
x: S - 3,
|
|
4626
4626
|
y: J - 3,
|
|
4627
|
-
width:
|
|
4627
|
+
width: T + 6,
|
|
4628
4628
|
height: A + 6,
|
|
4629
4629
|
fill: "none",
|
|
4630
4630
|
stroke: R,
|
|
@@ -4637,7 +4637,7 @@ const pi = {
|
|
|
4637
4637
|
{
|
|
4638
4638
|
x: S - Ze,
|
|
4639
4639
|
y: J - Ze,
|
|
4640
|
-
width:
|
|
4640
|
+
width: T + Ze * 2,
|
|
4641
4641
|
height: A + Ze * 2,
|
|
4642
4642
|
fill: "transparent",
|
|
4643
4643
|
stroke: "transparent",
|
|
@@ -4650,7 +4650,7 @@ const pi = {
|
|
|
4650
4650
|
{
|
|
4651
4651
|
x: S,
|
|
4652
4652
|
y: J,
|
|
4653
|
-
width:
|
|
4653
|
+
width: T,
|
|
4654
4654
|
height: A,
|
|
4655
4655
|
fill: C,
|
|
4656
4656
|
fillOpacity: V,
|
|
@@ -4729,10 +4729,10 @@ const pi = {
|
|
|
4729
4729
|
P.current = r, D.current = t, F.current = o, b.current = m, M.current = p, L.current = a;
|
|
4730
4730
|
}, [r, t, o, m, p, a]);
|
|
4731
4731
|
const N = k((ee, oe) => {
|
|
4732
|
-
const G = D.current, se = F.current, ie = b.current,
|
|
4732
|
+
const G = D.current, se = F.current, ie = b.current, I = M.current, v = L.current, z = se && ie && v > 0 && I ? se(ee) !== void 0 ? se(ee) : se(findClosestTime(I, ee)) ?? ee : ee, Z = G(z) + oe;
|
|
4733
4733
|
if (!G.invert) return ee;
|
|
4734
4734
|
const X = G.invert(Z), te = X instanceof Date ? X.getTime() : X;
|
|
4735
|
-
return se && ie && v > 0 &&
|
|
4735
|
+
return se && ie && v > 0 && I ? ie(Math.round(te)) : te;
|
|
4736
4736
|
}, []), x = k((ee) => {
|
|
4737
4737
|
ee.stopPropagation(), u == null || u(e.id);
|
|
4738
4738
|
}, [e.id, u]), f = k((ee) => {
|
|
@@ -4743,9 +4743,9 @@ const pi = {
|
|
|
4743
4743
|
bottom: e.bottom
|
|
4744
4744
|
};
|
|
4745
4745
|
}, [e.time1, e.time2, e.top, e.bottom]), Y = k((ee) => {
|
|
4746
|
-
const oe = ee.clientX - g.current.x, G = ee.clientY - g.current.y, se = P.current, ie = h.current,
|
|
4747
|
-
[
|
|
4748
|
-
time1:
|
|
4746
|
+
const oe = ee.clientX - g.current.x, G = ee.clientY - g.current.y, se = P.current, ie = h.current, I = N(ie.time1, oe), v = N(ie.time2, oe), z = se.invert(se.scale(ie.top) + G), Z = se.invert(se.scale(ie.bottom) + G);
|
|
4747
|
+
[I, v, z, Z].every(Number.isFinite) && (i == null || i(e.id, {
|
|
4748
|
+
time1: I,
|
|
4749
4749
|
time2: v,
|
|
4750
4750
|
top: z,
|
|
4751
4751
|
bottom: Z
|
|
@@ -4761,8 +4761,8 @@ const pi = {
|
|
|
4761
4761
|
if (!Number.isFinite(E) || !Number.isFinite(q)) return null;
|
|
4762
4762
|
const W = t(E), U = t(q), S = r.scale(e.top), Q = r.scale(e.bottom);
|
|
4763
4763
|
if ([W, U, S, Q].some((ee) => !Number.isFinite(ee))) return null;
|
|
4764
|
-
const J = Math.min(W, U), j = Math.max(W, U),
|
|
4765
|
-
if (j < -50 || J > c + 50 || A < -50 ||
|
|
4764
|
+
const J = Math.min(W, U), j = Math.max(W, U), T = Math.min(S, Q), A = Math.max(S, Q), C = j - J, V = A - T;
|
|
4765
|
+
if (j < -50 || J > c + 50 || A < -50 || T > n + 50) return null;
|
|
4766
4766
|
const ne = Ni(e), y = vi(e), R = Wi(e), be = e.filled ? rt.dashed : rt[e.lineStyle], H = l ? "rgba(99, 179, 237, 0.4)" : "rgba(59, 130, 246, 0.4)", K = e.label || "FVG";
|
|
4767
4767
|
return /* @__PURE__ */ de(
|
|
4768
4768
|
"g",
|
|
@@ -4775,7 +4775,7 @@ const pi = {
|
|
|
4775
4775
|
"rect",
|
|
4776
4776
|
{
|
|
4777
4777
|
x: J - 3,
|
|
4778
|
-
y:
|
|
4778
|
+
y: T - 3,
|
|
4779
4779
|
width: C + 6,
|
|
4780
4780
|
height: V + 6,
|
|
4781
4781
|
fill: "none",
|
|
@@ -4788,7 +4788,7 @@ const pi = {
|
|
|
4788
4788
|
"rect",
|
|
4789
4789
|
{
|
|
4790
4790
|
x: J - Ze,
|
|
4791
|
-
y:
|
|
4791
|
+
y: T - Ze,
|
|
4792
4792
|
width: C + Ze * 2,
|
|
4793
4793
|
height: V + Ze * 2,
|
|
4794
4794
|
fill: "transparent",
|
|
@@ -4801,7 +4801,7 @@ const pi = {
|
|
|
4801
4801
|
"rect",
|
|
4802
4802
|
{
|
|
4803
4803
|
x: J,
|
|
4804
|
-
y:
|
|
4804
|
+
y: T,
|
|
4805
4805
|
width: C,
|
|
4806
4806
|
height: V,
|
|
4807
4807
|
fill: ne,
|
|
@@ -4820,7 +4820,7 @@ const pi = {
|
|
|
4820
4820
|
"rect",
|
|
4821
4821
|
{
|
|
4822
4822
|
x: J + 2,
|
|
4823
|
-
y:
|
|
4823
|
+
y: T + 2,
|
|
4824
4824
|
width: Math.max(50, K.length * 7),
|
|
4825
4825
|
height: 16,
|
|
4826
4826
|
fill: ne,
|
|
@@ -4832,7 +4832,7 @@ const pi = {
|
|
|
4832
4832
|
"text",
|
|
4833
4833
|
{
|
|
4834
4834
|
x: J + 2 + Math.max(50, K.length * 7) / 2,
|
|
4835
|
-
y:
|
|
4835
|
+
y: T + 10,
|
|
4836
4836
|
dy: "0.35em",
|
|
4837
4837
|
textAnchor: "middle",
|
|
4838
4838
|
fontSize: 10,
|
|
@@ -4880,14 +4880,14 @@ const pi = {
|
|
|
4880
4880
|
Ne(() => {
|
|
4881
4881
|
P.current = r;
|
|
4882
4882
|
}, [r]);
|
|
4883
|
-
const D = k((
|
|
4884
|
-
|
|
4885
|
-
}, [e.id, u]), F = k((
|
|
4886
|
-
|
|
4887
|
-
}, [e.id, i]), b = k((
|
|
4888
|
-
g.current =
|
|
4889
|
-
}, [e.price]), M = k((
|
|
4890
|
-
const A =
|
|
4883
|
+
const D = k((T) => {
|
|
4884
|
+
T.stopPropagation(), u == null || u(e.id);
|
|
4885
|
+
}, [e.id, u]), F = k((T) => {
|
|
4886
|
+
T.stopPropagation(), i == null || i(e.id);
|
|
4887
|
+
}, [e.id, i]), b = k((T) => {
|
|
4888
|
+
g.current = T.clientY, h.current = e.price;
|
|
4889
|
+
}, [e.price]), M = k((T) => {
|
|
4890
|
+
const A = T.clientY - g.current, C = P.current, V = C.invert(C.scale(h.current) + A);
|
|
4891
4891
|
Number.isFinite(V) && (o == null || o(e.id, V));
|
|
4892
4892
|
}, [e.id, o]), { isDragging: L, handleMouseDown: N } = Xe({
|
|
4893
4893
|
onDragStart: b,
|
|
@@ -5105,7 +5105,7 @@ const pi = {
|
|
|
5105
5105
|
alert_line: 5
|
|
5106
5106
|
}, H = be[y.type] ?? 2, K = be[R.type] ?? 2;
|
|
5107
5107
|
return H !== K ? H - K : 0;
|
|
5108
|
-
}), [b, s]),
|
|
5108
|
+
}), [b, s]), T = Ee(() => {
|
|
5109
5109
|
if (h && h.length > 0) return h;
|
|
5110
5110
|
if (!p || g <= 0) return;
|
|
5111
5111
|
const y = new Array(g);
|
|
@@ -5147,7 +5147,7 @@ const pi = {
|
|
|
5147
5147
|
timeToIndex: a,
|
|
5148
5148
|
indexToTime: p,
|
|
5149
5149
|
dataLength: g,
|
|
5150
|
-
compressedTimes:
|
|
5150
|
+
compressedTimes: T,
|
|
5151
5151
|
timeFormatter: P
|
|
5152
5152
|
},
|
|
5153
5153
|
y.id
|
|
@@ -5166,7 +5166,7 @@ const pi = {
|
|
|
5166
5166
|
timeToIndex: a,
|
|
5167
5167
|
indexToTime: p,
|
|
5168
5168
|
dataLength: g,
|
|
5169
|
-
compressedTimes:
|
|
5169
|
+
compressedTimes: T
|
|
5170
5170
|
},
|
|
5171
5171
|
y.id
|
|
5172
5172
|
) : y.type === "order_block" ? /* @__PURE__ */ d(
|
|
@@ -5184,7 +5184,7 @@ const pi = {
|
|
|
5184
5184
|
timeToIndex: a,
|
|
5185
5185
|
indexToTime: p,
|
|
5186
5186
|
dataLength: g,
|
|
5187
|
-
compressedTimes:
|
|
5187
|
+
compressedTimes: T
|
|
5188
5188
|
},
|
|
5189
5189
|
y.id
|
|
5190
5190
|
) : y.type === "fair_value_gap" ? /* @__PURE__ */ d(
|
|
@@ -5202,7 +5202,7 @@ const pi = {
|
|
|
5202
5202
|
timeToIndex: a,
|
|
5203
5203
|
indexToTime: p,
|
|
5204
5204
|
dataLength: g,
|
|
5205
|
-
compressedTimes:
|
|
5205
|
+
compressedTimes: T
|
|
5206
5206
|
},
|
|
5207
5207
|
y.id
|
|
5208
5208
|
) : y.type === "bos_line" ? /* @__PURE__ */ d(
|
|
@@ -5220,7 +5220,7 @@ const pi = {
|
|
|
5220
5220
|
onMove: J,
|
|
5221
5221
|
timeToIndex: a,
|
|
5222
5222
|
dataLength: g,
|
|
5223
|
-
compressedTimes:
|
|
5223
|
+
compressedTimes: T
|
|
5224
5224
|
},
|
|
5225
5225
|
y.id
|
|
5226
5226
|
) : y.type === "brush" ? /* @__PURE__ */ d(
|
|
@@ -5236,7 +5236,7 @@ const pi = {
|
|
|
5236
5236
|
onMove: o,
|
|
5237
5237
|
timeToIndex: a,
|
|
5238
5238
|
indexToTime: p,
|
|
5239
|
-
compressedTimes:
|
|
5239
|
+
compressedTimes: T
|
|
5240
5240
|
},
|
|
5241
5241
|
y.id
|
|
5242
5242
|
) : y.type === "alert_line" ? /* @__PURE__ */ d(
|
|
@@ -5268,7 +5268,7 @@ const pi = {
|
|
|
5268
5268
|
timeToIndex: a,
|
|
5269
5269
|
indexToTime: p,
|
|
5270
5270
|
dataLength: g,
|
|
5271
|
-
compressedTimes:
|
|
5271
|
+
compressedTimes: T
|
|
5272
5272
|
},
|
|
5273
5273
|
y.id
|
|
5274
5274
|
) : y.type === "ray" ? /* @__PURE__ */ d(
|
|
@@ -5286,7 +5286,7 @@ const pi = {
|
|
|
5286
5286
|
timeToIndex: a,
|
|
5287
5287
|
indexToTime: p,
|
|
5288
5288
|
dataLength: g,
|
|
5289
|
-
compressedTimes:
|
|
5289
|
+
compressedTimes: T
|
|
5290
5290
|
},
|
|
5291
5291
|
y.id
|
|
5292
5292
|
) : y.type === "crossline" ? /* @__PURE__ */ d(
|
|
@@ -5304,7 +5304,7 @@ const pi = {
|
|
|
5304
5304
|
timeToIndex: a,
|
|
5305
5305
|
indexToTime: p,
|
|
5306
5306
|
dataLength: g,
|
|
5307
|
-
compressedTimes:
|
|
5307
|
+
compressedTimes: T,
|
|
5308
5308
|
timeFormatter: P
|
|
5309
5309
|
},
|
|
5310
5310
|
y.id
|
|
@@ -5323,7 +5323,7 @@ const pi = {
|
|
|
5323
5323
|
timeToIndex: a,
|
|
5324
5324
|
indexToTime: p,
|
|
5325
5325
|
dataLength: g,
|
|
5326
|
-
compressedTimes:
|
|
5326
|
+
compressedTimes: T
|
|
5327
5327
|
},
|
|
5328
5328
|
y.id
|
|
5329
5329
|
) : y.type === "emoji" ? /* @__PURE__ */ d(
|
|
@@ -5340,7 +5340,7 @@ const pi = {
|
|
|
5340
5340
|
timeToIndex: a,
|
|
5341
5341
|
indexToTime: p,
|
|
5342
5342
|
dataLength: g,
|
|
5343
|
-
compressedTimes:
|
|
5343
|
+
compressedTimes: T
|
|
5344
5344
|
},
|
|
5345
5345
|
y.id
|
|
5346
5346
|
) : y.type === "timerange" ? /* @__PURE__ */ d(
|
|
@@ -5357,7 +5357,7 @@ const pi = {
|
|
|
5357
5357
|
timeToIndex: a,
|
|
5358
5358
|
indexToTime: p,
|
|
5359
5359
|
dataLength: g,
|
|
5360
|
-
compressedTimes:
|
|
5360
|
+
compressedTimes: T,
|
|
5361
5361
|
timeFormatter: P
|
|
5362
5362
|
},
|
|
5363
5363
|
y.id
|
|
@@ -5377,7 +5377,7 @@ const pi = {
|
|
|
5377
5377
|
timeToIndex: a,
|
|
5378
5378
|
indexToTime: p,
|
|
5379
5379
|
dataLength: g,
|
|
5380
|
-
compressedTimes:
|
|
5380
|
+
compressedTimes: T
|
|
5381
5381
|
},
|
|
5382
5382
|
y.id
|
|
5383
5383
|
) : y.type === "channel" ? /* @__PURE__ */ d(
|
|
@@ -5395,7 +5395,7 @@ const pi = {
|
|
|
5395
5395
|
timeToIndex: a,
|
|
5396
5396
|
indexToTime: p,
|
|
5397
5397
|
dataLength: g,
|
|
5398
|
-
compressedTimes:
|
|
5398
|
+
compressedTimes: T
|
|
5399
5399
|
},
|
|
5400
5400
|
y.id
|
|
5401
5401
|
) : y.type === "fibRetracement" ? /* @__PURE__ */ d(
|
|
@@ -5413,7 +5413,7 @@ const pi = {
|
|
|
5413
5413
|
timeToIndex: a,
|
|
5414
5414
|
indexToTime: p,
|
|
5415
5415
|
dataLength: g,
|
|
5416
|
-
compressedTimes:
|
|
5416
|
+
compressedTimes: T
|
|
5417
5417
|
},
|
|
5418
5418
|
y.id
|
|
5419
5419
|
) : y.type === "measure" ? /* @__PURE__ */ d(
|
|
@@ -5431,7 +5431,7 @@ const pi = {
|
|
|
5431
5431
|
timeToIndex: a,
|
|
5432
5432
|
indexToTime: p,
|
|
5433
5433
|
dataLength: g,
|
|
5434
|
-
compressedTimes:
|
|
5434
|
+
compressedTimes: T
|
|
5435
5435
|
},
|
|
5436
5436
|
y.id
|
|
5437
5437
|
) : y.type === "pitchfork" ? /* @__PURE__ */ d(
|
|
@@ -5449,7 +5449,7 @@ const pi = {
|
|
|
5449
5449
|
timeToIndex: a,
|
|
5450
5450
|
indexToTime: p,
|
|
5451
5451
|
dataLength: g,
|
|
5452
|
-
compressedTimes:
|
|
5452
|
+
compressedTimes: T
|
|
5453
5453
|
},
|
|
5454
5454
|
y.id
|
|
5455
5455
|
) : y.type !== "text" ? null : /* @__PURE__ */ d(
|
|
@@ -5468,7 +5468,7 @@ const pi = {
|
|
|
5468
5468
|
timeToIndex: a,
|
|
5469
5469
|
indexToTime: p,
|
|
5470
5470
|
dataLength: g,
|
|
5471
|
-
compressedTimes:
|
|
5471
|
+
compressedTimes: T
|
|
5472
5472
|
},
|
|
5473
5473
|
y.id
|
|
5474
5474
|
)) });
|
|
@@ -6099,7 +6099,7 @@ const pi = {
|
|
|
6099
6099
|
return h.forEach((N, x) => {
|
|
6100
6100
|
const f = c(N.t), Y = r.scale(N.h), _ = r.scale(N.l), w = r.scale(N.o), O = r.scale(N.c), E = P(x);
|
|
6101
6101
|
if (E === 0) return;
|
|
6102
|
-
const q = `M${f},${Y}L${f},${_}`, W = Math.min(w, O), U = Math.max(w, O), S = f - i, Q = f + i, J = Math.max(1, U - W), j = `M${S},${W}H${Q}V${W + J}H${S}Z`,
|
|
6102
|
+
const q = `M${f},${Y}L${f},${_}`, W = Math.min(w, O), U = Math.max(w, O), S = f - i, Q = f + i, J = Math.max(1, U - W), j = `M${S},${W}H${Q}V${W + J}H${S}Z`, T = N.c >= N.o;
|
|
6103
6103
|
(s == null ? void 0 : s.phase) === "candles" && E < 0.9 ? M.push(
|
|
6104
6104
|
/* @__PURE__ */ de("g", { className: "dwlf-candle-individual", children: [
|
|
6105
6105
|
/* @__PURE__ */ d(
|
|
@@ -6116,13 +6116,13 @@ const pi = {
|
|
|
6116
6116
|
"path",
|
|
6117
6117
|
{
|
|
6118
6118
|
d: j,
|
|
6119
|
-
fill:
|
|
6119
|
+
fill: T ? g : p,
|
|
6120
6120
|
stroke: "none",
|
|
6121
6121
|
opacity: E
|
|
6122
6122
|
}
|
|
6123
6123
|
)
|
|
6124
6124
|
] }, `candle-${x}`)
|
|
6125
|
-
) : (D += q,
|
|
6125
|
+
) : (D += q, T ? F += j : b += j);
|
|
6126
6126
|
}), /* @__PURE__ */ de("g", { className: "dwlf-candles", children: [
|
|
6127
6127
|
D && /* @__PURE__ */ d(
|
|
6128
6128
|
"path",
|
|
@@ -6255,14 +6255,14 @@ const pi = {
|
|
|
6255
6255
|
w(vt(t));
|
|
6256
6256
|
}, [t]);
|
|
6257
6257
|
const [O, E] = qe(!0), [q, W] = qe(null), [U, { width: S, height: Q }] = wr(), J = $(null), j = Q || Xi, A = (u || "").toLowerCase() === "hourly" ? 36e5 : 864e5, C = Ee(() => {
|
|
6258
|
-
for (const
|
|
6259
|
-
const ue =
|
|
6258
|
+
for (const B of _.panes) {
|
|
6259
|
+
const ue = B.series.find((pe) => pe.type === "ohlc" && Array.isArray(pe.data));
|
|
6260
6260
|
if (ue)
|
|
6261
6261
|
return ue;
|
|
6262
6262
|
}
|
|
6263
6263
|
return null;
|
|
6264
|
-
}, [_]), V = Ee(() => !C || !Array.isArray(C.data) ? [] : C.data.filter((
|
|
6265
|
-
() => V.map((
|
|
6264
|
+
}, [_]), V = Ee(() => !C || !Array.isArray(C.data) ? [] : C.data.filter((B) => Number.isFinite(B == null ? void 0 : B.t)), [C]), ne = Ee(
|
|
6265
|
+
() => V.map((B) => ({ date: new Date(B.t).toISOString() })),
|
|
6266
6266
|
[V]
|
|
6267
6267
|
), y = xr(ne, i, o, u), R = s && V.length > 0, be = m && V.length > 0, {
|
|
6268
6268
|
mouseHandlers: H,
|
|
@@ -6272,22 +6272,22 @@ const pi = {
|
|
|
6272
6272
|
resetView: G,
|
|
6273
6273
|
panToStart: se,
|
|
6274
6274
|
panToEnd: ie
|
|
6275
|
-
} = y,
|
|
6276
|
-
(
|
|
6275
|
+
} = y, I = k(
|
|
6276
|
+
(B) => {
|
|
6277
6277
|
if (!V.length)
|
|
6278
|
-
return Date.now() +
|
|
6279
|
-
if (
|
|
6280
|
-
return V[Math.max(0,
|
|
6281
|
-
if (
|
|
6282
|
-
return V[
|
|
6283
|
-
const ue = V[V.length - 1].t, pe =
|
|
6278
|
+
return Date.now() + B * A;
|
|
6279
|
+
if (B <= 0)
|
|
6280
|
+
return V[Math.max(0, B)].t;
|
|
6281
|
+
if (B < V.length)
|
|
6282
|
+
return V[B].t;
|
|
6283
|
+
const ue = V[V.length - 1].t, pe = B - (V.length - 1);
|
|
6284
6284
|
return ue + pe * A;
|
|
6285
6285
|
},
|
|
6286
6286
|
[V, A]
|
|
6287
6287
|
), v = Ee(() => {
|
|
6288
6288
|
if (!R)
|
|
6289
6289
|
return null;
|
|
6290
|
-
const
|
|
6290
|
+
const B = y.viewportStart, ue = Math.max(y.viewportEnd, B + 1), pe = I(B), ae = I(ue), me = ae <= pe ? pe + A : ae;
|
|
6291
6291
|
return {
|
|
6292
6292
|
startTime: pe,
|
|
6293
6293
|
endTime: me,
|
|
@@ -6295,7 +6295,7 @@ const pi = {
|
|
|
6295
6295
|
viewportEnd: y.viewportEnd,
|
|
6296
6296
|
visibleCount: y.visibleCount
|
|
6297
6297
|
};
|
|
6298
|
-
}, [R, y.viewportStart, y.viewportEnd, y.visibleCount,
|
|
6298
|
+
}, [R, y.viewportStart, y.viewportEnd, y.visibleCount, I, A]), z = $(!1), Z = $(V.length);
|
|
6299
6299
|
Ne(() => {
|
|
6300
6300
|
if (!R) {
|
|
6301
6301
|
z.current = !1;
|
|
@@ -6316,30 +6316,30 @@ const pi = {
|
|
|
6316
6316
|
const X = Ee(() => {
|
|
6317
6317
|
if (!be)
|
|
6318
6318
|
return null;
|
|
6319
|
-
let
|
|
6319
|
+
let B = [];
|
|
6320
6320
|
if (R && v) {
|
|
6321
6321
|
const ae = Math.max(0, v.viewportEnd - v.viewportStart);
|
|
6322
|
-
|
|
6322
|
+
B = Array.from({ length: ae }, (me, ge) => I(v.viewportStart + ge));
|
|
6323
6323
|
} else
|
|
6324
|
-
|
|
6325
|
-
const ue = Array.from(new Set(
|
|
6324
|
+
B = Ut(_);
|
|
6325
|
+
const ue = Array.from(new Set(B.filter((ae) => Number.isFinite(ae)))).sort((ae, me) => ae - me);
|
|
6326
6326
|
if (!ue.length)
|
|
6327
6327
|
return null;
|
|
6328
6328
|
const pe = /* @__PURE__ */ new Map();
|
|
6329
6329
|
return ue.forEach((ae, me) => pe.set(ae, me)), { rawToIndex: pe, indexToRaw: ue };
|
|
6330
|
-
}, [be, R, v, _,
|
|
6330
|
+
}, [be, R, v, _, I]), te = Ee(() => {
|
|
6331
6331
|
if (X)
|
|
6332
|
-
return (
|
|
6332
|
+
return (B) => X.rawToIndex.get(B);
|
|
6333
6333
|
}, [X]), ce = Ee(() => {
|
|
6334
6334
|
if (X)
|
|
6335
|
-
return (
|
|
6336
|
-
const ue = X.indexToRaw.length - 1, pe = Math.max(0, Math.min(ue,
|
|
6335
|
+
return (B) => {
|
|
6336
|
+
const ue = X.indexToRaw.length - 1, pe = Math.max(0, Math.min(ue, B));
|
|
6337
6337
|
return X.indexToRaw[pe];
|
|
6338
6338
|
};
|
|
6339
|
-
}, [X]), re = k((
|
|
6340
|
-
R && K(
|
|
6339
|
+
}, [X]), re = k((B) => {
|
|
6340
|
+
R && K(B), U && (U.current = B);
|
|
6341
6341
|
}, [R, K, U]), le = Ee(() => {
|
|
6342
|
-
const
|
|
6342
|
+
const B = (me) => {
|
|
6343
6343
|
if (!X || !Number.isFinite(me))
|
|
6344
6344
|
return me;
|
|
6345
6345
|
const { rawToIndex: ge, indexToRaw: he } = X, ye = ge.get(me);
|
|
@@ -6353,11 +6353,11 @@ const pi = {
|
|
|
6353
6353
|
}, ue = (me) => !X || !me ? me : me.map((ge) => {
|
|
6354
6354
|
let he = ge;
|
|
6355
6355
|
if (Number.isFinite(ge.startTime ?? NaN)) {
|
|
6356
|
-
const ye =
|
|
6356
|
+
const ye = B(ge.startTime);
|
|
6357
6357
|
ye !== ge.startTime && (he = { ...he, startTime: ye });
|
|
6358
6358
|
}
|
|
6359
6359
|
if (Number.isFinite(ge.endTime ?? NaN)) {
|
|
6360
|
-
const ye =
|
|
6360
|
+
const ye = B(ge.endTime);
|
|
6361
6361
|
ye !== ge.endTime && (he = he === ge ? { ...he } : he, he.endTime = ye);
|
|
6362
6362
|
}
|
|
6363
6363
|
return he;
|
|
@@ -6416,14 +6416,14 @@ const pi = {
|
|
|
6416
6416
|
guides: ue(me.guides)
|
|
6417
6417
|
};
|
|
6418
6418
|
}), ae;
|
|
6419
|
-
}, [_, R, v, A,
|
|
6419
|
+
}, [_, R, v, A, I, X]), { rects: We, heights: Oe } = Ee(
|
|
6420
6420
|
() => Yi(le, j),
|
|
6421
6421
|
[le, j]
|
|
6422
6422
|
), Fe = Ee(() => {
|
|
6423
|
-
const
|
|
6423
|
+
const B = /* @__PURE__ */ new Map();
|
|
6424
6424
|
return We.forEach((ue) => {
|
|
6425
|
-
|
|
6426
|
-
}),
|
|
6425
|
+
B.set(ue.pane.id, ue);
|
|
6426
|
+
}), B;
|
|
6427
6427
|
}, [We]), De = Ee(
|
|
6428
6428
|
() => Mr(le, Oe),
|
|
6429
6429
|
[le, Oe]
|
|
@@ -6432,48 +6432,48 @@ const pi = {
|
|
|
6432
6432
|
return X.indexToRaw.map((ue, pe) => pe);
|
|
6433
6433
|
if (!R || !v)
|
|
6434
6434
|
return Ut(le);
|
|
6435
|
-
const
|
|
6435
|
+
const B = [];
|
|
6436
6436
|
for (let ue = v.viewportStart; ue < v.viewportEnd; ue += 1)
|
|
6437
|
-
|
|
6438
|
-
return
|
|
6439
|
-
}, [X, R, v, le,
|
|
6440
|
-
const
|
|
6441
|
-
if (!we.length ||
|
|
6437
|
+
B.push(I(ue));
|
|
6438
|
+
return B.length ? B : [v.startTime, v.endTime];
|
|
6439
|
+
}, [X, R, v, le, I]), ke = Ee(() => {
|
|
6440
|
+
const B = Math.max(0, S);
|
|
6441
|
+
if (!we.length || B <= 0) {
|
|
6442
6442
|
const ae = Date.now();
|
|
6443
|
-
return ze.scaleUtc().domain([ae - 36e5, ae]).range([0,
|
|
6443
|
+
return ze.scaleUtc().domain([ae - 36e5, ae]).range([0, B || 1]);
|
|
6444
6444
|
}
|
|
6445
6445
|
if (X) {
|
|
6446
6446
|
const ae = X.indexToRaw.length, me = ae > 1 ? ae - 1 : 1;
|
|
6447
|
-
return ze.scaleLinear().domain([0, me]).range([0,
|
|
6447
|
+
return ze.scaleLinear().domain([0, me]).range([0, B]);
|
|
6448
6448
|
}
|
|
6449
6449
|
let ue = we[0], pe = we[we.length - 1];
|
|
6450
|
-
return R && v && (ue = v.startTime, pe = v.endTime), ue === pe && (pe = ue + A), ze.scaleUtc().domain([ue, pe]).range([0,
|
|
6450
|
+
return R && v && (ue = v.startTime, pe = v.endTime), ue === pe && (pe = ue + A), ze.scaleUtc().domain([ue, pe]).range([0, B]);
|
|
6451
6451
|
}, [we, S, R, v, A, X]), $e = Ee(() => {
|
|
6452
6452
|
if (!we.length || S <= 0) return [];
|
|
6453
|
-
const
|
|
6453
|
+
const B = Math.min(12, Math.max(2, Math.floor(S / 140)));
|
|
6454
6454
|
if (X) {
|
|
6455
6455
|
const ue = X.indexToRaw.length;
|
|
6456
6456
|
if (!ue) return [];
|
|
6457
|
-
const ae = ze.scaleLinear().domain([0, Math.max(1, ue - 1)]).ticks(
|
|
6457
|
+
const ae = ze.scaleLinear().domain([0, Math.max(1, ue - 1)]).ticks(B);
|
|
6458
6458
|
return Array.from(new Set(ae.map((ge) => {
|
|
6459
6459
|
const he = Math.round(ge);
|
|
6460
6460
|
return Math.max(0, Math.min(ue - 1, he));
|
|
6461
6461
|
}))).sort((ge, he) => ge - he);
|
|
6462
6462
|
}
|
|
6463
|
-
return ke.ticks(
|
|
6464
|
-
}, [ke, we, S, X]), xe = k((
|
|
6463
|
+
return ke.ticks(B).map((ue) => ue instanceof Date ? ue.valueOf() : Number(ue));
|
|
6464
|
+
}, [ke, we, S, X]), xe = k((B) => {
|
|
6465
6465
|
if (X) {
|
|
6466
6466
|
if (!X.indexToRaw.length)
|
|
6467
|
-
return
|
|
6468
|
-
const ue = Math.max(0, Math.min(X.indexToRaw.length - 1, Math.round(
|
|
6467
|
+
return B;
|
|
6468
|
+
const ue = Math.max(0, Math.min(X.indexToRaw.length - 1, Math.round(B)));
|
|
6469
6469
|
return X.indexToRaw[ue];
|
|
6470
6470
|
}
|
|
6471
|
-
return
|
|
6471
|
+
return B;
|
|
6472
6472
|
}, [X]), Se = O ? q : null, Qe = k(
|
|
6473
|
-
(
|
|
6473
|
+
(B) => {
|
|
6474
6474
|
var Le;
|
|
6475
6475
|
if (!O || !J.current) return;
|
|
6476
|
-
const ue = J.current.getBoundingClientRect(), pe =
|
|
6476
|
+
const ue = J.current.getBoundingClientRect(), pe = B.clientX - ue.left, ae = Math.max(0, Math.min(pe, Math.max(0, S))), me = ke.invert(ae), ge = me instanceof Date ? me.valueOf() : me;
|
|
6477
6477
|
if (!Number.isFinite(ge)) {
|
|
6478
6478
|
W(null);
|
|
6479
6479
|
return;
|
|
@@ -6483,7 +6483,7 @@ const pi = {
|
|
|
6483
6483
|
W(null);
|
|
6484
6484
|
return;
|
|
6485
6485
|
}
|
|
6486
|
-
const ye =
|
|
6486
|
+
const ye = B.clientY - ue.top;
|
|
6487
6487
|
let Pe = null;
|
|
6488
6488
|
if (p === "pointer")
|
|
6489
6489
|
for (const Ye of Fe.values()) {
|
|
@@ -6521,8 +6521,8 @@ const pi = {
|
|
|
6521
6521
|
time: Ce,
|
|
6522
6522
|
price: it,
|
|
6523
6523
|
paneId: Ye,
|
|
6524
|
-
screenX:
|
|
6525
|
-
screenY:
|
|
6524
|
+
screenX: B.clientX,
|
|
6525
|
+
screenY: B.clientY
|
|
6526
6526
|
}), x == null || x({
|
|
6527
6527
|
time: Ce,
|
|
6528
6528
|
price: it
|
|
@@ -6549,20 +6549,20 @@ const pi = {
|
|
|
6549
6549
|
), Me = k(() => {
|
|
6550
6550
|
W(null);
|
|
6551
6551
|
}, []), je = k(
|
|
6552
|
-
(
|
|
6552
|
+
(B) => {
|
|
6553
6553
|
var ae, me;
|
|
6554
6554
|
if (!O || !J.current) return;
|
|
6555
6555
|
let ue, pe;
|
|
6556
6556
|
if (q)
|
|
6557
6557
|
ue = q.time, pe = q.perPane;
|
|
6558
6558
|
else {
|
|
6559
|
-
const ge = J.current.getBoundingClientRect(), he =
|
|
6559
|
+
const ge = J.current.getBoundingClientRect(), he = B.clientX - ge.left, ye = Math.max(0, Math.min(he, Math.max(0, S))), Pe = ke.invert(ye), ve = Pe instanceof Date ? Pe.valueOf() : Pe;
|
|
6560
6560
|
if (!Number.isFinite(ve))
|
|
6561
6561
|
return;
|
|
6562
6562
|
const Ce = at(we, ve);
|
|
6563
6563
|
if (!Number.isFinite(Ce))
|
|
6564
6564
|
return;
|
|
6565
|
-
const Le =
|
|
6565
|
+
const Le = B.clientY - ge.top;
|
|
6566
6566
|
let Ye = null;
|
|
6567
6567
|
if (p === "pointer")
|
|
6568
6568
|
for (const Ve of Fe.values()) {
|
|
@@ -6589,7 +6589,7 @@ const pi = {
|
|
|
6589
6589
|
}), ue = xe(Ce);
|
|
6590
6590
|
}
|
|
6591
6591
|
if (L) {
|
|
6592
|
-
const ge = J.current.getBoundingClientRect(), he =
|
|
6592
|
+
const ge = J.current.getBoundingClientRect(), he = B.clientY - ge.top;
|
|
6593
6593
|
for (const [ye, Pe] of Fe.entries()) {
|
|
6594
6594
|
const ve = Pe.y + Pe.height;
|
|
6595
6595
|
if (he >= Pe.y && he <= ve) {
|
|
@@ -6600,8 +6600,8 @@ const pi = {
|
|
|
6600
6600
|
time: ue,
|
|
6601
6601
|
price: Ye,
|
|
6602
6602
|
paneId: ye,
|
|
6603
|
-
screenX:
|
|
6604
|
-
screenY:
|
|
6603
|
+
screenX: B.clientX,
|
|
6604
|
+
screenY: B.clientY
|
|
6605
6605
|
});
|
|
6606
6606
|
}
|
|
6607
6607
|
break;
|
|
@@ -6674,62 +6674,62 @@ const pi = {
|
|
|
6674
6674
|
xe,
|
|
6675
6675
|
L
|
|
6676
6676
|
]
|
|
6677
|
-
), Ie = k((
|
|
6678
|
-
w(vt(
|
|
6679
|
-
}, []), He = k((
|
|
6677
|
+
), Ie = k((B) => {
|
|
6678
|
+
w(vt(B));
|
|
6679
|
+
}, []), He = k((B) => {
|
|
6680
6680
|
w((ue) => ({
|
|
6681
6681
|
...ue,
|
|
6682
|
-
panes: [...ue.panes, fr(
|
|
6682
|
+
panes: [...ue.panes, fr(B)]
|
|
6683
6683
|
}));
|
|
6684
|
-
}, []), Je = k((
|
|
6684
|
+
}, []), Je = k((B) => {
|
|
6685
6685
|
w((ue) => ({
|
|
6686
6686
|
...ue,
|
|
6687
|
-
panes: ue.panes.filter((pe) => pe.id !==
|
|
6687
|
+
panes: ue.panes.filter((pe) => pe.id !== B)
|
|
6688
6688
|
}));
|
|
6689
|
-
}, []), ut = k((
|
|
6689
|
+
}, []), ut = k((B, ue) => {
|
|
6690
6690
|
w((pe) => ({
|
|
6691
6691
|
...pe,
|
|
6692
6692
|
panes: pe.panes.map((ae) => {
|
|
6693
|
-
if (ae.id !==
|
|
6693
|
+
if (ae.id !== B) return ae;
|
|
6694
6694
|
const me = { ...ae, ...ue };
|
|
6695
6695
|
return ue.series && (me.series = ue.series.map(Xt)), ue.guides && (me.guides = ue.guides.map((ge) => ({ ...ge }))), me;
|
|
6696
6696
|
})
|
|
6697
6697
|
}));
|
|
6698
|
-
}, []), ot = k((
|
|
6698
|
+
}, []), ot = k((B, ue) => {
|
|
6699
6699
|
w((pe) => ({
|
|
6700
6700
|
...pe,
|
|
6701
6701
|
panes: pe.panes.map((ae) => {
|
|
6702
|
-
if (ae.id !==
|
|
6702
|
+
if (ae.id !== B) return ae;
|
|
6703
6703
|
const me = ae.series.some((ge) => ge.key === ue.key) ? ae.series.map((ge) => ge.key === ue.key ? Xt(ue) : ge) : [...ae.series, Xt(ue)];
|
|
6704
6704
|
return { ...ae, series: me };
|
|
6705
6705
|
})
|
|
6706
6706
|
}));
|
|
6707
|
-
}, []), mt = k((
|
|
6707
|
+
}, []), mt = k((B, ue, pe) => {
|
|
6708
6708
|
w((ae) => ({
|
|
6709
6709
|
...ae,
|
|
6710
6710
|
panes: ae.panes.map((me) => {
|
|
6711
|
-
if (me.id !==
|
|
6711
|
+
if (me.id !== B) return me;
|
|
6712
6712
|
const ge = me.series.map((he) => he.key === ue ? { ...he, data: Array.isArray(pe) ? [...pe] : [] } : he);
|
|
6713
6713
|
return { ...me, series: ge };
|
|
6714
6714
|
})
|
|
6715
6715
|
}));
|
|
6716
|
-
}, []), Wt = k((
|
|
6716
|
+
}, []), Wt = k((B, ue) => {
|
|
6717
6717
|
w((pe) => ({
|
|
6718
6718
|
...pe,
|
|
6719
|
-
panes: pe.panes.map((ae) => ae.id ===
|
|
6719
|
+
panes: pe.panes.map((ae) => ae.id === B ? { ...ae, series: ae.series.filter((me) => me.key !== ue) } : ae)
|
|
6720
6720
|
}));
|
|
6721
|
-
}, []), xt = k((
|
|
6721
|
+
}, []), xt = k((B, ue) => {
|
|
6722
6722
|
w((pe) => ({
|
|
6723
6723
|
...pe,
|
|
6724
|
-
panes: pe.panes.map((ae) => ae.id ===
|
|
6724
|
+
panes: pe.panes.map((ae) => ae.id === B ? { ...ae, guides: [...ae.guides ?? [], { ...ue }] } : ae)
|
|
6725
6725
|
}));
|
|
6726
|
-
}, []), Ct = k((
|
|
6726
|
+
}, []), Ct = k((B, ue) => {
|
|
6727
6727
|
w((pe) => ({
|
|
6728
6728
|
...pe,
|
|
6729
|
-
panes: pe.panes.map((ae) => ae.id ===
|
|
6729
|
+
panes: pe.panes.map((ae) => ae.id === B ? { ...ae, guides: (ae.guides ?? []).filter((me) => me.y !== ue) } : ae)
|
|
6730
6730
|
}));
|
|
6731
|
-
}, []), wt = k((
|
|
6732
|
-
E(!!
|
|
6731
|
+
}, []), wt = k((B) => {
|
|
6732
|
+
E(!!B), B || W(null);
|
|
6733
6733
|
}, []), Yt = k(() => {
|
|
6734
6734
|
R && ee();
|
|
6735
6735
|
}, [R, ee]), Ft = k(() => {
|
|
@@ -6740,14 +6740,14 @@ const pi = {
|
|
|
6740
6740
|
R && se();
|
|
6741
6741
|
}, [R, se]), Dt = k(() => {
|
|
6742
6742
|
R && ie();
|
|
6743
|
-
}, [R, ie]), kt = k((
|
|
6744
|
-
!R || !H.onMouseDown || H.onMouseDown(
|
|
6745
|
-
}, [R, H]), Mt = k((
|
|
6746
|
-
!R || !H.onMouseMove || H.onMouseMove(
|
|
6747
|
-
}, [R, H]), ar = k((
|
|
6748
|
-
!R || !H.onMouseUp || H.onMouseUp(
|
|
6749
|
-
}, [R, H]), mr = k((
|
|
6750
|
-
!R || !H.onMouseLeave || H.onMouseLeave(
|
|
6743
|
+
}, [R, ie]), kt = k((B) => {
|
|
6744
|
+
!R || !H.onMouseDown || H.onMouseDown(B);
|
|
6745
|
+
}, [R, H]), Mt = k((B) => {
|
|
6746
|
+
!R || !H.onMouseMove || H.onMouseMove(B);
|
|
6747
|
+
}, [R, H]), ar = k((B) => {
|
|
6748
|
+
!R || !H.onMouseUp || H.onMouseUp(B);
|
|
6749
|
+
}, [R, H]), mr = k((B) => {
|
|
6750
|
+
!R || !H.onMouseLeave || H.onMouseLeave(B);
|
|
6751
6751
|
}, [R, H]);
|
|
6752
6752
|
br(Y, () => ({
|
|
6753
6753
|
setSpec: Ie,
|
|
@@ -6810,20 +6810,20 @@ const pi = {
|
|
|
6810
6810
|
className: "dwlf-chart-svg",
|
|
6811
6811
|
onClick: je,
|
|
6812
6812
|
onMouseDown: kt,
|
|
6813
|
-
onMouseMove: (
|
|
6814
|
-
R && Mt(
|
|
6813
|
+
onMouseMove: (B) => {
|
|
6814
|
+
R && Mt(B), Qe(B);
|
|
6815
6815
|
},
|
|
6816
6816
|
onMouseUp: ar,
|
|
6817
|
-
onMouseLeave: (
|
|
6818
|
-
R && mr(
|
|
6817
|
+
onMouseLeave: (B) => {
|
|
6818
|
+
R && mr(B), Me();
|
|
6819
6819
|
},
|
|
6820
6820
|
children: [
|
|
6821
6821
|
/* @__PURE__ */ d("rect", { x: 0, y: 0, width: S, height: j, fill: Et }),
|
|
6822
|
-
We.map(({ pane:
|
|
6822
|
+
We.map(({ pane: B, y: ue, height: pe }) => {
|
|
6823
6823
|
var he;
|
|
6824
|
-
const ae = De[
|
|
6824
|
+
const ae = De[B.id];
|
|
6825
6825
|
if (!ae) return null;
|
|
6826
|
-
const me = ze.scaleLinear().domain(ae.domain).ticks(4), ge = Se == null ? void 0 : Se.perPane[
|
|
6826
|
+
const me = ze.scaleLinear().domain(ae.domain).ticks(4), ge = Se == null ? void 0 : Se.perPane[B.id];
|
|
6827
6827
|
return /* @__PURE__ */ de("g", { transform: `translate(0, ${ue})`, children: [
|
|
6828
6828
|
/* @__PURE__ */ d("rect", { x: 0, y: 0, width: S, height: pe, fill: Et }),
|
|
6829
6829
|
c && $e.map((ye, Pe) => /* @__PURE__ */ d(
|
|
@@ -6853,7 +6853,7 @@ const pi = {
|
|
|
6853
6853
|
`y-grid-${ye}-${Pe}`
|
|
6854
6854
|
) : null;
|
|
6855
6855
|
}),
|
|
6856
|
-
(he =
|
|
6856
|
+
(he = B.guides) == null ? void 0 : he.map((ye, Pe) => {
|
|
6857
6857
|
const ve = ae.scale(ye.y);
|
|
6858
6858
|
let Ce = 0, Le = S;
|
|
6859
6859
|
if (ye.startTime !== void 0 && Number.isFinite(ye.startTime)) {
|
|
@@ -6888,8 +6888,8 @@ const pi = {
|
|
|
6888
6888
|
)
|
|
6889
6889
|
] }, `${ye.y}-${Pe}`);
|
|
6890
6890
|
}),
|
|
6891
|
-
|
|
6892
|
-
|
|
6891
|
+
B.series.map((ye) => /* @__PURE__ */ d(gr.Fragment, { children: Bi(ye, ae, ke, S, r, f) }, ye.key)),
|
|
6892
|
+
B.id === "price" && h.length > 0 && /* @__PURE__ */ d(
|
|
6893
6893
|
$i,
|
|
6894
6894
|
{
|
|
6895
6895
|
annotations: h,
|
|
@@ -6911,7 +6911,7 @@ const pi = {
|
|
|
6911
6911
|
animationPhase: f == null ? void 0 : f.phase
|
|
6912
6912
|
}
|
|
6913
6913
|
),
|
|
6914
|
-
Se && ge && g && ge.lineVisible !== !1 && Number.isFinite(ge.y ?? NaN) && (() => {
|
|
6914
|
+
Se && ge && g && !B.hideYAxis && ge.lineVisible !== !1 && Number.isFinite(ge.y ?? NaN) && (() => {
|
|
6915
6915
|
const Le = Math.max(0, S - 72 - 4), Ye = ge.y, Re = Math.max(
|
|
6916
6916
|
11,
|
|
6917
6917
|
Math.min(pe - 9 - 2, Ye)
|
|
@@ -6960,7 +6960,7 @@ const pi = {
|
|
|
6960
6960
|
strokeDasharray: "3 3"
|
|
6961
6961
|
}
|
|
6962
6962
|
),
|
|
6963
|
-
/* @__PURE__ */ d("g", { className: "dwlf-y-axis", transform: `translate(${S - 40}, 0)`, children: me.map((ye, Pe) => /* @__PURE__ */ d(
|
|
6963
|
+
!B.hideYAxis && /* @__PURE__ */ d("g", { className: "dwlf-y-axis", transform: `translate(${S - 40}, 0)`, children: me.map((ye, Pe) => /* @__PURE__ */ d(
|
|
6964
6964
|
"text",
|
|
6965
6965
|
{
|
|
6966
6966
|
x: 0,
|
|
@@ -6972,8 +6972,8 @@ const pi = {
|
|
|
6972
6972
|
},
|
|
6973
6973
|
`${ye}-${Pe}`
|
|
6974
6974
|
)) }),
|
|
6975
|
-
|
|
6976
|
-
] },
|
|
6975
|
+
B.title && /* @__PURE__ */ d("text", { x: 12, y: 14, fill: Rt, fontSize: 12, fontWeight: 600, children: B.title })
|
|
6976
|
+
] }, B.id);
|
|
6977
6977
|
}),
|
|
6978
6978
|
Se && /* @__PURE__ */ d("g", { className: "dwlf-crosshair", children: /* @__PURE__ */ d(
|
|
6979
6979
|
"line",
|
|
@@ -6987,23 +6987,23 @@ const pi = {
|
|
|
6987
6987
|
strokeDasharray: "3 3"
|
|
6988
6988
|
}
|
|
6989
6989
|
) }),
|
|
6990
|
-
/* @__PURE__ */ d("g", { className: "dwlf-x-axis", children: $e.map((
|
|
6990
|
+
/* @__PURE__ */ d("g", { className: "dwlf-x-axis", children: $e.map((B) => /* @__PURE__ */ d(
|
|
6991
6991
|
"text",
|
|
6992
6992
|
{
|
|
6993
|
-
x: ke(
|
|
6993
|
+
x: ke(B),
|
|
6994
6994
|
y: j - 6,
|
|
6995
6995
|
fill: St,
|
|
6996
6996
|
fontSize: 10,
|
|
6997
6997
|
textAnchor: "middle",
|
|
6998
|
-
children: er(xe(
|
|
6998
|
+
children: er(xe(B), le.timeFormatter)
|
|
6999
6999
|
},
|
|
7000
|
-
`tick-${
|
|
7000
|
+
`tick-${B}`
|
|
7001
7001
|
)) })
|
|
7002
7002
|
]
|
|
7003
7003
|
}
|
|
7004
7004
|
),
|
|
7005
|
-
Se && We.map(({ pane:
|
|
7006
|
-
const ae = Se.perPane[
|
|
7005
|
+
Se && We.map(({ pane: B, y: ue, height: pe }) => {
|
|
7006
|
+
const ae = Se.perPane[B.id];
|
|
7007
7007
|
return ae ? /* @__PURE__ */ de(
|
|
7008
7008
|
"div",
|
|
7009
7009
|
{
|
|
@@ -7018,7 +7018,7 @@ const pi = {
|
|
|
7018
7018
|
},
|
|
7019
7019
|
children: [
|
|
7020
7020
|
/* @__PURE__ */ de("div", { className: "dwlf-pane-tooltip__title", children: [
|
|
7021
|
-
|
|
7021
|
+
B.title ?? "Pane",
|
|
7022
7022
|
" · ",
|
|
7023
7023
|
er(Se.time, le.timeFormatter)
|
|
7024
7024
|
] }),
|
|
@@ -7028,7 +7028,7 @@ const pi = {
|
|
|
7028
7028
|
] }, me.key)) })
|
|
7029
7029
|
]
|
|
7030
7030
|
},
|
|
7031
|
-
`tooltip-${
|
|
7031
|
+
`tooltip-${B.id}`
|
|
7032
7032
|
) : null;
|
|
7033
7033
|
})
|
|
7034
7034
|
]
|
|
@@ -7118,12 +7118,12 @@ function xs(e, t = 50) {
|
|
|
7118
7118
|
if (!E) return;
|
|
7119
7119
|
const q = E.getBoundingClientRect(), W = { left: 50, right: 20 }, U = q.width - W.left - W.right, S = U / h, Q = U - S, J = (A) => Math.max(-Q, Math.min(0, A));
|
|
7120
7120
|
let j = O;
|
|
7121
|
-
const
|
|
7121
|
+
const T = n >= e.length;
|
|
7122
7122
|
if (m !== 0 && Math.sign(O) !== Math.sign(m)) {
|
|
7123
7123
|
const A = m + O, C = J(A), V = C - m;
|
|
7124
7124
|
a(C), j = O - V;
|
|
7125
7125
|
}
|
|
7126
|
-
if (
|
|
7126
|
+
if (T && j < 0) {
|
|
7127
7127
|
const A = m + j, C = J(A), V = C - m;
|
|
7128
7128
|
a(C), j -= V;
|
|
7129
7129
|
}
|
|
@@ -7143,12 +7143,12 @@ function xs(e, t = 50) {
|
|
|
7143
7143
|
if (O) {
|
|
7144
7144
|
const se = W / h, ie = Math.round(w.deltaX / (se * 1.5));
|
|
7145
7145
|
if (ie !== 0) {
|
|
7146
|
-
const
|
|
7146
|
+
const I = Math.max(0, r - ie), v = Math.min(e.length, I + h), z = Math.max(0, v - h);
|
|
7147
7147
|
c(z), l(v), a(0);
|
|
7148
7148
|
}
|
|
7149
7149
|
return;
|
|
7150
7150
|
}
|
|
7151
|
-
const S = (w.clientX - E.left - q.left - m) / W, Q = r + S * h, J = n - r,
|
|
7151
|
+
const S = (w.clientX - E.left - q.left - m) / W, Q = r + S * h, J = n - r, T = 1 + w.deltaY * 2e-3, A = T <= 0 ? 0.1 : T;
|
|
7152
7152
|
let C = Math.round(J * A);
|
|
7153
7153
|
if (C = Math.max(5, Math.min(e.length, C)), C === J) return;
|
|
7154
7154
|
let y = Math.max(0, Math.min(e.length - 1, Q)) - C * S;
|