lightweight-charts-drawing 0.3.0 → 0.4.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/CHANGELOG.md +11 -0
- package/dist/index.d.ts +14 -1
- package/dist/lightweight-charts-drawing.es.js +275 -242
- package/dist/lightweight-charts-drawing.es.js.map +1 -1
- package/dist/lightweight-charts-drawing.umd.cjs +7 -7
- package/dist/lightweight-charts-drawing.umd.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ function pr(e, t) {
|
|
|
32
32
|
return !0;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#089981", tt = "#00bcd4", $ = "#2962ff", ne = "#9c27b0", ut = "#e91e63", qt = "#673ab7",
|
|
35
|
+
const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#089981", tt = "#00bcd4", $ = "#2962ff", ne = "#9c27b0", ut = "#e91e63", qt = "#673ab7", Pt = [
|
|
36
36
|
{ coeff: 0, color: j, visible: !0 },
|
|
37
37
|
{ coeff: 0.236, color: rt, visible: !0 },
|
|
38
38
|
{ coeff: 0.382, color: nt, visible: !0 },
|
|
@@ -318,7 +318,7 @@ const _e = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
318
318
|
"cyclic-lines": { kind: "cyclic-lines", pointCount: 2, preview: "line", isBbox: !1, defaults: { color: "#80ccdb", width: 2 } },
|
|
319
319
|
"sine-line": { kind: "sine-line", pointCount: 2, preview: "line", isBbox: !1, defaults: { color: "#159980", width: 2 } },
|
|
320
320
|
"time-cycles": { kind: "time-cycles", pointCount: 2, preview: "line", isBbox: !1, defaults: { color: "#159980", width: 2, fillBackground: !0, backgroundColor: "#6aa84f", transparency: 50 } },
|
|
321
|
-
"fib-retracement": { kind: "fib-retracement", pointCount: 2, preview: "line", isBbox: !1, hotkey: "Alt + F", defaults: { width: 2, levels:
|
|
321
|
+
"fib-retracement": { kind: "fib-retracement", pointCount: 2, preview: "line", isBbox: !1, hotkey: "Alt + F", defaults: { width: 2, levels: Pt, fillBackground: !0, transparency: 80 } },
|
|
322
322
|
// TV arrow factory text: #2962FF, 14px, centre / bottom.
|
|
323
323
|
// TV LineToolArrow: the trend line with rightEnd = Arrow.
|
|
324
324
|
arrow: { kind: "arrow", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, textColor: $, fontSize: 14, horzLabelsAlign: "center", vertLabelsAlign: "bottom", leftEnd: 0, rightEnd: 1 } },
|
|
@@ -344,7 +344,7 @@ const _e = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
344
344
|
// TV label factory: labelTextColor tv-blue-500, 14px, left, bottom.
|
|
345
345
|
"parallel-channel": { kind: "parallel-channel", pointCount: 3, preview: "line", isBbox: !1, defaults: { width: 2, levels: _e, fillBackground: !0, transparency: 80, textColor: $, fontSize: 14, horzLabelsAlign: "left", vertLabelsAlign: "bottom" } },
|
|
346
346
|
pitchfork: { kind: "pitchfork", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#f23645", width: 2, levels: kt, fillBackground: !0, transparency: 80 } },
|
|
347
|
-
"trend-based-fib-extension": { kind: "trend-based-fib-extension", pointCount: 3, preview: "line", isBbox: !1, defaults: { width: 2, levels:
|
|
347
|
+
"trend-based-fib-extension": { kind: "trend-based-fib-extension", pointCount: 3, preview: "line", isBbox: !1, defaults: { width: 2, levels: Pt, fillBackground: !0, transparency: 80 } },
|
|
348
348
|
// TV label factory: labelTextColor = the line colour, 14px, left, bottom.
|
|
349
349
|
// TV factory: fill in the line colour at 0.2, prices off (12px, line
|
|
350
350
|
// colour), no line ends, no extend.
|
|
@@ -353,7 +353,7 @@ const _e = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
353
353
|
"schiff-pitchfork": { kind: "schiff-pitchfork", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#f23645", width: 2, levels: kt, fillBackground: !0, transparency: 80 } },
|
|
354
354
|
"modified-schiff-pitchfork": { kind: "modified-schiff-pitchfork", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#f23645", width: 2, levels: kt, fillBackground: !0, transparency: 80 } },
|
|
355
355
|
"inside-pitchfork": { kind: "inside-pitchfork", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#f23645", width: 2, levels: kt, fillBackground: !0, transparency: 80 } },
|
|
356
|
-
"fib-channel": { kind: "fib-channel", pointCount: 3, preview: "line", isBbox: !1, defaults: { width: 2, levels:
|
|
356
|
+
"fib-channel": { kind: "fib-channel", pointCount: 3, preview: "line", isBbox: !1, defaults: { width: 2, levels: Pt, fillBackground: !0, transparency: 80, showPrices: !0, showCoeffs: !0, fibLevelsAsPercents: !1, labelFontSize: 12, horzLabelsAlign: "left", vertLabelsAlign: "middle" } },
|
|
357
357
|
"rotated-rectangle": { kind: "rotated-rectangle", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#4caf50", width: 2, fillBackground: !0, backgroundColor: "#4caf50", transparency: 50 } },
|
|
358
358
|
// TV bezier factory: fill off by default, tv-blue back @ 50.
|
|
359
359
|
curve: { kind: "curve", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, fillBackground: !1, backgroundColor: "#2962ff", transparency: 50 } },
|
|
@@ -438,17 +438,17 @@ function sn(e) {
|
|
|
438
438
|
return He[e];
|
|
439
439
|
}
|
|
440
440
|
function Kt(e) {
|
|
441
|
-
const t = { ...Mn, ...He[e].defaults, ...
|
|
441
|
+
const t = { ...Mn, ...He[e].defaults, ...Oo(e) };
|
|
442
442
|
return t.levels && (t.levels = t.levels.map((n) => ({ ...n }))), t;
|
|
443
443
|
}
|
|
444
444
|
function Ua(e) {
|
|
445
445
|
const t = { ...Mn, ...He[e].defaults };
|
|
446
446
|
return t.levels && (t.levels = t.levels.map((n) => ({ ...n }))), t;
|
|
447
447
|
}
|
|
448
|
-
let
|
|
448
|
+
let Oo = () => {
|
|
449
449
|
};
|
|
450
450
|
function Xa(e) {
|
|
451
|
-
|
|
451
|
+
Oo = e;
|
|
452
452
|
}
|
|
453
453
|
const et = 6, L = 6, Qn = 9;
|
|
454
454
|
function W(e) {
|
|
@@ -498,7 +498,7 @@ function Lr(e, t) {
|
|
|
498
498
|
const n = e[0];
|
|
499
499
|
return Math.hypot(n.x - t.x, n.y - t.y) <= et + L ? { hit: "handle", handleIndex: 0 } : Math.abs(t.x - n.x) <= Qn + L && Math.abs(t.y - n.y) <= Qn + L ? { hit: "body" } : null;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function Do(e, t) {
|
|
502
502
|
const [n, o, i] = e, r = o.x - n.x, l = o.y - n.y, s = Math.hypot(r, l) || 1, a = l / s, c = -r / s;
|
|
503
503
|
if (t) {
|
|
504
504
|
const h = i ? Math.abs((i.x - n.x) * a + (i.y - n.y) * c) : 0;
|
|
@@ -688,13 +688,13 @@ function Uo(e, t, n, o) {
|
|
|
688
688
|
});
|
|
689
689
|
}
|
|
690
690
|
let he = null, to = null;
|
|
691
|
-
function
|
|
691
|
+
function zt(e, t, n, o) {
|
|
692
692
|
return he || (he = document.createElement("canvas").getContext("2d")), he ? (to ?? (to = getComputedStyle(document.body).fontFamily), he.font = `${o ? "italic " : ""}${n ? "bold " : ""}${t}px ${to}`, he.measureText(e).width) : e.length * t * 0.6;
|
|
693
693
|
}
|
|
694
694
|
function Ye(e, t, n, o, i) {
|
|
695
695
|
const r = e.split(/\r\n|\r|\n/);
|
|
696
696
|
if (i == null || !Number.isFinite(i) || i <= 0) return r;
|
|
697
|
-
const l = (c) =>
|
|
697
|
+
const l = (c) => zt(c, t, n, o);
|
|
698
698
|
if (l("x") > i) return r;
|
|
699
699
|
const s = (c) => {
|
|
700
700
|
const f = [];
|
|
@@ -755,7 +755,7 @@ function G(e) {
|
|
|
755
755
|
let n = e.wrapWidth != null ? Ye(e.text, t, !!e.bold, !!e.italic, e.wrapWidth) : e.text.split(`
|
|
756
756
|
`);
|
|
757
757
|
e.maxHeight != null && (n = n.slice(0, Math.max(0, Math.floor(e.maxHeight / t))));
|
|
758
|
-
const o = e.padV ?? t / 3, i = e.padH ?? t / 3, r = e.offsetX ?? 0, l = e.offsetY ?? 0, s = e.boxWidthFromWrap && e.wrapWidth != null ? e.wrapWidth : Math.max(0, ...n.map((M) =>
|
|
758
|
+
const o = e.padV ?? t / 3, i = e.padH ?? t / 3, r = e.offsetX ?? 0, l = e.offsetY ?? 0, s = e.boxWidthFromWrap && e.wrapWidth != null ? e.wrapWidth : Math.max(0, ...n.map((M) => zt(M, t, !!e.bold, !!e.italic)));
|
|
759
759
|
let a = Math.round(s + 2 * i);
|
|
760
760
|
a % 2 && (a += 1);
|
|
761
761
|
const c = e.lineSpacing ?? 0, f = t * n.length + c * Math.max(0, n.length - 1) + 2 * o, h = e.vert === "bottom" ? e.y - f - l : e.vert === "middle" ? e.y - f / 2 : e.y + l, u = e.horz === "left" ? e.x + r : e.horz === "center" ? e.x - a / 2 : e.x - a - r, x = e.horz === "center" ? u + a / 2 : e.horz === "left" ? u : u + a, d = e.vert === "middle" ? h + f / 2 : e.vert === "top" ? h : h + f, p = e.horz === "left" ? u + i : e.horz === "right" ? u + a - i : u + a / 2, y = e.horz === "left" ? "start" : e.horz === "right" ? "end" : "middle", b = e.angle ?? 0, m = Math.cos(b), g = Math.sin(b), w = (M, v) => ({ x: (M - x) * m - (v - d) * g + x, y: (M - x) * g + (v - d) * m + d });
|
|
@@ -853,12 +853,12 @@ function jo(e, t, n) {
|
|
|
853
853
|
const c = l.length, f = a.b, h = a.b + a.m * (c - 1);
|
|
854
854
|
let u = -1 / 0, x = -1 / 0;
|
|
855
855
|
for (let S = 0; S < c; S++) {
|
|
856
|
-
const
|
|
857
|
-
u = Math.max(u, l[S].high -
|
|
856
|
+
const C = a.b + a.m * S;
|
|
857
|
+
u = Math.max(u, l[S].high - C), x = Math.max(x, C - l[S].low);
|
|
858
858
|
}
|
|
859
|
-
const d = e.style.useUpperDeviation === !1 ? u : (e.style.upperDeviation ?? 2) * a.sd, p = e.style.useLowerDeviation === !1 ? -x : (e.style.lowerDeviation ?? -2) * a.sd, y = (S,
|
|
860
|
-
const
|
|
861
|
-
return
|
|
859
|
+
const d = e.style.useUpperDeviation === !1 ? u : (e.style.upperDeviation ?? 2) * a.sd, p = e.style.useLowerDeviation === !1 ? -x : (e.style.lowerDeviation ?? -2) * a.sd, y = (S, C) => {
|
|
860
|
+
const I = t.timeToX(S), A = t.priceToY(C);
|
|
861
|
+
return I == null || A == null ? null : { x: I, y: A };
|
|
862
862
|
}, b = y(l[0].time, f), m = y(l[c - 1].time, h);
|
|
863
863
|
if (!b || !m) return null;
|
|
864
864
|
const g = y(l[0].time, f + d), w = y(l[c - 1].time, h + d), M = y(l[0].time, f + p), v = y(l[c - 1].time, h + p), k = (S) => e.style.extendRight && n != null ? Rr(S, n) : S;
|
|
@@ -967,7 +967,7 @@ function Qo(e, t, n = 32) {
|
|
|
967
967
|
}
|
|
968
968
|
return c;
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function Or(e, t) {
|
|
971
971
|
const n = e.points[1];
|
|
972
972
|
if (!t || !n) return "waiting";
|
|
973
973
|
const o = N(n.time);
|
|
@@ -1022,8 +1022,8 @@ function Jo(e, t, n, o = {}) {
|
|
|
1022
1022
|
} else {
|
|
1023
1023
|
const w = Math.max(0, Math.floor((y.low - l) / c)), M = Math.min(a - 1, Math.floor((y.high - l) / c));
|
|
1024
1024
|
for (let v = w; v <= M; v++) {
|
|
1025
|
-
const k = Math.max(y.low, l + v * c), S = Math.min(y.high, l + (v + 1) * c),
|
|
1026
|
-
m ? f[v].up +=
|
|
1025
|
+
const k = Math.max(y.low, l + v * c), S = Math.min(y.high, l + (v + 1) * c), C = S > k ? (S - k) / g * b : 0;
|
|
1026
|
+
m ? f[v].up += C : f[v].down += C, h[v] += C;
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
@@ -1103,7 +1103,7 @@ function an(e, t, n, o) {
|
|
|
1103
1103
|
const s = Math.max(1, 2 * (n + o) / l);
|
|
1104
1104
|
return { x: e.x + i * s, y: e.y + r * s };
|
|
1105
1105
|
}
|
|
1106
|
-
const
|
|
1106
|
+
const Dr = ["bars", "oc", "line", "line-open", "line-high", "line-low", "line-hl2"];
|
|
1107
1107
|
function ro(e, t) {
|
|
1108
1108
|
const [n, o, i, r] = e;
|
|
1109
1109
|
switch (t) {
|
|
@@ -1143,30 +1143,30 @@ function lo(e, t, n, o) {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
1145
|
function ii(e, t, n) {
|
|
1146
|
-
var
|
|
1146
|
+
var O;
|
|
1147
1147
|
if (e.kind !== "bar-pattern" || !n) return null;
|
|
1148
|
-
const o = ((
|
|
1148
|
+
const o = ((O = e.pattern) == null ? void 0 : O.bars) ?? [];
|
|
1149
1149
|
if (o.length === 0 || t.length < 2) return null;
|
|
1150
|
-
const i = e.style, [r, l] = t, s =
|
|
1150
|
+
const i = e.style, [r, l] = t, s = Dr.includes(i.patternMode ?? "") ? i.patternMode : "bars";
|
|
1151
1151
|
let a = o;
|
|
1152
1152
|
if (i.mirrored) {
|
|
1153
|
-
let
|
|
1154
|
-
for (const
|
|
1155
|
-
|
|
1156
|
-
if (
|
|
1157
|
-
const
|
|
1153
|
+
let T = 1 / 0, E = -1 / 0;
|
|
1154
|
+
for (const P of a)
|
|
1155
|
+
T = Math.min(T, P[2], P[1]), E = Math.max(E, P[1], P[2]);
|
|
1156
|
+
if (T < E) {
|
|
1157
|
+
const P = (T + E) / 2, B = (R) => P - (R - P);
|
|
1158
1158
|
a = a.map(([R, Y, K, xt]) => [B(R), B(Y), B(K), B(xt)]);
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
1161
|
i.flipped && (a = [...a].reverse());
|
|
1162
1162
|
const c = !!i.mirrored != !!i.flipped, f = c ? e.points[1].price : e.points[0].price, h = c ? e.points[0].price : e.points[1].price, u = n.priceToY(f), x = n.priceToY(h), d = lo(a[0], s, !0, !!i.flipped), p = lo(a[a.length - 1], s, !1, !!i.flipped), y = n.priceToY(d), b = n.priceToY(p);
|
|
1163
1163
|
if (u == null || x == null || y == null || b == null) return null;
|
|
1164
|
-
const m = b !== y ? +((x - u) / (b - y)).toFixed(8) : 1, g = (
|
|
1165
|
-
return F ? { lineMode: F, bars: [], line: a.map((
|
|
1164
|
+
const m = b !== y ? +((x - u) / (b - y)).toFixed(8) : 1, g = (T) => (n.priceToY(T) ?? 0) * m, w = n.timeToBarIndex(e.points[0].time), M = n.timeToBarIndex(e.points[1].time), k = w == null || M == null || w <= M ? { x: r.x, y: u } : { x: l.x, y: x }, S = a.length, C = S > 1 ? Math.abs(r.x - l.x) / (S - 1) : 0, I = k.y - g(d), A = a.map((T, E) => Math.round(k.x + E * C + 0.5)), F = s !== "bars" && s !== "oc";
|
|
1165
|
+
return F ? { lineMode: F, bars: [], line: a.map((T, E) => ({ x: A[E], y: Math.round(g(ro(T, s)[0])) + I })) } : {
|
|
1166
1166
|
lineMode: F,
|
|
1167
1167
|
line: [],
|
|
1168
|
-
bars: a.map((
|
|
1169
|
-
const [
|
|
1168
|
+
bars: a.map((T, E) => {
|
|
1169
|
+
const [P, B] = ro(T, s), R = Math.round(g(P)) + I, Y = Math.round(g(B)) + I;
|
|
1170
1170
|
return { x: A[E], top: Math.min(R, Y), bottom: Math.max(R, Y) };
|
|
1171
1171
|
})
|
|
1172
1172
|
};
|
|
@@ -1194,19 +1194,19 @@ function ci(e) {
|
|
|
1194
1194
|
const t = e - Jt, n = Math.floor(t / Jt), o = t % Jt;
|
|
1195
1195
|
return { row: n === 0 ? null : n - 1, col: o === 0 ? null : o - 1 };
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
1197
|
+
function Wt(e) {
|
|
1198
1198
|
return e.tableCells ?? [["", "", ""], ["", "", ""], ["", "", ""]];
|
|
1199
1199
|
}
|
|
1200
1200
|
function we(e) {
|
|
1201
1201
|
var o;
|
|
1202
|
-
const t = ((o =
|
|
1202
|
+
const t = ((o = Wt(e)[0]) == null ? void 0 : o.length) ?? 0, n = e.tableColWidths ?? [];
|
|
1203
1203
|
return Array.from({ length: t }, (i, r) => n[r] ?? li);
|
|
1204
1204
|
}
|
|
1205
1205
|
function Pn(e) {
|
|
1206
|
-
const t =
|
|
1206
|
+
const t = Wt(e).length, n = e.tableRowHeights ?? [];
|
|
1207
1207
|
return Array.from({ length: t }, (o, i) => n[i] ?? 0);
|
|
1208
1208
|
}
|
|
1209
|
-
const ai = (e) => e.fontSize ?? 14, fi = (e) =>
|
|
1209
|
+
const ai = (e) => e.fontSize ?? 14, fi = (e) => zt("0", e, !1, !1);
|
|
1210
1210
|
function Ur(e) {
|
|
1211
1211
|
return fi(e) + 2 * Ht + 2 * ht;
|
|
1212
1212
|
}
|
|
@@ -1222,7 +1222,7 @@ function ui(e, t, n) {
|
|
|
1222
1222
|
function Gr(e, t) {
|
|
1223
1223
|
return e * t + (e - 1) * t * (si - 1) + 2 * Ht + 2 * ht;
|
|
1224
1224
|
}
|
|
1225
|
-
function xi(e, t =
|
|
1225
|
+
function xi(e, t = Wt(e), n = we(e)) {
|
|
1226
1226
|
const o = ai(e), i = Pn(e), r = [];
|
|
1227
1227
|
return { heights: i.map((s, a) => {
|
|
1228
1228
|
var f;
|
|
@@ -1232,7 +1232,7 @@ function xi(e, t = zt(e), n = we(e)) {
|
|
|
1232
1232
|
}), mins: r };
|
|
1233
1233
|
}
|
|
1234
1234
|
function En(e, t) {
|
|
1235
|
-
const n = e.style, o = ai(n), i =
|
|
1235
|
+
const n = e.style, o = ai(n), i = Wt(n), r = we(n), { heights: l } = xi(n, i, r), s = [Math.round(t.x)];
|
|
1236
1236
|
let a = 0;
|
|
1237
1237
|
for (const h of r)
|
|
1238
1238
|
a += h, s.push(Math.round(t.x + a));
|
|
@@ -1284,7 +1284,7 @@ function fn(e, t, n) {
|
|
|
1284
1284
|
}
|
|
1285
1285
|
function qr(e, t, n) {
|
|
1286
1286
|
var a;
|
|
1287
|
-
const o =
|
|
1287
|
+
const o = Wt(e).map((c) => [...c]), i = we(e), r = Pn(e), [l, s] = n ?? [o.length - 1, (((a = o[0]) == null ? void 0 : a.length) ?? 1) - 1];
|
|
1288
1288
|
if (t === "row") {
|
|
1289
1289
|
const c = l + 1;
|
|
1290
1290
|
o.splice(c, 0, new Array(i.length).fill("")), r.splice(c, 0, 0);
|
|
@@ -1297,11 +1297,11 @@ function qr(e, t, n) {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
function Zr(e, t) {
|
|
1299
1299
|
var o;
|
|
1300
|
-
const n =
|
|
1300
|
+
const n = Wt(e);
|
|
1301
1301
|
return t === "row" ? n.length > 1 : (((o = n[0]) == null ? void 0 : o.length) ?? 0) > 1;
|
|
1302
1302
|
}
|
|
1303
1303
|
function Kr(e, t, n) {
|
|
1304
|
-
const o =
|
|
1304
|
+
const o = Wt(e).map((c) => [...c]), i = we(e), r = Pn(e), [l, s] = n;
|
|
1305
1305
|
if (t === "row")
|
|
1306
1306
|
o.splice(l, 1), r.splice(l, 1);
|
|
1307
1307
|
else {
|
|
@@ -1312,7 +1312,7 @@ function Kr(e, t, n) {
|
|
|
1312
1312
|
return { patch: { tableCells: o, tableColWidths: i, tableRowHeights: r }, cell: a };
|
|
1313
1313
|
}
|
|
1314
1314
|
function Qr(e, t, n) {
|
|
1315
|
-
const o =
|
|
1315
|
+
const o = Wt(e).map((i) => [...i]);
|
|
1316
1316
|
return o[t[0]] && (o[t[0]][t[1]] = n), { tableCells: o };
|
|
1317
1317
|
}
|
|
1318
1318
|
const Ga = 2e6, co = 2e3, ja = { "image/png": "png", "image/jpeg": "jpg", "image/webp": "webp" }, $t = /* @__PURE__ */ new Map();
|
|
@@ -1382,7 +1382,7 @@ function ll(e) {
|
|
|
1382
1382
|
return { txt: t ? e.text : rl[e.kind] ?? "Text", faint: !t };
|
|
1383
1383
|
}
|
|
1384
1384
|
function gi(e, t, n, o) {
|
|
1385
|
-
const { txt: i, faint: r } = ll(e), l = t.fontSize ?? 14, s =
|
|
1385
|
+
const { txt: i, faint: r } = ll(e), l = t.fontSize ?? 14, s = zt(i, l, !1, !1) + 16, a = l + 12, c = Math.round(180 * Math.atan2(o.y - n.y, o.x - n.x) / Math.PI);
|
|
1386
1386
|
let f = o.x, h = o.y - a / 2;
|
|
1387
1387
|
return c >= -135 && c <= -45 ? (f = o.x - s / 2, h = o.y - a) : c > -45 && c < 45 ? f = o.x : c >= 45 && c <= 135 ? (f = o.x - s / 2, h = o.y) : f = o.x - s, { txt: i, faint: r, fs: l, box: { left: f, top: h, width: s, height: a } };
|
|
1388
1388
|
}
|
|
@@ -1429,7 +1429,7 @@ function ao(e, t) {
|
|
|
1429
1429
|
return l === "top" && (f += ` L ${a} ${o} L ${t} ${o - 10} L ${c} ${o}`), f += ` L ${n + i - s} ${o} A ${s} ${s} 0 0 1 ${n + i} ${o + s} L ${n + i} ${o + r - s} A ${s} ${s} 0 0 1 ${n + i - s} ${o + r}`, l === "bottom" && (f += ` L ${c} ${o + r} L ${t} ${o + r + 10} L ${a} ${o + r}`), f += ` L ${n + s} ${o + r} A ${s} ${s} 0 0 1 ${n} ${o + r - s} Z`, f;
|
|
1430
1430
|
}
|
|
1431
1431
|
function ki(e, t, n) {
|
|
1432
|
-
const o =
|
|
1432
|
+
const o = zt(e, n, !0, !1) + 20, i = n + 10, r = t.x + 9, l = t.y - (i + 15);
|
|
1433
1433
|
return { x: r, y: l, w: o, h: i, fs: n };
|
|
1434
1434
|
}
|
|
1435
1435
|
function al(e) {
|
|
@@ -1437,7 +1437,7 @@ function al(e) {
|
|
|
1437
1437
|
return `M ${t + 12} ${n + i} L ${t - 9} ${n + i + 15} L ${t + 5} ${n + i} L ${t + r} ${n + i} A ${r} ${r} 0 0 1 ${t} ${n + i - r} L ${t} ${n + r} A ${r} ${r} 0 0 1 ${t + r} ${n} L ${t + o - r} ${n} A ${r} ${r} 0 0 1 ${t + o} ${n + r} L ${t + o} ${n + i - r} A ${r} ${r} 0 0 1 ${t + o - r} ${n + i} Z`;
|
|
1438
1438
|
}
|
|
1439
1439
|
function Li(e, t) {
|
|
1440
|
-
const n = e.style, o = n.fontSize ?? 14, i = n.wordWrap ? n.wordWrapWidth ?? 200 : void 0, r = Ye(gt(e).text, o, !!n.bold, !!n.italic, i), l = i ?? Math.max(0, ...r.map((u) =>
|
|
1440
|
+
const n = e.style, o = n.fontSize ?? 14, i = n.wordWrap ? n.wordWrapWidth ?? 200 : void 0, r = Ye(gt(e).text, o, !!n.bold, !!n.italic, i), l = i ?? Math.max(0, ...r.map((u) => zt(u, o, !!n.bold, !!n.italic))), s = o * r.length, a = l + 20, c = s + 20, f = t.x - a / 2, h = t.y - c / 2;
|
|
1441
1441
|
return { fs: o, lines: r, textW: l, textH: s, x: f, y: h, w: a, h: c, wrap: i };
|
|
1442
1442
|
}
|
|
1443
1443
|
function fl(e, t, n) {
|
|
@@ -1448,7 +1448,7 @@ function fl(e, t, n) {
|
|
|
1448
1448
|
let m = `M ${y(8, 0)}`;
|
|
1449
1449
|
return x === 10 ? m += d ? ` L ${y(h - 8, 0)} L ${y(c, f)} L ${y(h + 8, 0)} L ${y(r - 8, 0)}` : ` L ${y(c, f)} L ${y(r - 8, 0)}` : m += ` L ${y(r - 8, 0)}`, m += x === 20 ? ` L ${y(c, f)} L ${y(r, 8)}` : ` ${b(r, 8)}`, x === 21 ? m += p ? ` L ${y(r, u - 8)} L ${y(c, f)} L ${y(r, u + 8)} L ${y(r, l - 8)}` : ` L ${y(c, f)} L ${y(r, l - 8)}` : m += ` L ${y(r, l - 8)}`, m += x === 22 ? ` L ${y(c, f)} L ${y(r - 8, l)}` : ` ${b(r - 8, l)}`, x === 12 ? m += d ? ` L ${y(h + 8, l)} L ${y(c, f)} L ${y(h - 8, l)} L ${y(8, l)}` : ` L ${y(c, f)} L ${y(8, l)}` : m += ` L ${y(8, l)}`, m += x === 2 ? ` L ${y(c, f)} L ${y(0, l - 8)}` : ` ${b(0, l - 8)}`, x === 1 ? m += p ? ` L ${y(0, u + 8)} L ${y(c, f)} L ${y(0, u - 8)} L ${y(0, 8)}` : ` L ${y(c, f)} L ${y(0, 8)}` : m += ` L ${y(0, 8)}`, m += x === 0 ? ` L ${y(c, f)} L ${y(8, 0)}` : ` ${b(8, 0)}`, m + " Z";
|
|
1450
1450
|
}
|
|
1451
|
-
const
|
|
1451
|
+
const Ot = { pole: "#808080", labelBg: "#0f0f0f", labelBorder: "#2e2e2e", labelText: "#dbdbdb", plateBorder: "#0f0f0f" };
|
|
1452
1452
|
function Si(e, t) {
|
|
1453
1453
|
const n = e.barAt(t.time);
|
|
1454
1454
|
return n ? { high: n.high, low: n.low } : null;
|
|
@@ -1663,7 +1663,7 @@ function Tl(e, t, n, o, i, r) {
|
|
|
1663
1663
|
if (l) return l;
|
|
1664
1664
|
const [s, a, c] = t;
|
|
1665
1665
|
if (!c) return _(n.x, n.y, s, a) <= o ? { hit: "body" } : null;
|
|
1666
|
-
const f = e.style, h = { x: c.x - s.x, y: c.y - s.y }, u = (f.levels ??
|
|
1666
|
+
const f = e.style, h = { x: c.x - s.x, y: c.y - s.y }, u = (f.levels ?? Pt).filter((d) => d.visible).map((d) => d.coeff);
|
|
1667
1667
|
if (u.length === 0) return null;
|
|
1668
1668
|
const x = (i + r) * 2;
|
|
1669
1669
|
for (const d of u) {
|
|
@@ -1720,7 +1720,7 @@ function ho(e, t) {
|
|
|
1720
1720
|
return t.x >= o - L && t.x <= i + L && t.y >= r - L && t.y <= l + L ? { hit: "body" } : null;
|
|
1721
1721
|
}
|
|
1722
1722
|
function Il(e, t, n) {
|
|
1723
|
-
const o = e.fmt === 2, i =
|
|
1723
|
+
const o = e.fmt === 2, i = Do(t, o), r = o ? [t[0], t[1], ...i] : t, l = z(r, n);
|
|
1724
1724
|
return l || (Qt(n.x, n.y, i) ? { hit: "body" } : null);
|
|
1725
1725
|
}
|
|
1726
1726
|
function Pl(e, t) {
|
|
@@ -1796,7 +1796,7 @@ function Fl(e, t, n, o, i) {
|
|
|
1796
1796
|
if (Math.abs(n.x - f.x) <= Math.max(o, (f.width ?? 1) / 2 + 2)) return { hit: "body" };
|
|
1797
1797
|
return null;
|
|
1798
1798
|
}
|
|
1799
|
-
function
|
|
1799
|
+
function Ol(e, t, n) {
|
|
1800
1800
|
const o = z(t, n);
|
|
1801
1801
|
if (o) return o;
|
|
1802
1802
|
const i = Ho(e, t);
|
|
@@ -1804,7 +1804,7 @@ function Dl(e, t, n) {
|
|
|
1804
1804
|
const r = No(i);
|
|
1805
1805
|
return n.x >= r.left - L && n.x <= r.right + L && n.y >= r.top - L && n.y <= r.bottom + L ? { hit: "body" } : null;
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function Dl(e, t) {
|
|
1808
1808
|
const n = z(e, t);
|
|
1809
1809
|
if (n) return n;
|
|
1810
1810
|
const [o, i, r] = e;
|
|
@@ -2085,9 +2085,9 @@ function Jl(e, t, n, o, i, r, l = !1) {
|
|
|
2085
2085
|
return Fl(e, t, n, s, r);
|
|
2086
2086
|
case "gann-square-fixed":
|
|
2087
2087
|
case "gann-square":
|
|
2088
|
-
return
|
|
2088
|
+
return Ol(e, t, n);
|
|
2089
2089
|
case "sector":
|
|
2090
|
-
return
|
|
2090
|
+
return Dl(t, n);
|
|
2091
2091
|
case "fib-speed-resistance-arcs":
|
|
2092
2092
|
return Hl(e, t, n);
|
|
2093
2093
|
case "fib-spiral":
|
|
@@ -2320,7 +2320,7 @@ function Me(e) {
|
|
|
2320
2320
|
return e.length % 2 === 1 && e[Math.floor(e.length / 2)].trim() !== "";
|
|
2321
2321
|
}
|
|
2322
2322
|
function zi(e, t, n, o, i, r, l, s, a, c, f) {
|
|
2323
|
-
const h = Math.max(0, ...n.map((g) =>
|
|
2323
|
+
const h = Math.max(0, ...n.map((g) => zt(g, o, c, f))) + 2 * l, u = n.length * i + 2 * r, x = a === "left" ? e.x : a === "right" ? e.x - h : e.x - h / 2, d = s === "bottom" ? e.y - u : s === "top" ? e.y : e.y - u / 2, p = t * Math.PI / 180, y = Math.cos(p), b = Math.sin(p), m = (g, w) => ({ x: (g - e.x) * y - (w - e.y) * b + e.x, y: (g - e.x) * b + (w - e.y) * y + e.y });
|
|
2324
2324
|
return [m(x, d), m(x + h, d), m(x + h, d + u), m(x, d + u)];
|
|
2325
2325
|
}
|
|
2326
2326
|
function U(e, t, n, o) {
|
|
@@ -2350,8 +2350,8 @@ function Wi(e, t, n, o, i, r) {
|
|
|
2350
2350
|
let f, h;
|
|
2351
2351
|
s === "bottom" ? [f, h] = e.y < n.y ? [e, t] : [n, o] : s === "top" ? [f, h] = e.y > n.y ? [e, t] : [n, o] : [f, h] = [{ x: (e.x + n.x) / 2, y: (e.y + n.y) / 2 }, { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 }];
|
|
2352
2352
|
const u = f.x < h.x ? f : h, x = u === f ? h : f, d = a === "left" ? u : a === "right" ? x : { x: (u.x + x.x) / 2, y: (u.y + x.y) / 2 }, p = Math.atan((u.y - x.y) / (u.x - x.x)), y = Number.isNaN(p) ? 0 : p * 180 / Math.PI, b = i.fontSize ?? 14, m = b / 3, g = r ?? (c ? m : 0), w = l.split(`
|
|
2353
|
-
`), M = Math.ceil(b), v = w.length * M + 2 * m, k = s === "bottom" ? d.y - v : s === "top" ? d.y : d.y - v / 2, S = a === "left" ? d.x + g : a === "right" ? d.x - g : d.x,
|
|
2354
|
-
return { u: d, angle: y, fs: b, lines: w, lineH: M, top: k + m, x: S, anchor:
|
|
2353
|
+
`), M = Math.ceil(b), v = w.length * M + 2 * m, k = s === "bottom" ? d.y - v : s === "top" ? d.y : d.y - v / 2, S = a === "left" ? d.x + g : a === "right" ? d.x - g : d.x, C = a === "left" ? "start" : a === "right" ? "end" : "middle";
|
|
2354
|
+
return { u: d, angle: y, fs: b, lines: w, lineH: M, top: k + m, x: S, anchor: C, vert: s, horz: a, padV: m, padH: g };
|
|
2355
2355
|
}
|
|
2356
2356
|
function Xe(e, t, n, o, i, r) {
|
|
2357
2357
|
const l = Wi(e, t, n, o, i, r);
|
|
@@ -2431,7 +2431,7 @@ function Fi(e, t, n, o, i, r) {
|
|
|
2431
2431
|
}
|
|
2432
2432
|
return a;
|
|
2433
2433
|
}
|
|
2434
|
-
function
|
|
2434
|
+
function Oi(e, t, n, o, i, r) {
|
|
2435
2435
|
const l = t.x - e.x, s = t.y - e.y;
|
|
2436
2436
|
let a = 0, c = 1;
|
|
2437
2437
|
const f = (h, u) => {
|
|
@@ -2449,9 +2449,9 @@ function Di(e, t, n, o, i, r) {
|
|
|
2449
2449
|
return f(-l, e.x - n) && f(l, n + i - e.x) && f(-s, e.y - o) && f(s, o + r - e.y) && a <= c;
|
|
2450
2450
|
}
|
|
2451
2451
|
function ss(e, t, n, o) {
|
|
2452
|
-
return e.x === t.x && e.y === t.y ? e.x >= 0 && e.x <= n && e.y >= 0 && e.y <= o :
|
|
2452
|
+
return e.x === t.x && e.y === t.y ? e.x >= 0 && e.x <= n && e.y >= 0 && e.y <= o : Oi(e, t, 0, 0, n, o);
|
|
2453
2453
|
}
|
|
2454
|
-
function
|
|
2454
|
+
function Di(e, t, n, o, i, r, l) {
|
|
2455
2455
|
if (!i || n.length === 0) return [];
|
|
2456
2456
|
const s = o === 3;
|
|
2457
2457
|
if (s && !ss(e, t, r, l)) return [];
|
|
@@ -2460,11 +2460,11 @@ function Oi(e, t, n, o, i, r, l) {
|
|
|
2460
2460
|
Math.round(x) % 2 !== 0 && (x = Math.round(x) + 1);
|
|
2461
2461
|
const d = c * n.length + f * (n.length - 1) + h * 2, p = { x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }, y = o === 0 ? e : o === 2 ? t : p, b = t.y < e.y && t.x < e.x || t.y > e.y && t.x > e.x;
|
|
2462
2462
|
let m = y.x + 12, g = b ? y.y - 12 - d : y.y + 12;
|
|
2463
|
-
s && (e.x !== t.x || e.y !== t.y) && (m < 0 ? m = 0 : m + x > r && (m = r - x), g < 0 ? g = 0 : g + d > l && (g = l - d),
|
|
2463
|
+
s && (e.x !== t.x || e.y !== t.y) && (m < 0 ? m = 0 : m + x > r && (m = r - x), g < 0 ? g = 0 : g + d > l && (g = l - d), Oi(e, t, m, g, x, d) && (g = b ? p.y + 12 : p.y - 12 - d, m = Math.min(p.x, r) - x));
|
|
2464
2464
|
const w = Math.floor(m), M = Math.floor(g), v = [{ t: "rect", x: w, y: M, w: x, h: d, rx: 4, ry: 4, fill: "#464646", fillOpacity: 230 / 255 }];
|
|
2465
2465
|
return n.forEach((k, S) => {
|
|
2466
|
-
const
|
|
2467
|
-
v.push({ t: "path", d: ls[k.icon], transform: `translate(${w + h}, ${
|
|
2466
|
+
const C = M + h + S * (c + f);
|
|
2467
|
+
v.push({ t: "path", d: ls[k.icon], transform: `translate(${w + h}, ${C})`, fill: "#F9F9F9", fillRule: "evenodd" }), v.push({ t: "text", x: w + h + c + h, y: C + c / 2, text: k.text, size: a, fill: "#FFFFFF", baseline: "central" });
|
|
2468
2468
|
}), [{ t: "group", inert: !0, items: v }];
|
|
2469
2469
|
}
|
|
2470
2470
|
function Ge(e, t, n) {
|
|
@@ -2487,20 +2487,20 @@ function Bt(e, t, n) {
|
|
|
2487
2487
|
function _i(e) {
|
|
2488
2488
|
return { ...e, horzLabelsAlign: e.horzLabelsAlign ?? "center", vertLabelsAlign: e.vertLabelsAlign ?? "bottom" };
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function On(e, t, n) {
|
|
2491
2491
|
return Ri(e, t, e, t, _i(n), (n.fontSize ?? 14) / 3, !1);
|
|
2492
2492
|
}
|
|
2493
2493
|
function ie(e, t) {
|
|
2494
2494
|
return t && t.length ? { items: [{ t: "clip", name: e, polys: [t] }], clip: e } : { items: [], clip: void 0 };
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function Dn(e, t, n, o, i, r, l, s, a) {
|
|
2497
2497
|
if (!e.points[0] || !e.points[1]) return [];
|
|
2498
2498
|
const c = Fi(e, t, n, o, l, !0), f = o.statsPosition ?? (e.kind === "info-line" ? 1 : 2), h = s || !!o.showStats, u = [{
|
|
2499
2499
|
t: "group",
|
|
2500
2500
|
clip: a,
|
|
2501
2501
|
items: [...o.leftEnd === 1 ? Bt(n, t, o) : [], ...o.rightEnd === 1 ? Bt(t, n, o) : []]
|
|
2502
2502
|
}];
|
|
2503
|
-
return o.showMiddlePoint && s && u.push({ t: "anchors", pts: [{ x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 }] }), u.push(...Xe(t, n, t, n, _i(o), (o.fontSize ?? 14) / 3)), u.push(...
|
|
2503
|
+
return o.showMiddlePoint && s && u.push({ t: "anchors", pts: [{ x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 }] }), u.push(...Xe(t, n, t, n, _i(o), (o.fontSize ?? 14) / 3)), u.push(...Di(t, n, c, f, h, i, r)), u;
|
|
2504
2504
|
}
|
|
2505
2505
|
function cs(e, t, n) {
|
|
2506
2506
|
if (!n.text) return null;
|
|
@@ -2584,22 +2584,22 @@ function us(e, t, n, o, i) {
|
|
|
2584
2584
|
];
|
|
2585
2585
|
}
|
|
2586
2586
|
function uo(e, t, n, o, i, r, l, s) {
|
|
2587
|
-
const [a, c] = t, f = ie("cut",
|
|
2587
|
+
const [a, c] = t, f = ie("cut", On(a, c, r));
|
|
2588
2588
|
return [
|
|
2589
2589
|
St(a, c),
|
|
2590
2590
|
...f.items,
|
|
2591
2591
|
{ t: "line", a, b: c, stroke: r.color, strokeWidth: r.width, dash: W(r), cap: Hi(r), clip: f.clip },
|
|
2592
|
-
...
|
|
2592
|
+
...Dn(e, a, c, r, o, i, l, s, f.clip),
|
|
2593
2593
|
...n ? [{ t: "anchors", pts: t }] : []
|
|
2594
2594
|
];
|
|
2595
2595
|
}
|
|
2596
2596
|
function Te(e, t, n, o, i, r, l, s, a, c) {
|
|
2597
|
-
const [f, h] = t, u = h.x - f.x, x = h.y - f.y, d = Math.hypot(u, x) || 1, p = u / d, y = x / d, b = (o + i) * 2, m = l ? { x: f.x - p * b, y: f.y - y * b } : f, g = s ? { x: h.x + p * b, y: h.y + y * b } : h, w = ie("cut",
|
|
2597
|
+
const [f, h] = t, u = h.x - f.x, x = h.y - f.y, d = Math.hypot(u, x) || 1, p = u / d, y = x / d, b = (o + i) * 2, m = l ? { x: f.x - p * b, y: f.y - y * b } : f, g = s ? { x: h.x + p * b, y: h.y + y * b } : h, w = ie("cut", On(f, h, r));
|
|
2598
2598
|
return [
|
|
2599
2599
|
St(f, h),
|
|
2600
2600
|
...w.items,
|
|
2601
2601
|
{ t: "line", a: m, b: g, stroke: r.color, strokeWidth: r.width, dash: W(r), clip: w.clip },
|
|
2602
|
-
...
|
|
2602
|
+
...Dn(e, f, h, r, o, i, a, c, w.clip),
|
|
2603
2603
|
...n ? [{ t: "anchors", pts: t }] : []
|
|
2604
2604
|
];
|
|
2605
2605
|
}
|
|
@@ -2615,12 +2615,12 @@ function xs(e, t, n, o) {
|
|
|
2615
2615
|
}
|
|
2616
2616
|
function ds(e, t, n, o, i, r, l, s) {
|
|
2617
2617
|
if (e.kind !== "info-line") return [];
|
|
2618
|
-
const [a, c] = t, f = ie("cut",
|
|
2618
|
+
const [a, c] = t, f = ie("cut", On(a, c, r)), h = Math.hypot(c.x - a.x, c.y - a.y) || 1, u = (o + i) * 2, x = (c.x - a.x) / h, d = (c.y - a.y) / h, p = r.extendLeft ? { x: a.x - x * u, y: a.y - d * u } : a, y = r.extendRight ? { x: c.x + x * u, y: c.y + d * u } : c;
|
|
2619
2619
|
return [
|
|
2620
2620
|
St(a, c),
|
|
2621
2621
|
...f.items,
|
|
2622
2622
|
{ t: "line", a: p, b: y, stroke: r.color, strokeWidth: r.width, dash: W(r), cap: "round", clip: f.clip },
|
|
2623
|
-
...
|
|
2623
|
+
...Dn(e, a, c, r, o, i, l, s, f.clip),
|
|
2624
2624
|
...n ? [{ t: "anchors", pts: t }] : []
|
|
2625
2625
|
];
|
|
2626
2626
|
}
|
|
@@ -2646,7 +2646,7 @@ function ys(e, t, n, o, i, r, l, s) {
|
|
|
2646
2646
|
},
|
|
2647
2647
|
// TV TrendToolWithStatsPaneView: price / bars stats (factory off) at the
|
|
2648
2648
|
// second point (statsPosition 2), on hover / selection / always.
|
|
2649
|
-
...
|
|
2649
|
+
...Di(a, c, Fi(e, a, c, r, l, !1), r.statsPosition ?? 2, s || !!r.showStats, o, i),
|
|
2650
2650
|
...n ? [{ t: "anchors", pts: t }] : []
|
|
2651
2651
|
];
|
|
2652
2652
|
}
|
|
@@ -2770,9 +2770,41 @@ function Vi(e, t, n, o, i) {
|
|
|
2770
2770
|
return { t: "rect", x: n, y: Math.min(s, a), w: Math.max(1, o - n), h: Math.abs(a - s), fill: r.color, fillOpacity: i, stroke: "none", inert: !0 };
|
|
2771
2771
|
}) : [];
|
|
2772
2772
|
}
|
|
2773
|
+
function Ka(e, t, n, o, i) {
|
|
2774
|
+
const r = e.style;
|
|
2775
|
+
let l = null, s = 0, a = 0;
|
|
2776
|
+
if (e.kind === "fib-retracement" && t.length >= 2) {
|
|
2777
|
+
const [p, y] = t, b = e.points[0].price, m = e.points[1].price;
|
|
2778
|
+
s = r.extendLeft ? 0 : Math.min(p.x, y.x), a = r.extendRight ? o : Math.max(p.x, y.x);
|
|
2779
|
+
const g = !!r.fibLevelsBasedOnLogScale && !!(i != null && i.isLog()) && b > 0 && m > 0, w = (v) => {
|
|
2780
|
+
const k = r.reverse ? b : m, S = r.reverse ? m : b;
|
|
2781
|
+
return g ? Math.exp(Math.log(k) + v * (Math.log(S) - Math.log(k))) : k + v * (S - k);
|
|
2782
|
+
}, M = (v) => r.reverse ? p.y + (y.y - p.y) * v : y.y + (p.y - y.y) * v;
|
|
2783
|
+
l = (v) => g ? M(v) : (i == null ? void 0 : i.priceToY(w(v))) ?? M(v);
|
|
2784
|
+
} else if (e.kind === "trend-based-fib-extension" && t.length >= 3 && e.points.length >= 3) {
|
|
2785
|
+
const [, p, y] = t, b = e.points[0].price, m = e.points[1].price, g = e.points[2].price, w = r.reverse ? b - m : m - b, M = r.reverse ? t[0].y - t[1].y : t[1].y - t[0].y;
|
|
2786
|
+
s = r.extendLeft ? 0 : Math.min(p.x, y.x), a = r.extendRight ? o : Math.max(p.x, y.x);
|
|
2787
|
+
const v = !!r.fibLevelsBasedOnLogScale && !!(i != null && i.isLog()) && b > 0 && m > 0 && g > 0, k = (C) => {
|
|
2788
|
+
if (!v) return g + w * C;
|
|
2789
|
+
const I = r.reverse ? Math.log(b) - Math.log(m) : Math.log(m) - Math.log(b);
|
|
2790
|
+
return Math.exp(Math.log(g) + C * I);
|
|
2791
|
+
}, S = (C) => y.y + M * C;
|
|
2792
|
+
l = (C) => v ? S(C) : (i == null ? void 0 : i.priceToY(k(C))) ?? S(C);
|
|
2793
|
+
}
|
|
2794
|
+
if (!l || n.x < s - L || n.x > a + L) return null;
|
|
2795
|
+
const c = r.levels ?? Pt;
|
|
2796
|
+
let f = null;
|
|
2797
|
+
if (c.forEach((p, y) => {
|
|
2798
|
+
if (!p.visible) return;
|
|
2799
|
+
const b = l(p.coeff), m = Math.abs(n.y - b);
|
|
2800
|
+
m <= 6 && (!f || m < f.dist) && (f = { index: y, y: b, dist: m });
|
|
2801
|
+
}), !f) return null;
|
|
2802
|
+
const { index: h, y: u } = f, x = r.horzTextAlign ?? "center", d = x === "left" ? s : x === "right" ? a : (s + a) / 2;
|
|
2803
|
+
return { index: h, y: u, left: s, right: a, textX: d };
|
|
2804
|
+
}
|
|
2773
2805
|
function vs(e, t, n, o, i, r) {
|
|
2774
2806
|
if (e.kind !== "fib-retracement") return [];
|
|
2775
|
-
const [l, s] = t, a = e.points[0].price, c = e.points[1].price, f = i.extendLeft ? 0 : Math.min(l.x, s.x), h = i.extendRight ? o : Math.max(l.x, s.x), u = Ct(i,
|
|
2807
|
+
const [l, s] = t, a = e.points[0].price, c = e.points[1].price, f = i.extendLeft ? 0 : Math.min(l.x, s.x), h = i.extendRight ? o : Math.max(l.x, s.x), u = Ct(i, Pt), x = !!i.fibLevelsBasedOnLogScale && !!(r != null && r.isLog()) && a > 0 && c > 0, d = (m) => {
|
|
2776
2808
|
const g = i.reverse ? a : c, w = i.reverse ? c : a;
|
|
2777
2809
|
return x ? Math.exp(Math.log(g) + m * (Math.log(w) - Math.log(g))) : g + m * (w - g);
|
|
2778
2810
|
}, p = (m) => i.reverse ? l.y + (s.y - l.y) * m : s.y + (l.y - s.y) * m, y = (m) => x ? p(m) : (r == null ? void 0 : r.priceToY(d(m))) ?? p(m), b = Nn(r);
|
|
@@ -2786,7 +2818,7 @@ function vs(e, t, n, o, i, r) {
|
|
|
2786
2818
|
}
|
|
2787
2819
|
function ks(e, t, n, o, i, r) {
|
|
2788
2820
|
if (e.kind !== "trend-based-fib-extension") return [];
|
|
2789
|
-
const [, l, s] = t, a = e.points[0].price, c = e.points[1].price, f = e.points[2].price, h = i.reverse ? a - c : c - a, u = i.reverse ? t[0].y - t[1].y : t[1].y - t[0].y, x = Ct(i,
|
|
2821
|
+
const [, l, s] = t, a = e.points[0].price, c = e.points[1].price, f = e.points[2].price, h = i.reverse ? a - c : c - a, u = i.reverse ? t[0].y - t[1].y : t[1].y - t[0].y, x = Ct(i, Pt), d = i.extendLeft ? 0 : Math.min(l.x, s.x), p = i.extendRight ? o : Math.max(l.x, s.x), y = !!i.fibLevelsBasedOnLogScale && !!(r != null && r.isLog()) && a > 0 && c > 0 && f > 0, b = (M) => {
|
|
2790
2822
|
if (!y) return f + h * M;
|
|
2791
2823
|
const v = i.reverse ? Math.log(a) - Math.log(c) : Math.log(c) - Math.log(a);
|
|
2792
2824
|
return Math.exp(Math.log(f) + M * v);
|
|
@@ -2805,20 +2837,20 @@ function Ls(e, t, n, o, i, r, l) {
|
|
|
2805
2837
|
const [s, a, c] = t, f = c.x - s.x, h = c.y - s.y, u = (r + l) * 2, x = (M) => ({ l: { x: s.x + f * M, y: s.y + h * M }, r: { x: a.x + f * M, y: a.y + h * M } }), d = (M) => {
|
|
2806
2838
|
const v = x(M);
|
|
2807
2839
|
return We(v.l, v.r, !!o.extendLeft, !!o.extendRight, u);
|
|
2808
|
-
}, p = Ct(o,
|
|
2840
|
+
}, p = Ct(o, Pt), y = Z(o), b = Nn(i), m = (M, v) => (i == null ? void 0 : i.yToPrice(v)) ?? e.points[0].price + (e.points[2].price - e.points[0].price) * M, g = (M, v) => {
|
|
2809
2841
|
const k = o.showCoeffs !== !1, S = o.showPrices !== !1;
|
|
2810
2842
|
if (!k && !S) return null;
|
|
2811
|
-
let
|
|
2812
|
-
k && (
|
|
2813
|
-
const
|
|
2814
|
-
return G({ x: A.x, y: A.y, text:
|
|
2843
|
+
let C = "";
|
|
2844
|
+
k && (C += o.fibLevelsAsPercents ? `${(100 * M.coeff).toFixed(2)}%` : It(M.coeff)), S && (C += ` (${m(M.coeff, v.l.y).toFixed(b)})`);
|
|
2845
|
+
const I = o.horzLabelsAlign ?? "left", A = I === "left" ? v.l : I === "right" ? v.r : { x: (v.l.x + v.r.x) / 2, y: (v.l.y + v.r.y) / 2 };
|
|
2846
|
+
return G({ x: A.x, y: A.y, text: C, fs: o.labelFontSize ?? 12, vert: o.vertLabelsAlign ?? "middle", horz: I === "left" ? "right" : I === "right" ? "left" : "center", offsetX: 4 });
|
|
2815
2847
|
}, w = [];
|
|
2816
2848
|
return y > 0 && p.slice(1).forEach((M, v) => {
|
|
2817
2849
|
const k = d(p[v].coeff), S = d(M.coeff);
|
|
2818
2850
|
w.push({ t: "polygon", pts: [k.l, k.r, S.r, S.l], fill: p[v].color, fillOpacity: y, stroke: "none", inert: !0 });
|
|
2819
2851
|
}), p.forEach((M, v) => {
|
|
2820
|
-
const k = x(M.coeff), S = d(M.coeff),
|
|
2821
|
-
w.push({ t: "hit", a: k.l, b: k.r, width: 12 }, ...
|
|
2852
|
+
const k = x(M.coeff), S = d(M.coeff), C = g(M, k), I = Yn(`l${v}`, [C ? C.poly : null]);
|
|
2853
|
+
w.push({ t: "hit", a: k.l, b: k.r, width: 12 }, ...I.items), w.push({ t: "line", a: S.l, b: S.r, stroke: M.color, strokeWidth: wt(M, o), dash: Mt(M, o), clip: I.clip }), C && w.push(U(C, M.color));
|
|
2822
2854
|
}), w.push(...lt(n, t)), w;
|
|
2823
2855
|
}
|
|
2824
2856
|
function Ui(e, t, n, o, i, r, l) {
|
|
@@ -2870,7 +2902,7 @@ function As(e, t, n, o) {
|
|
|
2870
2902
|
return x.push(...Nt(i, r, o), ...lt(n, t)), x;
|
|
2871
2903
|
}
|
|
2872
2904
|
function $s(e, t, n, o, i, r, l) {
|
|
2873
|
-
const [s, a] = t, c = oi(e, t, l, Pe), f = W(r), h = Z(r), u = c.h.map((k) => ({ color: k.color, far: an(s, { x: a.x, y: k.y }, o, i) })), x = c.v.map((k) => ({ color: k.color, far: an(s, { x: k.x, y: a.y }, o, i) })), d = (k) => k.slice(1).map((S,
|
|
2905
|
+
const [s, a] = t, c = oi(e, t, l, Pe), f = W(r), h = Z(r), u = c.h.map((k) => ({ color: k.color, far: an(s, { x: a.x, y: k.y }, o, i) })), x = c.v.map((k) => ({ color: k.color, far: an(s, { x: k.x, y: a.y }, o, i) })), d = (k) => k.slice(1).map((S, C) => ({ color: S.color, pts: [s, S.far, k[C].far] })), { left: p, top: y, right: b, bottom: m } = c.box, g = r.fanGrid ?? Ro, w = W({ ...r, lineStyle: g.style, width: g.width }), M = (k, S, C, I, A, F, O) => G({ x: k, y: S, text: It(C), fs: 12, vert: I, horz: A, offsetX: F, offsetY: O }), v = [];
|
|
2874
2906
|
if (h > 0)
|
|
2875
2907
|
for (const k of [...d(u), ...d(x)]) v.push({ t: "polygon", pts: k.pts, fill: k.color, fillOpacity: h, stroke: "none", inert: !0 });
|
|
2876
2908
|
for (const k of c.h)
|
|
@@ -2961,11 +2993,11 @@ function zs(e, t, n, o, i) {
|
|
|
2961
2993
|
if (e.kind !== "gann-square" || o.showLabels === !1 || !i) return [];
|
|
2962
2994
|
const [g, w] = e.points, M = i.timeToBarIndex(g.time), v = i.timeToBarIndex(w.time);
|
|
2963
2995
|
if (M == null || v == null) return [];
|
|
2964
|
-
const k = o.reverse ? -1 : 1, S = (w.price - g.price) * k,
|
|
2965
|
-
F(r.start.x, r.end.y, bt(S,
|
|
2966
|
-
F(r.end.x, r.start.y, String(
|
|
2996
|
+
const k = o.reverse ? -1 : 1, S = (w.price - g.price) * k, C = (v - M) * k, I = Math.max(0, Math.min(8, Math.round(-Math.log10(i.pipSize())))), A = o.labelFontSize ?? 12, F = (T, E, P, B, R, Y) => G({ x: T, y: E, text: P, fs: A, bold: o.bold, italic: o.italic, horz: B, vert: R, offsetX: 10, offsetY: Y }), O = [
|
|
2997
|
+
F(r.start.x, r.end.y, bt(S, I), C > 0 ? "right" : "left", S > 0 ? "bottom" : "top", S > 0 ? 8 : 10),
|
|
2998
|
+
F(r.end.x, r.start.y, String(C), C > 0 ? "left" : "right", S > 0 ? "top" : "bottom", S > 0 ? 10 : 8)
|
|
2967
2999
|
];
|
|
2968
|
-
return
|
|
3000
|
+
return C !== 0 && O.push(F(r.end.x, r.end.y, String(Number(Math.abs(S / C).toFixed(7))), C > 0 ? "left" : "right", S > 0 ? "bottom" : "top", S > 0 ? 8 : 10)), O;
|
|
2969
3001
|
})(), x = ((m = l[l.length - 1]) == null ? void 0 : m.color) ?? "#808080", d = f.right - f.left, p = f.bottom - f.top, y = [
|
|
2970
3002
|
{ t: "clipRect", name: "box", x: f.left, y: f.top, w: d, h: p, idPrefix: "gann-clip-" },
|
|
2971
3003
|
{ t: "rect", x: f.left, y: f.top, w: d, h: p, fill: "transparent" }
|
|
@@ -3000,33 +3032,33 @@ function Ws(e, t, n, o, i) {
|
|
|
3000
3032
|
return y.push(...me(t, e)), y;
|
|
3001
3033
|
}
|
|
3002
3034
|
function Rs(e, t, n, o, i) {
|
|
3003
|
-
const [r, l] = t, s = Math.min(r.x, l.x), a = Math.max(r.x, l.x), c = Math.min(r.y, l.y), f = Math.max(r.y, l.y), h = mt(r, l), u = o.levels ?? Ee, x = o.vLevels ?? Ee, d = W(o), [p, y] = e.points, b = !!o.reverse, m = (
|
|
3004
|
-
const E = b ? y.price : p.price,
|
|
3005
|
-
return (i == null ? void 0 : i.priceToY(E +
|
|
3006
|
-
}, g = (i == null ? void 0 : i.timeToBarIndex(p.time)) ?? null, w = (i == null ? void 0 : i.timeToBarIndex(y.time)) ?? null, M = (
|
|
3035
|
+
const [r, l] = t, s = Math.min(r.x, l.x), a = Math.max(r.x, l.x), c = Math.min(r.y, l.y), f = Math.max(r.y, l.y), h = mt(r, l), u = o.levels ?? Ee, x = o.vLevels ?? Ee, d = W(o), [p, y] = e.points, b = !!o.reverse, m = (T) => {
|
|
3036
|
+
const E = b ? y.price : p.price, P = b ? p.price - y.price : y.price - p.price;
|
|
3037
|
+
return (i == null ? void 0 : i.priceToY(E + T * P)) ?? (b ? l.y + T * (r.y - l.y) : r.y + T * (l.y - r.y));
|
|
3038
|
+
}, g = (i == null ? void 0 : i.timeToBarIndex(p.time)) ?? null, w = (i == null ? void 0 : i.timeToBarIndex(y.time)) ?? null, M = (T) => {
|
|
3007
3039
|
if (i && g != null && w != null) {
|
|
3008
|
-
const E = b ? w : g,
|
|
3040
|
+
const E = b ? w : g, P = b ? g - w : w - g, B = i.barIndexToTime(Math.round(E + T * P)), R = B != null ? i.timeToX(B) : null;
|
|
3009
3041
|
if (R != null) return R;
|
|
3010
3042
|
}
|
|
3011
|
-
return b ? l.x +
|
|
3012
|
-
}, v = u.filter((
|
|
3013
|
-
if (
|
|
3014
|
-
for (let
|
|
3015
|
-
const E = M(u[
|
|
3043
|
+
return b ? l.x + T * (r.x - l.x) : r.x + T * (l.x - r.x);
|
|
3044
|
+
}, v = u.filter((T) => T.visible).map((T) => ({ ...T, y: m(T.coeff) })), k = x.filter((T) => T.visible).map((T) => ({ ...T, x: M(T.coeff) })), S = o.fillBackground !== !1 ? Math.max(0, Math.min(1, (100 - (o.transparency ?? 80)) / 100)) : 0, C = o.fillVertBackground !== !1 ? Math.max(0, Math.min(1, (100 - (o.vertTransparency ?? 80)) / 100)) : 0, I = o.fans ?? { visible: !1, color: "#9C9C9C" }, A = [];
|
|
3045
|
+
if (I.visible)
|
|
3046
|
+
for (let T = 0; T < u.length; T++) {
|
|
3047
|
+
const E = M(u[T].coeff);
|
|
3016
3048
|
A.push([{ x: s, y: f }, { x: E, y: c }], [{ x: a, y: f }, { x: E, y: c }], [{ x: s, y: c }, { x: E, y: f }], [{ x: a, y: c }, { x: E, y: f }]);
|
|
3017
|
-
const
|
|
3018
|
-
if (!
|
|
3019
|
-
const B = m(
|
|
3049
|
+
const P = x[T];
|
|
3050
|
+
if (!P) continue;
|
|
3051
|
+
const B = m(P.coeff);
|
|
3020
3052
|
A.push([{ x: s, y: f }, { x: a, y: B }], [{ x: a, y: f }, { x: s, y: B }], [{ x: s, y: c }, { x: a, y: B }], [{ x: a, y: c }, { x: s, y: B }]);
|
|
3021
3053
|
}
|
|
3022
|
-
const F = (
|
|
3023
|
-
v.forEach((
|
|
3024
|
-
E > 0 && S > 0 &&
|
|
3025
|
-
}), k.forEach((
|
|
3026
|
-
E > 0 &&
|
|
3054
|
+
const F = (T, E, P, B, R, Y, K, xt) => U(G({ x: T, y: E, text: P, fs: 12, horz: R, vert: Y, offsetX: K, offsetY: xt }), B), O = [{ t: "rect", x: s, y: c, w: Math.max(1, a - s), h: Math.max(1, f - c), fill: "transparent" }];
|
|
3055
|
+
v.forEach((T, E) => {
|
|
3056
|
+
E > 0 && S > 0 && O.push({ t: "rect", x: s, y: Math.min(T.y, v[E - 1].y), w: a - s, h: Math.abs(T.y - v[E - 1].y), fill: T.color, fillOpacity: S, inert: !0 }), O.push({ t: "line", a: { x: s, y: T.y }, b: { x: a, y: T.y }, stroke: T.color, strokeWidth: o.width, dash: d }), o.showLeftLabels !== !1 && O.push(F(s, T.y, It(T.coeff), T.color, "right", "middle", 5, 0)), o.showRightLabels !== !1 && O.push(F(a, T.y, It(T.coeff), T.color, "left", "middle", 5, 0));
|
|
3057
|
+
}), k.forEach((T, E) => {
|
|
3058
|
+
E > 0 && C > 0 && O.push({ t: "rect", x: Math.min(T.x, k[E - 1].x), y: c, w: Math.abs(T.x - k[E - 1].x), h: f - c, fill: T.color, fillOpacity: C, inert: !0 }), O.push({ t: "line", a: { x: T.x, y: c }, b: { x: T.x, y: f }, stroke: T.color, strokeWidth: o.width, dash: d }), o.showTopLabels !== !1 && O.push(F(T.x, c, It(T.coeff), T.color, "center", "bottom", 0, 3)), o.showBottomLabels !== !1 && O.push(F(T.x, f, It(T.coeff), T.color, "center", "top", 0, 5));
|
|
3027
3059
|
});
|
|
3028
|
-
for (const [
|
|
3029
|
-
return
|
|
3060
|
+
for (const [T, E] of A) O.push({ t: "line", a: T, b: E, stroke: I.color, strokeWidth: o.width, dash: d, inert: !0 });
|
|
3061
|
+
return O.push(...me(n, h)), O;
|
|
3030
3062
|
}
|
|
3031
3063
|
function Fs(e, t, n, o, i) {
|
|
3032
3064
|
const r = Vo(e, t);
|
|
@@ -3050,10 +3082,10 @@ function Fs(e, t, n, o, i) {
|
|
|
3050
3082
|
y.push({ t: "line", a: a(u(m.coeff, b)), b: Zt(u(m.coeff, b), r.dir, o), stroke: m.color, strokeWidth: wt(m, i), dash: Mt(m, i), cap: "round" });
|
|
3051
3083
|
return y.push(...me(n, t)), y;
|
|
3052
3084
|
}
|
|
3053
|
-
const
|
|
3085
|
+
const Os = 0.06;
|
|
3054
3086
|
function je(e, t) {
|
|
3055
3087
|
const n = ge(e);
|
|
3056
|
-
return t && n.fillOpacity > 0 ? { fill: n.fill, fillOpacity: Math.min(1, n.fillOpacity +
|
|
3088
|
+
return t && n.fillOpacity > 0 ? { fill: n.fill, fillOpacity: Math.min(1, n.fillOpacity + Os) } : n;
|
|
3057
3089
|
}
|
|
3058
3090
|
function Xi(e, t, n, o) {
|
|
3059
3091
|
return e.text ? [{
|
|
@@ -3070,7 +3102,7 @@ function Xi(e, t, n, o) {
|
|
|
3070
3102
|
inert: !0
|
|
3071
3103
|
}] : [];
|
|
3072
3104
|
}
|
|
3073
|
-
function
|
|
3105
|
+
function Ds(e, t) {
|
|
3074
3106
|
if (e.length < 2) return [];
|
|
3075
3107
|
const n = [];
|
|
3076
3108
|
return t.leftEnd === 1 && n.push(...Bt(e[1], e[0], t)), t.rightEnd === 1 && n.push(...Bt(e[e.length - 2], e[e.length - 1], t)), n;
|
|
@@ -3108,7 +3140,7 @@ function _s(e, t, n, o, i, r) {
|
|
|
3108
3140
|
return x && p.push(U(x, i.textColor ?? i.color, i.bold, i.italic)), p.push(...at(n, [...mt(l, s), ...$i(l, s)], Yt.rectangle)), p;
|
|
3109
3141
|
}
|
|
3110
3142
|
function Hs(e, t, n, o) {
|
|
3111
|
-
const i = e.fmt === 2, r =
|
|
3143
|
+
const i = e.fmt === 2, r = Do(t, i), l = ge(o), s = i ? [t[0], t[1], ...r] : t;
|
|
3112
3144
|
return [
|
|
3113
3145
|
{ t: "polygon", pts: r, fill: l.fill, fillOpacity: l.fillOpacity, stroke: o.color, strokeWidth: o.width, dash: W(o), join: "round" },
|
|
3114
3146
|
...at(n, s)
|
|
@@ -3162,7 +3194,7 @@ function Gi(e, t, n, o, i, r) {
|
|
|
3162
3194
|
const s = ge(n);
|
|
3163
3195
|
l.push({ t: "path", d: yn(i) + " Z", fill: s.fill, fillOpacity: s.fillOpacity, stroke: "none" });
|
|
3164
3196
|
}
|
|
3165
|
-
if (l.push({ t: "path", d: yn(o), fill: "none", stroke: n.color, strokeWidth: n.width, dash: W(n), cap: "round" }), l.push(...
|
|
3197
|
+
if (l.push({ t: "path", d: yn(o), fill: "none", stroke: n.color, strokeWidth: n.width, dash: W(n), cap: "round" }), l.push(...Ds(i, n)), t) {
|
|
3166
3198
|
for (const [s, a] of r) l.push({ t: "line", a: s, b: a, stroke: n.color, strokeOpacity: 0.3, dash: "3 3" });
|
|
3167
3199
|
l.push({ t: "anchors", pts: e });
|
|
3168
3200
|
}
|
|
@@ -3368,8 +3400,8 @@ function rc(e, t, n, o) {
|
|
|
3368
3400
|
];
|
|
3369
3401
|
return t.length >= 4 && l.push(...oe(t, 1, 3, o.width, pt(r[1], r[2], r[3], 2), i)), t.length >= 6 && l.push(...oe(t, 3, 5, o.width, pt(r[3], r[4], r[5], 2), i)), n && l.push({ t: "anchors", pts: t }), l;
|
|
3370
3402
|
}
|
|
3371
|
-
function
|
|
3372
|
-
const i = o.fontSize / 3, r =
|
|
3403
|
+
function _t(e, t, n, o) {
|
|
3404
|
+
const i = o.fontSize / 3, r = zt(n, o.fontSize, !!o.bold, !!o.italic) + 2 * i, l = o.fontSize + 2 * i, s = t ? e.y - 5 - l : e.y + 5;
|
|
3373
3405
|
return {
|
|
3374
3406
|
t: "group",
|
|
3375
3407
|
inert: !0,
|
|
@@ -3413,10 +3445,10 @@ function lc(e, t, n) {
|
|
|
3413
3445
|
inert: !0
|
|
3414
3446
|
}), c.push(
|
|
3415
3447
|
{ t: "polyline", pts: e, fill: "none", stroke: n.color, strokeWidth: n.width, join: "round" },
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3448
|
+
_t(o, i.y > o.y, "A", s),
|
|
3449
|
+
_t(i, i.y < o.y, "B", s),
|
|
3450
|
+
_t(r, r.y < i.y, "C", s),
|
|
3451
|
+
_t(l, l.y < r.y, "D", s)
|
|
3420
3452
|
), t && c.push({ t: "anchors", pts: e }), c;
|
|
3421
3453
|
}
|
|
3422
3454
|
function po(e, t, n, o) {
|
|
@@ -3430,9 +3462,9 @@ function sc(e, t, n) {
|
|
|
3430
3462
|
return n.fillBackground !== !1 && (b.push(y(s, a, c)), u && b.push(y(u, l, s)), x && b.push(y(c, f, x))), b.push(
|
|
3431
3463
|
{ t: "line", a: u ?? d(c, s), b: x ?? d(s, c), stroke: n.color, strokeWidth: n.width, dash: W({ ...n, lineStyle: "dotted" }), inert: !0 },
|
|
3432
3464
|
{ t: "polyline", pts: e, fill: "none", stroke: n.color, strokeWidth: n.width, dash: W(n), join: "round" },
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3465
|
+
_t(l, l.y < r.y, "Left Shoulder", p),
|
|
3466
|
+
_t(a, a.y < s.y, "Head", p),
|
|
3467
|
+
_t(f, f.y < c.y, "Right Shoulder", p)
|
|
3436
3468
|
), t && b.push({ t: "anchors", pts: e }), b;
|
|
3437
3469
|
}
|
|
3438
3470
|
function cc(e, t = 5) {
|
|
@@ -3487,12 +3519,12 @@ function fc(e) {
|
|
|
3487
3519
|
return e < 92 ? 18 : Math.min(Math.max(e * 0.25, 18), 106, e * 0.9);
|
|
3488
3520
|
}
|
|
3489
3521
|
function hc(e, t, n) {
|
|
3490
|
-
const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = n.fontSize ?? 16, s = (A, F,
|
|
3522
|
+
const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = n.fontSize ?? 16, s = (A, F, O) => n.text ? [{
|
|
3491
3523
|
t: "text",
|
|
3492
3524
|
x: A,
|
|
3493
3525
|
y: F,
|
|
3494
3526
|
text: n.text,
|
|
3495
|
-
anchor:
|
|
3527
|
+
anchor: O,
|
|
3496
3528
|
size: l,
|
|
3497
3529
|
weight: n.bold !== !1 ? 700 : 400,
|
|
3498
3530
|
fontStyle: n.italic ? "italic" : "normal",
|
|
@@ -3517,14 +3549,14 @@ function hc(e, t, n) {
|
|
|
3517
3549
|
...m.map((A) => g(A, 1)),
|
|
3518
3550
|
...m.slice(0, m.length - 1).reverse().map((A) => g(A, -1))
|
|
3519
3551
|
], M = Math.min(5, Math.max(2, Math.round(0.02 * h))), v = Math.atan2(c, f);
|
|
3520
|
-
let k = o.x, S = o.y,
|
|
3521
|
-
v > -Math.PI / 4 && v < Math.PI / 4 ? S -= 8 : v > 3 * Math.PI / 4 || v < -3 * Math.PI / 4 ? S += 8 + l : v < 0 ? (k += 10,
|
|
3522
|
-
const
|
|
3552
|
+
let k = o.x, S = o.y, C = "middle";
|
|
3553
|
+
v > -Math.PI / 4 && v < Math.PI / 4 ? S -= 8 : v > 3 * Math.PI / 4 || v < -3 * Math.PI / 4 ? S += 8 + l : v < 0 ? (k += 10, C = "start", S += l * 0.35) : (k -= 10, C = "end", S += l * 0.35);
|
|
3554
|
+
const I = [
|
|
3523
3555
|
{ t: "hit", a, b: i, width: Math.max(12, 1.22 * y / 2) },
|
|
3524
3556
|
{ t: "polygon", pts: w, fill: n.color, stroke: n.color, strokeWidth: M, join: "round", cap: "round" },
|
|
3525
|
-
...s(k, S,
|
|
3557
|
+
...s(k, S, C)
|
|
3526
3558
|
];
|
|
3527
|
-
return t &&
|
|
3559
|
+
return t && I.push({ t: "anchors", pts: e }), I;
|
|
3528
3560
|
}
|
|
3529
3561
|
function uc(e, t) {
|
|
3530
3562
|
const n = t === "up" ? 1 : -1, o = n * 12, i = n * 10, r = 19.5 / 2, l = 5;
|
|
@@ -3640,31 +3672,31 @@ function vc(e, t, n, o, i) {
|
|
|
3640
3672
|
if (e.kind !== "ghost-feed") return [];
|
|
3641
3673
|
if (e.ghost && i && e.points.length >= 2) {
|
|
3642
3674
|
const v = e.ghost.amplitude, k = Math.max(0, Math.min(1, (o.variance ?? 50) / 100)), S = [];
|
|
3643
|
-
let
|
|
3675
|
+
let C = 8, I = !1;
|
|
3644
3676
|
for (let A = 0; A < e.points.length - 1; A++) {
|
|
3645
|
-
const F = i.timeToBarIndex(e.points[A].time),
|
|
3646
|
-
if (F == null ||
|
|
3647
|
-
|
|
3648
|
-
const
|
|
3649
|
-
if (E == null ||
|
|
3650
|
-
const B = Math.min(F,
|
|
3677
|
+
const F = i.timeToBarIndex(e.points[A].time), O = i.timeToBarIndex(e.points[A + 1].time);
|
|
3678
|
+
if (F == null || O == null || F === O) continue;
|
|
3679
|
+
I = !0;
|
|
3680
|
+
const T = t[A].x <= t[A + 1].x, E = i.priceToY(T ? e.points[A].price : e.points[A + 1].price), P = i.priceToY(T ? e.points[A + 1].price : e.points[A].price);
|
|
3681
|
+
if (E == null || P == null) continue;
|
|
3682
|
+
const B = Math.min(F, O), R = Math.abs(O - F) - (A === 0 ? 0 : 1), Y = R > 1 ? (P - E) / (R - 1) : 0;
|
|
3651
3683
|
for (let K = 0; K < R; K++) {
|
|
3652
3684
|
const xt = i.barIndexToTime(B + K), Vt = xt == null ? null : i.timeToX(xt);
|
|
3653
3685
|
if (Vt == null) continue;
|
|
3654
3686
|
if (K > 0) {
|
|
3655
3687
|
const ce = i.barIndexToTime(B + K - 1), ae = ce == null ? null : i.timeToX(ce);
|
|
3656
|
-
ae != null && (
|
|
3688
|
+
ae != null && (C = Math.abs(Vt - ae) || C);
|
|
3657
3689
|
}
|
|
3658
3690
|
const vt = i.yToPrice(E + K * Y);
|
|
3659
3691
|
if (vt == null) continue;
|
|
3660
|
-
const Ut = go((e.ghost.seed ^ Math.imul(A, 2654435769) ^ Math.imul(K, 2654435761)) >>> 0), le = v * (1 - 2 * Ut()) * k, dt = Math.max(1e-9, v * (1 + (0.5 - Ut()) * k)), ft = le - dt / 2,
|
|
3661
|
-
se == null || Tt == null || Le == null || Se == null || S.push({ x: Vt, openY: se, highY: Tt, lowY: Le, closeY: Se, up:
|
|
3692
|
+
const Ut = go((e.ghost.seed ^ Math.imul(A, 2654435769) ^ Math.imul(K, 2654435761)) >>> 0), le = v * (1 - 2 * Ut()) * k, dt = Math.max(1e-9, v * (1 + (0.5 - Ut()) * k)), ft = le - dt / 2, Rt = ft + Ut() * dt, Ft = ft + Ut() * dt, se = i.priceToY(vt + Rt), Tt = i.priceToY(vt + ft + dt), Le = i.priceToY(vt + ft), Se = i.priceToY(vt + Ft);
|
|
3693
|
+
se == null || Tt == null || Le == null || Se == null || S.push({ x: Vt, openY: se, highY: Tt, lowY: Le, closeY: Se, up: Ft >= Rt });
|
|
3662
3694
|
}
|
|
3663
3695
|
}
|
|
3664
|
-
if (
|
|
3665
|
-
const A = Math.floor(0.3 *
|
|
3696
|
+
if (I) {
|
|
3697
|
+
const A = Math.floor(0.3 * C), F = o.ghostCandle ?? wr, O = i.priceToY(e.points[0].price), T = i.priceToY(e.points[0].price + v), E = O != null && T != null ? Math.abs(T - O) : 10, P = [];
|
|
3666
3698
|
for (const R of S)
|
|
3667
|
-
F.drawWick &&
|
|
3699
|
+
F.drawWick && P.push({ t: "line", a: { x: R.x, y: R.highY }, b: { x: R.x, y: R.lowY }, stroke: F.wickColor, strokeWidth: 1 }), P.push({
|
|
3668
3700
|
t: "rect",
|
|
3669
3701
|
x: Math.round(R.x) - A - 0.5,
|
|
3670
3702
|
y: Math.min(R.openY, R.closeY),
|
|
@@ -3677,7 +3709,7 @@ function vc(e, t, n, o, i) {
|
|
|
3677
3709
|
const B = [
|
|
3678
3710
|
{ t: "polyline", pts: t, fill: "none", stroke: "transparent", strokeWidth: Math.max(12, E * 2) },
|
|
3679
3711
|
{ t: "polyline", pts: t, fill: "none", stroke: "#808080", strokeWidth: 1, inert: !0 },
|
|
3680
|
-
{ t: "group", inert: !0, opacity: 1 - (o.transparency ?? 50) / 100, items:
|
|
3712
|
+
{ t: "group", inert: !0, opacity: 1 - (o.transparency ?? 50) / 100, items: P }
|
|
3681
3713
|
];
|
|
3682
3714
|
return n && B.push({ t: "anchors", pts: t }), B;
|
|
3683
3715
|
}
|
|
@@ -3687,10 +3719,10 @@ function vc(e, t, n, o, i) {
|
|
|
3687
3719
|
const w = [];
|
|
3688
3720
|
for (let v = 0; v < wo; v++) {
|
|
3689
3721
|
const k = g, S = (d() - 0.5) * 2 * m;
|
|
3690
|
-
let
|
|
3691
|
-
|
|
3692
|
-
const
|
|
3693
|
-
w.push({ x: s + p * (v + 0.5), openY: k, highY:
|
|
3722
|
+
let C = k + S;
|
|
3723
|
+
C = Math.max(c + b, Math.min(f - b, C));
|
|
3724
|
+
const I = Math.min(k, C) - d() * b, A = Math.max(k, C) + d() * b;
|
|
3725
|
+
w.push({ x: s + p * (v + 0.5), openY: k, highY: I, lowY: A, closeY: C, up: C <= k }), g = C;
|
|
3694
3726
|
}
|
|
3695
3727
|
const M = [
|
|
3696
3728
|
{ t: "rect", x: s, y: c, w: h, h: u, fill: o.color, fillOpacity: 0.04, stroke: o.color, strokeWidth: o.width, dash: "4 3" },
|
|
@@ -3794,7 +3826,7 @@ function Xn(e, t, n, o, i) {
|
|
|
3794
3826
|
const r = $c(i);
|
|
3795
3827
|
return { t: "rect", x: e, y: t, w: n, h: o, fill: r > 0 ? i.backgroundColor ?? i.color : "transparent", fillOpacity: r > 0 ? r : 1 };
|
|
3796
3828
|
}
|
|
3797
|
-
const
|
|
3829
|
+
const Et = (e, t, n) => ({ t: "line", a: e, b: t, stroke: n.color, strokeWidth: n.width, cap: "round" }), Oe = (e, t, n) => ({
|
|
3798
3830
|
t: "path",
|
|
3799
3831
|
d: Ge(e, t, n.width),
|
|
3800
3832
|
fill: "none",
|
|
@@ -3815,23 +3847,23 @@ function Gn(e, t, n, o, i, r, l, s, a) {
|
|
|
3815
3847
|
}
|
|
3816
3848
|
function Bc(e, t, n, o, i, r, l) {
|
|
3817
3849
|
if (e.kind !== "price-range") return [];
|
|
3818
|
-
const [s, a] = t, c = r.extendLeft ? 0 : Math.min(s.x, a.x), f = r.extendRight ? o : Math.max(s.x, a.x), h = Math.round((s.x + a.x) / 2), u = Un(e, r, l, !0, !1), x = [
|
|
3819
|
-
Math.abs(a.y - s.y) >= 15 * r.width && x.push(
|
|
3850
|
+
const [s, a] = t, c = r.extendLeft ? 0 : Math.min(s.x, a.x), f = r.extendRight ? o : Math.max(s.x, a.x), h = Math.round((s.x + a.x) / 2), u = Un(e, r, l, !0, !1), x = [Et({ x: h, y: s.y }, { x: h, y: a.y }, r)];
|
|
3851
|
+
Math.abs(a.y - s.y) >= 15 * r.width && x.push(Oe({ x: h, y: s.y }, { x: h, y: a.y }, r));
|
|
3820
3852
|
const d = [
|
|
3821
3853
|
Xn(c, Math.min(s.y, a.y), Math.max(1, f - c), Math.abs(a.y - s.y), r),
|
|
3822
|
-
|
|
3823
|
-
|
|
3854
|
+
Et({ x: c, y: s.y }, { x: f, y: s.y }, r),
|
|
3855
|
+
Et({ x: c, y: a.y }, { x: f, y: a.y }, r)
|
|
3824
3856
|
];
|
|
3825
3857
|
return Gn(d, x, s, a, t, n, i, r, u);
|
|
3826
3858
|
}
|
|
3827
3859
|
function Ic(e, t, n, o, i, r) {
|
|
3828
3860
|
if (e.kind !== "date-range") return [];
|
|
3829
|
-
const [l, s] = t, a = i.extendTop ? 0 : Math.min(l.y, s.y), c = i.extendBottom ? o : Math.max(l.y, s.y), f = Math.round((l.y + s.y) / 2), h = Un(e, i, r, !1, !0), u = [
|
|
3830
|
-
Math.abs(s.x - l.x) >= 15 * i.width && u.push(
|
|
3861
|
+
const [l, s] = t, a = i.extendTop ? 0 : Math.min(l.y, s.y), c = i.extendBottom ? o : Math.max(l.y, s.y), f = Math.round((l.y + s.y) / 2), h = Un(e, i, r, !1, !0), u = [Et({ x: l.x, y: f }, { x: s.x, y: f }, i)];
|
|
3862
|
+
Math.abs(s.x - l.x) >= 15 * i.width && u.push(Oe({ x: l.x, y: f }, { x: s.x, y: f }, i));
|
|
3831
3863
|
const x = [
|
|
3832
3864
|
Xn(Math.min(l.x, s.x), a, Math.max(1, Math.abs(s.x - l.x)), Math.max(1, c - a), i),
|
|
3833
|
-
|
|
3834
|
-
|
|
3865
|
+
Et({ x: l.x, y: a }, { x: l.x, y: c }, i),
|
|
3866
|
+
Et({ x: s.x, y: a }, { x: s.x, y: c }, i)
|
|
3835
3867
|
];
|
|
3836
3868
|
return Gn(x, u, l, s, t, n, o, i, h);
|
|
3837
3869
|
}
|
|
@@ -3840,10 +3872,10 @@ function Pc(e, t, n, o, i, r) {
|
|
|
3840
3872
|
const [l, s] = t, a = Math.round((l.y + s.y) / 2), c = Math.round((l.x + s.x) / 2), f = Un(e, i, r, !0, !0), h = i.drawBorder ? i.borderWidth ?? 1 : 0, u = h / 2, x = l.x + Math.sign(s.x - l.x) * u, d = s.x + Math.sign(l.x - s.x) * u, p = l.y + Math.sign(s.y - l.y) * u, y = s.y + Math.sign(l.y - s.y) * u, b = [Xn(Math.min(l.x, s.x), Math.min(l.y, s.y), Math.max(1, Math.abs(s.x - l.x)), Math.max(1, Math.abs(s.y - l.y)), i)];
|
|
3841
3873
|
h > 0 && b.push({ t: "rect", x: Math.min(l.x, s.x), y: Math.min(l.y, s.y), w: Math.abs(s.x - l.x), h: Math.abs(s.y - l.y), fill: "none", stroke: i.borderColor ?? i.color, strokeWidth: h });
|
|
3842
3874
|
const m = [
|
|
3843
|
-
|
|
3844
|
-
|
|
3875
|
+
Et({ x, y: a }, { x: d, y: a }, i),
|
|
3876
|
+
Et({ x: c, y: p }, { x: c, y }, i)
|
|
3845
3877
|
];
|
|
3846
|
-
return Math.abs(s.x - l.x) >= 25 * i.width && m.push(
|
|
3878
|
+
return Math.abs(s.x - l.x) >= 25 * i.width && m.push(Oe({ x, y: a }, { x: d, y: a }, i)), Math.abs(s.y - l.y) >= 25 * i.width && m.push(Oe({ x: c, y: p }, { x: c, y }, i)), Gn(b, m, l, s, t, n, o, i, f);
|
|
3847
3879
|
}
|
|
3848
3880
|
function Ec(e, t, n, o, i, r) {
|
|
3849
3881
|
const l = i.regressionLines ?? Fo, s = jo(e, r, o);
|
|
@@ -3905,17 +3937,17 @@ function Ki(e, t, n) {
|
|
|
3905
3937
|
if (o.visible) {
|
|
3906
3938
|
const p = o.volume === "delta" ? a.maxDelta : a.maxTotal, y = 11;
|
|
3907
3939
|
a.rows.forEach((b, m) => {
|
|
3908
|
-
const g = u(m), w = m >= a.vaFrom && m <= a.vaTo, M = w ? o.vaUpColor : o.upColor, v = w ? o.vaDownColor : o.downColor, k = Math.max(1, g.h - 1), S = (A) => p > 0 ? A / p * f : 0,
|
|
3909
|
-
let
|
|
3910
|
-
for (const A of
|
|
3911
|
-
const F = h ? r -
|
|
3912
|
-
x.push({ t: "rect", x: F, y: g.y, w: A.w, h: k, fill: A.color }),
|
|
3940
|
+
const g = u(m), w = m >= a.vaFrom && m <= a.vaTo, M = w ? o.vaUpColor : o.upColor, v = w ? o.vaDownColor : o.downColor, k = Math.max(1, g.h - 1), S = (A) => p > 0 ? A / p * f : 0, C = o.volume === "total" ? [{ w: S(b.up + b.down), color: M }] : o.volume === "delta" ? [{ w: S(Math.abs(b.up - b.down)), color: b.up >= b.down ? M : v }] : [{ w: S(b.up), color: M }, { w: S(b.down), color: v }];
|
|
3941
|
+
let I = 0;
|
|
3942
|
+
for (const A of C) {
|
|
3943
|
+
const F = h ? r - I - A.w : i + I;
|
|
3944
|
+
x.push({ t: "rect", x: F, y: g.y, w: A.w, h: k, fill: A.color }), I += A.w;
|
|
3913
3945
|
}
|
|
3914
3946
|
if (o.showValues && g.h >= y - 2) {
|
|
3915
3947
|
const A = o.volume === "delta" ? b.up - b.down : b.up + b.down;
|
|
3916
3948
|
x.push({
|
|
3917
3949
|
t: "text",
|
|
3918
|
-
x: h ? r -
|
|
3950
|
+
x: h ? r - I - 4 : i + I + 4,
|
|
3919
3951
|
y: g.y + g.h / 2,
|
|
3920
3952
|
text: Wc(A),
|
|
3921
3953
|
size: y,
|
|
@@ -3956,7 +3988,7 @@ function Fc(e, t, n, o) {
|
|
|
3956
3988
|
return n && r.push({ t: "anchors", pts: [t[0]] }), r;
|
|
3957
3989
|
}
|
|
3958
3990
|
const vo = /* @__PURE__ */ new Map();
|
|
3959
|
-
function
|
|
3991
|
+
function Oc(e, t) {
|
|
3960
3992
|
let n = vo.get(t);
|
|
3961
3993
|
n || (n = new Intl.DateTimeFormat("en-US", {
|
|
3962
3994
|
timeZone: t,
|
|
@@ -3976,8 +4008,8 @@ function Dc(e, t) {
|
|
|
3976
4008
|
return { y: Number(i("year")), m: Number(i("month")), d: Number(i("day")), wd: i("weekday"), hh: i("hour"), mi: i("minute"), ss: i("second") };
|
|
3977
4009
|
}
|
|
3978
4010
|
const Qe = (e, t) => String(e).padStart(t, "0");
|
|
3979
|
-
function
|
|
3980
|
-
const n =
|
|
4011
|
+
function Dc(e, t) {
|
|
4012
|
+
const n = Oc(e, t);
|
|
3981
4013
|
return { date: `${Qe(n.y, 4)}-${Qe(n.m, 2)}-${Qe(n.d, 2)}`, time: `${n.hh}:${n.mi}` };
|
|
3982
4014
|
}
|
|
3983
4015
|
const Be = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAAZ0lEQVR4Xl2OsQmAMBRErwgSsHAJV3GHgEVKl3ADixSClViKYPkHfEI+Wsg1j8dxnCQCiQ1jJRFcFIybHsNYCCJXvCSsJonzp/YXbiKzs7d8pavyEBP2yQEji5YV+1KIkmjI/ouRID31wXKLSuZPUAAAAABJRU5ErkJggg==", w: 9, h: 9 }, _c = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAQAAADI+WwIAAAAb0lEQVQIHWXAMQpBAQAG4L9eKQdQSr3JpFzC5CoOoJzBSUzK+iallNWkrG99pUymDxHw5Z+RdX4ZOpnmm57aXiuWunnScXAxTGLhqMyNth1muVNq1AYKK2wVeTBGo8JZP2/mgEk+KWxQ5ZfSUS8vV97kThm/FD/aAAAAAElFTkSuQmCC", w: 11, h: 10 }, Hc = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAARElEQVR4AWMgHvy/9//5f34gzQZiQYSeAyEPkOYE0iAhMJOTAc4ixXjR/13/r/7////h/zn/pSFCT/43/lcHS6X9fwgANMArS3ikrioAAAAASUVORK5CYII=", w: 9, h: 9 };
|
|
@@ -4004,12 +4036,12 @@ function Je(e, t, n, o, i, r, l, s) {
|
|
|
4004
4036
|
function ko(e, t, n, o, i, r) {
|
|
4005
4037
|
const l = In(e, t, r);
|
|
4006
4038
|
if (!l) return [];
|
|
4007
|
-
const [s, a] = t, c = e.points[0].price, f = Math.min(s.x, a.x), h = Math.max(s.x, a.x), u = Math.max(8, h - f), x = (f + h) / 2, d = ct(i.stopColor ?? "#f23645").hex, p = ct(i.targetColor ?? "#089981").hex, y = i.stopTransparency ?? 80, b = i.targetTransparency ?? 80, m = Lt(p, 100 - b), g = Lt(d, 100 - y), { yStop: w, yTarget: M, stop: v, profit: k } = l, S = i.accountSize ?? 1e3, { qty:
|
|
4039
|
+
const [s, a] = t, c = e.points[0].price, f = Math.min(s.x, a.x), h = Math.max(s.x, a.x), u = Math.max(8, h - f), x = (f + h) / 2, d = ct(i.stopColor ?? "#f23645").hex, p = ct(i.targetColor ?? "#089981").hex, y = i.stopTransparency ?? 80, b = i.targetTransparency ?? 80, m = Lt(p, 100 - b), g = Lt(d, 100 - y), { yStop: w, yTarget: M, stop: v, profit: k } = l, S = i.accountSize ?? 1e3, { qty: C, shown: I } = $r(i, c, v), A = (fe) => parseFloat(fe.toFixed(2)), F = A(S + k * C), O = A(S - v * C), T = v > 0 ? Math.round(100 * k / v) / 100 : 0, E = o === "long" ? 1 : -1, P = Br(e, o, c - E * v, c + E * k, r), B = P ? (P.closePrice - c) * E : null, R = (r == null ? void 0 : r.pipSize()) ?? 0.01, Y = Math.max(0, Math.min(8, Math.round(-Math.log10(R)))), K = Jn(i, "tp", k, c, R, Y, F, k * C), xt = Jn(i, "sl", v, c, R, Y, O, -v * C), Vt = Cr(i, B != null ? bt(B, Y) : null, !!(P != null && P.closed), I, T), vt = Vt ? Vt.split(`
|
|
4008
4040
|
`) : [], Ut = B != null && B < 0 ? d : B != null && B > 0 ? p : i.color, le = (fe) => {
|
|
4009
4041
|
var Zn;
|
|
4010
4042
|
const qn = (Zn = ((r == null ? void 0 : r.bars()) ?? [])[fe]) == null ? void 0 : Zn.time;
|
|
4011
4043
|
return qn != null && r ? r.timeToX(qn) : null;
|
|
4012
|
-
}, dt =
|
|
4044
|
+
}, dt = P && r ? r.priceToY(P.closePrice) : null, ft = (P == null ? void 0 : P.entryIndex) != null ? le(P.entryIndex) : a.x, Rt = (P == null ? void 0 : P.closeIndex) != null ? le(P.closeIndex) : a.x, Ft = ft != null && Rt != null && dt != null && ft !== Rt ? { x: Math.min(ft, Rt), y: Math.min(s.y, dt), w: Math.abs(Rt - ft), h: Math.abs(dt - s.y) } : null, se = P ? le(P.closed ? P.closeIndex : P.barIndex) : null, Tt = (P == null ? void 0 : P.entryIndex) != null && ft != null && se != null && dt != null ? { from: { x: ft, y: s.y }, to: { x: se, y: dt } } : null, Le = n || !!i.showStats, Se = Math.max(
|
|
4013
4045
|
0,
|
|
4014
4046
|
st(K, i.fontSize ?? 12),
|
|
4015
4047
|
st(xt, i.fontSize ?? 12),
|
|
@@ -4021,7 +4053,7 @@ function ko(e, t, n, o, i, r) {
|
|
|
4021
4053
|
// 1 − (transparency / 100)^3 (TV)
|
|
4022
4054
|
{ t: "rect", x: f, y: Math.min(s.y, w), w: u, h: Math.abs(w - s.y), fill: g }
|
|
4023
4055
|
];
|
|
4024
|
-
return
|
|
4056
|
+
return Ft && B != null && B < 0 && yt.push({ t: "rect", ...Ft, fill: d, fillOpacity: 1 - (y / 100) ** 3 }), yt.push({ t: "rect", x: f, y: Math.min(s.y, M), w: u, h: Math.abs(M - s.y), fill: m }), Ft && B != null && B > 0 && yt.push({ t: "rect", ...Ft, fill: p, fillOpacity: 1 - (b / 100) ** 3 }), Tt && yt.push(
|
|
4025
4057
|
{ t: "line", a: Tt.from, b: Tt.to, stroke: i.color, strokeWidth: 1, dash: "6 4", inert: !0 },
|
|
4026
4058
|
{ t: "path", d: Ge(Tt.from, Tt.to, 1), fill: "none", stroke: i.color, strokeWidth: 1, inert: !0 }
|
|
4027
4059
|
), yt.push(
|
|
@@ -4034,7 +4066,7 @@ const Nc = "#202020", Lo = Be.w;
|
|
|
4034
4066
|
function So(e, t, n) {
|
|
4035
4067
|
const o = N(e);
|
|
4036
4068
|
if (o == null) return "";
|
|
4037
|
-
const i = (n == null ? void 0 : n.timeInfo()) ?? { timeZone: "UTC", intraday: !0 }, { date: r, time: l } =
|
|
4069
|
+
const i = (n == null ? void 0 : n.timeInfo()) ?? { timeZone: "UTC", intraday: !0 }, { date: r, time: l } = Dc(o, i.timeZone);
|
|
4038
4070
|
return i.intraday ? `${r}${t}${l}` : r;
|
|
4039
4071
|
}
|
|
4040
4072
|
function Co(e) {
|
|
@@ -4068,7 +4100,7 @@ function Co(e) {
|
|
|
4068
4100
|
}
|
|
4069
4101
|
function Yc(e, t, n, o, i, r) {
|
|
4070
4102
|
if (e.kind !== "position-forecast") return [];
|
|
4071
|
-
const [l, s] = t, a = s.y <= l.y, c = Qo(l, s), f = c[c.length - 2] ?? l, h = Math.hypot(s.x - f.x, s.y - f.y) || 1, u = (s.x - f.x) / h, x = (s.y - f.y) / h, d = Math.max(8, 4 * i.width), p = s.x - u * d, y = s.y - x * d, b = [s, { x: p - x * (d / 2), y: y + u * (d / 2) }, { x: p + x * (d / 2), y: y - u * (d / 2) }], m = e.points[1].price - e.points[0].price, g = e.points[0].price !== 0 ? m / Math.abs(e.points[0].price) * 100 : 0, w = N(e.points[0].time), M = N(e.points[1].time), v = w != null && M != null ? Fn(M - w) : "", k = (r == null ? void 0 : r.pipSize()) ?? 0.01, S = Math.max(0, Math.min(8, Math.round(-Math.log10(k)))),
|
|
4103
|
+
const [l, s] = t, a = s.y <= l.y, c = Qo(l, s), f = c[c.length - 2] ?? l, h = Math.hypot(s.x - f.x, s.y - f.y) || 1, u = (s.x - f.x) / h, x = (s.y - f.y) / h, d = Math.max(8, 4 * i.width), p = s.x - u * d, y = s.y - x * d, b = [s, { x: p - x * (d / 2), y: y + u * (d / 2) }, { x: p + x * (d / 2), y: y - u * (d / 2) }], m = e.points[1].price - e.points[0].price, g = e.points[0].price !== 0 ? m / Math.abs(e.points[0].price) * 100 : 0, w = N(e.points[0].time), M = N(e.points[1].time), v = w != null && M != null ? Fn(M - w) : "", k = (r == null ? void 0 : r.pipSize()) ?? 0.01, S = Math.max(0, Math.min(8, Math.round(-Math.log10(k)))), C = Or(e, r), I = Math.max(0, Math.min(1, (100 - (i.transparency ?? 10)) / 100)), A = [
|
|
4072
4104
|
{ t: "polyline", pts: c, fill: "none", stroke: "transparent", strokeWidth: 12 },
|
|
4073
4105
|
{ t: "polyline", pts: c, fill: "none", stroke: i.color, strokeWidth: i.width, join: "round" },
|
|
4074
4106
|
{ t: "polygon", pts: b, fill: i.color, stroke: i.color, strokeWidth: 1, join: "round" },
|
|
@@ -4086,7 +4118,7 @@ function Yc(e, t, n, o, i, r) {
|
|
|
4086
4118
|
bg: i.sourceBackColor ?? "#2962FF",
|
|
4087
4119
|
stroke: i.sourceStrokeColor ?? "#2962FF",
|
|
4088
4120
|
fg: i.sourceTextColor ?? "#ffffff",
|
|
4089
|
-
opacity:
|
|
4121
|
+
opacity: I
|
|
4090
4122
|
}),
|
|
4091
4123
|
Co({
|
|
4092
4124
|
cx: s.x,
|
|
@@ -4101,12 +4133,12 @@ function Yc(e, t, n, o, i, r) {
|
|
|
4101
4133
|
bg: i.targetBackColor ?? "#2962FF",
|
|
4102
4134
|
stroke: i.targetStrokeColor ?? "#2962FF",
|
|
4103
4135
|
fg: i.targetTextColor ?? "#ffffff",
|
|
4104
|
-
opacity:
|
|
4105
|
-
banner:
|
|
4106
|
-
text:
|
|
4107
|
-
icon:
|
|
4108
|
-
bg:
|
|
4109
|
-
fg:
|
|
4136
|
+
opacity: I,
|
|
4137
|
+
banner: C === "waiting" ? void 0 : {
|
|
4138
|
+
text: C === "success" ? "SUCCESS" : "FAILURE",
|
|
4139
|
+
icon: C === "success" ? _c : Hc,
|
|
4140
|
+
bg: C === "success" ? i.successBackground ?? "#4caf50" : i.failureBackground ?? "#F23645",
|
|
4141
|
+
fg: C === "success" ? i.successTextColor ?? "#ffffff" : i.failureTextColor ?? "#ffffff",
|
|
4110
4142
|
above: a
|
|
4111
4143
|
}
|
|
4112
4144
|
})
|
|
@@ -4208,15 +4240,15 @@ function jc(e, t, n, o) {
|
|
|
4208
4240
|
function qc(e, t, n, o, i) {
|
|
4209
4241
|
const r = n ? Wn(e, t, n, o) : null;
|
|
4210
4242
|
if (!r) return [];
|
|
4211
|
-
const l = [{ t: "line", a: { x: r.x, y: r.poleStart }, b: { x: r.x, y: r.poleEnd }, stroke:
|
|
4212
|
-
r.gap && l.push({ t: "line", a: { x: r.x, y: r.gap[0] }, b: { x: r.x, y: r.gap[1] }, stroke:
|
|
4213
|
-
{ t: "circle", cx: r.x, cy: r.plateY, r: 35, fill: e.style.plateColor ?? "#2962ff", stroke:
|
|
4243
|
+
const l = [{ t: "line", a: { x: r.x, y: r.poleStart }, b: { x: r.x, y: r.poleEnd }, stroke: Ot.pole, strokeWidth: 1 }];
|
|
4244
|
+
r.gap && l.push({ t: "line", a: { x: r.x, y: r.gap[0] }, b: { x: r.x, y: r.gap[1] }, stroke: Ot.pole, strokeWidth: 1 }), e.style.showImage && l.push(
|
|
4245
|
+
{ t: "circle", cx: r.x, cy: r.plateY, r: 35, fill: e.style.plateColor ?? "#2962ff", stroke: Ot.plateBorder, strokeWidth: 1, shadow: Vc },
|
|
4214
4246
|
{ t: "text", x: r.x, y: r.plateY, text: e.glyph || "🙂", anchor: "middle", baseline: "central", size: 32, inert: !0 }
|
|
4215
4247
|
);
|
|
4216
4248
|
const s = r.l.box;
|
|
4217
4249
|
return l.push(
|
|
4218
|
-
{ t: "rect", x: s.left, y: s.top, w: s.width, h: s.height, rx: 4, fill:
|
|
4219
|
-
U(r.l, gt(e).faint ? ke(
|
|
4250
|
+
{ t: "rect", x: s.left, y: s.top, w: s.width, h: s.height, rx: 4, fill: Ot.labelBg, stroke: Ot.labelBorder, strokeWidth: 1 },
|
|
4251
|
+
U(r.l, gt(e).faint ? ke(Ot.labelText) : Ot.labelText, e.style.bold, e.style.italic)
|
|
4220
4252
|
), i && l.push({ t: "anchors", pts: [r.anchor], squares: Yt.single }), l;
|
|
4221
4253
|
}
|
|
4222
4254
|
function Zc(e, t, n, o, i) {
|
|
@@ -4271,7 +4303,7 @@ function Qc(e, t, n, o) {
|
|
|
4271
4303
|
[y + w, g - M, b - y - w, M],
|
|
4272
4304
|
[y + w, m + w, M, g - m - w],
|
|
4273
4305
|
[b - M, m + w, M, g - m - w]
|
|
4274
|
-
].map(([k, S,
|
|
4306
|
+
].map(([k, S, C, I]) => `M${k} ${S}h${C}v${I}h${-C}Z`).join("");
|
|
4275
4307
|
}
|
|
4276
4308
|
let f = "";
|
|
4277
4309
|
o != null && o.edge && (o.edge.col != null && i.xs[o.edge.col + 1] != null && (f += `M${i.xs[o.edge.col + 1] - 3} ${i.top}h7v${i.bottom - i.top}h-7Z`), o.edge.row != null && i.ys[o.edge.row + 1] != null && (f += `M${i.left} ${i.ys[o.edge.row + 1] - 3}h${i.right - i.left}v7h${-(i.right - i.left)}Z`));
|
|
@@ -4280,11 +4312,11 @@ function Qc(e, t, n, o) {
|
|
|
4280
4312
|
d.forEach((y, b) => {
|
|
4281
4313
|
var k;
|
|
4282
4314
|
const m = o != null && o.editing && o.cell && o.cell[0] === p && o.cell[1] === b ? [] : ((k = i.lines[p]) == null ? void 0 : k[b]) ?? [], g = i.xs[b], w = i.xs[b + 1], M = h === "right" ? w - ht - Ht : h === "center" ? g + (w - g) / 2 : g + ht + Ht, v = i.ys[p] + ht + Ht + i.fs / 2 + 0.05 * i.fs;
|
|
4283
|
-
m.forEach((S,
|
|
4315
|
+
m.forEach((S, C) => {
|
|
4284
4316
|
u.push({
|
|
4285
4317
|
t: "text",
|
|
4286
4318
|
x: M,
|
|
4287
|
-
y: v +
|
|
4319
|
+
y: v + C * i.fs * si,
|
|
4288
4320
|
text: S,
|
|
4289
4321
|
anchor: h === "right" ? "end" : h === "center" ? "middle" : "start",
|
|
4290
4322
|
baseline: "central",
|
|
@@ -4589,7 +4621,7 @@ function bn(e, t, n, o, i, r) {
|
|
|
4589
4621
|
return { ...t, anchored: { x: (n[0].x + o) / r.w, y: (n[0].y + i) / r.h } };
|
|
4590
4622
|
const l = [];
|
|
4591
4623
|
for (const s of n) {
|
|
4592
|
-
const a =
|
|
4624
|
+
const a = D(e, { x: s.x + o, y: s.y + i });
|
|
4593
4625
|
if (!a) return null;
|
|
4594
4626
|
l.push(a);
|
|
4595
4627
|
}
|
|
@@ -4608,7 +4640,7 @@ function tr(e, t) {
|
|
|
4608
4640
|
}
|
|
4609
4641
|
return n;
|
|
4610
4642
|
}
|
|
4611
|
-
function
|
|
4643
|
+
function D(e, t) {
|
|
4612
4644
|
const n = e.xToTime(t.x), o = e.yToPrice(t.y);
|
|
4613
4645
|
return n == null || o == null ? null : { time: n, price: o };
|
|
4614
4646
|
}
|
|
@@ -4896,7 +4928,7 @@ function fa(e, t) {
|
|
|
4896
4928
|
if (!n || !o) return e;
|
|
4897
4929
|
const i = J(t, n), r = J(t, o);
|
|
4898
4930
|
if (!i || !r) return e;
|
|
4899
|
-
const l = r.x - i.x, s = r.y - i.y, a = Math.hypot(l, s) || 1, c = -s / a * a * 0.15, f = l / a * a * 0.15, h = (u) =>
|
|
4931
|
+
const l = r.x - i.x, s = r.y - i.y, a = Math.hypot(l, s) || 1, c = -s / a * a * 0.15, f = l / a * a * 0.15, h = (u) => D(t, { x: i.x + l * u + c, y: i.y + s * u + f });
|
|
4900
4932
|
if (e.kind === "curve") {
|
|
4901
4933
|
const u = h(0.5);
|
|
4902
4934
|
return u ? { ...e, points: [e.points[0], u, e.points[2]] } : e;
|
|
@@ -4947,7 +4979,7 @@ function Ie(e, t) {
|
|
|
4947
4979
|
const n = e.barIndexToTime(t), o = n == null ? null : e.timeToX(n);
|
|
4948
4980
|
return n == null || o == null ? null : { i: t, time: n, x: o };
|
|
4949
4981
|
}
|
|
4950
|
-
function
|
|
4982
|
+
function De(e, t) {
|
|
4951
4983
|
const n = e.xToTime(t), o = n == null ? null : e.timeToBarIndex(n);
|
|
4952
4984
|
return o == null ? null : Ie(e, o);
|
|
4953
4985
|
}
|
|
@@ -4960,7 +4992,7 @@ function ee(e, t, n) {
|
|
|
4960
4992
|
const f = Math.hypot(s, a), h = s < 0 ? -1 : 1, u = a < 0 ? -1 : 1;
|
|
4961
4993
|
let x = Math.max(Math.abs(a), Math.abs(s));
|
|
4962
4994
|
x /= x * Math.SQRT2 / f;
|
|
4963
|
-
const d =
|
|
4995
|
+
const d = De(e, o + x * h);
|
|
4964
4996
|
if (!d) return t;
|
|
4965
4997
|
const p = e.yToPrice(r + Math.abs(d.x - o) * u);
|
|
4966
4998
|
return p == null ? t : { time: d.time, price: p };
|
|
@@ -4968,7 +5000,7 @@ function ee(e, t, n) {
|
|
|
4968
5000
|
function ir(e, t, n) {
|
|
4969
5001
|
const o = J(e, t), i = J(e, n);
|
|
4970
5002
|
if (!o || !i) return t;
|
|
4971
|
-
const r = o.x - i.x, l = o.y - i.y, s = Math.max(Math.abs(r), Math.abs(l)), a =
|
|
5003
|
+
const r = o.x - i.x, l = o.y - i.y, s = Math.max(Math.abs(r), Math.abs(l)), a = De(e, i.x + s * (r < 0 ? -1 : 1));
|
|
4972
5004
|
if (!a) return t;
|
|
4973
5005
|
const c = e.yToPrice(i.y + Math.abs(a.x - i.x) * (l < 0 ? -1 : 1));
|
|
4974
5006
|
return c == null ? t : { time: a.time, price: c };
|
|
@@ -5007,7 +5039,7 @@ function rr(e, t, n) {
|
|
|
5007
5039
|
}
|
|
5008
5040
|
function lr(e, t, n, o) {
|
|
5009
5041
|
const i = Math.atan2(n.y - t.y, n.x - t.x) + Math.PI / 2, r = o ?? Math.hypot(n.x - t.x, n.y - t.y) / 2;
|
|
5010
|
-
return
|
|
5042
|
+
return D(e, { x: (t.x + n.x) / 2 + Math.cos(i) * r, y: (t.y + n.y) / 2 + Math.sin(i) * r });
|
|
5011
5043
|
}
|
|
5012
5044
|
function $o(e, t, n, o) {
|
|
5013
5045
|
const i = t.length;
|
|
@@ -5032,7 +5064,7 @@ function Bo(e, t, n) {
|
|
|
5032
5064
|
function xa(e, t, n) {
|
|
5033
5065
|
const o = e.start;
|
|
5034
5066
|
if (e.mode.hit !== "handle") return { cursor: t };
|
|
5035
|
-
const i = e.mode.handleIndex, r = o.points, l = e.startScreen, s = (f) =>
|
|
5067
|
+
const i = e.mode.handleIndex, r = o.points, l = e.startScreen, s = (f) => D(n, f), a = (f, h = ee) => {
|
|
5036
5068
|
const u = s(t);
|
|
5037
5069
|
return f ? { cursor: u ? Bo(n, h(n, u, f), t) : t } : { cursor: t };
|
|
5038
5070
|
}, c = (f, h) => {
|
|
@@ -5088,7 +5120,7 @@ function sr(e, t, n, o, i = (r) => r) {
|
|
|
5088
5120
|
if (r.kind !== "ellipse" || e.mode.hit !== "handle") return null;
|
|
5089
5121
|
const l = e.mode.handleIndex, [s, a, c] = e.startScreen;
|
|
5090
5122
|
if (!s || !a || !c || l > 1) return null;
|
|
5091
|
-
const f =
|
|
5123
|
+
const f = D(n, t);
|
|
5092
5124
|
if (!f) return null;
|
|
5093
5125
|
const h = r.points[l === 0 ? 1 : 0], u = o ? ee(n, f, h) : i(f), x = [...r.points];
|
|
5094
5126
|
x[l] = u;
|
|
@@ -5097,9 +5129,9 @@ function sr(e, t, n, o, i = (r) => r) {
|
|
|
5097
5129
|
const y = a.x - s.x, b = a.y - s.y, m = Math.hypot(y, b) || 1, g = Math.abs(((c.x - s.x) * b - (c.y - s.y) * y) / m), w = lr(n, d, p, o ? void 0 : g);
|
|
5098
5130
|
if (!w) return null;
|
|
5099
5131
|
if (x[2] = w, o && n.timeToBarIndex(x[0].time) === n.timeToBarIndex(x[1].time)) {
|
|
5100
|
-
const M = x[l], v = x[l === 0 ? 1 : 0], k = J(n, M), S = J(n, v),
|
|
5101
|
-
if (k && S &&
|
|
5102
|
-
const A = 2 * Math.abs(
|
|
5132
|
+
const M = x[l], v = x[l === 0 ? 1 : 0], k = J(n, M), S = J(n, v), C = n.timeToX(M.time), I = n.timeToX(w.time);
|
|
5133
|
+
if (k && S && C != null && I != null) {
|
|
5134
|
+
const A = 2 * Math.abs(C - I) * (v.price > M.price ? 1 : -1), F = n.yToPrice(S.y + A);
|
|
5103
5135
|
F != null && (x[l] = { time: M.time, price: F });
|
|
5104
5136
|
}
|
|
5105
5137
|
}
|
|
@@ -5108,7 +5140,7 @@ function sr(e, t, n, o, i = (r) => r) {
|
|
|
5108
5140
|
function da(e, t, n) {
|
|
5109
5141
|
const o = e.start;
|
|
5110
5142
|
if (e.mode.hit !== "handle") return null;
|
|
5111
|
-
const i = e.mode.handleIndex, [r, l] = o.points, s = n.timeToBarIndex(r.time), a = n.timeToBarIndex(l.time), c =
|
|
5143
|
+
const i = e.mode.handleIndex, [r, l] = o.points, s = n.timeToBarIndex(r.time), a = n.timeToBarIndex(l.time), c = D(n, t);
|
|
5112
5144
|
if (!c || s == null || a == null || s === a) return null;
|
|
5113
5145
|
const f = Math.abs(l.price - r.price) / Math.abs(a - s), h = i === 0 ? l : r, u = n.timeToBarIndex(c.time), x = n.timeToBarIndex(h.time);
|
|
5114
5146
|
if (u == null || x == null) return null;
|
|
@@ -5125,7 +5157,7 @@ function ya(e, t, n) {
|
|
|
5125
5157
|
const x = f === 5 ? t.x - a : l - t.x;
|
|
5126
5158
|
f === 5 ? a += x : l -= x, s -= x / 2, c += x / 2;
|
|
5127
5159
|
} else {
|
|
5128
|
-
const x = f === 4 ? s - t.y : t.y - c, d =
|
|
5160
|
+
const x = f === 4 ? s - t.y : t.y - c, d = De(n, l), p = De(n, a);
|
|
5129
5161
|
if (!d || !p) return null;
|
|
5130
5162
|
const y = Ie(n, p.i + 1), b = y ? y.x - p.x : 0;
|
|
5131
5163
|
if (b <= 0) return null;
|
|
@@ -5134,7 +5166,7 @@ function ya(e, t, n) {
|
|
|
5134
5166
|
const M = w.x - p.x;
|
|
5135
5167
|
l = g.x, a = w.x, f === 4 ? s -= M : c += M;
|
|
5136
5168
|
}
|
|
5137
|
-
const h =
|
|
5169
|
+
const h = D(n, { x: l, y: s }), u = D(n, { x: a, y: c });
|
|
5138
5170
|
return !h || !u ? null : V(o, [h, u]);
|
|
5139
5171
|
}
|
|
5140
5172
|
function pa(e, t, n, o) {
|
|
@@ -5142,7 +5174,7 @@ function pa(e, t, n, o) {
|
|
|
5142
5174
|
if (i.kind !== "long-position" && i.kind !== "short-position" || e.mode.hit !== "handle") return null;
|
|
5143
5175
|
const r = e.mode.handleIndex, [l, s] = i.points, a = n.pipSize(), c = i.kind === "long-position" ? 1 : -1, { stop: f, profit: h } = _o(i, a);
|
|
5144
5176
|
if (r === 0) {
|
|
5145
|
-
const x =
|
|
5177
|
+
const x = D(n, t);
|
|
5146
5178
|
if (!x) return null;
|
|
5147
5179
|
const d = o(x);
|
|
5148
5180
|
return V(i, [d, { time: s.time, price: d.price }]);
|
|
@@ -5168,7 +5200,7 @@ function ba(e, t, n) {
|
|
|
5168
5200
|
if (o.kind !== "parallel-channel" || e.mode.hit !== "handle") return null;
|
|
5169
5201
|
const [i, r, l] = e.startScreen;
|
|
5170
5202
|
if (!i || !r || !l) return null;
|
|
5171
|
-
const s = e.mode.handleIndex, a = t.x - e.startCursor.x, c = t.y - e.startCursor.y, f = (u) =>
|
|
5203
|
+
const s = e.mode.handleIndex, a = t.x - e.startCursor.x, c = t.y - e.startCursor.y, f = (u) => D(n, u), h = o.points;
|
|
5172
5204
|
if (s === 0 || s === 2) {
|
|
5173
5205
|
const u = f({ x: i.x + a, y: i.y + c }), x = f({ x: l.x + a, y: l.y + c });
|
|
5174
5206
|
return !u || !x ? null : V(o, [u, h[1], x]);
|
|
@@ -5192,7 +5224,7 @@ function ma(e, t, n, o) {
|
|
|
5192
5224
|
if (i.kind !== "disjoint-channel" || e.mode.hit !== "handle") return null;
|
|
5193
5225
|
const r = e.mode.handleIndex, l = i.points;
|
|
5194
5226
|
if (r === 0 || r === 1) {
|
|
5195
|
-
const a =
|
|
5227
|
+
const a = D(n, t);
|
|
5196
5228
|
if (!a) return null;
|
|
5197
5229
|
const c = l.slice();
|
|
5198
5230
|
return c[r] = o(a), V(i, c);
|
|
@@ -5210,7 +5242,7 @@ function ma(e, t, n, o) {
|
|
|
5210
5242
|
function ga(e, t, n, o) {
|
|
5211
5243
|
const i = e.start;
|
|
5212
5244
|
if (i.kind !== "rotated-rectangle" || e.mode.hit !== "handle") return null;
|
|
5213
|
-
const r = e.mode.handleIndex, l =
|
|
5245
|
+
const r = e.mode.handleIndex, l = D(n, t);
|
|
5214
5246
|
if (!l) return null;
|
|
5215
5247
|
const s = i.points.slice();
|
|
5216
5248
|
if (r >= 2)
|
|
@@ -5219,7 +5251,7 @@ function ga(e, t, n, o) {
|
|
|
5219
5251
|
s[r] = p;
|
|
5220
5252
|
const y = r === 0 ? J(n, p) : a, b = r === 1 ? J(n, p) : c;
|
|
5221
5253
|
if (!y || !b) return null;
|
|
5222
|
-
const m = Math.hypot(b.x - y.x, b.y - y.y) || 1, g =
|
|
5254
|
+
const m = Math.hypot(b.x - y.x, b.y - y.y) || 1, g = D(n, { x: y.x + (b.y - y.y) / m * d, y: y.y - (b.x - y.x) / m * d });
|
|
5223
5255
|
return g ? (s[2] = g, V(i, s)) : null;
|
|
5224
5256
|
}
|
|
5225
5257
|
function wa(e, t, n, o, i = !1) {
|
|
@@ -5257,7 +5289,7 @@ function wa(e, t, n, o, i = !1) {
|
|
|
5257
5289
|
// edge kept; the balloon centre follows.
|
|
5258
5290
|
case "callout": {
|
|
5259
5291
|
if (e.mode.handleIndex !== 1) break;
|
|
5260
|
-
const u = e.start.style, x = u.wordWrapWidth ?? 200, d = e.startScreen[1].x - x / 2 - 10, p = Math.max(100, t.x - d - 10), y =
|
|
5292
|
+
const u = e.start.style, x = u.wordWrapWidth ?? 200, d = e.startScreen[1].x - x / 2 - 10, p = Math.max(100, t.x - d - 10), y = D(n, { x: d + p / 2 + 10, y: e.startScreen[1].y });
|
|
5261
5293
|
return y ? { ...V(e.start, [e.start.points[0], y]), style: { ...u, wordWrapWidth: p } } : null;
|
|
5262
5294
|
}
|
|
5263
5295
|
case "image":
|
|
@@ -5273,7 +5305,7 @@ function wa(e, t, n, o, i = !1) {
|
|
|
5273
5305
|
if (x > 2 && (u === 0 || u === x - 1)) {
|
|
5274
5306
|
const d = e.startScreen[u === 0 ? x - 1 : 0];
|
|
5275
5307
|
if (Math.hypot(t.x - d.x, t.y - d.y) < Ji) {
|
|
5276
|
-
const p =
|
|
5308
|
+
const p = D(n, t);
|
|
5277
5309
|
if (!p) return null;
|
|
5278
5310
|
const y = e.start.points.slice();
|
|
5279
5311
|
return y[u] = o(p), { ...V(e.start, y), closed: !0 };
|
|
@@ -5294,16 +5326,16 @@ function wa(e, t, n, o, i = !1) {
|
|
|
5294
5326
|
// TV: the h-line anchor is a vertical resize (price only), the v-line
|
|
5295
5327
|
// anchor a horizontal resize (time only).
|
|
5296
5328
|
case "horizontal-line": {
|
|
5297
|
-
const u =
|
|
5329
|
+
const u = D(n, t);
|
|
5298
5330
|
return u ? V(e.start, [{ time: e.start.points[0].time, price: o(u).price }]) : null;
|
|
5299
5331
|
}
|
|
5300
5332
|
case "vertical-line": {
|
|
5301
|
-
const u =
|
|
5333
|
+
const u = D(n, t);
|
|
5302
5334
|
return u ? V(e.start, [{ time: o(u).time, price: e.start.points[0].price }]) : null;
|
|
5303
5335
|
}
|
|
5304
5336
|
}
|
|
5305
5337
|
if (e.mode.hit === "body" && e.start.kind === "signpost") {
|
|
5306
|
-
const u = t.x - e.startCursor.x, x = t.y - e.startCursor.y, d =
|
|
5338
|
+
const u = t.x - e.startCursor.x, x = t.y - e.startCursor.y, d = D(n, { x: e.startScreen[0].x + u, y: e.startScreen[0].y }), p = ((h = e.pane) == null ? void 0 : h.h) ?? 0, y = Wn(e.start, e.startScreen[0], n, p);
|
|
5307
5339
|
if (!d) return null;
|
|
5308
5340
|
const b = V(e.start, [{ time: d.time, price: e.start.points[0].price }]), m = fo(b, n, p, y.anchor.y + x);
|
|
5309
5341
|
return m == null ? b : { ...b, style: { ...b.style, signpostPosition: m } };
|
|
@@ -5327,14 +5359,14 @@ function wa(e, t, n, o, i = !1) {
|
|
|
5327
5359
|
d = t.x;
|
|
5328
5360
|
break;
|
|
5329
5361
|
}
|
|
5330
|
-
const m =
|
|
5362
|
+
const m = D(n, { x: d, y: p }), g = D(n, { x: y, y: b });
|
|
5331
5363
|
return !m || !g ? null : V(e.start, [m, g]);
|
|
5332
5364
|
}
|
|
5333
5365
|
if (r != null && r.isBbox && e.startScreen.length === 2 && e.mode.handleIndex < 4) {
|
|
5334
|
-
const x = mt(e.startScreen[0], e.startScreen[1])[(e.mode.handleIndex + 2) % 4], d =
|
|
5366
|
+
const x = mt(e.startScreen[0], e.startScreen[1])[(e.mode.handleIndex + 2) % 4], d = D(n, t), p = D(n, x);
|
|
5335
5367
|
return !d || !p ? null : V(e.start, [o(d), p]);
|
|
5336
5368
|
}
|
|
5337
|
-
const l =
|
|
5369
|
+
const l = D(n, t);
|
|
5338
5370
|
if (!l) return null;
|
|
5339
5371
|
const s = e.mode.handleIndex, a = e.start.points.slice();
|
|
5340
5372
|
if (s < 0 || s >= a.length) return null;
|
|
@@ -5373,40 +5405,40 @@ function Ma(e, t, n) {
|
|
|
5373
5405
|
const b = r === 0 || r === 1, m = r === 0 || r === 2, g = { x: l.x + (b ? 0 : d), y: l.y + (m ? 0 : p) }, w = { x: g.x + (b ? d : -d), y: g.y + (m ? p : -p) }, M = h * a.length, v = x(f);
|
|
5374
5406
|
let k = b ? Math.min(t.x, w.x - M) : Math.max(t.x, w.x + M);
|
|
5375
5407
|
const S = m ? Math.min(t.y, w.y - v) : Math.max(t.y, w.y + v);
|
|
5376
|
-
let
|
|
5377
|
-
const
|
|
5378
|
-
if (b && !
|
|
5408
|
+
let C = o.points[0].time;
|
|
5409
|
+
const I = o.anchored && e.pane && e.pane.w > 0 && e.pane.h > 0 ? e.pane : null;
|
|
5410
|
+
if (b && !I) {
|
|
5379
5411
|
const B = cr(n, k), R = B == null ? null : n.timeToX(B);
|
|
5380
5412
|
if (B == null || R == null) return null;
|
|
5381
|
-
|
|
5413
|
+
C = B, k = R;
|
|
5382
5414
|
}
|
|
5383
5415
|
let A = o.points[0].price;
|
|
5384
|
-
if (m && !
|
|
5416
|
+
if (m && !I) {
|
|
5385
5417
|
const B = n.yToPrice(S);
|
|
5386
5418
|
if (B == null) return null;
|
|
5387
5419
|
A = B;
|
|
5388
5420
|
}
|
|
5389
|
-
const F = g.x - k,
|
|
5390
|
-
b && (
|
|
5391
|
-
const E = fn(c, f, m ? p +
|
|
5392
|
-
if (
|
|
5421
|
+
const F = g.x - k, O = g.y - S, T = fn(a, u, b ? d + F : d - F);
|
|
5422
|
+
b && (T[T.length - 1] += Math.round(l.x + d) - k - x(T));
|
|
5423
|
+
const E = fn(c, f, m ? p + O : p - O), P = hi(s);
|
|
5424
|
+
if (I) {
|
|
5393
5425
|
const B = b ? k : l.x, R = m ? S : l.y;
|
|
5394
5426
|
return {
|
|
5395
5427
|
...o,
|
|
5396
|
-
anchored: { x: B /
|
|
5397
|
-
style: { ...i, tableColWidths:
|
|
5428
|
+
anchored: { x: B / I.w, y: R / I.h },
|
|
5429
|
+
style: { ...i, tableColWidths: T.map((Y) => Math.max(Y, h)), tableRowHeights: E.map((Y) => Math.max(Y, P)) }
|
|
5398
5430
|
};
|
|
5399
5431
|
}
|
|
5400
5432
|
return {
|
|
5401
5433
|
...o,
|
|
5402
|
-
points: [{ time:
|
|
5403
|
-
style: { ...i, tableColWidths:
|
|
5434
|
+
points: [{ time: C, price: A }],
|
|
5435
|
+
style: { ...i, tableColWidths: T.map((B) => Math.max(B, h)), tableRowHeights: E.map((B) => Math.max(B, P)) }
|
|
5404
5436
|
};
|
|
5405
5437
|
}
|
|
5406
5438
|
function va(e, t, n) {
|
|
5407
5439
|
const o = e.start, i = o.image, r = zn(i == null ? void 0 : i.name);
|
|
5408
5440
|
if (!i || !r || e.mode.hit !== "handle" || e.mode.handleIndex > 3) return null;
|
|
5409
|
-
const [l, s] = nl[e.mode.handleIndex], a = { x: e.startScreen[0].x + (i.dx ?? 0), y: e.startScreen[0].y }, c = { x: a.x - l * i.cssWidth / 2, y: a.y - s * i.cssHeight / 2 }, f = Math.max(Math.abs(c.x - t.x) / r.width, Math.abs(c.y - t.y) / r.height), h = Math.round(r.width * f), u = Math.round(r.height * f), x = { x: c.x + l * h / 2, y: c.y + s * u / 2 }, d =
|
|
5441
|
+
const [l, s] = nl[e.mode.handleIndex], a = { x: e.startScreen[0].x + (i.dx ?? 0), y: e.startScreen[0].y }, c = { x: a.x - l * i.cssWidth / 2, y: a.y - s * i.cssHeight / 2 }, f = Math.max(Math.abs(c.x - t.x) / r.width, Math.abs(c.y - t.y) / r.height), h = Math.round(r.width * f), u = Math.round(r.height * f), x = { x: c.x + l * h / 2, y: c.y + s * u / 2 }, d = D(n, x);
|
|
5410
5442
|
if (!d) return null;
|
|
5411
5443
|
const p = n.timeToX(d.time);
|
|
5412
5444
|
return { ...o, points: [d], image: { ...i, cssWidth: h, cssHeight: u, dx: p == null ? 0 : x.x - p } };
|
|
@@ -5584,7 +5616,7 @@ function fr(e, t) {
|
|
|
5584
5616
|
const l = n.logicalToCoordinate(o + 1);
|
|
5585
5617
|
return l == null ? i : i + r * (l - i);
|
|
5586
5618
|
}
|
|
5587
|
-
function
|
|
5619
|
+
function Qa(e, t, n) {
|
|
5588
5620
|
if (n.length === 0) return null;
|
|
5589
5621
|
const o = ar(n, t);
|
|
5590
5622
|
return o == null ? null : fr(e, o);
|
|
@@ -5837,8 +5869,8 @@ function ur(e, t) {
|
|
|
5837
5869
|
}
|
|
5838
5870
|
return e;
|
|
5839
5871
|
}
|
|
5840
|
-
const
|
|
5841
|
-
class
|
|
5872
|
+
const Oa = () => `dw_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
|
|
5873
|
+
class Ja {
|
|
5842
5874
|
constructor(t, n, o = {}) {
|
|
5843
5875
|
H(this, "chart");
|
|
5844
5876
|
H(this, "series");
|
|
@@ -5907,7 +5939,7 @@ class Qa {
|
|
|
5907
5939
|
}
|
|
5908
5940
|
/** Add a drawing (default style of its kind when none); returns its id. */
|
|
5909
5941
|
add(t) {
|
|
5910
|
-
const n = { id:
|
|
5942
|
+
const n = { id: Oa(), style: Kt(t.kind), ...t };
|
|
5911
5943
|
return this.list = [...this.list, n], this.emit("add", n), this.changed(), n.id;
|
|
5912
5944
|
}
|
|
5913
5945
|
update(t) {
|
|
@@ -5938,7 +5970,7 @@ class Qa {
|
|
|
5938
5970
|
* the pane at most) and selected. The file must be known to the core
|
|
5939
5971
|
* image cache (cacheImage / setImageReader) under `name`. */
|
|
5940
5972
|
addImage(t) {
|
|
5941
|
-
const { w: n, h: o } = this.paneSize(), i =
|
|
5973
|
+
const { w: n, h: o } = this.paneSize(), i = D(this.coords, { x: n / 2, y: o / 2 });
|
|
5942
5974
|
if (!i) return null;
|
|
5943
5975
|
const r = Kt("image"), l = this.add({
|
|
5944
5976
|
kind: "image",
|
|
@@ -6100,7 +6132,7 @@ class Qa {
|
|
|
6100
6132
|
return t.enabled ? (o) => To(o, n, t.mode) ?? o : (o) => o;
|
|
6101
6133
|
}
|
|
6102
6134
|
dataAt(t) {
|
|
6103
|
-
const n =
|
|
6135
|
+
const n = D(this.coords, t);
|
|
6104
6136
|
return n ? this.snapFn()(n) : null;
|
|
6105
6137
|
}
|
|
6106
6138
|
/** The magnet-snapped aim point of the preview (x and y lock onto the
|
|
@@ -6108,7 +6140,7 @@ class Qa {
|
|
|
6108
6140
|
aimAt(t) {
|
|
6109
6141
|
const n = this.magnet();
|
|
6110
6142
|
if (!n.enabled) return t;
|
|
6111
|
-
const o =
|
|
6143
|
+
const o = D(this.coords, t), i = o ? To(o, this.coords, n.mode) : null;
|
|
6112
6144
|
return i && J(this.coords, i) || t;
|
|
6113
6145
|
}
|
|
6114
6146
|
hitTopmost(t) {
|
|
@@ -6192,7 +6224,7 @@ class Qa {
|
|
|
6192
6224
|
}
|
|
6193
6225
|
if (this.spec) return;
|
|
6194
6226
|
const n = this.hitTopmost(this.panePoint(t));
|
|
6195
|
-
n && ((i = sn(n.drawing.kind)) != null && i.textEditable) && (t.stopPropagation(), this.emit("textEdit", n.drawing,
|
|
6227
|
+
n && ((i = sn(n.drawing.kind)) != null && i.textEditable) && (t.stopPropagation(), this.emit("textEdit", n.drawing, Da(n.drawing, n.pts)));
|
|
6196
6228
|
}
|
|
6197
6229
|
placementClick(t) {
|
|
6198
6230
|
const n = this.spec;
|
|
@@ -6243,14 +6275,14 @@ class Qa {
|
|
|
6243
6275
|
/** Brush / highlighter: press, drag (a vertex every FREEHAND_SAMPLE_PX),
|
|
6244
6276
|
* release commits (no magnet, like TV). */
|
|
6245
6277
|
startFreehand(t) {
|
|
6246
|
-
const n = this.spec, o =
|
|
6278
|
+
const n = this.spec, o = D(this.coords, t);
|
|
6247
6279
|
if (!o) return;
|
|
6248
6280
|
this.pending = [o], this.cursor = t;
|
|
6249
6281
|
let i = t;
|
|
6250
6282
|
const r = (s) => {
|
|
6251
6283
|
const a = this.panePoint(s);
|
|
6252
6284
|
if (this.cursor = a, Math.hypot(a.x - i.x, a.y - i.y) < ia) return;
|
|
6253
|
-
const c =
|
|
6285
|
+
const c = D(this.coords, a);
|
|
6254
6286
|
c && (i = a, this.pending = [...this.pending, c], this.redraw());
|
|
6255
6287
|
}, l = () => {
|
|
6256
6288
|
document.removeEventListener("pointermove", r), document.removeEventListener("pointerup", l), this.releaseChart();
|
|
@@ -6361,7 +6393,7 @@ class Qa {
|
|
|
6361
6393
|
return s.length >= 2 && u.push({ t: "polyline", pts: s, fill: "none", stroke: a.color, strokeWidth: a.width, cap: "round" }), u.push({ t: "line", a: h, b: c, stroke: a.color, strokeWidth: a.width, cap: "round" }), [...u, ...f];
|
|
6362
6394
|
}
|
|
6363
6395
|
}
|
|
6364
|
-
function
|
|
6396
|
+
function Da(e, t) {
|
|
6365
6397
|
return (e.kind === "callout" || e.kind === "note") && t[1] ? t[1] : e.kind === "price-note" && t[1] ? { x: (t[0].x + t[1].x) / 2, y: (t[0].y + t[1].y) / 2 } : t[0];
|
|
6366
6398
|
}
|
|
6367
6399
|
function _a(e) {
|
|
@@ -6428,17 +6460,17 @@ class Na {
|
|
|
6428
6460
|
});
|
|
6429
6461
|
}
|
|
6430
6462
|
}
|
|
6431
|
-
const
|
|
6463
|
+
const tf = "0.4.0";
|
|
6432
6464
|
export {
|
|
6433
6465
|
La as ANCHORABLE_KINDS,
|
|
6434
6466
|
Mn as DEFAULT_STYLE,
|
|
6435
|
-
|
|
6467
|
+
Ja as DrawingManager,
|
|
6436
6468
|
Ga as IMAGE_MAX_BYTES,
|
|
6437
6469
|
co as IMAGE_MAX_SIDE,
|
|
6438
6470
|
ja as IMAGE_TYPES,
|
|
6439
6471
|
He as OVERLAY_SPECS,
|
|
6440
6472
|
Io as TV_ANCHOR_COLOR,
|
|
6441
|
-
|
|
6473
|
+
tf as VERSION,
|
|
6442
6474
|
ka as anchorCursor,
|
|
6443
6475
|
wa as applyDrag,
|
|
6444
6476
|
mn as buildNewDrawing,
|
|
@@ -6448,6 +6480,7 @@ export {
|
|
|
6448
6480
|
Ba as drawScene,
|
|
6449
6481
|
ns as drawingAxisLabels,
|
|
6450
6482
|
Ua as factoryStyleFor,
|
|
6483
|
+
Ka as fibLevelAt,
|
|
6451
6484
|
sn as findOverlaySpec,
|
|
6452
6485
|
Ao as finishPlacement,
|
|
6453
6486
|
Jl as hitTestKind,
|
|
@@ -6461,7 +6494,7 @@ export {
|
|
|
6461
6494
|
tn as sceneOf,
|
|
6462
6495
|
Xa as setDefaultStyleOverride,
|
|
6463
6496
|
qa as setImageReader,
|
|
6464
|
-
|
|
6497
|
+
Qa as timeToXFallback,
|
|
6465
6498
|
Ca as toggleAnchored,
|
|
6466
6499
|
Mr as volumeProfileDefaults,
|
|
6467
6500
|
Bn as volumeProfileStyle
|