lightweight-charts-drawing 0.6.0 → 0.6.1
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 +12 -0
- package/dist/index.d.ts +16 -3
- package/dist/lightweight-charts-drawing.es.js +960 -942
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var br = (e, t, n) => t in e ?
|
|
1
|
+
var mr = Object.defineProperty;
|
|
2
|
+
var br = (e, t, n) => t in e ? mr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var N = (e, t, n) => br(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
const Mn = {
|
|
5
5
|
color: "#2962ff",
|
|
6
6
|
width: 1,
|
|
7
7
|
lineStyle: "solid"
|
|
8
8
|
};
|
|
9
|
-
function
|
|
9
|
+
function gr(e, t) {
|
|
10
10
|
if (!e || !t) return !0;
|
|
11
11
|
const n = /^(\d+)([A-Z]+)?$/.exec(t.trim().toUpperCase());
|
|
12
12
|
if (!n) return !0;
|
|
@@ -32,14 +32,14 @@ function mr(e, t) {
|
|
|
32
32
|
return !0;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
{ coeff: 0, color:
|
|
35
|
+
const q = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", Z = "#089981", tt = "#00bcd4", $ = "#2962ff", ne = "#9c27b0", ut = "#e91e63", qt = "#673ab7", Pt = [
|
|
36
|
+
{ coeff: 0, color: q, visible: !0 },
|
|
37
37
|
{ coeff: 0.236, color: rt, visible: !0 },
|
|
38
38
|
{ coeff: 0.382, color: nt, visible: !0 },
|
|
39
39
|
{ coeff: 0.5, color: it, visible: !0 },
|
|
40
|
-
{ coeff: 0.618, color:
|
|
40
|
+
{ coeff: 0.618, color: Z, visible: !0 },
|
|
41
41
|
{ coeff: 0.786, color: tt, visible: !0 },
|
|
42
|
-
{ coeff: 1, color:
|
|
42
|
+
{ coeff: 1, color: q, visible: !0 },
|
|
43
43
|
{ coeff: 1.618, color: $, visible: !0 },
|
|
44
44
|
{ coeff: 2.618, color: rt, visible: !0 },
|
|
45
45
|
{ coeff: 3.618, color: ne, visible: !0 },
|
|
@@ -48,22 +48,22 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
48
48
|
{ coeff: 1.414, color: rt, visible: !1 },
|
|
49
49
|
{ coeff: 2.272, color: nt, visible: !1 },
|
|
50
50
|
{ coeff: 2.414, color: it, visible: !1 },
|
|
51
|
-
{ coeff: 2, color:
|
|
51
|
+
{ coeff: 2, color: Z, visible: !1 },
|
|
52
52
|
{ coeff: 3, color: tt, visible: !1 },
|
|
53
|
-
{ coeff: 3.272, color:
|
|
53
|
+
{ coeff: 3.272, color: q, visible: !1 },
|
|
54
54
|
{ coeff: 3.414, color: $, visible: !1 },
|
|
55
55
|
{ coeff: 4, color: rt, visible: !1 },
|
|
56
56
|
{ coeff: 4.272, color: ne, visible: !1 },
|
|
57
57
|
{ coeff: 4.414, color: ut, visible: !1 },
|
|
58
58
|
{ coeff: 4.618, color: nt, visible: !1 },
|
|
59
|
-
{ coeff: 4.764, color:
|
|
59
|
+
{ coeff: 4.764, color: Z, visible: !1 }
|
|
60
60
|
], kt = [
|
|
61
61
|
{ coeff: 0.25, color: "#ffb74d", visible: !1 },
|
|
62
62
|
// tan-orange-300
|
|
63
63
|
{ coeff: 0.382, color: "#81c784", visible: !1 },
|
|
64
64
|
// iguana-green-300
|
|
65
|
-
{ coeff: 0.5, color:
|
|
66
|
-
{ coeff: 0.618, color:
|
|
65
|
+
{ coeff: 0.5, color: Z, visible: !0 },
|
|
66
|
+
{ coeff: 0.618, color: Z, visible: !1 },
|
|
67
67
|
{ coeff: 0.75, color: tt, visible: !1 },
|
|
68
68
|
{ coeff: 1, color: $, visible: !0 },
|
|
69
69
|
{ coeff: 1.5, color: ne, visible: !1 },
|
|
@@ -72,9 +72,9 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
72
72
|
// ripe-red-300
|
|
73
73
|
], vn = [
|
|
74
74
|
{ coeff: 1 / 8, color: nt, visible: !0, label: "1/8" },
|
|
75
|
-
{ coeff: 1 / 4, color:
|
|
75
|
+
{ coeff: 1 / 4, color: Z, visible: !0, label: "1/4" },
|
|
76
76
|
{ coeff: 1 / 3, color: it, visible: !0, label: "1/3" },
|
|
77
|
-
{ coeff: 1 / 2, color:
|
|
77
|
+
{ coeff: 1 / 2, color: Z, visible: !0, label: "1/2" },
|
|
78
78
|
{ coeff: 1, color: tt, visible: !0, label: "1/1" },
|
|
79
79
|
{ coeff: 2, color: $, visible: !0, label: "2/1" },
|
|
80
80
|
{ coeff: 3, color: ne, visible: !0, label: "3/1" },
|
|
@@ -84,43 +84,43 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
84
84
|
{ coeff: 0.236, color: rt, visible: !0 },
|
|
85
85
|
{ coeff: 0.382, color: nt, visible: !0 },
|
|
86
86
|
{ coeff: 0.5, color: it, visible: !0 },
|
|
87
|
-
{ coeff: 0.618, color:
|
|
87
|
+
{ coeff: 0.618, color: Z, visible: !0 },
|
|
88
88
|
{ coeff: 0.786, color: tt, visible: !0 },
|
|
89
|
-
{ coeff: 1, color:
|
|
89
|
+
{ coeff: 1, color: q, visible: !0 },
|
|
90
90
|
{ coeff: 1.618, color: $, visible: !1 },
|
|
91
91
|
{ coeff: 2.618, color: rt, visible: !1 },
|
|
92
92
|
{ coeff: 3.618, color: qt, visible: !1 },
|
|
93
93
|
{ coeff: 4.236, color: ut, visible: !1 },
|
|
94
94
|
{ coeff: 4.618, color: ut, visible: !1 }
|
|
95
95
|
], Ee = [
|
|
96
|
-
{ coeff: 0, color:
|
|
96
|
+
{ coeff: 0, color: q, visible: !0 },
|
|
97
97
|
{ coeff: 0.25, color: nt, visible: !0 },
|
|
98
98
|
{ coeff: 0.382, color: tt, visible: !0 },
|
|
99
99
|
{ coeff: 0.5, color: it, visible: !0 },
|
|
100
|
-
{ coeff: 0.618, color:
|
|
100
|
+
{ coeff: 0.618, color: Z, visible: !0 },
|
|
101
101
|
{ coeff: 0.75, color: $, visible: !0 },
|
|
102
|
-
{ coeff: 1, color:
|
|
102
|
+
{ coeff: 1, color: q, visible: !0 }
|
|
103
103
|
], Ln = [
|
|
104
|
-
{ coeff: 0, color:
|
|
104
|
+
{ coeff: 0, color: q, visible: !0, width: 2, style: "solid" },
|
|
105
105
|
{ coeff: 0.382, color: rt, visible: !0, width: 2, style: "solid" },
|
|
106
106
|
{ coeff: 0.5, color: "#81c784", visible: !1, width: 2, style: "solid" },
|
|
107
107
|
{ coeff: 0.618, color: it, visible: !0, width: 2, style: "solid" },
|
|
108
|
-
{ coeff: 1, color:
|
|
108
|
+
{ coeff: 1, color: Z, visible: !0, width: 2, style: "solid" },
|
|
109
109
|
{ coeff: 1.382, color: tt, visible: !0, width: 2, style: "solid" },
|
|
110
|
-
{ coeff: 1.618, color:
|
|
110
|
+
{ coeff: 1.618, color: q, visible: !0, width: 2, style: "solid" },
|
|
111
111
|
{ coeff: 2, color: $, visible: !0, width: 2, style: "solid" },
|
|
112
112
|
{ coeff: 2.382, color: ut, visible: !0, width: 2, style: "solid" },
|
|
113
113
|
{ coeff: 2.618, color: ne, visible: !0, width: 2, style: "solid" },
|
|
114
114
|
{ coeff: 3, color: "#673ab7", visible: !0, width: 2, style: "solid" }
|
|
115
|
-
], Sn = { visible: !0, color:
|
|
115
|
+
], Sn = { visible: !0, color: q, width: 2, style: "dashed" }, wr = Sn, Mr = { visible: !0, color: q, width: 2, style: "solid" }, Xt = (e, t) => ({ color: e, width: 2, visible: t }), X = (e, t, n, o) => ({ color: e, width: 2, visible: t, x: n, y: o }), on = [Xt(q, !0), Xt(nt, !0), Xt(tt, !0), Xt(it, !0), Xt(Z, !0), Xt(q, !0)], rn = [
|
|
116
116
|
X("#b39ddb", !1, 8, 1),
|
|
117
117
|
X(rt, !1, 5, 1),
|
|
118
|
-
X(
|
|
118
|
+
X(q, !1, 4, 1),
|
|
119
119
|
X(nt, !1, 3, 1),
|
|
120
120
|
X(tt, !0, 2, 1),
|
|
121
121
|
X(it, !0, 1, 1),
|
|
122
|
-
X(
|
|
123
|
-
X(
|
|
122
|
+
X(Z, !0, 1, 2),
|
|
123
|
+
X(Z, !1, 1, 3),
|
|
124
124
|
X($, !1, 1, 4),
|
|
125
125
|
X("#9575cd", !1, 1, 5),
|
|
126
126
|
X("#b39ddb", !1, 1, 8)
|
|
@@ -132,12 +132,12 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
132
132
|
X(tt, !0, 2, 1),
|
|
133
133
|
X(it, !0, 3, 0),
|
|
134
134
|
X(it, !0, 3, 1),
|
|
135
|
-
X(
|
|
136
|
-
X(
|
|
135
|
+
X(Z, !0, 4, 0),
|
|
136
|
+
X(Z, !0, 4, 1),
|
|
137
137
|
X($, !0, 5, 0),
|
|
138
138
|
X($, !0, 5, 1)
|
|
139
139
|
], Fo = { visible: !0, color: "rgba(21, 56, 153, 0.8)", width: 1, style: "solid" }, Cn = [
|
|
140
|
-
{ coeff: 0, color:
|
|
140
|
+
{ coeff: 0, color: q, visible: !0 },
|
|
141
141
|
{ coeff: 1, color: $, visible: !0 },
|
|
142
142
|
{ coeff: 2, color: $, visible: !0 },
|
|
143
143
|
{ coeff: 3, color: $, visible: !0 },
|
|
@@ -160,10 +160,10 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
160
160
|
], An = [
|
|
161
161
|
{ coeff: 0.236, color: rt, visible: !0 },
|
|
162
162
|
{ coeff: 0.382, color: nt, visible: !0 },
|
|
163
|
-
{ coeff: 0.5, color:
|
|
163
|
+
{ coeff: 0.5, color: Z, visible: !0 },
|
|
164
164
|
{ coeff: 0.618, color: it, visible: !0 },
|
|
165
165
|
{ coeff: 0.786, color: tt, visible: !0 },
|
|
166
|
-
{ coeff: 1, color:
|
|
166
|
+
{ coeff: 1, color: q, visible: !0 },
|
|
167
167
|
{ coeff: 1.618, color: $, visible: !0 },
|
|
168
168
|
{ coeff: 2.618, color: ut, visible: !0 },
|
|
169
169
|
{ coeff: 3.618, color: $, visible: !0 },
|
|
@@ -172,24 +172,24 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
172
172
|
], $n = [
|
|
173
173
|
{ coeff: 0.236, color: rt, visible: !0 },
|
|
174
174
|
{ coeff: 0.382, color: nt, visible: !0 },
|
|
175
|
-
{ coeff: 0.5, color:
|
|
175
|
+
{ coeff: 0.5, color: Z, visible: !0 },
|
|
176
176
|
{ coeff: 0.618, color: it, visible: !0 },
|
|
177
177
|
{ coeff: 0.786, color: tt, visible: !0 },
|
|
178
|
-
{ coeff: 1, color:
|
|
178
|
+
{ coeff: 1, color: q, visible: !0 },
|
|
179
179
|
{ coeff: 1.618, color: $, visible: !0 },
|
|
180
180
|
{ coeff: 2.618, color: ut, visible: !0 },
|
|
181
181
|
{ coeff: 3.618, color: $, visible: !0 },
|
|
182
182
|
{ coeff: 4.236, color: ut, visible: !0 },
|
|
183
183
|
{ coeff: 4.618, color: rt, visible: !0 }
|
|
184
184
|
], ze = [
|
|
185
|
-
{ coeff: 0, color:
|
|
185
|
+
{ coeff: 0, color: q, visible: !0 },
|
|
186
186
|
{ coeff: 0.25, color: nt, visible: !0 },
|
|
187
187
|
{ coeff: 0.382, color: tt, visible: !0 },
|
|
188
188
|
{ coeff: 0.5, color: it, visible: !0 },
|
|
189
|
-
{ coeff: 0.618, color:
|
|
189
|
+
{ coeff: 0.618, color: Z, visible: !0 },
|
|
190
190
|
{ coeff: 0.75, color: $, visible: !0 },
|
|
191
|
-
{ coeff: 1, color:
|
|
192
|
-
],
|
|
191
|
+
{ coeff: 1, color: q, visible: !0 }
|
|
192
|
+
], vr = 7, kr = {
|
|
193
193
|
upColor: "#ACE5DC",
|
|
194
194
|
downColor: "#FAA1A4",
|
|
195
195
|
drawBorder: !0,
|
|
@@ -202,7 +202,7 @@ const j = "#808080", rt = "#f23645", nt = "#ff9800", it = "#4caf50", q = "#08998
|
|
|
202
202
|
up: { visible: !0, color: $, width: 2, style: "solid" },
|
|
203
203
|
down: { visible: !0, color: $, width: 2, style: "solid" }
|
|
204
204
|
};
|
|
205
|
-
function
|
|
205
|
+
function Lr(e) {
|
|
206
206
|
const t = (n, o, i) => ({ visible: n, color: o, width: i, style: "solid" });
|
|
207
207
|
return {
|
|
208
208
|
rowsLayout: "rows",
|
|
@@ -229,7 +229,7 @@ function kr(e) {
|
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
231
|
function Bn(e, t) {
|
|
232
|
-
return { ...
|
|
232
|
+
return { ...Lr(e), ...t.vp ?? {} };
|
|
233
233
|
}
|
|
234
234
|
const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
235
235
|
coeff: e,
|
|
@@ -237,7 +237,7 @@ const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
237
237
|
visible: t === 1 || t === 3 || t === 5,
|
|
238
238
|
width: t === 1 || t === 5 ? 2 : 1,
|
|
239
239
|
style: t === 3 ? "dashed" : "solid"
|
|
240
|
-
})),
|
|
240
|
+
})), Sr = kt.map(
|
|
241
241
|
(e) => e.coeff === 0.5 ? { ...e, color: tt } : e
|
|
242
242
|
), Ne = {
|
|
243
243
|
// 1-point
|
|
@@ -291,8 +291,8 @@ const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
291
291
|
},
|
|
292
292
|
// TV risk / reward factory style: lines #808080 1px, text white 12px,
|
|
293
293
|
// stop #F23645 / target #089981 at 80 transparency, price labels on.
|
|
294
|
-
"long-position": { kind: "long-position", pointCount: 1, preview: "none", isBbox: !1, defaults: { color:
|
|
295
|
-
"short-position": { kind: "short-position", pointCount: 1, preview: "none", isBbox: !1, defaults: { color:
|
|
294
|
+
"long-position": { kind: "long-position", pointCount: 1, preview: "none", isBbox: !1, defaults: { color: q, width: 1, textColor: "#ffffff", fontSize: 12, stopColor: "#f23645", stopTransparency: 80, targetColor: "#089981", targetTransparency: 80, showPriceLabels: !0, accountSize: 1e3, riskPercent: 25, lotSize: 1, riskDisplayMode: "percents", leverage: 1e4, qtyPrecision: "default" } },
|
|
295
|
+
"short-position": { kind: "short-position", pointCount: 1, preview: "none", isBbox: !1, defaults: { color: q, width: 1, textColor: "#ffffff", fontSize: 12, stopColor: "#f23645", stopTransparency: 80, targetColor: "#089981", targetTransparency: 80, showPriceLabels: !0, accountSize: 1e3, riskPercent: 25, lotSize: 1, riskDisplayMode: "percents", leverage: 1e4, qtyPrecision: "default" } },
|
|
296
296
|
"gann-fan": { kind: "gann-fan", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, levels: vn, fillBackground: !0, transparency: 80 } },
|
|
297
297
|
// TV factory (line-tool-gann-box): price and time levels alike, all four
|
|
298
298
|
// label sides on, both backgrounds on at 80, angles off (#9C9C9C).
|
|
@@ -300,7 +300,7 @@ const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
300
300
|
// TV factory: fills default OFF (unlike the retracement family).
|
|
301
301
|
// TV fib time zone labels: on, right / bottom.
|
|
302
302
|
"fib-time-zone": { kind: "fib-time-zone", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, levels: Cn, fillBackground: !1, transparency: 80, showLabels: !0, horzLabelsAlign: "right", vertLabelsAlign: "bottom" } },
|
|
303
|
-
"fib-circles": { kind: "fib-circles", pointCount: 2, preview: "line", isBbox: !1, defaults: { color:
|
|
303
|
+
"fib-circles": { kind: "fib-circles", pointCount: 2, preview: "line", isBbox: !1, defaults: { color: q, width: 2, levels: $n, fillBackground: !0, transparency: 80 } },
|
|
304
304
|
"fib-speed-resistance-fan": { kind: "fib-speed-resistance-fan", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, levels: Ee, vLevels: Ee, fillBackground: !0, transparency: 80, showLeftLabels: !0, showRightLabels: !0, showTopLabels: !0, showBottomLabels: !0, reverse: !1, fanGrid: Fo } },
|
|
305
305
|
"fib-speed-resistance-arcs": { kind: "fib-speed-resistance-arcs", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, levels: An, fillBackground: !0, transparency: 80 } },
|
|
306
306
|
// TV factory (line-tool-fib-spiral): sky-blue, 2px.
|
|
@@ -312,7 +312,7 @@ const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
312
312
|
"gann-square": { kind: "gann-square", pointCount: 2, preview: "line", isBbox: !1, defaults: { width: 2, gannLevels: on, gannFans: rn, gannArcs: ln, fillBackground: !0, transparency: 80, reverse: !1, showLabels: !0, labelFontSize: 12 } },
|
|
313
313
|
sector: { kind: "sector", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#9c9c9c", width: 2, fillBackground: !0, transparency: 80, sectorColor1: $, sectorColor2: ne } },
|
|
314
314
|
"fib-wedge": { kind: "fib-wedge", pointCount: 3, preview: "line", isBbox: !1, defaults: { width: 2, levels: kn, fillBackground: !0, transparency: 80 } },
|
|
315
|
-
pitchfan: { kind: "pitchfan", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#f23645", width: 2, levels:
|
|
315
|
+
pitchfan: { kind: "pitchfan", pointCount: 3, preview: "line", isBbox: !1, defaults: { color: "#f23645", width: 2, levels: Sr, fillBackground: !0, transparency: 80 } },
|
|
316
316
|
// TV factories: cyclic #80ccdb 2px; sine #159980 1px; time-cycles #159980
|
|
317
317
|
// with the iguana-green fill on by default.
|
|
318
318
|
"cyclic-lines": { kind: "cyclic-lines", pointCount: 2, preview: "line", isBbox: !1, defaults: { color: "#80ccdb", width: 2 } },
|
|
@@ -366,10 +366,10 @@ const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
366
366
|
// TV factories: abcd minty-green + white labels (line-tool-abcd); xabcd/
|
|
367
367
|
// cypher tv-blue line + background @ transparency 85, white labels
|
|
368
368
|
// (line-tool-5points-patterns `nonThemedFactoryDefaults`).
|
|
369
|
-
"abcd-pattern": { kind: "abcd-pattern", pointCount: 4, preview: "line", isBbox: !1, defaults: { color:
|
|
369
|
+
"abcd-pattern": { kind: "abcd-pattern", pointCount: 4, preview: "line", isBbox: !1, defaults: { color: Z, width: 2, textColor: "#ffffff", fontSize: 12 } },
|
|
370
370
|
"xabcd-pattern": { kind: "xabcd-pattern", pointCount: 5, preview: "line", isBbox: !1, defaults: { color: $, width: 2, textColor: "#ffffff", backgroundColor: $, fillBackground: !0, transparency: 85, fontSize: 12 } },
|
|
371
371
|
"cypher-pattern": { kind: "cypher-pattern", pointCount: 5, preview: "line", isBbox: !1, defaults: { color: $, width: 2, textColor: "#ffffff", backgroundColor: $, fillBackground: !0, transparency: 85, fontSize: 12 } },
|
|
372
|
-
"head-and-shoulders": { kind: "head-and-shoulders", pointCount: 7, preview: "line", isBbox: !1, defaults: { color:
|
|
372
|
+
"head-and-shoulders": { kind: "head-and-shoulders", pointCount: 7, preview: "line", isBbox: !1, defaults: { color: Z, width: 2, textColor: "#ffffff", fontSize: 12, fillBackground: !0, backgroundColor: Z, transparency: 85 } },
|
|
373
373
|
"triangle-pattern": { kind: "triangle-pattern", pointCount: 4, preview: "line", isBbox: !1, defaults: { color: qt, width: 2, textColor: "#ffffff", fontSize: 12, fillBackground: !0, backgroundColor: qt, transparency: 85 } },
|
|
374
374
|
"three-drives-pattern": { kind: "three-drives-pattern", pointCount: 7, preview: "line", isBbox: !1, defaults: { color: qt, width: 2, textColor: "#ffffff", fontSize: 12 } },
|
|
375
375
|
"elliott-impulse": { kind: "elliott-impulse", pointCount: 6, preview: "line", isBbox: !1, defaults: { color: "#3d85c6", width: 2 } },
|
|
@@ -432,22 +432,22 @@ const He = [-0.25, 0, 0.25, 0.5, 0.75, 1, 1.25].map((e, t) => ({
|
|
|
432
432
|
"anchored-vwap": { kind: "anchored-vwap", pointCount: 1, preview: "none", isBbox: !1, defaults: { color: "#1e88e5", width: 1, vwapSource: "hlc3", levels: Tn, fillBackground: !0, backgroundColor: "#4caf50", transparency: 95 } },
|
|
433
433
|
"fixed-range-volume-profile": { kind: "fixed-range-volume-profile", pointCount: 2, preview: "rect", isBbox: !0 },
|
|
434
434
|
"anchored-volume-profile": { kind: "anchored-volume-profile", pointCount: 1, preview: "none", isBbox: !1 }
|
|
435
|
-
},
|
|
435
|
+
}, Cr = new Set(Object.keys(Ne));
|
|
436
436
|
function sn(e) {
|
|
437
|
-
if (e &&
|
|
437
|
+
if (e && Cr.has(e))
|
|
438
438
|
return Ne[e];
|
|
439
439
|
}
|
|
440
440
|
function Kt(e) {
|
|
441
441
|
const t = { ...Mn, ...Ne[e].defaults, ...Oo(e) };
|
|
442
442
|
return t.levels && (t.levels = t.levels.map((n) => ({ ...n }))), t;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function of(e) {
|
|
445
445
|
const t = { ...Mn, ...Ne[e].defaults };
|
|
446
446
|
return t.levels && (t.levels = t.levels.map((n) => ({ ...n }))), t;
|
|
447
447
|
}
|
|
448
448
|
let Oo = () => {
|
|
449
449
|
};
|
|
450
|
-
function
|
|
450
|
+
function rf(e) {
|
|
451
451
|
Oo = e;
|
|
452
452
|
}
|
|
453
453
|
const et = 6, L = 6, Qn = 9;
|
|
@@ -477,7 +477,7 @@ function Qt(e, t, n) {
|
|
|
477
477
|
}
|
|
478
478
|
return o;
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function bt(e, t) {
|
|
481
481
|
const n = Math.min(e.x, t.x), o = Math.max(e.x, t.x), i = Math.min(e.y, t.y), r = Math.max(e.y, t.y);
|
|
482
482
|
return [
|
|
483
483
|
{ x: n, y: i },
|
|
@@ -494,7 +494,7 @@ function O(e) {
|
|
|
494
494
|
}
|
|
495
495
|
return typeof e == "object" && e !== null && "year" in e ? Date.UTC(e.year, e.month - 1, e.day) / 1e3 : null;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Tr(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
|
}
|
|
@@ -512,7 +512,7 @@ function _o(e, t) {
|
|
|
512
512
|
const f = i ? (i.x - o.x) * -a + (i.y - o.y) * -c : 0;
|
|
513
513
|
return [n, o, { x: o.x - a * f, y: o.y - c * f }, { x: n.x - a * f, y: n.y - c * f }];
|
|
514
514
|
}
|
|
515
|
-
const
|
|
515
|
+
const Ar = [
|
|
516
516
|
["tpPriceOffset", "TP price offset", !0],
|
|
517
517
|
["tpPercentOffset", "TP percent offset", !0],
|
|
518
518
|
["tpTickOffset", "TP tick offset", !0],
|
|
@@ -529,7 +529,7 @@ const Tr = [
|
|
|
529
529
|
];
|
|
530
530
|
function Be(e, t) {
|
|
531
531
|
var o;
|
|
532
|
-
return ((o = e.positionStats) == null ? void 0 : o[t]) ??
|
|
532
|
+
return ((o = e.positionStats) == null ? void 0 : o[t]) ?? Ar.find((i) => i[0] === t)[2];
|
|
533
533
|
}
|
|
534
534
|
function Ce(e, t) {
|
|
535
535
|
const n = Math.abs(e).toLocaleString("en-US", { minimumFractionDigits: t, maximumFractionDigits: t });
|
|
@@ -540,7 +540,7 @@ function Jn(e, t, n, o, i, r, l, s) {
|
|
|
540
540
|
let u = "";
|
|
541
541
|
return a("PriceOffset") && (u += c ? f : `${t === "tp" ? "Target" : "Stop"}: ${f}`), a("PercentOffset") && (u += u !== "" ? ` (${h})` : h), a("TickOffset") && (u += (u !== "" ? " " : "") + Ce(Math.round(n / i), 0)), a("Amount") && (u += c ? (u !== "" ? " " : "") + String(l) : (u !== "" ? ", " : "") + `Amount: ${l}`), a("PL") && (u += c ? (u !== "" ? " " : "") + Ce(s, r) : (u !== "" ? ", " : "") + `PnL: ${Ce(s, r)}`), u;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function $r(e, t, n, o, i) {
|
|
544
544
|
const r = !!e.compactStats;
|
|
545
545
|
let l = "";
|
|
546
546
|
return Be(e, "openClosePL") && t && (l += r ? t : `${n ? "Closed" : "Open"} PnL: ${t}`), Be(e, "qty") && (l += (l !== "" ? r ? " ~ " : ", " : "") + (r ? String(o) : `Qty: ${o}`)), Be(e, "riskRewardRatio") && (l += (l !== "" ? `
|
|
@@ -554,18 +554,18 @@ function Ho(e, t) {
|
|
|
554
554
|
profit: e.style.profitLevel ?? (i || t * 100)
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Br(e) {
|
|
558
558
|
const t = e.accountSize ?? pe.accountSize;
|
|
559
559
|
return e.riskDisplayMode === "money" ? Math.min(e.riskAmount ?? t * (e.riskPercent ?? pe.risk) / 100, t) : (e.riskPercent ?? pe.risk) / 100 * t;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Ir(e, t) {
|
|
562
562
|
if (!t || t === "default") return Math.floor(e);
|
|
563
563
|
const n = Math.pow(10, parseInt(t, 10));
|
|
564
564
|
return Math.round(e * n) / n;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
const o = e.accountSize ?? pe.accountSize, i = e.leverage ?? pe.leverage, r = n > 0 ?
|
|
568
|
-
return { qty: a, shown:
|
|
566
|
+
function Pr(e, t, n) {
|
|
567
|
+
const o = e.accountSize ?? pe.accountSize, i = e.leverage ?? pe.leverage, r = n > 0 ? Br(e) / n : 1 / 0, l = t > 0 ? i * o / t : 1 / 0, s = Math.min(r, l), a = Number.isFinite(s) ? s : 0, c = e.lotSize && e.lotSize > 0 ? e.lotSize : 1;
|
|
568
|
+
return { qty: a, shown: Ir(a / c, e.qtyPrecision) };
|
|
569
569
|
}
|
|
570
570
|
function In(e, t, n) {
|
|
571
571
|
if (e.kind !== "long-position" && e.kind !== "short-position") return null;
|
|
@@ -578,7 +578,7 @@ function In(e, t, n) {
|
|
|
578
578
|
profit: s
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Er(e, t, n, o, i) {
|
|
582
582
|
if (!i || e.points.length < 2) return null;
|
|
583
583
|
const r = i.bars();
|
|
584
584
|
if (r.length === 0) return null;
|
|
@@ -596,8 +596,8 @@ function Pr(e, t, n, o, i) {
|
|
|
596
596
|
let x = null, d = null;
|
|
597
597
|
if (u != null)
|
|
598
598
|
for (let y = u; y <= h; y++) {
|
|
599
|
-
const
|
|
600
|
-
if (t === "long" ?
|
|
599
|
+
const m = r[y];
|
|
600
|
+
if (t === "long" ? m.low <= n ? d = n : m.high >= o && (d = o) : m.high >= n ? d = n : m.low <= o && (d = o), d != null) {
|
|
601
601
|
x = y;
|
|
602
602
|
break;
|
|
603
603
|
}
|
|
@@ -619,16 +619,16 @@ function No(e, t) {
|
|
|
619
619
|
const [i, r] = e.style.reverse ? [o, n] : [n, o];
|
|
620
620
|
return { start: i, end: r, dx: r.x - i.x, dy: r.y - i.y };
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function zr(e, t) {
|
|
623
623
|
return t.map((n, o) => ({ l: n, t: o / 5 })).filter((n) => n.l.visible).map(({ l: n, t: o }) => ({ color: n.color, width: n.width, x: e.start.x + o * e.dx, y: e.start.y + o * e.dy }));
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function Wr(e, t) {
|
|
626
626
|
return t.filter((n) => n.visible).map((n) => {
|
|
627
627
|
const o = n.x > n.y ? { x: e.end.x, y: e.start.y + n.y / n.x * e.dy } : { x: e.start.x + n.x / n.y * e.dx, y: e.end.y };
|
|
628
628
|
return { color: n.color, width: n.width, from: e.start, to: o };
|
|
629
629
|
});
|
|
630
630
|
}
|
|
631
|
-
function
|
|
631
|
+
function Rr(e, t) {
|
|
632
632
|
const n = e.dx !== 0 ? e.dy / e.dx : 0, o = (l, s) => n !== 0 ? Math.hypot(l, s / n) : Math.abs(l);
|
|
633
633
|
let i = 0;
|
|
634
634
|
const r = [];
|
|
@@ -639,7 +639,7 @@ function Wr(e, t) {
|
|
|
639
639
|
}
|
|
640
640
|
return r;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Fr(e, t, n) {
|
|
643
643
|
const o = e.dx < 0 ? -1 : 1, i = e.dy < 0 ? -1 : 1, r = e.dx !== 0 ? Math.abs(e.dy / e.dx) : 1, l = o * i > 0 ? 1 : 0, { x: s, y: a } = e.start, c = `M ${s + o * t} ${a} A ${t} ${t * r} 0 0 ${l} ${s} ${a + i * t * r}`, f = n > 0 ? `L ${s} ${a + i * n * r} A ${n} ${n * r} 0 0 ${1 - l} ${s + o * n} ${a}` : `L ${s} ${a}`, h = `M ${s + o * n} ${a} L ${s + o * t} ${a} A ${t} ${t * r} 0 0 ${l} ${s} ${a + i * t * r} ${f} Z`;
|
|
644
644
|
return { stroke: c, fill: h };
|
|
645
645
|
}
|
|
@@ -735,7 +735,7 @@ function Ve(e, t, n, o, i) {
|
|
|
735
735
|
a.push(p), d.word = "";
|
|
736
736
|
else {
|
|
737
737
|
const y = s(p);
|
|
738
|
-
for (let
|
|
738
|
+
for (let m = 0; m < y.length - 1; m++) a.push(y[m]);
|
|
739
739
|
d.word = y[y.length - 1];
|
|
740
740
|
}
|
|
741
741
|
continue;
|
|
@@ -758,7 +758,7 @@ function G(e) {
|
|
|
758
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
|
-
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",
|
|
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", m = e.angle ?? 0, b = Math.cos(m), g = Math.sin(m), w = (M, v) => ({ x: (M - x) * b - (v - d) * g + x, y: (M - x) * g + (v - d) * b + d });
|
|
762
762
|
return {
|
|
763
763
|
lines: n,
|
|
764
764
|
fs: t,
|
|
@@ -767,7 +767,7 @@ function G(e) {
|
|
|
767
767
|
tx: p,
|
|
768
768
|
y0: h + o + t / 2 + 0.05 * t,
|
|
769
769
|
anchor: y,
|
|
770
|
-
rotate: `rotate(${
|
|
770
|
+
rotate: `rotate(${m * 180 / Math.PI} ${x} ${d})`,
|
|
771
771
|
box: { left: u, top: h, width: a, height: f },
|
|
772
772
|
poly: [w(u, h), w(u + a, h), w(u + a, h + f), w(u, h + f)]
|
|
773
773
|
};
|
|
@@ -792,9 +792,9 @@ function Go(e, t, n) {
|
|
|
792
792
|
function jo(e, t, n) {
|
|
793
793
|
const [o, i] = t;
|
|
794
794
|
if (!e.text || !o || !i) return null;
|
|
795
|
-
const r = e.style, l = Math.min(o.x, i.x), s = Math.max(o.x, i.x), a = Math.min(o.y, i.y), c = Math.max(o.y, i.y), f = !!r.extendLeft, h = !!r.extendRight, u = (l <= n || f) && (s >= 0 || h), x = r.fontSize ?? 14, d = x / 3, p = r.horzLabelsAlign ?? "center", y = r.vertLabelsAlign ?? "middle",
|
|
795
|
+
const r = e.style, l = Math.min(o.x, i.x), s = Math.max(o.x, i.x), a = Math.min(o.y, i.y), c = Math.max(o.y, i.y), f = !!r.extendLeft, h = !!r.extendRight, u = (l <= n || f) && (s >= 0 || h), x = r.fontSize ?? 14, d = x / 3, p = r.horzLabelsAlign ?? "center", y = r.vertLabelsAlign ?? "middle", m = y === "middle", b = m ? d : 0, w = {
|
|
796
796
|
x: p === "left" ? f ? u ? 0 : s : l : p === "right" ? h ? u ? n : l : s : ((f && u ? 0 : l) + (h && u ? n : s)) / 2,
|
|
797
|
-
y:
|
|
797
|
+
y: m ? (a + c) / 2 : y === "top" ? c : a,
|
|
798
798
|
text: e.text,
|
|
799
799
|
fs: x,
|
|
800
800
|
bold: r.bold,
|
|
@@ -802,9 +802,9 @@ function jo(e, t, n) {
|
|
|
802
802
|
vert: y,
|
|
803
803
|
horz: p,
|
|
804
804
|
padV: d,
|
|
805
|
-
padH:
|
|
806
|
-
wrapWidth:
|
|
807
|
-
maxHeight:
|
|
805
|
+
padH: b,
|
|
806
|
+
wrapWidth: m ? (h ? n : s) - (f ? 0 : l) - 2 * b : void 0,
|
|
807
|
+
maxHeight: m ? c - a : void 0
|
|
808
808
|
}, M = G(w);
|
|
809
809
|
if (p === "left" && f || p === "right" && h) {
|
|
810
810
|
const v = f ? 0 : Math.max(l, 0), S = (h ? n : Math.min(s, n)) - v - M.box.width;
|
|
@@ -825,26 +825,26 @@ function qo(e) {
|
|
|
825
825
|
}
|
|
826
826
|
return t;
|
|
827
827
|
}
|
|
828
|
-
function
|
|
828
|
+
function Dr(e, t, n, o) {
|
|
829
829
|
const i = Math.max(1, Math.round(o)), r = Math.max(0, t - e);
|
|
830
830
|
if (n === "Ticks Per Row") {
|
|
831
831
|
const l = Math.floor(e / i) * i;
|
|
832
832
|
return { start: l, tpr: i, count: Math.max(1, Math.ceil((t - l) / i)) };
|
|
833
833
|
}
|
|
834
|
-
return { start: e, ...
|
|
834
|
+
return { start: e, ...Or(r, i) };
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function Or(e, t) {
|
|
837
837
|
const n = (l) => Math.max(1, Math.ceil(e / l)), o = Math.max(1, Math.floor(e / t)), i = Math.max(1, Math.ceil(e / t)), r = Math.abs(n(o) - t) <= Math.abs(n(i) - t) ? o : i;
|
|
838
838
|
return { tpr: r, count: n(r) };
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function _r(e) {
|
|
841
841
|
let t = 0;
|
|
842
842
|
const n = (e.length - 1) / 2;
|
|
843
843
|
for (let o = 1; o < e.length; o++)
|
|
844
844
|
(e[o] > e[t] || e[o] === e[t] && Math.abs(o - n) <= Math.abs(t - n)) && (t = o);
|
|
845
845
|
return t;
|
|
846
846
|
}
|
|
847
|
-
function
|
|
847
|
+
function Hr(e, t, n) {
|
|
848
848
|
let o = 0;
|
|
849
849
|
for (const c of e) o += c;
|
|
850
850
|
const i = o * Math.max(0, Math.min(100, n)) / 100;
|
|
@@ -863,18 +863,18 @@ function _r(e, t, n) {
|
|
|
863
863
|
function eo(e, t, n, o, i, r, l) {
|
|
864
864
|
if (o < n) return null;
|
|
865
865
|
let s = 1 / 0, a = -1 / 0;
|
|
866
|
-
for (let
|
|
867
|
-
const g = Te(e[
|
|
866
|
+
for (let b = n; b <= o; b++) {
|
|
867
|
+
const g = Te(e[b].low, i), w = Te(e[b].high, i);
|
|
868
868
|
g < s && (s = g), w > a && (a = w);
|
|
869
869
|
}
|
|
870
870
|
if (!Number.isFinite(s) || !Number.isFinite(a)) return null;
|
|
871
871
|
let c, f, h;
|
|
872
|
-
"fixedTpr" in r ? (f = Math.max(1, r.fixedTpr), c = Math.floor(s / f) * f, h = Math.max(1, Math.ceil((a - c) / f))) : { start: c, tpr: f, count: h } =
|
|
872
|
+
"fixedTpr" in r ? (f = Math.max(1, r.fixedTpr), c = Math.floor(s / f) * f, h = Math.max(1, Math.ceil((a - c) / f))) : { start: c, tpr: f, count: h } = Dr(s, a, r.layout, r.rowSize);
|
|
873
873
|
const u = new Array(h).fill(0), x = new Array(h).fill(0);
|
|
874
|
-
for (let
|
|
875
|
-
const g = e[
|
|
874
|
+
for (let b = n; b <= o; b++) {
|
|
875
|
+
const g = e[b], w = g.volume ?? 0;
|
|
876
876
|
if (!(w > 0)) continue;
|
|
877
|
-
const M = t[
|
|
877
|
+
const M = t[b] ? u : x, v = Te(g.low, i) - c, k = Te(g.high, i) - c;
|
|
878
878
|
if (k <= v) {
|
|
879
879
|
M[Math.min(h - 1, Math.max(0, Math.floor(v / f)))] += w;
|
|
880
880
|
continue;
|
|
@@ -885,16 +885,16 @@ function eo(e, t, n, o, i, r, l) {
|
|
|
885
885
|
D > z && (M[A] += w * (D - z) / S);
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
|
-
const d = u.map((
|
|
889
|
-
return { lo: c * i, step: f * i, up: u, down: x, poc: p, vaLo: y, vaHi:
|
|
888
|
+
const d = u.map((b, g) => b + x[g]), p = _r(d), [y, m] = Hr(d, p, l);
|
|
889
|
+
return { lo: c * i, step: f * i, up: u, down: x, poc: p, vaLo: y, vaHi: m, boxLo: s * i, boxHi: a * i };
|
|
890
890
|
}
|
|
891
|
-
function
|
|
891
|
+
function Nr(e) {
|
|
892
892
|
return { poc: e.lo + (e.poc + 0.5) * e.step, vah: e.lo + (e.vaHi + 1) * e.step, val: e.lo + e.vaLo * e.step };
|
|
893
893
|
}
|
|
894
|
-
const
|
|
895
|
-
function
|
|
894
|
+
const Yr = [["1", 60], ["5", 300], ["15", 900], ["30", 1800], ["60", 3600], ["240", 14400], ["1D", 86400]];
|
|
895
|
+
function Vr(e, t) {
|
|
896
896
|
if (t || e <= 300) return "1S";
|
|
897
|
-
for (const [n, o] of
|
|
897
|
+
for (const [n, o] of Yr) if (e / o < 5e3) return n;
|
|
898
898
|
return "1D";
|
|
899
899
|
}
|
|
900
900
|
function no(e, t) {
|
|
@@ -913,7 +913,7 @@ function Ue(e, t, n) {
|
|
|
913
913
|
}
|
|
914
914
|
return r;
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Ur(e) {
|
|
917
917
|
const t = e.length;
|
|
918
918
|
if (t < 2) return null;
|
|
919
919
|
let n = 0, o = 0, i = 0, r = 0, l = 0;
|
|
@@ -932,7 +932,7 @@ function Vr(e) {
|
|
|
932
932
|
const h = t * l - o * o, u = h > 1e-12 ? (t * r - n * o) / Math.sqrt(s * h) : 0;
|
|
933
933
|
return { m: a, b: c, sd: Math.sqrt(f / (t - 1)), r: u };
|
|
934
934
|
}
|
|
935
|
-
function
|
|
935
|
+
function Xr(e, t) {
|
|
936
936
|
const [n, o] = e;
|
|
937
937
|
if (o.x <= n.x || t <= o.x) return e;
|
|
938
938
|
const i = (t - n.x) / (o.x - n.x);
|
|
@@ -941,7 +941,7 @@ function Ur(e, t) {
|
|
|
941
941
|
function Zo(e, t, n) {
|
|
942
942
|
const o = e.points[1], i = O(e.points[0].time), r = o ? O(o.time) : null;
|
|
943
943
|
if (!t || i == null || r == null) return null;
|
|
944
|
-
const l = Ue(t.bars(), i, r), s = e.style.regressionSource ?? "close", a =
|
|
944
|
+
const l = Ue(t.bars(), i, r), s = e.style.regressionSource ?? "close", a = Ur(l.map((S) => Ko(S, s)));
|
|
945
945
|
if (!a) return null;
|
|
946
946
|
const c = l.length, f = a.b, h = a.b + a.m * (c - 1);
|
|
947
947
|
let u = -1 / 0, x = -1 / 0;
|
|
@@ -952,15 +952,15 @@ function Zo(e, t, n) {
|
|
|
952
952
|
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) => {
|
|
953
953
|
const I = t.timeToX(S), A = t.priceToY(C);
|
|
954
954
|
return I == null || A == null ? null : { x: I, y: A };
|
|
955
|
-
},
|
|
956
|
-
if (!
|
|
957
|
-
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 ?
|
|
955
|
+
}, m = y(l[0].time, f), b = y(l[c - 1].time, h);
|
|
956
|
+
if (!m || !b) return null;
|
|
957
|
+
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 ? Xr(S, n) : S;
|
|
958
958
|
return {
|
|
959
|
-
center: k([
|
|
959
|
+
center: k([m, b]),
|
|
960
960
|
upper: g && w ? k([g, w]) : null,
|
|
961
961
|
lower: M && v ? k([M, v]) : null,
|
|
962
962
|
pearsons: a.r,
|
|
963
|
-
anchors: i <= r ? [
|
|
963
|
+
anchors: i <= r ? [m, b] : [b, m]
|
|
964
964
|
};
|
|
965
965
|
}
|
|
966
966
|
function Ko(e, t) {
|
|
@@ -997,16 +997,16 @@ function Qo(e, t, n, o) {
|
|
|
997
997
|
if (s && s.key === r) return s.data;
|
|
998
998
|
let a = 0, c = t.length;
|
|
999
999
|
for (; a < c; ) {
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1000
|
+
const m = a + c >> 1, b = O(t[m].time);
|
|
1001
|
+
b != null && b < n ? a = m + 1 : c = m;
|
|
1002
1002
|
}
|
|
1003
1003
|
const f = t.length - a, h = new Float64Array(Math.max(0, f)), u = new Float64Array(Math.max(0, f));
|
|
1004
1004
|
let x = 0, d = 0, p = 0;
|
|
1005
|
-
for (let
|
|
1006
|
-
const
|
|
1005
|
+
for (let m = 0; m < f; m++) {
|
|
1006
|
+
const b = t[a + m], g = Ko(b, o), w = b.volume && b.volume > 0 ? b.volume : 1;
|
|
1007
1007
|
x += g * w, d += g * g * w, p += w;
|
|
1008
1008
|
const M = x / p;
|
|
1009
|
-
h[
|
|
1009
|
+
h[m] = M, u[m] = Math.sqrt(Math.max(0, d / p - M * M));
|
|
1010
1010
|
}
|
|
1011
1011
|
const y = { start: a, vwap: h, sd: u };
|
|
1012
1012
|
return l.set(e.id, { key: r, data: y }), y;
|
|
@@ -1019,11 +1019,11 @@ function io(e, t) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
return n;
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function Gr(e, t) {
|
|
1023
1023
|
var n;
|
|
1024
|
-
return t ? ((n =
|
|
1024
|
+
return t ? ((n = jr(e, t.bars())) == null ? void 0 : n.vwap) ?? null : null;
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function jr(e, t) {
|
|
1027
1027
|
const n = e.points[0] ? O(e.points[0].time) : null;
|
|
1028
1028
|
if (n == null || t.length === 0) return null;
|
|
1029
1029
|
const o = Qo(e, t, n, e.style.vwapSource ?? "hlc3"), i = o.vwap.length - 1;
|
|
@@ -1043,10 +1043,10 @@ function Jo(e, t) {
|
|
|
1043
1043
|
for (let h = a; h < c; h++) {
|
|
1044
1044
|
const u = h - s.start, x = l[h], d = s.vwap[u], p = t.timeToX(x.time), y = t.priceToY(d);
|
|
1045
1045
|
if (!(p == null || y == null) && (o.line.push({ x: p, y }), o.bands.length > 0)) {
|
|
1046
|
-
const
|
|
1047
|
-
for (const
|
|
1048
|
-
const g = t.priceToY(d +
|
|
1049
|
-
g != null &&
|
|
1046
|
+
const m = r ? d * 0.01 : s.sd[u];
|
|
1047
|
+
for (const b of o.bands) {
|
|
1048
|
+
const g = t.priceToY(d + b.level.coeff * m), w = t.priceToY(d - b.level.coeff * m);
|
|
1049
|
+
g != null && b.upper.push({ x: p, y: g }), w != null && b.lower.push({ x: p, y: w });
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
@@ -1062,7 +1062,7 @@ function ti(e, t, n = 32) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
return c;
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function qr(e, t) {
|
|
1066
1066
|
const n = e.points[1];
|
|
1067
1067
|
if (!t || !n) return "waiting";
|
|
1068
1068
|
const o = O(n.time);
|
|
@@ -1082,7 +1082,7 @@ function jr(e, t) {
|
|
|
1082
1082
|
return l ? (n.price > e.points[0].price ? l.high >= n.price : l.low <= n.price) ? "success" : s ? "waiting" : "failure" : "waiting";
|
|
1083
1083
|
}
|
|
1084
1084
|
const ro = /* @__PURE__ */ new WeakMap();
|
|
1085
|
-
function
|
|
1085
|
+
function Zr(e) {
|
|
1086
1086
|
let t = ro.get(e);
|
|
1087
1087
|
return (!t || t.length !== e.length) && (t = qo(e), ro.set(e, t)), t;
|
|
1088
1088
|
}
|
|
@@ -1093,13 +1093,13 @@ function ei(e, t, n, o = {}) {
|
|
|
1093
1093
|
let f = i, h = 0, u = i.length - 1;
|
|
1094
1094
|
const x = o.lower;
|
|
1095
1095
|
if (x) {
|
|
1096
|
-
const g = x.barEnd(c), w = x.bars(
|
|
1096
|
+
const g = x.barEnd(c), w = x.bars(Vr(g - a, x.seconds), a);
|
|
1097
1097
|
if (w && w.length) {
|
|
1098
1098
|
const M = w, v = no(M, a), k = no(M, g) - 1;
|
|
1099
1099
|
k >= v && (f = w, h = v, u = k);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
const d = f === i ? qo(i) :
|
|
1102
|
+
const d = f === i ? qo(i) : Zr(f), p = eo(f, d, h, u, l, s, r);
|
|
1103
1103
|
if (!p) return null;
|
|
1104
1104
|
let y = null;
|
|
1105
1105
|
if (o.developing) {
|
|
@@ -1111,21 +1111,21 @@ function ei(e, t, n, o = {}) {
|
|
|
1111
1111
|
if ((O(f[h].time) ?? 0) >= M) continue;
|
|
1112
1112
|
const v = g === u ? p : eo(f, d, h, g, l, s, r);
|
|
1113
1113
|
if (!v) continue;
|
|
1114
|
-
const k =
|
|
1114
|
+
const k = Nr(v);
|
|
1115
1115
|
y.push({ time: i[w].time, poc: k.poc, vah: k.vah, val: k.val });
|
|
1116
1116
|
}
|
|
1117
1117
|
}
|
|
1118
|
-
const
|
|
1118
|
+
const m = p.up.map((g, w) => ({ up: g, down: p.down[w] })), b = m.map((g) => g.up + g.down);
|
|
1119
1119
|
return {
|
|
1120
1120
|
lo: p.lo,
|
|
1121
|
-
hi: p.lo +
|
|
1121
|
+
hi: p.lo + m.length * p.step,
|
|
1122
1122
|
step: p.step,
|
|
1123
|
-
rows:
|
|
1123
|
+
rows: m,
|
|
1124
1124
|
poc: p.poc,
|
|
1125
1125
|
vaFrom: p.vaLo,
|
|
1126
1126
|
vaTo: p.vaHi,
|
|
1127
|
-
maxTotal: Math.max(...
|
|
1128
|
-
maxDelta: Math.max(...
|
|
1127
|
+
maxTotal: Math.max(...b),
|
|
1128
|
+
maxDelta: Math.max(...m.map((g) => Math.abs(g.up - g.down))),
|
|
1129
1129
|
lastTime: i[i.length - 1].time,
|
|
1130
1130
|
developing: y
|
|
1131
1131
|
};
|
|
@@ -1167,13 +1167,13 @@ function ri(e, t, n, o) {
|
|
|
1167
1167
|
const [i, r] = t, l = (e.style.levels ?? o).filter((M) => M.visible), s = (e.style.vLevels ?? e.style.levels ?? o).filter((M) => M.visible), a = !!e.style.reverse, c = e.points[0], f = e.points[1] ?? e.points[0], h = a ? c.price : f.price, u = a ? f.price - c.price : c.price - f.price, x = a ? i.y : r.y, d = a ? r.y - i.y : i.y - r.y, p = l.map((M) => {
|
|
1168
1168
|
const v = (n == null ? void 0 : n.priceToY(h + M.coeff * u)) ?? x + M.coeff * d;
|
|
1169
1169
|
return { coeff: M.coeff, color: M.color, y: v };
|
|
1170
|
-
}), y = (n == null ? void 0 : n.timeToBarIndex(c.time)) ?? null,
|
|
1170
|
+
}), y = (n == null ? void 0 : n.timeToBarIndex(c.time)) ?? null, m = (n == null ? void 0 : n.timeToBarIndex(f.time)) ?? null, b = a ? i.x : r.x, g = a ? r.x - i.x : i.x - r.x, w = s.map((M) => {
|
|
1171
1171
|
let v = null;
|
|
1172
|
-
if (n && y != null &&
|
|
1173
|
-
const k = n.barIndexToTime(Math.round((a ? y :
|
|
1172
|
+
if (n && y != null && m != null) {
|
|
1173
|
+
const k = n.barIndexToTime(Math.round((a ? y : m) + M.coeff * (a ? m - y : y - m)));
|
|
1174
1174
|
v = k != null ? n.timeToX(k) : null;
|
|
1175
1175
|
}
|
|
1176
|
-
return { coeff: M.coeff, color: M.color, x: v ??
|
|
1176
|
+
return { coeff: M.coeff, color: M.color, x: v ?? b + M.coeff * g };
|
|
1177
1177
|
});
|
|
1178
1178
|
return {
|
|
1179
1179
|
h: p,
|
|
@@ -1187,7 +1187,7 @@ function an(e, t, n, o) {
|
|
|
1187
1187
|
const s = Math.max(1, 2 * (n + o) / l);
|
|
1188
1188
|
return { x: e.x + i * s, y: e.y + r * s };
|
|
1189
1189
|
}
|
|
1190
|
-
const
|
|
1190
|
+
const Kr = ["bars", "oc", "line", "line-open", "line-high", "line-low", "line-hl2"];
|
|
1191
1191
|
function lo(e, t) {
|
|
1192
1192
|
const [n, o, i, r] = e;
|
|
1193
1193
|
switch (t) {
|
|
@@ -1231,7 +1231,7 @@ function li(e, t, n) {
|
|
|
1231
1231
|
if (e.kind !== "bar-pattern" || !n) return null;
|
|
1232
1232
|
const o = ((D = e.pattern) == null ? void 0 : D.bars) ?? [];
|
|
1233
1233
|
if (o.length === 0 || t.length < 2) return null;
|
|
1234
|
-
const i = e.style, [r, l] = t, s =
|
|
1234
|
+
const i = e.style, [r, l] = t, s = Kr.includes(i.patternMode ?? "") ? i.patternMode : "bars";
|
|
1235
1235
|
let a = o;
|
|
1236
1236
|
if (i.mirrored) {
|
|
1237
1237
|
let T = 1 / 0, E = -1 / 0;
|
|
@@ -1239,13 +1239,13 @@ function li(e, t, n) {
|
|
|
1239
1239
|
T = Math.min(T, P[2], P[1]), E = Math.max(E, P[1], P[2]);
|
|
1240
1240
|
if (T < E) {
|
|
1241
1241
|
const P = (T + E) / 2, B = (F) => P - (F - P);
|
|
1242
|
-
a = a.map(([F, Y,
|
|
1242
|
+
a = a.map(([F, Y, Q, xt]) => [B(F), B(Y), B(Q), B(xt)]);
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
i.flipped && (a = [...a].reverse());
|
|
1246
|
-
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 = so(a[0], s, !0, !!i.flipped), p = so(a[a.length - 1], s, !1, !!i.flipped), y = n.priceToY(d),
|
|
1247
|
-
if (u == null || x == null || y == null ||
|
|
1248
|
-
const
|
|
1246
|
+
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 = so(a[0], s, !0, !!i.flipped), p = so(a[a.length - 1], s, !1, !!i.flipped), y = n.priceToY(d), m = n.priceToY(p);
|
|
1247
|
+
if (u == null || x == null || y == null || m == null) return null;
|
|
1248
|
+
const b = m !== y ? +((x - u) / (m - y)).toFixed(8) : 1, g = (T) => (n.priceToY(T) ?? 0) * b, 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)), z = s !== "bars" && s !== "oc";
|
|
1249
1249
|
return z ? { lineMode: z, bars: [], line: a.map((T, E) => ({ x: A[E], y: Math.round(g(lo(T, s)[0])) + I })) } : {
|
|
1250
1250
|
lineMode: z,
|
|
1251
1251
|
line: [],
|
|
@@ -1256,7 +1256,7 @@ function li(e, t, n) {
|
|
|
1256
1256
|
};
|
|
1257
1257
|
}
|
|
1258
1258
|
let ue = null;
|
|
1259
|
-
function
|
|
1259
|
+
function Qr(e, t) {
|
|
1260
1260
|
return ue || (ue = document.createElement("canvas").getContext("2d")), ue ? (ue.font = t, ue.measureText(e).width) : e.length * 8;
|
|
1261
1261
|
}
|
|
1262
1262
|
function si(e, t) {
|
|
@@ -1264,13 +1264,13 @@ function si(e, t) {
|
|
|
1264
1264
|
if (n === "" || e.kind !== "arrow-mark-up" && e.kind !== "arrow-mark-down") return null;
|
|
1265
1265
|
const o = e.style, i = o.fontSize ?? 14, r = i / 3, l = Math.ceil(i), s = n.split(`
|
|
1266
1266
|
`), a = `${o.italic ? "italic " : ""}${o.bold ? "bold " : ""}${i}px ${getComputedStyle(document.body).fontFamily}`;
|
|
1267
|
-
let c = Math.round(Math.max(...s.map((u) =>
|
|
1267
|
+
let c = Math.round(Math.max(...s.map((u) => Qr(u, a))) + 2 * r);
|
|
1268
1268
|
c % 2 && (c += 1);
|
|
1269
1269
|
const f = s.length * l + 2 * r, h = e.kind === "arrow-mark-up" ? t.y + 20 : t.y - 20 - f;
|
|
1270
1270
|
return { left: t.x - c / 2, top: h, width: c, height: f, lines: s, lineH: l, pad: r };
|
|
1271
1271
|
}
|
|
1272
|
-
const Ht = 8, ht = 1,
|
|
1273
|
-
function
|
|
1272
|
+
const Ht = 8, ht = 1, Jr = 2, ci = 120, ai = 1.3, tl = "#2962ff", el = "rgba(41, 98, 255, 0.2)", co = 3, Jt = 1024;
|
|
1273
|
+
function nl(e) {
|
|
1274
1274
|
return Jt + (e.row == null ? 0 : e.row + 1) * Jt + (e.col == null ? 0 : e.col + 1);
|
|
1275
1275
|
}
|
|
1276
1276
|
function fi(e) {
|
|
@@ -1291,19 +1291,19 @@ function Pn(e) {
|
|
|
1291
1291
|
return Array.from({ length: t }, (o, i) => n[i] ?? 0);
|
|
1292
1292
|
}
|
|
1293
1293
|
const hi = (e) => e.fontSize ?? 14, ui = (e) => zt("0", e, !1, !1);
|
|
1294
|
-
function
|
|
1294
|
+
function ol(e) {
|
|
1295
1295
|
return ui(e) + 2 * Ht + 2 * ht;
|
|
1296
1296
|
}
|
|
1297
1297
|
function xi(e) {
|
|
1298
1298
|
return e + 2 * Ht + ht;
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function il(e, t) {
|
|
1301
1301
|
return Math.max(e - 2 * Ht - 2 * ht, ui(t));
|
|
1302
1302
|
}
|
|
1303
1303
|
function di(e, t, n) {
|
|
1304
|
-
return e === "" ? [] : Ve(e, n, !1, !1,
|
|
1304
|
+
return e === "" ? [] : Ve(e, n, !1, !1, il(t, n));
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function rl(e, t) {
|
|
1307
1307
|
return e * t + (e - 1) * t * (ai - 1) + 2 * Ht + 2 * ht;
|
|
1308
1308
|
}
|
|
1309
1309
|
function yi(e, t = Wt(e), n = we(e)) {
|
|
@@ -1311,7 +1311,7 @@ function yi(e, t = Wt(e), n = we(e)) {
|
|
|
1311
1311
|
return { heights: i.map((s, a) => {
|
|
1312
1312
|
var f;
|
|
1313
1313
|
let c = xi(o);
|
|
1314
|
-
for (let h = 0; h < n.length; h++) c = Math.max(c,
|
|
1314
|
+
for (let h = 0; h < n.length; h++) c = Math.max(c, rl(di(((f = t[a]) == null ? void 0 : f[h]) ?? "", n[h], o).length, o));
|
|
1315
1315
|
return r.push(c), Math.max(s, c);
|
|
1316
1316
|
}), mins: r };
|
|
1317
1317
|
}
|
|
@@ -1335,7 +1335,7 @@ function pi(e) {
|
|
|
1335
1335
|
{ x: e.right, y: e.bottom }
|
|
1336
1336
|
];
|
|
1337
1337
|
}
|
|
1338
|
-
function
|
|
1338
|
+
function ll(e, t, n) {
|
|
1339
1339
|
if (n) {
|
|
1340
1340
|
let o = null, i = null;
|
|
1341
1341
|
if (t.x >= e.left && t.x <= e.right) {
|
|
@@ -1366,7 +1366,7 @@ function fn(e, t, n) {
|
|
|
1366
1366
|
const l = r / i, s = e.map((a, c) => Math.max(t[c], a * l));
|
|
1367
1367
|
return o(s) > r + 0.01 ? fn(s, t, n) : s;
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1369
|
+
function sl(e, t, n) {
|
|
1370
1370
|
var a;
|
|
1371
1371
|
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];
|
|
1372
1372
|
if (t === "row") {
|
|
@@ -1379,12 +1379,12 @@ function ll(e, t, n) {
|
|
|
1379
1379
|
}
|
|
1380
1380
|
return { tableCells: o, tableColWidths: i, tableRowHeights: r };
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1382
|
+
function cl(e, t) {
|
|
1383
1383
|
var o;
|
|
1384
1384
|
const n = Wt(e);
|
|
1385
1385
|
return t === "row" ? n.length > 1 : (((o = n[0]) == null ? void 0 : o.length) ?? 0) > 1;
|
|
1386
1386
|
}
|
|
1387
|
-
function
|
|
1387
|
+
function al(e, t, n) {
|
|
1388
1388
|
const o = Wt(e).map((c) => [...c]), i = we(e), r = Pn(e), [l, s] = n;
|
|
1389
1389
|
if (t === "row")
|
|
1390
1390
|
o.splice(l, 1), r.splice(l, 1);
|
|
@@ -1395,23 +1395,23 @@ function cl(e, t, n) {
|
|
|
1395
1395
|
const a = [Math.min(l, o.length - 1), Math.min(s, i.length - 1)];
|
|
1396
1396
|
return { patch: { tableCells: o, tableColWidths: i, tableRowHeights: r }, cell: a };
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1398
|
+
function fl(e, t, n) {
|
|
1399
1399
|
const o = Wt(e).map((i) => [...i]);
|
|
1400
1400
|
return o[t[0]] && (o[t[0]][t[1]] = n), { tableCells: o };
|
|
1401
1401
|
}
|
|
1402
|
-
const
|
|
1403
|
-
let
|
|
1402
|
+
const lf = 2e6, ao = 2e3, sf = { "image/png": "png", "image/jpeg": "jpg", "image/webp": "webp" }, $t = /* @__PURE__ */ new Map();
|
|
1403
|
+
let mi = () => Promise.reject(new Error("no image reader"));
|
|
1404
1404
|
const hn = /* @__PURE__ */ new Set();
|
|
1405
|
-
function
|
|
1406
|
-
|
|
1405
|
+
function cf(e) {
|
|
1406
|
+
mi = e;
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1408
|
+
function hl(e) {
|
|
1409
1409
|
return hn.add(e), () => hn.delete(e);
|
|
1410
1410
|
}
|
|
1411
|
-
function
|
|
1411
|
+
function bi() {
|
|
1412
1412
|
for (const e of hn) e();
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1414
|
+
function ul(e) {
|
|
1415
1415
|
return new Promise((t, n) => {
|
|
1416
1416
|
const o = new Image();
|
|
1417
1417
|
o.onload = () => t({ url: e, width: o.naturalWidth, height: o.naturalHeight }), o.onerror = () => n(new Error("image decode failed")), o.src = e;
|
|
@@ -1420,14 +1420,14 @@ function hl(e) {
|
|
|
1420
1420
|
function zn(e) {
|
|
1421
1421
|
if (!e) return null;
|
|
1422
1422
|
const t = $t.get(e);
|
|
1423
|
-
return t && t !== "loading" && t !== "error" ? t : (t || ($t.set(e, "loading"),
|
|
1423
|
+
return t && t !== "loading" && t !== "error" ? t : (t || ($t.set(e, "loading"), mi(e).then((n) => ul(URL.createObjectURL(n))).then(
|
|
1424
1424
|
(n) => $t.set(e, n),
|
|
1425
1425
|
(n) => {
|
|
1426
1426
|
$t.set(e, "error"), console.warn("[image] read failed:", n);
|
|
1427
1427
|
}
|
|
1428
|
-
).then(
|
|
1428
|
+
).then(bi)), null);
|
|
1429
1429
|
}
|
|
1430
|
-
function
|
|
1430
|
+
function xl(e) {
|
|
1431
1431
|
return !!e && $t.get(e) === "error";
|
|
1432
1432
|
}
|
|
1433
1433
|
function gi(e, t) {
|
|
@@ -1444,15 +1444,15 @@ function wi(e) {
|
|
|
1444
1444
|
{ x: e.right - 1, y: e.bottom - 1 }
|
|
1445
1445
|
];
|
|
1446
1446
|
}
|
|
1447
|
-
const
|
|
1448
|
-
function
|
|
1447
|
+
const dl = [[-1, -1], [1, -1], [-1, 1], [1, 1]];
|
|
1448
|
+
function yl(e, t, n, o) {
|
|
1449
1449
|
const i = Math.min(Math.min(1, n / 4 / e), Math.min(1, o / 4 / t));
|
|
1450
1450
|
return { cssWidth: Math.round(i * e), cssHeight: Math.round(i * t) };
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1453
|
-
(!$t.has(e) || $t.get(e) === "error") && $t.set(e, t),
|
|
1452
|
+
function af(e, t) {
|
|
1453
|
+
(!$t.has(e) || $t.get(e) === "error") && $t.set(e, t), bi();
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const pl = "Add text", ml = {
|
|
1456
1456
|
text: "Text",
|
|
1457
1457
|
note: "Add text",
|
|
1458
1458
|
pin: "Note",
|
|
@@ -1463,7 +1463,7 @@ const yl = "Add text", pl = {
|
|
|
1463
1463
|
};
|
|
1464
1464
|
function bl(e) {
|
|
1465
1465
|
const t = !!(e.text && e.text.length > 0);
|
|
1466
|
-
return { txt: t ? e.text :
|
|
1466
|
+
return { txt: t ? e.text : ml[e.kind] ?? "Text", faint: !t };
|
|
1467
1467
|
}
|
|
1468
1468
|
function Mi(e, t, n, o) {
|
|
1469
1469
|
const { txt: i, faint: r } = bl(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);
|
|
@@ -1471,7 +1471,7 @@ function Mi(e, t, n, o) {
|
|
|
1471
1471
|
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 } };
|
|
1472
1472
|
}
|
|
1473
1473
|
function gt(e) {
|
|
1474
|
-
return e.text ? { text: e.text, faint: !1 } : { text:
|
|
1474
|
+
return e.text ? { text: e.text, faint: !1 } : { text: pl, faint: !0 };
|
|
1475
1475
|
}
|
|
1476
1476
|
function vi(e, t) {
|
|
1477
1477
|
const n = e.style, o = n.fontSize ?? 14, i = o / 6;
|
|
@@ -1494,10 +1494,10 @@ function ki(e, t) {
|
|
|
1494
1494
|
const o = e.style.fontSize ?? 16, i = Math.round(o / 1.3), r = G({ x: t.x, y: t.y, text: gt(e).text, fs: o, vert: "bottom", horz: "left", padV: i, padH: 12 }), l = Math.min(r.box.width, o + 2 * i) / 2;
|
|
1495
1495
|
return { l: r, r: l };
|
|
1496
1496
|
}
|
|
1497
|
-
function
|
|
1497
|
+
function gl(e, t, n, o, [i, r, l, s]) {
|
|
1498
1498
|
return `M ${e + i} ${t} H ${e + n - r} A ${r} ${r} 0 0 1 ${e + n} ${t + r} V ${t + o - l} A ${l} ${l} 0 0 1 ${e + n - l} ${t + o} H ${e + s} A ${s} ${s} 0 0 1 ${e} ${t + o - s} V ${t + i} A ${i} ${i} 0 0 1 ${e + i} ${t} Z`;
|
|
1499
1499
|
}
|
|
1500
|
-
const
|
|
1500
|
+
const wl = "m12 30 .88-.77C20.25 22.73 24 17.07 24 12.09 24 5.04 18.54 0 12 0S0 5.04 0 12.1c0 4.97 3.75 10.64 11.12 17.13L12 30Zm0-13a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z";
|
|
1501
1501
|
function Li(e, t, n) {
|
|
1502
1502
|
const o = e.style, i = o.fontSize ?? 14, r = Math.min(236, n), l = Ve(gt(e).text, i, !!o.bold, !!o.italic, r - 24);
|
|
1503
1503
|
let s = l.length * i + 24;
|
|
@@ -1516,7 +1516,7 @@ function Si(e, t, n) {
|
|
|
1516
1516
|
const o = zt(e, n, !0, !1) + 20, i = n + 10, r = t.x + 9, l = t.y - (i + 15);
|
|
1517
1517
|
return { x: r, y: l, w: o, h: i, fs: n };
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function Ml(e) {
|
|
1520
1520
|
const { x: t, y: n, w: o, h: i } = e, r = 3;
|
|
1521
1521
|
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`;
|
|
1522
1522
|
}
|
|
@@ -1524,13 +1524,13 @@ function Ci(e, t) {
|
|
|
1524
1524
|
const n = e.style, o = n.fontSize ?? 14, i = n.wordWrap ? n.wordWrapWidth ?? 200 : void 0, r = Ve(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;
|
|
1525
1525
|
return { fs: o, lines: r, textW: l, textH: s, x: f, y: h, w: a, h: c, wrap: i };
|
|
1526
1526
|
}
|
|
1527
|
-
function
|
|
1527
|
+
function vl(e, t, n) {
|
|
1528
1528
|
const { x: o, y: i, w: r, h: l, textW: s, textH: a } = e, c = t.x - o, f = t.y - i, h = n.x - o, u = n.y - i;
|
|
1529
1529
|
let x = 0;
|
|
1530
1530
|
t.x > o + r ? x = 20 : t.x > o && (x = 10), t.y > i + l ? x += 2 : t.y > i && (x += 1);
|
|
1531
|
-
const d = s + 4 > 16, p = a + 4 > 16, y = (g, w) => `${o + g} ${i + w}`,
|
|
1532
|
-
let
|
|
1533
|
-
return x === 10 ?
|
|
1531
|
+
const d = s + 4 > 16, p = a + 4 > 16, y = (g, w) => `${o + g} ${i + w}`, m = (g, w) => `A 8 8 0 0 1 ${y(g, w)}`;
|
|
1532
|
+
let b = `M ${y(8, 0)}`;
|
|
1533
|
+
return x === 10 ? b += 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)}` : b += ` L ${y(r - 8, 0)}`, b += x === 20 ? ` L ${y(c, f)} L ${y(r, 8)}` : ` ${m(r, 8)}`, x === 21 ? b += 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)}` : b += ` L ${y(r, l - 8)}`, b += x === 22 ? ` L ${y(c, f)} L ${y(r - 8, l)}` : ` ${m(r - 8, l)}`, x === 12 ? b += 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)}` : b += ` L ${y(8, l)}`, b += x === 2 ? ` L ${y(c, f)} L ${y(0, l - 8)}` : ` ${m(0, l - 8)}`, x === 1 ? b += 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)}` : b += ` L ${y(0, 8)}`, b += x === 0 ? ` L ${y(c, f)} L ${y(8, 0)}` : ` ${m(8, 0)}`, b + " Z";
|
|
1534
1534
|
}
|
|
1535
1535
|
const Dt = { pole: "#808080", labelBg: "#0f0f0f", labelBorder: "#2e2e2e", labelText: "#dbdbdb", plateBorder: "#0f0f0f" };
|
|
1536
1536
|
function Ti(e, t) {
|
|
@@ -1545,7 +1545,7 @@ function Ai(e, t, n) {
|
|
|
1545
1545
|
const s = r === 1 ? l : n - l, a = Math.min(n, Math.abs(i - l));
|
|
1546
1546
|
return s > 0 ? Math.max(0, Math.min(100, 100 * a / s)) * r : 50 * r;
|
|
1547
1547
|
}
|
|
1548
|
-
function
|
|
1548
|
+
function kl(e, t, n, o) {
|
|
1549
1549
|
const i = Math.min(t, Math.max(0, o === 1 ? n : t - n));
|
|
1550
1550
|
return n - o * Math.abs(i * e / 100);
|
|
1551
1551
|
}
|
|
@@ -1564,10 +1564,10 @@ function Wn(e, t, n, o) {
|
|
|
1564
1564
|
wrapWidth: 134,
|
|
1565
1565
|
lineSpacing: 3
|
|
1566
1566
|
});
|
|
1567
|
-
let d =
|
|
1568
|
-
const y = p.box.height,
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1567
|
+
let d = kl(r, o, f, l), p = x(d);
|
|
1568
|
+
const y = p.box.height, m = l === 1 ? Math.min(h - y, d) : Math.max(h + y, d);
|
|
1569
|
+
m !== d && (d = m, p = x(d));
|
|
1570
|
+
const b = i.showImage ? 80 : 0, g = d + (y + b) * l, w = d + (y + 10 + 35) * l, M = i.showImage ? [d + y * l, d + y * l + 10 * l] : null;
|
|
1571
1571
|
return { l: p, anchor: { x: t.x, y: d }, poleStart: h, poleEnd: g, plateY: w, gap: M, n: l, x: t.x };
|
|
1572
1572
|
}
|
|
1573
1573
|
function ho(e, t, n, o) {
|
|
@@ -1584,22 +1584,22 @@ function W(e, t) {
|
|
|
1584
1584
|
return { hit: "handle", handleIndex: n };
|
|
1585
1585
|
return null;
|
|
1586
1586
|
}
|
|
1587
|
-
function
|
|
1588
|
-
const o =
|
|
1587
|
+
function Ll(e, t, n) {
|
|
1588
|
+
const o = bt(e, t);
|
|
1589
1589
|
for (let i = 0; i < 4; i++)
|
|
1590
1590
|
if (Math.hypot(o[i].x - n.x, o[i].y - n.y) <= ot)
|
|
1591
1591
|
return { hit: "handle", handleIndex: i };
|
|
1592
1592
|
return null;
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Sl(e, t, n, o = L) {
|
|
1595
1595
|
const i = e[0];
|
|
1596
1596
|
return Math.hypot(0.9 * n - t.x, i.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.abs(t.y - i.y) <= o ? { hit: "body" } : null;
|
|
1597
1597
|
}
|
|
1598
|
-
function
|
|
1598
|
+
function Cl(e, t, n, o = L) {
|
|
1599
1599
|
const i = e[0];
|
|
1600
1600
|
return Math.hypot(i.x - t.x, 0.9 * n - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.abs(t.x - i.x) <= o ? { hit: "body" } : null;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function Tl(e, t, n = L) {
|
|
1603
1603
|
const o = e[0];
|
|
1604
1604
|
return Math.hypot(o.x - t.x, o.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.abs(t.y - o.y) <= n || Math.abs(t.x - o.x) <= n ? { hit: "body" } : null;
|
|
1605
1605
|
}
|
|
@@ -1607,13 +1607,13 @@ function $i(e, t, n = L) {
|
|
|
1607
1607
|
const o = e[0];
|
|
1608
1608
|
return Math.hypot(o.x - t.x, o.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : t.x >= o.x - ot && Math.abs(t.y - o.y) <= n ? { hit: "body" } : null;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function Al(e, t, n) {
|
|
1611
1611
|
const o = W(t, n);
|
|
1612
1612
|
if (o) return o;
|
|
1613
1613
|
const i = e.style, r = i.extendLeft ? -1 / 0 : Math.min(t[0].x, t[1].x), l = i.extendRight ? 1 / 0 : Math.max(t[0].x, t[1].x), s = Math.min(t[0].y, t[1].y), a = Math.max(t[0].y, t[1].y);
|
|
1614
1614
|
return n.x >= r - L && n.x <= l + L && n.y >= s - L && n.y <= a + L ? { hit: "body" } : null;
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function $l(e, t, n, o, i) {
|
|
1617
1617
|
const r = W(t, n);
|
|
1618
1618
|
if (r) return r;
|
|
1619
1619
|
const l = e.style, s = l.extendLeft ?? e.kind === "extended-line", a = l.extendRight ?? (e.kind === "ray" || e.kind === "extended-line"), [c, f] = t;
|
|
@@ -1629,7 +1629,7 @@ function Bi(e, t, n = L) {
|
|
|
1629
1629
|
const o = W(e, t);
|
|
1630
1630
|
return o || (H(t.x, t.y, e[0], e[1]) <= n ? { hit: "body" } : null);
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function Bl(e, t, n, o) {
|
|
1633
1633
|
if (!e.points[0] || !e.points[1]) return null;
|
|
1634
1634
|
const i = In(e, t, o);
|
|
1635
1635
|
if (!i) return null;
|
|
@@ -1651,7 +1651,7 @@ function Rn(e, t, n, o, i, r, l, s) {
|
|
|
1651
1651
|
const h = e.x - t.x, u = e.y - t.y, x = (h * o.y - u * o.x) / f, d = (a * u - c * h) / f;
|
|
1652
1652
|
return (l || x >= 0) && (s || x <= 1) && d >= Math.min(i, r) && d <= Math.max(i, r);
|
|
1653
1653
|
}
|
|
1654
|
-
function
|
|
1654
|
+
function Il(e, t, n, o, i) {
|
|
1655
1655
|
const r = W(t, n);
|
|
1656
1656
|
if (r) return r;
|
|
1657
1657
|
const l = Uo(e.kind, t);
|
|
@@ -1673,13 +1673,13 @@ function Bl(e, t, n, o, i) {
|
|
|
1673
1673
|
}
|
|
1674
1674
|
return null;
|
|
1675
1675
|
}
|
|
1676
|
-
function
|
|
1676
|
+
function Pl(e, t, n) {
|
|
1677
1677
|
const o = W(t, n);
|
|
1678
1678
|
if (o) return o;
|
|
1679
1679
|
const i = e.style, r = i.extendLeft ? -1 / 0 : Math.min(t[1].x, t[2].x), l = i.extendRight ? 1 / 0 : Math.max(t[1].x, t[2].x), s = Math.min(t[0].y, t[1].y, t[2].y), a = Math.max(t[0].y, t[1].y, t[2].y);
|
|
1680
1680
|
return n.x >= r - L && n.x <= l + L && n.y >= s - L && n.y <= a + L ? { hit: "body" } : null;
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function El(e, t, n, o, i) {
|
|
1683
1683
|
const r = W(t, n);
|
|
1684
1684
|
if (r) return r;
|
|
1685
1685
|
const [l, s] = t, a = (o + i) * 2, c = (e.style.levels ?? vn).filter((f) => f.visible);
|
|
@@ -1689,7 +1689,7 @@ function Pl(e, t, n, o, i) {
|
|
|
1689
1689
|
}
|
|
1690
1690
|
return null;
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1692
|
+
function zl(e, t, n, o) {
|
|
1693
1693
|
const i = W(t, n);
|
|
1694
1694
|
if (i) return i;
|
|
1695
1695
|
const r = t[1].x - t[0].x, l = (e.style.levels ?? Cn).filter((s) => s.visible);
|
|
@@ -1698,7 +1698,7 @@ function El(e, t, n, o) {
|
|
|
1698
1698
|
return { hit: "body" };
|
|
1699
1699
|
return H(n.x, n.y, t[0], t[1]) <= o ? { hit: "body" } : null;
|
|
1700
1700
|
}
|
|
1701
|
-
function
|
|
1701
|
+
function Wl(e, t, n) {
|
|
1702
1702
|
const o = W(t, n);
|
|
1703
1703
|
if (o) return o;
|
|
1704
1704
|
if (e.fmt === 2) {
|
|
@@ -1710,29 +1710,29 @@ function zl(e, t, n) {
|
|
|
1710
1710
|
const i = Math.hypot(t[1].x - t[0].x, t[1].y - t[0].y);
|
|
1711
1711
|
return Math.hypot(n.x - t[0].x, n.y - t[0].y) <= i + L ? { hit: "body" } : null;
|
|
1712
1712
|
}
|
|
1713
|
-
function
|
|
1713
|
+
function Rl(e, t, n, o, i, r) {
|
|
1714
1714
|
const [l, s, a] = t, c = s.x - l.x === 0 ? 0 : (a.x - l.x) / (s.x - l.x), f = a.y - (l.y + (s.y - l.y) * c), h = { x: l.x, y: l.y + f }, u = { x: s.x, y: s.y + f }, x = { x: (l.x + s.x) / 2, y: (l.y + s.y) / 2 }, d = [l, s, h, u, { x: x.x, y: x.y + f }, x], p = W(d, n);
|
|
1715
1715
|
if (p) return p;
|
|
1716
|
-
const y = e.style,
|
|
1717
|
-
if (
|
|
1718
|
-
const
|
|
1719
|
-
for (const g of
|
|
1720
|
-
const w = f * g.coeff, [M, v] = Xe({ x: l.x, y: l.y + w }, { x: s.x, y: s.y + w }, !!y.extendLeft, !!y.extendRight,
|
|
1716
|
+
const y = e.style, m = (y.levels ?? He).filter((g) => g.visible);
|
|
1717
|
+
if (m.length === 0) return null;
|
|
1718
|
+
const b = (i + r) * 2;
|
|
1719
|
+
for (const g of m) {
|
|
1720
|
+
const w = f * g.coeff, [M, v] = Xe({ x: l.x, y: l.y + w }, { x: s.x, y: s.y + w }, !!y.extendLeft, !!y.extendRight, b);
|
|
1721
1721
|
if (H(n.x, n.y, M, v) <= o) return { hit: "body" };
|
|
1722
1722
|
}
|
|
1723
|
-
return y.fillBackground !== !1 && Rn(n, l, s, { x: 0, y: f },
|
|
1723
|
+
return y.fillBackground !== !1 && Rn(n, l, s, { x: 0, y: f }, m[0].coeff, m[m.length - 1].coeff, !!y.extendLeft, !!y.extendRight) ? { hit: "body" } : null;
|
|
1724
1724
|
}
|
|
1725
|
-
function
|
|
1725
|
+
function Fl(e, t, n, o, i, r) {
|
|
1726
1726
|
const [l, s, a] = t, c = { x: s.x, y: a.y }, f = { x: l.x, y: a.y + (s.y - l.y) }, u = W([l, s, c, f], n);
|
|
1727
1727
|
if (u) return u;
|
|
1728
1728
|
const x = e.style, d = (i + r) * 2;
|
|
1729
1729
|
for (const [p, y] of [[l, s], [f, c]]) {
|
|
1730
|
-
const [
|
|
1731
|
-
if (H(n.x, n.y,
|
|
1730
|
+
const [m, b] = Xe(p, y, !!x.extendLeft, !!x.extendRight, d);
|
|
1731
|
+
if (H(n.x, n.y, m, b) <= o) return { hit: "body" };
|
|
1732
1732
|
}
|
|
1733
1733
|
return null;
|
|
1734
1734
|
}
|
|
1735
|
-
function
|
|
1735
|
+
function Dl(e, t, n, o, i, r) {
|
|
1736
1736
|
const l = W(t, n);
|
|
1737
1737
|
if (l) return l;
|
|
1738
1738
|
const [s, a, c] = t, f = e.style, h = (i + r) * 2;
|
|
@@ -1742,7 +1742,7 @@ function Fl(e, t, n, o, i, r) {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
return null;
|
|
1744
1744
|
}
|
|
1745
|
-
function
|
|
1745
|
+
function Ol(e, t, n, o, i, r) {
|
|
1746
1746
|
const l = W(t, n);
|
|
1747
1747
|
if (l) return l;
|
|
1748
1748
|
const [s, a, c] = t;
|
|
@@ -1756,7 +1756,7 @@ function Dl(e, t, n, o, i, r) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
return f.fillBackground === !1 ? null : Rn(n, s, a, h, Math.min(...u), Math.max(...u), !!f.extendLeft, !!f.extendRight) ? { hit: "body" } : null;
|
|
1758
1758
|
}
|
|
1759
|
-
function
|
|
1759
|
+
function _l(e, t) {
|
|
1760
1760
|
const n = W(e, t);
|
|
1761
1761
|
if (n) return n;
|
|
1762
1762
|
const [o, i, r] = e;
|
|
@@ -1765,7 +1765,7 @@ function Ol(e, t) {
|
|
|
1765
1765
|
return (p / (a + L)) ** 2 + (y / (u + L)) ** 2 <= 1 ? { hit: "body" } : null;
|
|
1766
1766
|
}
|
|
1767
1767
|
function Ii(e, t) {
|
|
1768
|
-
const [n, o, i, r] =
|
|
1768
|
+
const [n, o, i, r] = bt(e, t);
|
|
1769
1769
|
return [
|
|
1770
1770
|
{ x: (n.x + o.x) / 2, y: n.y },
|
|
1771
1771
|
{ x: o.x, y: (o.y + i.y) / 2 },
|
|
@@ -1774,7 +1774,7 @@ function Ii(e, t) {
|
|
|
1774
1774
|
];
|
|
1775
1775
|
}
|
|
1776
1776
|
function un(e, t, n = !1) {
|
|
1777
|
-
const [o, i] = e, r =
|
|
1777
|
+
const [o, i] = e, r = Ll(o, i, t);
|
|
1778
1778
|
if (r) return r;
|
|
1779
1779
|
if (n) {
|
|
1780
1780
|
const f = Ii(o, i);
|
|
@@ -1785,13 +1785,13 @@ function un(e, t, n = !1) {
|
|
|
1785
1785
|
const l = Math.min(o.x, i.x), s = Math.max(o.x, i.x), a = Math.min(o.y, i.y), c = Math.max(o.y, i.y);
|
|
1786
1786
|
return t.x >= l - L && t.x <= s + L && t.y >= a - L && t.y <= c + L ? { hit: "body" } : null;
|
|
1787
1787
|
}
|
|
1788
|
-
function
|
|
1788
|
+
function Hl(e, t) {
|
|
1789
1789
|
const n = W(e, t);
|
|
1790
1790
|
if (n) return n;
|
|
1791
1791
|
const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y);
|
|
1792
1792
|
return Math.hypot(t.x - o.x, t.y - o.y) <= r + L ? { hit: "body" } : null;
|
|
1793
1793
|
}
|
|
1794
|
-
function
|
|
1794
|
+
function Nl(e, t, n, o) {
|
|
1795
1795
|
const i = W(t, n);
|
|
1796
1796
|
if (i) return i;
|
|
1797
1797
|
const r = e.style.extendLeft ? 0 : Math.min(t[0].x, t[1].x), l = e.style.extendRight ? o : Math.max(t[0].x, t[1].x), s = Math.min(t[0].y, t[1].y), a = Math.max(t[0].y, t[1].y);
|
|
@@ -1803,11 +1803,11 @@ function uo(e, t) {
|
|
|
1803
1803
|
const o = Math.min(e[0].x, e[1].x), i = Math.max(e[0].x, e[1].x), r = Math.min(e[0].y, e[1].y), l = Math.max(e[0].y, e[1].y);
|
|
1804
1804
|
return t.x >= o - L && t.x <= i + L && t.y >= r - L && t.y <= l + L ? { hit: "body" } : null;
|
|
1805
1805
|
}
|
|
1806
|
-
function
|
|
1806
|
+
function Yl(e, t, n) {
|
|
1807
1807
|
const o = e.fmt === 2, i = _o(t, o), r = o ? [t[0], t[1], ...i] : t, l = W(r, n);
|
|
1808
1808
|
return l || (Qt(n.x, n.y, i) ? { hit: "body" } : null);
|
|
1809
1809
|
}
|
|
1810
|
-
function
|
|
1810
|
+
function Vl(e, t) {
|
|
1811
1811
|
const n = W(e, t);
|
|
1812
1812
|
return n || (Qt(t.x, t.y, e) ? { hit: "body" } : null);
|
|
1813
1813
|
}
|
|
@@ -1817,7 +1817,7 @@ function te(e, t, n = L) {
|
|
|
1817
1817
|
return { hit: "body" };
|
|
1818
1818
|
return null;
|
|
1819
1819
|
}
|
|
1820
|
-
function
|
|
1820
|
+
function Ul(e, t, n, o, i = L) {
|
|
1821
1821
|
const r = W(t, n);
|
|
1822
1822
|
if (r) return r;
|
|
1823
1823
|
const l = li(e, t, o);
|
|
@@ -1834,7 +1834,7 @@ function Vl(e, t, n, o, i = L) {
|
|
|
1834
1834
|
if (Math.abs(n.x - s.x) <= 1 + i && n.y >= s.top - i && n.y <= s.bottom + i) return { hit: "body" };
|
|
1835
1835
|
return null;
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function Xl(e, t, n, o) {
|
|
1838
1838
|
const i = W(t, n);
|
|
1839
1839
|
if (i) return i;
|
|
1840
1840
|
const r = t[0], l = o === "up" ? r.y : r.y - 22;
|
|
@@ -1842,7 +1842,7 @@ function Ul(e, t, n, o) {
|
|
|
1842
1842
|
const s = si(e, r);
|
|
1843
1843
|
return s && n.x >= s.left && n.x <= s.left + s.width && n.y >= s.top && n.y <= s.top + s.height ? { hit: "body" } : null;
|
|
1844
1844
|
}
|
|
1845
|
-
function
|
|
1845
|
+
function Gl(e, t, n, o, i) {
|
|
1846
1846
|
const r = W(t, n);
|
|
1847
1847
|
if (r) return r;
|
|
1848
1848
|
const [l, s] = t, a = ri(e, t, i, Ee), c = Math.max(o, Math.abs(s.y - l.y) + Math.max(l.y, s.y)), f = [...a.h.map((x) => ({ x: s.x, y: x.y })), ...a.v.map((x) => ({ x: x.x, y: s.y }))];
|
|
@@ -1855,7 +1855,7 @@ function Xl(e, t, n, o, i) {
|
|
|
1855
1855
|
if (H(n.x, n.y, x, d) <= L) return { hit: "body" };
|
|
1856
1856
|
return null;
|
|
1857
1857
|
}
|
|
1858
|
-
function
|
|
1858
|
+
function jl(e, t, n, o) {
|
|
1859
1859
|
const i = W(t, n);
|
|
1860
1860
|
if (i) return i;
|
|
1861
1861
|
const [r, l, s] = t;
|
|
@@ -1864,12 +1864,12 @@ function Gl(e, t, n, o) {
|
|
|
1864
1864
|
for (const x of u)
|
|
1865
1865
|
h.push({ x: a.x + c.x * x.coeff, y: a.y + c.y * x.coeff }), h.push({ x: a.x - c.x * x.coeff, y: a.y - c.y * x.coeff });
|
|
1866
1866
|
for (const x of h) {
|
|
1867
|
-
const d = x.x - r.x, p = x.y - r.y, y = Math.hypot(d, p) || 1,
|
|
1868
|
-
if (H(n.x, n.y, r,
|
|
1867
|
+
const d = x.x - r.x, p = x.y - r.y, y = Math.hypot(d, p) || 1, m = { x: r.x + d / y * f, y: r.y + p / y * f };
|
|
1868
|
+
if (H(n.x, n.y, r, m) <= L) return { hit: "body" };
|
|
1869
1869
|
}
|
|
1870
1870
|
return H(n.x, n.y, l, s) <= L ? { hit: "body" } : null;
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1872
|
+
function ql(e, t, n, o, i) {
|
|
1873
1873
|
const r = W(t, n);
|
|
1874
1874
|
if (r) return r;
|
|
1875
1875
|
const [l, s, a] = t;
|
|
@@ -1880,7 +1880,7 @@ function jl(e, t, n, o, i) {
|
|
|
1880
1880
|
if (Math.abs(n.x - f.x) <= Math.max(o, (f.width ?? 1) / 2 + 2)) return { hit: "body" };
|
|
1881
1881
|
return null;
|
|
1882
1882
|
}
|
|
1883
|
-
function
|
|
1883
|
+
function Zl(e, t, n) {
|
|
1884
1884
|
const o = W(t, n);
|
|
1885
1885
|
if (o) return o;
|
|
1886
1886
|
const i = No(e, t);
|
|
@@ -1888,7 +1888,7 @@ function ql(e, t, n) {
|
|
|
1888
1888
|
const r = Yo(i);
|
|
1889
1889
|
return n.x >= r.left - L && n.x <= r.right + L && n.y >= r.top - L && n.y <= r.bottom + L ? { hit: "body" } : null;
|
|
1890
1890
|
}
|
|
1891
|
-
function
|
|
1891
|
+
function Kl(e, t) {
|
|
1892
1892
|
const n = W(e, t);
|
|
1893
1893
|
if (n) return n;
|
|
1894
1894
|
const [o, i, r] = e;
|
|
@@ -1905,7 +1905,7 @@ function Zl(e, t) {
|
|
|
1905
1905
|
for (; h < -Math.PI; ) h += 2 * Math.PI;
|
|
1906
1906
|
return (c >= 0 ? h >= -0.05 && h <= c + 0.05 : h <= 0.05 && h >= c - 0.05) && f <= l + L ? { hit: "body" } : null;
|
|
1907
1907
|
}
|
|
1908
|
-
function
|
|
1908
|
+
function Ql(e, t, n) {
|
|
1909
1909
|
const o = W(t, n);
|
|
1910
1910
|
if (o) return o;
|
|
1911
1911
|
const [i, r, l] = t;
|
|
@@ -1929,7 +1929,7 @@ function Kl(e, t, n) {
|
|
|
1929
1929
|
}
|
|
1930
1930
|
return null;
|
|
1931
1931
|
}
|
|
1932
|
-
function
|
|
1932
|
+
function Jl(e, t, n) {
|
|
1933
1933
|
const o = W(t, n);
|
|
1934
1934
|
if (o) return o;
|
|
1935
1935
|
const [i, r] = t, l = Math.hypot(r.x - i.x, r.y - i.y);
|
|
@@ -1977,8 +1977,8 @@ function zi(e, t, n) {
|
|
|
1977
1977
|
if (c < 1) return null;
|
|
1978
1978
|
const f = a < 0 ? -1 : 1, h = 1 - Math.sqrt(3) / 2, u = c / (r * h), x = [];
|
|
1979
1979
|
for (let d = 0; d <= 48; d++) {
|
|
1980
|
-
const p = 2 * Math.PI / 3 - d / 48 * (Math.PI / 3), y = r / 2 + r * Math.cos(p),
|
|
1981
|
-
x.push({ x: e.x + l * y - s *
|
|
1980
|
+
const p = 2 * Math.PI / 3 - d / 48 * (Math.PI / 3), y = r / 2 + r * Math.cos(p), m = f * u * r * (Math.sin(p) - Math.sqrt(3) / 2);
|
|
1981
|
+
x.push({ x: e.x + l * y - s * m, y: e.y + s * y + l * m });
|
|
1982
1982
|
}
|
|
1983
1983
|
return x;
|
|
1984
1984
|
}
|
|
@@ -1993,10 +1993,10 @@ function dn(e, t = !1, n = !1) {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
return f;
|
|
1995
1995
|
}
|
|
1996
|
-
const
|
|
1996
|
+
const ts = /* @__PURE__ */ new Set([
|
|
1997
1997
|
"triangle-pattern"
|
|
1998
1998
|
]);
|
|
1999
|
-
function
|
|
1999
|
+
function es(e, t, n) {
|
|
2000
2000
|
const o = W(t, n);
|
|
2001
2001
|
if (o) return o;
|
|
2002
2002
|
const i = Ye(e.style);
|
|
@@ -2004,7 +2004,7 @@ function ts(e, t, n) {
|
|
|
2004
2004
|
if (H(n.x, n.y, t[r - 1], t[r]) <= i) return { hit: "body" };
|
|
2005
2005
|
if (e.kind === "xabcd-pattern" || e.kind === "cypher-pattern")
|
|
2006
2006
|
return t.length >= 3 && Qt(n.x, n.y, [t[0], t[1], t[2]]) ? { hit: "body" } : t.length >= 5 && Qt(n.x, n.y, [t[2], t[3], t[4]]) ? { hit: "body" } : null;
|
|
2007
|
-
if (
|
|
2007
|
+
if (ts.has(e.kind) && t.length >= 3 && Qt(n.x, n.y, t))
|
|
2008
2008
|
return { hit: "body" };
|
|
2009
2009
|
if (e.kind === "polyline" && e.closed === !0 && e.style.fillBackground !== !1 && t.length >= 2) {
|
|
2010
2010
|
if (H(n.x, n.y, t[t.length - 1], t[0]) <= i) return { hit: "body" };
|
|
@@ -2012,7 +2012,7 @@ function ts(e, t, n) {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
return null;
|
|
2014
2014
|
}
|
|
2015
|
-
function
|
|
2015
|
+
function ns(e, t, n = L) {
|
|
2016
2016
|
if (e.length === 0) return null;
|
|
2017
2017
|
const o = e.length - 1;
|
|
2018
2018
|
return Math.hypot(e[0].x - t.x, e[0].y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.hypot(e[o].x - t.x, e[o].y - t.y) <= ot ? { hit: "handle", handleIndex: o } : te(e, t, n);
|
|
@@ -2021,7 +2021,7 @@ function de(e, t, n, o = L) {
|
|
|
2021
2021
|
const i = W(t, n);
|
|
2022
2022
|
return i || te(e, n, o);
|
|
2023
2023
|
}
|
|
2024
|
-
function
|
|
2024
|
+
function os(e, t, n, o) {
|
|
2025
2025
|
const i = W(e, t);
|
|
2026
2026
|
if (i) return i;
|
|
2027
2027
|
const [r, l] = e, s = l.x - r.x;
|
|
@@ -2030,7 +2030,7 @@ function ns(e, t, n, o) {
|
|
|
2030
2030
|
if (Math.abs(t.x - a) <= o) return { hit: "body" };
|
|
2031
2031
|
return H(t.x, t.y, r, l) <= o ? { hit: "body" } : null;
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function is(e, t, n, o) {
|
|
2034
2034
|
const i = W(e, t);
|
|
2035
2035
|
if (i) return i;
|
|
2036
2036
|
const [r, l] = e, s = Math.abs(l.x - r.x);
|
|
@@ -2044,7 +2044,7 @@ function os(e, t, n, o) {
|
|
|
2044
2044
|
}
|
|
2045
2045
|
return null;
|
|
2046
2046
|
}
|
|
2047
|
-
function
|
|
2047
|
+
function rs(e, t, n, o) {
|
|
2048
2048
|
var s;
|
|
2049
2049
|
const i = W(t, n);
|
|
2050
2050
|
if (i) return i;
|
|
@@ -2052,7 +2052,7 @@ function is(e, t, n, o) {
|
|
|
2052
2052
|
const r = (o == null ? void 0 : o.pipSize()) ?? 0.01, l = (s = Go(e, t, Math.max(0, Math.min(8, Math.round(-Math.log10(r)))))) == null ? void 0 : s.box;
|
|
2053
2053
|
return l && n.x >= l.left && n.x <= l.left + l.width && n.y >= l.top && n.y <= l.top + l.height ? { hit: "body" } : null;
|
|
2054
2054
|
}
|
|
2055
|
-
function
|
|
2055
|
+
function ls(e, t, n, o, i) {
|
|
2056
2056
|
const r = Zo(e, i, o), l = W(r ? r.anchors : t, n);
|
|
2057
2057
|
if (l) return l;
|
|
2058
2058
|
if (!r) return Bi(t, n);
|
|
@@ -2062,7 +2062,7 @@ function rs(e, t, n, o, i) {
|
|
|
2062
2062
|
return { hit: "body" };
|
|
2063
2063
|
return null;
|
|
2064
2064
|
}
|
|
2065
|
-
function
|
|
2065
|
+
function ss(e, t, n, o) {
|
|
2066
2066
|
if (Math.hypot(t[0].x - n.x, t[0].y - n.y) <= ot)
|
|
2067
2067
|
return { hit: "handle", handleIndex: 0 };
|
|
2068
2068
|
const i = Jo(e, o);
|
|
@@ -2075,15 +2075,15 @@ function ls(e, t, n, o) {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
return null;
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function cs(e, t, n = L) {
|
|
2079
2079
|
const o = W(e, t);
|
|
2080
2080
|
return o || te(ti(e[0], e[1]), t, n);
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function as(e, t) {
|
|
2083
2083
|
const n = e[0];
|
|
2084
2084
|
return Math.hypot(n.x - t.x, n.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : t.x >= n.x - L && t.x <= n.x + 17 + L && t.y >= n.y - 22 - L && t.y <= n.y + L ? { hit: "body" } : null;
|
|
2085
2085
|
}
|
|
2086
|
-
function
|
|
2086
|
+
function fs(e, t, n, o) {
|
|
2087
2087
|
if (!e.ghost) return un(t, n);
|
|
2088
2088
|
const i = W(t, n);
|
|
2089
2089
|
if (i) return i;
|
|
@@ -2096,28 +2096,28 @@ function as(e, t, n, o) {
|
|
|
2096
2096
|
if (H(n.x, n.y, t[l - 1], t[l]) <= r) return { hit: "body" };
|
|
2097
2097
|
return null;
|
|
2098
2098
|
}
|
|
2099
|
-
function
|
|
2099
|
+
function hs(e, t, n, o, i, r, l = !1) {
|
|
2100
2100
|
var a;
|
|
2101
2101
|
const s = Ye(e.style);
|
|
2102
2102
|
switch (e.kind) {
|
|
2103
2103
|
case "horizontal-line":
|
|
2104
|
-
return
|
|
2104
|
+
return Sl(t, n, o, s);
|
|
2105
2105
|
case "horizontal-ray":
|
|
2106
2106
|
return $i(t, n, s);
|
|
2107
2107
|
case "vertical-line":
|
|
2108
|
-
return
|
|
2108
|
+
return Cl(t, n, i, s);
|
|
2109
2109
|
case "cross-line":
|
|
2110
|
-
return
|
|
2110
|
+
return Tl(t, n, s);
|
|
2111
2111
|
case "arrow-mark-up":
|
|
2112
2112
|
case "arrow-mark-down":
|
|
2113
|
-
return
|
|
2113
|
+
return Xl(e, t, n, e.kind === "arrow-mark-up" ? "up" : "down");
|
|
2114
2114
|
case "font-icon":
|
|
2115
|
-
return
|
|
2115
|
+
return Tr(t, n);
|
|
2116
2116
|
case "table": {
|
|
2117
2117
|
const c = En(e, t[0]), f = W(pi(c), n);
|
|
2118
2118
|
if (f) return f;
|
|
2119
|
-
const h =
|
|
2120
|
-
return h ? "edge" in h ? { hit: "handle", handleIndex:
|
|
2119
|
+
const h = ll(c, n, l);
|
|
2120
|
+
return h ? "edge" in h ? { hit: "handle", handleIndex: nl(h.edge) } : { hit: "body", cell: h.cell } : null;
|
|
2121
2121
|
}
|
|
2122
2122
|
case "image": {
|
|
2123
2123
|
const c = gi(e, t[0]);
|
|
@@ -2132,56 +2132,56 @@ function fs(e, t, n, o, i, r, l = !1) {
|
|
|
2132
2132
|
return Ot(n, { left: f.x, top: f.y, width: f.w, height: f.h }) ? { hit: "body" } : null;
|
|
2133
2133
|
}
|
|
2134
2134
|
case "flag-mark":
|
|
2135
|
-
return
|
|
2135
|
+
return as(t, n);
|
|
2136
2136
|
case "trend-line":
|
|
2137
2137
|
case "ray":
|
|
2138
2138
|
case "extended-line":
|
|
2139
2139
|
case "info-line":
|
|
2140
2140
|
case "arrow":
|
|
2141
2141
|
case "trend-angle":
|
|
2142
|
-
return
|
|
2142
|
+
return $l(e, t, n, o, i);
|
|
2143
2143
|
case "arrow-marker":
|
|
2144
2144
|
return Bi(t, n, s);
|
|
2145
2145
|
case "position-forecast":
|
|
2146
|
-
return
|
|
2146
|
+
return cs(t, n, s);
|
|
2147
2147
|
case "long-position":
|
|
2148
2148
|
case "short-position":
|
|
2149
|
-
return
|
|
2149
|
+
return Bl(e, t, n, r);
|
|
2150
2150
|
case "bar-pattern":
|
|
2151
|
-
return
|
|
2151
|
+
return Ul(e, t, n, r, s);
|
|
2152
2152
|
case "ghost-feed":
|
|
2153
|
-
return
|
|
2153
|
+
return fs(e, t, n, r);
|
|
2154
2154
|
case "gann-box":
|
|
2155
2155
|
return un(t, n);
|
|
2156
2156
|
case "gann-fan":
|
|
2157
|
-
return
|
|
2157
|
+
return El(e, t, n, o, i);
|
|
2158
2158
|
case "fib-time-zone":
|
|
2159
|
-
return
|
|
2159
|
+
return zl(e, t, n, s);
|
|
2160
2160
|
case "fib-circles":
|
|
2161
|
-
return
|
|
2161
|
+
return Wl(e, t, n);
|
|
2162
2162
|
case "fib-speed-resistance-fan":
|
|
2163
|
-
return
|
|
2163
|
+
return Gl(e, t, n, o, r);
|
|
2164
2164
|
case "pitchfan":
|
|
2165
|
-
return
|
|
2165
|
+
return jl(e, t, n, o);
|
|
2166
2166
|
case "fib-wedge":
|
|
2167
|
-
return
|
|
2167
|
+
return Ql(e, t, n);
|
|
2168
2168
|
case "trend-based-fib-time":
|
|
2169
|
-
return
|
|
2169
|
+
return ql(e, t, n, s, r);
|
|
2170
2170
|
case "gann-square-fixed":
|
|
2171
2171
|
case "gann-square":
|
|
2172
|
-
return
|
|
2172
|
+
return Zl(e, t, n);
|
|
2173
2173
|
case "sector":
|
|
2174
|
-
return
|
|
2174
|
+
return Kl(t, n);
|
|
2175
2175
|
case "fib-speed-resistance-arcs":
|
|
2176
|
-
return
|
|
2176
|
+
return Jl(e, t, n);
|
|
2177
2177
|
case "fib-spiral":
|
|
2178
2178
|
return de(Pi(t[0], t[1], !!e.style.counterclockwise), t, n, s);
|
|
2179
2179
|
case "sine-line":
|
|
2180
2180
|
return de(Ei(t[0], t[1], o), t, n, s);
|
|
2181
2181
|
case "time-cycles":
|
|
2182
|
-
return
|
|
2182
|
+
return is(t, n, o, s);
|
|
2183
2183
|
case "cyclic-lines":
|
|
2184
|
-
return
|
|
2184
|
+
return os(t, n, o, s);
|
|
2185
2185
|
case "curve":
|
|
2186
2186
|
return de(
|
|
2187
2187
|
xn(t, !!e.style.extendLeft, !!e.style.extendRight),
|
|
@@ -2231,13 +2231,13 @@ function fs(e, t, n, o, i, r, l = !1) {
|
|
|
2231
2231
|
return c || (t[1] && H(n.x, n.y, t[0], t[1]) <= L ? { hit: "body" } : t[1] && Ot(n, Mi(e, e.style, t[0], t[1]).box) ? { hit: "body" } : null);
|
|
2232
2232
|
}
|
|
2233
2233
|
case "price-note":
|
|
2234
|
-
return
|
|
2234
|
+
return rs(e, t, n, r);
|
|
2235
2235
|
case "callout": {
|
|
2236
2236
|
const c = Ci(e, t[1]);
|
|
2237
2237
|
return Math.hypot(t[0].x - n.x, t[0].y - n.y) <= ot ? { hit: "handle", handleIndex: 0 } : l && c.wrap != null && Math.hypot(t[1].x + c.wrap / 2 + 10 - n.x, t[1].y - n.y) <= ot ? { hit: "handle", handleIndex: 1 } : Ot(n, { left: c.x, top: c.y, width: c.w, height: c.h }) ? { hit: "body" } : null;
|
|
2238
2238
|
}
|
|
2239
2239
|
case "regression-trend":
|
|
2240
|
-
return
|
|
2240
|
+
return ls(e, t, n, o, r);
|
|
2241
2241
|
case "fixed-range-volume-profile": {
|
|
2242
2242
|
const c = W(t, n);
|
|
2243
2243
|
if (c) return c;
|
|
@@ -2251,7 +2251,7 @@ function fs(e, t, n, o, i, r, l = !1) {
|
|
|
2251
2251
|
return f && n.x >= f.left && n.x <= f.right && n.y >= f.top && n.y <= f.bottom ? { hit: "body" } : null;
|
|
2252
2252
|
}
|
|
2253
2253
|
case "anchored-vwap":
|
|
2254
|
-
return
|
|
2254
|
+
return ss(e, t, n, r);
|
|
2255
2255
|
case "abcd-pattern":
|
|
2256
2256
|
case "xabcd-pattern":
|
|
2257
2257
|
case "cypher-pattern":
|
|
@@ -2265,29 +2265,29 @@ function fs(e, t, n, o, i, r, l = !1) {
|
|
|
2265
2265
|
case "elliott-triple-combo":
|
|
2266
2266
|
case "polyline":
|
|
2267
2267
|
case "path":
|
|
2268
|
-
return
|
|
2268
|
+
return es(e, t, n);
|
|
2269
2269
|
case "brush":
|
|
2270
2270
|
case "highlighter":
|
|
2271
|
-
return
|
|
2271
|
+
return ns(t, n, s);
|
|
2272
2272
|
case "parallel-channel":
|
|
2273
|
-
return Wl(e, t, n, s, o, i);
|
|
2274
|
-
case "disjoint-channel":
|
|
2275
2273
|
return Rl(e, t, n, s, o, i);
|
|
2276
|
-
case "
|
|
2274
|
+
case "disjoint-channel":
|
|
2277
2275
|
return Fl(e, t, n, s, o, i);
|
|
2276
|
+
case "flat-top-bottom":
|
|
2277
|
+
return Dl(e, t, n, s, o, i);
|
|
2278
2278
|
case "pitchfork":
|
|
2279
2279
|
case "schiff-pitchfork":
|
|
2280
2280
|
case "modified-schiff-pitchfork":
|
|
2281
2281
|
case "inside-pitchfork":
|
|
2282
|
-
return
|
|
2282
|
+
return Il(e, t, n, o, i);
|
|
2283
2283
|
case "fib-channel":
|
|
2284
|
-
return
|
|
2284
|
+
return Ol(e, t, n, s, o, i);
|
|
2285
2285
|
case "rotated-rectangle":
|
|
2286
|
-
return
|
|
2286
|
+
return Yl(e, t, n);
|
|
2287
2287
|
case "trend-based-fib-extension":
|
|
2288
|
-
return
|
|
2288
|
+
return Pl(e, t, n);
|
|
2289
2289
|
case "fib-retracement":
|
|
2290
|
-
return
|
|
2290
|
+
return Al(e, t, n);
|
|
2291
2291
|
case "rectangle": {
|
|
2292
2292
|
const c = (r == null ? void 0 : r.timeAxis().width) || o, f = un(t, n, !0);
|
|
2293
2293
|
if (f) return f;
|
|
@@ -2299,20 +2299,20 @@ function fs(e, t, n, o, i, r, l = !1) {
|
|
|
2299
2299
|
return h && n.x >= h.left && n.x <= h.left + h.width && n.y >= h.top && n.y <= h.top + h.height ? { hit: "body" } : null;
|
|
2300
2300
|
}
|
|
2301
2301
|
case "circle":
|
|
2302
|
-
return
|
|
2302
|
+
return Hl(t, n);
|
|
2303
2303
|
case "ellipse":
|
|
2304
|
-
return
|
|
2304
|
+
return _l(t, n);
|
|
2305
2305
|
case "price-range":
|
|
2306
|
-
return
|
|
2306
|
+
return Nl(e, t, n, o);
|
|
2307
2307
|
case "date-range":
|
|
2308
2308
|
return uo(t, n);
|
|
2309
2309
|
case "date-and-price-range":
|
|
2310
2310
|
return uo(t, n);
|
|
2311
2311
|
case "triangle":
|
|
2312
|
-
return
|
|
2312
|
+
return Vl(t, n);
|
|
2313
2313
|
}
|
|
2314
2314
|
}
|
|
2315
|
-
function
|
|
2315
|
+
function us(e) {
|
|
2316
2316
|
const t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((o) => o + o).join("") : t;
|
|
2317
2317
|
return [parseInt(n.slice(0, 2), 16), parseInt(n.slice(2, 4), 16), parseInt(n.slice(4, 6), 16)];
|
|
2318
2318
|
}
|
|
@@ -2326,10 +2326,10 @@ function ct(e) {
|
|
|
2326
2326
|
}
|
|
2327
2327
|
function Lt(e, t) {
|
|
2328
2328
|
if (t >= 100) return e;
|
|
2329
|
-
const [n, o, i] =
|
|
2329
|
+
const [n, o, i] = us(e);
|
|
2330
2330
|
return `rgba(${n}, ${o}, ${i}, ${(t / 100).toFixed(2)})`;
|
|
2331
2331
|
}
|
|
2332
|
-
function
|
|
2332
|
+
function xs(e) {
|
|
2333
2333
|
let t = 0, n = 0, o = 0;
|
|
2334
2334
|
const i = e.match(/^#([0-9a-f]{6})/i);
|
|
2335
2335
|
if (i) {
|
|
@@ -2341,8 +2341,8 @@ function us(e) {
|
|
|
2341
2341
|
}
|
|
2342
2342
|
return 0.199 * t + 0.687 * n + 0.114 * o >= 150 ? "#000000" : "#ffffff";
|
|
2343
2343
|
}
|
|
2344
|
-
const Gt = (e, t) => ({ ...e, back: t, color:
|
|
2345
|
-
function
|
|
2344
|
+
const Gt = (e, t) => ({ ...e, back: t, color: xs(t) });
|
|
2345
|
+
function ds(e, t, n) {
|
|
2346
2346
|
const o = e.style, i = [], r = [];
|
|
2347
2347
|
if ((e.kind === "vertical-line" || e.kind === "cross-line") && o.showTime && e.points[0] && r.push(Gt({ time: e.points[0].time }, ct(o.color).hex)), e.kind === "long-position" || e.kind === "short-position") {
|
|
2348
2348
|
if (o.showPriceLabels !== !1) {
|
|
@@ -2356,7 +2356,7 @@ function xs(e, t, n) {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
if (e.kind === "anchored-vwap") {
|
|
2358
2358
|
if (o.vwapPriceLabel !== !1) {
|
|
2359
|
-
const l =
|
|
2359
|
+
const l = Gr(e, n);
|
|
2360
2360
|
l != null && i.push(Gt({ price: l }, ct(o.color).hex));
|
|
2361
2361
|
}
|
|
2362
2362
|
return { price: i, time: r };
|
|
@@ -2373,11 +2373,11 @@ function st(e, t) {
|
|
|
2373
2373
|
const n = Wi();
|
|
2374
2374
|
return n ? (We ?? (We = getComputedStyle(document.body).fontFamily), n.font = `${t}px ${We}`, n.measureText(e).width) : e.length * t * 0.6;
|
|
2375
2375
|
}
|
|
2376
|
-
function
|
|
2376
|
+
function ys(e, t) {
|
|
2377
2377
|
const n = Wi();
|
|
2378
2378
|
return n ? (We ?? (We = getComputedStyle(document.body).fontFamily), n.font = `bold ${t}px ${We}`, n.measureText(e).width) : e.length * t * 0.65;
|
|
2379
2379
|
}
|
|
2380
|
-
function
|
|
2380
|
+
function mt(e, t) {
|
|
2381
2381
|
const n = Math.abs(e).toFixed(t);
|
|
2382
2382
|
return e < 0 ? `−${n}` : n;
|
|
2383
2383
|
}
|
|
@@ -2395,7 +2395,7 @@ function Fn(e) {
|
|
|
2395
2395
|
const s = l.join(" ");
|
|
2396
2396
|
return t ? `-${s}` : s;
|
|
2397
2397
|
}
|
|
2398
|
-
function
|
|
2398
|
+
function ps(e) {
|
|
2399
2399
|
const t = [[1e9, " B"], [1e6, " M"], [1e3, " K"]];
|
|
2400
2400
|
for (const [n, o] of t) if (Math.abs(e) >= n) return `${Number((e / n).toFixed(2))}${o}`;
|
|
2401
2401
|
return String(Math.round(e));
|
|
@@ -2404,8 +2404,8 @@ function Me(e) {
|
|
|
2404
2404
|
return e.length % 2 === 1 && e[Math.floor(e.length / 2)].trim() !== "";
|
|
2405
2405
|
}
|
|
2406
2406
|
function Ri(e, t, n, o, i, r, l, s, a, c, f) {
|
|
2407
|
-
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),
|
|
2408
|
-
return [
|
|
2407
|
+
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), m = Math.sin(p), b = (g, w) => ({ x: (g - e.x) * y - (w - e.y) * m + e.x, y: (g - e.x) * m + (w - e.y) * y + e.y });
|
|
2408
|
+
return [b(x, d), b(x + h, d), b(x + h, d + u), b(x, d + u)];
|
|
2409
2409
|
}
|
|
2410
2410
|
function U(e, t, n, o) {
|
|
2411
2411
|
return {
|
|
@@ -2433,9 +2433,9 @@ function Fi(e, t, n, o, i, r) {
|
|
|
2433
2433
|
const s = i.vertLabelsAlign ?? "bottom", a = i.horzLabelsAlign ?? "left", c = s === "middle";
|
|
2434
2434
|
let f, h;
|
|
2435
2435
|
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 }];
|
|
2436
|
-
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,
|
|
2437
|
-
`), M = Math.ceil(
|
|
2438
|
-
return { u: d, angle: y, fs:
|
|
2436
|
+
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, m = i.fontSize ?? 14, b = m / 3, g = r ?? (c ? b : 0), w = l.split(`
|
|
2437
|
+
`), M = Math.ceil(m), v = w.length * M + 2 * b, 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";
|
|
2438
|
+
return { u: d, angle: y, fs: m, lines: w, lineH: M, top: k + b, x: S, anchor: C, vert: s, horz: a, padV: b, padH: g };
|
|
2439
2439
|
}
|
|
2440
2440
|
function Ge(e, t, n, o, i, r) {
|
|
2441
2441
|
const l = Fi(e, t, n, o, i, r);
|
|
@@ -2475,7 +2475,7 @@ const Yt = {
|
|
|
2475
2475
|
// close point, stop, target (line-tool-risk-reward)
|
|
2476
2476
|
single: [0]
|
|
2477
2477
|
// horizontal line, vertical line, signpost pole
|
|
2478
|
-
},
|
|
2478
|
+
}, ms = 50, bs = {
|
|
2479
2479
|
price: "M3 2h11v1H3V2Zm5.5 1.8.35.35 2 2 .36.35-.71.7-.35-.35L9 5.71v6.58l1.15-1.14.35-.36.7.71-.35.35-2 2-.35.36-.35-.36-2-2-.36-.35.71-.7.35.35L8 12.29V5.71L6.85 6.85l-.35.36-.7-.71.35-.35 2-2 .35-.36ZM3.5 16H3v-1h11v1H3.5Z",
|
|
2480
2480
|
bars: "M2 3v2H1v9h1v2h1v-2h1V5H3V3H2Zm6.2 4.5-.35.35L6.71 9h4.58l-1.14-1.15-.36-.35.71-.7.35.35 2 2 .36.35-.36.35-2 2-.35.36-.7-.71.35-.35L11.29 10H6.71l1.14 1.15.36.35-.71.7-.35-.35-2-2-.36-.35.36-.35 2-2 .35-.36.7.71ZM3 6H2v7h1V6Zm12-2.5V3h1v2h1v9h-1v2h-1v-2h-1V5h1V3.5ZM15 6h1v7h-1V6Z",
|
|
2481
2481
|
angle: "M8.55 2.78 2.7 15H15v-1h-4.01a6.2 6.2 0 0 0-1.36-3.95 7.94 7.94 0 0 0-2.57-1.83l2.4-5-.91-.44ZM6.63 9.12 4.29 14H10a5.18 5.18 0 0 0-1.12-3.3 6.93 6.93 0 0 0-2.24-1.58Z"
|
|
@@ -2488,13 +2488,13 @@ function Oi(e, t, n, o, i, r) {
|
|
|
2488
2488
|
const d = [];
|
|
2489
2489
|
if (o.showPriceRange || o.showPercentPriceRange) {
|
|
2490
2490
|
const p = [];
|
|
2491
|
-
if (o.showPriceRange && p.push(
|
|
2492
|
-
const y = l.price !== 0 ? `${
|
|
2491
|
+
if (o.showPriceRange && p.push(mt(c, h)), o.showPercentPriceRange) {
|
|
2492
|
+
const y = l.price !== 0 ? `${mt(c / Math.abs(l.price) * 100, 2)}%` : "";
|
|
2493
2493
|
y && p.push(o.showPriceRange ? `(${y})` : y);
|
|
2494
2494
|
}
|
|
2495
2495
|
d.push(p.join(" "));
|
|
2496
2496
|
}
|
|
2497
|
-
o.showPipsPriceRange && d.push(
|
|
2497
|
+
o.showPipsPriceRange && d.push(mt(Math.round(c / f), 0)), a.push({ icon: "price", text: d.join(", ") });
|
|
2498
2498
|
}
|
|
2499
2499
|
const u = r && !!o.showDateTimeRange, x = r && !!o.showDistance;
|
|
2500
2500
|
if (o.showBarsRange || u || x) {
|
|
@@ -2504,8 +2504,8 @@ function Oi(e, t, n, o, i, r) {
|
|
|
2504
2504
|
d += `${p != null && y != null ? y - p : 0} bars`;
|
|
2505
2505
|
}
|
|
2506
2506
|
if (u) {
|
|
2507
|
-
const p = O(l.time), y = O(s.time),
|
|
2508
|
-
|
|
2507
|
+
const p = O(l.time), y = O(s.time), m = p != null && y != null ? Fn(y - p) : "";
|
|
2508
|
+
m && (d += o.showBarsRange ? ` (${m})` : m);
|
|
2509
2509
|
}
|
|
2510
2510
|
x && (d += (d ? ", " : "") + `distance: ${Math.round(Math.hypot(n.x - t.x, n.y - t.y))} px`), d && a.push({ icon: "bars", text: d });
|
|
2511
2511
|
}
|
|
@@ -2532,20 +2532,20 @@ function _i(e, t, n, o, i, r) {
|
|
|
2532
2532
|
};
|
|
2533
2533
|
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;
|
|
2534
2534
|
}
|
|
2535
|
-
function
|
|
2535
|
+
function gs(e, t, n, o) {
|
|
2536
2536
|
return e.x === t.x && e.y === t.y ? e.x >= 0 && e.x <= n && e.y >= 0 && e.y <= o : _i(e, t, 0, 0, n, o);
|
|
2537
2537
|
}
|
|
2538
2538
|
function Hi(e, t, n, o, i, r, l) {
|
|
2539
2539
|
if (!i || n.length === 0) return [];
|
|
2540
2540
|
const s = o === 3;
|
|
2541
|
-
if (s && !
|
|
2541
|
+
if (s && !gs(e, t, r, l)) return [];
|
|
2542
2542
|
const a = 12, c = 18, f = 8, h = 12;
|
|
2543
2543
|
let x = Math.max(...n.map((k) => st(k.text, a))) + h * 2 + c + h;
|
|
2544
2544
|
Math.round(x) % 2 !== 0 && (x = Math.round(x) + 1);
|
|
2545
|
-
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,
|
|
2546
|
-
let
|
|
2547
|
-
s && (e.x !== t.x || e.y !== t.y) && (
|
|
2548
|
-
const w = Math.floor(
|
|
2545
|
+
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, m = t.y < e.y && t.x < e.x || t.y > e.y && t.x > e.x;
|
|
2546
|
+
let b = y.x + 12, g = m ? y.y - 12 - d : y.y + 12;
|
|
2547
|
+
s && (e.x !== t.x || e.y !== t.y) && (b < 0 ? b = 0 : b + x > r && (b = r - x), g < 0 ? g = 0 : g + d > l && (g = l - d), _i(e, t, b, g, x, d) && (g = m ? p.y + 12 : p.y - 12 - d, b = Math.min(p.x, r) - x));
|
|
2548
|
+
const w = Math.floor(b), M = Math.floor(g), v = [{ t: "rect", x: w, y: M, w: x, h: d, rx: 4, ry: 4, fill: "#464646", fillOpacity: 230 / 255 }];
|
|
2549
2549
|
return n.forEach((k, S) => {
|
|
2550
2550
|
const C = M + h + S * (c + f);
|
|
2551
2551
|
v.push({ t: "path", d: bs[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" });
|
|
@@ -2586,7 +2586,7 @@ function On(e, t, n, o, i, r, l, s, a) {
|
|
|
2586
2586
|
}];
|
|
2587
2587
|
return o.showMiddlePoint && s && u.push({ t: "anchors", pts: [{ x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 }] }), u.push(...Ge(t, n, t, n, Ni(o), (o.fontSize ?? 14) / 3)), u.push(...Hi(t, n, c, f, h, i, r)), u;
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function ws(e, t, n) {
|
|
2590
2590
|
if (!n.text) return null;
|
|
2591
2591
|
const o = n.horzLabelsAlign ?? "center";
|
|
2592
2592
|
return G({
|
|
@@ -2601,7 +2601,7 @@ function gs(e, t, n) {
|
|
|
2601
2601
|
offsetX: o === "right" ? 3 : 0
|
|
2602
2602
|
});
|
|
2603
2603
|
}
|
|
2604
|
-
function
|
|
2604
|
+
function Ms(e, t, n) {
|
|
2605
2605
|
if (!n.text) return null;
|
|
2606
2606
|
const o = n.horzLabelsAlign ?? "center", i = { y: e.y, text: n.text, fs: n.fontSize ?? 12, bold: n.bold, italic: n.italic, vert: n.vertLabelsAlign ?? "top", horz: o };
|
|
2607
2607
|
if (o === "right") {
|
|
@@ -2614,8 +2614,8 @@ function _n(e, t) {
|
|
|
2614
2614
|
return e && t === "middle" && Me(e.lines) ? e.poly : null;
|
|
2615
2615
|
}
|
|
2616
2616
|
const St = (e, t) => ({ t: "hit", a: e, b: t, width: 12 }), Yi = (e) => (e.lineStyle ?? "solid") === "solid" ? "round" : "butt";
|
|
2617
|
-
function
|
|
2618
|
-
const i = e[0], r =
|
|
2617
|
+
function vs(e, t, n, o) {
|
|
2618
|
+
const i = e[0], r = ws(i.y, n, o), l = ie("cut", _n(r, o.vertLabelsAlign ?? "middle"));
|
|
2619
2619
|
return [
|
|
2620
2620
|
St({ x: 0, y: i.y }, { x: n, y: i.y }),
|
|
2621
2621
|
...l.items,
|
|
@@ -2625,7 +2625,7 @@ function Ms(e, t, n, o) {
|
|
|
2625
2625
|
...t ? [{ t: "anchors", pts: [{ x: 0.9 * n, y: i.y }], squares: Yt.single }] : []
|
|
2626
2626
|
];
|
|
2627
2627
|
}
|
|
2628
|
-
function
|
|
2628
|
+
function ks(e, t, n, o) {
|
|
2629
2629
|
var h;
|
|
2630
2630
|
const i = e[0], r = o.vertLabelsAlign ?? "middle", l = o.horzLabelsAlign ?? "center", s = o.textOrientation === "horizontal", a = r === "top" ? n : r === "middle" ? n / 2 : 0, c = o.text ? G(s ? {
|
|
2631
2631
|
x: i.x,
|
|
@@ -2657,7 +2657,7 @@ function vs(e, t, n, o) {
|
|
|
2657
2657
|
...t ? [{ t: "anchors", pts: [{ x: i.x, y: 0.9 * n }], squares: Yt.single }] : []
|
|
2658
2658
|
];
|
|
2659
2659
|
}
|
|
2660
|
-
function
|
|
2660
|
+
function Ls(e, t, n, o, i) {
|
|
2661
2661
|
const r = e[0], l = R(i);
|
|
2662
2662
|
return [
|
|
2663
2663
|
St({ x: 0, y: r.y }, { x: n, y: r.y }),
|
|
@@ -2678,17 +2678,17 @@ function xo(e, t, n, o, i, r, l, s) {
|
|
|
2678
2678
|
];
|
|
2679
2679
|
}
|
|
2680
2680
|
function Ae(e, t, n, o, i, r, l, s, a, c) {
|
|
2681
|
-
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,
|
|
2681
|
+
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, m = (o + i) * 2, b = l ? { x: f.x - p * m, y: f.y - y * m } : f, g = s ? { x: h.x + p * m, y: h.y + y * m } : h, w = ie("cut", Dn(f, h, r));
|
|
2682
2682
|
return [
|
|
2683
2683
|
St(f, h),
|
|
2684
2684
|
...w.items,
|
|
2685
|
-
{ t: "line", a:
|
|
2685
|
+
{ t: "line", a: b, b: g, stroke: r.color, strokeWidth: r.width, dash: R(r), clip: w.clip },
|
|
2686
2686
|
...On(e, f, h, r, o, i, a, c, w.clip),
|
|
2687
2687
|
...n ? [{ t: "anchors", pts: t }] : []
|
|
2688
2688
|
];
|
|
2689
2689
|
}
|
|
2690
|
-
function
|
|
2691
|
-
const i = e[0], r =
|
|
2690
|
+
function Ss(e, t, n, o) {
|
|
2691
|
+
const i = e[0], r = Ms(i, n, o), l = ie("cut", _n(r, o.vertLabelsAlign ?? "top"));
|
|
2692
2692
|
return [
|
|
2693
2693
|
St(i, { x: n, y: i.y }),
|
|
2694
2694
|
...l.items,
|
|
@@ -2697,7 +2697,7 @@ function Ls(e, t, n, o) {
|
|
|
2697
2697
|
...t ? [{ t: "anchors", pts: [i] }] : []
|
|
2698
2698
|
];
|
|
2699
2699
|
}
|
|
2700
|
-
function
|
|
2700
|
+
function Cs(e, t, n, o, i, r, l, s) {
|
|
2701
2701
|
if (e.kind !== "info-line") return [];
|
|
2702
2702
|
const [a, c] = t, f = ie("cut", Dn(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;
|
|
2703
2703
|
return [
|
|
@@ -2708,8 +2708,8 @@ function Ss(e, t, n, o, i, r, l, s) {
|
|
|
2708
2708
|
...n ? [{ t: "anchors", pts: t }] : []
|
|
2709
2709
|
];
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2712
|
-
const [a, c] = t, f = c.x - a.x, h = c.y - a.y, u = r.angle ?? Math.atan2(-h, f) * 180 / Math.PI, x = u * Math.PI / 180, d =
|
|
2711
|
+
function Ts(e, t, n, o, i, r, l, s) {
|
|
2712
|
+
const [a, c] = t, f = c.x - a.x, h = c.y - a.y, u = r.angle ?? Math.atan2(-h, f) * 180 / Math.PI, x = u * Math.PI / 180, d = ms, p = { x: a.x + d * Math.cos(x), y: a.y - d * Math.sin(x) }, y = `M ${a.x} ${a.y} L ${a.x + d} ${a.y} A ${d} ${d} 0 ${Math.abs(x) > Math.PI ? 1 : 0} ${x > 0 ? 0 : 1} ${p.x} ${p.y}`, m = r.fontSize ?? 12, b = Math.hypot(f, h) || 1, g = (o + i) * 2, w = r.extendLeft ? { x: a.x - f / b * g, y: a.y - h / b * g } : a, M = r.extendRight ? { x: c.x + f / b * g, y: c.y + h / b * g } : c;
|
|
2713
2713
|
return [
|
|
2714
2714
|
St(a, c),
|
|
2715
2715
|
{ t: "line", a: w, b: M, stroke: r.color, strokeWidth: r.width, dash: R(r), cap: Yi(r) },
|
|
@@ -2717,10 +2717,10 @@ function Cs(e, t, n, o, i, r, l, s) {
|
|
|
2717
2717
|
{ t: "path", d: y, fill: "none", stroke: r.color, strokeWidth: 1, dash: "1 2", inert: !0 },
|
|
2718
2718
|
{
|
|
2719
2719
|
t: "text",
|
|
2720
|
-
x: a.x + d + 5 +
|
|
2720
|
+
x: a.x + d + 5 + m / 3,
|
|
2721
2721
|
y: a.y,
|
|
2722
2722
|
text: `${Math.round(u * 100) / 100}º`,
|
|
2723
|
-
size:
|
|
2723
|
+
size: m,
|
|
2724
2724
|
anchor: "start",
|
|
2725
2725
|
baseline: "central",
|
|
2726
2726
|
weight: r.bold ? 700 : 400,
|
|
@@ -2737,7 +2737,7 @@ function Cs(e, t, n, o, i, r, l, s) {
|
|
|
2737
2737
|
function Ct(e, t) {
|
|
2738
2738
|
return (e.levels ?? t).filter((n) => n.visible).slice().sort((n, o) => n.coeff - o.coeff);
|
|
2739
2739
|
}
|
|
2740
|
-
function
|
|
2740
|
+
function K(e) {
|
|
2741
2741
|
return e.fillBackground === !1 ? 0 : Math.max(0, Math.min(1, (100 - (e.transparency ?? 80)) / 100));
|
|
2742
2742
|
}
|
|
2743
2743
|
function wt(e, t) {
|
|
@@ -2753,32 +2753,32 @@ function Re(e, t, n, o, i) {
|
|
|
2753
2753
|
r: o ? { x: t.x + r / s * i, y: t.y + l / s * i } : t
|
|
2754
2754
|
};
|
|
2755
2755
|
}
|
|
2756
|
-
function
|
|
2756
|
+
function As(e) {
|
|
2757
2757
|
const [t, n, o] = e, i = n.x - t.x === 0 ? 0 : (o.x - t.x) / (n.x - t.x), r = o.y - (t.y + (n.y - t.y) * i), l = { x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 };
|
|
2758
2758
|
return {
|
|
2759
2759
|
anchors: [t, n, { x: t.x, y: t.y + r }, { x: n.x, y: n.y + r }, { x: l.x, y: l.y + r }, l],
|
|
2760
2760
|
dy: r
|
|
2761
2761
|
};
|
|
2762
2762
|
}
|
|
2763
|
-
function
|
|
2763
|
+
function $s(e) {
|
|
2764
2764
|
const [t, n, o] = e, i = { x: n.x, y: o.y }, r = { x: t.x, y: o.y + (n.y - t.y) };
|
|
2765
2765
|
return { anchors: [t, n, i, r], P: i, A: r };
|
|
2766
2766
|
}
|
|
2767
|
-
function
|
|
2767
|
+
function Bs(e, t, n, o, i) {
|
|
2768
2768
|
const r = (i.vertLabelsAlign ?? "bottom") === "middle", l = r ? 0 : o.length > 0 ? o[0].coeff : 0, s = r ? 1 : o.length > 0 ? o[o.length - 1].coeff : 0;
|
|
2769
2769
|
return { e: { x: e.x, y: e.y + n * l }, t: { x: t.x, y: t.y + n * l }, i: { x: e.x, y: e.y + n * s }, n: { x: t.x, y: t.y + n * s } };
|
|
2770
2770
|
}
|
|
2771
|
-
function
|
|
2772
|
-
const [r, l] = e, { anchors: s, dy: a } =
|
|
2773
|
-
y &&
|
|
2774
|
-
const w = h(c[g].coeff), M = h(
|
|
2775
|
-
|
|
2771
|
+
function Is(e, t, n, o, i) {
|
|
2772
|
+
const [r, l] = e, { anchors: s, dy: a } = As(e), c = (n.levels ?? He).filter((b) => b.visible), f = (o + i) * 2, h = (b) => Re({ x: r.x, y: r.y + a * b }, { x: l.x, y: l.y + a * b }, !!n.extendLeft, !!n.extendRight, f), u = K(n), x = n.backgroundColor ?? n.color, d = Bs(r, l, a, c, n), p = Di(d.e, d.t, d.i, d.n, n, void 0, !0), y = p && p.length ? "cut" : void 0, m = [];
|
|
2773
|
+
y && m.push({ t: "clip", name: y, polys: [p] }), c.slice(1).forEach((b, g) => {
|
|
2774
|
+
const w = h(c[g].coeff), M = h(b.coeff);
|
|
2775
|
+
m.push({ t: "polygon", pts: [w.l, w.r, M.r, M.l], fill: x, fillOpacity: u, stroke: "transparent" });
|
|
2776
2776
|
});
|
|
2777
|
-
for (const
|
|
2778
|
-
const g = h(
|
|
2779
|
-
|
|
2777
|
+
for (const b of c) {
|
|
2778
|
+
const g = h(b.coeff);
|
|
2779
|
+
m.push({ t: "hit", a: g.l, b: g.r, width: 12 }), m.push({ t: "line", a: g.l, b: g.r, stroke: b.color, strokeWidth: wt(b, n), dash: Mt(b, n), clip: y });
|
|
2780
2780
|
}
|
|
2781
|
-
return
|
|
2781
|
+
return m.push(...Ge(d.e, d.t, d.i, d.n, n)), t && m.push({ t: "anchors", pts: s, squares: Yt.parallelChannel }), m;
|
|
2782
2782
|
}
|
|
2783
2783
|
function yo(e, t, n, o, i) {
|
|
2784
2784
|
const r = (s, a, c) => G({ x: s.x, y: s.y, text: c, fs: i.priceLabelFontSize ?? 12, bold: i.priceLabelBold, italic: i.priceLabelItalic, vert: "middle", horz: s.x > a.x ? "left" : "right", offsetX: 6, padH: 0, padV: 0 }), l = i.priceLabelTextColor ?? i.color;
|
|
@@ -2789,24 +2789,24 @@ function yo(e, t, n, o, i) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
function Vi(e, t, n, o, i, r, l, s, a, c, f) {
|
|
2791
2791
|
var g, w;
|
|
2792
|
-
const h = (a + c) * 2, u = Re(t, n, !!s.extendLeft, !!s.extendRight, h), x = Re(o, i, !!s.extendLeft, !!s.extendRight, h), d = R(s), p = (s.lineStyle ?? "solid") === "solid" ? "round" : "butt", y = Math.max(0, Math.min(8, Math.round(-Math.log10((f == null ? void 0 : f.pipSize()) ?? 0.01)))),
|
|
2793
|
-
return s.fillBackground !== !1 &&
|
|
2792
|
+
const h = (a + c) * 2, u = Re(t, n, !!s.extendLeft, !!s.extendRight, h), x = Re(o, i, !!s.extendLeft, !!s.extendRight, h), d = R(s), p = (s.lineStyle ?? "solid") === "solid" ? "round" : "butt", y = Math.max(0, Math.min(8, Math.round(-Math.log10((f == null ? void 0 : f.pipSize()) ?? 0.01)))), m = (M) => M.toFixed(y), b = [];
|
|
2793
|
+
return s.fillBackground !== !1 && b.push({ t: "polygon", pts: [u.l, u.r, x.r, x.l], fill: s.backgroundColor ?? s.color, fillOpacity: K(s), stroke: "transparent" }), b.push(
|
|
2794
2794
|
{ t: "hit", a: t, b: n, width: 12 },
|
|
2795
2795
|
{ t: "hit", a: o, b: i, width: 12 },
|
|
2796
2796
|
{ t: "line", a: u.l, b: u.r, stroke: s.color, strokeWidth: s.width, dash: d, cap: p },
|
|
2797
2797
|
{ t: "line", a: x.l, b: x.r, stroke: s.color, strokeWidth: s.width, dash: d, cap: p }
|
|
2798
|
-
), s.leftEnd === 1 &&
|
|
2798
|
+
), s.leftEnd === 1 && b.push(...Bt(n, t, s), ...Bt(i, o, s)), s.rightEnd === 1 && b.push(...Bt(t, n, s), ...Bt(o, i, s)), s.showPrices && (b.push(...yo(t, n, m(((g = e.points[0]) == null ? void 0 : g.price) ?? 0), m(((w = e.points[1]) == null ? void 0 : w.price) ?? 0), s)), b.push(...yo(i, o, m(r), m(l), s))), b;
|
|
2799
2799
|
}
|
|
2800
|
-
function
|
|
2800
|
+
function Ps(e, t, n, o, i, r, l) {
|
|
2801
2801
|
var x, d;
|
|
2802
|
-
const [s, a] = t, { anchors: c, P: f, A: h } =
|
|
2802
|
+
const [s, a] = t, { anchors: c, P: f, A: h } = $s(t), u = ((x = e.points[2]) == null ? void 0 : x.price) ?? e.points[0].price;
|
|
2803
2803
|
return [
|
|
2804
2804
|
...Vi(e, s, a, h, f, u, u + ((((d = e.points[1]) == null ? void 0 : d.price) ?? 0) - e.points[0].price), o, i, r, l),
|
|
2805
2805
|
...Ge(s, a, h, f, o),
|
|
2806
2806
|
...n ? [{ t: "anchors", pts: c, squares: Yt.disjointChannel }] : []
|
|
2807
2807
|
];
|
|
2808
2808
|
}
|
|
2809
|
-
function
|
|
2809
|
+
function Es(e, t, n, o, i, r, l) {
|
|
2810
2810
|
var x;
|
|
2811
2811
|
const [s, a, c] = t, f = { x: s.x, y: c.y }, h = { x: a.x, y: c.y }, u = ((x = e.points[2]) == null ? void 0 : x.price) ?? e.points[0].price;
|
|
2812
2812
|
return [
|
|
@@ -2832,7 +2832,7 @@ function Yn(e, t) {
|
|
|
2832
2832
|
return n.length ? { items: [{ t: "clip", name: e, polys: n }], clip: e } : { items: [], clip: void 0 };
|
|
2833
2833
|
}
|
|
2834
2834
|
function Nt(e, t, n, o = !1) {
|
|
2835
|
-
const i = n.fibTrendLine ?? (o ?
|
|
2835
|
+
const i = n.fibTrendLine ?? (o ? Mr : wr);
|
|
2836
2836
|
return i.visible ? [{ t: "line", a: e, b: t, stroke: i.color, strokeWidth: i.width, dash: R({ ...n, lineStyle: i.style }), cap: i.style === "solid" ? "round" : "butt", inert: !0 }] : [];
|
|
2837
2837
|
}
|
|
2838
2838
|
function Ui(e, t, n, o, i, r, l, s, a) {
|
|
@@ -2854,23 +2854,23 @@ function Xi(e, t, n, o, i) {
|
|
|
2854
2854
|
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 };
|
|
2855
2855
|
}) : [];
|
|
2856
2856
|
}
|
|
2857
|
-
function
|
|
2857
|
+
function ff(e, t, n, o, i) {
|
|
2858
2858
|
const r = e.style;
|
|
2859
2859
|
let l = null, s = 0, a = 0;
|
|
2860
2860
|
if (e.kind === "fib-retracement" && t.length >= 2) {
|
|
2861
|
-
const [p, y] = t,
|
|
2861
|
+
const [p, y] = t, m = e.points[0].price, b = e.points[1].price;
|
|
2862
2862
|
s = r.extendLeft ? 0 : Math.min(p.x, y.x), a = r.extendRight ? o : Math.max(p.x, y.x);
|
|
2863
|
-
const g = !!r.fibLevelsBasedOnLogScale && !!(i != null && i.isLog()) &&
|
|
2864
|
-
const k = r.reverse ?
|
|
2863
|
+
const g = !!r.fibLevelsBasedOnLogScale && !!(i != null && i.isLog()) && m > 0 && b > 0, w = (v) => {
|
|
2864
|
+
const k = r.reverse ? m : b, S = r.reverse ? b : m;
|
|
2865
2865
|
return g ? Math.exp(Math.log(k) + v * (Math.log(S) - Math.log(k))) : k + v * (S - k);
|
|
2866
2866
|
}, M = (v) => r.reverse ? p.y + (y.y - p.y) * v : y.y + (p.y - y.y) * v;
|
|
2867
2867
|
l = (v) => g ? M(v) : (i == null ? void 0 : i.priceToY(w(v))) ?? M(v);
|
|
2868
2868
|
} else if (e.kind === "trend-based-fib-extension" && t.length >= 3 && e.points.length >= 3) {
|
|
2869
|
-
const [, p, y] = t,
|
|
2869
|
+
const [, p, y] = t, m = e.points[0].price, b = e.points[1].price, g = e.points[2].price, w = r.reverse ? m - b : b - m, M = r.reverse ? t[0].y - t[1].y : t[1].y - t[0].y;
|
|
2870
2870
|
s = r.extendLeft ? 0 : Math.min(p.x, y.x), a = r.extendRight ? o : Math.max(p.x, y.x);
|
|
2871
|
-
const v = !!r.fibLevelsBasedOnLogScale && !!(i != null && i.isLog()) &&
|
|
2871
|
+
const v = !!r.fibLevelsBasedOnLogScale && !!(i != null && i.isLog()) && m > 0 && b > 0 && g > 0, k = (C) => {
|
|
2872
2872
|
if (!v) return g + w * C;
|
|
2873
|
-
const I = r.reverse ? Math.log(
|
|
2873
|
+
const I = r.reverse ? Math.log(m) - Math.log(b) : Math.log(b) - Math.log(m);
|
|
2874
2874
|
return Math.exp(Math.log(g) + C * I);
|
|
2875
2875
|
}, S = (C) => y.y + M * C;
|
|
2876
2876
|
l = (C) => v ? S(C) : (i == null ? void 0 : i.priceToY(k(C))) ?? S(C);
|
|
@@ -2880,52 +2880,52 @@ function af(e, t, n, o, i) {
|
|
|
2880
2880
|
let f = null;
|
|
2881
2881
|
if (c.forEach((p, y) => {
|
|
2882
2882
|
if (!p.visible) return;
|
|
2883
|
-
const
|
|
2884
|
-
|
|
2883
|
+
const m = l(p.coeff), b = Math.abs(n.y - m);
|
|
2884
|
+
b <= 6 && (!f || b < f.dist) && (f = { index: y, y: m, dist: b });
|
|
2885
2885
|
}), !f) return null;
|
|
2886
2886
|
const { index: h, y: u } = f, x = r.horzTextAlign ?? "center", d = x === "left" ? s : x === "right" ? a : (s + a) / 2;
|
|
2887
2887
|
return { index: h, y: u, left: s, right: a, textX: d };
|
|
2888
2888
|
}
|
|
2889
|
-
function
|
|
2889
|
+
function zs(e, t, n, o, i, r) {
|
|
2890
2890
|
if (e.kind !== "fib-retracement") return [];
|
|
2891
|
-
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 = (
|
|
2891
|
+
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 = (b) => {
|
|
2892
2892
|
const g = i.reverse ? a : c, w = i.reverse ? c : a;
|
|
2893
|
-
return x ? Math.exp(Math.log(g) +
|
|
2894
|
-
}, p = (
|
|
2893
|
+
return x ? Math.exp(Math.log(g) + b * (Math.log(w) - Math.log(g))) : g + b * (w - g);
|
|
2894
|
+
}, p = (b) => i.reverse ? l.y + (s.y - l.y) * b : s.y + (l.y - s.y) * b, y = (b) => x ? p(b) : (r == null ? void 0 : r.priceToY(d(b))) ?? p(b), m = Nn(r);
|
|
2895
2895
|
return [
|
|
2896
|
-
...Xi(u, y, f, h,
|
|
2897
|
-
...u.flatMap((
|
|
2896
|
+
...Xi(u, y, f, h, K(i)),
|
|
2897
|
+
...u.flatMap((b, g) => Ui(`l${g}`, b, y(b.coeff), f, h, d(b.coeff), m, i, o)),
|
|
2898
2898
|
// TV draws the trend line after the levels, before the labels.
|
|
2899
2899
|
...Nt(l, s, i),
|
|
2900
2900
|
...lt(n, t)
|
|
2901
2901
|
];
|
|
2902
2902
|
}
|
|
2903
|
-
function
|
|
2903
|
+
function Ws(e, t, n, o, i, r) {
|
|
2904
2904
|
if (e.kind !== "trend-based-fib-extension") return [];
|
|
2905
|
-
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,
|
|
2905
|
+
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, m = (M) => {
|
|
2906
2906
|
if (!y) return f + h * M;
|
|
2907
2907
|
const v = i.reverse ? Math.log(a) - Math.log(c) : Math.log(c) - Math.log(a);
|
|
2908
2908
|
return Math.exp(Math.log(f) + M * v);
|
|
2909
|
-
},
|
|
2909
|
+
}, b = (M) => s.y + u * M, g = (M) => y ? b(M) : (r == null ? void 0 : r.priceToY(m(M))) ?? b(M), w = Nn(r);
|
|
2910
2910
|
return [
|
|
2911
|
-
...Xi(x, g, d, p,
|
|
2912
|
-
...x.flatMap((M, v) => Ui(`l${v}`, M, g(M.coeff), d, p,
|
|
2911
|
+
...Xi(x, g, d, p, K(i)),
|
|
2912
|
+
...x.flatMap((M, v) => Ui(`l${v}`, M, g(M.coeff), d, p, m(M.coeff), w, i, o)),
|
|
2913
2913
|
// TV trend line: the measured move and the projection leg.
|
|
2914
2914
|
...Nt(t[0], t[1], i),
|
|
2915
2915
|
...Nt(t[1], t[2], i),
|
|
2916
2916
|
...lt(n, t)
|
|
2917
2917
|
];
|
|
2918
2918
|
}
|
|
2919
|
-
function
|
|
2919
|
+
function Rs(e, t, n, o, i, r, l) {
|
|
2920
2920
|
if (e.kind !== "fib-channel") return [];
|
|
2921
2921
|
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) => {
|
|
2922
2922
|
const v = x(M);
|
|
2923
2923
|
return Re(v.l, v.r, !!o.extendLeft, !!o.extendRight, u);
|
|
2924
|
-
}, p = Ct(o, Pt), y =
|
|
2924
|
+
}, p = Ct(o, Pt), y = K(o), m = Nn(i), b = (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) => {
|
|
2925
2925
|
const k = o.showCoeffs !== !1, S = o.showPrices !== !1;
|
|
2926
2926
|
if (!k && !S) return null;
|
|
2927
2927
|
let C = "";
|
|
2928
|
-
k && (C += o.fibLevelsAsPercents ? `${(100 * M.coeff).toFixed(2)}%` : It(M.coeff)), S && (C += ` (${
|
|
2928
|
+
k && (C += o.fibLevelsAsPercents ? `${(100 * M.coeff).toFixed(2)}%` : It(M.coeff)), S && (C += ` (${b(M.coeff, v.l.y).toFixed(m)})`);
|
|
2929
2929
|
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 };
|
|
2930
2930
|
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 });
|
|
2931
2931
|
}, w = [];
|
|
@@ -2946,38 +2946,38 @@ function Gi(e, t, n, o, i, r, l) {
|
|
|
2946
2946
|
...r ? [U(r, t.color)] : []
|
|
2947
2947
|
];
|
|
2948
2948
|
}
|
|
2949
|
-
function
|
|
2950
|
-
const [l, s, a] = t, c = i.fibTrendLine ?? Sn, f = R({ ...i, lineStyle: c.style, width: c.width }), h = Xo(e, t, r, Ct(i, Ln)), u =
|
|
2951
|
-
return c.visible && (
|
|
2949
|
+
function Fs(e, t, n, o, i, r) {
|
|
2950
|
+
const [l, s, a] = t, c = i.fibTrendLine ?? Sn, f = R({ ...i, lineStyle: c.style, width: c.width }), h = Xo(e, t, r, Ct(i, Ln)), u = K(i), x = i.vertLabelsAlign ?? "bottom", d = i.horzLabelsAlign ?? "right", p = d === "left" ? "right" : d === "right" ? "left" : "center", y = (b, g) => i.showLabels === !1 ? null : G({ x: b, y: x === "top" ? 0 : x === "middle" ? 0.5 * o : o, text: String(g), fs: 12, vert: x, horz: p, offsetX: 2 }), m = [];
|
|
2951
|
+
return c.visible && (m.push({ t: "line", a: l, b: s, stroke: c.color, strokeWidth: c.width, dash: f }), a && m.push({ t: "line", a: s, b: a, stroke: c.color, strokeWidth: c.width, dash: f })), u > 0 && h.slice(1).forEach((b, g) => {
|
|
2952
2952
|
const w = h[g].x;
|
|
2953
|
-
|
|
2954
|
-
}), h.forEach((
|
|
2955
|
-
const w = y(
|
|
2956
|
-
|
|
2957
|
-
}),
|
|
2958
|
-
}
|
|
2959
|
-
function
|
|
2960
|
-
const [i, r] = e, l = o.vertLabelsAlign ?? "bottom", s = o.horzLabelsAlign ?? "right", a = s === "left" ? "right" : s === "right" ? "left" : "center", c = (d, p) => o.showLabels === !1 ? null : G({ x: d, y: l === "top" ? 0 : l === "middle" ? 0.5 * n : n, text: String(p), fs: 12, vert: l, horz: a, offsetX: 2 }), f = r.x - i.x, h = Ct(o, Cn), u =
|
|
2953
|
+
m.push({ t: "rect", x: Math.min(w, b.x), y: 0, w: Math.max(1, Math.abs(b.x - w)), h: o, fill: b.color, fillOpacity: u, stroke: "none", inert: !0 });
|
|
2954
|
+
}), h.forEach((b, g) => {
|
|
2955
|
+
const w = y(b.x, b.coeff);
|
|
2956
|
+
m.push(...Gi(`l${g}`, b, b.x, o, i, w, w && d === "center" ? w.poly : null));
|
|
2957
|
+
}), m.push(...lt(n, t)), m;
|
|
2958
|
+
}
|
|
2959
|
+
function Ds(e, t, n, o) {
|
|
2960
|
+
const [i, r] = e, l = o.vertLabelsAlign ?? "bottom", s = o.horzLabelsAlign ?? "right", a = s === "left" ? "right" : s === "right" ? "left" : "center", c = (d, p) => o.showLabels === !1 ? null : G({ x: d, y: l === "top" ? 0 : l === "middle" ? 0.5 * n : n, text: String(p), fs: 12, vert: l, horz: a, offsetX: 2 }), f = r.x - i.x, h = Ct(o, Cn), u = K(o), x = [{ t: "line", a: i, b: r, stroke: "#808080", strokeWidth: 1, dash: "6 4" }];
|
|
2961
2961
|
return u > 0 && h.slice(1).forEach((d, p) => {
|
|
2962
|
-
const y = i.x + f * h[p].coeff,
|
|
2963
|
-
x.push({ t: "rect", x: Math.min(y,
|
|
2962
|
+
const y = i.x + f * h[p].coeff, m = i.x + f * d.coeff;
|
|
2963
|
+
x.push({ t: "rect", x: Math.min(y, m), y: 0, w: Math.max(1, Math.abs(m - y)), h: n, fill: d.color, fillOpacity: u, stroke: "none", inert: !0 });
|
|
2964
2964
|
}), h.forEach((d, p) => {
|
|
2965
|
-
const y = i.x + f * d.coeff,
|
|
2966
|
-
x.push(...Gi(`l${p}`, d, y, n, o,
|
|
2965
|
+
const y = i.x + f * d.coeff, m = c(y, d.coeff);
|
|
2966
|
+
x.push(...Gi(`l${p}`, d, y, n, o, m, m && l === "middle" && Me(m.lines) ? m.poly : null));
|
|
2967
2967
|
}), x.push(...lt(t, e)), x;
|
|
2968
2968
|
}
|
|
2969
|
-
const
|
|
2970
|
-
function
|
|
2969
|
+
const Os = [0.236, 0.382, 0.5, 0.618, 1];
|
|
2970
|
+
function _s(e, t, n, o) {
|
|
2971
2971
|
const [i, r] = t;
|
|
2972
2972
|
if (e.fmt !== 2) {
|
|
2973
2973
|
const d = Math.hypot(r.x - i.x, r.y - i.y), p = R(o);
|
|
2974
2974
|
return [
|
|
2975
|
-
...
|
|
2975
|
+
...Os.map((y) => ({ t: "circle", cx: i.x, cy: i.y, r: d * y, fill: "none", stroke: o.color, strokeWidth: o.width, dash: p, strokeOpacity: y === 1 ? 1 : 0.55 })),
|
|
2976
2976
|
{ t: "line", a: i, b: r, stroke: o.color, strokeWidth: 1, strokeOpacity: 0.4, dash: "2 3" },
|
|
2977
2977
|
...lt(n, t)
|
|
2978
2978
|
];
|
|
2979
2979
|
}
|
|
2980
|
-
const l = (i.x + r.x) / 2, s = (i.y + r.y) / 2, a = Math.abs(r.x - i.x) / 2, c = Math.abs(r.y - i.y) / 2, f = (o.levels ?? $n).filter((d) => d.visible), h =
|
|
2980
|
+
const l = (i.x + r.x) / 2, s = (i.y + r.y) / 2, a = Math.abs(r.x - i.x) / 2, c = Math.abs(r.y - i.y) / 2, f = (o.levels ?? $n).filter((d) => d.visible), h = K(o), u = (d) => `M ${l - a * d} ${s} a ${a * d} ${c * d} 0 1 0 ${2 * a * d} 0 a ${a * d} ${c * d} 0 1 0 ${-2 * a * d} 0 Z`, x = [];
|
|
2981
2981
|
h > 0 && f.forEach((d, p) => x.push({ t: "path", d: u(d.coeff) + (p > 0 ? " " + u(f[p - 1].coeff) : ""), fill: d.color, fillOpacity: h, fillRule: "evenodd", stroke: "none", inert: !0 }));
|
|
2982
2982
|
for (const d of f) {
|
|
2983
2983
|
const p = o.showCoeffs !== !1 ? Fe({ text: Hn(d.coeff, !!o.fibLevelsAsPercents), y: s + c * d.coeff, left: l, right: l, extendLeft: !1, extendRight: !1, paneW: 0, horz: "left", vert: "middle", fs: 12 }) : null;
|
|
@@ -2985,24 +2985,24 @@ function Os(e, t, n, o) {
|
|
|
2985
2985
|
}
|
|
2986
2986
|
return x.push(...Nt(i, r, o), ...lt(n, t)), x;
|
|
2987
2987
|
}
|
|
2988
|
-
function
|
|
2989
|
-
const [s, a] = t, c = ri(e, t, l, Ee), f = R(r), h =
|
|
2988
|
+
function Hs(e, t, n, o, i, r, l) {
|
|
2989
|
+
const [s, a] = t, c = ri(e, t, l, Ee), f = R(r), h = K(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: m, bottom: b } = c.box, g = r.fanGrid ?? Fo, w = R({ ...r, lineStyle: g.style, width: g.width }), M = (k, S, C, I, A, z, D) => G({ x: k, y: S, text: It(C), fs: 12, vert: I, horz: A, offsetX: z, offsetY: D }), v = [];
|
|
2990
2990
|
if (h > 0)
|
|
2991
2991
|
for (const k of [...d(u), ...d(x)]) v.push({ t: "polygon", pts: k.pts, fill: k.color, fillOpacity: h, stroke: "none", inert: !0 });
|
|
2992
2992
|
for (const k of c.h)
|
|
2993
|
-
g.visible && v.push({ t: "line", a: { x: p, y: k.y }, b: { x:
|
|
2993
|
+
g.visible && v.push({ t: "line", a: { x: p, y: k.y }, b: { x: m, y: k.y }, stroke: g.color, strokeWidth: g.width, dash: w, inert: !0 }), r.showLeftLabels !== !1 && v.push(U(M(p, k.y, k.coeff, "middle", "right", 5, 0), k.color)), r.showRightLabels !== !1 && v.push(U(M(m, k.y, k.coeff, "middle", "left", 5, 0), k.color));
|
|
2994
2994
|
for (const k of c.v)
|
|
2995
|
-
g.visible && v.push({ t: "line", a: { x: k.x, y }, b: { x: k.x, y:
|
|
2995
|
+
g.visible && v.push({ t: "line", a: { x: k.x, y }, b: { x: k.x, y: b }, stroke: g.color, strokeWidth: g.width, dash: w, inert: !0 }), r.showTopLabels !== !1 && v.push(U(M(k.x, y, k.coeff, "bottom", "center", 0, 5), k.color)), r.showBottomLabels !== !1 && v.push(U(M(k.x, b, k.coeff, "top", "center", 0, 5), k.color));
|
|
2996
2996
|
for (const k of [...u, ...x])
|
|
2997
2997
|
v.push({ t: "hit", a: s, b: k.far, width: L * 2 }), v.push({ t: "line", a: s, b: k.far, stroke: k.color, strokeWidth: r.width, dash: f, cap: "round" });
|
|
2998
2998
|
return v.push(...lt(n, t)), v;
|
|
2999
2999
|
}
|
|
3000
|
-
function
|
|
3001
|
-
const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = i.y >= o.y ? 1 : -1, s = R(n), a = Ct(n, An), c =
|
|
3000
|
+
function Ns(e, t, n) {
|
|
3001
|
+
const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = i.y >= o.y ? 1 : -1, s = R(n), a = Ct(n, An), c = K(n), f = !!n.fullCircles, h = (x) => f ? `M ${o.x - x} ${o.y} A ${x} ${x} 0 1 0 ${o.x + x} ${o.y} A ${x} ${x} 0 1 0 ${o.x - x} ${o.y}` : `M ${o.x - x} ${o.y} A ${x} ${x} 0 0 ${l > 0 ? 0 : 1} ${o.x + x} ${o.y}`, u = [];
|
|
3002
3002
|
if (r >= 1e-6) {
|
|
3003
3003
|
c > 0 && a.slice(1).forEach((x, d) => {
|
|
3004
|
-
const p = r * a[d].coeff, y = r * x.coeff,
|
|
3005
|
-
u.push({ t: "path", d:
|
|
3004
|
+
const p = r * a[d].coeff, y = r * x.coeff, m = f ? `${h(y)} Z ${h(p)} Z` : `M ${o.x - y} ${o.y} A ${y} ${y} 0 0 ${l > 0 ? 0 : 1} ${o.x + y} ${o.y} L ${o.x + p} ${o.y} A ${p} ${p} 0 0 ${l > 0 ? 1 : 0} ${o.x - p} ${o.y} Z`;
|
|
3005
|
+
u.push({ t: "path", d: m, fill: x.color, fillOpacity: c, fillRule: "evenodd", stroke: "none", inert: !0 });
|
|
3006
3006
|
});
|
|
3007
3007
|
for (const x of a) {
|
|
3008
3008
|
const d = r * x.coeff;
|
|
@@ -3015,7 +3015,7 @@ function Hs(e, t, n) {
|
|
|
3015
3015
|
}
|
|
3016
3016
|
return u.push(...lt(t, e)), u;
|
|
3017
3017
|
}
|
|
3018
|
-
function
|
|
3018
|
+
function Ys(e, t, n, o, i) {
|
|
3019
3019
|
const [r, l] = e, s = Pi(r, l, !!i.counterclockwise), a = R(i), c = l.x - r.x, f = l.y - r.y, h = Math.hypot(c, f) || 1, u = (n + o) * 2, x = { x: l.x + c / h * u, y: l.y + f / h * u };
|
|
3020
3020
|
return [
|
|
3021
3021
|
...s.length >= 2 ? [
|
|
@@ -3025,151 +3025,151 @@ function Ns(e, t, n, o, i) {
|
|
|
3025
3025
|
...lt(t, e)
|
|
3026
3026
|
];
|
|
3027
3027
|
}
|
|
3028
|
-
function
|
|
3028
|
+
function Vs(e, t, n) {
|
|
3029
3029
|
const [o, i, r] = e, l = Math.hypot(i.x - o.x, i.y - o.y);
|
|
3030
3030
|
if (l < 1e-6) return lt(t, e);
|
|
3031
3031
|
const s = Math.atan2(i.y - o.y, i.x - o.x), a = Math.atan2(r.y - o.y, r.x - o.x), c = { x: o.x + Math.cos(a) * l, y: o.y + Math.sin(a) * l };
|
|
3032
3032
|
let f = a - s;
|
|
3033
3033
|
for (; f > Math.PI; ) f -= 2 * Math.PI;
|
|
3034
3034
|
for (; f < -Math.PI; ) f += 2 * Math.PI;
|
|
3035
|
-
const h = R(n), u = Ct(n, kn), x =
|
|
3036
|
-
const
|
|
3035
|
+
const h = R(n), u = Ct(n, kn), x = K(n), d = 24, p = (m) => {
|
|
3036
|
+
const b = [];
|
|
3037
3037
|
for (let g = 0; g <= d; g++) {
|
|
3038
3038
|
const w = s + f * g / d;
|
|
3039
|
-
|
|
3039
|
+
b.push({ x: o.x + Math.cos(w) * m, y: o.y + Math.sin(w) * m });
|
|
3040
3040
|
}
|
|
3041
|
-
return
|
|
3041
|
+
return b;
|
|
3042
3042
|
}, y = [
|
|
3043
3043
|
{ t: "hit", a: o, b: i, width: 12 },
|
|
3044
3044
|
{ t: "hit", a: o, b: c, width: 12 }
|
|
3045
3045
|
];
|
|
3046
|
-
x > 0 && u.slice(1).forEach((
|
|
3047
|
-
const g = p(l *
|
|
3048
|
-
y.push({ t: "polygon", pts: [...g, ...w], fill:
|
|
3046
|
+
x > 0 && u.slice(1).forEach((m, b) => {
|
|
3047
|
+
const g = p(l * m.coeff), w = p(l * u[b].coeff).reverse();
|
|
3048
|
+
y.push({ t: "polygon", pts: [...g, ...w], fill: m.color, fillOpacity: x, stroke: "none", inert: !0 });
|
|
3049
3049
|
}), y.push(...Nt(o, i, n, !0), ...Nt(o, c, n, !0));
|
|
3050
|
-
for (const
|
|
3051
|
-
const
|
|
3052
|
-
y.push({ t: "polyline", pts: p(
|
|
3050
|
+
for (const m of u) {
|
|
3051
|
+
const b = l * m.coeff, g = s + f / 2;
|
|
3052
|
+
y.push({ t: "polyline", pts: p(b), fill: "none", stroke: m.color, strokeWidth: wt(m, n), dash: Mt(m, n) ?? h }), n.showCoeffs !== !1 && y.push({ t: "text", x: o.x + Math.cos(g) * (b + 8), y: o.y + Math.sin(g) * (b + 8), text: It(m.coeff), size: 11, fill: m.color, anchor: "middle", inert: !0 });
|
|
3053
3053
|
}
|
|
3054
3054
|
return y.push(...lt(t, e)), y;
|
|
3055
3055
|
}
|
|
3056
|
-
function
|
|
3057
|
-
const [i, r, l] = e, s = { x: (r.x + l.x) / 2, y: (r.y + l.y) / 2 }, a = { x: (l.x - r.x) / 2, y: (l.y - r.y) / 2 }, c = R(o), f = Ct(o, kt), h =
|
|
3058
|
-
const
|
|
3059
|
-
return { x: i.x +
|
|
3056
|
+
function Us(e, t, n, o) {
|
|
3057
|
+
const [i, r, l] = e, s = { x: (r.x + l.x) / 2, y: (r.y + l.y) / 2 }, a = { x: (l.x - r.x) / 2, y: (l.y - r.y) / 2 }, c = R(o), f = Ct(o, kt), h = K(o), u = n * 4, x = (y) => {
|
|
3058
|
+
const m = y.x - i.x, b = y.y - i.y, g = Math.hypot(m, b) || 1;
|
|
3059
|
+
return { x: i.x + m / g * u, y: i.y + b / g * u };
|
|
3060
3060
|
}, d = [
|
|
3061
3061
|
...f.slice().reverse().map((y) => ({ t: { x: s.x - a.x * y.coeff, y: s.y - a.y * y.coeff }, color: y.color, lvl: y })),
|
|
3062
3062
|
{ t: s, color: o.color },
|
|
3063
3063
|
...f.map((y) => ({ t: { x: s.x + a.x * y.coeff, y: s.y + a.y * y.coeff }, color: y.color, lvl: y }))
|
|
3064
3064
|
], p = [{ t: "line", a: r, b: l, stroke: o.color, strokeWidth: o.width, dash: c }];
|
|
3065
3065
|
for (const y of d) p.push({ t: "hit", a: i, b: x(y.t), width: L * 2 });
|
|
3066
|
-
h > 0 && d.slice(1).forEach((y,
|
|
3066
|
+
h > 0 && d.slice(1).forEach((y, m) => p.push({ t: "polygon", pts: [i, x(d[m].t), x(y.t)], fill: y.color, fillOpacity: h, stroke: "none", inert: !0 }));
|
|
3067
3067
|
for (const y of d)
|
|
3068
3068
|
p.push({ t: "line", a: i, b: x(y.t), stroke: y.color, strokeWidth: y.lvl ? wt(y.lvl, o) : o.width, dash: y.lvl ? Mt(y.lvl, o) : c });
|
|
3069
3069
|
return p.push(...lt(t, e)), p;
|
|
3070
3070
|
}
|
|
3071
|
-
const
|
|
3072
|
-
function
|
|
3073
|
-
var
|
|
3071
|
+
const be = (e, t) => e ? [{ t: "anchors", pts: t }] : [];
|
|
3072
|
+
function Xs(e, t, n, o, i) {
|
|
3073
|
+
var b;
|
|
3074
3074
|
const r = No(e, t);
|
|
3075
|
-
if (!r) return
|
|
3076
|
-
const l = o.gannLevels ?? on, s =
|
|
3075
|
+
if (!r) return be(n, t);
|
|
3076
|
+
const l = o.gannLevels ?? on, s = zr(r, l), a = Wr(r, o.gannFans ?? rn), c = Rr(r, o.gannArcs ?? ln), f = Yo(r), h = o.fillBackground === !1 ? 0 : Math.max(0, Math.min(1, (100 - (o.transparency ?? 80)) / 100)), u = (() => {
|
|
3077
3077
|
if (e.kind !== "gann-square" || o.showLabels === !1 || !i) return [];
|
|
3078
3078
|
const [g, w] = e.points, M = i.timeToBarIndex(g.time), v = i.timeToBarIndex(w.time);
|
|
3079
3079
|
if (M == null || v == null) return [];
|
|
3080
3080
|
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, z = (T, E, P, B, F, Y) => G({ x: T, y: E, text: P, fs: A, bold: o.bold, italic: o.italic, horz: B, vert: F, offsetX: 10, offsetY: Y }), D = [
|
|
3081
|
-
z(r.start.x, r.end.y,
|
|
3081
|
+
z(r.start.x, r.end.y, mt(S, I), C > 0 ? "right" : "left", S > 0 ? "bottom" : "top", S > 0 ? 8 : 10),
|
|
3082
3082
|
z(r.end.x, r.start.y, String(C), C > 0 ? "left" : "right", S > 0 ? "top" : "bottom", S > 0 ? 10 : 8)
|
|
3083
3083
|
];
|
|
3084
3084
|
return C !== 0 && D.push(z(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)), D;
|
|
3085
|
-
})(), x = ((
|
|
3085
|
+
})(), x = ((b = l[l.length - 1]) == null ? void 0 : b.color) ?? "#808080", d = f.right - f.left, p = f.bottom - f.top, y = [
|
|
3086
3086
|
{ t: "clipRect", name: "box", x: f.left, y: f.top, w: d, h: p, idPrefix: "gann-clip-" },
|
|
3087
3087
|
{ t: "rect", x: f.left, y: f.top, w: d, h: p, fill: "transparent" }
|
|
3088
3088
|
];
|
|
3089
3089
|
for (const g of s)
|
|
3090
3090
|
y.push({ t: "line", a: { x: g.x, y: r.start.y }, b: { x: g.x, y: r.end.y }, stroke: g.color, strokeWidth: g.width, inert: !0 }), y.push({ t: "line", a: { x: r.start.x, y: g.y }, b: { x: r.end.x, y: g.y }, stroke: g.color, strokeWidth: g.width, inert: !0 });
|
|
3091
3091
|
for (const g of a) y.push({ t: "line", a: g.from, b: g.to, stroke: g.color, strokeWidth: g.width, cap: "round", inert: !0 });
|
|
3092
|
-
const
|
|
3092
|
+
const m = [];
|
|
3093
3093
|
for (const g of c) {
|
|
3094
|
-
const w =
|
|
3095
|
-
h > 0 &&
|
|
3094
|
+
const w = Fr(r, g.r, g.prev);
|
|
3095
|
+
h > 0 && m.push({ t: "path", d: w.fill, fill: g.color, fillOpacity: h, stroke: "none" }), m.push({ t: "path", d: w.stroke, fill: "none", stroke: g.color, strokeWidth: g.width });
|
|
3096
3096
|
}
|
|
3097
|
-
y.push({ t: "group", clip: "box", inert: !0, items:
|
|
3097
|
+
y.push({ t: "group", clip: "box", inert: !0, items: m });
|
|
3098
3098
|
for (const g of u) y.push(U(g, x, o.bold, o.italic));
|
|
3099
|
-
return y.push(...
|
|
3099
|
+
return y.push(...be(n, t)), y;
|
|
3100
3100
|
}
|
|
3101
|
-
function
|
|
3102
|
-
const [r, l] = e, s = (n + o) * 2, a = l.x - r.x, c = l.y - r.y, f = (i.levels ?? vn).map((
|
|
3103
|
-
const
|
|
3104
|
-
return { x: r.x +
|
|
3101
|
+
function Gs(e, t, n, o, i) {
|
|
3102
|
+
const [r, l] = e, s = (n + o) * 2, a = l.x - r.x, c = l.y - r.y, f = (i.levels ?? vn).map((m, b) => ({ ...m, index: b + 1 })).filter((m) => m.visible), h = K(i), u = (m) => m > 1 ? { x: l.x, y: r.y + c / m } : { x: r.x + a * m, y: l.y }, x = (m) => {
|
|
3103
|
+
const b = Vo(r, l, m), g = Math.hypot(b.x, b.y) || 1;
|
|
3104
|
+
return { x: r.x + b.x / g * s, y: r.y + b.y / g * s };
|
|
3105
3105
|
}, d = [];
|
|
3106
|
-
f.forEach((
|
|
3107
|
-
|
|
3106
|
+
f.forEach((m, b) => {
|
|
3107
|
+
m.index < 4 && b < f.length - 1 ? d.push({ from: m.coeff, to: f[b + 1].coeff, color: m.color }) : m.index > 4 && b > 0 && d.push({ from: m.coeff, to: f[b - 1].coeff, color: m.color });
|
|
3108
3108
|
});
|
|
3109
3109
|
const p = 12 / 3, y = [{ t: "hit", a: r, b: l, width: 12 }];
|
|
3110
|
-
for (const
|
|
3111
|
-
if (h > 0) for (const
|
|
3112
|
-
for (const
|
|
3113
|
-
const
|
|
3114
|
-
y.push({ t: "line", a: r, b
|
|
3110
|
+
for (const m of f) y.push({ t: "hit", a: r, b: x(m.coeff), width: L * 2 });
|
|
3111
|
+
if (h > 0) for (const m of d) y.push({ t: "polygon", pts: [r, x(m.from), x(m.to)], fill: m.color, fillOpacity: h, stroke: "none", inert: !0 });
|
|
3112
|
+
for (const m of f) {
|
|
3113
|
+
const b = x(m.coeff), g = u(m.coeff);
|
|
3114
|
+
y.push({ t: "line", a: r, b, stroke: m.color, strokeWidth: wt(m, i), dash: Mt(m, i) }), i.showLabels !== !1 && y.push({ t: "text", x: g.x + p, y: g.y, text: m.label ?? It(m.coeff), size: 12, fill: m.color, anchor: "start", baseline: "central", inert: !0 });
|
|
3115
3115
|
}
|
|
3116
|
-
return y.push(...
|
|
3116
|
+
return y.push(...be(t, e)), y;
|
|
3117
3117
|
}
|
|
3118
|
-
function
|
|
3119
|
-
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 =
|
|
3120
|
-
const E =
|
|
3121
|
-
return (i == null ? void 0 : i.priceToY(E + T * P)) ?? (
|
|
3118
|
+
function js(e, t, n, o, i) {
|
|
3119
|
+
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 = bt(r, l), u = o.levels ?? ze, x = o.vLevels ?? ze, d = R(o), [p, y] = e.points, m = !!o.reverse, b = (T) => {
|
|
3120
|
+
const E = m ? y.price : p.price, P = m ? p.price - y.price : y.price - p.price;
|
|
3121
|
+
return (i == null ? void 0 : i.priceToY(E + T * P)) ?? (m ? l.y + T * (r.y - l.y) : r.y + T * (l.y - r.y));
|
|
3122
3122
|
}, g = (i == null ? void 0 : i.timeToBarIndex(p.time)) ?? null, w = (i == null ? void 0 : i.timeToBarIndex(y.time)) ?? null, M = (T) => {
|
|
3123
3123
|
if (i && g != null && w != null) {
|
|
3124
|
-
const E =
|
|
3124
|
+
const E = m ? w : g, P = m ? g - w : w - g, B = i.barIndexToTime(Math.round(E + T * P)), F = B != null ? i.timeToX(B) : null;
|
|
3125
3125
|
if (F != null) return F;
|
|
3126
3126
|
}
|
|
3127
|
-
return
|
|
3128
|
-
}, v = u.filter((T) => T.visible).map((T) => ({ ...T, y:
|
|
3127
|
+
return m ? l.x + T * (r.x - l.x) : r.x + T * (l.x - r.x);
|
|
3128
|
+
}, v = u.filter((T) => T.visible).map((T) => ({ ...T, y: b(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 = [];
|
|
3129
3129
|
if (I.visible)
|
|
3130
3130
|
for (let T = 0; T < u.length; T++) {
|
|
3131
3131
|
const E = M(u[T].coeff);
|
|
3132
3132
|
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 }]);
|
|
3133
3133
|
const P = x[T];
|
|
3134
3134
|
if (!P) continue;
|
|
3135
|
-
const B =
|
|
3135
|
+
const B = b(P.coeff);
|
|
3136
3136
|
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 }]);
|
|
3137
3137
|
}
|
|
3138
|
-
const z = (T, E, P, B, F, Y,
|
|
3138
|
+
const z = (T, E, P, B, F, Y, Q, xt) => U(G({ x: T, y: E, text: P, fs: 12, horz: F, vert: Y, offsetX: Q, offsetY: xt }), B), D = [{ t: "rect", x: s, y: c, w: Math.max(1, a - s), h: Math.max(1, f - c), fill: "transparent" }];
|
|
3139
3139
|
v.forEach((T, E) => {
|
|
3140
3140
|
E > 0 && S > 0 && D.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 }), D.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 && D.push(z(s, T.y, It(T.coeff), T.color, "right", "middle", 5, 0)), o.showRightLabels !== !1 && D.push(z(a, T.y, It(T.coeff), T.color, "left", "middle", 5, 0));
|
|
3141
3141
|
}), k.forEach((T, E) => {
|
|
3142
3142
|
E > 0 && C > 0 && D.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 }), D.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 && D.push(z(T.x, c, It(T.coeff), T.color, "center", "bottom", 0, 3)), o.showBottomLabels !== !1 && D.push(z(T.x, f, It(T.coeff), T.color, "center", "top", 0, 5));
|
|
3143
3143
|
});
|
|
3144
3144
|
for (const [T, E] of A) D.push({ t: "line", a: T, b: E, stroke: I.color, strokeWidth: o.width, dash: d, inert: !0 });
|
|
3145
|
-
return D.push(...
|
|
3145
|
+
return D.push(...be(n, h)), D;
|
|
3146
3146
|
}
|
|
3147
|
-
function
|
|
3147
|
+
function qs(e, t, n, o, i) {
|
|
3148
3148
|
const r = Uo(e, t);
|
|
3149
3149
|
if (!r) return [];
|
|
3150
|
-
const l = Zt(r.pivot, r.dir, o), s = Math.hypot(r.dir.x, r.dir.y) || 1, a = (
|
|
3150
|
+
const l = Zt(r.pivot, r.dir, o), s = Math.hypot(r.dir.x, r.dir.y) || 1, a = (m) => i.extendLines ? { x: m.x - r.dir.x / s * o * 4, y: m.y - r.dir.y / s * o * 4 } : m, c = R(i), f = Ct(i, kt), h = K(i), u = (m, b) => ({ x: r.mid.x + r.half.x * m * b, y: r.mid.y + r.half.y * m * b }), x = [];
|
|
3151
3151
|
let d = 0;
|
|
3152
|
-
for (const
|
|
3153
|
-
x.push({ from: d, to:
|
|
3152
|
+
for (const m of f)
|
|
3153
|
+
x.push({ from: d, to: m.coeff, color: m.color }), d = m.coeff;
|
|
3154
3154
|
const p = [1, -1], y = [{ t: "hit", a: r.pivot, b: l, width: L * 2 }];
|
|
3155
|
-
for (const
|
|
3156
|
-
const g = u(
|
|
3155
|
+
for (const m of p) for (const b of f) {
|
|
3156
|
+
const g = u(b.coeff, m);
|
|
3157
3157
|
y.push({ t: "hit", a: g, b: Zt(g, r.dir, o), width: L * 2 });
|
|
3158
3158
|
}
|
|
3159
3159
|
if (h > 0)
|
|
3160
|
-
for (const
|
|
3161
|
-
const g = u(
|
|
3162
|
-
y.push({ t: "polygon", pts: [a(g), Zt(g, r.dir, o), Zt(w, r.dir, o), a(w)], fill:
|
|
3160
|
+
for (const m of p) for (const b of x) {
|
|
3161
|
+
const g = u(b.from, m), w = u(b.to, m);
|
|
3162
|
+
y.push({ t: "polygon", pts: [a(g), Zt(g, r.dir, o), Zt(w, r.dir, o), a(w)], fill: b.color, fillOpacity: h, stroke: "none", inert: !0 });
|
|
3163
3163
|
}
|
|
3164
3164
|
y.push({ t: "line", a: t[1], b: t[2], stroke: i.color, strokeWidth: i.width, dash: c, cap: "round" }), y.push({ t: "line", a: a(r.pivot), b: l, stroke: i.color, strokeWidth: i.width, dash: c, cap: "round" });
|
|
3165
|
-
for (const
|
|
3166
|
-
y.push({ t: "line", a: a(u(
|
|
3167
|
-
return y.push(...
|
|
3165
|
+
for (const m of p) for (const b of f)
|
|
3166
|
+
y.push({ t: "line", a: a(u(b.coeff, m)), b: Zt(u(b.coeff, m), r.dir, o), stroke: b.color, strokeWidth: wt(b, i), dash: Mt(b, i), cap: "round" });
|
|
3167
|
+
return y.push(...be(n, t)), y;
|
|
3168
3168
|
}
|
|
3169
|
-
const
|
|
3169
|
+
const Zs = 0.06;
|
|
3170
3170
|
function qe(e, t) {
|
|
3171
3171
|
const n = ge(e);
|
|
3172
|
-
return t && n.fillOpacity > 0 ? { fill: n.fill, fillOpacity: Math.min(1, n.fillOpacity +
|
|
3172
|
+
return t && n.fillOpacity > 0 ? { fill: n.fill, fillOpacity: Math.min(1, n.fillOpacity + Zs) } : n;
|
|
3173
3173
|
}
|
|
3174
3174
|
function ji(e, t, n, o) {
|
|
3175
3175
|
return e.text ? [{
|
|
@@ -3186,13 +3186,13 @@ function ji(e, t, n, o) {
|
|
|
3186
3186
|
inert: !0
|
|
3187
3187
|
}] : [];
|
|
3188
3188
|
}
|
|
3189
|
-
function
|
|
3189
|
+
function Ks(e, t) {
|
|
3190
3190
|
if (e.length < 2) return [];
|
|
3191
3191
|
const n = [];
|
|
3192
3192
|
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;
|
|
3193
3193
|
}
|
|
3194
3194
|
const yn = (e) => e.map((t, n) => `${n === 0 ? "M" : "L"} ${t.x} ${t.y}`).join(" "), at = (e, t, n) => e ? [n ? { t: "anchors", pts: t, squares: n } : { t: "anchors", pts: t }] : [];
|
|
3195
|
-
function
|
|
3195
|
+
function Qs(e, t, n, o, i, r) {
|
|
3196
3196
|
const [l, s] = t, a = i.extendLeft ? -i.width : Math.min(l.x, s.x), c = i.extendRight ? o + i.width : Math.max(l.x, s.x), f = Math.min(l.y, s.y), h = Math.max(l.y, s.y), u = qe(i, r), x = jo(e, t, o), d = i.rectMiddleLine, p = [{
|
|
3197
3197
|
t: "rect",
|
|
3198
3198
|
x: a,
|
|
@@ -3206,31 +3206,31 @@ function Ks(e, t, n, o, i, r) {
|
|
|
3206
3206
|
dash: R(i)
|
|
3207
3207
|
}];
|
|
3208
3208
|
if (d != null && d.visible) {
|
|
3209
|
-
const y = x && (i.vertLabelsAlign ?? "middle") === "middle" && Me(x.lines) ? x.poly : null,
|
|
3210
|
-
|
|
3211
|
-
const
|
|
3209
|
+
const y = x && (i.vertLabelsAlign ?? "middle") === "middle" && Me(x.lines) ? x.poly : null, m = y && y.length ? "mid" : void 0;
|
|
3210
|
+
m && p.push({ t: "clip", name: m, polys: [y] });
|
|
3211
|
+
const b = Math.floor((f + h) / 2);
|
|
3212
3212
|
p.push({
|
|
3213
3213
|
t: "line",
|
|
3214
|
-
a: { x: a, y:
|
|
3215
|
-
b: { x: c, y:
|
|
3214
|
+
a: { x: a, y: b },
|
|
3215
|
+
b: { x: c, y: b },
|
|
3216
3216
|
stroke: d.color,
|
|
3217
3217
|
strokeWidth: d.width,
|
|
3218
3218
|
dash: R({ ...i, lineStyle: d.style, width: d.width }),
|
|
3219
3219
|
cap: "butt",
|
|
3220
|
-
clip:
|
|
3220
|
+
clip: m,
|
|
3221
3221
|
inert: !0
|
|
3222
3222
|
});
|
|
3223
3223
|
}
|
|
3224
|
-
return x && p.push(U(x, i.textColor ?? i.color, i.bold, i.italic)), p.push(...at(n, [...
|
|
3224
|
+
return x && p.push(U(x, i.textColor ?? i.color, i.bold, i.italic)), p.push(...at(n, [...bt(l, s), ...Ii(l, s)], Yt.rectangle)), p;
|
|
3225
3225
|
}
|
|
3226
|
-
function
|
|
3226
|
+
function Js(e, t, n, o) {
|
|
3227
3227
|
const i = e.fmt === 2, r = _o(t, i), l = ge(o), s = i ? [t[0], t[1], ...r] : t;
|
|
3228
3228
|
return [
|
|
3229
3229
|
{ t: "polygon", pts: r, fill: l.fill, fillOpacity: l.fillOpacity, stroke: o.color, strokeWidth: o.width, dash: R(o), join: "round" },
|
|
3230
3230
|
...at(n, s)
|
|
3231
3231
|
];
|
|
3232
3232
|
}
|
|
3233
|
-
function
|
|
3233
|
+
function tc(e, t, n, o, i) {
|
|
3234
3234
|
const [r, l] = t, s = Math.hypot(l.x - r.x, l.y - r.y), a = qe(o, i);
|
|
3235
3235
|
return [
|
|
3236
3236
|
{ t: "circle", cx: r.x, cy: r.y, r: Math.max(0, s), fill: a.fill, fillOpacity: a.fillOpacity, stroke: o.color, strokeWidth: o.width, dash: R(o) },
|
|
@@ -3238,7 +3238,7 @@ function Js(e, t, n, o, i) {
|
|
|
3238
3238
|
...at(n, t)
|
|
3239
3239
|
];
|
|
3240
3240
|
}
|
|
3241
|
-
function
|
|
3241
|
+
function ec(e, t, n, o, i) {
|
|
3242
3242
|
const [r, l, s] = t, a = (r.x + l.x) / 2, c = (r.y + l.y) / 2, f = Math.max(1, Math.hypot(l.x - r.x, l.y - r.y) / 2), h = Math.atan2(l.y - r.y, l.x - r.x), u = -Math.sin(h), x = Math.cos(h), d = Math.max(1, Math.abs((s.x - a) * u + (s.y - c) * x)), p = h * 180 / Math.PI, y = qe(o, i);
|
|
3243
3243
|
return [
|
|
3244
3244
|
{
|
|
@@ -3253,14 +3253,14 @@ function tc(e, t, n, o, i) {
|
|
|
3253
3253
|
...at(n, t)
|
|
3254
3254
|
];
|
|
3255
3255
|
}
|
|
3256
|
-
function
|
|
3256
|
+
function nc(e, t, n, o) {
|
|
3257
3257
|
const i = qe(n, o);
|
|
3258
3258
|
return [
|
|
3259
3259
|
{ t: "polygon", pts: e, fill: i.fill, fillOpacity: i.fillOpacity, stroke: n.color, strokeWidth: n.width, dash: R(n), join: "round" },
|
|
3260
3260
|
...at(t, e)
|
|
3261
3261
|
];
|
|
3262
3262
|
}
|
|
3263
|
-
function
|
|
3263
|
+
function oc(e, t, n) {
|
|
3264
3264
|
const [o, i] = e, r = R(n), l = e.length === 3 ? zi(o, i, e[2]) : null;
|
|
3265
3265
|
if (!l)
|
|
3266
3266
|
return [{ t: "line", a: o, b: i, stroke: n.color, strokeWidth: n.width, dash: r, cap: "round" }, ...at(t, e)];
|
|
@@ -3278,17 +3278,17 @@ function qi(e, t, n, o, i, r) {
|
|
|
3278
3278
|
const s = ge(n);
|
|
3279
3279
|
l.push({ t: "path", d: yn(i) + " Z", fill: s.fill, fillOpacity: s.fillOpacity, stroke: "none" });
|
|
3280
3280
|
}
|
|
3281
|
-
if (l.push({ t: "path", d: yn(o), fill: "none", stroke: n.color, strokeWidth: n.width, dash: R(n), cap: "round" }), l.push(...
|
|
3281
|
+
if (l.push({ t: "path", d: yn(o), fill: "none", stroke: n.color, strokeWidth: n.width, dash: R(n), cap: "round" }), l.push(...Ks(i, n)), t) {
|
|
3282
3282
|
for (const [s, a] of r) l.push({ t: "line", a: s, b: a, stroke: n.color, strokeOpacity: 0.3, dash: "3 3" });
|
|
3283
3283
|
l.push({ t: "anchors", pts: e });
|
|
3284
3284
|
}
|
|
3285
3285
|
return l;
|
|
3286
3286
|
}
|
|
3287
|
-
function
|
|
3287
|
+
function ic(e, t, n) {
|
|
3288
3288
|
const o = e.length >= 3 ? e : [e[0], { x: (e[0].x + e[1].x) / 2, y: (e[0].y + e[1].y) / 2 }, e[1]], [i, r, l] = o, s = xn(o, !!n.extendLeft, !!n.extendRight), a = n.extendLeft || n.extendRight ? xn(o) : s;
|
|
3289
3289
|
return qi(e, t, n, s, a, [[i, r], [l, r]]);
|
|
3290
3290
|
}
|
|
3291
|
-
function
|
|
3291
|
+
function rc(e, t, n) {
|
|
3292
3292
|
const o = e.length >= 4 ? e : [
|
|
3293
3293
|
e[0],
|
|
3294
3294
|
{ x: e[0].x + (e[1].x - e[0].x) / 3, y: e[0].y + (e[1].y - e[0].y) / 3 },
|
|
@@ -3297,7 +3297,7 @@ function ic(e, t, n) {
|
|
|
3297
3297
|
], [i, r, l, s] = o, a = dn(o, !!n.extendLeft, !!n.extendRight), c = n.extendLeft || n.extendRight ? dn(o) : a;
|
|
3298
3298
|
return qi(e, t, n, a, c, [[i, r], [s, l]]);
|
|
3299
3299
|
}
|
|
3300
|
-
function
|
|
3300
|
+
function lc(e, t, n) {
|
|
3301
3301
|
const [o, i, r] = e, l = Math.hypot(i.x - o.x, i.y - o.y);
|
|
3302
3302
|
if (!r || l < 1e-6)
|
|
3303
3303
|
return [{ t: "line", a: o, b: i, stroke: n.color, strokeWidth: n.width }, ...at(t, e)];
|
|
@@ -3331,18 +3331,18 @@ function rc(e, t, n) {
|
|
|
3331
3331
|
...at(t, e)
|
|
3332
3332
|
];
|
|
3333
3333
|
}
|
|
3334
|
-
function
|
|
3334
|
+
function sc(e, t, n, o, i) {
|
|
3335
3335
|
const [r, l] = e, s = l.x - r.x, a = R(i), c = [{ t: "line", a: r, b: l, stroke: "#808080", strokeWidth: 1, dash: "6 4" }];
|
|
3336
3336
|
if (Math.abs(s) >= 2)
|
|
3337
3337
|
for (let f = r.x; s > 0 ? f <= n + 2 : f >= -2; f += s)
|
|
3338
3338
|
c.push({ t: "line", a: { x: f, y: 0 }, b: { x: f, y: o }, stroke: i.color, strokeWidth: i.width, dash: a });
|
|
3339
3339
|
return c.push(...at(t, e)), c;
|
|
3340
3340
|
}
|
|
3341
|
-
function
|
|
3341
|
+
function cc(e, t, n, o) {
|
|
3342
3342
|
const i = Ei(e[0], e[1], n), r = [];
|
|
3343
3343
|
return i.length >= 2 && r.push({ t: "polyline", pts: i, fill: "none", stroke: o.color, strokeWidth: o.width, dash: R(o) }), r.push(...at(t, e)), r;
|
|
3344
3344
|
}
|
|
3345
|
-
function
|
|
3345
|
+
function ac(e, t, n, o) {
|
|
3346
3346
|
const [i, r] = e, l = Math.abs(r.x - i.x), s = l / 2, a = R(o), c = ge(o), f = i.y, h = [];
|
|
3347
3347
|
if (l >= 2) {
|
|
3348
3348
|
const u = Math.min(i.x, r.x), x = Math.floor(-u / l) - 1, d = Math.ceil((n - u) / l) + 1;
|
|
@@ -3367,35 +3367,35 @@ const Vn = {
|
|
|
3367
3367
|
"elliott-triangle": ["0", "A", "B", "C", "D", "E"],
|
|
3368
3368
|
"elliott-double-combo": ["0", "W", "X", "Y"],
|
|
3369
3369
|
"elliott-triple-combo": ["0", "W", "X", "Y", "X", "Z"]
|
|
3370
|
-
},
|
|
3370
|
+
}, fc = /* @__PURE__ */ new Set([
|
|
3371
3371
|
"polyline"
|
|
3372
|
-
]),
|
|
3372
|
+
]), hc = [
|
|
3373
3373
|
{ font: 11, circle: 14, bold: !0 },
|
|
3374
3374
|
{ font: 16, circle: 22, bold: !1 },
|
|
3375
3375
|
{ font: 18, circle: 22, bold: !1 },
|
|
3376
3376
|
{ font: 20, circle: 28, bold: !1 },
|
|
3377
3377
|
{ font: 24, circle: 36, bold: !0 }
|
|
3378
|
-
],
|
|
3378
|
+
], uc = {
|
|
3379
3379
|
"elliott-impulse": ["0", "1", "2", "3", "4", "5"],
|
|
3380
3380
|
"elliott-correction": ["0", "A", "B", "C"],
|
|
3381
3381
|
"elliott-triangle": ["0", "A", "B", "C", "D", "E"],
|
|
3382
3382
|
"elliott-double-combo": ["0", "W", "X", "Y"],
|
|
3383
3383
|
"elliott-triple-combo": ["0", "W", "X", "Y", "X", "Z"]
|
|
3384
3384
|
}, po = ["0", "i", "ii", "iii", "iv", "v"];
|
|
3385
|
-
function
|
|
3386
|
-
const n =
|
|
3385
|
+
function xc(e, t) {
|
|
3386
|
+
const n = uc[e] ?? [];
|
|
3387
3387
|
return e === "elliott-impulse" ? t === 1 ? po : t === 3 ? po.map((o) => o.toUpperCase()) : n : t % 2 === 1 ? n.map((o) => o.toLowerCase()) : n;
|
|
3388
3388
|
}
|
|
3389
|
-
function
|
|
3390
|
-
const r = 14 - Math.max(0, Math.min(14, Math.round(o.elliottDegree ??
|
|
3389
|
+
function dc(e, t, n, o) {
|
|
3390
|
+
const r = 14 - Math.max(0, Math.min(14, Math.round(o.elliottDegree ?? vr))), l = Math.floor(r / 3), s = ["", "brackets", "circle"][r % 3], a = hc[l], c = xc(e.kind, l), f = 10 + a.circle / 2, h = t.length > 2 ? Math.sign(t[2].y - t[1].y) : 1, u = (d) => d % 2 === 0 ? h : -h, x = [{ t: "polyline", pts: t, fill: "none", stroke: "transparent", strokeWidth: Math.max(L * 2, o.width) }];
|
|
3391
3391
|
return o.showWave !== !1 && x.push({ t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: R(o), join: "round", cap: "round" }), t.forEach((d, p) => {
|
|
3392
3392
|
if (p === 0 && !n) return;
|
|
3393
|
-
const y = d.y + (u(p) === 1 ? f : -f),
|
|
3393
|
+
const y = d.y + (u(p) === 1 ? f : -f), m = c[p] ?? String(p);
|
|
3394
3394
|
s === "circle" && x.push({ t: "circle", cx: d.x, cy: y, r: a.circle / 2 - 0.5, fill: "none", stroke: o.color, strokeWidth: 1, inert: !0 }), x.push({
|
|
3395
3395
|
t: "text",
|
|
3396
3396
|
x: d.x,
|
|
3397
3397
|
y: y + 0.05 * a.font,
|
|
3398
|
-
text: s === "brackets" ? `(${
|
|
3398
|
+
text: s === "brackets" ? `(${m})` : m,
|
|
3399
3399
|
size: a.font,
|
|
3400
3400
|
weight: a.bold ? 700 : 400,
|
|
3401
3401
|
fill: o.color,
|
|
@@ -3457,15 +3457,15 @@ function Ki(e, t, n) {
|
|
|
3457
3457
|
}), i;
|
|
3458
3458
|
}
|
|
3459
3459
|
const ve = (e) => ({ t: "polyline", pts: e, fill: "none", stroke: "transparent", strokeWidth: L * 2 });
|
|
3460
|
-
function
|
|
3460
|
+
function yc(e, t, n, o) {
|
|
3461
3461
|
const i = re(o), r = e.points.map((s) => s.price), l = [
|
|
3462
3462
|
ve(t),
|
|
3463
3463
|
{ t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: R(o), join: "round" }
|
|
3464
3464
|
];
|
|
3465
3465
|
return t.length >= 3 && l.push(...oe(t, 0, 2, o.width, pt(r[0], r[1], r[2], 3), i)), t.length >= 4 && l.push(...oe(t, 1, 3, o.width, pt(r[1], r[2], r[3], 3), i)), l.push(...Ki(t, Vn[e.kind], o)), n && l.push({ t: "anchors", pts: t }), l;
|
|
3466
3466
|
}
|
|
3467
|
-
function
|
|
3468
|
-
const i = e.kind === "cypher-pattern", r = re(o), l = o.backgroundColor ?? o.color, s = o.fillBackground === !1 ? 0 :
|
|
3467
|
+
function pc(e, t, n, o) {
|
|
3468
|
+
const i = e.kind === "cypher-pattern", r = re(o), l = o.backgroundColor ?? o.color, s = o.fillBackground === !1 ? 0 : K(o), a = e.points.map((f) => f.price), c = [];
|
|
3469
3469
|
if (s > 0 && t.length >= 3 && c.push({ t: "polygon", pts: [t[0], t[1], t[2]], fill: l, fillOpacity: s, stroke: "none" }), s > 0 && t.length >= 5 && c.push({ t: "polygon", pts: [t[2], t[3], t[4]], fill: l, fillOpacity: s, stroke: "none" }), c.push(ve(t), { t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: R(o), join: "round" }), t.length >= 3 && c.push(...oe(t, 0, 2, 1, pt(a[0], a[1], a[2], 3), r)), t.length >= 4 && c.push(...oe(t, 1, 3, 1, i ? pt(a[1], a[0], a[3], 3) : pt(a[1], a[2], a[3], 3), r)), t.length >= 5) {
|
|
3470
3470
|
const f = i ? pt(a[0], a[2], a[4], 3) : pt(a[0], a[1], a[4], 3);
|
|
3471
3471
|
c.push(
|
|
@@ -3477,7 +3477,7 @@ function yc(e, t, n, o) {
|
|
|
3477
3477
|
}
|
|
3478
3478
|
return c.push(...Ki(t, Vn[e.kind], o)), n && c.push({ t: "anchors", pts: t }), c;
|
|
3479
3479
|
}
|
|
3480
|
-
function
|
|
3480
|
+
function mc(e, t, n, o) {
|
|
3481
3481
|
const i = re(o), r = e.points.map((s) => s.price), l = [
|
|
3482
3482
|
ve(t),
|
|
3483
3483
|
{ t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: R(o), join: "round" }
|
|
@@ -3522,7 +3522,7 @@ function bc(e, t, n) {
|
|
|
3522
3522
|
t: "polygon",
|
|
3523
3523
|
pts: a,
|
|
3524
3524
|
fill: n.fillBackground === !1 ? "none" : n.backgroundColor ?? n.color,
|
|
3525
|
-
fillOpacity:
|
|
3525
|
+
fillOpacity: K({ ...n, transparency: n.transparency ?? 85 }),
|
|
3526
3526
|
stroke: n.color,
|
|
3527
3527
|
strokeWidth: n.width,
|
|
3528
3528
|
dash: R({ ...n, lineStyle: "dotted" }),
|
|
@@ -3535,23 +3535,23 @@ function bc(e, t, n) {
|
|
|
3535
3535
|
_t(l, l.y < r.y, "D", s)
|
|
3536
3536
|
), t && c.push({ t: "anchors", pts: e }), c;
|
|
3537
3537
|
}
|
|
3538
|
-
function
|
|
3538
|
+
function mo(e, t, n, o) {
|
|
3539
3539
|
const i = { x: t.x - e.x, y: t.y - e.y }, r = { x: o.x - n.x, y: o.y - n.y }, l = i.x * r.y - i.y * r.x;
|
|
3540
3540
|
if (Math.abs(l) < 1e-9) return null;
|
|
3541
3541
|
const s = ((n.x - e.x) * i.y - (n.y - e.y) * i.x) / l;
|
|
3542
3542
|
return s < 0 || s > 1 ? null : { x: n.x + r.x * s, y: n.y + r.y * s };
|
|
3543
3543
|
}
|
|
3544
|
-
function
|
|
3545
|
-
const o =
|
|
3546
|
-
return n.fillBackground !== !1 && (
|
|
3544
|
+
function gc(e, t, n) {
|
|
3545
|
+
const o = K({ ...n, transparency: n.transparency ?? 85 }), i = n.backgroundColor ?? n.color, [r, l, s, a, c, f, h] = e, u = mo(s, c, r, l), x = mo(s, c, f, h), d = (b, g) => ({ x: b.x + (g.x - b.x) * 10, y: b.y + (g.y - b.y) * 10 }), p = re(n), y = (b, g, w) => ({ t: "polygon", pts: [b, g, w], fill: i, fillOpacity: o, stroke: "none", inert: !0 }), m = [ve(e)];
|
|
3546
|
+
return n.fillBackground !== !1 && (m.push(y(s, a, c)), u && m.push(y(u, l, s)), x && m.push(y(c, f, x))), m.push(
|
|
3547
3547
|
{ t: "line", a: u ?? d(c, s), b: x ?? d(s, c), stroke: n.color, strokeWidth: n.width, dash: R({ ...n, lineStyle: "dotted" }), inert: !0 },
|
|
3548
3548
|
{ t: "polyline", pts: e, fill: "none", stroke: n.color, strokeWidth: n.width, dash: R(n), join: "round" },
|
|
3549
3549
|
_t(l, l.y < r.y, "Left Shoulder", p),
|
|
3550
3550
|
_t(a, a.y < s.y, "Head", p),
|
|
3551
3551
|
_t(f, f.y < c.y, "Right Shoulder", p)
|
|
3552
|
-
), t &&
|
|
3552
|
+
), t && m.push({ t: "anchors", pts: e }), m;
|
|
3553
3553
|
}
|
|
3554
|
-
function
|
|
3554
|
+
function wc(e, t = 5) {
|
|
3555
3555
|
if (e.length < 2) return e;
|
|
3556
3556
|
const n = Math.max(1, t), o = [e[0]];
|
|
3557
3557
|
for (let r = 1; r < e.length; r++) {
|
|
@@ -3570,27 +3570,27 @@ function gc(e, t = 5) {
|
|
|
3570
3570
|
}
|
|
3571
3571
|
return i.push(o[o.length - 1]), i;
|
|
3572
3572
|
}
|
|
3573
|
-
function
|
|
3573
|
+
function Mc(e, t, n, o) {
|
|
3574
3574
|
if (e.kind === "triangle-pattern" && t.length >= 4) return bc(t, n, o);
|
|
3575
|
-
if (e.kind === "head-and-shoulders" && t.length >= 7) return
|
|
3576
|
-
if (e.kind === "abcd-pattern" && t.length >= 2) return
|
|
3577
|
-
if ((e.kind === "xabcd-pattern" || e.kind === "cypher-pattern") && t.length >= 2) return
|
|
3578
|
-
if (e.kind === "three-drives-pattern" && t.length >= 2) return
|
|
3579
|
-
if (e.kind.startsWith("elliott-")) return
|
|
3580
|
-
const i = Vn[e.kind], r =
|
|
3575
|
+
if (e.kind === "head-and-shoulders" && t.length >= 7) return gc(t, n, o);
|
|
3576
|
+
if (e.kind === "abcd-pattern" && t.length >= 2) return yc(e, t, n, o);
|
|
3577
|
+
if ((e.kind === "xabcd-pattern" || e.kind === "cypher-pattern") && t.length >= 2) return pc(e, t, n, o);
|
|
3578
|
+
if (e.kind === "three-drives-pattern" && t.length >= 2) return mc(e, t, n, o);
|
|
3579
|
+
if (e.kind.startsWith("elliott-")) return dc(e, t, n, o);
|
|
3580
|
+
const i = Vn[e.kind], r = fc.has(e.kind) && e.closed === !0, l = e.kind === "highlighter", s = e.kind === "brush" || l, a = o.width, c = s ? wc(t) : t, f = s ? void 0 : R(o), h = s && t.length > 1 ? [t[0], t[t.length - 1]] : t, u = [];
|
|
3581
3581
|
if (r) {
|
|
3582
|
-
const x = o.backgroundColor ?? o.color, d = o.fillBackground !== void 0 ?
|
|
3582
|
+
const x = o.backgroundColor ?? o.color, d = o.fillBackground !== void 0 ? K(o) : 0.08;
|
|
3583
3583
|
u.push(
|
|
3584
3584
|
{ t: "polygon", pts: c, fill: x, fillOpacity: d, stroke: "transparent", strokeWidth: L * 2 },
|
|
3585
3585
|
{ t: "polygon", pts: c, fill: x, fillOpacity: d, stroke: o.color, strokeWidth: o.width, dash: f, join: "round" }
|
|
3586
3586
|
);
|
|
3587
3587
|
} else {
|
|
3588
|
-
e.kind === "brush" && o.fillBackground === !0 && u.push({ t: "polygon", pts: c, fill: o.backgroundColor ?? o.color, fillOpacity:
|
|
3588
|
+
e.kind === "brush" && o.fillBackground === !0 && u.push({ t: "polygon", pts: c, fill: o.backgroundColor ?? o.color, fillOpacity: K(o), stroke: "none", inert: !0 }), u.push(
|
|
3589
3589
|
{ t: "polyline", pts: c, fill: "none", stroke: "transparent", strokeWidth: Math.max(L * 2, a) },
|
|
3590
3590
|
{ t: "polyline", pts: c, fill: "none", stroke: o.color, strokeWidth: a, strokeOpacity: l ? 0.2 : 1, dash: f, join: "round", cap: "round" }
|
|
3591
3591
|
);
|
|
3592
3592
|
const x = (p, y) => {
|
|
3593
|
-
const
|
|
3593
|
+
const m = Math.hypot(y.x - p.x, y.y - p.y), g = (o.lineStyle ?? "solid") === "solid" && m >= 1 ? { x: p.x + (y.x - p.x) * (m + o.width / 2) / m, y: p.y + (y.y - p.y) * (m + o.width / 2) / m } : y;
|
|
3594
3594
|
return { t: "path", d: je(p, g, o.width), fill: "none", stroke: o.color, strokeWidth: o.width, dash: f, join: "round", cap: "round", inert: !0 };
|
|
3595
3595
|
}, d = e.kind === "path" || e.kind === "brush";
|
|
3596
3596
|
d && c.length > 1 && (o.leftEnd ?? 0) === 1 && u.push(x(c[1], c[0])), d && c.length > 1 && (o.rightEnd ?? (e.kind === "path" ? 1 : 0)) === 1 && u.push(x(c[c.length - 2], c[c.length - 1]));
|
|
@@ -3599,10 +3599,10 @@ function wc(e, t, n, o) {
|
|
|
3599
3599
|
u.push({ t: "text", x: x.x, y: x.y + Zi(t, d), text: i[d] ?? String(d + 1), size: 11, fill: o.color, anchor: "middle" });
|
|
3600
3600
|
}), n && u.push({ t: "anchors", pts: h }), u;
|
|
3601
3601
|
}
|
|
3602
|
-
function
|
|
3602
|
+
function vc(e) {
|
|
3603
3603
|
return e < 92 ? 18 : Math.min(Math.max(e * 0.25, 18), 106, e * 0.9);
|
|
3604
3604
|
}
|
|
3605
|
-
function
|
|
3605
|
+
function kc(e, t, n) {
|
|
3606
3606
|
const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = n.fontSize ?? 16, s = (A, z, D) => n.text ? [{
|
|
3607
3607
|
t: "text",
|
|
3608
3608
|
x: A,
|
|
@@ -3624,14 +3624,14 @@ function vc(e, t, n) {
|
|
|
3624
3624
|
const A = { x: (i.x - o.x) / r, y: (i.y - o.y) / r };
|
|
3625
3625
|
a = { x: i.x - A.x * 22, y: i.y - A.y * 22 };
|
|
3626
3626
|
}
|
|
3627
|
-
const c = i.x - a.x, f = i.y - a.y, h = Math.hypot(c, f), u = c / h, x = f / h, d = -x, p = u, y =
|
|
3627
|
+
const c = i.x - a.x, f = i.y - a.y, h = Math.hypot(c, f), u = c / h, x = f / h, d = -x, p = u, y = vc(h), m = h >= 35 ? 0.1 : 0, b = [
|
|
3628
3628
|
{ x: 0, y: 0 },
|
|
3629
|
-
{ x: h - y + y *
|
|
3629
|
+
{ x: h - y + y * m, y: 1.22 * y / 4 },
|
|
3630
3630
|
{ x: h - y, y: 1.22 * y / 2 },
|
|
3631
3631
|
{ x: h, y: 0 }
|
|
3632
3632
|
], g = (A, z) => ({ x: a.x + u * A.x + d * A.y * z, y: a.y + x * A.x + p * A.y * z }), w = [
|
|
3633
|
-
...
|
|
3634
|
-
...
|
|
3633
|
+
...b.map((A) => g(A, 1)),
|
|
3634
|
+
...b.slice(0, b.length - 1).reverse().map((A) => g(A, -1))
|
|
3635
3635
|
], M = Math.min(5, Math.max(2, Math.round(0.02 * h))), v = Math.atan2(c, f);
|
|
3636
3636
|
let k = o.x, S = o.y, C = "middle";
|
|
3637
3637
|
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);
|
|
@@ -3642,12 +3642,12 @@ function vc(e, t, n) {
|
|
|
3642
3642
|
];
|
|
3643
3643
|
return t && I.push({ t: "anchors", pts: e }), I;
|
|
3644
3644
|
}
|
|
3645
|
-
function
|
|
3645
|
+
function Lc(e, t) {
|
|
3646
3646
|
const n = t === "up" ? 1 : -1, o = n * 12, i = n * 10, r = 19.5 / 2, l = 5;
|
|
3647
3647
|
return `M ${e.x} ${e.y} L ${e.x + r} ${e.y + o} L ${e.x + l} ${e.y + o} L ${e.x + l} ${e.y + o + i} L ${e.x - l} ${e.y + o + i} L ${e.x - l} ${e.y + o} L ${e.x - r} ${e.y + o} Z`;
|
|
3648
3648
|
}
|
|
3649
|
-
function
|
|
3650
|
-
const r = t[0], l = si(e, r), s = o.fontSize ?? 14, a = [{ t: "path", d:
|
|
3649
|
+
function bo(e, t, n, o, i) {
|
|
3650
|
+
const r = t[0], l = si(e, r), s = o.fontSize ?? 14, a = [{ t: "path", d: Lc(r, i), fill: o.color }];
|
|
3651
3651
|
return l && (a.push({ t: "rect", x: l.left, y: l.top, w: l.width, h: l.height, fill: "transparent" }), l.lines.forEach((c, f) => {
|
|
3652
3652
|
a.push({
|
|
3653
3653
|
t: "text",
|
|
@@ -3665,12 +3665,12 @@ function mo(e, t, n, o, i) {
|
|
|
3665
3665
|
});
|
|
3666
3666
|
})), n && a.push({ t: "anchors", pts: [r] }), a;
|
|
3667
3667
|
}
|
|
3668
|
-
const go = 22, $e = 17, Ke = 12,
|
|
3669
|
-
function
|
|
3668
|
+
const go = 22, $e = 17, Ke = 12, Sc = 5;
|
|
3669
|
+
function Cc(e, t, n) {
|
|
3670
3670
|
const o = e[0], i = o.y - go, r = o.x, l = [
|
|
3671
3671
|
{ x: r, y: i },
|
|
3672
3672
|
{ x: r + $e, y: i },
|
|
3673
|
-
{ x: r + $e -
|
|
3673
|
+
{ x: r + $e - Sc, y: i + Ke / 2 },
|
|
3674
3674
|
{ x: r + $e, y: i + Ke },
|
|
3675
3675
|
{ x: r, y: i + Ke }
|
|
3676
3676
|
], s = [
|
|
@@ -3681,24 +3681,24 @@ function Sc(e, t, n) {
|
|
|
3681
3681
|
];
|
|
3682
3682
|
return t && s.push({ t: "anchors", pts: [o] }), s;
|
|
3683
3683
|
}
|
|
3684
|
-
function
|
|
3684
|
+
function Tc(e, t, n, o, i) {
|
|
3685
3685
|
const r = t[0], l = (i == null ? void 0 : i.pipSize()) ?? 0.01, s = Math.max(0, Math.min(8, Math.round(-Math.log10(l)))), a = e.points[0].price.toFixed(s), c = o.fontSize ?? 14, f = Si(a, r, c), h = 100 - (o.transparency ?? 0), u = o.borderColor ?? o.color, x = [
|
|
3686
|
-
{ t: "path", d:
|
|
3686
|
+
{ t: "path", d: Ml(f), fill: Lt(ct(o.backgroundColor ?? o.color).hex, h), stroke: u, strokeWidth: 2, join: "round" },
|
|
3687
3687
|
{ t: "text", x: f.x + 10, y: f.y + f.h / 2 + Math.floor(0.35 * c), text: a, size: c, weight: "bold", fill: o.textColor ?? "#ffffff", pre: !0 },
|
|
3688
3688
|
{ t: "circle", cx: r.x, cy: r.y, r: 2.5, fill: Lt(ct(u).hex, h), stroke: "#0f0f0f", strokeWidth: 1 }
|
|
3689
3689
|
];
|
|
3690
3690
|
return n && x.push({ t: "anchors", pts: [r] }), x;
|
|
3691
3691
|
}
|
|
3692
|
-
const
|
|
3693
|
-
function
|
|
3694
|
-
const [o] = t, i = e.style.fontSize ??
|
|
3692
|
+
const Ac = 28;
|
|
3693
|
+
function $c(e, t, n) {
|
|
3694
|
+
const [o] = t, i = e.style.fontSize ?? Ac, r = i / 2, l = [];
|
|
3695
3695
|
return n && l.push({ t: "rect", x: o.x - r - 2, y: o.y - r - 2, w: i + 4, h: i + 4, fill: "none", stroke: "#2962ff", strokeWidth: 1, dash: "3 3", rx: 3 }), l.push({ t: "glyph", x: o.x - r, y: o.y - r, size: i, glyph: e.glyph ?? "", color: e.style.color }), [{ t: "group", items: l }];
|
|
3696
3696
|
}
|
|
3697
|
-
const
|
|
3698
|
-
function
|
|
3697
|
+
const Bc = "#089981", Ic = "#f23645";
|
|
3698
|
+
function Pc(e, t) {
|
|
3699
3699
|
const n = [];
|
|
3700
3700
|
for (const o of e) {
|
|
3701
|
-
const i = o.up ?
|
|
3701
|
+
const i = o.up ? Bc : Ic, r = Math.min(o.openY, o.closeY), l = Math.max(1, Math.abs(o.closeY - o.openY));
|
|
3702
3702
|
n.push(
|
|
3703
3703
|
{ t: "line", a: { x: o.x, y: o.highY }, b: { x: o.x, y: o.lowY }, stroke: i, strokeWidth: 1 },
|
|
3704
3704
|
{ t: "rect", x: o.x - t / 2, y: r, w: t, h: l, fill: i }
|
|
@@ -3706,7 +3706,7 @@ function Ic(e, t) {
|
|
|
3706
3706
|
}
|
|
3707
3707
|
return n;
|
|
3708
3708
|
}
|
|
3709
|
-
function
|
|
3709
|
+
function Ec(e, t, n, o, i) {
|
|
3710
3710
|
if (e.kind !== "bar-pattern") return [];
|
|
3711
3711
|
const [r, l] = t, s = li(e, t, i), a = n ? [{ t: "anchors", pts: t }] : [];
|
|
3712
3712
|
if (!s) {
|
|
@@ -3752,7 +3752,7 @@ function wo(e) {
|
|
|
3752
3752
|
};
|
|
3753
3753
|
}
|
|
3754
3754
|
const Mo = 14;
|
|
3755
|
-
function
|
|
3755
|
+
function zc(e, t, n, o, i) {
|
|
3756
3756
|
if (e.kind !== "ghost-feed") return [];
|
|
3757
3757
|
if (e.ghost && i && e.points.length >= 2) {
|
|
3758
3758
|
const v = e.ghost.amplitude, k = Math.max(0, Math.min(1, (o.variance ?? 50) / 100)), S = [];
|
|
@@ -3764,21 +3764,21 @@ function Ec(e, t, n, o, i) {
|
|
|
3764
3764
|
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);
|
|
3765
3765
|
if (E == null || P == null) continue;
|
|
3766
3766
|
const B = Math.min(z, D), F = Math.abs(D - z) - (A === 0 ? 0 : 1), Y = F > 1 ? (P - E) / (F - 1) : 0;
|
|
3767
|
-
for (let
|
|
3768
|
-
const xt = i.barIndexToTime(B +
|
|
3767
|
+
for (let Q = 0; Q < F; Q++) {
|
|
3768
|
+
const xt = i.barIndexToTime(B + Q), Vt = xt == null ? null : i.timeToX(xt);
|
|
3769
3769
|
if (Vt == null) continue;
|
|
3770
|
-
if (
|
|
3771
|
-
const ce = i.barIndexToTime(B +
|
|
3770
|
+
if (Q > 0) {
|
|
3771
|
+
const ce = i.barIndexToTime(B + Q - 1), ae = ce == null ? null : i.timeToX(ce);
|
|
3772
3772
|
ae != null && (C = Math.abs(Vt - ae) || C);
|
|
3773
3773
|
}
|
|
3774
|
-
const vt = i.yToPrice(E +
|
|
3774
|
+
const vt = i.yToPrice(E + Q * Y);
|
|
3775
3775
|
if (vt == null) continue;
|
|
3776
|
-
const Ut = wo((e.ghost.seed ^ Math.imul(A, 2654435769) ^ Math.imul(
|
|
3776
|
+
const Ut = wo((e.ghost.seed ^ Math.imul(A, 2654435769) ^ Math.imul(Q, 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);
|
|
3777
3777
|
se == null || Tt == null || Le == null || Se == null || S.push({ x: Vt, openY: se, highY: Tt, lowY: Le, closeY: Se, up: Ft >= Rt });
|
|
3778
3778
|
}
|
|
3779
3779
|
}
|
|
3780
3780
|
if (I) {
|
|
3781
|
-
const A = Math.floor(0.3 * C), z = o.ghostCandle ??
|
|
3781
|
+
const A = Math.floor(0.3 * C), z = o.ghostCandle ?? kr, D = i.priceToY(e.points[0].price), T = i.priceToY(e.points[0].price + v), E = D != null && T != null ? Math.abs(T - D) : 10, P = [];
|
|
3782
3782
|
for (const F of S)
|
|
3783
3783
|
z.drawWick && P.push({ t: "line", a: { x: F.x, y: F.highY }, b: { x: F.x, y: F.lowY }, stroke: z.wickColor, strokeWidth: 1 }), P.push({
|
|
3784
3784
|
t: "rect",
|
|
@@ -3798,29 +3798,29 @@ function Ec(e, t, n, o, i) {
|
|
|
3798
3798
|
return n && B.push({ t: "anchors", pts: t }), B;
|
|
3799
3799
|
}
|
|
3800
3800
|
}
|
|
3801
|
-
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 = a - s, u = f - c, x = Math.round((e.points[0].price + e.points[1].price) * 1e3) ^ ((O(e.points[0].time) ?? 0) | 0), d = wo(x), p = h / Mo, y = Math.max(1, p * 0.6),
|
|
3801
|
+
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 = a - s, u = f - c, x = Math.round((e.points[0].price + e.points[1].price) * 1e3) ^ ((O(e.points[0].time) ?? 0) | 0), d = wo(x), p = h / Mo, y = Math.max(1, p * 0.6), m = u * 0.06, b = u * 0.12;
|
|
3802
3802
|
let g = c + u / 2;
|
|
3803
3803
|
const w = [];
|
|
3804
3804
|
for (let v = 0; v < Mo; v++) {
|
|
3805
|
-
const k = g, S = (d() - 0.5) * 2 *
|
|
3805
|
+
const k = g, S = (d() - 0.5) * 2 * b;
|
|
3806
3806
|
let C = k + S;
|
|
3807
|
-
C = Math.max(c +
|
|
3808
|
-
const I = Math.min(k, C) - d() *
|
|
3807
|
+
C = Math.max(c + m, Math.min(f - m, C));
|
|
3808
|
+
const I = Math.min(k, C) - d() * m, A = Math.max(k, C) + d() * m;
|
|
3809
3809
|
w.push({ x: s + p * (v + 0.5), openY: k, highY: I, lowY: A, closeY: C, up: C <= k }), g = C;
|
|
3810
3810
|
}
|
|
3811
3811
|
const M = [
|
|
3812
3812
|
{ 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" },
|
|
3813
3813
|
// dotted guide line through the walk's midline (matches the icon)
|
|
3814
3814
|
{ t: "line", a: { x: s, y: c + u / 2 }, b: { x: a, y: c + u / 2 }, stroke: o.color, strokeWidth: 1, strokeOpacity: 0.4, dash: "2 3", inert: !0 },
|
|
3815
|
-
{ t: "group", inert: !0, items:
|
|
3815
|
+
{ t: "group", inert: !0, items: Pc(w, y) }
|
|
3816
3816
|
];
|
|
3817
3817
|
if (n)
|
|
3818
|
-
for (const v of
|
|
3818
|
+
for (const v of bt(r, l))
|
|
3819
3819
|
M.push({ t: "circle", cx: v.x, cy: v.y, r: et, fill: "#fff", stroke: o.color, strokeWidth: 1.5, cursor: "nwse-resize" });
|
|
3820
3820
|
return M;
|
|
3821
3821
|
}
|
|
3822
|
-
const
|
|
3823
|
-
function
|
|
3822
|
+
const Wc = "#2e2e2e", Rc = { dx: 0, dy: 1, blur: 4, color: "rgba(0,0,0,0.4)" };
|
|
3823
|
+
function Fc(e, t, n, o) {
|
|
3824
3824
|
const i = n / 2, r = 10 + i, l = Math.min(e.y, t.y), s = Math.max(e.y, t.y);
|
|
3825
3825
|
let a;
|
|
3826
3826
|
if (e.y > t.y) {
|
|
@@ -3845,31 +3845,31 @@ function Un(e, t, n, o, i) {
|
|
|
3845
3845
|
if (!s || !a) return l;
|
|
3846
3846
|
if (o) {
|
|
3847
3847
|
const c = s.price, h = a.price - c, u = (n == null ? void 0 : n.pipSize()) ?? 0.01, x = Math.max(0, Math.min(8, Math.round(-Math.log10(u)))), d = r(t.showPriceRange), p = r(t.showPercentPriceRange), y = r(t.showPipsPriceRange);
|
|
3848
|
-
let
|
|
3849
|
-
if (d && (
|
|
3850
|
-
const
|
|
3851
|
-
d && (
|
|
3848
|
+
let m = "";
|
|
3849
|
+
if (d && (m += mt(h, x)), p) {
|
|
3850
|
+
const b = c !== 0 ? 100 * h / Math.abs(c) : 0;
|
|
3851
|
+
d && (m += " ("), m += `${mt(Math.round(b * 100) / 100, 2)}%`, d && (m += ")");
|
|
3852
3852
|
}
|
|
3853
|
-
y && (d ?
|
|
3853
|
+
y && (d ? m += p ? " " : ", " : p && (m += ", "), m += mt(Math.round(h / u), 0)), m && l.push(m);
|
|
3854
3854
|
}
|
|
3855
3855
|
if (i) {
|
|
3856
3856
|
const c = r(t.showBarsRange), f = r(t.showDateTimeRange), h = r(t.showVolume);
|
|
3857
3857
|
let u = "";
|
|
3858
3858
|
const x = O(s.time), d = O(a.time), p = (n == null ? void 0 : n.timeToBarIndex(s.time)) ?? null, y = (n == null ? void 0 : n.timeToBarIndex(a.time)) ?? null;
|
|
3859
3859
|
if (c && p != null && y != null && (u += `${y - p} bars`), f && x != null && d != null && (c && (u += ", "), u += Fn(d - x)), u && l.push(u), h && n && x != null && d != null) {
|
|
3860
|
-
const
|
|
3861
|
-
let
|
|
3862
|
-
for (const w of
|
|
3863
|
-
w.volume != null && (
|
|
3864
|
-
g && l.push(`Vol ${
|
|
3860
|
+
const m = Ue(n.bars(), Math.min(x, d), Math.max(x, d));
|
|
3861
|
+
let b = 0, g = !1;
|
|
3862
|
+
for (const w of m)
|
|
3863
|
+
w.volume != null && (b += w.volume, g = !0);
|
|
3864
|
+
g && l.push(`Vol ${ps(b)}`);
|
|
3865
3865
|
}
|
|
3866
3866
|
}
|
|
3867
3867
|
return l;
|
|
3868
3868
|
}
|
|
3869
|
-
function
|
|
3869
|
+
function Dc(e, t, n, o, i, r) {
|
|
3870
3870
|
if (!i.length) return [];
|
|
3871
|
-
const l = r.fontSize ?? 12, s = l * 0.4 + l / 3, a = l * 0.2 + l / 3, c = Math.max(...i.map((x) => st(x, l))) + s * 2, f = l * i.length + 8 * (i.length - 1) + a * 2, h =
|
|
3872
|
-
return r.fillLabelBackground !== !1 && u.push({ t: "rect", x: e - c / 2, y: h - f / 2, w: c, h: f, rx: 4, fill: r.labelBackgroundColor ??
|
|
3871
|
+
const l = r.fontSize ?? 12, s = l * 0.4 + l / 3, a = l * 0.2 + l / 3, c = Math.max(...i.map((x) => st(x, l))) + s * 2, f = l * i.length + 8 * (i.length - 1) + a * 2, h = Fc(t, n, f, o), u = [];
|
|
3872
|
+
return r.fillLabelBackground !== !1 && u.push({ t: "rect", x: e - c / 2, y: h - f / 2, w: c, h: f, rx: 4, fill: r.labelBackgroundColor ?? Wc, shadow: Rc }), i.forEach((x, d) => {
|
|
3873
3873
|
u.push({ t: "text", x: e, y: h - f / 2 + a + d * (l + 8) + l / 2, text: x, size: l, fill: r.textColor ?? "#ffffff", anchor: "middle", baseline: "central" });
|
|
3874
3874
|
}), [{ t: "group", inert: !0, items: u }];
|
|
3875
3875
|
}
|
|
@@ -3880,13 +3880,13 @@ function Qi(e, t, n) {
|
|
|
3880
3880
|
`), l = Math.ceil(i), s = Math.round((e.y + t.y) / 2);
|
|
3881
3881
|
return { x: (e.x + t.x) / 2, cy: s, top: s - r.length * l / 2, lines: r, lineH: l, fs: i };
|
|
3882
3882
|
}
|
|
3883
|
-
function
|
|
3883
|
+
function Oc(e, t, n) {
|
|
3884
3884
|
const o = Qi(e, t, n);
|
|
3885
3885
|
if (!o || !Me(o.lines)) return { items: [], clip: void 0 };
|
|
3886
3886
|
const i = o.fs / 3, r = Ri({ x: o.x, y: o.cy }, 0, o.lines, o.fs, o.lineH, i, i, "middle", "center", !!n.customTextBold, !!n.customTextItalic);
|
|
3887
3887
|
return r.length ? { items: [{ t: "clip", name: "text", polys: [r] }], clip: "text" } : { items: [], clip: void 0 };
|
|
3888
3888
|
}
|
|
3889
|
-
function
|
|
3889
|
+
function _c(e, t, n) {
|
|
3890
3890
|
const o = Qi(e, t, n);
|
|
3891
3891
|
return o ? o.lines.map((i, r) => ({
|
|
3892
3892
|
t: "text",
|
|
@@ -3903,11 +3903,11 @@ function Oc(e, t, n) {
|
|
|
3903
3903
|
pre: !0
|
|
3904
3904
|
})) : [];
|
|
3905
3905
|
}
|
|
3906
|
-
function
|
|
3906
|
+
function Hc(e) {
|
|
3907
3907
|
return e.fillBackground === !1 ? 0 : Math.max(0, Math.min(1, (100 - (e.transparency ?? 85)) / 100));
|
|
3908
3908
|
}
|
|
3909
3909
|
function Xn(e, t, n, o, i) {
|
|
3910
|
-
const r =
|
|
3910
|
+
const r = Hc(i);
|
|
3911
3911
|
return { t: "rect", x: e, y: t, w: n, h: o, fill: r > 0 ? i.backgroundColor ?? i.color : "transparent", fillOpacity: r > 0 ? r : 1 };
|
|
3912
3912
|
}
|
|
3913
3913
|
const Et = (e, t, n) => ({ t: "line", a: e, b: t, stroke: n.color, strokeWidth: n.width, cap: "round" }), Oe = (e, t, n) => ({
|
|
@@ -3920,16 +3920,16 @@ const Et = (e, t, n) => ({ t: "line", a: e, b: t, stroke: n.color, strokeWidth:
|
|
|
3920
3920
|
join: "round"
|
|
3921
3921
|
});
|
|
3922
3922
|
function Gn(e, t, n, o, i, r, l, s, a) {
|
|
3923
|
-
const c =
|
|
3923
|
+
const c = Oc(n, o, s), f = [
|
|
3924
3924
|
...c.items,
|
|
3925
3925
|
...e,
|
|
3926
3926
|
{ t: "group", clip: c.clip, items: t },
|
|
3927
|
-
...
|
|
3928
|
-
...
|
|
3927
|
+
...Dc((n.x + o.x) / 2, n, o, l, a, s),
|
|
3928
|
+
..._c(i[0], i[1], s)
|
|
3929
3929
|
];
|
|
3930
3930
|
return r && f.push({ t: "anchors", pts: i }), f;
|
|
3931
3931
|
}
|
|
3932
|
-
function
|
|
3932
|
+
function Nc(e, t, n, o, i, r, l) {
|
|
3933
3933
|
if (e.kind !== "price-range") return [];
|
|
3934
3934
|
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)];
|
|
3935
3935
|
Math.abs(a.y - s.y) >= 15 * r.width && x.push(Oe({ x: h, y: s.y }, { x: h, y: a.y }, r));
|
|
@@ -3940,7 +3940,7 @@ function Hc(e, t, n, o, i, r, l) {
|
|
|
3940
3940
|
];
|
|
3941
3941
|
return Gn(d, x, s, a, t, n, i, r, u);
|
|
3942
3942
|
}
|
|
3943
|
-
function
|
|
3943
|
+
function Yc(e, t, n, o, i, r) {
|
|
3944
3944
|
if (e.kind !== "date-range") return [];
|
|
3945
3945
|
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)];
|
|
3946
3946
|
Math.abs(s.x - l.x) >= 15 * i.width && u.push(Oe({ x: l.x, y: f }, { x: s.x, y: f }, i));
|
|
@@ -3951,17 +3951,17 @@ function Nc(e, t, n, o, i, r) {
|
|
|
3951
3951
|
];
|
|
3952
3952
|
return Gn(x, u, l, s, t, n, o, i, h);
|
|
3953
3953
|
}
|
|
3954
|
-
function
|
|
3954
|
+
function Vc(e, t, n, o, i, r) {
|
|
3955
3955
|
if (e.kind !== "date-and-price-range") return [];
|
|
3956
|
-
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,
|
|
3957
|
-
h > 0 &&
|
|
3958
|
-
const
|
|
3956
|
+
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, m = [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)];
|
|
3957
|
+
h > 0 && m.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 });
|
|
3958
|
+
const b = [
|
|
3959
3959
|
Et({ x, y: a }, { x: d, y: a }, i),
|
|
3960
3960
|
Et({ x: c, y: p }, { x: c, y }, i)
|
|
3961
3961
|
];
|
|
3962
|
-
return Math.abs(s.x - l.x) >= 25 * i.width &&
|
|
3962
|
+
return Math.abs(s.x - l.x) >= 25 * i.width && b.push(Oe({ x, y: a }, { x: d, y: a }, i)), Math.abs(s.y - l.y) >= 25 * i.width && b.push(Oe({ x: c, y: p }, { x: c, y }, i)), Gn(m, b, l, s, t, n, o, i, f);
|
|
3963
3963
|
}
|
|
3964
|
-
function
|
|
3964
|
+
function Uc(e, t, n, o, i, r) {
|
|
3965
3965
|
const l = i.regressionLines ?? Do, s = Zo(e, r, o);
|
|
3966
3966
|
if (!s) {
|
|
3967
3967
|
const u = [{ t: "line", a: t[0], b: t[1], stroke: l.base.color, strokeWidth: l.base.width, dash: R({ ...i, lineStyle: l.base.style }), cap: "round" }];
|
|
@@ -3971,7 +3971,7 @@ function Vc(e, t, n, o, i, r) {
|
|
|
3971
3971
|
{ seg: s.lower, st: l.down },
|
|
3972
3972
|
{ seg: s.center, st: l.base },
|
|
3973
3973
|
{ seg: s.upper, st: l.up }
|
|
3974
|
-
].filter((u) => !!u.seg && u.st.visible), c =
|
|
3974
|
+
].filter((u) => !!u.seg && u.st.visible), c = K(i), f = [];
|
|
3975
3975
|
c > 0 && a.slice(1).forEach((u, x) => {
|
|
3976
3976
|
const d = a[x].seg;
|
|
3977
3977
|
f.push({ t: "polygon", pts: [d[0], d[1], u.seg[1], u.seg[0]], fill: u.st.color, fillOpacity: c, stroke: "none", inert: !0 });
|
|
@@ -3984,7 +3984,7 @@ function Vc(e, t, n, o, i, r) {
|
|
|
3984
3984
|
const h = s.lower;
|
|
3985
3985
|
return i.showPearsons !== !1 && h && f.push({ t: "text", x: h[0].x, y: h[0].y + 4, text: String(s.pearsons), anchor: "middle", baseline: "hanging", size: 12, fill: l.down.color, inert: !0 }), n && f.push({ t: "anchors", pts: s.anchors }), f;
|
|
3986
3986
|
}
|
|
3987
|
-
function
|
|
3987
|
+
function Xc(e, t, n, o, i, r) {
|
|
3988
3988
|
const l = R(i), s = Jo(e, r), a = [{ t: "circle", cx: t[0].x, cy: t[0].y, r: et + L, fill: "transparent" }];
|
|
3989
3989
|
if (n && a.push({ t: "anchors", pts: t }), s.line.length < 2) {
|
|
3990
3990
|
const h = { x: o, y: t[0].y };
|
|
@@ -4000,7 +4000,7 @@ function Uc(e, t, n, o, i, r) {
|
|
|
4000
4000
|
];
|
|
4001
4001
|
for (const h of s.bands)
|
|
4002
4002
|
if (!(h.upper.length < 2 || h.lower.length < 2)) {
|
|
4003
|
-
i.fillBackground !== !1 && h.index === 0 && c.push({ t: "polygon", pts: [...h.upper, ...h.lower.slice().reverse()], fill: i.backgroundColor ?? "#4caf50", fillOpacity:
|
|
4003
|
+
i.fillBackground !== !1 && h.index === 0 && c.push({ t: "polygon", pts: [...h.upper, ...h.lower.slice().reverse()], fill: i.backgroundColor ?? "#4caf50", fillOpacity: K({ ...i, transparency: i.transparency ?? 95 }), stroke: "none", inert: !0 });
|
|
4004
4004
|
for (const [u, x] of [["upper", h.upper], ["lower", h.lower]]) {
|
|
4005
4005
|
const d = cn(i, h.index, u);
|
|
4006
4006
|
d.visible && c.push(...f(x, d.color, d.width));
|
|
@@ -4009,31 +4009,31 @@ function Uc(e, t, n, o, i, r) {
|
|
|
4009
4009
|
return c.push(...f(s.line, i.color, i.width, l), ...a), c;
|
|
4010
4010
|
}
|
|
4011
4011
|
const vo = (e) => e === "dashed" ? "6 4" : e === "dotted" ? "2 3" : void 0;
|
|
4012
|
-
function
|
|
4012
|
+
function Gc(e) {
|
|
4013
4013
|
const t = Math.abs(e), n = (o, i) => `${(e < 0 ? -o : o).toFixed(o >= 100 ? 0 : o >= 10 ? 1 : 2)}${i}`;
|
|
4014
4014
|
return t >= 1e9 ? n(t / 1e9, "B") : t >= 1e6 ? n(t / 1e6, "M") : t >= 1e3 ? n(t / 1e3, "K") : String(Math.round(e));
|
|
4015
4015
|
}
|
|
4016
4016
|
function Ji(e, t, n) {
|
|
4017
4017
|
const o = Bn(n.kind, n.style), { left: i, right: r, top: l, bottom: s, vp: a } = e, c = Math.max(1, r - i), f = Math.max(0, Math.min(100, o.percentWidth)) / 100 * c, h = o.placement === "right", u = (p) => {
|
|
4018
|
-
const y = t.priceToY(a.lo + (p + 1) * a.step) ?? l,
|
|
4019
|
-
return { y: Math.min(y,
|
|
4018
|
+
const y = t.priceToY(a.lo + (p + 1) * a.step) ?? l, m = t.priceToY(a.lo + p * a.step) ?? s;
|
|
4019
|
+
return { y: Math.min(y, m), h: Math.abs(m - y) };
|
|
4020
4020
|
}, x = [];
|
|
4021
4021
|
if (o.visible) {
|
|
4022
4022
|
const p = o.volume === "delta" ? a.maxDelta : a.maxTotal, y = 11;
|
|
4023
|
-
a.rows.forEach((
|
|
4024
|
-
const g = u(
|
|
4023
|
+
a.rows.forEach((m, b) => {
|
|
4024
|
+
const g = u(b), w = b >= a.vaFrom && b <= 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(m.up + m.down), color: M }] : o.volume === "delta" ? [{ w: S(Math.abs(m.up - m.down)), color: m.up >= m.down ? M : v }] : [{ w: S(m.up), color: M }, { w: S(m.down), color: v }];
|
|
4025
4025
|
let I = 0;
|
|
4026
4026
|
for (const A of C) {
|
|
4027
4027
|
const z = h ? r - I - A.w : i + I;
|
|
4028
4028
|
x.push({ t: "rect", x: z, y: g.y, w: A.w, h: k, fill: A.color }), I += A.w;
|
|
4029
4029
|
}
|
|
4030
4030
|
if (o.showValues && g.h >= y - 2) {
|
|
4031
|
-
const A = o.volume === "delta" ?
|
|
4031
|
+
const A = o.volume === "delta" ? m.up - m.down : m.up + m.down;
|
|
4032
4032
|
x.push({
|
|
4033
4033
|
t: "text",
|
|
4034
4034
|
x: h ? r - I - 4 : i + I + 4,
|
|
4035
4035
|
y: g.y + g.h / 2,
|
|
4036
|
-
text:
|
|
4036
|
+
text: Gc(A),
|
|
4037
4037
|
size: y,
|
|
4038
4038
|
fill: o.valuesColor,
|
|
4039
4039
|
anchor: h ? "end" : "start",
|
|
@@ -4043,18 +4043,18 @@ function Ji(e, t, n) {
|
|
|
4043
4043
|
});
|
|
4044
4044
|
}
|
|
4045
4045
|
const d = (p, y) => {
|
|
4046
|
-
const
|
|
4047
|
-
|
|
4046
|
+
const m = t.priceToY(p);
|
|
4047
|
+
m != null && x.push({ t: "line", a: { x: i, y: m }, b: { x: r, y: m }, stroke: y.color, strokeWidth: y.width, dash: vo(y.style) });
|
|
4048
4048
|
};
|
|
4049
4049
|
if (o.vah.visible && d(a.lo + (a.vaTo + 1) * a.step, o.vah), o.val.visible && d(a.lo + a.vaFrom * a.step, o.val), o.poc.visible && d(a.lo + (a.poc + 0.5) * a.step, o.poc), a.developing) {
|
|
4050
|
-
const p = (y,
|
|
4051
|
-
if (!
|
|
4052
|
-
const
|
|
4050
|
+
const p = (y, m) => {
|
|
4051
|
+
if (!m.visible) return;
|
|
4052
|
+
const b = [];
|
|
4053
4053
|
for (const g of a.developing) {
|
|
4054
4054
|
const w = t.timeToX(g.time), M = t.priceToY(y(g));
|
|
4055
|
-
w == null || M == null || (
|
|
4055
|
+
w == null || M == null || (b.length && b.push({ x: w, y: b[b.length - 1].y }), b.push({ x: w, y: M }));
|
|
4056
4056
|
}
|
|
4057
|
-
|
|
4057
|
+
b.length > 1 && x.push({ t: "polyline", pts: b, fill: "none", stroke: m.color, strokeWidth: m.width, dash: vo(m.style) });
|
|
4058
4058
|
};
|
|
4059
4059
|
p((y) => y.poc, o.developingPoc), p((y) => y.vah, o.developingVah), p((y) => y.val, o.developingVal);
|
|
4060
4060
|
}
|
|
@@ -4063,16 +4063,16 @@ function Ji(e, t, n) {
|
|
|
4063
4063
|
{ t: "group", inert: !0, items: x }
|
|
4064
4064
|
];
|
|
4065
4065
|
}
|
|
4066
|
-
function
|
|
4066
|
+
function jc(e, t, n, o) {
|
|
4067
4067
|
const i = ii(e, t, o), r = i && o ? Ji(i, o, e) : [];
|
|
4068
4068
|
return n && r.push({ t: "anchors", pts: t }), r;
|
|
4069
4069
|
}
|
|
4070
|
-
function
|
|
4070
|
+
function qc(e, t, n, o) {
|
|
4071
4071
|
const i = oi(e, t, o), r = i && o ? Ji(i, o, e) : [];
|
|
4072
4072
|
return n && r.push({ t: "anchors", pts: [t[0]] }), r;
|
|
4073
4073
|
}
|
|
4074
4074
|
const ko = /* @__PURE__ */ new Map();
|
|
4075
|
-
function
|
|
4075
|
+
function Zc(e, t) {
|
|
4076
4076
|
let n = ko.get(t);
|
|
4077
4077
|
n || (n = new Intl.DateTimeFormat("en-US", {
|
|
4078
4078
|
timeZone: t,
|
|
@@ -4092,11 +4092,11 @@ function qc(e, t) {
|
|
|
4092
4092
|
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") };
|
|
4093
4093
|
}
|
|
4094
4094
|
const Qe = (e, t) => String(e).padStart(t, "0");
|
|
4095
|
-
function
|
|
4096
|
-
const n =
|
|
4095
|
+
function Kc(e, t) {
|
|
4096
|
+
const n = Zc(e, t);
|
|
4097
4097
|
return { date: `${Qe(n.y, 4)}-${Qe(n.m, 2)}-${Qe(n.d, 2)}`, time: `${n.hh}:${n.mi}` };
|
|
4098
4098
|
}
|
|
4099
|
-
const Ie = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAAZ0lEQVR4Xl2OsQmAMBRErwgSsHAJV3GHgEVKl3ADixSClViKYPkHfEI+Wsg1j8dxnCQCiQ1jJRFcFIybHsNYCCJXvCSsJonzp/YXbiKzs7d8pavyEBP2yQEji5YV+1KIkmjI/ouRID31wXKLSuZPUAAAAABJRU5ErkJggg==", w: 9, h: 9 },
|
|
4099
|
+
const Ie = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAAZ0lEQVR4Xl2OsQmAMBRErwgSsHAJV3GHgEVKl3ADixSClViKYPkHfEI+Wsg1j8dxnCQCiQ1jJRFcFIybHsNYCCJXvCSsJonzp/YXbiKzs7d8pavyEBP2yQEji5YV+1KIkmjI/ouRID31wXKLSuZPUAAAAABJRU5ErkJggg==", w: 9, h: 9 }, Qc = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAQAAADI+WwIAAAAb0lEQVQIHWXAMQpBAQAG4L9eKQdQSr3JpFzC5CoOoJzBSUzK+iallNWkrG99pUymDxHw5Z+RdX4ZOpnmm57aXiuWunnScXAxTGLhqMyNth1muVNq1AYKK2wVeTBGo8JZP2/mgEk+KWxQ5ZfSUS8vV97kThm/FD/aAAAAAElFTkSuQmCC", w: 11, h: 10 }, Jc = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAARElEQVR4AWMgHvy/9//5f34gzQZiQYSeAyEPkOYE0iAhMJOTAc4ixXjR/13/r/7////h/zn/pSFCT/43/lcHS6X9fwgANMArS3ikrioAAAAASUVORK5CYII=", w: 9, h: 9 };
|
|
4100
4100
|
function Je(e, t, n, o, i, r, l, s) {
|
|
4101
4101
|
const a = l.fontSize ?? 12, c = 4, f = a / 3, h = Math.max(...i.map((d) => st(d, a))) + c * 2, u = a * i.length + f * 2, x = n === "bottom" ? t - o - u : n === "top" ? t + o : t - u / 2 + o;
|
|
4102
4102
|
return {
|
|
@@ -4120,37 +4120,37 @@ function Je(e, t, n, o, i, r, l, s) {
|
|
|
4120
4120
|
function Lo(e, t, n, o, i, r) {
|
|
4121
4121
|
const l = In(e, t, r);
|
|
4122
4122
|
if (!l) return [];
|
|
4123
|
-
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,
|
|
4123
|
+
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, m = i.targetTransparency ?? 80, b = Lt(p, 100 - m), g = Lt(d, 100 - y), { yStop: w, yTarget: M, stop: v, profit: k } = l, S = i.accountSize ?? 1e3, { qty: C, shown: I } = Pr(i, c, v), A = (fe) => parseFloat(fe.toFixed(2)), z = A(S + k * C), D = A(S - v * C), T = v > 0 ? Math.round(100 * k / v) / 100 : 0, E = o === "long" ? 1 : -1, P = Er(e, o, c - E * v, c + E * k, r), B = P ? (P.closePrice - c) * E : null, F = (r == null ? void 0 : r.pipSize()) ?? 0.01, Y = Math.max(0, Math.min(8, Math.round(-Math.log10(F)))), Q = Jn(i, "tp", k, c, F, Y, z, k * C), xt = Jn(i, "sl", v, c, F, Y, D, -v * C), Vt = $r(i, B != null ? mt(B, Y) : null, !!(P != null && P.closed), I, T), vt = Vt ? Vt.split(`
|
|
4124
4124
|
`) : [], Ut = B != null && B < 0 ? d : B != null && B > 0 ? p : i.color, le = (fe) => {
|
|
4125
4125
|
var Zn;
|
|
4126
4126
|
const qn = (Zn = ((r == null ? void 0 : r.bars()) ?? [])[fe]) == null ? void 0 : Zn.time;
|
|
4127
4127
|
return qn != null && r ? r.timeToX(qn) : null;
|
|
4128
4128
|
}, 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(
|
|
4129
4129
|
0,
|
|
4130
|
-
st(
|
|
4130
|
+
st(Q, i.fontSize ?? 12),
|
|
4131
4131
|
st(xt, i.fontSize ?? 12),
|
|
4132
4132
|
...vt.map((fe) => st(fe, i.fontSize ?? 12))
|
|
4133
|
-
) + 8, ce = h - f - Se - et <= 8, ae = ce ? et + 8 : 0,
|
|
4133
|
+
) + 8, ce = h - f - Se - et <= 8, ae = ce ? et + 8 : 0, pr = ce ? (M < w ? 1 : -1) * (k > v ? -1 : 1) * (0.5 * ((i.fontSize ?? 12) * 2 + 2 * (i.fontSize ?? 12) / 3) + et + 8) : 0, yt = [
|
|
4134
4134
|
{ t: "rect", x: f, y: Math.min(M, w), w: u, h: Math.abs(M - w), fill: "transparent" },
|
|
4135
4135
|
// profit + stop zones; the P&L zone from the actual entry to the actual
|
|
4136
4136
|
// close (or the close point) between the entry and close prices, alpha
|
|
4137
4137
|
// 1 − (transparency / 100)^3 (TV)
|
|
4138
4138
|
{ t: "rect", x: f, y: Math.min(s.y, w), w: u, h: Math.abs(w - s.y), fill: g }
|
|
4139
4139
|
];
|
|
4140
|
-
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:
|
|
4140
|
+
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: b }), Ft && B != null && B > 0 && yt.push({ t: "rect", ...Ft, fill: p, fillOpacity: 1 - (m / 100) ** 3 }), Tt && yt.push(
|
|
4141
4141
|
{ t: "line", a: Tt.from, b: Tt.to, stroke: i.color, strokeWidth: 1, dash: "6 4", inert: !0 },
|
|
4142
4142
|
{ t: "path", d: je(Tt.from, Tt.to, 1), fill: "none", stroke: i.color, strokeWidth: 1, inert: !0 }
|
|
4143
4143
|
), yt.push(
|
|
4144
4144
|
{ t: "line", a: { x: f, y: s.y }, b: { x: h, y: s.y }, stroke: i.color, strokeWidth: i.width },
|
|
4145
|
-
{ t: "line", a: { x: f, y: M }, b: { x: h, y: M }, stroke:
|
|
4145
|
+
{ t: "line", a: { x: f, y: M }, b: { x: h, y: M }, stroke: b, strokeWidth: i.width },
|
|
4146
4146
|
{ t: "line", a: { x: f, y: w }, b: { x: h, y: w }, stroke: g, strokeWidth: i.width }
|
|
4147
|
-
), Le && (
|
|
4147
|
+
), Le && (Q && yt.push(Je(x, M, M < s.y ? "bottom" : "top", ae, [Q], p, i)), vt.length > 0 && yt.push(Je(x, s.y, "middle", pr, vt, Ut, i, "#ffffff")), xt && yt.push(Je(x, w, w > s.y ? "top" : "bottom", ae, [xt], d, i))), n && yt.push({ t: "anchors", pts: l.anchors, squares: Yt.position }), yt;
|
|
4148
4148
|
}
|
|
4149
|
-
const
|
|
4149
|
+
const ta = "#202020", So = Ie.w;
|
|
4150
4150
|
function Co(e, t, n) {
|
|
4151
4151
|
const o = O(e);
|
|
4152
4152
|
if (o == null) return "";
|
|
4153
|
-
const i = (n == null ? void 0 : n.timeInfo()) ?? { timeZone: "UTC", intraday: !0 }, { date: r, time: l } =
|
|
4153
|
+
const i = (n == null ? void 0 : n.timeInfo()) ?? { timeZone: "UTC", intraday: !0 }, { date: r, time: l } = Kc(o, i.timeZone);
|
|
4154
4154
|
return i.intraday ? `${r}${t}${l}` : r;
|
|
4155
4155
|
}
|
|
4156
4156
|
function To(e) {
|
|
@@ -4159,7 +4159,7 @@ function To(e) {
|
|
|
4159
4159
|
const f = [
|
|
4160
4160
|
{ t: "rect", x: r, y: l, w: n, h: o, rx: 3, fill: e.bg, fillOpacity: e.opacity, stroke: e.stroke, strokeOpacity: e.opacity, strokeWidth: 2 },
|
|
4161
4161
|
{ t: "path", d: `M ${e.cx - 5} ${s} L ${e.cx} ${a} L ${e.cx + 5} ${s} Z`, fill: e.bg, fillOpacity: e.opacity },
|
|
4162
|
-
{ t: "circle", cx: e.cx, cy: e.y, r: 3, fill:
|
|
4162
|
+
{ t: "circle", cx: e.cx, cy: e.y, r: 3, fill: ta }
|
|
4163
4163
|
];
|
|
4164
4164
|
for (const u of e.rows) {
|
|
4165
4165
|
const x = u.dy != null ? l + u.dy : c;
|
|
@@ -4173,21 +4173,21 @@ function To(e) {
|
|
|
4173
4173
|
}
|
|
4174
4174
|
const h = e.banner;
|
|
4175
4175
|
if (h) {
|
|
4176
|
-
const x = h.above ? l - 18 - 2 : l + o + 2, d =
|
|
4176
|
+
const x = h.above ? l - 18 - 2 : l + o + 2, d = ys(h.text, 14), p = r + Math.round((n - d) / 2), y = h.icon, m = h.above ? x + Math.abs(18 - y.h) / 2 : x + 8 - Math.abs(18 - y.h) / 2;
|
|
4177
4177
|
f.push(
|
|
4178
4178
|
{ t: "rect", x: r - 1, y: x, w: n + 2, h: 18, rx: 5, fill: h.bg, fillOpacity: e.opacity },
|
|
4179
4179
|
{ t: "text", x: p, y: x + 3, text: h.text, size: 14, weight: "bold", fill: h.fg, baseline: "hanging" },
|
|
4180
|
-
{ t: "image", href: y.href, x: p - y.w - 4, y:
|
|
4180
|
+
{ t: "image", href: y.href, x: p - y.w - 4, y: m, w: y.w, h: y.h }
|
|
4181
4181
|
);
|
|
4182
4182
|
}
|
|
4183
4183
|
return { t: "group", inert: !0, items: f };
|
|
4184
4184
|
}
|
|
4185
|
-
function
|
|
4185
|
+
function ea(e, t, n, o, i, r) {
|
|
4186
4186
|
if (e.kind !== "position-forecast") return [];
|
|
4187
|
-
const [l, s] = t, a = s.y <= l.y, c = ti(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,
|
|
4187
|
+
const [l, s] = t, a = s.y <= l.y, c = ti(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, m = [s, { x: p - x * (d / 2), y: y + u * (d / 2) }, { x: p + x * (d / 2), y: y - u * (d / 2) }], b = e.points[1].price - e.points[0].price, g = e.points[0].price !== 0 ? b / Math.abs(e.points[0].price) * 100 : 0, w = O(e.points[0].time), M = O(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 = qr(e, r), I = Math.max(0, Math.min(1, (100 - (i.transparency ?? 10)) / 100)), A = [
|
|
4188
4188
|
{ t: "polyline", pts: c, fill: "none", stroke: "transparent", strokeWidth: 12 },
|
|
4189
4189
|
{ t: "polyline", pts: c, fill: "none", stroke: i.color, strokeWidth: i.width, join: "round" },
|
|
4190
|
-
{ t: "polygon", pts:
|
|
4190
|
+
{ t: "polygon", pts: m, fill: i.color, stroke: i.color, strokeWidth: 1, join: "round" },
|
|
4191
4191
|
// source balloon on the direction side; target balloon opposite
|
|
4192
4192
|
To({
|
|
4193
4193
|
cx: l.x,
|
|
@@ -4211,7 +4211,7 @@ function ta(e, t, n, o, i, r) {
|
|
|
4211
4211
|
paneW: o,
|
|
4212
4212
|
height: 38,
|
|
4213
4213
|
rows: [
|
|
4214
|
-
{ text: `${
|
|
4214
|
+
{ text: `${mt(b, S)} (${mt(Math.round(g * 100) / 100, 2)}%)${v ? ` in ${v}` : ""}`, size: 14, dy: 5 },
|
|
4215
4215
|
{ text: e.points[1].price.toFixed(S), size: 11, dy: 22, clockThen: Co(e.points[1].time, " ", r) }
|
|
4216
4216
|
],
|
|
4217
4217
|
bg: i.targetBackColor ?? "#2962FF",
|
|
@@ -4220,7 +4220,7 @@ function ta(e, t, n, o, i, r) {
|
|
|
4220
4220
|
opacity: I,
|
|
4221
4221
|
banner: C === "waiting" ? void 0 : {
|
|
4222
4222
|
text: C === "success" ? "SUCCESS" : "FAILURE",
|
|
4223
|
-
icon: C === "success" ?
|
|
4223
|
+
icon: C === "success" ? Qc : Jc,
|
|
4224
4224
|
bg: C === "success" ? i.successBackground ?? "#4caf50" : i.failureBackground ?? "#F23645",
|
|
4225
4225
|
fg: C === "success" ? i.successTextColor ?? "#ffffff" : i.failureTextColor ?? "#ffffff",
|
|
4226
4226
|
above: a
|
|
@@ -4229,8 +4229,8 @@ function ta(e, t, n, o, i, r) {
|
|
|
4229
4229
|
];
|
|
4230
4230
|
return n && A.push({ t: "anchors", pts: t }), A;
|
|
4231
4231
|
}
|
|
4232
|
-
const tr = { dx: 0, dy: 2, blur: 4, color: "rgba(0,0,0,0.4)" },
|
|
4233
|
-
function
|
|
4232
|
+
const tr = { dx: 0, dy: 2, blur: 4, color: "rgba(0,0,0,0.4)" }, na = { dx: 0, dy: 1, blur: 4, color: "rgba(0,0,0,0.4)" }, ke = (e) => Lt(ct(e).hex, 50);
|
|
4233
|
+
function oa(e, t, n, o) {
|
|
4234
4234
|
const i = e.style, r = vi(e, t), l = gt(e).faint, s = Math.max(1, Math.round(Math.max((i.fontSize ?? 14) / 12, 1))), a = n ? "#2962ff" : o ? "rgba(41, 98, 255, 0.4)" : null, c = r.box, f = [
|
|
4235
4235
|
{
|
|
4236
4236
|
t: "rect",
|
|
@@ -4253,8 +4253,8 @@ function na(e, t, n, o) {
|
|
|
4253
4253
|
}
|
|
4254
4254
|
return n && i.wordWrap && f.push({ t: "anchors", pts: [{ x: c.left + c.width, y: c.top + c.height / 2 }] }), f;
|
|
4255
4255
|
}
|
|
4256
|
-
function
|
|
4257
|
-
const i = e.style, r = [{ t: "path", d:
|
|
4256
|
+
function ia(e, t, n, o) {
|
|
4257
|
+
const i = e.style, r = [{ t: "path", d: wl, transform: `translate(${t.x - 12} ${t.y - 30})`, fill: i.color, fillRule: "evenodd" }];
|
|
4258
4258
|
if (!n) return r;
|
|
4259
4259
|
const l = Li(e, t, o), s = gt(e).faint, a = i.textColor ?? "#dbdbdb", c = [];
|
|
4260
4260
|
return i.fillBackground !== !1 && c.push({ t: "path", d: fo(l, t.x), fill: Lt(ct(i.backgroundColor ?? "#2e2e2e").hex, 100 - (i.transparency ?? 0)), shadow: tr }), i.drawBorder && c.push({ t: "path", d: fo(l, t.x), fill: "none", stroke: i.borderColor ?? "#4a4a4a", strokeWidth: 1, inert: !0 }), l.lines.forEach((f, h) => {
|
|
@@ -4273,7 +4273,7 @@ function oa(e, t, n, o) {
|
|
|
4273
4273
|
});
|
|
4274
4274
|
}), r.push({ t: "group", items: c }, { t: "anchors", pts: [t] }), r;
|
|
4275
4275
|
}
|
|
4276
|
-
function
|
|
4276
|
+
function ra(e, t, n, o) {
|
|
4277
4277
|
const [i, r] = t;
|
|
4278
4278
|
if (!r) return [];
|
|
4279
4279
|
const { txt: l, faint: s, fs: a, box: c } = Mi(e, o, i, r), f = c.left, h = c.top, u = c.width, x = c.height, d = o.color ?? "#dbdbdb", p = [
|
|
@@ -4308,11 +4308,11 @@ function ia(e, t, n, o) {
|
|
|
4308
4308
|
];
|
|
4309
4309
|
return n && p.push({ t: "anchors", pts: t }), p;
|
|
4310
4310
|
}
|
|
4311
|
-
function
|
|
4311
|
+
function la(e, t, n, o) {
|
|
4312
4312
|
const [i] = t, { l: r, r: l } = ki(e, i), s = gt(e).faint, a = o.textColor ?? "#ffffff", c = r.box, f = [
|
|
4313
4313
|
{
|
|
4314
4314
|
t: "path",
|
|
4315
|
-
d:
|
|
4315
|
+
d: gl(c.left, c.top, c.width, c.height, [l, l, l, 2]),
|
|
4316
4316
|
fill: Lt(ct(o.backgroundColor ?? o.color).hex, 100 - (o.transparency ?? 0)),
|
|
4317
4317
|
stroke: o.borderColor ?? o.color,
|
|
4318
4318
|
strokeWidth: 2
|
|
@@ -4321,12 +4321,12 @@ function ra(e, t, n, o) {
|
|
|
4321
4321
|
];
|
|
4322
4322
|
return n && f.push({ t: "anchors", pts: t }), f;
|
|
4323
4323
|
}
|
|
4324
|
-
function
|
|
4324
|
+
function sa(e, t, n, o, i) {
|
|
4325
4325
|
const r = n ? Wn(e, t, n, o) : null;
|
|
4326
4326
|
if (!r) return [];
|
|
4327
4327
|
const l = [{ t: "line", a: { x: r.x, y: r.poleStart }, b: { x: r.x, y: r.poleEnd }, stroke: Dt.pole, strokeWidth: 1 }];
|
|
4328
4328
|
r.gap && l.push({ t: "line", a: { x: r.x, y: r.gap[0] }, b: { x: r.x, y: r.gap[1] }, stroke: Dt.pole, strokeWidth: 1 }), e.style.showImage && l.push(
|
|
4329
|
-
{ t: "circle", cx: r.x, cy: r.plateY, r: 35, fill: e.style.plateColor ?? "#2962ff", stroke: Dt.plateBorder, strokeWidth: 1, shadow:
|
|
4329
|
+
{ t: "circle", cx: r.x, cy: r.plateY, r: 35, fill: e.style.plateColor ?? "#2962ff", stroke: Dt.plateBorder, strokeWidth: 1, shadow: na },
|
|
4330
4330
|
{ t: "text", x: r.x, y: r.plateY, text: e.glyph || "🙂", anchor: "middle", baseline: "central", size: 32, inert: !0 }
|
|
4331
4331
|
);
|
|
4332
4332
|
const s = r.l.box;
|
|
@@ -4335,11 +4335,11 @@ function la(e, t, n, o, i) {
|
|
|
4335
4335
|
U(r.l, gt(e).faint ? ke(Dt.labelText) : Dt.labelText, e.style.bold, e.style.italic)
|
|
4336
4336
|
), i && l.push({ t: "anchors", pts: [r.anchor], squares: Yt.single }), l;
|
|
4337
4337
|
}
|
|
4338
|
-
function
|
|
4338
|
+
function ca(e, t, n, o, i) {
|
|
4339
4339
|
const [r, l] = t, s = (i == null ? void 0 : i.pipSize()) ?? 0.01, a = Math.max(0, Math.min(8, Math.round(-Math.log10(s)))), c = Go(e, t, a), f = (() => {
|
|
4340
4340
|
if (!e.text) return null;
|
|
4341
|
-
const d = r.x < l.x ? r : l, p = d === r ? l : r, y = o.horzLabelsAlign ?? "center",
|
|
4342
|
-
return G({ x:
|
|
4341
|
+
const d = r.x < l.x ? r : l, p = d === r ? l : r, y = o.horzLabelsAlign ?? "center", m = y === "left" ? d : y === "right" ? p : { x: (r.x + l.x) / 2, y: (r.y + l.y) / 2 }, b = Math.atan((p.y - d.y) / (p.x - d.x));
|
|
4342
|
+
return G({ x: m.x, y: m.y, text: e.text, fs: o.fontSize ?? 14, bold: o.bold, italic: o.italic, vert: o.vertLabelsAlign ?? "bottom", horz: y, angle: Number.isNaN(b) ? 0 : b });
|
|
4343
4343
|
})(), h = f && (o.vertLabelsAlign ?? "bottom") === "middle" ? f.poly : null, u = h && h.length ? "text" : void 0, x = [{ t: "hit", a: r, b: l, width: 12 }];
|
|
4344
4344
|
if (f && x.push(U(f, o.textColor ?? "#2962ff", o.bold, o.italic)), x.push({ t: "circle", cx: r.x, cy: r.y, r: 2, fill: o.color }), u && x.push({ t: "clip", name: u, polys: [h] }), x.push({ t: "line", a: r, b: l, stroke: o.color, strokeWidth: 1, cap: "round", clip: u }), c) {
|
|
4345
4345
|
const d = c.box;
|
|
@@ -4350,10 +4350,10 @@ function sa(e, t, n, o, i) {
|
|
|
4350
4350
|
}
|
|
4351
4351
|
return x.push({ t: "circle", cx: r.x, cy: r.y, r: 2.5, fill: "none", stroke: "#0f0f0f", strokeWidth: 1, inert: !0 }), n && x.push({ t: "anchors", pts: t }), x;
|
|
4352
4352
|
}
|
|
4353
|
-
function
|
|
4353
|
+
function aa(e, t, n, o) {
|
|
4354
4354
|
const [i, r] = t, l = Ci(e, r), s = gt(e).faint, a = o.textColor ?? "#ffffff", c = [{
|
|
4355
4355
|
t: "path",
|
|
4356
|
-
d:
|
|
4356
|
+
d: vl(l, i, r),
|
|
4357
4357
|
fill: Lt(ct(o.backgroundColor ?? o.color).hex, 100 - (o.transparency ?? 50)),
|
|
4358
4358
|
stroke: o.borderColor ?? o.color,
|
|
4359
4359
|
strokeWidth: o.width,
|
|
@@ -4374,29 +4374,29 @@ function ca(e, t, n, o) {
|
|
|
4374
4374
|
});
|
|
4375
4375
|
}), n && c.push({ t: "anchors", pts: l.wrap != null ? [i, { x: r.x + l.wrap / 2 + 10, y: r.y }] : [i] }), c;
|
|
4376
4376
|
}
|
|
4377
|
-
function
|
|
4377
|
+
function fa(e, t, n, o) {
|
|
4378
4378
|
const i = En(e, t), r = e.style, l = i.right - i.left, s = i.bottom - i.top;
|
|
4379
4379
|
let a = "";
|
|
4380
4380
|
for (const d of i.ys) a += `M${i.left} ${d}h${l}v${ht}h${-l}Z`;
|
|
4381
4381
|
for (const d of i.xs) a += `M${d} ${i.top}h${ht}v${s}h${-ht}Z`;
|
|
4382
4382
|
let c = "";
|
|
4383
4383
|
if (o != null && o.cell && o.cell[0] < i.ys.length - 1 && o.cell[1] < i.xs.length - 1) {
|
|
4384
|
-
const [d, p] = o.cell, y = i.xs[p],
|
|
4384
|
+
const [d, p] = o.cell, y = i.xs[p], m = i.xs[p + 1], b = i.ys[d], g = i.ys[d + 1], w = ht, M = Jr;
|
|
4385
4385
|
c = [
|
|
4386
|
-
[y + w,
|
|
4387
|
-
[y + w, g - M,
|
|
4388
|
-
[y + w,
|
|
4389
|
-
[
|
|
4386
|
+
[y + w, b + w, m - y - w, M],
|
|
4387
|
+
[y + w, g - M, m - y - w, M],
|
|
4388
|
+
[y + w, b + w, M, g - b - w],
|
|
4389
|
+
[m - M, b + w, M, g - b - w]
|
|
4390
4390
|
].map(([k, S, C, I]) => `M${k} ${S}h${C}v${I}h${-C}Z`).join("");
|
|
4391
4391
|
}
|
|
4392
4392
|
let f = "";
|
|
4393
4393
|
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`));
|
|
4394
4394
|
const h = r.horzLabelsAlign ?? "left", u = [];
|
|
4395
4395
|
i.cells.forEach((d, p) => {
|
|
4396
|
-
d.forEach((y,
|
|
4396
|
+
d.forEach((y, m) => {
|
|
4397
4397
|
var k;
|
|
4398
|
-
const
|
|
4399
|
-
|
|
4398
|
+
const b = o != null && o.editing && o.cell && o.cell[0] === p && o.cell[1] === m ? [] : ((k = i.lines[p]) == null ? void 0 : k[m]) ?? [], g = i.xs[m], w = i.xs[m + 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;
|
|
4399
|
+
b.forEach((S, C) => {
|
|
4400
4400
|
u.push({
|
|
4401
4401
|
t: "text",
|
|
4402
4402
|
x: M,
|
|
@@ -4417,9 +4417,9 @@ function aa(e, t, n, o) {
|
|
|
4417
4417
|
{ t: "rect", x: i.left, y: i.top, w: l, h: s, fill: r.backgroundColor ?? "#0f0f0f" },
|
|
4418
4418
|
{ t: "path", d: a, fill: r.color, crisp: !0 }
|
|
4419
4419
|
];
|
|
4420
|
-
return c && x.push({ t: "path", d: c, fill:
|
|
4420
|
+
return c && x.push({ t: "path", d: c, fill: tl, crisp: !0 }), x.push({ t: "group", inert: !0, items: u }), f && x.push({ t: "path", d: f, fill: el, inert: !0 }), n && x.push({ t: "anchors", pts: pi(i) }), x;
|
|
4421
4421
|
}
|
|
4422
|
-
function
|
|
4422
|
+
function ha(e, t, n) {
|
|
4423
4423
|
var r, l;
|
|
4424
4424
|
const o = gi(e, t);
|
|
4425
4425
|
if (!o) return [];
|
|
@@ -4439,23 +4439,23 @@ function tn(e, t, n) {
|
|
|
4439
4439
|
const { w: o, h: i, coords: r, selected: l } = n, s = !!n.hovered, a = l || s, c = e.style;
|
|
4440
4440
|
switch (e.kind) {
|
|
4441
4441
|
case "horizontal-line":
|
|
4442
|
-
return
|
|
4442
|
+
return vs(t, l, o, c);
|
|
4443
4443
|
case "vertical-line":
|
|
4444
|
-
return
|
|
4444
|
+
return ks(t, l, i, c);
|
|
4445
4445
|
case "cross-line":
|
|
4446
|
-
return
|
|
4446
|
+
return Ls(t, l, o, i, c);
|
|
4447
4447
|
case "trend-line":
|
|
4448
4448
|
return c.extendLeft || c.extendRight ? Ae(e, t, l, o, i, c, !!c.extendLeft, !!c.extendRight, r, a) : xo(e, t, l, o, i, c, r, a);
|
|
4449
4449
|
case "horizontal-ray":
|
|
4450
|
-
return
|
|
4450
|
+
return Ss(t, l, o, c);
|
|
4451
4451
|
case "ray":
|
|
4452
4452
|
return Ae(e, t, l, o, i, c, c.extendLeft ?? !1, c.extendRight ?? !0, r, a);
|
|
4453
4453
|
case "extended-line":
|
|
4454
4454
|
return Ae(e, t, l, o, i, c, c.extendLeft ?? !0, c.extendRight ?? !0, r, a);
|
|
4455
4455
|
case "info-line":
|
|
4456
|
-
return Ss(e, t, l, o, i, c, r, a);
|
|
4457
|
-
case "trend-angle":
|
|
4458
4456
|
return Cs(e, t, l, o, i, c, r, a);
|
|
4457
|
+
case "trend-angle":
|
|
4458
|
+
return Ts(e, t, l, o, i, c, r, a);
|
|
4459
4459
|
case "arrow": {
|
|
4460
4460
|
const f = { ...c, leftEnd: c.leftEnd ?? 0, rightEnd: c.rightEnd ?? 1 };
|
|
4461
4461
|
return f.extendLeft || f.extendRight ? Ae(e, t, l, o, i, f, !!f.extendLeft, !!f.extendRight, r, a) : xo(e, t, l, o, i, f, r, a);
|
|
@@ -4465,71 +4465,71 @@ function tn(e, t, n) {
|
|
|
4465
4465
|
case "short-position":
|
|
4466
4466
|
return Lo(e, t, l, "short", c, r);
|
|
4467
4467
|
case "position-forecast":
|
|
4468
|
-
return
|
|
4468
|
+
return ea(e, t, l, o, c, r);
|
|
4469
4469
|
case "parallel-channel":
|
|
4470
|
-
return
|
|
4470
|
+
return Is(t, l, c, o, i);
|
|
4471
4471
|
case "disjoint-channel":
|
|
4472
|
-
return Is(e, t, l, c, o, i, r);
|
|
4473
|
-
case "flat-top-bottom":
|
|
4474
4472
|
return Ps(e, t, l, c, o, i, r);
|
|
4473
|
+
case "flat-top-bottom":
|
|
4474
|
+
return Es(e, t, l, c, o, i, r);
|
|
4475
4475
|
case "fib-retracement":
|
|
4476
|
-
return Es(e, t, l, o, c, r);
|
|
4477
|
-
case "trend-based-fib-extension":
|
|
4478
4476
|
return zs(e, t, l, o, c, r);
|
|
4477
|
+
case "trend-based-fib-extension":
|
|
4478
|
+
return Ws(e, t, l, o, c, r);
|
|
4479
4479
|
case "fib-channel":
|
|
4480
|
-
return
|
|
4480
|
+
return Rs(e, t, l, c, r, o, i);
|
|
4481
4481
|
case "trend-based-fib-time":
|
|
4482
|
-
return
|
|
4482
|
+
return Fs(e, t, l, i, c, r);
|
|
4483
4483
|
case "fib-time-zone":
|
|
4484
|
-
return
|
|
4484
|
+
return Ds(t, l, i, c);
|
|
4485
4485
|
case "fib-circles":
|
|
4486
|
-
return
|
|
4486
|
+
return _s(e, t, l, c);
|
|
4487
4487
|
case "fib-speed-resistance-fan":
|
|
4488
|
-
return
|
|
4488
|
+
return Hs(e, t, l, o, i, c, r);
|
|
4489
4489
|
case "fib-speed-resistance-arcs":
|
|
4490
|
-
return
|
|
4490
|
+
return Ns(t, l, c);
|
|
4491
4491
|
case "fib-spiral":
|
|
4492
|
-
return
|
|
4492
|
+
return Ys(t, l, o, i, c);
|
|
4493
4493
|
case "fib-wedge":
|
|
4494
|
-
return
|
|
4494
|
+
return Vs(t, l, c);
|
|
4495
4495
|
case "pitchfan":
|
|
4496
|
-
return
|
|
4496
|
+
return Us(t, l, o, c);
|
|
4497
4497
|
case "pitchfork":
|
|
4498
4498
|
case "schiff-pitchfork":
|
|
4499
4499
|
case "modified-schiff-pitchfork":
|
|
4500
4500
|
case "inside-pitchfork":
|
|
4501
|
-
return
|
|
4501
|
+
return qs(e.kind, t, l, o, c);
|
|
4502
4502
|
case "gann-fan":
|
|
4503
|
-
return
|
|
4503
|
+
return Gs(t, l, o, i, c);
|
|
4504
4504
|
case "gann-box":
|
|
4505
|
-
return
|
|
4505
|
+
return js(e, t, l, c, r);
|
|
4506
4506
|
case "gann-square-fixed":
|
|
4507
4507
|
case "gann-square":
|
|
4508
|
-
return
|
|
4508
|
+
return Xs(e, t, l, c, r);
|
|
4509
4509
|
case "rectangle":
|
|
4510
|
-
return
|
|
4510
|
+
return Qs(e, t, l, o, c, s);
|
|
4511
4511
|
case "rotated-rectangle":
|
|
4512
|
-
return
|
|
4512
|
+
return Js(e, t, l, c);
|
|
4513
4513
|
case "circle":
|
|
4514
|
-
return Js(e, t, l, c, s);
|
|
4515
|
-
case "ellipse":
|
|
4516
4514
|
return tc(e, t, l, c, s);
|
|
4515
|
+
case "ellipse":
|
|
4516
|
+
return ec(e, t, l, c, s);
|
|
4517
4517
|
case "triangle":
|
|
4518
|
-
return
|
|
4518
|
+
return nc(t, l, c, s);
|
|
4519
4519
|
case "arc":
|
|
4520
|
-
return nc(t, l, c);
|
|
4521
|
-
case "curve":
|
|
4522
4520
|
return oc(t, l, c);
|
|
4523
|
-
case "
|
|
4521
|
+
case "curve":
|
|
4524
4522
|
return ic(t, l, c);
|
|
4525
|
-
case "
|
|
4523
|
+
case "double-curve":
|
|
4526
4524
|
return rc(t, l, c);
|
|
4525
|
+
case "sector":
|
|
4526
|
+
return lc(t, l, c);
|
|
4527
4527
|
case "cyclic-lines":
|
|
4528
|
-
return
|
|
4528
|
+
return sc(t, l, o, i, c);
|
|
4529
4529
|
case "sine-line":
|
|
4530
|
-
return sc(t, l, o, c);
|
|
4531
|
-
case "time-cycles":
|
|
4532
4530
|
return cc(t, l, o, c);
|
|
4531
|
+
case "time-cycles":
|
|
4532
|
+
return ac(t, l, o, c);
|
|
4533
4533
|
case "abcd-pattern":
|
|
4534
4534
|
case "xabcd-pattern":
|
|
4535
4535
|
case "cypher-pattern":
|
|
@@ -4545,59 +4545,59 @@ function tn(e, t, n) {
|
|
|
4545
4545
|
case "path":
|
|
4546
4546
|
case "brush":
|
|
4547
4547
|
case "highlighter":
|
|
4548
|
-
return
|
|
4548
|
+
return Mc(e, t, l, c);
|
|
4549
4549
|
case "arrow-marker":
|
|
4550
|
-
return
|
|
4550
|
+
return kc(t, l, c);
|
|
4551
4551
|
case "arrow-mark-up":
|
|
4552
|
-
return
|
|
4552
|
+
return bo(e, t, l, c, "up");
|
|
4553
4553
|
case "arrow-mark-down":
|
|
4554
|
-
return
|
|
4554
|
+
return bo(e, t, l, c, "down");
|
|
4555
4555
|
case "flag-mark":
|
|
4556
|
-
return
|
|
4556
|
+
return Cc(t, l, c);
|
|
4557
4557
|
case "price-label":
|
|
4558
|
-
return
|
|
4558
|
+
return Tc(e, t, l, c, r);
|
|
4559
4559
|
case "font-icon":
|
|
4560
|
-
return
|
|
4560
|
+
return $c(e, t, l);
|
|
4561
4561
|
case "bar-pattern":
|
|
4562
|
-
return Pc(e, t, l, c, r);
|
|
4563
|
-
case "ghost-feed":
|
|
4564
4562
|
return Ec(e, t, l, c, r);
|
|
4563
|
+
case "ghost-feed":
|
|
4564
|
+
return zc(e, t, l, c, r);
|
|
4565
4565
|
case "price-range":
|
|
4566
|
-
return
|
|
4566
|
+
return Nc(e, t, l, o, i, c, r);
|
|
4567
4567
|
case "date-range":
|
|
4568
|
-
return Nc(e, t, l, i, c, r);
|
|
4569
|
-
case "date-and-price-range":
|
|
4570
4568
|
return Yc(e, t, l, i, c, r);
|
|
4569
|
+
case "date-and-price-range":
|
|
4570
|
+
return Vc(e, t, l, i, c, r);
|
|
4571
4571
|
case "regression-trend":
|
|
4572
|
-
return Vc(e, t, l, o, c, r);
|
|
4573
|
-
case "anchored-vwap":
|
|
4574
4572
|
return Uc(e, t, l, o, c, r);
|
|
4573
|
+
case "anchored-vwap":
|
|
4574
|
+
return Xc(e, t, l, o, c, r);
|
|
4575
4575
|
case "fixed-range-volume-profile":
|
|
4576
|
-
return Gc(e, t, l, r);
|
|
4577
|
-
case "anchored-volume-profile":
|
|
4578
4576
|
return jc(e, t, l, r);
|
|
4577
|
+
case "anchored-volume-profile":
|
|
4578
|
+
return qc(e, t, l, r);
|
|
4579
4579
|
case "text":
|
|
4580
|
-
return
|
|
4580
|
+
return oa(e, t[0], n.textSelected ?? l, s);
|
|
4581
4581
|
case "pin":
|
|
4582
|
-
return
|
|
4582
|
+
return ia(e, t[0], l, o);
|
|
4583
4583
|
case "note":
|
|
4584
|
-
return ia(e, t, l, c);
|
|
4585
|
-
case "comment":
|
|
4586
4584
|
return ra(e, t, l, c);
|
|
4585
|
+
case "comment":
|
|
4586
|
+
return la(e, t, l, c);
|
|
4587
4587
|
case "price-note":
|
|
4588
|
-
return
|
|
4588
|
+
return ca(e, t, l, c, r);
|
|
4589
4589
|
case "signpost":
|
|
4590
|
-
return
|
|
4590
|
+
return sa(e, t[0], r, i, l);
|
|
4591
4591
|
case "callout":
|
|
4592
|
-
return
|
|
4592
|
+
return aa(e, t, l, c);
|
|
4593
4593
|
case "table":
|
|
4594
|
-
return
|
|
4594
|
+
return fa(e, t[0], l, n.tableUi ?? null);
|
|
4595
4595
|
case "image":
|
|
4596
|
-
return
|
|
4596
|
+
return ha(e, t[0], l);
|
|
4597
4597
|
}
|
|
4598
4598
|
return [];
|
|
4599
4599
|
}
|
|
4600
|
-
function
|
|
4600
|
+
function ua(e, t) {
|
|
4601
4601
|
return e.map((n) => ({
|
|
4602
4602
|
t: "group",
|
|
4603
4603
|
inert: !0,
|
|
@@ -4609,16 +4609,16 @@ function ha(e, t) {
|
|
|
4609
4609
|
]
|
|
4610
4610
|
}));
|
|
4611
4611
|
}
|
|
4612
|
-
function
|
|
4612
|
+
function xa(e) {
|
|
4613
4613
|
if (!Array.isArray(e)) return [];
|
|
4614
4614
|
const t = [];
|
|
4615
4615
|
for (const n of e)
|
|
4616
4616
|
!n || typeof n != "object" || typeof n.id != "string" || typeof n.kind != "string" || !Array.isArray(n.points) || n.points.length === 0 || !n.points.every(
|
|
4617
4617
|
(i) => i != null && typeof i == "object" && "time" in i && "price" in i && typeof i.price == "number"
|
|
4618
|
-
) || ((!n.style || typeof n.style != "object") && (n.style = { ...Mn }), t.push(
|
|
4618
|
+
) || ((!n.style || typeof n.style != "object") && (n.style = { ...Mn }), t.push(da(n)));
|
|
4619
4619
|
return t;
|
|
4620
4620
|
}
|
|
4621
|
-
function
|
|
4621
|
+
function da(e) {
|
|
4622
4622
|
const t = e.points, n = t.length, o = (i) => ({ ...i });
|
|
4623
4623
|
switch (e.kind) {
|
|
4624
4624
|
case "polyline":
|
|
@@ -4696,11 +4696,11 @@ function xa(e) {
|
|
|
4696
4696
|
return e;
|
|
4697
4697
|
}
|
|
4698
4698
|
}
|
|
4699
|
-
const
|
|
4699
|
+
const ya = 3, er = 5, pa = 2, ma = 50;
|
|
4700
4700
|
function ye(e, t, n) {
|
|
4701
4701
|
return t.anchored ? [{ x: t.anchored.x * n.w, y: t.anchored.y * n.h }] : nr(e, t.points);
|
|
4702
4702
|
}
|
|
4703
|
-
function
|
|
4703
|
+
function mn(e, t, n, o, i, r) {
|
|
4704
4704
|
if (t.anchored && r && r.w > 0 && r.h > 0)
|
|
4705
4705
|
return { ...t, anchored: { x: (n[0].x + o) / r.w, y: (n[0].y + i) / r.h } };
|
|
4706
4706
|
const l = [];
|
|
@@ -4739,7 +4739,7 @@ function Ao(e, t, n, o, i = !0) {
|
|
|
4739
4739
|
const h = t.priceToY(f), u = s != null && h != null ? Math.abs(h - s) : Math.abs(e.price - f);
|
|
4740
4740
|
u < c && (c = u, a = f);
|
|
4741
4741
|
}
|
|
4742
|
-
return n === "weak" && s != null && c >=
|
|
4742
|
+
return n === "weak" && s != null && c >= ma ? null : { time: e.time, price: a };
|
|
4743
4743
|
}
|
|
4744
4744
|
function V(e, t) {
|
|
4745
4745
|
switch (e.kind) {
|
|
@@ -4854,7 +4854,7 @@ const ba = /* @__PURE__ */ new Set([
|
|
|
4854
4854
|
"elliott-double-combo",
|
|
4855
4855
|
"elliott-triple-combo"
|
|
4856
4856
|
]);
|
|
4857
|
-
function
|
|
4857
|
+
function bn(e, t) {
|
|
4858
4858
|
switch (e) {
|
|
4859
4859
|
case "horizontal-line":
|
|
4860
4860
|
case "horizontal-ray":
|
|
@@ -4972,15 +4972,15 @@ function mn(e, t) {
|
|
|
4972
4972
|
}
|
|
4973
4973
|
return null;
|
|
4974
4974
|
}
|
|
4975
|
-
function
|
|
4976
|
-
const r = e.points[0], l = n.pipSize(), s = n.yToPrice(0), a = n.yToPrice(Math.max(1, i)), c = s != null && a != null ? Math.abs(s - a) : 0, f = Math.max(l, Math.round((c || l * 500) * 0.2 / l) * l), h = n.bars(), u = n.timeToBarIndex(r.time) ?? h.length, x = n.barIndexToTime(u), d = n.barIndexToTime(u + 1), p = x != null ? n.timeToX(x) : null, y = d != null ? n.timeToX(d) : null,
|
|
4975
|
+
function ga(e, t, n, o, i) {
|
|
4976
|
+
const r = e.points[0], l = n.pipSize(), s = n.yToPrice(0), a = n.yToPrice(Math.max(1, i)), c = s != null && a != null ? Math.abs(s - a) : 0, f = Math.max(l, Math.round((c || l * 500) * 0.2 / l) * l), h = n.bars(), u = n.timeToBarIndex(r.time) ?? h.length, x = n.barIndexToTime(u), d = n.barIndexToTime(u + 1), p = x != null ? n.timeToX(x) : null, y = d != null ? n.timeToX(d) : null, m = p != null && y != null ? Math.abs(y - p) : 0, b = m > 0 ? Math.round(o / m) : 0, g = u + Math.max(3, Math.round(0.15 * b)), w = n.barIndexToTime(g) ?? r.time, M = { ...Kt(t), stopLevel: f, profitLevel: f };
|
|
4977
4977
|
return {
|
|
4978
4978
|
...e,
|
|
4979
4979
|
points: [r, { time: w, price: r.price }],
|
|
4980
4980
|
style: M
|
|
4981
4981
|
};
|
|
4982
4982
|
}
|
|
4983
|
-
function
|
|
4983
|
+
function wa(e, t, n) {
|
|
4984
4984
|
const o = e.points[1];
|
|
4985
4985
|
if (!o) return e;
|
|
4986
4986
|
const i = O(e.points[0].time), r = O(o.time);
|
|
@@ -5000,14 +5000,14 @@ function ga(e, t, n) {
|
|
|
5000
5000
|
}
|
|
5001
5001
|
};
|
|
5002
5002
|
}
|
|
5003
|
-
function
|
|
5003
|
+
function Ma(e, t) {
|
|
5004
5004
|
const n = t.bars(), o = t.pipSize(), i = n.length > 0 ? n.reduce((l, s) => l + (s.high - s.low), 0) / n.length : 0, r = i > 0 ? Math.max(1, Math.round(i / o)) * o : Math.abs(e.points[0].price) * 0.01 || 1;
|
|
5005
5005
|
return {
|
|
5006
5006
|
...e,
|
|
5007
5007
|
ghost: { seed: Math.floor(Math.random() * 2147483647), amplitude: r }
|
|
5008
5008
|
};
|
|
5009
5009
|
}
|
|
5010
|
-
function
|
|
5010
|
+
function va(e, t) {
|
|
5011
5011
|
const n = e.points[0], o = e.points[e.points.length - 1];
|
|
5012
5012
|
if (!n || !o) return e;
|
|
5013
5013
|
const i = J(t, n), r = J(t, o);
|
|
@@ -5023,7 +5023,7 @@ function Ma(e, t) {
|
|
|
5023
5023
|
}
|
|
5024
5024
|
return e;
|
|
5025
5025
|
}
|
|
5026
|
-
function
|
|
5026
|
+
function ka(e, t) {
|
|
5027
5027
|
const n = J(t, e.points[0]), o = e.points[1] ? J(t, e.points[1]) : null;
|
|
5028
5028
|
return !n || !o ? e : {
|
|
5029
5029
|
...e,
|
|
@@ -5041,8 +5041,8 @@ function ir(e, t) {
|
|
|
5041
5041
|
return { ...e, points: [n, { ...o, price: n.price + x * Math.abs(r - i) * u }] };
|
|
5042
5042
|
}
|
|
5043
5043
|
function $o(e, t, n, o, i = {}) {
|
|
5044
|
-
let r =
|
|
5045
|
-
return r ? ((e === "long-position" || e === "short-position") && n && (r =
|
|
5044
|
+
let r = bn(e, t);
|
|
5045
|
+
return r ? ((e === "long-position" || e === "short-position") && n && (r = ga(r, e, n, o.w, o.h)), (e === "curve" || e === "double-curve") && n && (r = va(r, n)), e === "gann-square" && n && (r = ir(r, n)), e === "bar-pattern" && n && (r = wa(r, n, Math.max(1, o.h))), e === "trend-angle" && n && (r = ka(r, n)), e === "polyline" && i.closed !== void 0 && (r = { ...r, closed: i.closed }), e === "ghost-feed" && n && (r = Ma(r, n)), e === "font-icon" && (r = { ...r, glyph: i.glyph }), r) : null;
|
|
5046
5046
|
}
|
|
5047
5047
|
const rr = /* @__PURE__ */ new Set([
|
|
5048
5048
|
"trend-line",
|
|
@@ -5058,7 +5058,7 @@ const rr = /* @__PURE__ */ new Set([
|
|
|
5058
5058
|
"price-note",
|
|
5059
5059
|
"note",
|
|
5060
5060
|
"rotated-rectangle"
|
|
5061
|
-
]),
|
|
5061
|
+
]), La = /* @__PURE__ */ new Set(["parallel-channel", "flat-top-bottom", "disjoint-channel"]);
|
|
5062
5062
|
function Pe(e, t) {
|
|
5063
5063
|
const n = e.barIndexToTime(t), o = n == null ? null : e.timeToX(n);
|
|
5064
5064
|
return n == null || o == null ? null : { i: t, time: n, x: o };
|
|
@@ -5129,7 +5129,7 @@ function Bo(e, t, n, o) {
|
|
|
5129
5129
|
const i = t.length;
|
|
5130
5130
|
if (i === 0) return { point: n };
|
|
5131
5131
|
if (rr.has(e)) return { point: ee(o, n, t[i - 1]) };
|
|
5132
|
-
if (
|
|
5132
|
+
if (La.has(e)) return { point: i === 1 ? ee(o, n, t[0]) : n };
|
|
5133
5133
|
if (e === "rectangle") return { point: i === 1 ? lr(o, n, t[0]) : n };
|
|
5134
5134
|
if (e === "gann-box") return { point: sr(o, n, t[0]) };
|
|
5135
5135
|
if (e === "ellipse" && i === 1) {
|
|
@@ -5145,7 +5145,7 @@ function jn(e, t) {
|
|
|
5145
5145
|
function Io(e, t, n) {
|
|
5146
5146
|
return t && J(e, t) || n;
|
|
5147
5147
|
}
|
|
5148
|
-
function
|
|
5148
|
+
function Sa(e, t, n) {
|
|
5149
5149
|
const o = e.start;
|
|
5150
5150
|
if (e.mode.hit !== "handle") return { cursor: t };
|
|
5151
5151
|
const i = e.mode.handleIndex, r = o.points, l = e.startScreen, s = (f) => _(n, f), a = (f, h = ee) => {
|
|
@@ -5182,20 +5182,20 @@ function La(e, t, n) {
|
|
|
5182
5182
|
return { cursor: t, drawing: i <= 1 ? ar(e, t, n, !0) : void 0 };
|
|
5183
5183
|
case "rectangle": {
|
|
5184
5184
|
if (l.length !== 2) return { cursor: t };
|
|
5185
|
-
const f =
|
|
5185
|
+
const f = bt(l[0], l[1]);
|
|
5186
5186
|
if (i < 4) {
|
|
5187
5187
|
const h = s(f[(i + 2) % 4]);
|
|
5188
5188
|
return h ? a(h, lr) : { cursor: t };
|
|
5189
5189
|
}
|
|
5190
|
-
return { cursor: t, drawing:
|
|
5190
|
+
return { cursor: t, drawing: Ta(e, t, n) };
|
|
5191
5191
|
}
|
|
5192
5192
|
case "gann-box": {
|
|
5193
5193
|
if (l.length !== 2 || i >= 4) return { cursor: t };
|
|
5194
|
-
const f = s(
|
|
5194
|
+
const f = s(bt(l[0], l[1])[(i + 2) % 4]);
|
|
5195
5195
|
return f ? a(f, sr) : { cursor: t };
|
|
5196
5196
|
}
|
|
5197
5197
|
case "gann-square":
|
|
5198
|
-
return { cursor: t, drawing: i <= 1 ?
|
|
5198
|
+
return { cursor: t, drawing: i <= 1 ? Ca(e, t, n) : void 0 };
|
|
5199
5199
|
}
|
|
5200
5200
|
return rr.has(o.kind) && i <= 1 && r.length >= 2 ? a(r[i === 0 ? 1 : 0]) : { cursor: t };
|
|
5201
5201
|
}
|
|
@@ -5210,7 +5210,7 @@ function ar(e, t, n, o, i = (r) => r) {
|
|
|
5210
5210
|
x[l] = u;
|
|
5211
5211
|
const d = J(n, x[0]), p = J(n, x[1]);
|
|
5212
5212
|
if (!d || !p) return null;
|
|
5213
|
-
const y = a.x - s.x,
|
|
5213
|
+
const y = a.x - s.x, m = a.y - s.y, b = Math.hypot(y, m) || 1, g = Math.abs(((c.x - s.x) * m - (c.y - s.y) * y) / b), w = cr(n, d, p, o ? void 0 : g);
|
|
5214
5214
|
if (!w) return null;
|
|
5215
5215
|
if (x[2] = w, o && n.timeToBarIndex(x[0].time) === n.timeToBarIndex(x[1].time)) {
|
|
5216
5216
|
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);
|
|
@@ -5221,7 +5221,7 @@ function ar(e, t, n, o, i = (r) => r) {
|
|
|
5221
5221
|
}
|
|
5222
5222
|
return V(r, x);
|
|
5223
5223
|
}
|
|
5224
|
-
function
|
|
5224
|
+
function Ca(e, t, n) {
|
|
5225
5225
|
const o = e.start;
|
|
5226
5226
|
if (e.mode.hit !== "handle") return null;
|
|
5227
5227
|
const i = e.mode.handleIndex, [r, l] = o.points, s = n.timeToBarIndex(r.time), a = n.timeToBarIndex(l.time), c = _(n, t);
|
|
@@ -5231,10 +5231,10 @@ function Sa(e, t, n) {
|
|
|
5231
5231
|
const d = [...o.points];
|
|
5232
5232
|
return d[i] = { time: c.time, price: h.price + (c.price - h.price > 0 ? 1 : -1) * Math.abs(u - x) * f }, V(o, d);
|
|
5233
5233
|
}
|
|
5234
|
-
function
|
|
5234
|
+
function Ta(e, t, n) {
|
|
5235
5235
|
const o = e.start;
|
|
5236
5236
|
if (e.mode.hit !== "handle") return null;
|
|
5237
|
-
const [i, , r] =
|
|
5237
|
+
const [i, , r] = bt(e.startScreen[0], e.startScreen[1]);
|
|
5238
5238
|
let { x: l, y: s } = i, { x: a, y: c } = r;
|
|
5239
5239
|
const f = e.mode.handleIndex;
|
|
5240
5240
|
if (f === 5 || f === 7) {
|
|
@@ -5243,9 +5243,9 @@ function Ca(e, t, n) {
|
|
|
5243
5243
|
} else {
|
|
5244
5244
|
const x = f === 4 ? s - t.y : t.y - c, d = _e(n, l), p = _e(n, a);
|
|
5245
5245
|
if (!d || !p) return null;
|
|
5246
|
-
const y = Pe(n, p.i + 1),
|
|
5247
|
-
if (
|
|
5248
|
-
const
|
|
5246
|
+
const y = Pe(n, p.i + 1), m = y ? y.x - p.x : 0;
|
|
5247
|
+
if (m <= 0) return null;
|
|
5248
|
+
const b = Math.round(x / m), g = Pe(n, d.i - b), w = Pe(n, p.i + b);
|
|
5249
5249
|
if (!g || !w) return null;
|
|
5250
5250
|
const M = w.x - p.x;
|
|
5251
5251
|
l = g.x, a = w.x, f === 4 ? s -= M : c += M;
|
|
@@ -5253,7 +5253,7 @@ function Ca(e, t, n) {
|
|
|
5253
5253
|
const h = _(n, { x: l, y: s }), u = _(n, { x: a, y: c });
|
|
5254
5254
|
return !h || !u ? null : V(o, [h, u]);
|
|
5255
5255
|
}
|
|
5256
|
-
function
|
|
5256
|
+
function Aa(e, t, n, o) {
|
|
5257
5257
|
const i = e.start;
|
|
5258
5258
|
if (i.kind !== "long-position" && i.kind !== "short-position" || e.mode.hit !== "handle") return null;
|
|
5259
5259
|
const r = e.mode.handleIndex, [l, s] = i.points, a = n.pipSize(), c = i.kind === "long-position" ? 1 : -1, { stop: f, profit: h } = Ho(i, a);
|
|
@@ -5279,7 +5279,7 @@ function Ta(e, t, n, o) {
|
|
|
5279
5279
|
}
|
|
5280
5280
|
return null;
|
|
5281
5281
|
}
|
|
5282
|
-
function
|
|
5282
|
+
function $a(e, t, n) {
|
|
5283
5283
|
const o = e.start;
|
|
5284
5284
|
if (o.kind !== "parallel-channel" || e.mode.hit !== "handle") return null;
|
|
5285
5285
|
const [i, r, l] = e.startScreen;
|
|
@@ -5303,7 +5303,7 @@ function Aa(e, t, n) {
|
|
|
5303
5303
|
}
|
|
5304
5304
|
return null;
|
|
5305
5305
|
}
|
|
5306
|
-
function
|
|
5306
|
+
function Ba(e, t, n, o) {
|
|
5307
5307
|
const i = e.start;
|
|
5308
5308
|
if (i.kind !== "disjoint-channel" || e.mode.hit !== "handle") return null;
|
|
5309
5309
|
const r = e.mode.handleIndex, l = i.points;
|
|
@@ -5323,7 +5323,7 @@ function $a(e, t, n, o) {
|
|
|
5323
5323
|
}
|
|
5324
5324
|
return null;
|
|
5325
5325
|
}
|
|
5326
|
-
function
|
|
5326
|
+
function Ia(e, t, n, o) {
|
|
5327
5327
|
const i = e.start;
|
|
5328
5328
|
if (i.kind !== "rotated-rectangle" || e.mode.hit !== "handle") return null;
|
|
5329
5329
|
const r = e.mode.handleIndex, l = _(n, t);
|
|
@@ -5333,16 +5333,16 @@ function Ba(e, t, n, o) {
|
|
|
5333
5333
|
return s[2] = l, V(i, s);
|
|
5334
5334
|
const [a, c, f] = e.startScreen, h = c.x - a.x, u = c.y - a.y, x = Math.hypot(h, u) || 1, d = Math.abs(((f.x - a.x) * u - (f.y - a.y) * h) / x), p = o(l);
|
|
5335
5335
|
s[r] = p;
|
|
5336
|
-
const y = r === 0 ? J(n, p) : a,
|
|
5337
|
-
if (!y || !
|
|
5338
|
-
const
|
|
5336
|
+
const y = r === 0 ? J(n, p) : a, m = r === 1 ? J(n, p) : c;
|
|
5337
|
+
if (!y || !m) return null;
|
|
5338
|
+
const b = Math.hypot(m.x - y.x, m.y - y.y) || 1, g = _(n, { x: y.x + (m.y - y.y) / b * d, y: y.y - (m.x - y.x) / b * d });
|
|
5339
5339
|
return g ? (s[2] = g, V(i, s)) : null;
|
|
5340
5340
|
}
|
|
5341
|
-
function
|
|
5341
|
+
function Pa(e, t, n, o, i = !1) {
|
|
5342
5342
|
var f, h;
|
|
5343
5343
|
const r = sn(e.start.kind);
|
|
5344
5344
|
if (i && e.mode.hit === "handle") {
|
|
5345
|
-
const u =
|
|
5345
|
+
const u = Sa(e, t, n);
|
|
5346
5346
|
if (u.drawing !== void 0) return u.drawing;
|
|
5347
5347
|
t = u.cursor;
|
|
5348
5348
|
}
|
|
@@ -5354,11 +5354,11 @@ function Ia(e, t, n, o, i = !1) {
|
|
|
5354
5354
|
switch (e.start.kind) {
|
|
5355
5355
|
case "long-position":
|
|
5356
5356
|
case "short-position":
|
|
5357
|
-
return
|
|
5357
|
+
return Aa(e, t, n, o);
|
|
5358
5358
|
case "parallel-channel":
|
|
5359
|
-
return
|
|
5359
|
+
return $a(e, t, n);
|
|
5360
5360
|
case "table":
|
|
5361
|
-
return
|
|
5361
|
+
return Ea(e, t, n);
|
|
5362
5362
|
case "signpost": {
|
|
5363
5363
|
const u = ((f = e.pane) == null ? void 0 : f.h) ?? 0, x = ho(e.start, n, u, t.y);
|
|
5364
5364
|
return x == null ? null : { ...e.start, style: { ...e.start.style, signpostPosition: x } };
|
|
@@ -5377,12 +5377,12 @@ function Ia(e, t, n, o, i = !1) {
|
|
|
5377
5377
|
return y ? { ...V(e.start, [e.start.points[0], y]), style: { ...u, wordWrapWidth: p } } : null;
|
|
5378
5378
|
}
|
|
5379
5379
|
case "image":
|
|
5380
|
-
return
|
|
5380
|
+
return za(e, t, n);
|
|
5381
5381
|
// Anchored pin (TV Anchor drawing): its one anchor moves the fixed pane
|
|
5382
5382
|
// position like a body move (TV refuses point changes of a fixed
|
|
5383
5383
|
// drawing; the pin has a single point).
|
|
5384
5384
|
case "pin":
|
|
5385
|
-
if (e.start.anchored) return
|
|
5385
|
+
if (e.start.anchored) return mn(n, e.start, e.startScreen, t.x - e.startCursor.x, t.y - e.startCursor.y, e.pane);
|
|
5386
5386
|
break;
|
|
5387
5387
|
case "polyline": {
|
|
5388
5388
|
const u = e.mode.handleIndex, x = e.startScreen.length;
|
|
@@ -5398,14 +5398,14 @@ function Ia(e, t, n, o, i = !1) {
|
|
|
5398
5398
|
break;
|
|
5399
5399
|
}
|
|
5400
5400
|
case "disjoint-channel":
|
|
5401
|
-
return
|
|
5401
|
+
return Ba(e, t, n, o);
|
|
5402
5402
|
// TV Ellipse.setPoint: moving an end rebuilds the minor-axis point at
|
|
5403
5403
|
// the radius the ellipse had when the drag started (Shift: see ./shift).
|
|
5404
5404
|
case "ellipse":
|
|
5405
5405
|
if (e.mode.handleIndex <= 1) return ar(e, t, n, !1, o);
|
|
5406
5406
|
break;
|
|
5407
5407
|
case "rotated-rectangle":
|
|
5408
|
-
if (e.start.fmt === 2) return
|
|
5408
|
+
if (e.start.fmt === 2) return Ia(e, t, n, o);
|
|
5409
5409
|
break;
|
|
5410
5410
|
// TV: the h-line anchor is a vertical resize (price only), the v-line
|
|
5411
5411
|
// anchor a horizontal resize (time only).
|
|
@@ -5421,14 +5421,14 @@ function Ia(e, t, n, o, i = !1) {
|
|
|
5421
5421
|
if (e.mode.hit === "body" && e.start.kind === "signpost") {
|
|
5422
5422
|
const u = t.x - e.startCursor.x, x = t.y - e.startCursor.y, 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);
|
|
5423
5423
|
if (!d) return null;
|
|
5424
|
-
const
|
|
5425
|
-
return
|
|
5424
|
+
const m = V(e.start, [{ time: d.time, price: e.start.points[0].price }]), b = ho(m, n, p, y.anchor.y + x);
|
|
5425
|
+
return b == null ? m : { ...m, style: { ...m.style, signpostPosition: b } };
|
|
5426
5426
|
}
|
|
5427
5427
|
if (e.mode.hit === "body")
|
|
5428
|
-
return
|
|
5428
|
+
return mn(n, e.start, e.startScreen, t.x - e.startCursor.x, t.y - e.startCursor.y, e.pane);
|
|
5429
5429
|
if (e.start.kind === "rectangle" && e.mode.handleIndex >= 4 && e.startScreen.length === 2) {
|
|
5430
|
-
const [u, , x] =
|
|
5431
|
-
let { x: d, y: p } = u, { x: y, y:
|
|
5430
|
+
const [u, , x] = bt(e.startScreen[0], e.startScreen[1]);
|
|
5431
|
+
let { x: d, y: p } = u, { x: y, y: m } = x;
|
|
5432
5432
|
switch (e.mode.handleIndex) {
|
|
5433
5433
|
case 4:
|
|
5434
5434
|
p = t.y;
|
|
@@ -5437,17 +5437,17 @@ function Ia(e, t, n, o, i = !1) {
|
|
|
5437
5437
|
y = t.x;
|
|
5438
5438
|
break;
|
|
5439
5439
|
case 6:
|
|
5440
|
-
|
|
5440
|
+
m = t.y;
|
|
5441
5441
|
break;
|
|
5442
5442
|
case 7:
|
|
5443
5443
|
d = t.x;
|
|
5444
5444
|
break;
|
|
5445
5445
|
}
|
|
5446
|
-
const
|
|
5447
|
-
return !
|
|
5446
|
+
const b = _(n, { x: d, y: p }), g = _(n, { x: y, y: m });
|
|
5447
|
+
return !b || !g ? null : V(e.start, [b, g]);
|
|
5448
5448
|
}
|
|
5449
5449
|
if (r != null && r.isBbox && e.startScreen.length === 2 && e.mode.handleIndex < 4) {
|
|
5450
|
-
const x =
|
|
5450
|
+
const x = bt(e.startScreen[0], e.startScreen[1])[(e.mode.handleIndex + 2) % 4], d = _(n, t), p = _(n, x);
|
|
5451
5451
|
return !d || !p ? null : V(e.start, [o(d), p]);
|
|
5452
5452
|
}
|
|
5453
5453
|
const l = _(n, t);
|
|
@@ -5470,43 +5470,43 @@ function fr(e, t) {
|
|
|
5470
5470
|
const i = e.timeToBarIndex(n);
|
|
5471
5471
|
return i == null ? n : e.barIndexToTime(i - 1) ?? n;
|
|
5472
5472
|
}
|
|
5473
|
-
function
|
|
5473
|
+
function Ea(e, t, n) {
|
|
5474
5474
|
if (e.mode.hit !== "handle") return null;
|
|
5475
|
-
const o = e.start, i = o.style, r = e.mode.handleIndex, l = e.startScreen[0], s = i.fontSize ?? 14, a = we(i), { heights: c, mins: f } = yi(i), h =
|
|
5475
|
+
const o = e.start, i = o.style, r = e.mode.handleIndex, l = e.startScreen[0], s = i.fontSize ?? 14, a = we(i), { heights: c, mins: f } = yi(i), h = ol(s), u = a.map(() => h), x = (B) => B.reduce((F, Y) => F + Y, 0), d = x(a), p = x(c), y = fi(r);
|
|
5476
5476
|
if (y) {
|
|
5477
5477
|
const B = {};
|
|
5478
5478
|
if (y.col != null) {
|
|
5479
5479
|
const F = l.x + x(a.slice(0, y.col));
|
|
5480
|
-
B.tableColWidths = a.map((Y,
|
|
5480
|
+
B.tableColWidths = a.map((Y, Q) => Q === y.col ? Math.max(h, t.x - F) : Y);
|
|
5481
5481
|
}
|
|
5482
5482
|
if (y.row != null) {
|
|
5483
5483
|
const F = l.y + x(c.slice(0, y.row));
|
|
5484
|
-
B.tableRowHeights = c.map((Y,
|
|
5484
|
+
B.tableRowHeights = c.map((Y, Q) => Q === y.row ? Math.max(f[Q], t.y - F) : Y);
|
|
5485
5485
|
}
|
|
5486
5486
|
return { ...o, style: { ...i, ...B } };
|
|
5487
5487
|
}
|
|
5488
5488
|
if (r > 3) return null;
|
|
5489
|
-
const
|
|
5490
|
-
let k =
|
|
5491
|
-
const S =
|
|
5489
|
+
const m = r === 0 || r === 1, b = r === 0 || r === 2, g = { x: l.x + (m ? 0 : d), y: l.y + (b ? 0 : p) }, w = { x: g.x + (m ? d : -d), y: g.y + (b ? p : -p) }, M = h * a.length, v = x(f);
|
|
5490
|
+
let k = m ? Math.min(t.x, w.x - M) : Math.max(t.x, w.x + M);
|
|
5491
|
+
const S = b ? Math.min(t.y, w.y - v) : Math.max(t.y, w.y + v);
|
|
5492
5492
|
let C = o.points[0].time;
|
|
5493
5493
|
const I = o.anchored && e.pane && e.pane.w > 0 && e.pane.h > 0 ? e.pane : null;
|
|
5494
|
-
if (
|
|
5494
|
+
if (m && !I) {
|
|
5495
5495
|
const B = fr(n, k), F = B == null ? null : n.timeToX(B);
|
|
5496
5496
|
if (B == null || F == null) return null;
|
|
5497
5497
|
C = B, k = F;
|
|
5498
5498
|
}
|
|
5499
5499
|
let A = o.points[0].price;
|
|
5500
|
-
if (
|
|
5500
|
+
if (b && !I) {
|
|
5501
5501
|
const B = n.yToPrice(S);
|
|
5502
5502
|
if (B == null) return null;
|
|
5503
5503
|
A = B;
|
|
5504
5504
|
}
|
|
5505
|
-
const z = g.x - k, D = g.y - S, T = fn(a, u,
|
|
5506
|
-
|
|
5507
|
-
const E = fn(c, f,
|
|
5505
|
+
const z = g.x - k, D = g.y - S, T = fn(a, u, m ? d + z : d - z);
|
|
5506
|
+
m && (T[T.length - 1] += Math.round(l.x + d) - k - x(T));
|
|
5507
|
+
const E = fn(c, f, b ? p + D : p - D), P = xi(s);
|
|
5508
5508
|
if (I) {
|
|
5509
|
-
const B =
|
|
5509
|
+
const B = m ? k : l.x, F = b ? S : l.y;
|
|
5510
5510
|
return {
|
|
5511
5511
|
...o,
|
|
5512
5512
|
anchored: { x: B / I.w, y: F / I.h },
|
|
@@ -5519,15 +5519,15 @@ function Pa(e, t, n) {
|
|
|
5519
5519
|
style: { ...i, tableColWidths: T.map((B) => Math.max(B, h)), tableRowHeights: E.map((B) => Math.max(B, P)) }
|
|
5520
5520
|
};
|
|
5521
5521
|
}
|
|
5522
|
-
function
|
|
5522
|
+
function za(e, t, n) {
|
|
5523
5523
|
const o = e.start, i = o.image, r = zn(i == null ? void 0 : i.name);
|
|
5524
5524
|
if (!i || !r || e.mode.hit !== "handle" || e.mode.handleIndex > 3) return null;
|
|
5525
|
-
const [l, s] =
|
|
5525
|
+
const [l, s] = dl[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 = _(n, x);
|
|
5526
5526
|
if (!d) return null;
|
|
5527
5527
|
const p = n.timeToX(d.time);
|
|
5528
5528
|
return { ...o, points: [d], image: { ...i, cssWidth: h, cssHeight: u, dx: p == null ? 0 : x.x - p } };
|
|
5529
5529
|
}
|
|
5530
|
-
function
|
|
5530
|
+
function Wa(e, t) {
|
|
5531
5531
|
if (t.length < 2) return "grab";
|
|
5532
5532
|
let n = 0, o = 0;
|
|
5533
5533
|
for (const s of t)
|
|
@@ -5538,12 +5538,12 @@ function za(e, t) {
|
|
|
5538
5538
|
const l = (Math.atan2(r, i) * 180 / Math.PI + 360) % 180;
|
|
5539
5539
|
return l < 22.5 || l >= 157.5 ? "ew-resize" : l < 67.5 ? "nwse-resize" : l < 112.5 ? "ns-resize" : "nesw-resize";
|
|
5540
5540
|
}
|
|
5541
|
-
const
|
|
5542
|
-
function
|
|
5543
|
-
return
|
|
5541
|
+
const Ra = /* @__PURE__ */ new Set(["text", "pin", "table"]);
|
|
5542
|
+
function Fa(e) {
|
|
5543
|
+
return Ra.has(e);
|
|
5544
5544
|
}
|
|
5545
|
-
function
|
|
5546
|
-
if (!
|
|
5545
|
+
function Da(e, t, n) {
|
|
5546
|
+
if (!Fa(e.kind) || n.w <= 0 || n.h <= 0) return null;
|
|
5547
5547
|
if (!e.anchored) {
|
|
5548
5548
|
const c = J(t, e.points[0]);
|
|
5549
5549
|
return c ? { ...e, anchored: { x: c.x / n.w, y: c.y / n.h } } : null;
|
|
@@ -5553,110 +5553,123 @@ function Fa(e, t, n) {
|
|
|
5553
5553
|
const { anchored: s, ...a } = e;
|
|
5554
5554
|
return V(a, [{ time: r, price: l }]);
|
|
5555
5555
|
}
|
|
5556
|
-
const
|
|
5557
|
-
function
|
|
5556
|
+
const Oa = 1;
|
|
5557
|
+
function _a(e, t, n, o = () => [], i = () => ({ timeZone: "UTC", intraday: !0 }), r = () => null) {
|
|
5558
5558
|
return {
|
|
5559
|
-
priceToY: (
|
|
5560
|
-
yToPrice: (
|
|
5561
|
-
isLog: () => t.priceScale().options().mode ===
|
|
5559
|
+
priceToY: (l) => t.priceToCoordinate(l),
|
|
5560
|
+
yToPrice: (l) => t.coordinateToPrice(l),
|
|
5561
|
+
isLog: () => t.priceScale().options().mode === Oa,
|
|
5562
5562
|
// timeToCoordinate / coordinateToTime only map within the loaded data range;
|
|
5563
5563
|
// off-data x (the empty space to the RIGHT of the last bar — i.e. the
|
|
5564
5564
|
// future, where drawings should be anchorable just like in TradingView)
|
|
5565
5565
|
// returns null. We fall back to the logical-index axis, which extends
|
|
5566
5566
|
// infinitely, and extrapolate a synthetic time off the last bar using the
|
|
5567
5567
|
// bar interval. Both directions share the same anchor + interval so a future
|
|
5568
|
-
// point round-trips (place → project) to the same pixel.
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5568
|
+
// point round-trips (place → project) to the same pixel. With the host's
|
|
5569
|
+
// future axis a future time sits on the future bar that holds it and an x
|
|
5570
|
+
// gives the open time of its nearest future bar.
|
|
5571
|
+
timeToX: (l) => {
|
|
5572
|
+
const s = e.timeScale().timeToCoordinate(l);
|
|
5573
|
+
if (s != null) return s;
|
|
5574
|
+
const a = n();
|
|
5575
|
+
if (a.length === 0) return null;
|
|
5576
|
+
const c = j(l);
|
|
5577
|
+
if (c == null) return null;
|
|
5578
|
+
const f = ur(a, c, r()) ?? hr(a, c);
|
|
5579
|
+
return f == null ? null : xr(e, f);
|
|
5580
|
+
},
|
|
5581
|
+
xToTime: (l) => {
|
|
5582
|
+
const s = e.timeScale().coordinateToTime(l);
|
|
5583
|
+
if (s != null) return s;
|
|
5584
|
+
const a = n();
|
|
5585
|
+
if (a.length === 0) return null;
|
|
5586
|
+
const c = e.timeScale().coordinateToLogical(l), f = j(a[a.length - 1].time);
|
|
5587
|
+
if (c == null || f == null) return null;
|
|
5588
|
+
const h = r();
|
|
5589
|
+
if (h && c > a.length - 1) {
|
|
5590
|
+
const x = Math.round(c - (a.length - 1));
|
|
5591
|
+
if (x <= 0) return a[a.length - 1].time;
|
|
5592
|
+
const d = h.time(x, f);
|
|
5593
|
+
if (d != null) return d;
|
|
5594
|
+
}
|
|
5595
|
+
const u = me(a);
|
|
5596
|
+
return u <= 0 ? null : Math.round(f + (c - (a.length - 1)) * u);
|
|
5597
|
+
},
|
|
5598
|
+
barAt: (l) => Ha(n(), l),
|
|
5599
|
+
timeToBarIndex: (l) => {
|
|
5572
5600
|
const s = n();
|
|
5573
5601
|
if (s.length === 0) return null;
|
|
5574
|
-
const a =
|
|
5602
|
+
const a = j(l);
|
|
5575
5603
|
if (a == null) return null;
|
|
5576
|
-
const c =
|
|
5577
|
-
|
|
5604
|
+
const c = s.length - 1, f = j(s[c].time), h = j(s[0].time), u = f != null && a > f ? r() : null;
|
|
5605
|
+
if (u && f != null) return c + u.slots(a, f);
|
|
5606
|
+
const x = me(s);
|
|
5607
|
+
if (f != null && a > f) return Math.round(c + (a - f) / x);
|
|
5608
|
+
if (h != null && a < h) return Math.round((a - h) / x);
|
|
5609
|
+
let d = 0, p = 1 / 0;
|
|
5610
|
+
for (let y = 0; y < s.length; y++) {
|
|
5611
|
+
const m = j(s[y].time);
|
|
5612
|
+
if (m == null) continue;
|
|
5613
|
+
const b = Math.abs(m - a);
|
|
5614
|
+
b < p && (p = b, d = y);
|
|
5615
|
+
}
|
|
5616
|
+
return d;
|
|
5578
5617
|
},
|
|
5579
|
-
|
|
5580
|
-
const l = e.timeScale().coordinateToTime(r);
|
|
5581
|
-
if (l != null) return l;
|
|
5618
|
+
barIndexToTime: (l) => {
|
|
5582
5619
|
const s = n();
|
|
5583
5620
|
if (s.length === 0) return null;
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
const l = n();
|
|
5592
|
-
if (l.length === 0) return null;
|
|
5593
|
-
const s = Q(r);
|
|
5594
|
-
if (s == null) return null;
|
|
5595
|
-
const a = l.length - 1, c = Q(l[a].time), f = Q(l[0].time), h = be(l);
|
|
5596
|
-
if (c != null && s > c) return Math.round(a + (s - c) / h);
|
|
5597
|
-
if (f != null && s < f) return Math.round((s - f) / h);
|
|
5598
|
-
let u = 0, x = 1 / 0;
|
|
5599
|
-
for (let d = 0; d < l.length; d++) {
|
|
5600
|
-
const p = Q(l[d].time);
|
|
5601
|
-
if (p == null) continue;
|
|
5602
|
-
const y = Math.abs(p - s);
|
|
5603
|
-
y < x && (x = y, u = d);
|
|
5604
|
-
}
|
|
5605
|
-
return u;
|
|
5606
|
-
},
|
|
5607
|
-
barIndexToTime: (r) => {
|
|
5608
|
-
const l = n();
|
|
5609
|
-
if (l.length === 0) return null;
|
|
5610
|
-
if (r >= 0 && r < l.length) return l[r].time;
|
|
5611
|
-
const s = l.length - 1, a = Q(l[s].time);
|
|
5612
|
-
if (a == null) return null;
|
|
5613
|
-
const c = be(l);
|
|
5614
|
-
return Math.round(a + (r - s) * c);
|
|
5621
|
+
if (l >= 0 && l < s.length) return s[l].time;
|
|
5622
|
+
const a = s.length - 1, c = j(s[a].time);
|
|
5623
|
+
if (c == null) return null;
|
|
5624
|
+
const f = l > a ? r() : null, h = f ? f.time(l - a, c) : null;
|
|
5625
|
+
if (h != null) return h;
|
|
5626
|
+
const u = me(s);
|
|
5627
|
+
return Math.round(c + (l - a) * u);
|
|
5615
5628
|
},
|
|
5616
5629
|
bars: n,
|
|
5617
5630
|
visibleTimeRange: () => {
|
|
5618
|
-
const
|
|
5619
|
-
if (!
|
|
5620
|
-
const
|
|
5621
|
-
return
|
|
5631
|
+
const l = e.timeScale().getVisibleRange();
|
|
5632
|
+
if (!l) return null;
|
|
5633
|
+
const s = j(l.from), a = j(l.to);
|
|
5634
|
+
return s == null || a == null ? null : { from: s, to: a };
|
|
5622
5635
|
},
|
|
5623
|
-
indicatorValuesAt: (
|
|
5636
|
+
indicatorValuesAt: (l) => o(j(l)),
|
|
5624
5637
|
pipSize: () => {
|
|
5625
|
-
const
|
|
5626
|
-
return
|
|
5638
|
+
const l = t.options().priceFormat;
|
|
5639
|
+
return l && typeof l.minMove == "number" && l.minMove > 0 ? l.minMove : 0.01;
|
|
5627
5640
|
},
|
|
5628
|
-
addPriceLine: (
|
|
5629
|
-
removePriceLine: (
|
|
5630
|
-
zoomToScreenRect: (
|
|
5631
|
-
const
|
|
5632
|
-
|
|
5633
|
-
const
|
|
5634
|
-
if (
|
|
5635
|
-
const
|
|
5636
|
-
if (
|
|
5637
|
-
const
|
|
5638
|
-
|
|
5641
|
+
addPriceLine: (l) => t.createPriceLine(l),
|
|
5642
|
+
removePriceLine: (l) => t.removePriceLine(l),
|
|
5643
|
+
zoomToScreenRect: (l, s, a, c) => {
|
|
5644
|
+
const f = e.timeScale(), h = f.coordinateToLogical(Math.min(l, s)), u = f.coordinateToLogical(Math.max(l, s));
|
|
5645
|
+
h != null && u != null && u > h && f.setVisibleLogicalRange({ from: h, to: u });
|
|
5646
|
+
const x = t.coordinateToPrice(a), d = t.coordinateToPrice(c);
|
|
5647
|
+
if (x != null && d != null) {
|
|
5648
|
+
const p = Math.min(x, d), y = Math.max(x, d);
|
|
5649
|
+
if (y > p) {
|
|
5650
|
+
const m = t.priceScale();
|
|
5651
|
+
m.setAutoScale(!1), m.setVisibleRange({ from: p, to: y });
|
|
5639
5652
|
}
|
|
5640
5653
|
}
|
|
5641
5654
|
},
|
|
5642
|
-
formatTime: (
|
|
5643
|
-
const
|
|
5644
|
-
if (
|
|
5645
|
-
const
|
|
5646
|
-
if (
|
|
5647
|
-
const
|
|
5648
|
-
if (!
|
|
5649
|
-
const
|
|
5650
|
-
return `${
|
|
5655
|
+
formatTime: (l) => {
|
|
5656
|
+
const s = e.options().localization.timeFormatter;
|
|
5657
|
+
if (s) return s(l);
|
|
5658
|
+
const a = j(l);
|
|
5659
|
+
if (a == null) return String(l);
|
|
5660
|
+
const c = e.options(), f = new Date(a * 1e3), h = new Intl.DateTimeFormat(c.localization.locale, { month: "short", timeZone: "UTC" }).format(f), u = `${f.getUTCDate()} ${h} '${String(f.getUTCFullYear() % 100).padStart(2, "0")}`;
|
|
5661
|
+
if (!c.timeScale.timeVisible) return u;
|
|
5662
|
+
const x = (p) => String(p).padStart(2, "0"), d = `${x(f.getUTCHours())}:${x(f.getUTCMinutes())}${c.timeScale.secondsVisible ? `:${x(f.getUTCSeconds())}` : ""}`;
|
|
5663
|
+
return `${u} ${d}`;
|
|
5651
5664
|
},
|
|
5652
5665
|
timeInfo: () => i(),
|
|
5653
5666
|
timeAxis: () => {
|
|
5654
|
-
const
|
|
5655
|
-
return { height: e.timeScale().height(), width: e.timeScale().width(), fontSize:
|
|
5667
|
+
const l = e.options().layout;
|
|
5668
|
+
return { height: e.timeScale().height(), width: e.timeScale().width(), fontSize: l.fontSize, fontFamily: l.fontFamily };
|
|
5656
5669
|
}
|
|
5657
5670
|
};
|
|
5658
5671
|
}
|
|
5659
|
-
function
|
|
5672
|
+
function j(e) {
|
|
5660
5673
|
if (typeof e == "number") return e;
|
|
5661
5674
|
if (typeof e == "string") {
|
|
5662
5675
|
const t = Date.parse(e);
|
|
@@ -5664,35 +5677,40 @@ function Q(e) {
|
|
|
5664
5677
|
}
|
|
5665
5678
|
return typeof e == "object" && e !== null && "year" in e ? Date.UTC(e.year, e.month - 1, e.day) / 1e3 : null;
|
|
5666
5679
|
}
|
|
5667
|
-
function
|
|
5680
|
+
function me(e) {
|
|
5668
5681
|
if (e.length < 2) return 86400;
|
|
5669
5682
|
const t = [];
|
|
5670
5683
|
for (let n = Math.max(1, e.length - 50); n < e.length; n++) {
|
|
5671
|
-
const o =
|
|
5684
|
+
const o = j(e[n - 1].time), i = j(e[n].time);
|
|
5672
5685
|
o != null && i != null && i > o && t.push(i - o);
|
|
5673
5686
|
}
|
|
5674
5687
|
return t.length === 0 ? 86400 : (t.sort((n, o) => n - o), t[Math.floor(t.length / 2)]);
|
|
5675
5688
|
}
|
|
5676
5689
|
function hr(e, t) {
|
|
5677
|
-
const n = e.length, o =
|
|
5690
|
+
const n = e.length, o = j(e[0].time), i = j(e[n - 1].time);
|
|
5678
5691
|
if (o == null || i == null) return null;
|
|
5679
5692
|
if (t >= i) {
|
|
5680
|
-
const c =
|
|
5693
|
+
const c = me(e);
|
|
5681
5694
|
return c > 0 ? n - 1 + (t - i) / c : null;
|
|
5682
5695
|
}
|
|
5683
5696
|
if (t <= o) {
|
|
5684
|
-
const c =
|
|
5697
|
+
const c = me(e);
|
|
5685
5698
|
return c > 0 ? (t - o) / c : null;
|
|
5686
5699
|
}
|
|
5687
5700
|
let r = 0, l = n - 1;
|
|
5688
5701
|
for (; r < l; ) {
|
|
5689
|
-
const c = r + l + 1 >> 1, f =
|
|
5702
|
+
const c = r + l + 1 >> 1, f = j(e[c].time);
|
|
5690
5703
|
f != null && f <= t ? r = c : l = c - 1;
|
|
5691
5704
|
}
|
|
5692
|
-
const s =
|
|
5705
|
+
const s = j(e[r].time), a = r + 1 < n ? j(e[r + 1].time) : null;
|
|
5693
5706
|
return s == null || a == null || a <= s ? r : r + (t - s) / (a - s);
|
|
5694
5707
|
}
|
|
5695
|
-
function ur(e, t) {
|
|
5708
|
+
function ur(e, t, n) {
|
|
5709
|
+
if (!n) return null;
|
|
5710
|
+
const o = j(e[e.length - 1].time);
|
|
5711
|
+
return o == null || t <= o ? null : e.length - 1 + n.slots(t, o);
|
|
5712
|
+
}
|
|
5713
|
+
function xr(e, t) {
|
|
5696
5714
|
const n = e.timeScale(), o = Math.floor(t), i = n.logicalToCoordinate(o);
|
|
5697
5715
|
if (i == null) return null;
|
|
5698
5716
|
const r = t - o;
|
|
@@ -5700,18 +5718,18 @@ function ur(e, t) {
|
|
|
5700
5718
|
const l = n.logicalToCoordinate(o + 1);
|
|
5701
5719
|
return l == null ? i : i + r * (l - i);
|
|
5702
5720
|
}
|
|
5703
|
-
function
|
|
5721
|
+
function hf(e, t, n, o) {
|
|
5704
5722
|
if (n.length === 0) return null;
|
|
5705
|
-
const
|
|
5706
|
-
return
|
|
5723
|
+
const i = ur(n, t, o) ?? hr(n, t);
|
|
5724
|
+
return i == null ? null : xr(e, i);
|
|
5707
5725
|
}
|
|
5708
|
-
function
|
|
5726
|
+
function Ha(e, t) {
|
|
5709
5727
|
if (e.length === 0) return null;
|
|
5710
|
-
const n =
|
|
5728
|
+
const n = j(t);
|
|
5711
5729
|
if (n == null) return e[0];
|
|
5712
5730
|
let o = e[0], i = 1 / 0;
|
|
5713
5731
|
for (const r of e) {
|
|
5714
|
-
const l =
|
|
5732
|
+
const l = j(r.time);
|
|
5715
5733
|
if (l == null) continue;
|
|
5716
5734
|
const s = Math.abs(l - n);
|
|
5717
5735
|
s < i && (o = r, i = s);
|
|
@@ -5719,7 +5737,7 @@ function _a(e, t) {
|
|
|
5719
5737
|
return o;
|
|
5720
5738
|
}
|
|
5721
5739
|
const Po = "#1e53e5";
|
|
5722
|
-
function
|
|
5740
|
+
function Na(e, t, n) {
|
|
5723
5741
|
const o = { clips: /* @__PURE__ */ new Map(), grads: /* @__PURE__ */ new Map() };
|
|
5724
5742
|
for (const i of t) gn(e, i, n, o);
|
|
5725
5743
|
}
|
|
@@ -5750,7 +5768,7 @@ function gn(e, t, n, o) {
|
|
|
5750
5768
|
}
|
|
5751
5769
|
case "radialGradient": {
|
|
5752
5770
|
const l = e.createRadialGradient(t.cx, t.cy, 0, t.cx, t.cy, t.r);
|
|
5753
|
-
for (const s of t.stops) l.addColorStop(s.offset,
|
|
5771
|
+
for (const s of t.stops) l.addColorStop(s.offset, yr(s.color, s.opacity));
|
|
5754
5772
|
o.grads.set(t.name, l);
|
|
5755
5773
|
return;
|
|
5756
5774
|
}
|
|
@@ -5758,7 +5776,7 @@ function gn(e, t, n, o) {
|
|
|
5758
5776
|
case "hitPath":
|
|
5759
5777
|
return;
|
|
5760
5778
|
case "anchors":
|
|
5761
|
-
|
|
5779
|
+
qa(e, t.pts, t.squares, n.anchors);
|
|
5762
5780
|
return;
|
|
5763
5781
|
}
|
|
5764
5782
|
const i = "clip" in t && t.clip ? o.clips.get(t.clip) : void 0, r = !!i || t.t === "group" || "transform" in t && !!t.transform;
|
|
@@ -5797,17 +5815,17 @@ function gn(e, t, n, o) {
|
|
|
5797
5815
|
break;
|
|
5798
5816
|
}
|
|
5799
5817
|
case "text":
|
|
5800
|
-
|
|
5818
|
+
Ua(e, t, n);
|
|
5801
5819
|
break;
|
|
5802
5820
|
case "image":
|
|
5803
|
-
|
|
5821
|
+
Ga(e, t, n);
|
|
5804
5822
|
break;
|
|
5805
5823
|
case "glyph":
|
|
5806
|
-
|
|
5824
|
+
ja(e, t, n);
|
|
5807
5825
|
break;
|
|
5808
5826
|
case "group": {
|
|
5809
5827
|
if (t.transform && nn(e, t.transform), t.opacity != null && t.opacity < 1) {
|
|
5810
|
-
const l =
|
|
5828
|
+
const l = Ya(e);
|
|
5811
5829
|
if (l) {
|
|
5812
5830
|
for (const s of t.items) gn(l, s, n, o);
|
|
5813
5831
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha *= t.opacity, e.drawImage(l.canvas, 0, 0), e.restore();
|
|
@@ -5821,7 +5839,7 @@ function gn(e, t, n, o) {
|
|
|
5821
5839
|
}
|
|
5822
5840
|
r && e.restore();
|
|
5823
5841
|
}
|
|
5824
|
-
function
|
|
5842
|
+
function Ya(e) {
|
|
5825
5843
|
const t = e.canvas.width, n = e.canvas.height;
|
|
5826
5844
|
if (!t || !n) return null;
|
|
5827
5845
|
const o = document.createElement("canvas");
|
|
@@ -5834,13 +5852,13 @@ function jt(e, t, n, o, i) {
|
|
|
5834
5852
|
if (r && r !== "none" && r !== "transparent" && (e.save(), s && Eo(e, s), e.globalAlpha *= n.fillOpacity ?? 1, e.fillStyle = r, e.fill(t, n.fillRule === "evenodd" ? "evenodd" : "nonzero"), e.restore()), l && l !== "none" && l !== "transparent") {
|
|
5835
5853
|
const a = n.strokeWidth ?? 1;
|
|
5836
5854
|
if (a <= 0) return;
|
|
5837
|
-
e.save(), s && (!r || r === "none" || r === "transparent") && Eo(e, s), e.globalAlpha *= n.strokeOpacity ?? 1, e.strokeStyle = l, e.lineWidth = a, e.lineCap = n.cap ?? "butt", e.lineJoin = n.join ?? "miter", e.setLineDash(
|
|
5855
|
+
e.save(), s && (!r || r === "none" || r === "transparent") && Eo(e, s), e.globalAlpha *= n.strokeOpacity ?? 1, e.strokeStyle = l, e.lineWidth = a, e.lineCap = n.cap ?? "butt", e.lineJoin = n.join ?? "miter", e.setLineDash(Va(n.dash)), e.stroke(t), e.restore();
|
|
5838
5856
|
}
|
|
5839
5857
|
}
|
|
5840
5858
|
function Eo(e, t) {
|
|
5841
5859
|
e.shadowOffsetX = t.dx, e.shadowOffsetY = t.dy, e.shadowBlur = t.blur, e.shadowColor = t.color;
|
|
5842
5860
|
}
|
|
5843
|
-
function
|
|
5861
|
+
function Va(e) {
|
|
5844
5862
|
if (!e || e === "none") return [];
|
|
5845
5863
|
const t = e.split(/[\s,]+/).map(Number).filter((n) => Number.isFinite(n) && n >= 0);
|
|
5846
5864
|
return !t.length || t.every((n) => n === 0) ? [] : t.length % 2 ? [...t, ...t] : t;
|
|
@@ -5871,17 +5889,17 @@ function nn(e, t) {
|
|
|
5871
5889
|
}
|
|
5872
5890
|
}
|
|
5873
5891
|
}
|
|
5874
|
-
function
|
|
5892
|
+
function Ua(e, t, n) {
|
|
5875
5893
|
const o = t.pre ? t.text : t.text.replace(/\s+/g, " ").trim();
|
|
5876
5894
|
if (!o) return;
|
|
5877
5895
|
e.save(), t.opacity != null && (e.globalAlpha *= t.opacity);
|
|
5878
5896
|
const i = t.weight === "bold" ? 700 : t.weight ?? 400;
|
|
5879
5897
|
e.font = `${t.fontStyle === "italic" ? "italic " : ""}${i} ${t.size}px ${t.family ?? n.fontFamily}`, e.textAlign = t.anchor === "middle" ? "center" : t.anchor === "end" ? "right" : "left";
|
|
5880
5898
|
let r = t.y;
|
|
5881
|
-
t.baseline === "central" ? (e.textBaseline = "alphabetic", r +=
|
|
5899
|
+
t.baseline === "central" ? (e.textBaseline = "alphabetic", r += Xa(e)) : e.textBaseline = t.baseline === "middle" ? "middle" : t.baseline === "hanging" ? "hanging" : "alphabetic", e.fillStyle = t.fill ?? "#000000", e.fillText(o, t.x, r), e.restore();
|
|
5882
5900
|
}
|
|
5883
5901
|
const zo = /* @__PURE__ */ new Map();
|
|
5884
|
-
function
|
|
5902
|
+
function Xa(e) {
|
|
5885
5903
|
let t = zo.get(e.font);
|
|
5886
5904
|
if (t == null) {
|
|
5887
5905
|
const n = e.measureText("H");
|
|
@@ -5890,16 +5908,16 @@ function Ua(e) {
|
|
|
5890
5908
|
return t;
|
|
5891
5909
|
}
|
|
5892
5910
|
const Wo = /* @__PURE__ */ new Map();
|
|
5893
|
-
function
|
|
5911
|
+
function dr(e, t) {
|
|
5894
5912
|
let n = Wo.get(e);
|
|
5895
5913
|
return n || (n = new Image(), n.onload = () => {
|
|
5896
5914
|
var o;
|
|
5897
5915
|
return (o = t.onAsyncLoad) == null ? void 0 : o.call(t);
|
|
5898
5916
|
}, n.src = e, Wo.set(e, n)), n.complete && n.naturalWidth > 0 ? n : null;
|
|
5899
5917
|
}
|
|
5900
|
-
function
|
|
5918
|
+
function Ga(e, t, n) {
|
|
5901
5919
|
if (!t.href) return;
|
|
5902
|
-
const o =
|
|
5920
|
+
const o = dr(t.href, n);
|
|
5903
5921
|
if (o) {
|
|
5904
5922
|
if (e.save(), t.opacity != null && (e.globalAlpha *= t.opacity), t.stretch) e.drawImage(o, t.x, t.y, t.w, t.h);
|
|
5905
5923
|
else {
|
|
@@ -5909,25 +5927,25 @@ function Xa(e, t, n) {
|
|
|
5909
5927
|
e.restore();
|
|
5910
5928
|
}
|
|
5911
5929
|
}
|
|
5912
|
-
function
|
|
5930
|
+
function ja(e, t, n) {
|
|
5913
5931
|
const o = t.glyph.trim();
|
|
5914
5932
|
if (o) {
|
|
5915
5933
|
if (o.startsWith("<svg")) {
|
|
5916
5934
|
let i = o.replace(/currentColor/g, t.color);
|
|
5917
5935
|
/xmlns=/.test(i) || (i = i.replace("<svg", '<svg xmlns="http://www.w3.org/2000/svg"'));
|
|
5918
|
-
const r =
|
|
5936
|
+
const r = dr(`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`, n);
|
|
5919
5937
|
r && e.drawImage(r, t.x, t.y, t.size, t.size);
|
|
5920
5938
|
return;
|
|
5921
5939
|
}
|
|
5922
5940
|
e.save(), e.font = `${t.size - 4}px ${n.fontFamily}`, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = t.color, e.fillText(o, t.x + t.size / 2, t.y + t.size / 2), e.restore();
|
|
5923
5941
|
}
|
|
5924
5942
|
}
|
|
5925
|
-
function
|
|
5943
|
+
function qa(e, t, n, o) {
|
|
5926
5944
|
const i = o.selected ? 2 : 1;
|
|
5927
5945
|
t.forEach((r, l) => {
|
|
5928
5946
|
const s = !!(n != null && n.includes(l));
|
|
5929
5947
|
if (e.save(), o.hovered === l) {
|
|
5930
|
-
e.strokeStyle =
|
|
5948
|
+
e.strokeStyle = yr(Po, 0.2), e.lineWidth = 3;
|
|
5931
5949
|
const c = new Path2D();
|
|
5932
5950
|
s ? wn(c, r.x - et - 1.5, r.y - et - 1.5, 2 * et + 3, 2 * et + 3, 4.5, 4.5) : c.arc(r.x, r.y, et + 1.5, 0, Math.PI * 2), e.stroke(c);
|
|
5933
5951
|
}
|
|
@@ -5939,7 +5957,7 @@ function ja(e, t, n, o) {
|
|
|
5939
5957
|
e.fillStyle = o.fillAt(r.y), e.fill(a), e.strokeStyle = Po, e.lineWidth = i, e.stroke(a), e.restore();
|
|
5940
5958
|
});
|
|
5941
5959
|
}
|
|
5942
|
-
function
|
|
5960
|
+
function yr(e, t) {
|
|
5943
5961
|
if (t >= 1) return e;
|
|
5944
5962
|
const n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e);
|
|
5945
5963
|
if (n) {
|
|
@@ -5953,8 +5971,8 @@ function dr(e, t) {
|
|
|
5953
5971
|
}
|
|
5954
5972
|
return e;
|
|
5955
5973
|
}
|
|
5956
|
-
const
|
|
5957
|
-
class
|
|
5974
|
+
const Za = () => `dw_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
|
|
5975
|
+
class uf {
|
|
5958
5976
|
constructor(t, n, o = {}) {
|
|
5959
5977
|
N(this, "chart");
|
|
5960
5978
|
N(this, "series");
|
|
@@ -5984,14 +6002,14 @@ class hf {
|
|
|
5984
6002
|
N(this, "savedScroll", null);
|
|
5985
6003
|
N(this, "off", []);
|
|
5986
6004
|
this.chart = t, this.series = n, this.opts = { magnet: "off", ...o };
|
|
5987
|
-
const i = o.bars ?? (() =>
|
|
5988
|
-
this.coords =
|
|
6005
|
+
const i = o.bars ?? (() => Qa(n));
|
|
6006
|
+
this.coords = _a(t, n, i, () => [], o.timeInfo), this.primitive = new tf(this), n.attachPrimitive(this.primitive), this.el = t.chartElement(), this.listen(this.el, "pointerdown", (r) => this.onPointerDown(r), !0), this.listen(this.el, "pointermove", (r) => this.onHover(r)), this.listen(this.el, "pointerleave", () => {
|
|
5989
6007
|
this.hoverCursor = null, this.setHover(null);
|
|
5990
6008
|
}), this.listen(this.el, "dblclick", (r) => this.onDoubleClick(r), !0), this.listen(window, "keydown", (r) => this.onKey(r)), this.listen(window, "keyup", (r) => this.onKey(r)), this.listen(window, "blur", () => {
|
|
5991
6009
|
this.shift = !1, this.ctrl = !1;
|
|
5992
|
-
}), this.off.push(
|
|
6010
|
+
}), this.off.push(hl(() => {
|
|
5993
6011
|
var r;
|
|
5994
|
-
for (const l of this.list) l.kind === "image" &&
|
|
6012
|
+
for (const l of this.list) l.kind === "image" && xl((r = l.image) == null ? void 0 : r.name) && this.remove(l.id);
|
|
5995
6013
|
this.redraw();
|
|
5996
6014
|
}));
|
|
5997
6015
|
}
|
|
@@ -6034,7 +6052,7 @@ class hf {
|
|
|
6034
6052
|
}
|
|
6035
6053
|
/** Add a drawing (default style of its kind when none); returns its id. */
|
|
6036
6054
|
add(t) {
|
|
6037
|
-
const n = { id:
|
|
6055
|
+
const n = { id: Za(), style: Kt(t.kind), ...t };
|
|
6038
6056
|
return this.list = [...this.list, n], this.emit("add", n), this.changed(), n.id;
|
|
6039
6057
|
}
|
|
6040
6058
|
update(t) {
|
|
@@ -6076,7 +6094,7 @@ class hf {
|
|
|
6076
6094
|
const r = Kt("image"), l = this.add({
|
|
6077
6095
|
kind: "image",
|
|
6078
6096
|
points: [i],
|
|
6079
|
-
image: { name: t.name, ...
|
|
6097
|
+
image: { name: t.name, ...yl(t.width, t.height, n, o) },
|
|
6080
6098
|
style: { ...r, transparency: t.transparency ?? r.transparency }
|
|
6081
6099
|
});
|
|
6082
6100
|
return this.select([l]), l;
|
|
@@ -6087,7 +6105,7 @@ class hf {
|
|
|
6087
6105
|
toggleAnchored(t) {
|
|
6088
6106
|
const n = this.get(t);
|
|
6089
6107
|
if (!n) return !1;
|
|
6090
|
-
const o =
|
|
6108
|
+
const o = Da(n, this.coords, this.paneSize());
|
|
6091
6109
|
return o ? (this.update(o), this.emit("gestureEnd"), !0) : !1;
|
|
6092
6110
|
}
|
|
6093
6111
|
/** The table UI state (active cell, editor open, hovered edge) or null. */
|
|
@@ -6096,7 +6114,7 @@ class hf {
|
|
|
6096
6114
|
}
|
|
6097
6115
|
setTableCellText(t, n, o) {
|
|
6098
6116
|
const i = this.get(t);
|
|
6099
|
-
(i == null ? void 0 : i.kind) === "table" && this.update({ ...i, style: { ...i.style, ...
|
|
6117
|
+
(i == null ? void 0 : i.kind) === "table" && this.update({ ...i, style: { ...i.style, ...fl(i.style, n, o) } });
|
|
6100
6118
|
}
|
|
6101
6119
|
/** The cell editor closed (the cell stays active). */
|
|
6102
6120
|
endTableEdit() {
|
|
@@ -6110,11 +6128,11 @@ class hf {
|
|
|
6110
6128
|
if ((o == null ? void 0 : o.kind) !== "table") return;
|
|
6111
6129
|
const i = ((r = this.tableUi) == null ? void 0 : r.id) === t ? this.tableUi.cell : null;
|
|
6112
6130
|
if (n === "insert-column" || n === "insert-row")
|
|
6113
|
-
this.update({ ...o, style: { ...o.style, ...
|
|
6131
|
+
this.update({ ...o, style: { ...o.style, ...sl(o.style, n === "insert-row" ? "row" : "column", i) } });
|
|
6114
6132
|
else {
|
|
6115
6133
|
const s = n === "remove-row" ? "row" : "column";
|
|
6116
|
-
if (!i || !
|
|
6117
|
-
const a =
|
|
6134
|
+
if (!i || !cl(o.style, s)) return;
|
|
6135
|
+
const a = al(o.style, s, i);
|
|
6118
6136
|
this.update({ ...o, style: { ...o.style, ...a.patch } }), this.tableUi = { id: t, cell: a.cell, editing: ((l = this.tableUi) == null ? void 0 : l.editing) ?? !1, edge: null };
|
|
6119
6137
|
}
|
|
6120
6138
|
this.emit("gestureEnd");
|
|
@@ -6127,7 +6145,7 @@ class hf {
|
|
|
6127
6145
|
* and migrated (core parseDrawings); returns how many were loaded. */
|
|
6128
6146
|
importJSON(t) {
|
|
6129
6147
|
const n = typeof t == "string" ? JSON.parse(t) : t;
|
|
6130
|
-
return this.list =
|
|
6148
|
+
return this.list = xa(n), this.select([]), this.changed(), this.list.length;
|
|
6131
6149
|
}
|
|
6132
6150
|
/** Redraw on the next frame (the chart repaints the primitive). */
|
|
6133
6151
|
redraw() {
|
|
@@ -6150,7 +6168,7 @@ class hf {
|
|
|
6150
6168
|
const f = ye(i, c, r);
|
|
6151
6169
|
if (!f) continue;
|
|
6152
6170
|
const h = this.selected.includes(c.id), u = ((s = this.hovered) == null ? void 0 : s.id) === c.id && !c.locked, x = h || u && !this.spec, d = c.kind === "table" && h && ((a = this.tableUi) == null ? void 0 : a.id) === c.id ? this.tableUi : null, p = tn(c, f, { w: t, h: n, coords: i, selected: x && !c.locked, hovered: u, textSelected: h, tableUi: d });
|
|
6153
|
-
o.push({ scene: p, selected: h, hoveredAnchor: u ? this.hovered.anchor : -1 }), h && c.locked && o.push({ scene:
|
|
6171
|
+
o.push({ scene: p, selected: h, hoveredAnchor: u ? this.hovered.anchor : -1 }), h && c.locked && o.push({ scene: ua(f, c.style.color), selected: h, hoveredAnchor: -1 });
|
|
6154
6172
|
}
|
|
6155
6173
|
const l = this.previewScene(t, n);
|
|
6156
6174
|
return l && o.push({ scene: l, selected: !1, hoveredAnchor: -1 }), o;
|
|
@@ -6164,7 +6182,7 @@ class hf {
|
|
|
6164
6182
|
if (!this.shown(l)) continue;
|
|
6165
6183
|
const s = ye(o, l, i);
|
|
6166
6184
|
if (!s) continue;
|
|
6167
|
-
const a =
|
|
6185
|
+
const a = ds(l, s, o);
|
|
6168
6186
|
for (const c of a.price) {
|
|
6169
6187
|
const f = o.priceToY(c.price);
|
|
6170
6188
|
f != null && t.push(Ro(f, r.format(c.price), c.back, c.color));
|
|
@@ -6193,7 +6211,7 @@ class hf {
|
|
|
6193
6211
|
/** Chart background at a y (the anchor fill). */
|
|
6194
6212
|
backgroundAt(t, n) {
|
|
6195
6213
|
const o = this.chart.options().layout.background;
|
|
6196
|
-
return o.type === "gradient" && o.topColor && o.bottomColor ?
|
|
6214
|
+
return o.type === "gradient" && o.topColor && o.bottomColor ? Ja(o.topColor, o.bottomColor, n > 0 ? Math.max(0, Math.min(1, t / n)) : 0) : o.color ?? "#ffffff";
|
|
6197
6215
|
}
|
|
6198
6216
|
// ── internals ─────────────────────────────────────────────────────────────
|
|
6199
6217
|
listen(t, n, o, i = !1) {
|
|
@@ -6212,7 +6230,7 @@ class hf {
|
|
|
6212
6230
|
i.splice(Math.max(0, Math.min(i.length, n)), 0, r), this.list = i, this.changed();
|
|
6213
6231
|
}
|
|
6214
6232
|
shown(t) {
|
|
6215
|
-
return this.visible && !t.hidden && (this.opts.interval == null ||
|
|
6233
|
+
return this.visible && !t.hidden && (this.opts.interval == null || gr(t.visibility, this.opts.interval));
|
|
6216
6234
|
}
|
|
6217
6235
|
/** Drawings that are no longer shown leave the selection and the hover:
|
|
6218
6236
|
* Delete must not remove a drawing the user cannot see. */
|
|
@@ -6261,7 +6279,7 @@ class hf {
|
|
|
6261
6279
|
if (!this.shown(r)) continue;
|
|
6262
6280
|
const l = ye(this.coords, r, { w: n, h: o });
|
|
6263
6281
|
if (!l) continue;
|
|
6264
|
-
const s =
|
|
6282
|
+
const s = hs(r, l, t, n, o, this.coords, this.selected.includes(r.id));
|
|
6265
6283
|
if (s) return { drawing: r, mode: s, pts: l };
|
|
6266
6284
|
}
|
|
6267
6285
|
return null;
|
|
@@ -6313,7 +6331,7 @@ class hf {
|
|
|
6313
6331
|
const o = this.hitTopmost(n);
|
|
6314
6332
|
this.setHover(o ? { id: o.drawing.id, anchor: o.mode.hit === "handle" ? o.mode.handleIndex : -1 } : null);
|
|
6315
6333
|
const i = (o == null ? void 0 : o.drawing.kind) === "table" && o.mode.hit === "handle" ? fi(o.mode.handleIndex) : null, r = this.tableUi;
|
|
6316
|
-
(o == null ? void 0 : o.drawing.kind) === "table" && this.selected.includes(o.drawing.id) ? ((((l = r == null ? void 0 : r.edge) == null ? void 0 : l.row) ?? -1) !== ((i == null ? void 0 : i.row) ?? -1) || (((s = r == null ? void 0 : r.edge) == null ? void 0 : s.col) ?? -1) !== ((i == null ? void 0 : i.col) ?? -1) || (r == null ? void 0 : r.id) !== o.drawing.id) && (this.tableUi = r && r.id === o.drawing.id ? { ...r, edge: i } : { id: o.drawing.id, cell: null, editing: !1, edge: i }, this.redraw()) : r != null && r.edge && (this.tableUi = { ...r, edge: null }, this.redraw()), this.hoverCursor = o ? o.drawing.locked ? "default" : i ? i.col != null && i.row != null ? "default" : i.col != null ? "ew-resize" : "ns-resize" : o.mode.hit === "handle" ?
|
|
6334
|
+
(o == null ? void 0 : o.drawing.kind) === "table" && this.selected.includes(o.drawing.id) ? ((((l = r == null ? void 0 : r.edge) == null ? void 0 : l.row) ?? -1) !== ((i == null ? void 0 : i.row) ?? -1) || (((s = r == null ? void 0 : r.edge) == null ? void 0 : s.col) ?? -1) !== ((i == null ? void 0 : i.col) ?? -1) || (r == null ? void 0 : r.id) !== o.drawing.id) && (this.tableUi = r && r.id === o.drawing.id ? { ...r, edge: i } : { id: o.drawing.id, cell: null, editing: !1, edge: i }, this.redraw()) : r != null && r.edge && (this.tableUi = { ...r, edge: null }, this.redraw()), this.hoverCursor = o ? o.drawing.locked ? "default" : i ? i.col != null && i.row != null ? "default" : i.col != null ? "ew-resize" : "ns-resize" : o.mode.hit === "handle" ? Wa(o.pts[o.mode.handleIndex] ?? n, o.pts) : this.selected.includes(o.drawing.id) ? "move" : "pointer" : null;
|
|
6317
6335
|
}
|
|
6318
6336
|
onPointerDown(t) {
|
|
6319
6337
|
if (t.button !== 0) return;
|
|
@@ -6334,7 +6352,7 @@ class hf {
|
|
|
6334
6352
|
}
|
|
6335
6353
|
if (this.spec) return;
|
|
6336
6354
|
const n = this.hitTopmost(this.panePoint(t));
|
|
6337
|
-
n && ((i = sn(n.drawing.kind)) != null && i.textEditable) && (t.stopPropagation(), this.emit("textEdit", n.drawing,
|
|
6355
|
+
n && ((i = sn(n.drawing.kind)) != null && i.textEditable) && (t.stopPropagation(), this.emit("textEdit", n.drawing, Ka(n.drawing, n.pts)));
|
|
6338
6356
|
}
|
|
6339
6357
|
placementClick(t) {
|
|
6340
6358
|
const n = this.spec;
|
|
@@ -6391,14 +6409,14 @@ class hf {
|
|
|
6391
6409
|
let i = t;
|
|
6392
6410
|
const r = (s) => {
|
|
6393
6411
|
const a = this.panePoint(s);
|
|
6394
|
-
if (this.cursor = a, Math.hypot(a.x - i.x, a.y - i.y) <
|
|
6412
|
+
if (this.cursor = a, Math.hypot(a.x - i.x, a.y - i.y) < pa) return;
|
|
6395
6413
|
const c = _(this.coords, a);
|
|
6396
6414
|
c && (i = a, this.pending = [...this.pending, c], this.redraw());
|
|
6397
6415
|
}, l = () => {
|
|
6398
6416
|
document.removeEventListener("pointermove", r), document.removeEventListener("pointerup", l), this.releaseChart();
|
|
6399
6417
|
const s = this.pending;
|
|
6400
6418
|
this.pending = [], this.cursor = null;
|
|
6401
|
-
const a = s.length >= 2 ?
|
|
6419
|
+
const a = s.length >= 2 ? bn(n.kind, s) : null;
|
|
6402
6420
|
a ? this.placeNew(a, null) : this.afterPlacement();
|
|
6403
6421
|
};
|
|
6404
6422
|
document.addEventListener("pointermove", r), document.addEventListener("pointerup", l);
|
|
@@ -6436,8 +6454,8 @@ class hf {
|
|
|
6436
6454
|
if (u && !u.active && (u.pendingToggle ? this.toggle(u.id) : u.pendingCollapse && this.select([u.id]), u.start.kind === "table" && !i && (u.mode.hit === "body" && u.mode.cell && l ? this.openCell(u.start, u.mode.cell) : u.mode.hit === "handle" && u.mode.handleIndex < 4 && ((x = this.tableUi) == null ? void 0 : x.id) === u.id && (this.tableUi = { ...this.tableUi, cell: null, editing: !1 }, this.redraw()))), u != null && u.active && u.start.kind === "image") {
|
|
6437
6455
|
const p = this.get(u.id);
|
|
6438
6456
|
if (((d = p == null ? void 0 : p.image) == null ? void 0 : d.dx) != null) {
|
|
6439
|
-
const { dx: y, ...
|
|
6440
|
-
this.update({ ...p, image:
|
|
6457
|
+
const { dx: y, ...m } = p.image;
|
|
6458
|
+
this.update({ ...p, image: m });
|
|
6441
6459
|
}
|
|
6442
6460
|
}
|
|
6443
6461
|
this.endGesture(), this.emit("gestureEnd");
|
|
@@ -6448,7 +6466,7 @@ class hf {
|
|
|
6448
6466
|
const n = this.gesture;
|
|
6449
6467
|
if (!n) return;
|
|
6450
6468
|
if (!n.active) {
|
|
6451
|
-
if (!n.canDrag || Math.hypot(t.x - n.startCursor.x, t.y - n.startCursor.y) <
|
|
6469
|
+
if (!n.canDrag || Math.hypot(t.x - n.startCursor.x, t.y - n.startCursor.y) < ya) return;
|
|
6452
6470
|
if (n.pendingToggle && n.mode.hit === "body" && !n.group) {
|
|
6453
6471
|
const { id: i, ...r } = n.start;
|
|
6454
6472
|
this.add(r), this.select([n.id]);
|
|
@@ -6458,12 +6476,12 @@ class hf {
|
|
|
6458
6476
|
if (n.group) {
|
|
6459
6477
|
const i = { dx: t.x - n.startCursor.x, dy: t.y - n.startCursor.y }, { dx: r, dy: l } = this.shift ? jn(i.dx, i.dy) : i;
|
|
6460
6478
|
for (const s of n.group) {
|
|
6461
|
-
const a =
|
|
6479
|
+
const a = mn(this.coords, s.start, s.startScreen, r, l, this.paneSize());
|
|
6462
6480
|
a && this.update(a);
|
|
6463
6481
|
}
|
|
6464
6482
|
return;
|
|
6465
6483
|
}
|
|
6466
|
-
const o =
|
|
6484
|
+
const o = Pa(n, t, this.coords, this.snapFn(), this.shift);
|
|
6467
6485
|
o && this.update(o);
|
|
6468
6486
|
}
|
|
6469
6487
|
endGesture() {
|
|
@@ -6493,7 +6511,7 @@ class hf {
|
|
|
6493
6511
|
if (p) {
|
|
6494
6512
|
const y = [...i, p];
|
|
6495
6513
|
for (d != null && d.extra && y.push(d.extra); y.length < o.pointCount; ) y.push(p);
|
|
6496
|
-
const
|
|
6514
|
+
const m = bn(o.kind, y), b = m && o.kind === "gann-square" ? ir(m, l) : m, g = b ? { ...b, id: "__preview__", style: a } : null, w = g ? nr(l, g.points) : null;
|
|
6497
6515
|
if (g && w) return [...tn(g, w, { w: t, h: n, coords: l, selected: !1 }), ...f];
|
|
6498
6516
|
}
|
|
6499
6517
|
}
|
|
@@ -6503,16 +6521,16 @@ class hf {
|
|
|
6503
6521
|
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];
|
|
6504
6522
|
}
|
|
6505
6523
|
}
|
|
6506
|
-
function
|
|
6524
|
+
function Ka(e, t) {
|
|
6507
6525
|
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];
|
|
6508
6526
|
}
|
|
6509
|
-
function
|
|
6527
|
+
function Qa(e) {
|
|
6510
6528
|
return e.data().map((t) => {
|
|
6511
6529
|
const n = t, o = n.value ?? n.close ?? 0;
|
|
6512
6530
|
return { time: n.time, open: n.open ?? o, high: n.high ?? o, low: n.low ?? o, close: n.close ?? o, volume: n.volume };
|
|
6513
6531
|
});
|
|
6514
6532
|
}
|
|
6515
|
-
function
|
|
6533
|
+
function Ja(e, t, n) {
|
|
6516
6534
|
const o = /^#([0-9a-f]{6})$/i.exec(e), i = /^#([0-9a-f]{6})$/i.exec(t);
|
|
6517
6535
|
if (!o || !i) return e;
|
|
6518
6536
|
const r = parseInt(o[1], 16), l = parseInt(i[1], 16), s = (a) => Math.round((r >> a & 255) + ((l >> a & 255) - (r >> a & 255)) * n);
|
|
@@ -6521,7 +6539,7 @@ function Qa(e, t, n) {
|
|
|
6521
6539
|
function Ro(e, t, n, o) {
|
|
6522
6540
|
return { coordinate: () => e, text: () => t, backColor: () => n, textColor: () => o, visible: () => !0, tickVisible: () => !0 };
|
|
6523
6541
|
}
|
|
6524
|
-
class
|
|
6542
|
+
class tf {
|
|
6525
6543
|
constructor(t) {
|
|
6526
6544
|
N(this, "m");
|
|
6527
6545
|
N(this, "request", null);
|
|
@@ -6565,48 +6583,48 @@ class Ja {
|
|
|
6565
6583
|
n.save(), n.beginPath(), n.rect(0, 0, i, r), n.clip();
|
|
6566
6584
|
const l = this.m.fontFamily(), s = (c) => this.m.backgroundAt(c, r), a = () => this.requestUpdate();
|
|
6567
6585
|
for (const c of this.m.scenes(i, r))
|
|
6568
|
-
|
|
6586
|
+
Na(n, c.scene, { fontFamily: l, anchors: { fillAt: s, selected: c.selected, hovered: c.hoveredAnchor }, onAsyncLoad: a });
|
|
6569
6587
|
n.restore();
|
|
6570
6588
|
});
|
|
6571
6589
|
}
|
|
6572
6590
|
}
|
|
6573
|
-
const
|
|
6591
|
+
const xf = "0.6.1";
|
|
6574
6592
|
export {
|
|
6575
|
-
|
|
6593
|
+
Ra as ANCHORABLE_KINDS,
|
|
6576
6594
|
Mn as DEFAULT_STYLE,
|
|
6577
|
-
|
|
6578
|
-
|
|
6595
|
+
uf as DrawingManager,
|
|
6596
|
+
lf as IMAGE_MAX_BYTES,
|
|
6579
6597
|
ao as IMAGE_MAX_SIDE,
|
|
6580
|
-
|
|
6598
|
+
sf as IMAGE_TYPES,
|
|
6581
6599
|
Ne as OVERLAY_SPECS,
|
|
6582
6600
|
Po as TV_ANCHOR_COLOR,
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6601
|
+
xf as VERSION,
|
|
6602
|
+
Wa as anchorCursor,
|
|
6603
|
+
Pa as applyDrag,
|
|
6604
|
+
bn as buildNewDrawing,
|
|
6605
|
+
af as cacheImage,
|
|
6606
|
+
ul as decodeImage,
|
|
6589
6607
|
Kt as defaultStyleFor,
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6608
|
+
Na as drawScene,
|
|
6609
|
+
ds as drawingAxisLabels,
|
|
6610
|
+
of as factoryStyleFor,
|
|
6611
|
+
ff as fibLevelAt,
|
|
6594
6612
|
sn as findOverlaySpec,
|
|
6595
6613
|
$o as finishPlacement,
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6614
|
+
hs as hitTestKind,
|
|
6615
|
+
Fa as isAnchorable,
|
|
6616
|
+
gr as isVisibleOnInterval,
|
|
6617
|
+
_a as makeCoords,
|
|
6618
|
+
da as migrateDrawing,
|
|
6619
|
+
hl as onImagesChanged,
|
|
6620
|
+
xa as parseDrawings,
|
|
6621
|
+
ua as sceneLockedAnchors,
|
|
6604
6622
|
tn as sceneOf,
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6623
|
+
rf as setDefaultStyleOverride,
|
|
6624
|
+
cf as setImageReader,
|
|
6625
|
+
hf as timeToXFallback,
|
|
6626
|
+
Da as toggleAnchored,
|
|
6627
|
+
Lr as volumeProfileDefaults,
|
|
6610
6628
|
Bn as volumeProfileStyle
|
|
6611
6629
|
};
|
|
6612
6630
|
//# sourceMappingURL=lightweight-charts-drawing.es.js.map
|