@tradecanvas/chart 1.54.0 → 1.54.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/dist/Chart.d.ts +8 -1
- package/dist/Chart.d.ts.map +1 -1
- package/dist/LayoutSession-Breef1mg.cjs +2 -0
- package/dist/LayoutSession-Breef1mg.cjs.map +1 -0
- package/dist/{LayoutSession-DAqzoWkF.js → LayoutSession-C5aHWgk7.js} +353 -332
- package/dist/LayoutSession-C5aHWgk7.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/widget/ChartWidget.d.ts +2 -0
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/index.cjs +2 -2
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +12 -3
- package/dist/widget/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-0NYa74h6.cjs +0 -2
- package/dist/LayoutSession-0NYa74h6.cjs.map +0 -1
- package/dist/LayoutSession-DAqzoWkF.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PHI as a, PRICE_AXIS_WIDTH as o, TIME_AXIS_HEIGHT as s, autoPricePrecision as c, barDateZone as l, barTimeUnit as u, barsAreDaily as d, chartStyleValue as f, computePriceLimits as p, computePriceRange as m, formatPrice as h, fractionTick as g, indicatorSource as _, isValidTimeZone as v, mergeBar as y, niceNumber as ee, normalizeBarTime as b, parseIndicatorSource as x, priceFormatterFor as te, priceStepAt as ne, readChartStyleOverrides as re, readChartTypeOptions as S, readIndicatorPlotStyles as ie, readPaneStyle as ae, resolveChartTheme as oe, sessionMinute as C, setLocale as se, stepDecimals as ce, symbolTimeZone as w, tickBarCount as le, timeframeToMs as T, zonedDateFormatter as ue } from "@tradecanvas/commons";
|
|
2
|
-
import { AlertDragHandler as de, AlertManager as fe, Animator as pe, AreaRenderer as me, AxisDragHandler as he, BarCountdown as ge, BarRenderer as _e, BaselineRenderer as ve, CandlestickRenderer as ye, ChartLegend as be, ChartStateManager as E, CompareRenderer as xe, CompareSymbolIndicator as Se, CompareSymbolPaneIndicator as Ce, CorrelationCoefficientIndicator as we, CorrelationLogIndicator as Te, CrosshairHandler as Ee, CrosshairTooltip as De, CurrentPriceLine as Oe, DEFAULT_SESSION_HOURS as ke, DataExporter as D, DepthHeatmapRenderer as Ae, DrawingManager as je, DrawingRenderer as Me, EquivolumeRenderer as Ne, EventBus as Pe, GridRenderer as Fe, HLCAreaRenderer as Ie, HiLoRenderer as Le, HollowCandleRenderer as Re, IndicatorEngine as ze, InteractionManager as Be, KagiRenderer as Ve, KeyboardHandler as He, LineRenderer as Ue, LineWithMarkersRenderer as We, MarketProfileRenderer as Ge, MeasureOverlay as Ke, PRICE_SCALE_MARGIN as O, PanHandler as qe, PaneResizeHandler as Je, PeriodLevelsRenderer as Ye, PinnedTooltip as Xe, PivotMarkersRenderer as Ze, PointAndFigureRenderer as Qe, PriceAxis as $e, PriceAxisAddButton as et, PriceLines as tt, RenderEngine as nt, RenkoRenderer as rt, ReplayManager as it, ResamplingAdapter as at, ReshapeMemo as ot, SYMBOL_INDICATOR_IDS as k, SYMBOL_ZONE_WAIT_MS as st, Screenshot as A, SelectionBoxOverlay as ct, SessionBreaks as lt, SessionShading as ut, SignalMarkerManager as dt, SpreadIndicator as ft, StepLineRenderer as pt, StreamManager as mt, SymbolSeriesStore as ht, TimeAxis as gt, TradeZoneManager as _t, TradingManager as vt, TradingRenderer as yt, UndoRedoManager as bt, Viewport as xt, VolumeCandleRenderer as St, VolumeProfileRenderer as Ct, VolumeRenderer as wt, Watermark as Tt, ZoomHandler as Et, axisTimes as
|
|
2
|
+
import { AlertDragHandler as de, AlertManager as fe, Animator as pe, AreaRenderer as me, AxisDragHandler as he, BarCountdown as ge, BarRenderer as _e, BaselineRenderer as ve, CandlestickRenderer as ye, ChartLegend as be, ChartStateManager as E, CompareRenderer as xe, CompareSymbolIndicator as Se, CompareSymbolPaneIndicator as Ce, CorrelationCoefficientIndicator as we, CorrelationLogIndicator as Te, CrosshairHandler as Ee, CrosshairTooltip as De, CurrentPriceLine as Oe, DEFAULT_SESSION_HOURS as ke, DataExporter as D, DepthHeatmapRenderer as Ae, DrawingManager as je, DrawingRenderer as Me, EquivolumeRenderer as Ne, EventBus as Pe, GridRenderer as Fe, HLCAreaRenderer as Ie, HiLoRenderer as Le, HollowCandleRenderer as Re, IndicatorEngine as ze, InteractionManager as Be, KagiRenderer as Ve, KeyboardHandler as He, LineRenderer as Ue, LineWithMarkersRenderer as We, MarketProfileRenderer as Ge, MeasureOverlay as Ke, PRICE_SCALE_MARGIN as O, PanHandler as qe, PaneResizeHandler as Je, PeriodLevelsRenderer as Ye, PinnedTooltip as Xe, PivotMarkersRenderer as Ze, PointAndFigureRenderer as Qe, PriceAxis as $e, PriceAxisAddButton as et, PriceLines as tt, RenderEngine as nt, RenkoRenderer as rt, ReplayManager as it, ResamplingAdapter as at, ReshapeMemo as ot, SYMBOL_INDICATOR_IDS as k, SYMBOL_ZONE_WAIT_MS as st, Screenshot as A, SelectionBoxOverlay as ct, SessionBreaks as lt, SessionShading as ut, SignalMarkerManager as dt, SpreadIndicator as ft, StepLineRenderer as pt, StreamManager as mt, SymbolSeriesStore as ht, TimeAxis as gt, TradeZoneManager as _t, TradingManager as vt, TradingRenderer as yt, UndoRedoManager as bt, Viewport as xt, VolumeCandleRenderer as St, VolumeProfileRenderer as Ct, VolumeRenderer as wt, Watermark as Tt, ZoomHandler as Et, axisTimes as j, barTimeStepMs as Dt, findDominantSwing as Ot, gpuContextsLeft as kt, isPriceLevelAlert as At, isRegularSession as jt, loadWebGL as Mt, mergeSessionHours as Nt, pointAndFigureColumns as Pt, priceToY as Ft, rangePresetStart as It, readAlertOptions as Lt, registerBuiltInDrawingTools as Rt, registerBuiltInIndicators as zt, servesTimeframe as M, sourceParam as N, timeToX as Bt, timestampToBarIndex as P, toHeikinAshi as Vt, toKagi as Ht, toLineBreak as Ut, toRangeBars as Wt, toRenko as Gt, whenGpuContextFree as Kt, withResampling as F, xToBarIndex as qt, xToTime as I, yToPrice as Jt } from "@tradecanvas/core";
|
|
3
3
|
//#region src/regularHours.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
4
|
+
var Yt = 864e5, Xt = 10;
|
|
5
|
+
function Zt(e, t) {
|
|
6
6
|
let n = w(e);
|
|
7
7
|
if (!n || !v(n) || t.length < 2) return null;
|
|
8
8
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
@@ -14,34 +14,34 @@ function $t(e, t) {
|
|
|
14
14
|
});
|
|
15
15
|
if (r.length === 0) return null;
|
|
16
16
|
let i = u(t), a = Infinity;
|
|
17
|
-
for (let e = Math.max(1, t.length -
|
|
17
|
+
for (let e = Math.max(1, t.length - Xt); e < t.length; e++) {
|
|
18
18
|
let n = (t[e].time - t[e - 1].time) * i;
|
|
19
19
|
n > 0 && n < a && (a = n);
|
|
20
20
|
}
|
|
21
|
-
if (!(a <
|
|
21
|
+
if (!(a < Yt)) return null;
|
|
22
22
|
let o = {
|
|
23
23
|
timeZone: n,
|
|
24
24
|
windows: r,
|
|
25
25
|
startMinute: r[0].startMinute,
|
|
26
26
|
endMinute: r[r.length - 1].endMinute
|
|
27
27
|
};
|
|
28
|
-
return (e) =>
|
|
28
|
+
return (e) => jt(e * i, o);
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/chartA11y.ts
|
|
32
|
-
var
|
|
32
|
+
var Qt = {
|
|
33
33
|
role: "chart",
|
|
34
34
|
summary: "{what}. Last price {close}.",
|
|
35
35
|
empty: "Chart, no data.",
|
|
36
36
|
view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
|
|
37
37
|
bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
|
|
38
38
|
keys: "Arrow keys scroll and zoom, Home and End go to the start and the end. Comma and period read the bars one at a time."
|
|
39
|
-
},
|
|
39
|
+
}, L = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), $t = [
|
|
40
40
|
"role",
|
|
41
41
|
"aria-roledescription",
|
|
42
42
|
"aria-label",
|
|
43
43
|
"aria-describedby"
|
|
44
|
-
],
|
|
44
|
+
], en = 400, tn = 1e3, nn = class {
|
|
45
45
|
live;
|
|
46
46
|
help;
|
|
47
47
|
labels;
|
|
@@ -55,20 +55,20 @@ var en = {
|
|
|
55
55
|
};
|
|
56
56
|
constructor(e, t, n = {}) {
|
|
57
57
|
this.container = e, this.source = t, this.labels = {
|
|
58
|
-
...
|
|
58
|
+
...Qt,
|
|
59
59
|
...n
|
|
60
60
|
};
|
|
61
|
-
for (let t of
|
|
62
|
-
e.setAttribute("role", "application"), this.help =
|
|
61
|
+
for (let t of $t) this.before.set(t, e.getAttribute(t));
|
|
62
|
+
e.setAttribute("role", "application"), this.help = rn("div", "tc-sr-only"), this.help.id = `tc-chart-keys-${Math.random().toString(36).slice(2, 10)}`, e.setAttribute("aria-describedby", this.help.id), this.live = rn("div", "tc-sr-only tc-sr-live"), this.live.setAttribute("aria-live", "polite"), this.live.setAttribute("aria-atomic", "true"), e.append(this.help, this.live), e.addEventListener("blur", this.onBlur), this.applyLabels();
|
|
63
63
|
}
|
|
64
64
|
setLabels(e) {
|
|
65
65
|
this.labels = {
|
|
66
|
-
...
|
|
66
|
+
...Qt,
|
|
67
67
|
...e
|
|
68
68
|
}, this.applyLabels();
|
|
69
69
|
}
|
|
70
70
|
refresh(e = !1) {
|
|
71
|
-
let t =
|
|
71
|
+
let t = tn - (Date.now() - this.summaryAt);
|
|
72
72
|
if (e || t <= 0 || this.container.getAttribute("aria-label") === this.labels.empty) {
|
|
73
73
|
this.summaryTimer && clearTimeout(this.summaryTimer), this.summaryTimer = null, this.summaryAt = Date.now(), this.container.setAttribute("aria-label", this.summary());
|
|
74
74
|
return;
|
|
@@ -80,7 +80,7 @@ var en = {
|
|
|
80
80
|
viewMoved() {
|
|
81
81
|
this.cursor = null, this.viewTimer && clearTimeout(this.viewTimer), this.viewTimer = setTimeout(() => {
|
|
82
82
|
this.viewTimer = null, this.say(this.viewText());
|
|
83
|
-
},
|
|
83
|
+
}, en);
|
|
84
84
|
}
|
|
85
85
|
readBar(e) {
|
|
86
86
|
let t = this.source.bars();
|
|
@@ -93,13 +93,13 @@ var en = {
|
|
|
93
93
|
let i = t[this.cursor];
|
|
94
94
|
this.source.showBar(i.time);
|
|
95
95
|
let a = this.source.formatPrice;
|
|
96
|
-
this.say(
|
|
96
|
+
this.say(L(this.labels.bar, {
|
|
97
97
|
time: this.source.formatTime(i.time),
|
|
98
98
|
open: a(i.open),
|
|
99
99
|
high: a(i.high),
|
|
100
100
|
low: a(i.low),
|
|
101
101
|
close: a(i.close),
|
|
102
|
-
volume:
|
|
102
|
+
volume: an(i.volume ?? 0)
|
|
103
103
|
}));
|
|
104
104
|
}
|
|
105
105
|
destroy() {
|
|
@@ -118,7 +118,7 @@ var en = {
|
|
|
118
118
|
this.labels.typeName ? this.labels.typeName(t) : t,
|
|
119
119
|
this.source.timeframe()
|
|
120
120
|
].filter(Boolean).join(", ");
|
|
121
|
-
return
|
|
121
|
+
return L(this.labels.summary, {
|
|
122
122
|
what: n,
|
|
123
123
|
close: this.source.formatPrice(e[e.length - 1].close)
|
|
124
124
|
});
|
|
@@ -128,7 +128,7 @@ var en = {
|
|
|
128
128
|
if (e.length === 0) return this.labels.empty;
|
|
129
129
|
let t = this.source.visibleRange(), n = Math.max(0, Math.min(e.length - 1, Math.ceil(t.from))), r = Math.max(n, Math.min(e.length - 1, Math.floor(t.to))), i = -Infinity, a = Infinity;
|
|
130
130
|
for (let t = n; t <= r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
131
|
-
return
|
|
131
|
+
return L(this.labels.view, {
|
|
132
132
|
count: r - n + 1,
|
|
133
133
|
from: this.source.formatTime(e[n].time),
|
|
134
134
|
to: this.source.formatTime(e[r].time),
|
|
@@ -140,7 +140,7 @@ var en = {
|
|
|
140
140
|
this.live.textContent = e;
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
function
|
|
143
|
+
function rn(e, t) {
|
|
144
144
|
let n = document.createElement(e);
|
|
145
145
|
return n.className = t, Object.assign(n.style, {
|
|
146
146
|
position: "absolute",
|
|
@@ -154,14 +154,14 @@ function on(e, t) {
|
|
|
154
154
|
border: "0"
|
|
155
155
|
}), n;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function an(e) {
|
|
158
158
|
return Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/indicatorLabel.ts
|
|
162
|
-
var
|
|
163
|
-
function
|
|
164
|
-
let i = Object.keys(n || t).map((e) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)).slice(0,
|
|
162
|
+
var on = 3, sn = { stochrsi: 4 };
|
|
163
|
+
function cn(e, t, n, r) {
|
|
164
|
+
let i = Object.keys(n || t).map((e) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)).slice(0, sn[e] ?? on).map((e) => String(Number(e.toFixed(4)))), a = typeof t.symbol == "string" && t.symbol ? [t.symbol] : [];
|
|
165
165
|
return [
|
|
166
166
|
e === "spread" && t.mode === "ratio" ? "Ratio" : r ?? e.toUpperCase(),
|
|
167
167
|
...a,
|
|
@@ -170,7 +170,7 @@ function un(e, t, n, r) {
|
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/charts/ChartTypeStrategy.ts
|
|
173
|
-
function
|
|
173
|
+
function ln(e) {
|
|
174
174
|
switch (e) {
|
|
175
175
|
case "candlestick":
|
|
176
176
|
case "heikinAshi":
|
|
@@ -193,29 +193,29 @@ function dn(e) {
|
|
|
193
193
|
default: return new ye();
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function un(e, t, n = {}, r, i) {
|
|
197
197
|
if (t.length === 0) return t;
|
|
198
198
|
switch (e) {
|
|
199
|
-
case "heikinAshi": return
|
|
199
|
+
case "heikinAshi": return Vt(t);
|
|
200
200
|
case "renko": {
|
|
201
201
|
let e = n.renko?.boxSize;
|
|
202
|
-
return typeof e == "number" ?
|
|
202
|
+
return typeof e == "number" ? Gt(t, { brickSize: e }, i) : Gt(t, {
|
|
203
203
|
brickSize: 0,
|
|
204
204
|
useATR: !0,
|
|
205
205
|
atrPeriod: n.renko?.atrPeriod ?? 14
|
|
206
206
|
}, i);
|
|
207
207
|
}
|
|
208
|
-
case "lineBreak": return
|
|
209
|
-
case "kagi": return
|
|
210
|
-
case "pointAndFigure": return
|
|
211
|
-
case "rangeBars": return
|
|
212
|
-
rangeSize:
|
|
208
|
+
case "lineBreak": return Ut(t, n.lineBreak?.lines ?? 3);
|
|
209
|
+
case "kagi": return Ht(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
210
|
+
case "pointAndFigure": return fn(t, n, i).columns;
|
|
211
|
+
case "rangeBars": return Wt(t, {
|
|
212
|
+
rangeSize: xn(t, n, r),
|
|
213
213
|
includeForming: !0
|
|
214
214
|
}, i);
|
|
215
215
|
default: return t;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function dn(e) {
|
|
219
219
|
switch (e) {
|
|
220
220
|
case "heikinAshi":
|
|
221
221
|
case "renko":
|
|
@@ -226,72 +226,72 @@ function pn(e) {
|
|
|
226
226
|
default: return !1;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
return e !== "heikinAshi" &&
|
|
229
|
+
function R(e) {
|
|
230
|
+
return e !== "heikinAshi" && dn(e);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
return
|
|
232
|
+
function fn(e, t = {}, n) {
|
|
233
|
+
return Pt(e, hn(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
234
234
|
}
|
|
235
|
-
var
|
|
236
|
-
function
|
|
235
|
+
var pn = 50, mn = .01;
|
|
236
|
+
function hn(e, t = {}) {
|
|
237
237
|
let n = t.pointAndFigure?.boxSize;
|
|
238
238
|
if (typeof n == "number") return n;
|
|
239
|
-
let r =
|
|
240
|
-
return r > 0 ?
|
|
239
|
+
let r = gn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
240
|
+
return r > 0 ? z(ee(r / pn, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * mn || 1;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function gn(e, t) {
|
|
243
243
|
let n = -Infinity, r = Infinity;
|
|
244
244
|
for (let i = 0; i < t; i++) e[i].high > n && (n = e[i].high), e[i].low < r && (r = e[i].low);
|
|
245
245
|
let i = n - r;
|
|
246
246
|
return Number.isFinite(i) ? i : 0;
|
|
247
247
|
}
|
|
248
|
-
var
|
|
249
|
-
function
|
|
248
|
+
var _n = 100, vn = 3, yn = .01, bn = 15, z = (e) => Number(e.toPrecision(bn));
|
|
249
|
+
function xn(e, t = {}, n) {
|
|
250
250
|
let r = t.rangeBars?.range;
|
|
251
251
|
if (typeof r == "number") return r;
|
|
252
|
-
let i = e.length >=
|
|
253
|
-
return
|
|
252
|
+
let i = e.length >= vn ? Cn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
253
|
+
return En(z(ee(i > 0 ? i : a * yn || 1, !0)), n);
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function Sn(e) {
|
|
256
256
|
let t = e.length - 1;
|
|
257
257
|
return {
|
|
258
|
-
from: Math.max(0, t -
|
|
258
|
+
from: Math.max(0, t - _n),
|
|
259
259
|
end: t
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
let { from: t, end: n } =
|
|
262
|
+
function Cn(e) {
|
|
263
|
+
let { from: t, end: n } = Sn(e), r = 0;
|
|
264
264
|
for (let i = t; i < n; i++) {
|
|
265
265
|
let { high: t, low: n } = e[i], a = i > 0 ? e[i - 1].close : n;
|
|
266
266
|
r += Math.max(t - n, Math.abs(t - a), Math.abs(n - a));
|
|
267
267
|
}
|
|
268
268
|
return n > t ? r / (n - t) : 0;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
let { from: n, end: r } =
|
|
270
|
+
function wn(e, t) {
|
|
271
|
+
let { from: n, end: r } = Sn(e);
|
|
272
272
|
if (r <= n) return t(e[e.length - 1]?.close ?? 0);
|
|
273
273
|
let i = -Infinity, a = Infinity;
|
|
274
274
|
for (let t = n; t < r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
275
|
-
return
|
|
275
|
+
return Tn(t(i), t(a));
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Tn(e, t) {
|
|
278
278
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
return t === void 0 || !(t > 0) ? e :
|
|
280
|
+
function En(e, t) {
|
|
281
|
+
return t === void 0 || !(t > 0) ? e : z(Math.max(1, Math.round(e / t)) * t);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Dn(e, t) {
|
|
284
284
|
let n = t?.(e);
|
|
285
|
-
return n ? n.createRenderer() :
|
|
285
|
+
return n ? n.createRenderer() : ln(e);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function On(e, t, n, r, i, a) {
|
|
288
288
|
if (t.length === 0) return t;
|
|
289
289
|
let o = n?.(e);
|
|
290
|
-
return o?.transform ? o.transform(t) :
|
|
290
|
+
return o?.transform ? o.transform(t) : un(e, t, r, i, a);
|
|
291
291
|
}
|
|
292
292
|
//#endregion
|
|
293
293
|
//#region src/state/AutoSaveScheduler.ts
|
|
294
|
-
var
|
|
294
|
+
var kn = class {
|
|
295
295
|
timer = null;
|
|
296
296
|
delayMs = 0;
|
|
297
297
|
key = null;
|
|
@@ -321,15 +321,15 @@ var jn = class {
|
|
|
321
321
|
};
|
|
322
322
|
//#endregion
|
|
323
323
|
//#region src/DataManager.ts
|
|
324
|
-
function
|
|
324
|
+
function B(e) {
|
|
325
325
|
if (!e || typeof e.time != "number" || !Number.isFinite(e.time)) return !1;
|
|
326
326
|
let { open: t, high: n, low: r, close: i } = e;
|
|
327
327
|
return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function An(e) {
|
|
330
330
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function V(e) {
|
|
333
333
|
return {
|
|
334
334
|
...e,
|
|
335
335
|
high: Math.max(e.open, e.high, e.low, e.close),
|
|
@@ -337,36 +337,36 @@ function z(e) {
|
|
|
337
337
|
volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function H(e, t) {
|
|
341
341
|
return e === t || e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function jn(e, t) {
|
|
344
344
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
345
345
|
if (e[n].time === t) return n;
|
|
346
346
|
if (e[n].time < t) return -1;
|
|
347
347
|
}
|
|
348
348
|
return -1;
|
|
349
349
|
}
|
|
350
|
-
var
|
|
350
|
+
var Mn = {
|
|
351
351
|
index: -1,
|
|
352
352
|
changed: !1
|
|
353
353
|
};
|
|
354
|
-
function
|
|
354
|
+
function Nn(e, t) {
|
|
355
355
|
if (e.length === 0) return t;
|
|
356
356
|
let n = b(t);
|
|
357
357
|
return u(e) === 1 ? n : n / 1e3;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
let n =
|
|
359
|
+
function Pn(e, t) {
|
|
360
|
+
let n = Nn(e, t.time);
|
|
361
361
|
return n === t.time ? t : {
|
|
362
362
|
...t,
|
|
363
363
|
time: n
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
var
|
|
366
|
+
var U = class {
|
|
367
367
|
data = [];
|
|
368
368
|
withSeriesTime(e) {
|
|
369
|
-
return
|
|
369
|
+
return Pn(this.data, e);
|
|
370
370
|
}
|
|
371
371
|
getData() {
|
|
372
372
|
return this.data;
|
|
@@ -375,16 +375,16 @@ var V = class {
|
|
|
375
375
|
let t = [];
|
|
376
376
|
for (let n = 0; n < e.length; n++) {
|
|
377
377
|
let r = e[n];
|
|
378
|
-
|
|
378
|
+
B(r) && t.push(An(r) ? r : V(r));
|
|
379
379
|
}
|
|
380
380
|
this.data = t;
|
|
381
381
|
}
|
|
382
382
|
prependBars(e) {
|
|
383
383
|
let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
|
|
384
384
|
for (let r = 0; r < e.length; r++) {
|
|
385
|
-
if (!
|
|
385
|
+
if (!B(e[r])) continue;
|
|
386
386
|
let i = this.withSeriesTime(e[r]);
|
|
387
|
-
i.time >= t || n.push(
|
|
387
|
+
i.time >= t || n.push(An(i) ? i : V(i));
|
|
388
388
|
}
|
|
389
389
|
if (n.length === 0) return 0;
|
|
390
390
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -393,11 +393,11 @@ var V = class {
|
|
|
393
393
|
return n.length = r, this.data = n.concat(this.data), r;
|
|
394
394
|
}
|
|
395
395
|
appendBar(e) {
|
|
396
|
-
|
|
396
|
+
B(e) && this.data.push(V(this.withSeriesTime(e)));
|
|
397
397
|
}
|
|
398
398
|
updateLastBar(e) {
|
|
399
|
-
if (!
|
|
400
|
-
let t =
|
|
399
|
+
if (!B(e)) return;
|
|
400
|
+
let t = V(this.withSeriesTime(e));
|
|
401
401
|
if (this.data.length === 0) {
|
|
402
402
|
this.data.push(t);
|
|
403
403
|
return;
|
|
@@ -405,11 +405,11 @@ var V = class {
|
|
|
405
405
|
this.data[this.data.length - 1] = t;
|
|
406
406
|
}
|
|
407
407
|
replaceBar(e) {
|
|
408
|
-
if (!
|
|
409
|
-
let t = this.withSeriesTime(e), n =
|
|
410
|
-
if (n < 0) return
|
|
411
|
-
let r =
|
|
412
|
-
return
|
|
408
|
+
if (!B(e)) return Mn;
|
|
409
|
+
let t = this.withSeriesTime(e), n = jn(this.data, t.time);
|
|
410
|
+
if (n < 0) return Mn;
|
|
411
|
+
let r = V(t);
|
|
412
|
+
return H(this.data[n], r) ? {
|
|
413
413
|
index: n,
|
|
414
414
|
changed: !1
|
|
415
415
|
} : (this.data[n] = r, {
|
|
@@ -426,18 +426,18 @@ var V = class {
|
|
|
426
426
|
clear() {
|
|
427
427
|
this.data = [];
|
|
428
428
|
}
|
|
429
|
-
},
|
|
429
|
+
}, W = {
|
|
430
430
|
to: "none",
|
|
431
431
|
index: -1,
|
|
432
432
|
changed: !1
|
|
433
433
|
};
|
|
434
|
-
function
|
|
434
|
+
function G(e, t) {
|
|
435
435
|
let n = e[e.length - 1];
|
|
436
436
|
if (!n) return "append";
|
|
437
437
|
let r = b(t.time), i = b(n.time);
|
|
438
438
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function Fn(e) {
|
|
441
441
|
return [
|
|
442
442
|
e.time,
|
|
443
443
|
e.open,
|
|
@@ -446,8 +446,8 @@ function Ln(e) {
|
|
|
446
446
|
e.close
|
|
447
447
|
].every(Number.isFinite);
|
|
448
448
|
}
|
|
449
|
-
var
|
|
450
|
-
shown = new
|
|
449
|
+
var In = class {
|
|
450
|
+
shown = new U();
|
|
451
451
|
whole = null;
|
|
452
452
|
aside = null;
|
|
453
453
|
shownRevision = 0;
|
|
@@ -486,7 +486,7 @@ var Rn = class {
|
|
|
486
486
|
}
|
|
487
487
|
let t = null, n = e;
|
|
488
488
|
if (this.whole) {
|
|
489
|
-
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(
|
|
489
|
+
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(Fn).map((e) => this.inSeriesUnit(e)).filter((e) => (r === void 0 || e.time < r) && !i.has(e.time) && i.add(e.time)).sort((e, t) => e.time - t.time);
|
|
490
490
|
this.whole = [...a, ...this.whole];
|
|
491
491
|
let o = this.hoursFilter(this.whole);
|
|
492
492
|
t = a.length, n = o ? a.filter((e) => o(e.time)) : a;
|
|
@@ -498,8 +498,8 @@ var Rn = class {
|
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
mergeSnapshot(e) {
|
|
501
|
-
if (this.aside) return this.aside.setData(
|
|
502
|
-
let t =
|
|
501
|
+
if (this.aside) return this.aside.setData(Ln(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
502
|
+
let t = Ln(this.whole ?? this.shown.getData(), e);
|
|
503
503
|
return t ? (this.shown.setData(this.regularOnly(t)), !0) : !1;
|
|
504
504
|
}
|
|
505
505
|
refilter() {
|
|
@@ -556,7 +556,7 @@ var Rn = class {
|
|
|
556
556
|
mergeTick(e) {
|
|
557
557
|
if (this.aside) return this.aside.updateLastBarFromTick(e), this.wrote("aside", !1);
|
|
558
558
|
let t = this.whole ? this.hoursFilter(this.whole) : null;
|
|
559
|
-
if (t && this.whole && !t(
|
|
559
|
+
if (t && this.whole && !t(Nn(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
560
560
|
let n = this.shown.getLength();
|
|
561
561
|
this.shown.updateLastBarFromTick(e);
|
|
562
562
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -568,14 +568,14 @@ var Rn = class {
|
|
|
568
568
|
}
|
|
569
569
|
placeStreamBar(e) {
|
|
570
570
|
if (this.aside) {
|
|
571
|
-
let t =
|
|
571
|
+
let t = G(this.aside.getData(), e);
|
|
572
572
|
return t === "append" ? this.aside.appendBar(e) : t === "update" && this.aside.updateLastBar(e), this.wrote(t === "stale" ? "none" : "aside", !1);
|
|
573
573
|
}
|
|
574
|
-
let t = this.inSeriesUnit(e), n =
|
|
574
|
+
let t = this.inSeriesUnit(e), n = G(this.whole ?? this.shown.getData(), t);
|
|
575
575
|
if (n === "stale") return this.wrote("none", !1);
|
|
576
576
|
let r = this.startWholeSeries(t, n);
|
|
577
577
|
if (!this.take(t, n)) return this.wrote("hidden", r);
|
|
578
|
-
let i = this.shown.getLength(), a =
|
|
578
|
+
let i = this.shown.getLength(), a = G(this.shown.getData(), t);
|
|
579
579
|
return a === "stale" ? {
|
|
580
580
|
to: "none",
|
|
581
581
|
before: i,
|
|
@@ -589,7 +589,7 @@ var Rn = class {
|
|
|
589
589
|
replace(e) {
|
|
590
590
|
if (this.aside) {
|
|
591
591
|
let { index: t, changed: n } = this.aside.replaceBar(e);
|
|
592
|
-
return t < 0 ?
|
|
592
|
+
return t < 0 ? W : (n && this.onLiveChange({
|
|
593
593
|
kind: "bar",
|
|
594
594
|
time: this.aside.getData()[t].time
|
|
595
595
|
}), {
|
|
@@ -598,22 +598,22 @@ var Rn = class {
|
|
|
598
598
|
changed: n
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
if (!
|
|
602
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
601
|
+
if (!B(e)) return W;
|
|
602
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? jn(n, t.time) : -1;
|
|
603
603
|
if (n) {
|
|
604
|
-
if (r < 0 || !
|
|
604
|
+
if (r < 0 || !B(n[r])) return W;
|
|
605
605
|
let e = this.hoursFilter(n);
|
|
606
606
|
if (e && !e(t.time)) return this.replaceHidden(n, r, t);
|
|
607
607
|
}
|
|
608
608
|
let { index: i, changed: a } = this.shown.replaceBar(t);
|
|
609
|
-
return i < 0 ?
|
|
609
|
+
return i < 0 ? W : (a && (n && (n[r] = this.shown.getData()[i]), this.shownRevision++), {
|
|
610
610
|
to: "shown",
|
|
611
611
|
index: i,
|
|
612
612
|
changed: a
|
|
613
613
|
});
|
|
614
614
|
}
|
|
615
615
|
beginReplay() {
|
|
616
|
-
this.aside || (this.aside = new
|
|
616
|
+
this.aside || (this.aside = new U(), this.aside.setData(this.whole ?? this.shown.getData()));
|
|
617
617
|
}
|
|
618
618
|
endReplay() {
|
|
619
619
|
let e = this.aside;
|
|
@@ -633,10 +633,10 @@ var Rn = class {
|
|
|
633
633
|
this.shown.updateLastBar(e);
|
|
634
634
|
}
|
|
635
635
|
inSeriesUnit(e) {
|
|
636
|
-
return
|
|
636
|
+
return Pn(this.whole ?? this.shown.getData(), e);
|
|
637
637
|
}
|
|
638
638
|
replaceHidden(e, t, n) {
|
|
639
|
-
let r =
|
|
639
|
+
let r = V(n), i = !H(e[t], r);
|
|
640
640
|
return i && (e[t] = r), {
|
|
641
641
|
to: "hidden",
|
|
642
642
|
index: -1,
|
|
@@ -670,14 +670,14 @@ var Rn = class {
|
|
|
670
670
|
return !r || r(e.time);
|
|
671
671
|
}
|
|
672
672
|
};
|
|
673
|
-
function
|
|
673
|
+
function Ln(e, t) {
|
|
674
674
|
let n = t[0]?.time, r = 0;
|
|
675
675
|
for (; n !== void 0 && r < e.length && e[r].time < n;) r++;
|
|
676
676
|
return r === 0 || r === e.length ? null : e.slice(0, r).concat(t);
|
|
677
677
|
}
|
|
678
678
|
//#endregion
|
|
679
679
|
//#region src/HistoryPager.ts
|
|
680
|
-
var
|
|
680
|
+
var Rn = 5e3, zn = 6e4, Bn = 500, Vn = class {
|
|
681
681
|
loader = null;
|
|
682
682
|
pageSize = 500;
|
|
683
683
|
loading = !1;
|
|
@@ -729,7 +729,7 @@ var Bn = 5e3, Vn = 6e4, Hn = 500, Un = class {
|
|
|
729
729
|
try {
|
|
730
730
|
r = await e(t, this.pageSize);
|
|
731
731
|
} catch (e) {
|
|
732
|
-
return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(
|
|
732
|
+
return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(zn, Rn * 2 ** (this.failures - 1)), this.emit({
|
|
733
733
|
state: "error",
|
|
734
734
|
count: 0,
|
|
735
735
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -762,10 +762,10 @@ var Bn = 5e3, Vn = 6e4, Hn = 500, Un = class {
|
|
|
762
762
|
};
|
|
763
763
|
//#endregion
|
|
764
764
|
//#region src/ThemeManager.ts
|
|
765
|
-
function
|
|
765
|
+
function Hn(e, t) {
|
|
766
766
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
767
767
|
}
|
|
768
|
-
var
|
|
768
|
+
var Un = class t {
|
|
769
769
|
base;
|
|
770
770
|
shape = null;
|
|
771
771
|
font = null;
|
|
@@ -790,7 +790,7 @@ var Gn = class t {
|
|
|
790
790
|
return this.base;
|
|
791
791
|
}
|
|
792
792
|
setTheme(e) {
|
|
793
|
-
let n = t.read(e), r = this.font !== null &&
|
|
793
|
+
let n = t.read(e), r = this.font !== null && Hn(n.font, this.base.font);
|
|
794
794
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
795
795
|
...this.base,
|
|
796
796
|
shape: {
|
|
@@ -872,7 +872,7 @@ var Gn = class t {
|
|
|
872
872
|
};
|
|
873
873
|
//#endregion
|
|
874
874
|
//#region src/style/styleOptions.ts
|
|
875
|
-
function
|
|
875
|
+
function Wn(e, t) {
|
|
876
876
|
return t ? {
|
|
877
877
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
878
878
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -880,22 +880,22 @@ function Kn(e, t) {
|
|
|
880
880
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
881
881
|
} : {};
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function Gn(e) {
|
|
884
884
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
885
885
|
return {
|
|
886
886
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
887
887
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
888
888
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
889
889
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
890
|
-
...
|
|
891
|
-
...
|
|
890
|
+
...Wn("horizontal", n?.hLine),
|
|
891
|
+
...Wn("vertical", n?.vLine),
|
|
892
892
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
893
893
|
...e.overrides
|
|
894
894
|
};
|
|
895
895
|
}
|
|
896
896
|
//#endregion
|
|
897
897
|
//#region src/layout/LayoutManager.ts
|
|
898
|
-
var
|
|
898
|
+
var Kn = 200, qn = 80, K = (e) => e.position === "top" || e.position === "bottom", Jn = class {
|
|
899
899
|
panels = [];
|
|
900
900
|
containerWidth = 0;
|
|
901
901
|
containerHeight = 0;
|
|
@@ -912,8 +912,8 @@ var Jn = 200, Yn = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
912
912
|
this.panels.push({
|
|
913
913
|
id: e,
|
|
914
914
|
position: n,
|
|
915
|
-
size: r ?? (a ?
|
|
916
|
-
minSize: a ?
|
|
915
|
+
size: r ?? (a ? Kn : t),
|
|
916
|
+
minSize: a ? qn : i,
|
|
917
917
|
content: {
|
|
918
918
|
type: "indicator",
|
|
919
919
|
indicatorInstanceId: e
|
|
@@ -932,14 +932,14 @@ var Jn = 200, Yn = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
932
932
|
}
|
|
933
933
|
setPanelCollapsed(e, t) {
|
|
934
934
|
let n = this.panels.find((t) => t.id === e);
|
|
935
|
-
return !n || !
|
|
935
|
+
return !n || !K(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
|
|
936
936
|
}
|
|
937
937
|
isPanelCollapsed(e) {
|
|
938
938
|
return !!this.panels.find((t) => t.id === e)?.collapsed;
|
|
939
939
|
}
|
|
940
940
|
isPanelShownCollapsed(e) {
|
|
941
941
|
let t = this.panels.find((t) => t.id === e);
|
|
942
|
-
return !t || !
|
|
942
|
+
return !t || !K(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
|
|
943
943
|
}
|
|
944
944
|
setPanelScale(e, t) {
|
|
945
945
|
let n = this.panels.find((t) => t.id === e);
|
|
@@ -955,7 +955,7 @@ var Jn = 200, Yn = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
955
955
|
}
|
|
956
956
|
setMaximizedPanel(e) {
|
|
957
957
|
let t = e === null ? null : this.panels.find((t) => t.id === e);
|
|
958
|
-
return e !== null && (!t || !
|
|
958
|
+
return e !== null && (!t || !K(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
|
|
959
959
|
}
|
|
960
960
|
getMaximizedPanel() {
|
|
961
961
|
return this.maximized;
|
|
@@ -976,19 +976,19 @@ var Jn = 200, Yn = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
976
976
|
this.panels = [...this.panels].sort((e, n) => t(e) - t(n));
|
|
977
977
|
}
|
|
978
978
|
shownSize(e, t) {
|
|
979
|
-
return
|
|
979
|
+
return K(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
|
|
980
980
|
}
|
|
981
981
|
setPanelPosition(e, n) {
|
|
982
982
|
let r = this.panels.find((t) => t.id === e);
|
|
983
983
|
if (r) {
|
|
984
984
|
let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
|
|
985
|
-
r.position = n, a !== o && (r.size = o ?
|
|
985
|
+
r.position = n, a !== o && (r.size = o ? Kn : t, r.minSize = o ? qn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
setPanelSize(e, t) {
|
|
989
989
|
let n = this.panels.find((t) => t.id === e);
|
|
990
990
|
if (n) {
|
|
991
|
-
let e =
|
|
991
|
+
let e = K(n) ? this.containerHeight - s - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
|
|
992
992
|
n.size = Math.max(n.minSize, r), n.collapsed = void 0, this.maximized = null;
|
|
993
993
|
}
|
|
994
994
|
}
|
|
@@ -1102,8 +1102,8 @@ var Jn = 200, Yn = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1102
1102
|
getMainChartRect() {
|
|
1103
1103
|
return this.resolve().mainChartRect;
|
|
1104
1104
|
}
|
|
1105
|
-
},
|
|
1106
|
-
function
|
|
1105
|
+
}, Yn = 14, Xn = 14, Zn = 22, Qn = 4;
|
|
1106
|
+
function $n(e) {
|
|
1107
1107
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: s, measure: l } = e, u = e.tagPrecision ?? c(t, n), d = u, f = r === null ? [t, n] : [
|
|
1108
1108
|
t,
|
|
1109
1109
|
n,
|
|
@@ -1112,16 +1112,16 @@ function tr(e) {
|
|
|
1112
1112
|
for (let t of f) {
|
|
1113
1113
|
if (!Number.isFinite(t)) continue;
|
|
1114
1114
|
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : h(t, u, i), r = e.format ? n : h(t, d, i);
|
|
1115
|
-
p = Math.max(p, l(n, `500 ${s}px ${a}`) +
|
|
1115
|
+
p = Math.max(p, l(n, `500 ${s}px ${a}`) + Yn, l(r, `bold 11px ${a}`) + Xn, l(r, `600 ${s}px ${a}`) + Zn);
|
|
1116
1116
|
}
|
|
1117
|
-
return p <= o ? o : Math.ceil(p /
|
|
1117
|
+
return p <= o ? o : Math.ceil(p / Qn) * Qn;
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1119
|
+
function er(e, t) {
|
|
1120
1120
|
return t > e || t <= e - 12 ? t : e;
|
|
1121
1121
|
}
|
|
1122
1122
|
//#endregion
|
|
1123
1123
|
//#region src/layout/labelWidths.ts
|
|
1124
|
-
var
|
|
1124
|
+
var tr = 512, nr = class {
|
|
1125
1125
|
widths = /* @__PURE__ */ new Map();
|
|
1126
1126
|
fonts;
|
|
1127
1127
|
forget = () => this.widths.clear();
|
|
@@ -1132,12 +1132,12 @@ var rr = 512, ir = class {
|
|
|
1132
1132
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1133
1133
|
if (i !== void 0) return i;
|
|
1134
1134
|
let a = n();
|
|
1135
|
-
return this.widths.size >=
|
|
1135
|
+
return this.widths.size >= tr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1136
1136
|
}
|
|
1137
1137
|
destroy() {
|
|
1138
1138
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1139
1139
|
}
|
|
1140
|
-
},
|
|
1140
|
+
}, rr = class {
|
|
1141
1141
|
netY = 0;
|
|
1142
1142
|
travelX = 0;
|
|
1143
1143
|
engaged = !1;
|
|
@@ -1153,11 +1153,11 @@ var rr = 512, ir = class {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
return this.engaged;
|
|
1155
1155
|
}
|
|
1156
|
-
},
|
|
1157
|
-
function
|
|
1156
|
+
}, ir = 1;
|
|
1157
|
+
function ar(e, t) {
|
|
1158
1158
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function q(e) {
|
|
1161
1161
|
switch (e.kind) {
|
|
1162
1162
|
case "indicator": return `indicator:${e.plugin.descriptor.id}`;
|
|
1163
1163
|
case "drawing": return `drawing:${e.plugin.descriptor.type}`;
|
|
@@ -1167,25 +1167,25 @@ function G(e) {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
//#endregion
|
|
1169
1169
|
//#region src/plugins/registry.ts
|
|
1170
|
-
var
|
|
1171
|
-
function
|
|
1172
|
-
|
|
1170
|
+
var J = /* @__PURE__ */ new Map();
|
|
1171
|
+
function or(e) {
|
|
1172
|
+
J.set(q(e), e);
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1175
|
-
return
|
|
1174
|
+
function sr(e) {
|
|
1175
|
+
return J.delete(e);
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1178
|
-
return [...
|
|
1177
|
+
function cr() {
|
|
1178
|
+
return [...J.values()];
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1181
|
-
|
|
1180
|
+
function lr() {
|
|
1181
|
+
J.clear();
|
|
1182
1182
|
}
|
|
1183
1183
|
//#endregion
|
|
1184
1184
|
//#region src/plugins/PluginManager.ts
|
|
1185
|
-
var
|
|
1185
|
+
var ur = class {
|
|
1186
1186
|
plugins = /* @__PURE__ */ new Map();
|
|
1187
1187
|
constructor(e, t = {}) {
|
|
1188
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1188
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of cr()) this.add(e);
|
|
1189
1189
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1190
1190
|
}
|
|
1191
1191
|
register(e) {
|
|
@@ -1213,17 +1213,17 @@ var fr = class {
|
|
|
1213
1213
|
return e;
|
|
1214
1214
|
}
|
|
1215
1215
|
add(e) {
|
|
1216
|
-
this.plugins.set(
|
|
1216
|
+
this.plugins.set(q(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1217
1217
|
}
|
|
1218
|
-
},
|
|
1218
|
+
}, dr = {
|
|
1219
1219
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1220
1220
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1221
1221
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1222
1222
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1223
1223
|
positionClose: (e, t) => e.closePosition(t),
|
|
1224
|
-
positionReverse: (e, t, n) =>
|
|
1224
|
+
positionReverse: (e, t, n) => fr(e, t, n)
|
|
1225
1225
|
};
|
|
1226
|
-
async function
|
|
1226
|
+
async function fr(e, t, n) {
|
|
1227
1227
|
let { reversing: r } = n;
|
|
1228
1228
|
if (!r.has(t.positionId)) {
|
|
1229
1229
|
r.add(t.positionId);
|
|
@@ -1252,7 +1252,7 @@ async function mr(e, t, n) {
|
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function pr(e, t) {
|
|
1256
1256
|
let n = [], r = null, i = {
|
|
1257
1257
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1258
1258
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1262,8 +1262,8 @@ function hr(e, t) {
|
|
|
1262
1262
|
e.data && t.onFill?.(e.data);
|
|
1263
1263
|
};
|
|
1264
1264
|
e.on("orders", a), e.on("positions", o), e.on("error", s), e.on("fill", c), n.push(() => e.off("orders", a), () => e.off("positions", o), () => e.off("error", s), () => e.off("fill", c));
|
|
1265
|
-
for (let r of Object.keys(
|
|
1266
|
-
let a =
|
|
1265
|
+
for (let r of Object.keys(dr)) {
|
|
1266
|
+
let a = dr[r], o = t.onIntent(r, (n) => {
|
|
1267
1267
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1268
1268
|
message: `Execution command failed: ${r}`,
|
|
1269
1269
|
cause: e
|
|
@@ -1277,7 +1277,7 @@ function hr(e, t) {
|
|
|
1277
1277
|
}
|
|
1278
1278
|
//#endregion
|
|
1279
1279
|
//#region src/replay/ReplayStepLoader.ts
|
|
1280
|
-
var
|
|
1280
|
+
var mr = 1e3, hr = class {
|
|
1281
1281
|
pieces = /* @__PURE__ */ new Map();
|
|
1282
1282
|
asked = /* @__PURE__ */ new Set();
|
|
1283
1283
|
inFlight = !1;
|
|
@@ -1310,7 +1310,7 @@ var gr = 1e3, _r = class {
|
|
|
1310
1310
|
this.done = !0;
|
|
1311
1311
|
}
|
|
1312
1312
|
ask(e, t) {
|
|
1313
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1313
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(mr / n)), s = Math.min(e.length, t + o), c = s < e.length ? e[s].time : e[e.length - 1].time + r, l = e.slice(t, s);
|
|
1314
1314
|
for (let e of l) this.asked.add(e.time);
|
|
1315
1315
|
this.inFlight = !0, a({
|
|
1316
1316
|
state: "loading",
|
|
@@ -1351,12 +1351,12 @@ var gr = 1e3, _r = class {
|
|
|
1351
1351
|
...n === void 0 ? {} : { error: n }
|
|
1352
1352
|
});
|
|
1353
1353
|
}
|
|
1354
|
-
},
|
|
1355
|
-
function
|
|
1356
|
-
let n = (e.high - e.low) *
|
|
1357
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1354
|
+
}, gr = 1 / 3, _r = .25, vr = .5;
|
|
1355
|
+
function yr(e, t) {
|
|
1356
|
+
let n = (e.high - e.low) * _r;
|
|
1357
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * vr;
|
|
1358
1358
|
}
|
|
1359
|
-
function
|
|
1359
|
+
function br(e) {
|
|
1360
1360
|
return e.close >= e.open ? [
|
|
1361
1361
|
e.open,
|
|
1362
1362
|
e.low,
|
|
@@ -1369,22 +1369,22 @@ function Sr(e) {
|
|
|
1369
1369
|
e.close
|
|
1370
1370
|
];
|
|
1371
1371
|
}
|
|
1372
|
-
function
|
|
1373
|
-
let r =
|
|
1372
|
+
function xr(e, t, n) {
|
|
1373
|
+
let r = br(e), i = [
|
|
1374
1374
|
1,
|
|
1375
1375
|
2,
|
|
1376
1376
|
3
|
|
1377
1377
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1378
1378
|
return r.forEach((r, c) => {
|
|
1379
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1379
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : gr), !(c === 0 && t > 0) && o.push({
|
|
1380
1380
|
price: r,
|
|
1381
1381
|
time: e.time,
|
|
1382
1382
|
at: (t + s) / n
|
|
1383
1383
|
});
|
|
1384
1384
|
}), o;
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1387
|
-
let n = t.length > 0 &&
|
|
1386
|
+
function Sr(e, t = []) {
|
|
1387
|
+
let n = t.length > 0 && yr(e, t) ? t : [e], r = n.length, i = Cr(n.flatMap((e, t) => xr(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1388
1388
|
return {
|
|
1389
1389
|
bar: e,
|
|
1390
1390
|
points: i,
|
|
@@ -1394,7 +1394,7 @@ function wr(e, t = []) {
|
|
|
1394
1394
|
}))
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function Cr(e, t) {
|
|
1398
1398
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1399
1399
|
...e,
|
|
1400
1400
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1409,7 +1409,7 @@ function Tr(e, t) {
|
|
|
1409
1409
|
};
|
|
1410
1410
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1411
1411
|
}
|
|
1412
|
-
function
|
|
1412
|
+
function wr(e, t) {
|
|
1413
1413
|
let n = e.points;
|
|
1414
1414
|
if (t <= n[0].at) return n[0].price;
|
|
1415
1415
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1418,8 +1418,8 @@ function Er(e, t) {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
return n[n.length - 1].price;
|
|
1420
1420
|
}
|
|
1421
|
-
var
|
|
1422
|
-
function
|
|
1421
|
+
var Tr = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1422
|
+
function Er(e, t) {
|
|
1423
1423
|
let n = 0, r = 0;
|
|
1424
1424
|
for (let i of e.volumeAt) {
|
|
1425
1425
|
if (t >= i.at) {
|
|
@@ -1430,10 +1430,10 @@ function Or(e, t) {
|
|
|
1430
1430
|
}
|
|
1431
1431
|
return n;
|
|
1432
1432
|
}
|
|
1433
|
-
function
|
|
1434
|
-
let n =
|
|
1433
|
+
function Dr(e, t) {
|
|
1434
|
+
let n = Tr(t);
|
|
1435
1435
|
if (n >= 1) return { ...e.bar };
|
|
1436
|
-
let r =
|
|
1436
|
+
let r = wr(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1437
1437
|
for (let t of e.points) {
|
|
1438
1438
|
if (t.at > n) break;
|
|
1439
1439
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1444,29 +1444,29 @@ function kr(e, t) {
|
|
|
1444
1444
|
high: i,
|
|
1445
1445
|
low: a,
|
|
1446
1446
|
close: r,
|
|
1447
|
-
volume:
|
|
1447
|
+
volume: Er(e, n)
|
|
1448
1448
|
};
|
|
1449
1449
|
}
|
|
1450
|
-
function
|
|
1451
|
-
let n =
|
|
1450
|
+
function Or(e, t) {
|
|
1451
|
+
let n = Tr(t), r = 0;
|
|
1452
1452
|
for (let t of e.points) {
|
|
1453
1453
|
if (t.at > n) break;
|
|
1454
1454
|
r = t.at;
|
|
1455
1455
|
}
|
|
1456
1456
|
return r;
|
|
1457
1457
|
}
|
|
1458
|
-
function
|
|
1458
|
+
function Y(e, t, n) {
|
|
1459
1459
|
let r = [], i = e.bar.time;
|
|
1460
1460
|
for (let a of e.points) {
|
|
1461
1461
|
if (a.at > n) break;
|
|
1462
1462
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1463
1463
|
}
|
|
1464
|
-
let a =
|
|
1464
|
+
let a = wr(e, n);
|
|
1465
1465
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1466
1466
|
}
|
|
1467
1467
|
//#endregion
|
|
1468
1468
|
//#region src/replay/replayStep.ts
|
|
1469
|
-
var
|
|
1469
|
+
var kr = [
|
|
1470
1470
|
"1m",
|
|
1471
1471
|
"3m",
|
|
1472
1472
|
"5m",
|
|
@@ -1477,30 +1477,30 @@ var jr = [
|
|
|
1477
1477
|
"4h",
|
|
1478
1478
|
"1d"
|
|
1479
1479
|
];
|
|
1480
|
-
function
|
|
1480
|
+
function Ar(e, t) {
|
|
1481
1481
|
let n = T(e);
|
|
1482
|
-
return n > 0 ?
|
|
1482
|
+
return n > 0 ? kr.filter((e) => {
|
|
1483
1483
|
let r = T(e);
|
|
1484
1484
|
return r < n && n % r === 0 && t(e);
|
|
1485
1485
|
}) : [];
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1488
|
-
let r =
|
|
1487
|
+
function jr(e, t, n) {
|
|
1488
|
+
let r = Ar(t, n);
|
|
1489
1489
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1490
1490
|
let i = T(t);
|
|
1491
1491
|
return r.find((e) => i / T(e) <= 60) ?? null;
|
|
1492
1492
|
}
|
|
1493
1493
|
//#endregion
|
|
1494
1494
|
//#region src/Chart.ts
|
|
1495
|
-
var
|
|
1495
|
+
var Mr = {
|
|
1496
1496
|
min: 0,
|
|
1497
1497
|
max: 100
|
|
1498
|
-
},
|
|
1499
|
-
function
|
|
1498
|
+
}, Nr = "exchange", Pr = Nr;
|
|
1499
|
+
function Fr(e) {
|
|
1500
1500
|
if (typeof e == "string" && e !== "exchange" && !v(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
1501
1501
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
1502
1502
|
}
|
|
1503
|
-
function
|
|
1503
|
+
function Ir(e, t) {
|
|
1504
1504
|
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : w(e);
|
|
1505
1505
|
return i === void 0 ? e : {
|
|
1506
1506
|
...e,
|
|
@@ -1508,11 +1508,11 @@ function Rr(e, t) {
|
|
|
1508
1508
|
timezone: i
|
|
1509
1509
|
};
|
|
1510
1510
|
}
|
|
1511
|
-
var
|
|
1512
|
-
static version = "1.54.
|
|
1511
|
+
var Lr = .08, Rr = a ** -7, zr = 800, Br = 20, Vr = 8, Hr = new Set(["horizontalLine", "crossLine"]), Ur = new Set(["verticalLine", "crossLine"]), Wr = class {
|
|
1512
|
+
static version = "1.54.1";
|
|
1513
1513
|
engine;
|
|
1514
1514
|
viewport;
|
|
1515
|
-
series = new
|
|
1515
|
+
series = new In((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
1516
1516
|
themeManager;
|
|
1517
1517
|
layoutManager;
|
|
1518
1518
|
pluginManager;
|
|
@@ -1539,7 +1539,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1539
1539
|
renderDeferred = !1;
|
|
1540
1540
|
priceAxisWidth = o;
|
|
1541
1541
|
measureCtx;
|
|
1542
|
-
labelWidths = new
|
|
1542
|
+
labelWidths = new nr();
|
|
1543
1543
|
containerSizeCache = null;
|
|
1544
1544
|
containerSizeCacheTime = 0;
|
|
1545
1545
|
lastEmittedRange = null;
|
|
@@ -1599,7 +1599,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1599
1599
|
replayForming = null;
|
|
1600
1600
|
replayPhaseUnsub = null;
|
|
1601
1601
|
undoRedoManager;
|
|
1602
|
-
autoSaveScheduler = new
|
|
1602
|
+
autoSaveScheduler = new kn((e) => this.saveState(e));
|
|
1603
1603
|
animator;
|
|
1604
1604
|
crosshairTooltip;
|
|
1605
1605
|
pinnedTooltip;
|
|
@@ -1651,7 +1651,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1651
1651
|
snapshotKey = null;
|
|
1652
1652
|
historyCheckQueued = !1;
|
|
1653
1653
|
constructor(e, t) {
|
|
1654
|
-
t.timeZone != null &&
|
|
1654
|
+
t.timeZone != null && Fr(t.timeZone), this.container = e, this.options = {
|
|
1655
1655
|
...t,
|
|
1656
1656
|
chartType: t.chartType ?? "candlestick"
|
|
1657
1657
|
}, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
|
|
@@ -1689,11 +1689,11 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1689
1689
|
logScale: n.logScale ?? !0,
|
|
1690
1690
|
timeframes: n.timeframes ?? [],
|
|
1691
1691
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
1692
|
-
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new
|
|
1692
|
+
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new Vn({
|
|
1693
1693
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
1694
1694
|
prepend: (e) => this.prependBars(e),
|
|
1695
1695
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
1696
|
-
}), this.themeManager = new
|
|
1696
|
+
}), this.themeManager = new Un(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(Gn(t), "host", !1), this.layoutManager = new Jn(), this.indicatorEngine = new ze(), this.pluginManager = new ur(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Pe(), zt(this.indicatorEngine), this.indicatorEngine.register(new Se(this.symbolSeries)), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.indicatorEngine.register(new ft(this.symbolSeries)), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.drawingManager = new je(), Rt(this.drawingManager), this.drawingRenderer = new Me(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingManager.setRequestRender(() => {
|
|
1697
1697
|
this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
|
|
1698
1698
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
1699
1699
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
@@ -1726,7 +1726,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1726
1726
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
1727
1727
|
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Fe(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new $e(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new gt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Ee(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
1728
1728
|
if (e !== null && t) {
|
|
1729
|
-
let n = this.crosshairSeries(), i = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o =
|
|
1729
|
+
let n = this.crosshairSeries(), i = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = j(n), s = i ? o[e]?.time ?? i.time : void 0;
|
|
1730
1730
|
this.chartLegend.setHoverBar(i ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(r.Hover);
|
|
1731
1731
|
let c = this.viewport.getState(), l = t.y >= c.chartRect.y && t.y <= c.chartRect.y + c.chartRect.height;
|
|
1732
1732
|
if (i && l && this.features.crosshairTooltip) {
|
|
@@ -1738,7 +1738,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1738
1738
|
prevClose: a,
|
|
1739
1739
|
priceRange: c.priceRange,
|
|
1740
1740
|
plot: c.chartRect,
|
|
1741
|
-
barStepMs:
|
|
1741
|
+
barStepMs: Dt(o),
|
|
1742
1742
|
timeUnit: u(o)
|
|
1743
1743
|
});
|
|
1744
1744
|
} else this.crosshairTooltip.hide();
|
|
@@ -1749,7 +1749,11 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1749
1749
|
...s === void 0 ? {} : { time: s },
|
|
1750
1750
|
...a === void 0 ? {} : { prevClose: a }
|
|
1751
1751
|
});
|
|
1752
|
-
} else
|
|
1752
|
+
} else {
|
|
1753
|
+
this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.features.legend && this.engine.requestRender(r.Hover), this.eventBus.emit("crosshairLeave", {});
|
|
1754
|
+
let e = this.crosshairHandler.getSyncedSlot();
|
|
1755
|
+
e !== null && this.showSyncedBar(e);
|
|
1756
|
+
}
|
|
1753
1757
|
}), this.chartLegend = new be(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setResizeListener(() => {
|
|
1754
1758
|
this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
|
|
1755
1759
|
}), this.watermark = new Tt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new wt(), this.volumeProfile = new Ct(), this.marketProfile = new Ge(), this.depthHeatmap = new Ae(), this.periodLevels = new Ye(), this.pivotMarkers = new Ze(), this.barCountdown = new ge(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new lt(), this.sessionShading = new ut(), this.compareRenderer = new xe(), t.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
@@ -1757,7 +1761,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1757
1761
|
color: t.sessionBreaks.color,
|
|
1758
1762
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
1759
1763
|
lineWidth: t.sessionBreaks.lineWidth
|
|
1760
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new pe(), this.crosshairTooltip = new De(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Xe(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = S(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(
|
|
1764
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new pe(), this.crosshairTooltip = new De(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Xe(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = S(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Xr(t.shapes)), t.font && this.themeManager.setFont(Yr(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new He({
|
|
1761
1765
|
scrollBars: (e) => {
|
|
1762
1766
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
1763
1767
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -1774,7 +1778,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1774
1778
|
},
|
|
1775
1779
|
fitContent: () => this.fitContent()
|
|
1776
1780
|
}), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
|
|
1777
|
-
this.a11y = new
|
|
1781
|
+
this.a11y = new nn(e, {
|
|
1778
1782
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
1779
1783
|
timeframe: () => this.streamTimeframe ?? "",
|
|
1780
1784
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
@@ -1801,8 +1805,8 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1801
1805
|
}
|
|
1802
1806
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
1803
1807
|
}
|
|
1804
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Oe(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new fe(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(
|
|
1805
|
-
this.eventBus.emit("alertTriggered",
|
|
1808
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Oe(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new fe(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(At).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
1809
|
+
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
1806
1810
|
kind: "alert",
|
|
1807
1811
|
alert: "triggered",
|
|
1808
1812
|
alertId: e.id,
|
|
@@ -1810,13 +1814,13 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1810
1814
|
message: e.message
|
|
1811
1815
|
});
|
|
1812
1816
|
}), this.alertManager.on("added", (e) => {
|
|
1813
|
-
this.eventBus.emit("alertAdd",
|
|
1817
|
+
this.eventBus.emit("alertAdd", X(e));
|
|
1814
1818
|
}), this.alertManager.on("removed", (e) => {
|
|
1815
1819
|
this.eventBus.emit("alertRemove", { id: e });
|
|
1816
1820
|
}), this.alertManager.on("expired", (e) => {
|
|
1817
|
-
this.eventBus.emit("alertExpired",
|
|
1821
|
+
this.eventBus.emit("alertExpired", X(e));
|
|
1818
1822
|
}), this.alertManager.on("updated", (e) => {
|
|
1819
|
-
this.eventBus.emit("alertUpdate",
|
|
1823
|
+
this.eventBus.emit("alertUpdate", X(e));
|
|
1820
1824
|
}), this.signalMarkerManager = new dt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
1821
1825
|
this.eventBus.emit("signalMarkerAdd", {
|
|
1822
1826
|
id: e.id,
|
|
@@ -1841,7 +1845,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1841
1845
|
}), this.replayManager.on("stateChange", (e) => {
|
|
1842
1846
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
1843
1847
|
}), this.measureOverlay = new Ke(), this.interactionManager = new Be(e), this.features.panning) {
|
|
1844
|
-
let e = new
|
|
1848
|
+
let e = new rr();
|
|
1845
1849
|
this.interactionManager.setPanHandler(new qe((t, n) => {
|
|
1846
1850
|
t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
1847
1851
|
}, () => e.reset()));
|
|
@@ -1877,7 +1881,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1877
1881
|
y: t.y
|
|
1878
1882
|
});
|
|
1879
1883
|
})), this.interactionManager.setChartContextMenu((e, t) => this.eventBus.hasListeners("chartContextMenu") ? (this.eventBus.emit("chartContextMenu", this.contextAt(e, t)), !0) : !1), this.priceAxisAddButton.setEnabled(this.features.priceAxisAddButton && this.features.crosshair), this.interactionManager.setPriceAxisAddButton(this.priceAxisAddButton, (e) => {
|
|
1880
|
-
let t =
|
|
1884
|
+
let t = Jt(e.y, this.viewport.getState());
|
|
1881
1885
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
1882
1886
|
price: t,
|
|
1883
1887
|
x: e.x,
|
|
@@ -1914,7 +1918,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1914
1918
|
x: e.x,
|
|
1915
1919
|
y: e.y
|
|
1916
1920
|
}), t.length === 0) return;
|
|
1917
|
-
let r =
|
|
1921
|
+
let r = qt(e.x, this.viewport.getState());
|
|
1918
1922
|
r < 0 || r >= t.length || this.eventBus.emit("barClick", {
|
|
1919
1923
|
bar: t[r],
|
|
1920
1924
|
barIndex: r,
|
|
@@ -1957,7 +1961,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
1957
1961
|
end: () => {
|
|
1958
1962
|
let e = this.selectionBoxOverlay.end();
|
|
1959
1963
|
if (e && this.zoomAreaMode) {
|
|
1960
|
-
if (e.x1 - e.x0 <
|
|
1964
|
+
if (e.x1 - e.x0 < Vr) return;
|
|
1961
1965
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
1962
1966
|
return;
|
|
1963
1967
|
}
|
|
@@ -2001,7 +2005,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2001
2005
|
loadDuringReplay(e) {
|
|
2002
2006
|
this.snapshotKey = null, this.history.reset(), this.alertManager.clearLastValues();
|
|
2003
2007
|
let t = e[e.length - 1];
|
|
2004
|
-
t &&
|
|
2008
|
+
t && B(t) && this.alertManager.seedLastValue("price", t.close), this.replaySession && (this.replaySession.price = null), this.series.load(e);
|
|
2005
2009
|
}
|
|
2006
2010
|
prependBars(e) {
|
|
2007
2011
|
if (this.replaySession) return this.series.prepend(e).taken;
|
|
@@ -2009,7 +2013,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2009
2013
|
if (i === 0) return a;
|
|
2010
2014
|
let o = this.series.bars();
|
|
2011
2015
|
if (this.crosshairHandler.setData(o), this.displayDataCache = null, this.reshapeMemo.clear(), this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), r !== void 0) {
|
|
2012
|
-
let e = Math.round(
|
|
2016
|
+
let e = Math.round(P(r, this.getDisplayData()));
|
|
2013
2017
|
this.viewport.prependBars(e - n);
|
|
2014
2018
|
}
|
|
2015
2019
|
return this.updateViewportAndRender(), a;
|
|
@@ -2037,16 +2041,16 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2037
2041
|
}
|
|
2038
2042
|
checkHistory() {
|
|
2039
2043
|
this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
|
|
2040
|
-
if (this.historyCheckQueued = !1, !this.replayPages() || !this.history.hasLoader() ||
|
|
2044
|
+
if (this.historyCheckQueued = !1, !this.replayPages() || !this.history.hasLoader() || R(this.options.chartType)) return;
|
|
2041
2045
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2042
2046
|
if (t.width <= 0) return;
|
|
2043
2047
|
let { from: n, to: r } = e;
|
|
2044
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2048
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Br, r - n));
|
|
2045
2049
|
}));
|
|
2046
2050
|
}
|
|
2047
2051
|
useStreamHistory(e, t, n = !0) {
|
|
2048
2052
|
if (this.hostHistoryLoader) return;
|
|
2049
|
-
let r =
|
|
2053
|
+
let r = F(e), i = r.fetchHistoryBefore, a = this.streamTimeframe;
|
|
2050
2054
|
if (!i || a === null || le(a) !== null) {
|
|
2051
2055
|
this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
|
|
2052
2056
|
return;
|
|
@@ -2055,7 +2059,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2055
2059
|
this.history.setLoader((e, t) => i.call(r, o, a, e, t), t), this.historyFromStream = !0, n && this.checkHistory();
|
|
2056
2060
|
}
|
|
2057
2061
|
appendBar(e) {
|
|
2058
|
-
if (!
|
|
2062
|
+
if (!B(e)) return;
|
|
2059
2063
|
let t = this.series.append(e);
|
|
2060
2064
|
if (t.refiltered && (this.displayDataCache = null), t.to !== "shown") {
|
|
2061
2065
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -2065,7 +2069,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2065
2069
|
this.crosshairHandler.setData(i), this.displayDataCache = null, this.recalcIndicatorsFrom(i, i.length - 2), this.currentPriceLine.setPrice(e.close, i[i.length - 2]?.close), this.updateViewportAndRender(n), i.length !== r && this.emitBars(i.length), this.followLivePrice(e.close);
|
|
2066
2070
|
}
|
|
2067
2071
|
appendBars(e) {
|
|
2068
|
-
if (e = e.filter(
|
|
2072
|
+
if (e = e.filter(B), e.length === 0) return;
|
|
2069
2073
|
let t = e[e.length - 1].close, n = this.series.appendMany(e);
|
|
2070
2074
|
if (n.refiltered && (this.displayDataCache = null), n.shown === 0) {
|
|
2071
2075
|
this.takeLivePrice(t), n.aside || this.scheduleRender();
|
|
@@ -2077,7 +2081,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2077
2081
|
this.recalcIndicatorsFrom(a, i - 1), this.crosshairHandler.setData(a), this.currentPriceLine.setPrice(t, a[a.length - 2]?.close), this.updateViewportAndRender(r), a.length !== i && this.emitBars(a.length), this.followLivePrice(t);
|
|
2078
2082
|
}
|
|
2079
2083
|
updateLastBar(e) {
|
|
2080
|
-
if (!
|
|
2084
|
+
if (!B(e)) return;
|
|
2081
2085
|
let t = this.series.updateLast(e);
|
|
2082
2086
|
if (t.refiltered && (this.displayDataCache = null), t.to !== "shown") {
|
|
2083
2087
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -2099,7 +2103,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2099
2103
|
this.recalcIndicatorsFrom(n, n.length - 1), this.followLivePrice(e.price), this.scheduleRender();
|
|
2100
2104
|
}
|
|
2101
2105
|
updateBar(e) {
|
|
2102
|
-
if (!
|
|
2106
|
+
if (!B(e)) return !1;
|
|
2103
2107
|
let t = this.series.replace(e);
|
|
2104
2108
|
return t.to === "none" ? !1 : (t.to === "shown" && t.changed && this.showCorrection(t.index), !0);
|
|
2105
2109
|
}
|
|
@@ -2133,12 +2137,12 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2133
2137
|
}
|
|
2134
2138
|
fitFewColumns() {
|
|
2135
2139
|
let e = this.options.chartType;
|
|
2136
|
-
if (!
|
|
2140
|
+
if (!R(e) || this.pluginManager.getChartType(e)) return;
|
|
2137
2141
|
let t = this.getDisplayData().length, { chartRect: n, barWidth: r, barSpacing: i } = this.viewport.getState(), a = n.width / (r + i);
|
|
2138
2142
|
t > 0 && a > t + this.viewport.getRightMargin() && this.fitContent();
|
|
2139
2143
|
}
|
|
2140
2144
|
applyTimeSpacing() {
|
|
2141
|
-
let e = !this.tickStream && !
|
|
2145
|
+
let e = !this.tickStream && !R(this.options.chartType);
|
|
2142
2146
|
this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
|
|
2143
2147
|
}
|
|
2144
2148
|
setChartTypeOptions(e) {
|
|
@@ -2157,7 +2161,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2157
2161
|
return this.extendedHours;
|
|
2158
2162
|
}
|
|
2159
2163
|
sessionKeep(e) {
|
|
2160
|
-
return this.extendedHours ? null :
|
|
2164
|
+
return this.extendedHours ? null : Zt(this.symbolInfo, e);
|
|
2161
2165
|
}
|
|
2162
2166
|
reapplyExtendedHours() {
|
|
2163
2167
|
if (!this.series.refilter()) return;
|
|
@@ -2168,7 +2172,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2168
2172
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2169
2173
|
}
|
|
2170
2174
|
setShapes(e) {
|
|
2171
|
-
let t =
|
|
2175
|
+
let t = Xr(e);
|
|
2172
2176
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2173
2177
|
...this.themeManager.getTheme().shape,
|
|
2174
2178
|
...t
|
|
@@ -2180,7 +2184,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2180
2184
|
setFont(e) {
|
|
2181
2185
|
if (e === null) this.themeManager.setFont(null);
|
|
2182
2186
|
else {
|
|
2183
|
-
let t =
|
|
2187
|
+
let t = Yr(e);
|
|
2184
2188
|
if (Object.keys(t).length === 0) return;
|
|
2185
2189
|
this.themeManager.setFont(t);
|
|
2186
2190
|
}
|
|
@@ -2258,7 +2262,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2258
2262
|
this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
|
|
2259
2263
|
}
|
|
2260
2264
|
updateIndicatorNow(e, t) {
|
|
2261
|
-
let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ?
|
|
2265
|
+
let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? N(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
|
|
2262
2266
|
this.indicatorEngine.updateIndicator(e, t, this.indicatorBars()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
|
|
2263
2267
|
instanceId: e,
|
|
2264
2268
|
change: "params"
|
|
@@ -2276,7 +2280,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2276
2280
|
paneFor(e, t, n, r) {
|
|
2277
2281
|
if (n) return this.paneHostOf(n, r);
|
|
2278
2282
|
if (e.placement !== "overlay") return null;
|
|
2279
|
-
let i =
|
|
2283
|
+
let i = N(e), a = i ? x(t[i]) : null;
|
|
2280
2284
|
return a ? this.paneHostOf(a.instanceId, r) : null;
|
|
2281
2285
|
}
|
|
2282
2286
|
paneHostOf(e, t) {
|
|
@@ -2322,8 +2326,8 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2322
2326
|
return {
|
|
2323
2327
|
...e,
|
|
2324
2328
|
priceRange: {
|
|
2325
|
-
min: t.min - n *
|
|
2326
|
-
max: t.max + n *
|
|
2329
|
+
min: t.min - n * Lr,
|
|
2330
|
+
max: t.max + n * Lr
|
|
2327
2331
|
},
|
|
2328
2332
|
logScale: !1,
|
|
2329
2333
|
scaleMode: "regular",
|
|
@@ -2404,7 +2408,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2404
2408
|
}
|
|
2405
2409
|
static indicators() {
|
|
2406
2410
|
let e = new ze();
|
|
2407
|
-
return
|
|
2411
|
+
return zt(e), e.getAvailableIndicators();
|
|
2408
2412
|
}
|
|
2409
2413
|
setPanelPosition(e, t) {
|
|
2410
2414
|
this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
|
|
@@ -2427,7 +2431,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2427
2431
|
paneMoveHost(e, t) {
|
|
2428
2432
|
let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
|
|
2429
2433
|
if (!n || !r) return;
|
|
2430
|
-
let i =
|
|
2434
|
+
let i = N(r);
|
|
2431
2435
|
if (r.placement === "overlay" && i && x(n.params[i])) return;
|
|
2432
2436
|
if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
|
|
2433
2437
|
if (t === "new") {
|
|
@@ -2557,7 +2561,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2557
2561
|
}), n;
|
|
2558
2562
|
}
|
|
2559
2563
|
isTimeAligned() {
|
|
2560
|
-
return
|
|
2564
|
+
return R(this.options.chartType) ? !1 : this.getDisplayData().length === this.series.length();
|
|
2561
2565
|
}
|
|
2562
2566
|
roundPrice(e) {
|
|
2563
2567
|
if (!Number.isFinite(e)) return e;
|
|
@@ -2646,7 +2650,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2646
2650
|
}
|
|
2647
2651
|
autoFib() {
|
|
2648
2652
|
if (!this.features.drawings) return null;
|
|
2649
|
-
let e = this.getDisplayData(), t = this.viewport.getState(), n =
|
|
2653
|
+
let e = this.getDisplayData(), t = this.viewport.getState(), n = Ot(e, t.visibleRange.from, t.visibleRange.to);
|
|
2650
2654
|
return n ? this.addDrawing({
|
|
2651
2655
|
type: "fibRetracement",
|
|
2652
2656
|
anchors: [n[0], n[1]]
|
|
@@ -2724,7 +2728,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2724
2728
|
recordUndo(e) {
|
|
2725
2729
|
if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
|
|
2726
2730
|
let t = performance.now(), n = this.undoRedoManager.last();
|
|
2727
|
-
if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at <
|
|
2731
|
+
if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < zr) {
|
|
2728
2732
|
this.undoRedoManager.replaceLast({
|
|
2729
2733
|
...n,
|
|
2730
2734
|
custom: {
|
|
@@ -2771,7 +2775,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2771
2775
|
x: t.x,
|
|
2772
2776
|
y: t.y
|
|
2773
2777
|
};
|
|
2774
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
2778
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = Jt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = I(t.x, n)), e === "pane") {
|
|
2775
2779
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
2776
2780
|
e && (r.pane = e.instanceId);
|
|
2777
2781
|
}
|
|
@@ -2797,7 +2801,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2797
2801
|
...this.viewport.getState(),
|
|
2798
2802
|
data: this.getDisplayData()
|
|
2799
2803
|
};
|
|
2800
|
-
this.setVisibleRange(
|
|
2804
|
+
this.setVisibleRange(I(e.x0, t), I(e.x1, t));
|
|
2801
2805
|
}
|
|
2802
2806
|
lockAllDrawings() {
|
|
2803
2807
|
this.drawingManager.lockAllDrawings();
|
|
@@ -2842,7 +2846,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
2842
2846
|
for (let e of this.indicatorEngine.getActiveIndicators()) {
|
|
2843
2847
|
let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
|
|
2844
2848
|
if (!t) continue;
|
|
2845
|
-
let r =
|
|
2849
|
+
let r = cn(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
|
|
2846
2850
|
key: e,
|
|
2847
2851
|
title: e
|
|
2848
2852
|
}));
|
|
@@ -3025,6 +3029,8 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3025
3029
|
kind: "bars",
|
|
3026
3030
|
length: e
|
|
3027
3031
|
});
|
|
3032
|
+
let t = this.crosshairHandler.getSyncedSlot();
|
|
3033
|
+
t !== null && this.showSyncedBar(t);
|
|
3028
3034
|
}
|
|
3029
3035
|
followLivePrice(e) {
|
|
3030
3036
|
this.replayTrades() || this.tradingManager.setCurrentPrice(e), this.features.alerts && this.checkAlerts(e);
|
|
@@ -3050,12 +3056,12 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3050
3056
|
this.features.trading && this.tradingManager.setConfig(e);
|
|
3051
3057
|
}
|
|
3052
3058
|
async connect(e) {
|
|
3053
|
-
if (!
|
|
3059
|
+
if (!M(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
|
|
3054
3060
|
this.snapshotKey = null, this.holdReplayFor(e.symbol), this.disconnectStream(), this.streamManager = new mt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (t) => {
|
|
3055
3061
|
let n = this.streamSeriesKey(e.adapter);
|
|
3056
3062
|
n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(t) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(t) : (this.replaySession && this.useStreamHistory(e.adapter, e.historyPageSize, !1), this.setData(t)), this.snapshotKey = n, this.useStreamHistory(e.adapter, e.historyPageSize);
|
|
3057
3063
|
}), this.streamManager.on("barClose", (e) => {
|
|
3058
|
-
if (!
|
|
3064
|
+
if (!B(e)) return;
|
|
3059
3065
|
let t = this.series.placeStreamBar(e);
|
|
3060
3066
|
if (t.refiltered && (this.displayDataCache = null), t.to === "none") {
|
|
3061
3067
|
this.updateBar(e);
|
|
@@ -3067,7 +3073,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3067
3073
|
}), this.streamManager.on("barCorrection", (e) => {
|
|
3068
3074
|
this.updateBar(e);
|
|
3069
3075
|
}), this.streamManager.on("barUpdate", (e) => {
|
|
3070
|
-
if (!
|
|
3076
|
+
if (!B(e)) return;
|
|
3071
3077
|
let t = this.series.placeStreamBar(e);
|
|
3072
3078
|
if (t.refiltered && (this.displayDataCache = null), t.to === "none" || (this.replaySession || this.currentPriceLine.setPrice(e.close), this.replaySession)) return;
|
|
3073
3079
|
let n = t.before;
|
|
@@ -3113,7 +3119,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3113
3119
|
}, 1e3);
|
|
3114
3120
|
}
|
|
3115
3121
|
streamSeriesKey(e) {
|
|
3116
|
-
let t =
|
|
3122
|
+
let t = F(e), n = this.streamTimeframe, r = t instanceof at && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3117
3123
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3118
3124
|
}
|
|
3119
3125
|
setStreamTarget(e, t) {
|
|
@@ -3136,7 +3142,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3136
3142
|
async switchStream(e, t) {
|
|
3137
3143
|
if (!this.streamManager) return;
|
|
3138
3144
|
let n = this.streamAdapter;
|
|
3139
|
-
if (n && !
|
|
3145
|
+
if (n && !M(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
3140
3146
|
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(T(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
|
|
3141
3147
|
}
|
|
3142
3148
|
isIndicatorAllowed(e) {
|
|
@@ -3156,7 +3162,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3156
3162
|
}
|
|
3157
3163
|
connectExecution(e, t = {}) {
|
|
3158
3164
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3159
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3165
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = pr(e, {
|
|
3160
3166
|
onIntent: (e, t) => {
|
|
3161
3167
|
let n = (e) => t(e.payload);
|
|
3162
3168
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -3289,18 +3295,18 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3289
3295
|
goToTime(e) {
|
|
3290
3296
|
let t = this.getDisplayData();
|
|
3291
3297
|
if (t.length === 0 || !Number.isFinite(e)) return -1;
|
|
3292
|
-
let n = Math.max(0, Math.min(t.length - 1, Math.floor(
|
|
3298
|
+
let n = Math.max(0, Math.min(t.length - 1, Math.floor(P(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
|
|
3293
3299
|
return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
|
|
3294
3300
|
}
|
|
3295
3301
|
setVisibleRangePreset(e) {
|
|
3296
3302
|
let t = this.getDisplayData();
|
|
3297
3303
|
if (t.length === 0) return;
|
|
3298
|
-
let n = t.length - 1, r = u(t), i =
|
|
3304
|
+
let n = t.length - 1, r = u(t), i = It(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
3299
3305
|
if (a === null || a < t[0].time) {
|
|
3300
3306
|
this.fitContent();
|
|
3301
3307
|
return;
|
|
3302
3308
|
}
|
|
3303
|
-
let o =
|
|
3309
|
+
let o = P(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
|
|
3304
3310
|
this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
|
|
3305
3311
|
}
|
|
3306
3312
|
scrollToEnd() {
|
|
@@ -3325,7 +3331,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3325
3331
|
setVisibleRange(e, t) {
|
|
3326
3332
|
let n = this.getDisplayData();
|
|
3327
3333
|
if (n.length === 0) return;
|
|
3328
|
-
let r =
|
|
3334
|
+
let r = P(Math.min(e, t), n), i = P(Math.max(e, t), n);
|
|
3329
3335
|
this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
|
|
3330
3336
|
}
|
|
3331
3337
|
suspend() {
|
|
@@ -3483,8 +3489,23 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3483
3489
|
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
|
|
3484
3490
|
}
|
|
3485
3491
|
setCrosshairTime(e) {
|
|
3486
|
-
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(
|
|
3487
|
-
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
|
|
3492
|
+
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(P(e, t));
|
|
3493
|
+
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.showSyncedBar(n), this.engine.requestRender(r.Hover));
|
|
3494
|
+
}
|
|
3495
|
+
showSyncedBar(e) {
|
|
3496
|
+
if (e === null) {
|
|
3497
|
+
this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairSync", { barIndex: null });
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
let t = this.crosshairSeries(), n = e >= 0 && e < t.length ? t[e] : void 0, r = n && e > 0 ? t[e - 1] : void 0;
|
|
3501
|
+
this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(n ?? null, r ?? null);
|
|
3502
|
+
let i = n ? j(t)[e]?.time ?? n.time : void 0;
|
|
3503
|
+
this.eventBus.emit("crosshairSync", {
|
|
3504
|
+
barIndex: e,
|
|
3505
|
+
...n ? { bar: n } : {},
|
|
3506
|
+
...i === void 0 ? {} : { time: i },
|
|
3507
|
+
...r ? { prevClose: r.close } : {}
|
|
3508
|
+
});
|
|
3488
3509
|
}
|
|
3489
3510
|
getData() {
|
|
3490
3511
|
return this.series.bars();
|
|
@@ -3557,7 +3578,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3557
3578
|
return this.periodLevels.getPeriod();
|
|
3558
3579
|
}
|
|
3559
3580
|
setTimeZone(e) {
|
|
3560
|
-
|
|
3581
|
+
Fr(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
3561
3582
|
}
|
|
3562
3583
|
getTimeZone() {
|
|
3563
3584
|
return this.timeZoneSetting;
|
|
@@ -3622,7 +3643,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3622
3643
|
}
|
|
3623
3644
|
useSymbolInfo(e) {
|
|
3624
3645
|
let t = e && this.symbolInfo?.symbol === e.symbol ? w(this.symbolInfo) : void 0;
|
|
3625
|
-
this.symbolInfo = e ?
|
|
3646
|
+
this.symbolInfo = e ? Ir({
|
|
3626
3647
|
...e,
|
|
3627
3648
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
3628
3649
|
}, t) : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(r.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
@@ -3647,7 +3668,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3647
3668
|
if (!e || typeof e != "object") return;
|
|
3648
3669
|
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
3649
3670
|
if (!n(e.symbol)) return;
|
|
3650
|
-
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i =
|
|
3671
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = Ir({
|
|
3651
3672
|
...r,
|
|
3652
3673
|
...e,
|
|
3653
3674
|
symbol: e.symbol || r?.symbol || t
|
|
@@ -3655,7 +3676,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3655
3676
|
r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
|
|
3656
3677
|
}
|
|
3657
3678
|
resolveStreamSymbol(e, t) {
|
|
3658
|
-
let n =
|
|
3679
|
+
let n = F(e), r = n.resolveSymbol?.bind(n);
|
|
3659
3680
|
if (this.symbolInfo && this.symbolInfo.symbol !== t ? (r ? this.holdStudyZone() : this.studyZoneHeld = !1, this.useSymbolInfo(null)) : r && this.studyZoneHeld && this.holdStudyZone(), !r) {
|
|
3660
3681
|
this.releaseStudyZone();
|
|
3661
3682
|
return;
|
|
@@ -3686,7 +3707,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3686
3707
|
return this.sessionShading.isVisible();
|
|
3687
3708
|
}
|
|
3688
3709
|
setSessionShadingConfig(e) {
|
|
3689
|
-
this.hostSessionHours =
|
|
3710
|
+
this.hostSessionHours = Nt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
|
|
3690
3711
|
}
|
|
3691
3712
|
setTooltipVisible(e) {
|
|
3692
3713
|
e || this.crosshairTooltip.hide();
|
|
@@ -3708,11 +3729,11 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3708
3729
|
return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
|
|
3709
3730
|
}
|
|
3710
3731
|
async takeGpu(e, t, n) {
|
|
3711
|
-
let { gpu: r, reason: i } = await
|
|
3712
|
-
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ?
|
|
3732
|
+
let { gpu: r, reason: i } = await Mt(e);
|
|
3733
|
+
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? kt() > 0 ? this.takeGpu(e, t, n) : (this.waitForGpu(() => void this.takeGpu(e, t, !1)), n && this.applyRenderer(null, "limit"), this.getRenderer()) : ((r || n) && this.applyRenderer(r, i), this.getRenderer());
|
|
3713
3734
|
}
|
|
3714
3735
|
waitForGpu(e) {
|
|
3715
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
3736
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Kt(e) : null;
|
|
3716
3737
|
}
|
|
3717
3738
|
getRenderer() {
|
|
3718
3739
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -3890,12 +3911,12 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3890
3911
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
3891
3912
|
if (!this.replaySession) {
|
|
3892
3913
|
if (this.series.length() === 0) return;
|
|
3893
|
-
this.series.beginReplay(), this.replaySession =
|
|
3914
|
+
this.series.beginReplay(), this.replaySession = ii(this.currentSymbol);
|
|
3894
3915
|
}
|
|
3895
3916
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
3896
3917
|
c.animate = c.animate === !0;
|
|
3897
3918
|
let l = this.series.inHoursShown(this.series.liveBars()), u = t > 0 && i === void 0 && a !== !1, d = c.startIndex;
|
|
3898
|
-
i !== void 0 && d === void 0 ? d =
|
|
3919
|
+
i !== void 0 && d === void 0 ? d = Z(l, i) : u && d !== void 0 && (d += t);
|
|
3899
3920
|
let f = u ? t : a && d !== void 0 && d > 0 ? Math.min(Math.floor(d), l.length - 1) : 0, p = f > 0 ? l.slice(f) : l;
|
|
3900
3921
|
d !== void 0 && (c.startIndex = d - f), n.windowTime = f > 0 ? p[0]?.time ?? null : null, n.steps = r ?? null, n.stepsSymbol = this.currentSymbol, n.until = null, n.animate = c.animate, n.step = c.animate ? s ?? null : null, this.replayRevealMarks = o !== !1, this.useReplayLoader(n, !0);
|
|
3901
3922
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
@@ -3945,7 +3966,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3945
3966
|
});
|
|
3946
3967
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
3947
3968
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
3948
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = yi() ?
|
|
3969
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = yi() ? Or(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = Dr(r, i);
|
|
3949
3970
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
3950
3971
|
index: t,
|
|
3951
3972
|
path: r
|
|
@@ -3955,7 +3976,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3955
3976
|
drawFormingBar(e, t, n, r) {
|
|
3956
3977
|
this.currentPriceLine.setPrice(e.close, t);
|
|
3957
3978
|
let i = this.series.bars();
|
|
3958
|
-
if (this.recalcIndicatorsFrom(i, i.length - 1), (n || !
|
|
3979
|
+
if (this.recalcIndicatorsFrom(i, i.length - 1), (n || !ei.has(this.options.chartType)) && (this.displayDataCache = null), !n) {
|
|
3959
3980
|
this.scheduleRender();
|
|
3960
3981
|
return;
|
|
3961
3982
|
}
|
|
@@ -3963,19 +3984,19 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3963
3984
|
}
|
|
3964
3985
|
replayPathOf(e, t) {
|
|
3965
3986
|
let n = e[t];
|
|
3966
|
-
return
|
|
3987
|
+
return Sr(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
3967
3988
|
}
|
|
3968
3989
|
loadReplaySteps(e, t) {
|
|
3969
3990
|
let n = this.replayLoader?.loader;
|
|
3970
3991
|
if (!n) return;
|
|
3971
3992
|
n.evictBefore(e[t].time);
|
|
3972
3993
|
let r = this.replayManager.getStepMs();
|
|
3973
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
3994
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil($r / r) : 1);
|
|
3974
3995
|
}
|
|
3975
3996
|
useReplayLoader(e, t) {
|
|
3976
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
3997
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? jr(e.step, r, (e) => M(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
3977
3998
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
3978
|
-
let o =
|
|
3999
|
+
let o = F(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = T(r), u = new hr({
|
|
3979
4000
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
3980
4001
|
step: i,
|
|
3981
4002
|
ratio: Math.max(1, Math.round(l / T(i))),
|
|
@@ -3993,18 +4014,18 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
3993
4014
|
if (!i || !a?.setMarkPrice || !o) return;
|
|
3994
4015
|
let s = i.fedTime;
|
|
3995
4016
|
if (s === null) {
|
|
3996
|
-
i.fedTime = o.time, i.fedFraction = r, this.feedReplayPrice(
|
|
4017
|
+
i.fedTime = o.time, i.fedFraction = r, this.feedReplayPrice(Dr(n, r).close, o.time);
|
|
3997
4018
|
return;
|
|
3998
4019
|
}
|
|
3999
4020
|
if (o.time < s || o.time === s && r <= i.fedFraction) return;
|
|
4000
4021
|
let c = [];
|
|
4001
4022
|
if (o.time > s) {
|
|
4002
|
-
let a =
|
|
4003
|
-
e[a]?.time === s && i.fedFraction < 1 && c.push(...
|
|
4004
|
-
let o = e.slice(
|
|
4005
|
-
for (let e = 0; e < o.length; e += l) c.push(...
|
|
4006
|
-
c.push(...
|
|
4007
|
-
} else c.push(...
|
|
4023
|
+
let a = Z(e, s);
|
|
4024
|
+
e[a]?.time === s && i.fedFraction < 1 && c.push(...Y(this.replayPathOf(e, a), i.fedFraction, 1));
|
|
4025
|
+
let o = e.slice(di(e, s), t), l = Math.ceil(o.length / ui);
|
|
4026
|
+
for (let e = 0; e < o.length; e += l) c.push(...fi(o.slice(e, e + l)));
|
|
4027
|
+
c.push(...Y(n, -1, r));
|
|
4028
|
+
} else c.push(...Y(n, i.fedFraction, r));
|
|
4008
4029
|
i.fedTime = o.time, i.fedFraction = r;
|
|
4009
4030
|
for (let [e, t] of c) a.setMarkPrice(e, t);
|
|
4010
4031
|
let l = c[c.length - 1]?.[0];
|
|
@@ -4019,9 +4040,9 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4019
4040
|
if (!t) return;
|
|
4020
4041
|
let n = this.series.inHoursShown(this.series.liveBars());
|
|
4021
4042
|
if (n.length === 0) return;
|
|
4022
|
-
let r = t.windowTime === null ? 0 : Math.min(
|
|
4043
|
+
let r = t.windowTime === null ? 0 : Math.min(Z(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4023
4044
|
this.useReplayLoader(t, !1);
|
|
4024
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4045
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : si(o ?? i, t.until);
|
|
4025
4046
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4026
4047
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4027
4048
|
return;
|
|
@@ -4029,7 +4050,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4029
4050
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4030
4051
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4031
4052
|
let d = this.replayManager.remainingMs();
|
|
4032
|
-
this.clearBarHolders(), t.animate &&
|
|
4053
|
+
this.clearBarHolders(), t.animate && oi(t, this.replayCoarse, i);
|
|
4033
4054
|
let f = this.replayRestarting;
|
|
4034
4055
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4035
4056
|
try {
|
|
@@ -4053,13 +4074,13 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4053
4074
|
replayStepsOver(e, t, n = !1) {
|
|
4054
4075
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4055
4076
|
let r = mi(this.series.inHoursShown(e.steps), t);
|
|
4056
|
-
return r && (n ||
|
|
4077
|
+
return r && (n || li(r, t)) ? r : null;
|
|
4057
4078
|
}
|
|
4058
4079
|
canPageBackForReplay(e) {
|
|
4059
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4080
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < ti;
|
|
4060
4081
|
}
|
|
4061
4082
|
async pageBackForReplay(e) {
|
|
4062
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4083
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = ti, this.rebaseReplay("older"));
|
|
4063
4084
|
}
|
|
4064
4085
|
holdReplay() {
|
|
4065
4086
|
let e = this.replaySession;
|
|
@@ -4092,7 +4113,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4092
4113
|
this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4093
4114
|
}
|
|
4094
4115
|
replaySeekToTime(e) {
|
|
4095
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4116
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, si(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4096
4117
|
}
|
|
4097
4118
|
feedReplayPrice(e, t) {
|
|
4098
4119
|
let n = this.executionAdapter;
|
|
@@ -4112,10 +4133,10 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4112
4133
|
return;
|
|
4113
4134
|
}
|
|
4114
4135
|
if (i.time <= n.fedTime) return;
|
|
4115
|
-
let a = e.slice(
|
|
4136
|
+
let a = e.slice(di(e, n.fedTime), t + 1);
|
|
4116
4137
|
n.fedTime = i.time;
|
|
4117
|
-
let o = Math.ceil(a.length /
|
|
4118
|
-
for (let e = 0; e < a.length; e += o) for (let [t, n] of
|
|
4138
|
+
let o = Math.ceil(a.length / ui);
|
|
4139
|
+
for (let e = 0; e < a.length; e += o) for (let [t, n] of fi(a.slice(e, e + o))) r.setMarkPrice(t, n);
|
|
4119
4140
|
this.tradingManager.setCurrentPrice(i.close);
|
|
4120
4141
|
}
|
|
4121
4142
|
getReplayBarIndex() {
|
|
@@ -4162,10 +4183,10 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4162
4183
|
data: this.getDisplayData()
|
|
4163
4184
|
}, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
4164
4185
|
for (let e of t.anchors) {
|
|
4165
|
-
let t =
|
|
4186
|
+
let t = Bt(e.time, n), r = Ft(e.price, n);
|
|
4166
4187
|
i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
|
|
4167
4188
|
}
|
|
4168
|
-
return
|
|
4189
|
+
return Hr.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Ur.has(t.type) && ([o, s] = [r.y, r.y + r.height]), i = Math.max(i, r.x), a = Math.min(a, r.x + r.width), o = Math.max(o, r.y), s = Math.min(s, r.y + r.height), i <= a && o <= s ? {
|
|
4169
4190
|
x: i,
|
|
4170
4191
|
y: o,
|
|
4171
4192
|
width: a - i,
|
|
@@ -4214,14 +4235,14 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4214
4235
|
});
|
|
4215
4236
|
}
|
|
4216
4237
|
restoreIndicators(e, t) {
|
|
4217
|
-
let n =
|
|
4238
|
+
let n = Gr(e), r = /* @__PURE__ */ new Map();
|
|
4218
4239
|
this.unrestoredIndicators = [];
|
|
4219
4240
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4220
4241
|
if (t) {
|
|
4221
4242
|
let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
|
|
4222
4243
|
for (let n of t) {
|
|
4223
4244
|
let t = e.get(n.instanceId);
|
|
4224
|
-
t &&
|
|
4245
|
+
t && Kr(n, t) && o.add(n.instanceId);
|
|
4225
4246
|
}
|
|
4226
4247
|
for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
|
|
4227
4248
|
for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
|
|
@@ -4388,7 +4409,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4388
4409
|
if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
|
|
4389
4410
|
let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
|
|
4390
4411
|
if (JSON.stringify(n) === JSON.stringify(i)) return r;
|
|
4391
|
-
let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) <
|
|
4412
|
+
let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < zr && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
|
|
4392
4413
|
type: "indicators",
|
|
4393
4414
|
before: null,
|
|
4394
4415
|
after: null
|
|
@@ -4432,7 +4453,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4432
4453
|
let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
|
|
4433
4454
|
return r ? r + e.slice(t) : e;
|
|
4434
4455
|
}, r = t(e.channel), i = {
|
|
4435
|
-
...
|
|
4456
|
+
...Lt(e),
|
|
4436
4457
|
...e.target ? { target: t(e.target) } : {}
|
|
4437
4458
|
};
|
|
4438
4459
|
if (!e.expired) {
|
|
@@ -4524,14 +4545,14 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4524
4545
|
this.disposed = !0, this.stopWatchingVisibility?.(), this.stopWatchingVisibility = null, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.labelWidths.destroy(), this.container.innerHTML = "";
|
|
4525
4546
|
}
|
|
4526
4547
|
createChartRenderer(e) {
|
|
4527
|
-
let t =
|
|
4548
|
+
let t = Dn(e, (e) => this.pluginManager.getChartType(e));
|
|
4528
4549
|
return t instanceof Le && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
4529
4550
|
}
|
|
4530
4551
|
crosshairSeries() {
|
|
4531
4552
|
return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
|
|
4532
4553
|
}
|
|
4533
4554
|
getDisplayData() {
|
|
4534
|
-
let e = this.series.bars(), t = this.options.chartType === "rangeBars" ?
|
|
4555
|
+
let e = this.series.bars(), t = this.options.chartType === "rangeBars" ? wn(e, (e) => this.stepAt(e)) : void 0;
|
|
4535
4556
|
if (this.displayDataCache && t === this.displayDataStep) return this.displayDataCache;
|
|
4536
4557
|
if (e.length === 0) return e;
|
|
4537
4558
|
let n = this.displaySeries(e, t);
|
|
@@ -4539,8 +4560,8 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4539
4560
|
}
|
|
4540
4561
|
displaySeries(e, t) {
|
|
4541
4562
|
let n = this.options.chartType, r = (e) => this.pluginManager.getChartType(e);
|
|
4542
|
-
if (n !== "pointAndFigure" || r(n)) return
|
|
4543
|
-
let { columns: i, boxSize: a } =
|
|
4563
|
+
if (n !== "pointAndFigure" || r(n)) return On(n, e, r, this.chartTypeOptions, t, this.reshapeMemo);
|
|
4564
|
+
let { columns: i, boxSize: a } = fn(e, this.chartTypeOptions, this.reshapeMemo);
|
|
4544
4565
|
return this.chartRenderer instanceof Qe && this.chartRenderer.setBoxSize(a), i;
|
|
4545
4566
|
}
|
|
4546
4567
|
recalcIndicatorsFrom(e, t) {
|
|
@@ -4553,7 +4574,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4553
4574
|
}
|
|
4554
4575
|
exportBars() {
|
|
4555
4576
|
if (this.isTimeAligned()) return this.series.bars();
|
|
4556
|
-
let e = this.getDisplayData(), t =
|
|
4577
|
+
let e = this.getDisplayData(), t = j(e);
|
|
4557
4578
|
return e.map((e, n) => ({
|
|
4558
4579
|
...e,
|
|
4559
4580
|
time: t[n]?.time ?? e.time
|
|
@@ -4612,7 +4633,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4612
4633
|
}
|
|
4613
4634
|
fitPriceScale(e, t) {
|
|
4614
4635
|
if (e.length === 0) return;
|
|
4615
|
-
let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i =
|
|
4636
|
+
let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i = Qr(Qr(m(e, n, r, 0), this.indicatorEngine.getOverlayPriceRange(n, r)), this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null), a = this.features.volume && this.volumeRenderer.isVisible() && Zr(e, n, r) ? this.volumeRenderer.getHeightRatio() + Rr : O;
|
|
4616
4637
|
this.viewport.setScaleMargins(this.viewport.isInvertScale() ? {
|
|
4617
4638
|
top: a,
|
|
4618
4639
|
bottom: O
|
|
@@ -4639,7 +4660,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4639
4660
|
fitLeftAxisWidth() {
|
|
4640
4661
|
let e = this.leftViewport;
|
|
4641
4662
|
if (!e) return !1;
|
|
4642
|
-
let t = this.themeManager.getTheme(), n =
|
|
4663
|
+
let t = this.themeManager.getTheme(), n = $n({
|
|
4643
4664
|
min: e.priceRange.min,
|
|
4644
4665
|
max: e.priceRange.max,
|
|
4645
4666
|
lastPrice: null,
|
|
@@ -4648,12 +4669,12 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4648
4669
|
fontFamily: t.font.family,
|
|
4649
4670
|
fontSizeSmall: t.font.sizeSmall,
|
|
4650
4671
|
measure: (e, t) => this.measureText(e, t)
|
|
4651
|
-
}), r =
|
|
4672
|
+
}), r = er(this.leftAxisWidth, n);
|
|
4652
4673
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
4653
4674
|
}
|
|
4654
4675
|
fitPriceAxisWidth() {
|
|
4655
4676
|
if (!this.features.priceAxis) return !1;
|
|
4656
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
4677
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = $n({
|
|
4657
4678
|
min: e.min,
|
|
4658
4679
|
max: e.max,
|
|
4659
4680
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -4664,14 +4685,14 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4664
4685
|
fontFamily: t.font.family,
|
|
4665
4686
|
fontSizeSmall: t.font.sizeSmall,
|
|
4666
4687
|
measure: (e, t) => this.measureText(e, t)
|
|
4667
|
-
}), r =
|
|
4688
|
+
}), r = er(this.priceAxisWidth, n);
|
|
4668
4689
|
return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
4669
4690
|
}
|
|
4670
4691
|
measureText(e, t) {
|
|
4671
4692
|
let n = this.engine.layerManager.getLayer(r.Main)?.ctx;
|
|
4672
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
4693
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => qr(n, e, t));
|
|
4673
4694
|
let i = n ?? this.detachedMeasureContext();
|
|
4674
|
-
return i ?
|
|
4695
|
+
return i ? qr(i, e, t) : e.length * 7;
|
|
4675
4696
|
}
|
|
4676
4697
|
detachedMeasureContext() {
|
|
4677
4698
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -4712,7 +4733,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4712
4733
|
buildPanelRenderInfos() {
|
|
4713
4734
|
if (this.panelInfoCache) return this.panelInfoCache;
|
|
4714
4735
|
let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
|
|
4715
|
-
let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...
|
|
4736
|
+
let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...Mr }, o = {
|
|
4716
4737
|
x: e.rect.x,
|
|
4717
4738
|
y: e.rect.y + 20,
|
|
4718
4739
|
width: e.rect.width,
|
|
@@ -4796,7 +4817,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4796
4817
|
});
|
|
4797
4818
|
}
|
|
4798
4819
|
drawOverlayPlugins(e, t) {
|
|
4799
|
-
let n =
|
|
4820
|
+
let n = ar(this.pluginManager.getOverlays(), t);
|
|
4800
4821
|
if (n.length === 0) return;
|
|
4801
4822
|
let r = {
|
|
4802
4823
|
viewport: this.viewport.getState(),
|
|
@@ -4817,7 +4838,7 @@ var zr = .08, Br = a ** -7, Vr = 800, Hr = 20, Ur = 8, Wr = new Set(["horizontal
|
|
|
4817
4838
|
};
|
|
4818
4839
|
}
|
|
4819
4840
|
};
|
|
4820
|
-
function
|
|
4841
|
+
function Gr(e) {
|
|
4821
4842
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
4822
4843
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
4823
4844
|
i.add(e.instanceId);
|
|
@@ -4831,19 +4852,19 @@ function qr(e) {
|
|
|
4831
4852
|
for (let t of e) a(t);
|
|
4832
4853
|
return n;
|
|
4833
4854
|
}
|
|
4834
|
-
function
|
|
4855
|
+
function Kr(e, t) {
|
|
4835
4856
|
return e.id === t.id && (e.pane ?? null) === (t.pane ?? null) && (e.scale ?? null) === (t.scale ?? null) && e.position === void 0 == (t.position === void 0);
|
|
4836
4857
|
}
|
|
4837
|
-
function
|
|
4858
|
+
function qr(e, t, n) {
|
|
4838
4859
|
let r = e.font;
|
|
4839
4860
|
e.font = n;
|
|
4840
4861
|
let i = e.measureText(t).width;
|
|
4841
4862
|
return e.font = r, i;
|
|
4842
4863
|
}
|
|
4843
|
-
var
|
|
4844
|
-
function
|
|
4864
|
+
var Jr = 300;
|
|
4865
|
+
function Yr(e) {
|
|
4845
4866
|
let t = {}, n = e.family;
|
|
4846
|
-
typeof n == "string" && n.trim() !== "" && n.length <=
|
|
4867
|
+
typeof n == "string" && n.trim() !== "" && n.length <= Jr && !/[;{}<>\\]|\/\*/.test(n) && (t.family = n);
|
|
4847
4868
|
for (let n of [
|
|
4848
4869
|
"sizeSmall",
|
|
4849
4870
|
"sizeMedium",
|
|
@@ -4854,21 +4875,21 @@ function Zr(e) {
|
|
|
4854
4875
|
}
|
|
4855
4876
|
return t;
|
|
4856
4877
|
}
|
|
4857
|
-
function
|
|
4878
|
+
function Xr(e) {
|
|
4858
4879
|
let t = e.tagRadius;
|
|
4859
4880
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
4860
4881
|
}
|
|
4861
|
-
function
|
|
4882
|
+
function Zr(e, t, n) {
|
|
4862
4883
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
4863
4884
|
return !1;
|
|
4864
4885
|
}
|
|
4865
|
-
function
|
|
4886
|
+
function Qr(e, t) {
|
|
4866
4887
|
return e ? t ? {
|
|
4867
4888
|
min: Math.min(e.min, t.min),
|
|
4868
4889
|
max: Math.max(e.max, t.max)
|
|
4869
4890
|
} : e : t;
|
|
4870
4891
|
}
|
|
4871
|
-
function
|
|
4892
|
+
function X(e) {
|
|
4872
4893
|
return {
|
|
4873
4894
|
id: e.id,
|
|
4874
4895
|
price: e.price,
|
|
@@ -4883,14 +4904,14 @@ function J(e) {
|
|
|
4883
4904
|
bars: e.bars
|
|
4884
4905
|
};
|
|
4885
4906
|
}
|
|
4886
|
-
var
|
|
4907
|
+
var $r = 8e3, ei = new Set([
|
|
4887
4908
|
"candlestick",
|
|
4888
4909
|
"line",
|
|
4889
4910
|
"area",
|
|
4890
4911
|
"bar",
|
|
4891
4912
|
"hollowCandle"
|
|
4892
|
-
]),
|
|
4893
|
-
function
|
|
4913
|
+
]), ti = 10, ni = 50, ri = .001;
|
|
4914
|
+
function ii(e) {
|
|
4894
4915
|
return {
|
|
4895
4916
|
price: null,
|
|
4896
4917
|
fedTime: null,
|
|
@@ -4905,42 +4926,42 @@ function oi(e) {
|
|
|
4905
4926
|
held: null
|
|
4906
4927
|
};
|
|
4907
4928
|
}
|
|
4908
|
-
function
|
|
4929
|
+
function ai(e, t) {
|
|
4909
4930
|
let n = e[t + 1];
|
|
4910
|
-
return n ? n.time - e[t].time :
|
|
4931
|
+
return n ? n.time - e[t].time : pi(e);
|
|
4911
4932
|
}
|
|
4912
|
-
function
|
|
4933
|
+
function oi(e, t, n) {
|
|
4913
4934
|
let r = e.fedTime;
|
|
4914
4935
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
4915
|
-
let i =
|
|
4936
|
+
let i = ai(t, Q(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Q(n, a), s = n[o].time;
|
|
4916
4937
|
if (s > a) return;
|
|
4917
|
-
let c =
|
|
4938
|
+
let c = ai(n, o);
|
|
4918
4939
|
if (a === s && o > 0) {
|
|
4919
4940
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
4920
4941
|
return;
|
|
4921
4942
|
}
|
|
4922
4943
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
4923
4944
|
}
|
|
4924
|
-
function
|
|
4925
|
-
let n =
|
|
4926
|
-
return n > r && r >= 0 && e[r].time +
|
|
4945
|
+
function si(e, t) {
|
|
4946
|
+
let n = di(e, t), r = e.length - 1;
|
|
4947
|
+
return n > r && r >= 0 && e[r].time + pi(e) <= t ? r : Math.max(-1, n - 2);
|
|
4927
4948
|
}
|
|
4928
|
-
function
|
|
4949
|
+
function ci(e) {
|
|
4929
4950
|
let t = Infinity;
|
|
4930
4951
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
4931
4952
|
return t;
|
|
4932
4953
|
}
|
|
4933
|
-
function
|
|
4934
|
-
if (!(
|
|
4935
|
-
let n = Math.max(0, e.length -
|
|
4954
|
+
function li(e, t) {
|
|
4955
|
+
if (!(ci(e) < ci(t))) return !1;
|
|
4956
|
+
let n = Math.max(0, e.length - ni);
|
|
4936
4957
|
for (let r = n; r < e.length; r++) {
|
|
4937
|
-
let n = t[Q(t, e[r].time)], i = (n.high - n.low) *
|
|
4958
|
+
let n = t[Q(t, e[r].time)], i = (n.high - n.low) * ri + 2 ** -52;
|
|
4938
4959
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
4939
4960
|
}
|
|
4940
4961
|
return !0;
|
|
4941
4962
|
}
|
|
4942
|
-
var
|
|
4943
|
-
function
|
|
4963
|
+
var ui = 500;
|
|
4964
|
+
function Z(e, t) {
|
|
4944
4965
|
let n = 0, r = e.length;
|
|
4945
4966
|
for (; n < r;) {
|
|
4946
4967
|
let i = n + r >> 1;
|
|
@@ -4948,7 +4969,7 @@ function Y(e, t) {
|
|
|
4948
4969
|
}
|
|
4949
4970
|
return n;
|
|
4950
4971
|
}
|
|
4951
|
-
function
|
|
4972
|
+
function di(e, t) {
|
|
4952
4973
|
let n = 0, r = e.length;
|
|
4953
4974
|
for (; n < r;) {
|
|
4954
4975
|
let i = n + r >> 1;
|
|
@@ -4956,20 +4977,20 @@ function X(e, t) {
|
|
|
4956
4977
|
}
|
|
4957
4978
|
return n;
|
|
4958
4979
|
}
|
|
4959
|
-
function
|
|
4980
|
+
function fi(e) {
|
|
4960
4981
|
let t = 0, n = 0;
|
|
4961
4982
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
4962
4983
|
let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
|
|
4963
4984
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
4964
4985
|
}
|
|
4965
|
-
function
|
|
4986
|
+
function pi(e) {
|
|
4966
4987
|
let t = 0;
|
|
4967
4988
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
4968
4989
|
return t > 0 ? t : Infinity;
|
|
4969
4990
|
}
|
|
4970
4991
|
function mi(e, t) {
|
|
4971
4992
|
if (t.length === 0) return null;
|
|
4972
|
-
let n = t[t.length - 1].time +
|
|
4993
|
+
let n = t[t.length - 1].time + pi(t), r = e.filter((e) => Fn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
4973
4994
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
4974
4995
|
if (i.length === 0) return null;
|
|
4975
4996
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5514,6 +5535,6 @@ var Yi = class {
|
|
|
5514
5535
|
}
|
|
5515
5536
|
};
|
|
5516
5537
|
//#endregion
|
|
5517
|
-
export {
|
|
5538
|
+
export { Bn as C, H as D, B as E, cn as O, Un as S, U as T, sr as _, Ui as a, q as b, Wr as c, Ar as d, jr as f, or as g, cr as h, Wi as i, Pr as l, lr as m, Gi as n, Li as o, ur as p, Ki as r, Di as s, Yi as t, Nr as u, ir as v, Rn as w, Jn as x, ar as y };
|
|
5518
5539
|
|
|
5519
|
-
//# sourceMappingURL=LayoutSession-
|
|
5540
|
+
//# sourceMappingURL=LayoutSession-C5aHWgk7.js.map
|