@tradecanvas/chart 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chart.d.ts +11 -0
- package/dist/Chart.d.ts.map +1 -1
- package/dist/{LayoutSession-CO51QKwZ.js → LayoutSession-BJLUwx9d.js} +436 -424
- package/dist/LayoutSession-BJLUwx9d.js.map +1 -0
- package/dist/{LayoutSession-DIPjmNVe.cjs → LayoutSession-DiKwrEV8.cjs} +2 -2
- package/dist/LayoutSession-DiKwrEV8.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/widget/index.cjs +1 -1
- package/dist/widget/index.js +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-CO51QKwZ.js.map +0 -1
- package/dist/LayoutSession-DIPjmNVe.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./indicatorLabel-BsidWCv1.js";
|
|
2
2
|
import { CHART_SPACING as t, DARK_THEME as n, DEFAULT_CHART_DENSITY as r, DEFAULT_PANEL_HEIGHT as i, LIGHT_THEME as a, LayerType as o, MIN_PANEL_HEIGHT as s, PRICE_AXIS_WIDTH as c, TIME_AXIS_HEIGHT as l, autoPricePrecision as u, barDateZone as d, barTimeUnit as f, barsAreDaily as p, chartStyleValue as m, computePriceLimits as h, computePriceRange as g, createMarketTheme as _, formatPrice as v, fractionTick as y, indicatorSource as b, isValidTimeZone as x, mergeBar as ee, niceNumber as te, normalizeBarTime as S, parseIndicatorSource as C, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as w, readIndicatorPlotStyles as ae, readPaneStyle as oe, resolveChartTheme as se, sessionMinute as T, setLocale as ce, stepDecimals as le, symbolTimeZone as ue, tickBarCount as de, timeframeToMs as E, zonedDateFormatter as fe } from "@tradecanvas/commons";
|
|
3
|
-
import { AlertDragHandler as pe, AlertManager as me, Animator as he, AreaRenderer as ge, AxisDragHandler as _e, BarCountdown as ve, BarRenderer as ye, BaselineRenderer as be, CandlestickRenderer as xe, ChartLegend as Se, ChartMarkManager as Ce, ChartStateManager as D, CompareRenderer as we, CompareSymbolIndicator as Te, CompareSymbolPaneIndicator as Ee, CorrelationCoefficientIndicator as De, CorrelationLogIndicator as Oe, CrosshairHandler as ke, CrosshairTooltip as Ae, CurrentPriceLine as je, DEFAULT_SESSION_HOURS as Me, DataExporter as O, DepthHeatmapRenderer as Ne,
|
|
3
|
+
import { AlertDragHandler as pe, AlertManager as me, Animator as he, AreaRenderer as ge, AxisDragHandler as _e, BarCountdown as ve, BarRenderer as ye, BaselineRenderer as be, CandlestickRenderer as xe, ChartLegend as Se, ChartMarkManager as Ce, ChartStateManager as D, CompareRenderer as we, CompareSymbolIndicator as Te, CompareSymbolPaneIndicator as Ee, CorrelationCoefficientIndicator as De, CorrelationLogIndicator as Oe, CrosshairHandler as ke, CrosshairTooltip as Ae, CurrentPriceLine as je, DEFAULT_SESSION_HOURS as Me, DataExporter as O, DepthHeatmapRenderer as Ne, DepthOverlayLayer as Pe, DrawingManager as Fe, DrawingRenderer as Ie, EquivolumeRenderer as Le, EventBus as Re, GridRenderer as ze, HLCAreaRenderer as Be, HiLoRenderer as Ve, HollowCandleRenderer as He, INDICATOR_WORKER_MIN_BARS as Ue, IndicatorEngine as We, InteractionManager as Ge, KagiRenderer as Ke, KeyboardHandler as qe, LineRenderer as Je, LineWithMarkersRenderer as Ye, MarketProfileRenderer as Xe, MeasureOverlay as Ze, PRICE_AXIS_ADD_STRIP as Qe, PanHandler as $e, PaneResizeHandler as et, PeriodLevelsRenderer as tt, PinnedTooltip as nt, PivotMarkersRenderer as rt, PointAndFigureRenderer as it, PriceAxis as at, PriceAxisAddButton as ot, PriceLines as st, RenderEngine as ct, RenkoRenderer as lt, ReplayManager as ut, ResamplingAdapter as dt, ReshapeMemo as ft, SYMBOL_INDICATOR_IDS as pt, SYMBOL_ZONE_WAIT_MS as mt, Screenshot as k, SelectionBoxOverlay as ht, SessionBreaks as gt, SessionShading as _t, SignalMarkerManager as vt, SpreadIndicator as yt, StepLineRenderer as bt, StreamManager as xt, SymbolSeriesStore as St, TimeAxis as Ct, TradeZoneManager as wt, TradingManager as Tt, TradingRenderer as Et, UndoRedoManager as Dt, Viewport as Ot, VolumeCandleRenderer as kt, VolumeProfileRenderer as At, VolumeRenderer as jt, Watermark as Mt, ZoomHandler as Nt, axisTimes as A, barTimeStepMs as Pt, findDominantSwing as Ft, gpuContextsLeft as It, idleCssCursor as Lt, indicatorWorkerPool as Rt, isCrosshairCursor as zt, isPriceLevelAlert as Bt, isRegularSession as Vt, loadWebGL as Ht, mergeSessionHours as Ut, pointAndFigureColumns as Wt, rangePresetStart as Gt, readAlertOptions as Kt, registerBuiltInDrawingTools as qt, registerBuiltInIndicators as Jt, servesTimeframe as Yt, sourceParam as j, streamAdapterOf as Xt, timestampToBarIndex as M, toHeikinAshi as Zt, toKagi as Qt, toLineBreak as $t, toRangeBars as en, toRenko as tn, whenGpuContextFree as nn, withResampling as N, xToBarIndex as rn, xToTime as P, yToPrice as an } from "@tradecanvas/core";
|
|
4
4
|
//#region src/regularHours.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var on = 864e5, sn = 10;
|
|
6
|
+
function cn(e, t) {
|
|
7
7
|
let n = ue(e);
|
|
8
8
|
if (!n || !x(n) || t.length < 2) return null;
|
|
9
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
@@ -15,34 +15,34 @@ function sn(e, t) {
|
|
|
15
15
|
});
|
|
16
16
|
if (r.length === 0) return null;
|
|
17
17
|
let i = f(t), a = Infinity;
|
|
18
|
-
for (let e = Math.max(1, t.length -
|
|
18
|
+
for (let e = Math.max(1, t.length - sn); e < t.length; e++) {
|
|
19
19
|
let n = (t[e].time - t[e - 1].time) * i;
|
|
20
20
|
n > 0 && n < a && (a = n);
|
|
21
21
|
}
|
|
22
|
-
if (!(a <
|
|
22
|
+
if (!(a < on)) return null;
|
|
23
23
|
let o = {
|
|
24
24
|
timeZone: n,
|
|
25
25
|
windows: r,
|
|
26
26
|
startMinute: r[0].startMinute,
|
|
27
27
|
endMinute: r[r.length - 1].endMinute
|
|
28
28
|
};
|
|
29
|
-
return (e) =>
|
|
29
|
+
return (e) => Vt(e * i, o);
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/chartA11y.ts
|
|
33
|
-
var
|
|
33
|
+
var ln = {
|
|
34
34
|
role: "chart",
|
|
35
35
|
summary: "{what}. Last price {close}.",
|
|
36
36
|
empty: "Chart, no data.",
|
|
37
37
|
view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
|
|
38
38
|
bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
|
|
39
39
|
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."
|
|
40
|
-
}, F = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e),
|
|
40
|
+
}, F = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), un = [
|
|
41
41
|
"role",
|
|
42
42
|
"aria-roledescription",
|
|
43
43
|
"aria-label",
|
|
44
44
|
"aria-describedby"
|
|
45
|
-
],
|
|
45
|
+
], dn = 400, fn = 1e3, pn = class {
|
|
46
46
|
live;
|
|
47
47
|
help;
|
|
48
48
|
labels;
|
|
@@ -56,20 +56,20 @@ var cn = {
|
|
|
56
56
|
};
|
|
57
57
|
constructor(e, t, n = {}) {
|
|
58
58
|
this.container = e, this.source = t, this.labels = {
|
|
59
|
-
...
|
|
59
|
+
...ln,
|
|
60
60
|
...n
|
|
61
61
|
};
|
|
62
|
-
for (let t of
|
|
63
|
-
e.setAttribute("role", "application"), this.help =
|
|
62
|
+
for (let t of un) this.before.set(t, e.getAttribute(t));
|
|
63
|
+
e.setAttribute("role", "application"), this.help = mn("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 = mn("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();
|
|
64
64
|
}
|
|
65
65
|
setLabels(e) {
|
|
66
66
|
this.labels = {
|
|
67
|
-
...
|
|
67
|
+
...ln,
|
|
68
68
|
...e
|
|
69
69
|
}, this.applyLabels();
|
|
70
70
|
}
|
|
71
71
|
refresh(e = !1) {
|
|
72
|
-
let t =
|
|
72
|
+
let t = fn - (Date.now() - this.summaryAt);
|
|
73
73
|
if (e || t <= 0 || this.container.getAttribute("aria-label") === this.labels.empty) {
|
|
74
74
|
this.summaryTimer && clearTimeout(this.summaryTimer), this.summaryTimer = null, this.summaryAt = Date.now(), this.container.setAttribute("aria-label", this.summary());
|
|
75
75
|
return;
|
|
@@ -81,7 +81,7 @@ var cn = {
|
|
|
81
81
|
viewMoved() {
|
|
82
82
|
this.cursor = null, this.viewTimer && clearTimeout(this.viewTimer), this.viewTimer = setTimeout(() => {
|
|
83
83
|
this.viewTimer = null, this.say(this.viewText());
|
|
84
|
-
},
|
|
84
|
+
}, dn);
|
|
85
85
|
}
|
|
86
86
|
readBar(e) {
|
|
87
87
|
let t = this.source.bars();
|
|
@@ -100,7 +100,7 @@ var cn = {
|
|
|
100
100
|
high: a(i.high),
|
|
101
101
|
low: a(i.low),
|
|
102
102
|
close: a(i.close),
|
|
103
|
-
volume:
|
|
103
|
+
volume: hn(i.volume ?? 0)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
destroy() {
|
|
@@ -141,7 +141,7 @@ var cn = {
|
|
|
141
141
|
this.live.textContent = e;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
function
|
|
144
|
+
function mn(e, t) {
|
|
145
145
|
let n = document.createElement(e);
|
|
146
146
|
return n.className = t, Object.assign(n.style, {
|
|
147
147
|
position: "absolute",
|
|
@@ -155,57 +155,57 @@ function pn(e, t) {
|
|
|
155
155
|
border: "0"
|
|
156
156
|
}), n;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function hn(e) {
|
|
159
159
|
return Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region src/charts/ChartTypeStrategy.ts
|
|
163
|
-
function
|
|
163
|
+
function gn(e) {
|
|
164
164
|
switch (e) {
|
|
165
165
|
case "candlestick":
|
|
166
166
|
case "heikinAshi":
|
|
167
167
|
case "lineBreak":
|
|
168
168
|
case "rangeBars": return new xe();
|
|
169
|
-
case "line": return new
|
|
169
|
+
case "line": return new Je();
|
|
170
170
|
case "area": return new ge();
|
|
171
171
|
case "bar": return new ye();
|
|
172
|
-
case "hollowCandle": return new
|
|
172
|
+
case "hollowCandle": return new He();
|
|
173
173
|
case "baseline": return new be();
|
|
174
|
-
case "renko": return new
|
|
175
|
-
case "kagi": return new
|
|
176
|
-
case "pointAndFigure": return new
|
|
177
|
-
case "volumeCandles": return new
|
|
178
|
-
case "equivolume": return new
|
|
179
|
-
case "hlcArea": return new
|
|
180
|
-
case "stepLine": return new
|
|
181
|
-
case "lineWithMarkers": return new
|
|
182
|
-
case "hiLo": return new
|
|
174
|
+
case "renko": return new lt();
|
|
175
|
+
case "kagi": return new Ke();
|
|
176
|
+
case "pointAndFigure": return new it();
|
|
177
|
+
case "volumeCandles": return new kt();
|
|
178
|
+
case "equivolume": return new Le();
|
|
179
|
+
case "hlcArea": return new Be();
|
|
180
|
+
case "stepLine": return new bt();
|
|
181
|
+
case "lineWithMarkers": return new Ye();
|
|
182
|
+
case "hiLo": return new Ve();
|
|
183
183
|
default: return new xe();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function _n(e, t, n = {}, r, i) {
|
|
187
187
|
if (t.length === 0) return t;
|
|
188
188
|
switch (e) {
|
|
189
|
-
case "heikinAshi": return
|
|
189
|
+
case "heikinAshi": return Zt(t);
|
|
190
190
|
case "renko": {
|
|
191
191
|
let e = n.renko?.boxSize;
|
|
192
|
-
return typeof e == "number" ?
|
|
192
|
+
return typeof e == "number" ? tn(t, { brickSize: e }, i) : tn(t, {
|
|
193
193
|
brickSize: 0,
|
|
194
194
|
useATR: !0,
|
|
195
195
|
atrPeriod: n.renko?.atrPeriod ?? 14
|
|
196
196
|
}, i);
|
|
197
197
|
}
|
|
198
|
-
case "lineBreak": return
|
|
199
|
-
case "kagi": return
|
|
200
|
-
case "pointAndFigure": return
|
|
201
|
-
case "rangeBars": return
|
|
202
|
-
rangeSize:
|
|
198
|
+
case "lineBreak": return $t(t, n.lineBreak?.lines ?? 3);
|
|
199
|
+
case "kagi": return Qt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
200
|
+
case "pointAndFigure": return yn(t, n, i).columns;
|
|
201
|
+
case "rangeBars": return en(t, {
|
|
202
|
+
rangeSize: kn(t, n, r),
|
|
203
203
|
includeForming: !0
|
|
204
204
|
}, i);
|
|
205
205
|
default: return t;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function vn(e) {
|
|
209
209
|
switch (e) {
|
|
210
210
|
case "heikinAshi":
|
|
211
211
|
case "renko":
|
|
@@ -217,71 +217,71 @@ function _n(e) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function I(e) {
|
|
220
|
-
return e !== "heikinAshi" &&
|
|
220
|
+
return e !== "heikinAshi" && vn(e);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
222
|
+
function yn(e, t = {}, n) {
|
|
223
|
+
return Wt(e, Sn(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
225
|
+
var bn = 50, xn = .01;
|
|
226
|
+
function Sn(e, t = {}) {
|
|
227
227
|
let n = t.pointAndFigure?.boxSize;
|
|
228
228
|
if (typeof n == "number") return n;
|
|
229
|
-
let r =
|
|
230
|
-
return r > 0 ?
|
|
229
|
+
let r = Cn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
230
|
+
return r > 0 ? On(te(r / bn, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * xn || 1;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Cn(e, t) {
|
|
233
233
|
let n = -Infinity, r = Infinity;
|
|
234
234
|
for (let i = 0; i < t; i++) e[i].high > n && (n = e[i].high), e[i].low < r && (r = e[i].low);
|
|
235
235
|
let i = n - r;
|
|
236
236
|
return Number.isFinite(i) ? i : 0;
|
|
237
237
|
}
|
|
238
|
-
var
|
|
239
|
-
function
|
|
238
|
+
var wn = 100, Tn = 3, En = .01, Dn = 15, On = (e) => Number(e.toPrecision(Dn));
|
|
239
|
+
function kn(e, t = {}, n) {
|
|
240
240
|
let r = t.rangeBars?.range;
|
|
241
241
|
if (typeof r == "number") return r;
|
|
242
|
-
let i = e.length >=
|
|
243
|
-
return
|
|
242
|
+
let i = e.length >= Tn ? jn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
243
|
+
return Pn(On(te(i > 0 ? i : a * En || 1, !0)), n);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function An(e) {
|
|
246
246
|
let t = e.length - 1;
|
|
247
247
|
return {
|
|
248
|
-
from: Math.max(0, t -
|
|
248
|
+
from: Math.max(0, t - wn),
|
|
249
249
|
end: t
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
let { from: t, end: n } =
|
|
252
|
+
function jn(e) {
|
|
253
|
+
let { from: t, end: n } = An(e), r = 0;
|
|
254
254
|
for (let i = t; i < n; i++) {
|
|
255
255
|
let { high: t, low: n } = e[i], a = i > 0 ? e[i - 1].close : n;
|
|
256
256
|
r += Math.max(t - n, Math.abs(t - a), Math.abs(n - a));
|
|
257
257
|
}
|
|
258
258
|
return n > t ? r / (n - t) : 0;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
let { from: n, end: r } =
|
|
260
|
+
function Mn(e, t) {
|
|
261
|
+
let { from: n, end: r } = An(e);
|
|
262
262
|
if (r <= n) return t(e[e.length - 1]?.close ?? 0);
|
|
263
263
|
let i = -Infinity, a = Infinity;
|
|
264
264
|
for (let t = n; t < r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
265
|
-
return
|
|
266
|
-
}
|
|
267
|
-
function Mn(e, t) {
|
|
268
|
-
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
265
|
+
return Nn(t(i), t(a));
|
|
269
266
|
}
|
|
270
267
|
function Nn(e, t) {
|
|
271
|
-
return
|
|
268
|
+
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
272
269
|
}
|
|
273
270
|
function Pn(e, t) {
|
|
271
|
+
return t === void 0 || !(t > 0) ? e : On(Math.max(1, Math.round(e / t)) * t);
|
|
272
|
+
}
|
|
273
|
+
function Fn(e, t) {
|
|
274
274
|
let n = t?.(e);
|
|
275
|
-
return n ? n.createRenderer() :
|
|
275
|
+
return n ? n.createRenderer() : gn(e);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function In(e, t, n, r, i, a) {
|
|
278
278
|
if (t.length === 0) return t;
|
|
279
279
|
let o = n?.(e);
|
|
280
|
-
return o?.transform ? o.transform(t) :
|
|
280
|
+
return o?.transform ? o.transform(t) : _n(e, t, r, i, a);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/state/AutoSaveScheduler.ts
|
|
284
|
-
var
|
|
284
|
+
var Ln = class {
|
|
285
285
|
timer = null;
|
|
286
286
|
delayMs = 0;
|
|
287
287
|
key = null;
|
|
@@ -316,7 +316,7 @@ function L(e) {
|
|
|
316
316
|
let { open: t, high: n, low: r, close: i } = e;
|
|
317
317
|
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));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Rn(e) {
|
|
320
320
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
321
321
|
}
|
|
322
322
|
function R(e) {
|
|
@@ -330,24 +330,24 @@ function R(e) {
|
|
|
330
330
|
function z(e, t) {
|
|
331
331
|
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;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function zn(e, t) {
|
|
334
334
|
for (let n = e.length - 1; n >= 0; n--) {
|
|
335
335
|
if (e[n].time === t) return n;
|
|
336
336
|
if (e[n].time < t) return -1;
|
|
337
337
|
}
|
|
338
338
|
return -1;
|
|
339
339
|
}
|
|
340
|
-
var
|
|
340
|
+
var Bn = {
|
|
341
341
|
index: -1,
|
|
342
342
|
changed: !1
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function Vn(e, t) {
|
|
345
345
|
if (e.length === 0) return t;
|
|
346
346
|
let n = S(t);
|
|
347
347
|
return f(e) === 1 ? n : n / 1e3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
let n =
|
|
349
|
+
function Hn(e, t) {
|
|
350
|
+
let n = Vn(e, t.time);
|
|
351
351
|
return n === t.time ? t : {
|
|
352
352
|
...t,
|
|
353
353
|
time: n
|
|
@@ -357,7 +357,7 @@ var B = class {
|
|
|
357
357
|
data = [];
|
|
358
358
|
changes = 0;
|
|
359
359
|
withSeriesTime(e) {
|
|
360
|
-
return
|
|
360
|
+
return Hn(this.data, e);
|
|
361
361
|
}
|
|
362
362
|
getData() {
|
|
363
363
|
return this.data;
|
|
@@ -369,7 +369,7 @@ var B = class {
|
|
|
369
369
|
let t = [];
|
|
370
370
|
for (let n = 0; n < e.length; n++) {
|
|
371
371
|
let r = e[n];
|
|
372
|
-
L(r) && t.push(
|
|
372
|
+
L(r) && t.push(Rn(r) ? r : R(r));
|
|
373
373
|
}
|
|
374
374
|
this.data = t, this.changes++;
|
|
375
375
|
}
|
|
@@ -378,7 +378,7 @@ var B = class {
|
|
|
378
378
|
for (let r = 0; r < e.length; r++) {
|
|
379
379
|
if (!L(e[r])) continue;
|
|
380
380
|
let i = this.withSeriesTime(e[r]);
|
|
381
|
-
i.time >= t || n.push(
|
|
381
|
+
i.time >= t || n.push(Rn(i) ? i : R(i));
|
|
382
382
|
}
|
|
383
383
|
if (n.length === 0) return 0;
|
|
384
384
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -399,9 +399,9 @@ var B = class {
|
|
|
399
399
|
this.data[this.data.length - 1] = t;
|
|
400
400
|
}
|
|
401
401
|
replaceBar(e) {
|
|
402
|
-
if (!L(e)) return
|
|
403
|
-
let t = this.withSeriesTime(e), n =
|
|
404
|
-
if (n < 0) return
|
|
402
|
+
if (!L(e)) return Bn;
|
|
403
|
+
let t = this.withSeriesTime(e), n = zn(this.data, t.time);
|
|
404
|
+
if (n < 0) return Bn;
|
|
405
405
|
let r = R(t);
|
|
406
406
|
return z(this.data[n], r) ? {
|
|
407
407
|
index: n,
|
|
@@ -431,7 +431,7 @@ function H(e, t) {
|
|
|
431
431
|
let r = S(t.time), i = S(n.time);
|
|
432
432
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Un(e) {
|
|
435
435
|
return [
|
|
436
436
|
e.time,
|
|
437
437
|
e.open,
|
|
@@ -440,7 +440,7 @@ function Hn(e) {
|
|
|
440
440
|
e.close
|
|
441
441
|
].every(Number.isFinite);
|
|
442
442
|
}
|
|
443
|
-
var
|
|
443
|
+
var Wn = class {
|
|
444
444
|
shown = new B();
|
|
445
445
|
whole = null;
|
|
446
446
|
aside = null;
|
|
@@ -483,7 +483,7 @@ var Un = class {
|
|
|
483
483
|
}
|
|
484
484
|
let t = null, n = e;
|
|
485
485
|
if (this.whole) {
|
|
486
|
-
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(
|
|
486
|
+
let r = this.whole[0]?.time, i = /* @__PURE__ */ new Set(), a = e.filter(Un).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);
|
|
487
487
|
this.whole = [...a, ...this.whole];
|
|
488
488
|
let o = this.hoursFilter(this.whole);
|
|
489
489
|
t = a.length, n = o ? a.filter((e) => o(e.time)) : a;
|
|
@@ -495,8 +495,8 @@ var Un = class {
|
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
497
|
mergeSnapshot(e) {
|
|
498
|
-
if (this.aside) return this.aside.setData(
|
|
499
|
-
let t =
|
|
498
|
+
if (this.aside) return this.aside.setData(Gn(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = Gn(this.whole ?? this.shown.getData(), e);
|
|
500
500
|
return t ? (this.shown.setData(this.regularOnly(t)), !0) : !1;
|
|
501
501
|
}
|
|
502
502
|
refilter() {
|
|
@@ -553,7 +553,7 @@ var Un = class {
|
|
|
553
553
|
mergeTick(e) {
|
|
554
554
|
if (this.aside) return this.aside.updateLastBarFromTick(e), this.wrote("aside", !1);
|
|
555
555
|
let t = this.whole ? this.hoursFilter(this.whole) : null;
|
|
556
|
-
if (t && this.whole && !t(
|
|
556
|
+
if (t && this.whole && !t(Vn(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
557
557
|
let n = this.shown.getLength();
|
|
558
558
|
this.shown.updateLastBarFromTick(e);
|
|
559
559
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -596,7 +596,7 @@ var Un = class {
|
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
if (!L(e)) return V;
|
|
599
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? zn(n, t.time) : -1;
|
|
600
600
|
if (n) {
|
|
601
601
|
if (r < 0 || !L(n[r])) return V;
|
|
602
602
|
let e = this.hoursFilter(n);
|
|
@@ -630,7 +630,7 @@ var Un = class {
|
|
|
630
630
|
this.shown.updateLastBar(e);
|
|
631
631
|
}
|
|
632
632
|
inSeriesUnit(e) {
|
|
633
|
-
return
|
|
633
|
+
return Hn(this.whole ?? this.shown.getData(), e);
|
|
634
634
|
}
|
|
635
635
|
replaceHidden(e, t, n) {
|
|
636
636
|
let r = R(n), i = !z(e[t], r);
|
|
@@ -667,14 +667,14 @@ var Un = class {
|
|
|
667
667
|
return !r || r(e.time);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
function
|
|
670
|
+
function Gn(e, t) {
|
|
671
671
|
let n = t[0]?.time, r = 0;
|
|
672
672
|
for (; n !== void 0 && r < e.length && e[r].time < n;) r++;
|
|
673
673
|
return r === 0 || r === e.length ? null : e.slice(0, r).concat(t);
|
|
674
674
|
}
|
|
675
675
|
//#endregion
|
|
676
676
|
//#region src/model/PriceFit.ts
|
|
677
|
-
var
|
|
677
|
+
var Kn = class {
|
|
678
678
|
auto;
|
|
679
679
|
preferred;
|
|
680
680
|
pending = !0;
|
|
@@ -711,7 +711,7 @@ var Gn = class {
|
|
|
711
711
|
}
|
|
712
712
|
fit(e, t, n, r) {
|
|
713
713
|
if (t.length === 0) return;
|
|
714
|
-
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o =
|
|
714
|
+
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o = Jn(Jn(g(t, i, a, 0), r.overlayRange(i, a)), r.compareRange(t, n)), s = r.volumeRatio(t, i, a), { priceMargin: c, volumeGap: l } = this.spacing, u = s === null ? c : s + l;
|
|
715
715
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
716
716
|
top: u,
|
|
717
717
|
bottom: c
|
|
@@ -721,11 +721,11 @@ var Gn = class {
|
|
|
721
721
|
}), e.fitToPrices(o.min, o.max);
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
|
-
function
|
|
724
|
+
function qn(e, t, n) {
|
|
725
725
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
726
726
|
return !1;
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function Jn(e, t) {
|
|
729
729
|
return e ? t ? {
|
|
730
730
|
min: Math.min(e.min, t.min),
|
|
731
731
|
max: Math.max(e.max, t.max)
|
|
@@ -733,18 +733,18 @@ function qn(e, t) {
|
|
|
733
733
|
}
|
|
734
734
|
//#endregion
|
|
735
735
|
//#region src/model/DisplaySeries.ts
|
|
736
|
-
var
|
|
736
|
+
var Yn = class {
|
|
737
737
|
series = null;
|
|
738
738
|
madeAt = null;
|
|
739
739
|
epoch = 0;
|
|
740
|
-
memo = new
|
|
740
|
+
memo = new ft();
|
|
741
741
|
constructor(e) {
|
|
742
742
|
this.sources = e;
|
|
743
743
|
}
|
|
744
744
|
get() {
|
|
745
745
|
let e = this.sources.bars();
|
|
746
746
|
if (e.length === 0) return e;
|
|
747
|
-
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ?
|
|
747
|
+
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ? Mn(e, (e) => this.sources.stepAt(e)) : void 0, i = this.sources.version(), a = this.madeAt;
|
|
748
748
|
return this.series && a && a.version === i && a.type === t && a.options === n && a.step === r && a.epoch === this.epoch ? this.series : (this.series = this.make(t, e, n, r), this.madeAt = {
|
|
749
749
|
version: i,
|
|
750
750
|
type: t,
|
|
@@ -761,14 +761,14 @@ var Jn = class {
|
|
|
761
761
|
}
|
|
762
762
|
make(e, t, n, r) {
|
|
763
763
|
let { lookup: i } = this.sources;
|
|
764
|
-
if (e !== "pointAndFigure" || i(e)) return
|
|
765
|
-
let { columns: a, boxSize: o } =
|
|
764
|
+
if (e !== "pointAndFigure" || i(e)) return In(e, t, i, n, r, this.memo);
|
|
765
|
+
let { columns: a, boxSize: o } = yn(t, n, this.memo);
|
|
766
766
|
return this.sources.onBoxSize(o), a;
|
|
767
767
|
}
|
|
768
|
-
},
|
|
768
|
+
}, Xn = {
|
|
769
769
|
min: 0,
|
|
770
770
|
max: 100
|
|
771
|
-
},
|
|
771
|
+
}, Zn = class {
|
|
772
772
|
layout = null;
|
|
773
773
|
infos = null;
|
|
774
774
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -776,7 +776,7 @@ var Jn = class {
|
|
|
776
776
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
777
777
|
}
|
|
778
778
|
resolved() {
|
|
779
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
779
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(Qn(this.layout))), this.layout;
|
|
780
780
|
}
|
|
781
781
|
invalidate() {
|
|
782
782
|
this.layout = null, this.infos = null;
|
|
@@ -788,7 +788,7 @@ var Jn = class {
|
|
|
788
788
|
if (this.infos) return this.infos;
|
|
789
789
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
790
790
|
return this.infos = this.resolved().panels.map((e) => {
|
|
791
|
-
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...
|
|
791
|
+
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...Xn }, s = this.styles.get(i);
|
|
792
792
|
return {
|
|
793
793
|
instanceId: i,
|
|
794
794
|
members: this.sources.getPaneMembers(i),
|
|
@@ -848,7 +848,7 @@ var Jn = class {
|
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
|
-
function
|
|
851
|
+
function Qn(e) {
|
|
852
852
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
853
853
|
for (let t of e.panels) t.config.position !== "top" && t.config.position !== "bottom" || (n = Math.min(n, t.rect.y), r = Math.max(r, t.rect.y + t.rect.height));
|
|
854
854
|
return {
|
|
@@ -856,10 +856,10 @@ function Zn(e) {
|
|
|
856
856
|
bottom: r
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function $n(e) {
|
|
860
860
|
return e.length > 0 ? { renames: e } : {};
|
|
861
861
|
}
|
|
862
|
-
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t),
|
|
862
|
+
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), er = class {
|
|
863
863
|
steps;
|
|
864
864
|
snapshot;
|
|
865
865
|
enabled;
|
|
@@ -895,7 +895,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), $n = class {
|
|
|
895
895
|
...o,
|
|
896
896
|
after: n,
|
|
897
897
|
at: i,
|
|
898
|
-
|
|
898
|
+
...$n([...o.renames ?? [], ...r])
|
|
899
899
|
}
|
|
900
900
|
}) : this.steps.push({
|
|
901
901
|
...c,
|
|
@@ -904,7 +904,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), $n = class {
|
|
|
904
904
|
after: n,
|
|
905
905
|
subject: e,
|
|
906
906
|
at: i,
|
|
907
|
-
|
|
907
|
+
...$n(r)
|
|
908
908
|
}
|
|
909
909
|
});
|
|
910
910
|
}
|
|
@@ -942,7 +942,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), $n = class {
|
|
|
942
942
|
}
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
|
-
},
|
|
945
|
+
}, tr = class {
|
|
946
946
|
constructor(e, t, n) {
|
|
947
947
|
this.members = e, this.slots = t, this.handover = n;
|
|
948
948
|
}
|
|
@@ -1021,7 +1021,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), $n = class {
|
|
|
1021
1021
|
};
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/model/IndicatorSetup.ts
|
|
1024
|
-
function
|
|
1024
|
+
function nr(e, t, n) {
|
|
1025
1025
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1026
1026
|
return e.getActiveIndicators().map((t) => {
|
|
1027
1027
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1049,7 +1049,7 @@ function tr(e, t, n) {
|
|
|
1049
1049
|
};
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function rr(e, t) {
|
|
1053
1053
|
for (let [n, r] of t) n.paneSize !== void 0 && e.setPanelSize(r, n.paneSize), (n.paneSize !== void 0 || n.paneCollapsed) && e.setPanelCollapsed(r, !!n.paneCollapsed), n.paneSize !== void 0 && e.setPanelScale(r, {
|
|
1054
1054
|
log: !!n.paneLog,
|
|
1055
1055
|
invert: !!n.paneInvert,
|
|
@@ -1060,7 +1060,7 @@ function nr(e, t) {
|
|
|
1060
1060
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1061
1061
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function ir(e) {
|
|
1064
1064
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1065
1065
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1066
1066
|
i.add(e.instanceId);
|
|
@@ -1074,23 +1074,23 @@ function rr(e) {
|
|
|
1074
1074
|
for (let t of e) a(t);
|
|
1075
1075
|
return n;
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function ar(e, t) {
|
|
1078
1078
|
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);
|
|
1079
1079
|
}
|
|
1080
|
-
function
|
|
1080
|
+
function or(e, t) {
|
|
1081
1081
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1082
1082
|
for (let t of e) {
|
|
1083
1083
|
let e = n.get(t.instanceId);
|
|
1084
|
-
e &&
|
|
1084
|
+
e && ar(t, e) && sr(t, e) && r.add(t.instanceId);
|
|
1085
1085
|
}
|
|
1086
1086
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1087
1087
|
return r;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function sr(e, t) {
|
|
1090
1090
|
let n = Object.keys(e.params);
|
|
1091
1091
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function cr(e, t) {
|
|
1094
1094
|
let n = { ...e };
|
|
1095
1095
|
for (let [e, r] of Object.entries(n)) {
|
|
1096
1096
|
let i = C(r), a = i && t.get(i.instanceId);
|
|
@@ -1100,11 +1100,11 @@ function sr(e, t) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
//#endregion
|
|
1102
1102
|
//#region src/model/SymbolRequests.ts
|
|
1103
|
-
function
|
|
1103
|
+
function lr(e, t) {
|
|
1104
1104
|
let n = t.symbol;
|
|
1105
|
-
return
|
|
1105
|
+
return pt.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1106
1106
|
}
|
|
1107
|
-
var
|
|
1107
|
+
var ur = class {
|
|
1108
1108
|
asked = /* @__PURE__ */ new Set();
|
|
1109
1109
|
constructor(e, t) {
|
|
1110
1110
|
this.readers = e, this.held = t;
|
|
@@ -1112,14 +1112,14 @@ var lr = class {
|
|
|
1112
1112
|
required() {
|
|
1113
1113
|
let e = /* @__PURE__ */ new Set();
|
|
1114
1114
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1115
|
-
let n =
|
|
1115
|
+
let n = lr(t.id, t.params);
|
|
1116
1116
|
n && e.add(n);
|
|
1117
1117
|
}
|
|
1118
1118
|
return [...e];
|
|
1119
1119
|
}
|
|
1120
1120
|
readersOf(e) {
|
|
1121
1121
|
let t = e.trim();
|
|
1122
|
-
return this.readers.getActiveIndicators().filter((e) =>
|
|
1122
|
+
return this.readers.getActiveIndicators().filter((e) => pt.has(e.id) && String(e.params.symbol ?? "").trim() === t).map((e) => e.instanceId);
|
|
1123
1123
|
}
|
|
1124
1124
|
given(e) {
|
|
1125
1125
|
this.asked.delete(e.trim());
|
|
@@ -1130,20 +1130,20 @@ var lr = class {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
toAsk(e) {
|
|
1132
1132
|
this.forgetUnread();
|
|
1133
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1133
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? lr(t.id, t.params) : "";
|
|
1134
1134
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1135
1135
|
}
|
|
1136
|
-
},
|
|
1137
|
-
function
|
|
1138
|
-
if (!
|
|
1136
|
+
}, dr = (e, t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1137
|
+
function fr(e, t, n, r) {
|
|
1138
|
+
if (!dr(e, t)) {
|
|
1139
1139
|
for (let t of n) {
|
|
1140
1140
|
let n = r(t.id);
|
|
1141
|
-
if (n &&
|
|
1141
|
+
if (n && dr(e, n.chartRect)) return t.id;
|
|
1142
1142
|
}
|
|
1143
1143
|
return null;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function pr(e, t, n, r) {
|
|
1147
1147
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1148
1148
|
let i = n();
|
|
1149
1149
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1151,12 +1151,12 @@ function fr(e, t, n, r) {
|
|
|
1151
1151
|
data: r()
|
|
1152
1152
|
};
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function mr(e, t, n) {
|
|
1155
1155
|
return !n && e.some((e) => e.id === t);
|
|
1156
1156
|
}
|
|
1157
1157
|
//#endregion
|
|
1158
1158
|
//#region src/HistoryPager.ts
|
|
1159
|
-
var
|
|
1159
|
+
var hr = 5e3, gr = 6e4, _r = 500, vr = class {
|
|
1160
1160
|
loader = null;
|
|
1161
1161
|
pageSize = 500;
|
|
1162
1162
|
loading = !1;
|
|
@@ -1211,7 +1211,7 @@ var mr = 5e3, hr = 6e4, gr = 500, _r = class {
|
|
|
1211
1211
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1212
1212
|
state: "loaded",
|
|
1213
1213
|
count: 0
|
|
1214
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1214
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(gr, hr * 2 ** (this.failures - 1)), this.emit({
|
|
1215
1215
|
state: "error",
|
|
1216
1216
|
count: 0,
|
|
1217
1217
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1244,10 +1244,10 @@ var mr = 5e3, hr = 6e4, gr = 500, _r = class {
|
|
|
1244
1244
|
};
|
|
1245
1245
|
//#endregion
|
|
1246
1246
|
//#region src/ThemeManager.ts
|
|
1247
|
-
function
|
|
1247
|
+
function yr(e, t) {
|
|
1248
1248
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1249
1249
|
}
|
|
1250
|
-
var
|
|
1250
|
+
var br = class e {
|
|
1251
1251
|
base;
|
|
1252
1252
|
shape = null;
|
|
1253
1253
|
font = null;
|
|
@@ -1272,7 +1272,7 @@ var yr = class e {
|
|
|
1272
1272
|
return this.base;
|
|
1273
1273
|
}
|
|
1274
1274
|
setTheme(t) {
|
|
1275
|
-
let n = e.read(t), r = this.font !== null &&
|
|
1275
|
+
let n = e.read(t), r = this.font !== null && yr(n.font, this.base.font);
|
|
1276
1276
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1277
1277
|
...this.base,
|
|
1278
1278
|
shape: {
|
|
@@ -1354,7 +1354,7 @@ var yr = class e {
|
|
|
1354
1354
|
};
|
|
1355
1355
|
//#endregion
|
|
1356
1356
|
//#region src/style/styleOptions.ts
|
|
1357
|
-
function
|
|
1357
|
+
function xr(e, t) {
|
|
1358
1358
|
return t ? {
|
|
1359
1359
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1360
1360
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1362,22 +1362,22 @@ function br(e, t) {
|
|
|
1362
1362
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1363
1363
|
} : {};
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1365
|
+
function Sr(e) {
|
|
1366
1366
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1367
1367
|
return {
|
|
1368
1368
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1369
1369
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1370
1370
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1371
1371
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1372
|
-
...
|
|
1373
|
-
...
|
|
1372
|
+
...xr("horizontal", n?.hLine),
|
|
1373
|
+
...xr("vertical", n?.vLine),
|
|
1374
1374
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1375
1375
|
...e.overrides
|
|
1376
1376
|
};
|
|
1377
1377
|
}
|
|
1378
1378
|
//#endregion
|
|
1379
1379
|
//#region src/layout/LayoutManager.ts
|
|
1380
|
-
var
|
|
1380
|
+
var Cr = 200, wr = 80, Tr = .382, W = (e) => e.position === "top" || e.position === "bottom", Er = class {
|
|
1381
1381
|
panels = [];
|
|
1382
1382
|
containerWidth = 0;
|
|
1383
1383
|
containerHeight = 0;
|
|
@@ -1394,8 +1394,8 @@ var Sr = 200, Cr = 80, wr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1394
1394
|
this.panels.push({
|
|
1395
1395
|
id: e,
|
|
1396
1396
|
position: t,
|
|
1397
|
-
size: n ?? (r ?
|
|
1398
|
-
minSize: r ?
|
|
1397
|
+
size: n ?? (r ? Cr : i),
|
|
1398
|
+
minSize: r ? wr : s,
|
|
1399
1399
|
content: {
|
|
1400
1400
|
type: "indicator",
|
|
1401
1401
|
indicatorInstanceId: e
|
|
@@ -1477,7 +1477,7 @@ var Sr = 200, Cr = 80, wr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1477
1477
|
let n = this.panels.find((t) => t.id === e);
|
|
1478
1478
|
if (n) {
|
|
1479
1479
|
let r = n.position === "left" || n.position === "right", a = t === "left" || t === "right";
|
|
1480
|
-
n.position = t, r !== a && (n.size = a ?
|
|
1480
|
+
n.position = t, r !== a && (n.size = a ? Cr : i, n.minSize = a ? wr : s), a && (n.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
1483
|
setPanelSize(e, t) {
|
|
@@ -1489,7 +1489,7 @@ var Sr = 200, Cr = 80, wr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1489
1489
|
}
|
|
1490
1490
|
roomForOpen(e) {
|
|
1491
1491
|
let t = this.containerHeight - l;
|
|
1492
|
-
return t - Math.max(48, Math.ceil(t *
|
|
1492
|
+
return t - Math.max(48, Math.ceil(t * Tr)) - e * 20;
|
|
1493
1493
|
}
|
|
1494
1494
|
setPanelHeightOnScreen(e, t) {
|
|
1495
1495
|
let n = this.panels.find((t) => t.id === e);
|
|
@@ -1610,8 +1610,8 @@ var Sr = 200, Cr = 80, wr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1610
1610
|
getMainChartRect() {
|
|
1611
1611
|
return this.resolve().mainChartRect;
|
|
1612
1612
|
}
|
|
1613
|
-
},
|
|
1614
|
-
function
|
|
1613
|
+
}, Dr = 14, Or = 14, kr = 22, Ar = 4;
|
|
1614
|
+
function jr(e) {
|
|
1615
1615
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure: s } = e, l = e.tagPrecision ?? u(t, n), d = l, f = r === null ? [t, n] : [
|
|
1616
1616
|
t,
|
|
1617
1617
|
n,
|
|
@@ -1620,16 +1620,16 @@ function Ar(e) {
|
|
|
1620
1620
|
for (let t of f) {
|
|
1621
1621
|
if (!Number.isFinite(t)) continue;
|
|
1622
1622
|
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : v(t, l, i), r = e.format ? n : v(t, d, i);
|
|
1623
|
-
p = Math.max(p, s(n, `500 ${o}px ${a}`) +
|
|
1623
|
+
p = Math.max(p, s(n, `500 ${o}px ${a}`) + Dr, s(r, `bold 11px ${a}`) + Or, s(r, `600 ${o}px ${a}`) + kr);
|
|
1624
1624
|
}
|
|
1625
|
-
return p <= c ? c : Math.ceil(p /
|
|
1625
|
+
return p <= c ? c : Math.ceil(p / Ar) * Ar;
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function Mr(e, t) {
|
|
1628
1628
|
return t > e || t <= e - 12 ? t : e;
|
|
1629
1629
|
}
|
|
1630
1630
|
//#endregion
|
|
1631
1631
|
//#region src/layout/labelWidths.ts
|
|
1632
|
-
var
|
|
1632
|
+
var Nr = 512, Pr = class {
|
|
1633
1633
|
widths = /* @__PURE__ */ new Map();
|
|
1634
1634
|
fonts;
|
|
1635
1635
|
forget = () => this.widths.clear();
|
|
@@ -1640,12 +1640,12 @@ var Mr = 512, Nr = class {
|
|
|
1640
1640
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1641
1641
|
if (i !== void 0) return i;
|
|
1642
1642
|
let a = n();
|
|
1643
|
-
return this.widths.size >=
|
|
1643
|
+
return this.widths.size >= Nr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1644
1644
|
}
|
|
1645
1645
|
destroy() {
|
|
1646
1646
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1647
1647
|
}
|
|
1648
|
-
},
|
|
1648
|
+
}, Fr = class {
|
|
1649
1649
|
netY = 0;
|
|
1650
1650
|
travelX = 0;
|
|
1651
1651
|
engaged = !1;
|
|
@@ -1661,8 +1661,8 @@ var Mr = 512, Nr = class {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
return this.engaged;
|
|
1663
1663
|
}
|
|
1664
|
-
},
|
|
1665
|
-
function
|
|
1664
|
+
}, Ir = 1;
|
|
1665
|
+
function Lr(e, t) {
|
|
1666
1666
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1667
1667
|
}
|
|
1668
1668
|
function G(e) {
|
|
@@ -1676,24 +1676,24 @@ function G(e) {
|
|
|
1676
1676
|
//#endregion
|
|
1677
1677
|
//#region src/plugins/registry.ts
|
|
1678
1678
|
var K = /* @__PURE__ */ new Map();
|
|
1679
|
-
function
|
|
1679
|
+
function Rr(e) {
|
|
1680
1680
|
K.set(G(e), e);
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function zr(e) {
|
|
1683
1683
|
return K.delete(e);
|
|
1684
1684
|
}
|
|
1685
|
-
function
|
|
1685
|
+
function Br() {
|
|
1686
1686
|
return [...K.values()];
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1688
|
+
function Vr() {
|
|
1689
1689
|
K.clear();
|
|
1690
1690
|
}
|
|
1691
1691
|
//#endregion
|
|
1692
1692
|
//#region src/plugins/PluginManager.ts
|
|
1693
|
-
var
|
|
1693
|
+
var Hr = class {
|
|
1694
1694
|
plugins = /* @__PURE__ */ new Map();
|
|
1695
1695
|
constructor(e, t = {}) {
|
|
1696
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1696
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Br()) this.add(e);
|
|
1697
1697
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1698
1698
|
}
|
|
1699
1699
|
register(e) {
|
|
@@ -1723,15 +1723,15 @@ var Vr = class {
|
|
|
1723
1723
|
add(e) {
|
|
1724
1724
|
this.plugins.set(G(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1725
1725
|
}
|
|
1726
|
-
},
|
|
1726
|
+
}, Ur = {
|
|
1727
1727
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1728
1728
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1729
1729
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1730
1730
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1731
1731
|
positionClose: (e, t) => e.closePosition(t),
|
|
1732
|
-
positionReverse: (e, t, n) =>
|
|
1732
|
+
positionReverse: (e, t, n) => Wr(e, t, n)
|
|
1733
1733
|
};
|
|
1734
|
-
async function
|
|
1734
|
+
async function Wr(e, t, n) {
|
|
1735
1735
|
let { reversing: r } = n;
|
|
1736
1736
|
if (!r.has(t.positionId)) {
|
|
1737
1737
|
r.add(t.positionId);
|
|
@@ -1760,7 +1760,7 @@ async function Ur(e, t, n) {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
|
-
function
|
|
1763
|
+
function Gr(e, t) {
|
|
1764
1764
|
let n = [], r = null, i = {
|
|
1765
1765
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1766
1766
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1770,8 +1770,8 @@ function Wr(e, t) {
|
|
|
1770
1770
|
e.data && t.onFill?.(e.data);
|
|
1771
1771
|
};
|
|
1772
1772
|
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));
|
|
1773
|
-
for (let r of Object.keys(
|
|
1774
|
-
let a =
|
|
1773
|
+
for (let r of Object.keys(Ur)) {
|
|
1774
|
+
let a = Ur[r], o = t.onIntent(r, (n) => {
|
|
1775
1775
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1776
1776
|
message: `Execution command failed: ${r}`,
|
|
1777
1777
|
cause: e
|
|
@@ -1785,7 +1785,7 @@ function Wr(e, t) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
//#endregion
|
|
1787
1787
|
//#region src/replay/ReplayStepLoader.ts
|
|
1788
|
-
var
|
|
1788
|
+
var Kr = 1e3, qr = class {
|
|
1789
1789
|
pieces = /* @__PURE__ */ new Map();
|
|
1790
1790
|
asked = /* @__PURE__ */ new Set();
|
|
1791
1791
|
inFlight = !1;
|
|
@@ -1818,7 +1818,7 @@ var Gr = 1e3, Kr = class {
|
|
|
1818
1818
|
this.done = !0;
|
|
1819
1819
|
}
|
|
1820
1820
|
ask(e, t) {
|
|
1821
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1821
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(Kr / 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);
|
|
1822
1822
|
for (let e of l) this.asked.add(e.time);
|
|
1823
1823
|
this.inFlight = !0, a({
|
|
1824
1824
|
state: "loading",
|
|
@@ -1859,12 +1859,12 @@ var Gr = 1e3, Kr = class {
|
|
|
1859
1859
|
...n === void 0 ? {} : { error: n }
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
|
-
},
|
|
1863
|
-
function
|
|
1864
|
-
let n = (e.high - e.low) *
|
|
1865
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1862
|
+
}, Jr = 1 / 3, Yr = .25, Xr = .5;
|
|
1863
|
+
function Zr(e, t) {
|
|
1864
|
+
let n = (e.high - e.low) * Yr;
|
|
1865
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * Xr;
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function Qr(e) {
|
|
1868
1868
|
return e.close >= e.open ? [
|
|
1869
1869
|
e.open,
|
|
1870
1870
|
e.low,
|
|
@@ -1877,22 +1877,22 @@ function Zr(e) {
|
|
|
1877
1877
|
e.close
|
|
1878
1878
|
];
|
|
1879
1879
|
}
|
|
1880
|
-
function
|
|
1881
|
-
let r =
|
|
1880
|
+
function $r(e, t, n) {
|
|
1881
|
+
let r = Qr(e), i = [
|
|
1882
1882
|
1,
|
|
1883
1883
|
2,
|
|
1884
1884
|
3
|
|
1885
1885
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1886
1886
|
return r.forEach((r, c) => {
|
|
1887
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1887
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : Jr), !(c === 0 && t > 0) && o.push({
|
|
1888
1888
|
price: r,
|
|
1889
1889
|
time: e.time,
|
|
1890
1890
|
at: (t + s) / n
|
|
1891
1891
|
});
|
|
1892
1892
|
}), o;
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1895
|
-
let n = t.length > 0 &&
|
|
1894
|
+
function ei(e, t = []) {
|
|
1895
|
+
let n = t.length > 0 && Zr(e, t) ? t : [e], r = n.length, i = ti(n.flatMap((e, t) => $r(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1896
1896
|
return {
|
|
1897
1897
|
bar: e,
|
|
1898
1898
|
points: i,
|
|
@@ -1902,7 +1902,7 @@ function $r(e, t = []) {
|
|
|
1902
1902
|
}))
|
|
1903
1903
|
};
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1905
|
+
function ti(e, t) {
|
|
1906
1906
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1907
1907
|
...e,
|
|
1908
1908
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1917,7 +1917,7 @@ function ei(e, t) {
|
|
|
1917
1917
|
};
|
|
1918
1918
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1919
1919
|
}
|
|
1920
|
-
function
|
|
1920
|
+
function ni(e, t) {
|
|
1921
1921
|
let n = e.points;
|
|
1922
1922
|
if (t <= n[0].at) return n[0].price;
|
|
1923
1923
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1926,8 +1926,8 @@ function ti(e, t) {
|
|
|
1926
1926
|
}
|
|
1927
1927
|
return n[n.length - 1].price;
|
|
1928
1928
|
}
|
|
1929
|
-
var
|
|
1930
|
-
function
|
|
1929
|
+
var ri = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1930
|
+
function ii(e, t) {
|
|
1931
1931
|
let n = 0, r = 0;
|
|
1932
1932
|
for (let i of e.volumeAt) {
|
|
1933
1933
|
if (t >= i.at) {
|
|
@@ -1938,10 +1938,10 @@ function ri(e, t) {
|
|
|
1938
1938
|
}
|
|
1939
1939
|
return n;
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1942
|
-
let n =
|
|
1941
|
+
function ai(e, t) {
|
|
1942
|
+
let n = ri(t);
|
|
1943
1943
|
if (n >= 1) return { ...e.bar };
|
|
1944
|
-
let r =
|
|
1944
|
+
let r = ni(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1945
1945
|
for (let t of e.points) {
|
|
1946
1946
|
if (t.at > n) break;
|
|
1947
1947
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1952,11 +1952,11 @@ function ii(e, t) {
|
|
|
1952
1952
|
high: i,
|
|
1953
1953
|
low: a,
|
|
1954
1954
|
close: r,
|
|
1955
|
-
volume:
|
|
1955
|
+
volume: ii(e, n)
|
|
1956
1956
|
};
|
|
1957
1957
|
}
|
|
1958
|
-
function
|
|
1959
|
-
let n =
|
|
1958
|
+
function oi(e, t) {
|
|
1959
|
+
let n = ri(t), r = 0;
|
|
1960
1960
|
for (let t of e.points) {
|
|
1961
1961
|
if (t.at > n) break;
|
|
1962
1962
|
r = t.at;
|
|
@@ -1969,12 +1969,12 @@ function q(e, t, n) {
|
|
|
1969
1969
|
if (a.at > n) break;
|
|
1970
1970
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1971
1971
|
}
|
|
1972
|
-
let a =
|
|
1972
|
+
let a = ni(e, n);
|
|
1973
1973
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1974
1974
|
}
|
|
1975
1975
|
//#endregion
|
|
1976
1976
|
//#region src/replay/replayStep.ts
|
|
1977
|
-
var
|
|
1977
|
+
var si = [
|
|
1978
1978
|
"1m",
|
|
1979
1979
|
"3m",
|
|
1980
1980
|
"5m",
|
|
@@ -1985,27 +1985,27 @@ var oi = [
|
|
|
1985
1985
|
"4h",
|
|
1986
1986
|
"1d"
|
|
1987
1987
|
];
|
|
1988
|
-
function
|
|
1988
|
+
function ci(e, t) {
|
|
1989
1989
|
let n = E(e);
|
|
1990
|
-
return n > 0 ?
|
|
1990
|
+
return n > 0 ? si.filter((e) => {
|
|
1991
1991
|
let r = E(e);
|
|
1992
1992
|
return r < n && n % r === 0 && t(e);
|
|
1993
1993
|
}) : [];
|
|
1994
1994
|
}
|
|
1995
|
-
function
|
|
1996
|
-
let r =
|
|
1995
|
+
function li(e, t, n) {
|
|
1996
|
+
let r = ci(t, n);
|
|
1997
1997
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1998
1998
|
let i = E(t);
|
|
1999
1999
|
return r.find((e) => i / E(e) <= 60) ?? null;
|
|
2000
2000
|
}
|
|
2001
2001
|
//#endregion
|
|
2002
2002
|
//#region src/model/AlertWatch.ts
|
|
2003
|
-
function
|
|
2003
|
+
function ui(e, t) {
|
|
2004
2004
|
e.setBarTime(t.barTime);
|
|
2005
2005
|
let n = new Map([["price", t.price]]);
|
|
2006
|
-
t.lines &&
|
|
2006
|
+
t.lines && di(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2008
|
+
function di(e, t, n) {
|
|
2009
2009
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
2010
2010
|
for (let e of r) {
|
|
2011
2011
|
if (n.has(e)) continue;
|
|
@@ -2015,7 +2015,7 @@ function ui(e, t, n) {
|
|
|
2015
2015
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
|
-
function
|
|
2018
|
+
function fi(e, t, n, r) {
|
|
2019
2019
|
let i = (e) => {
|
|
2020
2020
|
let i = e.indexOf(":");
|
|
2021
2021
|
if (i <= 0) return null;
|
|
@@ -2037,35 +2037,35 @@ function di(e, t, n, r) {
|
|
|
2037
2037
|
});
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2040
|
+
function pi(e, t) {
|
|
2041
2041
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2042
2042
|
return r ? r + e.slice(n) : e;
|
|
2043
2043
|
}
|
|
2044
|
-
var
|
|
2044
|
+
var mi = [
|
|
2045
2045
|
"crossing",
|
|
2046
2046
|
"crossingUp",
|
|
2047
2047
|
"crossingDown"
|
|
2048
2048
|
];
|
|
2049
|
-
function
|
|
2049
|
+
function hi(e, t, n, r, i) {
|
|
2050
2050
|
e.clearAlerts();
|
|
2051
2051
|
for (let a of t) {
|
|
2052
2052
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2053
2053
|
if (a.drawingId) {
|
|
2054
|
-
r(a.drawingId) &&
|
|
2054
|
+
r(a.drawingId) && mi.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2055
2055
|
continue;
|
|
2056
2056
|
}
|
|
2057
2057
|
let t = {
|
|
2058
|
-
...
|
|
2059
|
-
...a.target ? { target:
|
|
2058
|
+
...Kt(a),
|
|
2059
|
+
...a.target ? { target: pi(a.target, n) } : {}
|
|
2060
2060
|
};
|
|
2061
2061
|
try {
|
|
2062
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2062
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, pi(a.channel, n), a.label, t);
|
|
2063
2063
|
} catch (e) {
|
|
2064
2064
|
i(e);
|
|
2065
2065
|
}
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
2068
|
-
var
|
|
2068
|
+
var gi = class {
|
|
2069
2069
|
kept = /* @__PURE__ */ new Map();
|
|
2070
2070
|
constructor(e) {
|
|
2071
2071
|
this.alerts = e;
|
|
@@ -2098,18 +2098,18 @@ function Y(e, t) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
return n;
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function _i(e) {
|
|
2102
2102
|
let t = 0, n = 0;
|
|
2103
2103
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
2104
2104
|
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];
|
|
2105
2105
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
2106
2106
|
}
|
|
2107
|
-
function
|
|
2107
|
+
function vi(e) {
|
|
2108
2108
|
let t = [], n = Math.ceil(e.length / 500);
|
|
2109
|
-
for (let r = 0; r < e.length; r += n) t.push(...
|
|
2109
|
+
for (let r = 0; r < e.length; r += n) t.push(..._i(e.slice(r, r + n)));
|
|
2110
2110
|
return t;
|
|
2111
2111
|
}
|
|
2112
|
-
function
|
|
2112
|
+
function yi(e, t, n) {
|
|
2113
2113
|
let r = e[t];
|
|
2114
2114
|
return r ? n.time === null ? {
|
|
2115
2115
|
marks: [[r.close, r.time]],
|
|
@@ -2118,14 +2118,14 @@ function vi(e, t, n) {
|
|
|
2118
2118
|
fraction: n.fraction
|
|
2119
2119
|
}
|
|
2120
2120
|
} : r.time <= n.time ? null : {
|
|
2121
|
-
marks:
|
|
2121
|
+
marks: vi(e.slice(Y(e, n.time), t + 1)),
|
|
2122
2122
|
fed: {
|
|
2123
2123
|
time: r.time,
|
|
2124
2124
|
fraction: n.fraction
|
|
2125
2125
|
}
|
|
2126
2126
|
} : null;
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2128
|
+
function bi(e, t, n, r, i, a) {
|
|
2129
2129
|
let o = e[t];
|
|
2130
2130
|
if (!o) return null;
|
|
2131
2131
|
let s = {
|
|
@@ -2133,7 +2133,7 @@ function yi(e, t, n, r, i, a) {
|
|
|
2133
2133
|
fraction: r
|
|
2134
2134
|
};
|
|
2135
2135
|
if (i.time === null) return {
|
|
2136
|
-
marks: [[
|
|
2136
|
+
marks: [[ai(n, r).close, o.time]],
|
|
2137
2137
|
fed: s
|
|
2138
2138
|
};
|
|
2139
2139
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
@@ -2142,28 +2142,28 @@ function yi(e, t, n, r, i, a) {
|
|
|
2142
2142
|
fed: s
|
|
2143
2143
|
};
|
|
2144
2144
|
let c = [], l = J(e, i.time);
|
|
2145
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...
|
|
2145
|
+
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...vi(e.slice(Y(e, i.time), t))), c.push(...q(n, -1, r)), {
|
|
2146
2146
|
marks: c,
|
|
2147
2147
|
fed: s
|
|
2148
2148
|
};
|
|
2149
2149
|
}
|
|
2150
2150
|
//#endregion
|
|
2151
2151
|
//#region src/Chart.ts
|
|
2152
|
-
var
|
|
2153
|
-
function
|
|
2152
|
+
var xi = "exchange";
|
|
2153
|
+
function Si(e) {
|
|
2154
2154
|
if (typeof e == "string" && e !== "exchange" && !x(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
2155
2155
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2156
2156
|
}
|
|
2157
|
-
var
|
|
2157
|
+
var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
2158
2158
|
ArrowLeft: [-1, 0],
|
|
2159
2159
|
ArrowRight: [1, 0],
|
|
2160
2160
|
ArrowUp: [0, -1],
|
|
2161
2161
|
ArrowDown: [0, 1]
|
|
2162
|
-
},
|
|
2163
|
-
static version = "2.
|
|
2162
|
+
}, Oi = new Set(["horizontalLine", "crossLine"]), ki = new Set(["verticalLine", "crossLine"]), Ai = class {
|
|
2163
|
+
static version = "2.8.0";
|
|
2164
2164
|
engine;
|
|
2165
2165
|
viewport;
|
|
2166
|
-
series = new
|
|
2166
|
+
series = new Wn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2167
2167
|
themeManager;
|
|
2168
2168
|
layoutManager;
|
|
2169
2169
|
pluginManager;
|
|
@@ -2173,6 +2173,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2173
2173
|
drawingManager;
|
|
2174
2174
|
drawingRenderer;
|
|
2175
2175
|
tradingManager;
|
|
2176
|
+
depthLayer = new Pe();
|
|
2176
2177
|
tradingRenderer;
|
|
2177
2178
|
eventBus;
|
|
2178
2179
|
streamManager = null;
|
|
@@ -2190,7 +2191,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2190
2191
|
renderDeferred = !1;
|
|
2191
2192
|
priceAxisWidth = c;
|
|
2192
2193
|
measureCtx;
|
|
2193
|
-
labelWidths = new
|
|
2194
|
+
labelWidths = new Pr();
|
|
2194
2195
|
containerSizeCache = null;
|
|
2195
2196
|
containerSizeCacheTime = 0;
|
|
2196
2197
|
lastEmittedRange = null;
|
|
@@ -2203,7 +2204,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2203
2204
|
unrestoredIndicators = [];
|
|
2204
2205
|
drawingAlerts = null;
|
|
2205
2206
|
zoomAreaMode = !1;
|
|
2206
|
-
priceAxisAddButton = new
|
|
2207
|
+
priceAxisAddButton = new ot();
|
|
2207
2208
|
displayTz = null;
|
|
2208
2209
|
timeZoneSetting = null;
|
|
2209
2210
|
symbolInfo = null;
|
|
@@ -2240,7 +2241,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2240
2241
|
hoveredBadge = null;
|
|
2241
2242
|
tradeZoneManager;
|
|
2242
2243
|
measureOverlay;
|
|
2243
|
-
selectionBoxOverlay = new
|
|
2244
|
+
selectionBoxOverlay = new ht();
|
|
2244
2245
|
replayManager;
|
|
2245
2246
|
replayBarUnsub = null;
|
|
2246
2247
|
replaySeeking = !1;
|
|
@@ -2255,7 +2256,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2255
2256
|
replayForming = null;
|
|
2256
2257
|
replayPhaseUnsub = null;
|
|
2257
2258
|
undoRedoManager;
|
|
2258
|
-
autoSaveScheduler = new
|
|
2259
|
+
autoSaveScheduler = new Ln((e) => this.saveState(e));
|
|
2259
2260
|
animator;
|
|
2260
2261
|
crosshairTooltip;
|
|
2261
2262
|
pinnedTooltip;
|
|
@@ -2267,14 +2268,14 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2267
2268
|
disposed = !1;
|
|
2268
2269
|
chartTypeOptions = {};
|
|
2269
2270
|
mainSeriesVisible = !0;
|
|
2270
|
-
priceLines = new
|
|
2271
|
-
symbolSeries = new
|
|
2271
|
+
priceLines = new st();
|
|
2272
|
+
symbolSeries = new St();
|
|
2272
2273
|
extendedHours = !0;
|
|
2273
2274
|
replayRestarting = !1;
|
|
2274
2275
|
symbolRequests;
|
|
2275
2276
|
gridRenderer;
|
|
2276
2277
|
priceAxis;
|
|
2277
|
-
leftPriceAxis = new
|
|
2278
|
+
leftPriceAxis = new at();
|
|
2278
2279
|
leftScaleRequested = !1;
|
|
2279
2280
|
leftAxisWidth = c;
|
|
2280
2281
|
leftViewport = null;
|
|
@@ -2306,12 +2307,12 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2306
2307
|
snapshotKey = null;
|
|
2307
2308
|
historyCheckQueued = !1;
|
|
2308
2309
|
constructor(e, n) {
|
|
2309
|
-
n.timeZone != null &&
|
|
2310
|
+
n.timeZone != null && Si(n.timeZone), this.container = e, this.options = {
|
|
2310
2311
|
...n,
|
|
2311
2312
|
chartType: n.chartType ?? "candlestick"
|
|
2312
|
-
}, this.numberLocale = n.numberLocale ?? "en-US", this.priceFit = new
|
|
2313
|
+
}, this.numberLocale = n.numberLocale ?? "en-US", this.priceFit = new Kn(n.autoScale !== !1), this.density = n.density === "compact" ? "compact" : "comfortable";
|
|
2313
2314
|
let r = t[this.density];
|
|
2314
|
-
this.priceFit.setSpacing(r), this.display = new
|
|
2315
|
+
this.priceFit.setSpacing(r), this.display = new Yn({
|
|
2315
2316
|
bars: () => this.series.bars(),
|
|
2316
2317
|
version: () => this.series.version(),
|
|
2317
2318
|
chartType: () => this.options.chartType,
|
|
@@ -2319,7 +2320,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2319
2320
|
lookup: (e) => this.pluginManager.getChartType(e),
|
|
2320
2321
|
stepAt: (e) => this.stepAt(e),
|
|
2321
2322
|
onBoxSize: (e) => {
|
|
2322
|
-
this.chartRenderer instanceof
|
|
2323
|
+
this.chartRenderer instanceof it && this.chartRenderer.setBoxSize(e);
|
|
2323
2324
|
}
|
|
2324
2325
|
});
|
|
2325
2326
|
let i = n.features ?? {};
|
|
@@ -2330,6 +2331,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2330
2331
|
drawingUndoRedo: i.drawingUndoRedo ?? !0,
|
|
2331
2332
|
trading: i.trading ?? !0,
|
|
2332
2333
|
tradingContextMenu: i.tradingContextMenu ?? !1,
|
|
2334
|
+
depth: i.depth ?? !1,
|
|
2333
2335
|
priceAxisAddButton: i.priceAxisAddButton ?? !1,
|
|
2334
2336
|
indicators: i.indicators ?? !0,
|
|
2335
2337
|
indicatorIds: i.indicatorIds ?? [],
|
|
@@ -2359,19 +2361,19 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2359
2361
|
logScale: i.logScale ?? !0,
|
|
2360
2362
|
timeframes: i.timeframes ?? [],
|
|
2361
2363
|
defaultTimeframeFavorites: i.defaultTimeframeFavorites ?? []
|
|
2362
|
-
}, 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
|
|
2364
|
+
}, 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 vr({
|
|
2363
2365
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2364
2366
|
prepend: (e) => this.prependBars(e),
|
|
2365
2367
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2366
|
-
}), this.themeManager = new
|
|
2368
|
+
}), this.themeManager = new br(n.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(Sr(n), "host", !1), this.container.style.backgroundColor || (this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background), this.layoutManager = new Er(), this.indicatorEngine = new We(), this.panes = new Zn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new tr(this.indicatorEngine, this.layoutManager, {
|
|
2367
2369
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2368
2370
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2369
2371
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2370
|
-
}), this.symbolRequests = new
|
|
2372
|
+
}), this.symbolRequests = new ur(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Hr(this.indicatorEngine, { plugins: n.plugins }), this.eventBus = new Re(), Jt(this.indicatorEngine), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.indicatorEngine.register(new yt(this.symbolSeries)), this.indicatorEngine.register(new De(this.symbolSeries)), this.indicatorEngine.register(new Oe(this.symbolSeries)), n.indicatorWorker === "auto" && this.useIndicatorWorker(), this.drawingManager = new Fe(), qt(this.drawingManager), this.drawingRenderer = new Ie(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingRenderer.setTimeFormat((e) => this.crosshairHandler.formatTime(e, this.getDisplayData())), this.drawingManager.setRequestRender(() => {
|
|
2371
2373
|
this.syncRenderContext(), this.engine.requestRender(o.Overlay), this.scheduleAutoSave();
|
|
2372
2374
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2373
2375
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2374
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new
|
|
2376
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new Dt(), this.indicatorHistory = new er({
|
|
2375
2377
|
steps: this.undoRedoManager,
|
|
2376
2378
|
snapshot: () => this.getIndicatorSetup(),
|
|
2377
2379
|
enabled: () => this.features.drawingUndoRedo
|
|
@@ -2388,14 +2390,17 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2388
2390
|
primary: e[0] ?? null
|
|
2389
2391
|
})), this.drawingManager.setForeignHistory((e, t) => {
|
|
2390
2392
|
e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
|
|
2391
|
-
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), n.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new
|
|
2393
|
+
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), n.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new Tt({
|
|
2392
2394
|
enabled: this.features.trading,
|
|
2393
2395
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
2394
|
-
}), this.tradingRenderer = new
|
|
2396
|
+
}), this.tradingRenderer = new Et(this.tradingManager), this.depthLayer.setConfig({
|
|
2397
|
+
enabled: this.features.depth,
|
|
2398
|
+
...n.depthOverlay
|
|
2399
|
+
}), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
2395
2400
|
this.eventBus.emit(e, t);
|
|
2396
|
-
}), this.engine = new
|
|
2401
|
+
}), this.engine = new ct(e, n.maxPixelRatio);
|
|
2397
2402
|
let s = this.engine.dprManager.getContainerSize();
|
|
2398
|
-
if (this.viewport = new
|
|
2403
|
+
if (this.viewport = new Ot(s.width, s.height, n.minBarSpacing ?? 2, n.maxBarSpacing ?? 30, n.rightMargin ?? r.rightMargin), this.viewport.setBarLayout(n.barLayout ?? r.barLayout), this.viewport.setScaleMargins({
|
|
2399
2404
|
top: r.priceMargin,
|
|
2400
2405
|
bottom: r.priceMargin
|
|
2401
2406
|
}), this.viewport.setPanLimits({
|
|
@@ -2405,7 +2410,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2405
2410
|
if (e.width <= 0 || e.height <= 0) return;
|
|
2406
2411
|
let t = this.viewport.isAtEnd();
|
|
2407
2412
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2408
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new
|
|
2413
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new ze(), n.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new at(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new Ct(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new ke(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), n.crosshair?.mode && this.crosshairHandler.setMode(n.crosshair.mode), zt(n.crosshair?.cursor) && this.crosshairHandler.setCursor(n.crosshair.cursor), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2409
2414
|
if (e !== null && t) {
|
|
2410
2415
|
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, i = e > 0 ? n[e - 1]?.close : void 0, a = A(n), s = r ? a[e]?.time ?? r.time : void 0;
|
|
2411
2416
|
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(o.Hover);
|
|
@@ -2419,7 +2424,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2419
2424
|
prevClose: i,
|
|
2420
2425
|
priceRange: c.priceRange,
|
|
2421
2426
|
plot: c.chartRect,
|
|
2422
|
-
barStepMs:
|
|
2427
|
+
barStepMs: Pt(a),
|
|
2423
2428
|
timeUnit: f(a)
|
|
2424
2429
|
});
|
|
2425
2430
|
} else this.crosshairTooltip.hide();
|
|
@@ -2435,14 +2440,14 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2435
2440
|
let e = this.crosshairHandler.getSyncedSlot();
|
|
2436
2441
|
e !== null && this.showSyncedBar(e);
|
|
2437
2442
|
}
|
|
2438
|
-
}), this.chartLegend = new Se(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setSpacing(
|
|
2443
|
+
}), this.chartLegend = new Se(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setSpacing(Qi(r)), this.chartLegend.setResizeListener(() => {
|
|
2439
2444
|
this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
|
|
2440
|
-
}), this.watermark = new
|
|
2445
|
+
}), this.watermark = new Mt(), n.watermark && this.watermark.setConfig(n.watermark), this.volumeRenderer = new jt(), this.volumeProfile = new At(), this.marketProfile = new Xe(), this.depthHeatmap = new Ne(), this.periodLevels = new tt(), this.pivotMarkers = new rt(), this.barCountdown = new ve(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new gt(), this.sessionShading = new _t(), this.compareRenderer = new we(), n.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
2441
2446
|
visible: n.sessionBreaks.visible ?? !0,
|
|
2442
2447
|
color: n.sessionBreaks.color,
|
|
2443
2448
|
lineStyle: n.sessionBreaks.lineStyle,
|
|
2444
2449
|
lineWidth: n.sessionBreaks.lineWidth
|
|
2445
|
-
}) : n.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), n.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new Ae(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new
|
|
2450
|
+
}) : n.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), n.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new Ae(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new nt(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), n.priceFormat && this.applyPriceFormat(n.priceFormat), n.chartTypeOptions && (this.chartTypeOptions = w(n.chartTypeOptions)), n.highLowLines && this.priceLines.setHighLow(!0), n.shapes && this.themeManager.setShape(Pi(n.shapes)), n.font && this.themeManager.setFont(Ni(n.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), n.extendedHours === !1 && (this.extendedHours = !1), n.timeFormatter && this.applyTimeFormatter(n.timeFormatter), this.keyboardHandler = new qe({
|
|
2446
2451
|
scrollBars: (e) => {
|
|
2447
2452
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2448
2453
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2459,7 +2464,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2459
2464
|
},
|
|
2460
2465
|
fitContent: () => this.fitContent()
|
|
2461
2466
|
}), this.keyboardHandler.setEnabled(this.features.keyboard), n.a11y !== !1) {
|
|
2462
|
-
this.a11y = new
|
|
2467
|
+
this.a11y = new pn(e, {
|
|
2463
2468
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
2464
2469
|
timeframe: () => this.streamTimeframe ?? "",
|
|
2465
2470
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
@@ -2490,7 +2495,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2490
2495
|
}
|
|
2491
2496
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2492
2497
|
}
|
|
2493
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new je(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new me(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.drawingAlerts = new
|
|
2498
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new je(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new me(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.drawingAlerts = new gi(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(Bt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2494
2499
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2495
2500
|
kind: "alert",
|
|
2496
2501
|
alert: "triggered",
|
|
@@ -2506,7 +2511,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2506
2511
|
this.eventBus.emit("alertExpired", X(e));
|
|
2507
2512
|
}), this.alertManager.on("updated", (e) => {
|
|
2508
2513
|
this.eventBus.emit("alertUpdate", X(e));
|
|
2509
|
-
}), this.signalMarkerManager = new
|
|
2514
|
+
}), this.signalMarkerManager = new vt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
2510
2515
|
this.eventBus.emit("signalMarkerAdd", {
|
|
2511
2516
|
id: e.id,
|
|
2512
2517
|
source: e.source,
|
|
@@ -2514,14 +2519,14 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2514
2519
|
});
|
|
2515
2520
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
2516
2521
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
2517
|
-
}), this.chartMarkManager = new Ce(), this.chartMarkManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.chartMarkManager.setDataGetter(() => this.isTimeAligned() ? this.getDisplayData() : []), this.tradeZoneManager = new
|
|
2522
|
+
}), this.chartMarkManager = new Ce(), this.chartMarkManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.chartMarkManager.setDataGetter(() => this.isTimeAligned() ? this.getDisplayData() : []), this.tradeZoneManager = new wt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
2518
2523
|
this.eventBus.emit("tradeZoneAdd", {
|
|
2519
2524
|
id: e.id,
|
|
2520
2525
|
direction: e.direction
|
|
2521
2526
|
});
|
|
2522
2527
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
2523
2528
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
2524
|
-
}), this.replayManager = new
|
|
2529
|
+
}), this.replayManager = new ut(), this.replayManager.on("complete", () => {
|
|
2525
2530
|
let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
|
|
2526
2531
|
t && this.eventBus.emit("replayComplete", {
|
|
2527
2532
|
barIndex: e,
|
|
@@ -2529,9 +2534,9 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2529
2534
|
});
|
|
2530
2535
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2531
2536
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2532
|
-
}), this.measureOverlay = new
|
|
2533
|
-
let e = new
|
|
2534
|
-
this.interactionManager.setPanHandler(new
|
|
2537
|
+
}), this.measureOverlay = new Ze(), this.interactionManager = new Ge(e), this.features.panning) {
|
|
2538
|
+
let e = new Fr();
|
|
2539
|
+
this.interactionManager.setPanHandler(new $e((t, n) => {
|
|
2535
2540
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2536
2541
|
}, () => e.reset()));
|
|
2537
2542
|
}
|
|
@@ -2543,7 +2548,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2543
2548
|
scales: !this.indicatorEngine.hasLeftScaleOverlays()
|
|
2544
2549
|
}
|
|
2545
2550
|
})), this.features.zooming) {
|
|
2546
|
-
this.interactionManager.setZoomHandler(new
|
|
2551
|
+
this.interactionManager.setZoomHandler(new Nt((e, t) => {
|
|
2547
2552
|
this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
|
|
2548
2553
|
}));
|
|
2549
2554
|
let e = new _e((e) => {
|
|
@@ -2575,7 +2580,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2575
2580
|
y: t.y
|
|
2576
2581
|
});
|
|
2577
2582
|
})), this.interactionManager.setChartContextMenu((e, t) => this.eventBus.hasListeners("chartContextMenu") ? (this.eventBus.emit("chartContextMenu", this.contextAt(e, t)), !0) : !1), this.applyPriceAxisAdd(), this.interactionManager.setPriceAxisAddButton(this.priceAxisAddButton, (e) => {
|
|
2578
|
-
let t =
|
|
2583
|
+
let t = an(e.y, this.viewport.getState());
|
|
2579
2584
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
2580
2585
|
price: t,
|
|
2581
2586
|
x: e.x,
|
|
@@ -2588,7 +2593,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2588
2593
|
let e = new pe(this.alertManager, () => this.viewport.getState());
|
|
2589
2594
|
this.interactionManager.setAlertDragHandler(e);
|
|
2590
2595
|
}
|
|
2591
|
-
let c = new
|
|
2596
|
+
let c = new et();
|
|
2592
2597
|
c.configure(() => this.getResolvedLayout(), (e, t) => this.dragPanelTo(e, t)), this.interactionManager.setPaneResizeHandler(c), this.interactionManager.setAltClickHandler((e) => {
|
|
2593
2598
|
let t = this.getDisplayData();
|
|
2594
2599
|
if (t.length === 0) return;
|
|
@@ -2640,7 +2645,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2640
2645
|
x: e.x,
|
|
2641
2646
|
y: e.y
|
|
2642
2647
|
}), t.length === 0) return;
|
|
2643
|
-
let i =
|
|
2648
|
+
let i = rn(e.x, this.viewport.getState());
|
|
2644
2649
|
i < 0 || i >= t.length || this.eventBus.emit("barClick", {
|
|
2645
2650
|
bar: t[i],
|
|
2646
2651
|
barIndex: i,
|
|
@@ -2685,7 +2690,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2685
2690
|
end: () => {
|
|
2686
2691
|
let e = this.selectionBoxOverlay.end();
|
|
2687
2692
|
if (e && this.zoomAreaMode) {
|
|
2688
|
-
if (e.x1 - e.x0 <
|
|
2693
|
+
if (e.x1 - e.x0 < Ti) return;
|
|
2689
2694
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
2690
2695
|
return;
|
|
2691
2696
|
}
|
|
@@ -2767,7 +2772,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2767
2772
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2768
2773
|
if (t.width <= 0) return;
|
|
2769
2774
|
let { from: n, to: r } = e;
|
|
2770
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2775
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(wi, r - n));
|
|
2771
2776
|
}));
|
|
2772
2777
|
}
|
|
2773
2778
|
useStreamHistory(e, t, n = !0) {
|
|
@@ -2881,7 +2886,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2881
2886
|
return this.extendedHours;
|
|
2882
2887
|
}
|
|
2883
2888
|
sessionKeep(e) {
|
|
2884
|
-
return this.extendedHours ? null :
|
|
2889
|
+
return this.extendedHours ? null : cn(this.symbolInfo, e);
|
|
2885
2890
|
}
|
|
2886
2891
|
reapplyExtendedHours() {
|
|
2887
2892
|
if (!this.series.refilter()) return;
|
|
@@ -2892,7 +2897,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2892
2897
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2893
2898
|
}
|
|
2894
2899
|
setShapes(e) {
|
|
2895
|
-
let t =
|
|
2900
|
+
let t = Pi(e);
|
|
2896
2901
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2897
2902
|
...this.themeManager.getTheme().shape,
|
|
2898
2903
|
...t
|
|
@@ -2904,7 +2909,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2904
2909
|
setFont(e) {
|
|
2905
2910
|
if (e === null) this.themeManager.setFont(null);
|
|
2906
2911
|
else {
|
|
2907
|
-
let t =
|
|
2912
|
+
let t = Ni(e);
|
|
2908
2913
|
if (Object.keys(t).length === 0) return;
|
|
2909
2914
|
this.themeManager.setFont(t);
|
|
2910
2915
|
}
|
|
@@ -2923,7 +2928,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
2923
2928
|
if (e !== "comfortable" && e !== "compact" || e === this.density) return;
|
|
2924
2929
|
this.density = e;
|
|
2925
2930
|
let n = t[e];
|
|
2926
|
-
this.priceFit.setSpacing(n), this.chartLegend.setSpacing(
|
|
2931
|
+
this.priceFit.setSpacing(n), this.chartLegend.setSpacing(Qi(n)), this.options.rightMargin === void 0 && this.viewport.setRightMargin(n.rightMargin), this.options.barLayout || this.viewport.setBarLayout(n.barLayout), this.updateViewportAndRender();
|
|
2927
2932
|
}
|
|
2928
2933
|
getDensity() {
|
|
2929
2934
|
return this.density;
|
|
@@ -3029,8 +3034,8 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3029
3034
|
return {
|
|
3030
3035
|
...e,
|
|
3031
3036
|
priceRange: {
|
|
3032
|
-
min: t.min - n *
|
|
3033
|
-
max: t.max + n *
|
|
3037
|
+
min: t.min - n * Ci,
|
|
3038
|
+
max: t.max + n * Ci
|
|
3034
3039
|
},
|
|
3035
3040
|
logScale: !1,
|
|
3036
3041
|
scaleMode: "regular",
|
|
@@ -3098,8 +3103,8 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3098
3103
|
return t.drawn ? this.indicatorEngine.peekOutput(e) : this.indicatorEngine.getOutput(e);
|
|
3099
3104
|
}
|
|
3100
3105
|
useIndicatorWorker() {
|
|
3101
|
-
this.indicatorWorker =
|
|
3102
|
-
minBars:
|
|
3106
|
+
this.indicatorWorker = Rt.acquire(), this.indicatorEngine.useWorker(this.indicatorWorker.client, {
|
|
3107
|
+
minBars: Ue,
|
|
3103
3108
|
onLand: () => this.indicatorsLandedSoon()
|
|
3104
3109
|
});
|
|
3105
3110
|
}
|
|
@@ -3121,8 +3126,8 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3121
3126
|
return this.pluginManager;
|
|
3122
3127
|
}
|
|
3123
3128
|
static indicators() {
|
|
3124
|
-
let e = new
|
|
3125
|
-
return
|
|
3129
|
+
let e = new We();
|
|
3130
|
+
return Jt(e), e.getAvailableIndicators();
|
|
3126
3131
|
}
|
|
3127
3132
|
setPanelPosition(e, t) {
|
|
3128
3133
|
this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
|
|
@@ -3338,7 +3343,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3338
3343
|
}
|
|
3339
3344
|
autoFib() {
|
|
3340
3345
|
if (!this.features.drawings) return null;
|
|
3341
|
-
let e = this.getDisplayData(), t = this.viewport.getState(), n =
|
|
3346
|
+
let e = this.getDisplayData(), t = this.viewport.getState(), n = Ft(e, t.visibleRange.from, t.visibleRange.to);
|
|
3342
3347
|
return n ? this.addDrawing({
|
|
3343
3348
|
type: "fibRetracement",
|
|
3344
3349
|
anchors: [n[0], n[1]]
|
|
@@ -3351,9 +3356,9 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3351
3356
|
return this.drawingManager.removeDrawings(e);
|
|
3352
3357
|
}
|
|
3353
3358
|
nudgeSelectedDrawings(e) {
|
|
3354
|
-
let t =
|
|
3359
|
+
let t = Di[e.key];
|
|
3355
3360
|
if (!t || !this.features.drawings || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
3356
|
-
let n = e.shiftKey ?
|
|
3361
|
+
let n = e.shiftKey ? Ei : 1, r = {
|
|
3357
3362
|
...this.viewport.getState(),
|
|
3358
3363
|
data: this.getDisplayData()
|
|
3359
3364
|
};
|
|
@@ -3497,7 +3502,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3497
3502
|
x: t.x,
|
|
3498
3503
|
y: t.y
|
|
3499
3504
|
};
|
|
3500
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
3505
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = an(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = P(t.x, n)), e === "pane") {
|
|
3501
3506
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
3502
3507
|
e && (r.pane = e.instanceId);
|
|
3503
3508
|
}
|
|
@@ -3505,7 +3510,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3505
3510
|
}
|
|
3506
3511
|
applyPriceAxisAdd() {
|
|
3507
3512
|
let e = this.features.priceAxisAddButton && this.features.crosshair;
|
|
3508
|
-
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ?
|
|
3513
|
+
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Qe : 0);
|
|
3509
3514
|
}
|
|
3510
3515
|
setPriceAxisAddButton(e) {
|
|
3511
3516
|
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay);
|
|
@@ -3739,7 +3744,13 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3739
3744
|
this.features.trading && this.eventBus.emit("positionModify", e);
|
|
3740
3745
|
}
|
|
3741
3746
|
setDepthData(e) {
|
|
3742
|
-
this.features.trading && this.
|
|
3747
|
+
!this.features.trading && !this.features.depth || (this.depthLayer.setData(e), this.engine.requestRender(o.Overlay));
|
|
3748
|
+
}
|
|
3749
|
+
setDepthOverlay(e) {
|
|
3750
|
+
this.depthLayer.setConfig(e), this.engine.requestRender(o.Overlay);
|
|
3751
|
+
}
|
|
3752
|
+
getDepthOverlay() {
|
|
3753
|
+
return this.depthLayer.getConfig();
|
|
3743
3754
|
}
|
|
3744
3755
|
setCurrentPrice(e, t) {
|
|
3745
3756
|
this.followLivePrice(e), this.replaySession ? this.replaySession.price = { price: e } : (this.currentPriceLine.setPrice(e), this.scheduleRender());
|
|
@@ -3763,23 +3774,23 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3763
3774
|
}
|
|
3764
3775
|
checkAlerts(e) {
|
|
3765
3776
|
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.indicatorEngine, r = this.replaySession || this.series.length() === 0 ? null : (e) => n.isComputingInWorker(e) ? void 0 : n.peekOutput(e)?.series;
|
|
3766
|
-
|
|
3777
|
+
ui(this.alertManager, {
|
|
3767
3778
|
price: e,
|
|
3768
3779
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3769
3780
|
lines: r
|
|
3770
3781
|
});
|
|
3771
3782
|
}
|
|
3772
3783
|
setTradingConfig(e) {
|
|
3773
|
-
this.features.trading && this.tradingManager.setConfig(e);
|
|
3784
|
+
this.features.trading && (this.tradingManager.setConfig(e), e.depthOverlay && this.setDepthOverlay(e.depthOverlay));
|
|
3774
3785
|
}
|
|
3775
3786
|
async connect(e) {
|
|
3776
3787
|
let t = {
|
|
3777
3788
|
...e,
|
|
3778
|
-
adapter:
|
|
3789
|
+
adapter: Xt(e),
|
|
3779
3790
|
feed: void 0
|
|
3780
3791
|
};
|
|
3781
|
-
if (!
|
|
3782
|
-
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new
|
|
3792
|
+
if (!Yt(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
3793
|
+
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new xt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (e) => {
|
|
3783
3794
|
let n = this.streamSeriesKey(t.adapter);
|
|
3784
3795
|
n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(e) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(e) : (this.replaySession && this.useStreamHistory(t.adapter, t.historyPageSize, !1), this.setData(e)), this.snapshotKey = n, this.useStreamHistory(t.adapter, t.historyPageSize);
|
|
3785
3796
|
}), this.streamManager.on("barClose", (e) => {
|
|
@@ -3841,7 +3852,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3841
3852
|
}, 1e3);
|
|
3842
3853
|
}
|
|
3843
3854
|
streamSeriesKey(e) {
|
|
3844
|
-
let t = N(e), n = this.streamTimeframe, r = t instanceof
|
|
3855
|
+
let t = N(e), n = this.streamTimeframe, r = t instanceof dt && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3845
3856
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3846
3857
|
}
|
|
3847
3858
|
setStreamTarget(e, t) {
|
|
@@ -3864,7 +3875,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3864
3875
|
async switchStream(e, t) {
|
|
3865
3876
|
if (!this.streamManager) return;
|
|
3866
3877
|
let n = this.streamAdapter;
|
|
3867
|
-
if (n && !
|
|
3878
|
+
if (n && !Yt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
3868
3879
|
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(E(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
|
|
3869
3880
|
}
|
|
3870
3881
|
isIndicatorAllowed(e) {
|
|
@@ -3884,7 +3895,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
3884
3895
|
}
|
|
3885
3896
|
connectExecution(e, t = {}) {
|
|
3886
3897
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3887
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3898
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Gr(e, {
|
|
3888
3899
|
onIntent: (e, t) => {
|
|
3889
3900
|
let n = (e) => t(e.payload);
|
|
3890
3901
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -4015,7 +4026,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4015
4026
|
setVisibleRangePreset(e) {
|
|
4016
4027
|
let t = this.getDisplayData();
|
|
4017
4028
|
if (t.length === 0) return;
|
|
4018
|
-
let n = t.length - 1, r = f(t), i =
|
|
4029
|
+
let n = t.length - 1, r = f(t), i = Gt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
4019
4030
|
if (a === null || a < t[0].time) {
|
|
4020
4031
|
this.fitContent();
|
|
4021
4032
|
return;
|
|
@@ -4200,14 +4211,14 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4200
4211
|
return this.crosshairHandler.getMode();
|
|
4201
4212
|
}
|
|
4202
4213
|
setCrosshairCursor(e) {
|
|
4203
|
-
!
|
|
4214
|
+
!zt(e) || e === this.crosshairHandler.getCursor() || (this.crosshairHandler.setCursor(e), this.applyIdleCursor(), this.engine.requestRender(o.Hover), this.eventBus.emit("crosshairCursorChange", { cursor: e }));
|
|
4204
4215
|
}
|
|
4205
4216
|
getCrosshairCursor() {
|
|
4206
4217
|
return this.crosshairHandler.getCursor();
|
|
4207
4218
|
}
|
|
4208
4219
|
applyIdleCursor() {
|
|
4209
4220
|
let e = this.themeManager.getTheme(), t = e.style?.crosshair.vertical.color ?? e.crosshair;
|
|
4210
|
-
this.interactionManager.setIdleCursor(
|
|
4221
|
+
this.interactionManager.setIdleCursor(Lt(this.crosshairHandler.getCursor(), t, e.background));
|
|
4211
4222
|
}
|
|
4212
4223
|
setCrosshairPosition(e) {
|
|
4213
4224
|
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(o.Hover);
|
|
@@ -4302,7 +4313,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4302
4313
|
return this.periodLevels.getPeriod();
|
|
4303
4314
|
}
|
|
4304
4315
|
setTimeZone(e) {
|
|
4305
|
-
|
|
4316
|
+
Si(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
4306
4317
|
}
|
|
4307
4318
|
getTimeZone() {
|
|
4308
4319
|
return this.timeZoneSetting;
|
|
@@ -4323,7 +4334,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4323
4334
|
this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
|
|
4324
4335
|
}
|
|
4325
4336
|
holdStudyZone() {
|
|
4326
|
-
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(),
|
|
4337
|
+
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), mt);
|
|
4327
4338
|
}
|
|
4328
4339
|
endStudyZoneWait() {
|
|
4329
4340
|
this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
|
|
@@ -4415,7 +4426,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4415
4426
|
return this.sessionShading.isVisible();
|
|
4416
4427
|
}
|
|
4417
4428
|
setSessionShadingConfig(e) {
|
|
4418
|
-
this.hostSessionHours =
|
|
4429
|
+
this.hostSessionHours = Ut(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(o.Background);
|
|
4419
4430
|
}
|
|
4420
4431
|
setTooltipVisible(e) {
|
|
4421
4432
|
e || this.crosshairTooltip.hide();
|
|
@@ -4437,11 +4448,11 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4437
4448
|
return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
|
|
4438
4449
|
}
|
|
4439
4450
|
async takeGpu(e, t, n) {
|
|
4440
|
-
let { gpu: r, reason: i } = await
|
|
4441
|
-
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ?
|
|
4451
|
+
let { gpu: r, reason: i } = await Ht(e);
|
|
4452
|
+
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? It() > 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());
|
|
4442
4453
|
}
|
|
4443
4454
|
waitForGpu(e) {
|
|
4444
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
4455
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? nn(e) : null;
|
|
4445
4456
|
}
|
|
4446
4457
|
getRenderer() {
|
|
4447
4458
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -4641,7 +4652,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4641
4652
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
4642
4653
|
if (!this.replaySession) {
|
|
4643
4654
|
if (this.series.length() === 0) return;
|
|
4644
|
-
this.series.beginReplay(), this.replaySession =
|
|
4655
|
+
this.series.beginReplay(), this.replaySession = zi(this.currentSymbol);
|
|
4645
4656
|
}
|
|
4646
4657
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4647
4658
|
c.animate = c.animate === !0;
|
|
@@ -4652,13 +4663,13 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4652
4663
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4653
4664
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4654
4665
|
let h = this.replayStepsSeries;
|
|
4655
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4666
|
+
h && c.startIndex !== void 0 && (c.startIndex = qi(h, p, c.startIndex));
|
|
4656
4667
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4657
4668
|
this.revealReplayMarks(this.replayRevealMarks ? _?.time ?? null : null), n.held && (n.held.state = c.paused ? "paused" : "playing", c.paused = !0), !c.paused && c.startIndex !== void 0 && c.startIndex >= 1 && this.replaySeek(c.startIndex - 1), this.replayManager.play(c);
|
|
4658
4669
|
}
|
|
4659
4670
|
buildReplay(e, t, n) {
|
|
4660
4671
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4661
|
-
this.replayPieces = r && t ?
|
|
4672
|
+
this.replayPieces = r && t ? Xi(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4662
4673
|
let a = this.replayRestarting;
|
|
4663
4674
|
this.replayRestarting = !0;
|
|
4664
4675
|
try {
|
|
@@ -4672,7 +4683,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4672
4683
|
let n = t, a = e[t];
|
|
4673
4684
|
if (i) {
|
|
4674
4685
|
let r = i[t];
|
|
4675
|
-
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ?
|
|
4686
|
+
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? $i(c, r) : Ji(e[n], i, t), a = Yi(i, e, t, n) ? e[n] : c;
|
|
4676
4687
|
}
|
|
4677
4688
|
let u = this.replayForming;
|
|
4678
4689
|
this.replayForming = null, s = t;
|
|
@@ -4696,7 +4707,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4696
4707
|
});
|
|
4697
4708
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4698
4709
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4699
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4710
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Zi() ? oi(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = ai(r, i);
|
|
4700
4711
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4701
4712
|
index: t,
|
|
4702
4713
|
path: r
|
|
@@ -4714,19 +4725,19 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4714
4725
|
}
|
|
4715
4726
|
replayPathOf(e, t) {
|
|
4716
4727
|
let n = e[t];
|
|
4717
|
-
return
|
|
4728
|
+
return ei(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4718
4729
|
}
|
|
4719
4730
|
loadReplaySteps(e, t) {
|
|
4720
4731
|
let n = this.replayLoader?.loader;
|
|
4721
4732
|
if (!n) return;
|
|
4722
4733
|
n.evictBefore(e[t].time);
|
|
4723
4734
|
let r = this.replayManager.getStepMs();
|
|
4724
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
4735
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(Fi / r) : 1);
|
|
4725
4736
|
}
|
|
4726
4737
|
useReplayLoader(e, t) {
|
|
4727
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4738
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? li(e.step, r, (e) => Yt(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
4728
4739
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4729
|
-
let o = N(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new
|
|
4740
|
+
let o = N(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new qr({
|
|
4730
4741
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4731
4742
|
step: i,
|
|
4732
4743
|
ratio: Math.max(1, Math.round(l / E(i))),
|
|
@@ -4742,7 +4753,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4742
4753
|
feedReplayForming(e, t, n, r) {
|
|
4743
4754
|
let i = this.replaySession;
|
|
4744
4755
|
if (!i || !this.executionAdapter?.setMarkPrice) return;
|
|
4745
|
-
let a =
|
|
4756
|
+
let a = bi(e, t, n, r, {
|
|
4746
4757
|
time: i.fedTime,
|
|
4747
4758
|
fraction: i.fedFraction
|
|
4748
4759
|
}, (e, t) => this.replayPathOf(e, t));
|
|
@@ -4766,7 +4777,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4766
4777
|
if (n.length === 0) return;
|
|
4767
4778
|
let r = t.windowTime === null ? 0 : Math.min(J(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4768
4779
|
this.useReplayLoader(t, !1);
|
|
4769
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4780
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Hi(o ?? i, t.until);
|
|
4770
4781
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4771
4782
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4772
4783
|
return;
|
|
@@ -4774,7 +4785,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4774
4785
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4775
4786
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4776
4787
|
let d = this.replayManager.remainingMs();
|
|
4777
|
-
this.clearBarHolders(), t.animate &&
|
|
4788
|
+
this.clearBarHolders(), t.animate && Vi(t, this.replayCoarse, i);
|
|
4778
4789
|
let f = this.replayRestarting;
|
|
4779
4790
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4780
4791
|
try {
|
|
@@ -4797,14 +4808,14 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4797
4808
|
}
|
|
4798
4809
|
replayStepsOver(e, t, n = !1) {
|
|
4799
4810
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4800
|
-
let r =
|
|
4801
|
-
return r && (n ||
|
|
4811
|
+
let r = Ki(this.series.inHoursShown(e.steps), t);
|
|
4812
|
+
return r && (n || Wi(r, t)) ? r : null;
|
|
4802
4813
|
}
|
|
4803
4814
|
canPageBackForReplay(e) {
|
|
4804
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4815
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < Ii;
|
|
4805
4816
|
}
|
|
4806
4817
|
async pageBackForReplay(e) {
|
|
4807
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4818
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = Ii, this.rebaseReplay("older"));
|
|
4808
4819
|
}
|
|
4809
4820
|
holdReplay() {
|
|
4810
4821
|
let e = this.replaySession;
|
|
@@ -4837,7 +4848,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4837
4848
|
this.signalMarkerManager.setRevealUntil(e, t), this.chartMarkManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4838
4849
|
}
|
|
4839
4850
|
replaySeekToTime(e) {
|
|
4840
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4851
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, Hi(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4841
4852
|
}
|
|
4842
4853
|
feedReplayPrice(e, t) {
|
|
4843
4854
|
let n = this.executionAdapter;
|
|
@@ -4852,7 +4863,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4852
4863
|
feedReplaySteps(e, t) {
|
|
4853
4864
|
let n = this.replaySession;
|
|
4854
4865
|
if (!n || !this.executionAdapter?.setMarkPrice) return;
|
|
4855
|
-
let r =
|
|
4866
|
+
let r = yi(e, t, {
|
|
4856
4867
|
time: n.fedTime,
|
|
4857
4868
|
fraction: n.fedFraction
|
|
4858
4869
|
});
|
|
@@ -4866,7 +4877,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4866
4877
|
}
|
|
4867
4878
|
replaySeekToBar(e) {
|
|
4868
4879
|
let t = this.replayStepsSeries;
|
|
4869
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4880
|
+
this.replaySeek(t && this.replayCoarse ? qi(t, this.replayCoarse, e) : e);
|
|
4870
4881
|
}
|
|
4871
4882
|
replayPause() {
|
|
4872
4883
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4907,7 +4918,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4907
4918
|
let { x: r, y: c } = this.drawingManager.anchorPoint(t.type, e, n);
|
|
4908
4919
|
i = Math.min(i, r), a = Math.max(a, r), o = Math.min(o, c), s = Math.max(s, c);
|
|
4909
4920
|
}
|
|
4910
|
-
if (
|
|
4921
|
+
if (Oi.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), ki.has(t.type) && ([o, s] = [r.y, r.y + r.height]), a < r.x || i > r.x + r.width || s < r.y || o > r.y + r.height) return null;
|
|
4911
4922
|
let c = this.drawingManager.drawnExtent(e);
|
|
4912
4923
|
return c && (i = Math.min(i, c.x), a = Math.max(a, c.x + c.width), o = Math.min(o, c.y), s = Math.max(s, c.y + c.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 ? {
|
|
4913
4924
|
x: i,
|
|
@@ -4958,12 +4969,12 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4958
4969
|
});
|
|
4959
4970
|
}
|
|
4960
4971
|
restoreIndicators(e, t) {
|
|
4961
|
-
let n =
|
|
4972
|
+
let n = ir(e), r = /* @__PURE__ */ new Map();
|
|
4962
4973
|
this.unrestoredIndicators = [];
|
|
4963
4974
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4964
4975
|
if (t) {
|
|
4965
4976
|
let e = this.getIndicatorSetup();
|
|
4966
|
-
for (let t of
|
|
4977
|
+
for (let t of or(e, n)) o.add(t);
|
|
4967
4978
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4968
4979
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4969
4980
|
for (let e = !0; e;) {
|
|
@@ -4974,7 +4985,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
4974
4985
|
}
|
|
4975
4986
|
}
|
|
4976
4987
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4977
|
-
let s = (e) =>
|
|
4988
|
+
let s = (e) => cr(e, r);
|
|
4978
4989
|
for (let e of n) {
|
|
4979
4990
|
let n = null;
|
|
4980
4991
|
if (o.has(e.instanceId)) {
|
|
@@ -5007,7 +5018,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5007
5018
|
}
|
|
5008
5019
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
5009
5020
|
}
|
|
5010
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
5021
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), rr(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
5011
5022
|
}
|
|
5012
5023
|
restoreLooks(e, t) {
|
|
5013
5024
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -5027,7 +5038,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5027
5038
|
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? oe(t.paneStyle) : null);
|
|
5028
5039
|
}
|
|
5029
5040
|
getIndicatorSetup() {
|
|
5030
|
-
return [...
|
|
5041
|
+
return [...nr(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
5031
5042
|
}
|
|
5032
5043
|
applyIndicatorSetup(e) {
|
|
5033
5044
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -5036,7 +5047,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5036
5047
|
});
|
|
5037
5048
|
}
|
|
5038
5049
|
followIndicatorAlerts(e, t) {
|
|
5039
|
-
this.features.alerts &&
|
|
5050
|
+
this.features.alerts && fi(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
5040
5051
|
}
|
|
5041
5052
|
beginIndicatorEdit(e) {
|
|
5042
5053
|
this.indicatorHistory.begin(e);
|
|
@@ -5060,17 +5071,17 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5060
5071
|
keptPaneDrawings = [];
|
|
5061
5072
|
replayingIndicatorStep = !1;
|
|
5062
5073
|
takesDrawing(e, t) {
|
|
5063
|
-
return
|
|
5074
|
+
return mr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
5064
5075
|
}
|
|
5065
5076
|
renamePane(e, t) {
|
|
5066
5077
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
5067
5078
|
}
|
|
5068
5079
|
drawingPaneAt(e) {
|
|
5069
|
-
return
|
|
5080
|
+
return fr(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
5070
5081
|
}
|
|
5071
5082
|
drawingPaneViewport(e) {
|
|
5072
5083
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
5073
|
-
return
|
|
5084
|
+
return pr(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
5074
5085
|
}
|
|
5075
5086
|
saveState(e) {
|
|
5076
5087
|
if (!this.features.saveLoad) return null;
|
|
@@ -5084,7 +5095,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5084
5095
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
5085
5096
|
this.drawingManager.renamePanes(n);
|
|
5086
5097
|
let r = new Set(this.unrestoredIndicators.map((e) => e.instanceId)), i = this.drawingManager.getDrawings(), a = i.filter((e) => e.paneId === void 0 || this.takesDrawing(e.paneId, e.type));
|
|
5087
|
-
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts &&
|
|
5098
|
+
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts && hi(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
5088
5099
|
console.warn("Layout alert left out:", e);
|
|
5089
5100
|
}), this.markStateChanged();
|
|
5090
5101
|
}
|
|
@@ -5137,7 +5148,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5137
5148
|
}
|
|
5138
5149
|
setFeatures(e) {
|
|
5139
5150
|
let t = this.getLegendBottom();
|
|
5140
|
-
Object.assign(this.features, e), e.legend !== void 0 && this.getLegendBottom() !== t && this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), (e.priceAxisAddButton !== void 0 || e.crosshair !== void 0) && (this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay)), e.grid !== void 0 && this.engine.requestRender(o.Background), e.marks !== void 0 && (e.marks || this.dropMarkHover(), this.engine.requestRender(o.Overlay)), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.updateViewportAndRender()), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
|
|
5151
|
+
Object.assign(this.features, e), e.depth !== void 0 && this.setDepthOverlay({ enabled: e.depth }), e.legend !== void 0 && this.getLegendBottom() !== t && this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), (e.priceAxisAddButton !== void 0 || e.crosshair !== void 0) && (this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay)), e.grid !== void 0 && this.engine.requestRender(o.Background), e.marks !== void 0 && (e.marks || this.dropMarkHover(), this.engine.requestRender(o.Overlay)), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.updateViewportAndRender()), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
|
|
5141
5152
|
}
|
|
5142
5153
|
resize() {
|
|
5143
5154
|
let e = this.engine.dprManager.readContainerSize();
|
|
@@ -5152,8 +5163,8 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5152
5163
|
this.disposed = !0, this.indicatorEngine.stopWorker(), this.indicatorWorker?.release(), this.indicatorWorker = null, 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 = "";
|
|
5153
5164
|
}
|
|
5154
5165
|
createChartRenderer(e) {
|
|
5155
|
-
let t =
|
|
5156
|
-
return t instanceof
|
|
5166
|
+
let t = Fn(e, (e) => this.pluginManager.getChartType(e));
|
|
5167
|
+
return t instanceof Ve && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5157
5168
|
}
|
|
5158
5169
|
crosshairSeries() {
|
|
5159
5170
|
return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
|
|
@@ -5230,7 +5241,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5230
5241
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5231
5242
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5232
5243
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5233
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5244
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && qn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5234
5245
|
});
|
|
5235
5246
|
}
|
|
5236
5247
|
updateViewportAndRender(e = !1) {
|
|
@@ -5245,7 +5256,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5245
5256
|
fitLeftAxisWidth() {
|
|
5246
5257
|
let e = this.leftViewport;
|
|
5247
5258
|
if (!e) return !1;
|
|
5248
|
-
let t = this.themeManager.getTheme(), n =
|
|
5259
|
+
let t = this.themeManager.getTheme(), n = jr({
|
|
5249
5260
|
min: e.priceRange.min,
|
|
5250
5261
|
max: e.priceRange.max,
|
|
5251
5262
|
lastPrice: null,
|
|
@@ -5254,12 +5265,12 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5254
5265
|
fontFamily: t.font.family,
|
|
5255
5266
|
fontSizeSmall: t.font.sizeSmall,
|
|
5256
5267
|
measure: (e, t) => this.measureText(e, t)
|
|
5257
|
-
}), r =
|
|
5268
|
+
}), r = Mr(this.leftAxisWidth, n);
|
|
5258
5269
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5259
5270
|
}
|
|
5260
5271
|
fitPriceAxisWidth() {
|
|
5261
5272
|
if (!this.features.priceAxis) return !1;
|
|
5262
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5273
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = jr({
|
|
5263
5274
|
min: e.min,
|
|
5264
5275
|
max: e.max,
|
|
5265
5276
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5270,14 +5281,14 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5270
5281
|
fontFamily: t.font.family,
|
|
5271
5282
|
fontSizeSmall: t.font.sizeSmall,
|
|
5272
5283
|
measure: (e, t) => this.measureText(e, t)
|
|
5273
|
-
}), r =
|
|
5284
|
+
}), r = Mr(this.priceAxisWidth, n);
|
|
5274
5285
|
return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5275
5286
|
}
|
|
5276
5287
|
measureText(e, t) {
|
|
5277
5288
|
let n = this.engine.layerManager.getLayer(o.Main)?.ctx;
|
|
5278
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
5289
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => ji(n, e, t));
|
|
5279
5290
|
let r = n ?? this.detachedMeasureContext();
|
|
5280
|
-
return r ?
|
|
5291
|
+
return r ? ji(r, e, t) : e.length * 7;
|
|
5281
5292
|
}
|
|
5282
5293
|
detachedMeasureContext() {
|
|
5283
5294
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -5326,6 +5337,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5326
5337
|
indicatorEngine: this.features.indicators ? this.indicatorEngine : null,
|
|
5327
5338
|
drawingRenderer: this.features.drawings ? this.drawingRenderer : null,
|
|
5328
5339
|
tradingRenderer: this.features.trading ? this.tradingRenderer : null,
|
|
5340
|
+
depthOverlay: this.features.trading || this.features.depth ? this.depthLayer : null,
|
|
5329
5341
|
currentPriceLine: this.currentPriceLine,
|
|
5330
5342
|
chartLegend: this.features.legend ? this.chartLegend : null,
|
|
5331
5343
|
volumeRenderer: this.features.volume ? this.volumeRenderer : null,
|
|
@@ -5366,7 +5378,7 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5366
5378
|
});
|
|
5367
5379
|
}
|
|
5368
5380
|
drawOverlayPlugins(e, t) {
|
|
5369
|
-
let n =
|
|
5381
|
+
let n = Lr(this.pluginManager.getOverlays(), t);
|
|
5370
5382
|
if (n.length === 0) return;
|
|
5371
5383
|
let r = {
|
|
5372
5384
|
viewport: this.viewport.getState(),
|
|
@@ -5387,15 +5399,15 @@ var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
|
5387
5399
|
};
|
|
5388
5400
|
}
|
|
5389
5401
|
};
|
|
5390
|
-
function
|
|
5402
|
+
function ji(e, t, n) {
|
|
5391
5403
|
let r = e.font;
|
|
5392
5404
|
e.font = n;
|
|
5393
5405
|
let i = e.measureText(t).width;
|
|
5394
5406
|
return e.font = r, i;
|
|
5395
5407
|
}
|
|
5396
|
-
var
|
|
5397
|
-
function
|
|
5398
|
-
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <=
|
|
5408
|
+
var Mi = 300;
|
|
5409
|
+
function Ni(e) {
|
|
5410
|
+
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <= Mi && !/[;{}<>\\]|\/\*/.test(e);
|
|
5399
5411
|
n(e.family) && (t.family = e.family), n(e.textFamily) && (t.textFamily = e.textFamily);
|
|
5400
5412
|
for (let n of [
|
|
5401
5413
|
"sizeSmall",
|
|
@@ -5407,7 +5419,7 @@ function Mi(e) {
|
|
|
5407
5419
|
}
|
|
5408
5420
|
return t;
|
|
5409
5421
|
}
|
|
5410
|
-
function
|
|
5422
|
+
function Pi(e) {
|
|
5411
5423
|
let t = e.tagRadius;
|
|
5412
5424
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
5413
5425
|
}
|
|
@@ -5426,8 +5438,8 @@ function X(e) {
|
|
|
5426
5438
|
bars: e.bars
|
|
5427
5439
|
};
|
|
5428
5440
|
}
|
|
5429
|
-
var
|
|
5430
|
-
function
|
|
5441
|
+
var Fi = 8e3, Ii = 10, Li = 50, Ri = .001;
|
|
5442
|
+
function zi(e) {
|
|
5431
5443
|
return {
|
|
5432
5444
|
price: null,
|
|
5433
5445
|
fedTime: null,
|
|
@@ -5442,48 +5454,48 @@ function Ri(e) {
|
|
|
5442
5454
|
held: null
|
|
5443
5455
|
};
|
|
5444
5456
|
}
|
|
5445
|
-
function
|
|
5457
|
+
function Bi(e, t) {
|
|
5446
5458
|
let n = e[t + 1];
|
|
5447
|
-
return n ? n.time - e[t].time :
|
|
5459
|
+
return n ? n.time - e[t].time : Gi(e);
|
|
5448
5460
|
}
|
|
5449
|
-
function
|
|
5461
|
+
function Vi(e, t, n) {
|
|
5450
5462
|
let r = e.fedTime;
|
|
5451
5463
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5452
|
-
let i =
|
|
5464
|
+
let i = Bi(t, Z(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Z(n, a), s = n[o].time;
|
|
5453
5465
|
if (s > a) return;
|
|
5454
|
-
let c =
|
|
5466
|
+
let c = Bi(n, o);
|
|
5455
5467
|
if (a === s && o > 0) {
|
|
5456
5468
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
5457
5469
|
return;
|
|
5458
5470
|
}
|
|
5459
5471
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5460
5472
|
}
|
|
5461
|
-
function
|
|
5473
|
+
function Hi(e, t) {
|
|
5462
5474
|
let n = Y(e, t), r = e.length - 1;
|
|
5463
|
-
return n > r && r >= 0 && e[r].time +
|
|
5475
|
+
return n > r && r >= 0 && e[r].time + Gi(e) <= t ? r : Math.max(-1, n - 2);
|
|
5464
5476
|
}
|
|
5465
|
-
function
|
|
5477
|
+
function Ui(e) {
|
|
5466
5478
|
let t = Infinity;
|
|
5467
5479
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
5468
5480
|
return t;
|
|
5469
5481
|
}
|
|
5470
|
-
function
|
|
5471
|
-
if (!(
|
|
5472
|
-
let n = Math.max(0, e.length -
|
|
5482
|
+
function Wi(e, t) {
|
|
5483
|
+
if (!(Ui(e) < Ui(t))) return !1;
|
|
5484
|
+
let n = Math.max(0, e.length - Li);
|
|
5473
5485
|
for (let r = n; r < e.length; r++) {
|
|
5474
|
-
let n = t[Z(t, e[r].time)], i = (n.high - n.low) *
|
|
5486
|
+
let n = t[Z(t, e[r].time)], i = (n.high - n.low) * Ri + 2 ** -52;
|
|
5475
5487
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5476
5488
|
}
|
|
5477
5489
|
return !0;
|
|
5478
5490
|
}
|
|
5479
|
-
function
|
|
5491
|
+
function Gi(e) {
|
|
5480
5492
|
let t = 0;
|
|
5481
5493
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5482
5494
|
return t > 0 ? t : Infinity;
|
|
5483
5495
|
}
|
|
5484
|
-
function
|
|
5496
|
+
function Ki(e, t) {
|
|
5485
5497
|
if (t.length === 0) return null;
|
|
5486
|
-
let n = t[t.length - 1].time +
|
|
5498
|
+
let n = t[t.length - 1].time + Gi(t), r = e.filter((e) => Un(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5487
5499
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5488
5500
|
if (i.length === 0) return null;
|
|
5489
5501
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5499,26 +5511,26 @@ function Z(e, t) {
|
|
|
5499
5511
|
}
|
|
5500
5512
|
return n;
|
|
5501
5513
|
}
|
|
5502
|
-
function
|
|
5514
|
+
function qi(e, t, n) {
|
|
5503
5515
|
let r = Math.max(0, Math.min(Math.floor(Number.isFinite(n) ? n : 0), t.length - 1)), i = r + 1 < t.length ? t[r + 1].time : Infinity, a = -1;
|
|
5504
5516
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5505
5517
|
return Math.max(0, a);
|
|
5506
5518
|
}
|
|
5507
|
-
function
|
|
5519
|
+
function Ji(e, t, n) {
|
|
5508
5520
|
let r = n;
|
|
5509
5521
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5510
5522
|
let i = {
|
|
5511
5523
|
...t[r],
|
|
5512
5524
|
time: e.time
|
|
5513
5525
|
};
|
|
5514
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5526
|
+
for (let e = r + 1; e <= n; e++) i = $i(i, t[e]);
|
|
5515
5527
|
return i;
|
|
5516
5528
|
}
|
|
5517
|
-
function
|
|
5529
|
+
function Yi(e, t, n, r) {
|
|
5518
5530
|
let i = e[n + 1], a = t[r + 1];
|
|
5519
5531
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5520
5532
|
}
|
|
5521
|
-
function
|
|
5533
|
+
function Xi(e, t) {
|
|
5522
5534
|
let n = /* @__PURE__ */ new Map();
|
|
5523
5535
|
for (let r of e) {
|
|
5524
5536
|
let e = t[Z(t, r.time)].time, i = n.get(e);
|
|
@@ -5526,17 +5538,17 @@ function Yi(e, t) {
|
|
|
5526
5538
|
}
|
|
5527
5539
|
return n;
|
|
5528
5540
|
}
|
|
5529
|
-
function
|
|
5541
|
+
function Zi() {
|
|
5530
5542
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5531
5543
|
}
|
|
5532
|
-
function
|
|
5544
|
+
function Qi(e) {
|
|
5533
5545
|
return {
|
|
5534
5546
|
inset: e.legendInset,
|
|
5535
5547
|
top: e.legendTop,
|
|
5536
5548
|
lineGap: e.legendLineGap
|
|
5537
5549
|
};
|
|
5538
5550
|
}
|
|
5539
|
-
function
|
|
5551
|
+
function $i(e, t) {
|
|
5540
5552
|
return {
|
|
5541
5553
|
time: e.time,
|
|
5542
5554
|
open: e.open,
|
|
@@ -5548,26 +5560,26 @@ function Qi(e, t) {
|
|
|
5548
5560
|
}
|
|
5549
5561
|
//#endregion
|
|
5550
5562
|
//#region src/io/parseOHLCV.ts
|
|
5551
|
-
var
|
|
5563
|
+
var ea = [
|
|
5552
5564
|
"time",
|
|
5553
5565
|
"timestamp",
|
|
5554
5566
|
"date",
|
|
5555
5567
|
"datetime",
|
|
5556
5568
|
"t"
|
|
5557
|
-
],
|
|
5569
|
+
], ta = ["open", "o"], na = ["high", "h"], ra = ["low", "l"], ia = ["close", "c"], aa = [
|
|
5558
5570
|
"volume",
|
|
5559
5571
|
"vol",
|
|
5560
5572
|
"v"
|
|
5561
5573
|
];
|
|
5562
|
-
function
|
|
5574
|
+
function oa(e) {
|
|
5563
5575
|
let t = e.trim();
|
|
5564
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5576
|
+
return t ? t[0] === "[" || t[0] === "{" ? sa(t) : ca(t) : {
|
|
5565
5577
|
data: [],
|
|
5566
5578
|
rowCount: 0,
|
|
5567
5579
|
skipped: 0
|
|
5568
5580
|
};
|
|
5569
5581
|
}
|
|
5570
|
-
function
|
|
5582
|
+
function sa(e) {
|
|
5571
5583
|
let t;
|
|
5572
5584
|
try {
|
|
5573
5585
|
t = JSON.parse(e);
|
|
@@ -5577,19 +5589,19 @@ function oa(e) {
|
|
|
5577
5589
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5578
5590
|
let n = [], r = 0;
|
|
5579
5591
|
for (let e of t) {
|
|
5580
|
-
let t = Array.isArray(e) ?
|
|
5592
|
+
let t = Array.isArray(e) ? pa(e) : fa(e);
|
|
5581
5593
|
t ? n.push(t) : r++;
|
|
5582
5594
|
}
|
|
5583
|
-
return
|
|
5595
|
+
return ha(n, t.length, r);
|
|
5584
5596
|
}
|
|
5585
|
-
function
|
|
5597
|
+
function ca(e) {
|
|
5586
5598
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5587
5599
|
if (t.length === 0) return {
|
|
5588
5600
|
data: [],
|
|
5589
5601
|
rowCount: 0,
|
|
5590
5602
|
skipped: 0
|
|
5591
5603
|
};
|
|
5592
|
-
let n =
|
|
5604
|
+
let n = la(t[0]), r = ua(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? da(r) : {
|
|
5593
5605
|
time: 0,
|
|
5594
5606
|
open: 1,
|
|
5595
5607
|
high: 2,
|
|
@@ -5600,7 +5612,7 @@ function sa(e) {
|
|
|
5600
5612
|
if (a.time < 0 || a.open < 0 || a.high < 0 || a.low < 0 || a.close < 0) throw Error("CSV is missing required column(s): time, open, high, low, close");
|
|
5601
5613
|
let o = [], s = 0;
|
|
5602
5614
|
for (let e = +!!i; e < t.length; e++) {
|
|
5603
|
-
let r =
|
|
5615
|
+
let r = ua(t[e], n), i = ma(r[a.time]), c = Q(r[a.open]), l = Q(r[a.high]), u = Q(r[a.low]), d = Q(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
5604
5616
|
if (i === null || ![
|
|
5605
5617
|
c,
|
|
5606
5618
|
l,
|
|
@@ -5619,9 +5631,9 @@ function sa(e) {
|
|
|
5619
5631
|
volume: Number.isFinite(f) ? f : 0
|
|
5620
5632
|
});
|
|
5621
5633
|
}
|
|
5622
|
-
return
|
|
5634
|
+
return ha(o, t.length - +!!i, s);
|
|
5623
5635
|
}
|
|
5624
|
-
function
|
|
5636
|
+
function la(e) {
|
|
5625
5637
|
let t = {
|
|
5626
5638
|
",": 0,
|
|
5627
5639
|
";": 0,
|
|
@@ -5633,7 +5645,7 @@ function ca(e) {
|
|
|
5633
5645
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5634
5646
|
return n;
|
|
5635
5647
|
}
|
|
5636
|
-
function
|
|
5648
|
+
function ua(e, t) {
|
|
5637
5649
|
let n = [], r = "", i = !1;
|
|
5638
5650
|
for (let a = 0; a < e.length; a++) {
|
|
5639
5651
|
let o = e[a];
|
|
@@ -5641,25 +5653,25 @@ function la(e, t) {
|
|
|
5641
5653
|
}
|
|
5642
5654
|
return n.push(r), n;
|
|
5643
5655
|
}
|
|
5644
|
-
function
|
|
5656
|
+
function da(e) {
|
|
5645
5657
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5646
5658
|
return {
|
|
5647
|
-
time: t(
|
|
5648
|
-
open: t(
|
|
5649
|
-
high: t(
|
|
5650
|
-
low: t(
|
|
5651
|
-
close: t(
|
|
5652
|
-
volume: t(
|
|
5659
|
+
time: t(ea),
|
|
5660
|
+
open: t(ta),
|
|
5661
|
+
high: t(na),
|
|
5662
|
+
low: t(ra),
|
|
5663
|
+
close: t(ia),
|
|
5664
|
+
volume: t(aa)
|
|
5653
5665
|
};
|
|
5654
5666
|
}
|
|
5655
|
-
function
|
|
5667
|
+
function fa(e) {
|
|
5656
5668
|
let t = (t) => {
|
|
5657
5669
|
for (let n of t) {
|
|
5658
5670
|
if (e[n] !== void 0) return e[n];
|
|
5659
5671
|
let t = n.toUpperCase();
|
|
5660
5672
|
if (e[t] !== void 0) return e[t];
|
|
5661
5673
|
}
|
|
5662
|
-
}, n =
|
|
5674
|
+
}, n = ma(String(t(ea) ?? "")), r = Number(t(ta)), i = Number(t(na)), a = Number(t(ra)), o = Number(t(ia)), s = Number(t(aa) ?? 0);
|
|
5663
5675
|
return n === null || ![
|
|
5664
5676
|
r,
|
|
5665
5677
|
i,
|
|
@@ -5674,9 +5686,9 @@ function da(e) {
|
|
|
5674
5686
|
volume: Number.isFinite(s) ? s : 0
|
|
5675
5687
|
};
|
|
5676
5688
|
}
|
|
5677
|
-
function
|
|
5689
|
+
function pa(e) {
|
|
5678
5690
|
if (e.length < 5) return null;
|
|
5679
|
-
let t =
|
|
5691
|
+
let t = ma(String(e[0])), n = Number(e[1]), r = Number(e[2]), i = Number(e[3]), a = Number(e[4]), o = e.length >= 6 ? Number(e[5]) : 0;
|
|
5680
5692
|
return t === null || ![
|
|
5681
5693
|
n,
|
|
5682
5694
|
r,
|
|
@@ -5694,7 +5706,7 @@ function fa(e) {
|
|
|
5694
5706
|
function Q(e) {
|
|
5695
5707
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5696
5708
|
}
|
|
5697
|
-
function
|
|
5709
|
+
function ma(e) {
|
|
5698
5710
|
let t = e.trim();
|
|
5699
5711
|
if (!t) return null;
|
|
5700
5712
|
let n = Number(t);
|
|
@@ -5702,7 +5714,7 @@ function pa(e) {
|
|
|
5702
5714
|
let r = Date.parse(t);
|
|
5703
5715
|
return Number.isFinite(r) ? r : null;
|
|
5704
5716
|
}
|
|
5705
|
-
function
|
|
5717
|
+
function ha(e, t, n) {
|
|
5706
5718
|
e.sort((e, t) => e.time - t.time);
|
|
5707
5719
|
let r = [];
|
|
5708
5720
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5714,7 +5726,7 @@ function ma(e, t, n) {
|
|
|
5714
5726
|
}
|
|
5715
5727
|
//#endregion
|
|
5716
5728
|
//#region src/io/DragDropImporter.ts
|
|
5717
|
-
var
|
|
5729
|
+
var ga = class {
|
|
5718
5730
|
host;
|
|
5719
5731
|
overlay = null;
|
|
5720
5732
|
callbacks;
|
|
@@ -5735,19 +5747,19 @@ var ha = class {
|
|
|
5735
5747
|
this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
|
|
5736
5748
|
}
|
|
5737
5749
|
onDragEnter(e) {
|
|
5738
|
-
|
|
5750
|
+
_a(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5739
5751
|
}
|
|
5740
5752
|
onDragOver(e) {
|
|
5741
|
-
|
|
5753
|
+
_a(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5742
5754
|
}
|
|
5743
5755
|
onDragLeave(e) {
|
|
5744
|
-
|
|
5756
|
+
_a(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5745
5757
|
}
|
|
5746
5758
|
async onDrop(e) {
|
|
5747
5759
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5748
5760
|
let t = e.dataTransfer?.files?.[0];
|
|
5749
5761
|
if (t) try {
|
|
5750
|
-
let e =
|
|
5762
|
+
let e = oa(await t.text());
|
|
5751
5763
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5752
5764
|
this.callbacks.onData(e.data, e, t);
|
|
5753
5765
|
} catch (e) {
|
|
@@ -5778,12 +5790,12 @@ var ha = class {
|
|
|
5778
5790
|
this.overlay?.remove(), this.overlay = null;
|
|
5779
5791
|
}
|
|
5780
5792
|
};
|
|
5781
|
-
function
|
|
5793
|
+
function _a(e) {
|
|
5782
5794
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5783
5795
|
}
|
|
5784
5796
|
//#endregion
|
|
5785
5797
|
//#region src/grid/gridShapes.ts
|
|
5786
|
-
var
|
|
5798
|
+
var va = {
|
|
5787
5799
|
"1x1": {
|
|
5788
5800
|
cols: 1,
|
|
5789
5801
|
rows: 1
|
|
@@ -5988,11 +6000,11 @@ var _a = {
|
|
|
5988
6000
|
cols: 3,
|
|
5989
6001
|
rows: 3
|
|
5990
6002
|
}
|
|
5991
|
-
},
|
|
5992
|
-
function ya(e) {
|
|
5993
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(_a, e);
|
|
5994
|
-
}
|
|
6003
|
+
}, ya = Object.keys(va);
|
|
5995
6004
|
function ba(e) {
|
|
6005
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(va, e);
|
|
6006
|
+
}
|
|
6007
|
+
function xa(e) {
|
|
5996
6008
|
if (e.areas) return e.areas;
|
|
5997
6009
|
let t = [];
|
|
5998
6010
|
for (let n = 0; n < e.rows; n++) for (let r = 0; r < e.cols; r++) t.push([
|
|
@@ -6003,16 +6015,16 @@ function ba(e) {
|
|
|
6003
6015
|
]);
|
|
6004
6016
|
return t;
|
|
6005
6017
|
}
|
|
6006
|
-
function
|
|
6018
|
+
function Sa(e) {
|
|
6007
6019
|
return e.areas?.length ?? e.cols * e.rows;
|
|
6008
6020
|
}
|
|
6009
|
-
function
|
|
6021
|
+
function Ca([e, t, n, r]) {
|
|
6010
6022
|
return `${t + 1} / ${e + 1} / span ${r} / span ${n}`;
|
|
6011
6023
|
}
|
|
6012
|
-
function
|
|
6013
|
-
e.style.gridArea = t ?
|
|
6024
|
+
function wa(e, t) {
|
|
6025
|
+
e.style.gridArea = t ? Ca(t) : "";
|
|
6014
6026
|
}
|
|
6015
|
-
function
|
|
6027
|
+
function Ta(e) {
|
|
6016
6028
|
if (!e.areas) return null;
|
|
6017
6029
|
let t = e.areas.find(([, , e, t]) => e * t > 1);
|
|
6018
6030
|
if (!t) return null;
|
|
@@ -6021,7 +6033,7 @@ function wa(e) {
|
|
|
6021
6033
|
}
|
|
6022
6034
|
//#endregion
|
|
6023
6035
|
//#region src/state/layoutStorage.ts
|
|
6024
|
-
function
|
|
6036
|
+
function Ea(e) {
|
|
6025
6037
|
let t = {
|
|
6026
6038
|
id: e.id,
|
|
6027
6039
|
name: e.name,
|
|
@@ -6029,11 +6041,11 @@ function Ta(e) {
|
|
|
6029
6041
|
};
|
|
6030
6042
|
return e.symbol !== void 0 && (t.symbol = e.symbol), e.timeframe !== void 0 && (t.timeframe = e.timeframe), e.kind !== void 0 && (t.kind = e.kind), t;
|
|
6031
6043
|
}
|
|
6032
|
-
var
|
|
6033
|
-
function
|
|
6044
|
+
var Da = (e, t) => t.updatedAt - e.updatedAt;
|
|
6045
|
+
function Oa(e) {
|
|
6034
6046
|
if (typeof e != "object" || !e) return null;
|
|
6035
6047
|
let t = e;
|
|
6036
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
6048
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Ea({
|
|
6037
6049
|
id: t.id,
|
|
6038
6050
|
name: t.name,
|
|
6039
6051
|
updatedAt: t.updatedAt,
|
|
@@ -6042,17 +6054,17 @@ function Da(e) {
|
|
|
6042
6054
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
6043
6055
|
});
|
|
6044
6056
|
}
|
|
6045
|
-
function
|
|
6046
|
-
let t =
|
|
6057
|
+
function ka(e) {
|
|
6058
|
+
let t = Oa(e), n = t ? e.content : void 0;
|
|
6047
6059
|
return t && typeof n == "string" ? {
|
|
6048
6060
|
...t,
|
|
6049
6061
|
content: n
|
|
6050
6062
|
} : null;
|
|
6051
6063
|
}
|
|
6052
|
-
function
|
|
6064
|
+
function Aa(e = []) {
|
|
6053
6065
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
6054
6066
|
return {
|
|
6055
|
-
list: () => [...t.values()].map(
|
|
6067
|
+
list: () => [...t.values()].map(Ea).sort(Da),
|
|
6056
6068
|
load: (e) => {
|
|
6057
6069
|
let n = t.get(e);
|
|
6058
6070
|
return n ? { ...n } : null;
|
|
@@ -6065,7 +6077,7 @@ function ka(e = []) {
|
|
|
6065
6077
|
}
|
|
6066
6078
|
};
|
|
6067
6079
|
}
|
|
6068
|
-
function
|
|
6080
|
+
function ja(e = "tcw:layouts:") {
|
|
6069
6081
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
6070
6082
|
let e;
|
|
6071
6083
|
try {
|
|
@@ -6073,10 +6085,10 @@ function Aa(e = "tcw:layouts:") {
|
|
|
6073
6085
|
} catch {
|
|
6074
6086
|
return [];
|
|
6075
6087
|
}
|
|
6076
|
-
return Array.isArray(e) ? e.map(
|
|
6088
|
+
return Array.isArray(e) ? e.map(Oa).filter((e) => e !== null) : [];
|
|
6077
6089
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
6078
6090
|
return {
|
|
6079
|
-
list: () => r().sort(
|
|
6091
|
+
list: () => r().sort(Da),
|
|
6080
6092
|
load: (e) => {
|
|
6081
6093
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
6082
6094
|
return t && i !== null ? {
|
|
@@ -6085,7 +6097,7 @@ function Aa(e = "tcw:layouts:") {
|
|
|
6085
6097
|
} : null;
|
|
6086
6098
|
},
|
|
6087
6099
|
save: (e) => {
|
|
6088
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
6100
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Ea(e)]);
|
|
6089
6101
|
},
|
|
6090
6102
|
remove: (e) => {
|
|
6091
6103
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -6094,14 +6106,14 @@ function Aa(e = "tcw:layouts:") {
|
|
|
6094
6106
|
}
|
|
6095
6107
|
//#endregion
|
|
6096
6108
|
//#region src/state/LayoutSession.ts
|
|
6097
|
-
var
|
|
6109
|
+
var Ma = 80;
|
|
6098
6110
|
function $(e) {
|
|
6099
6111
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
6100
6112
|
}
|
|
6101
|
-
function
|
|
6113
|
+
function Na() {
|
|
6102
6114
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
6103
6115
|
}
|
|
6104
|
-
function
|
|
6116
|
+
function Pa(e) {
|
|
6105
6117
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
6106
6118
|
return {
|
|
6107
6119
|
id: t,
|
|
@@ -6112,7 +6124,7 @@ function Na(e) {
|
|
|
6112
6124
|
...o === void 0 ? {} : { kind: o }
|
|
6113
6125
|
};
|
|
6114
6126
|
}
|
|
6115
|
-
var
|
|
6127
|
+
var Fa = class {
|
|
6116
6128
|
currentLayout = null;
|
|
6117
6129
|
savedContent = null;
|
|
6118
6130
|
dirty = !1;
|
|
@@ -6128,7 +6140,7 @@ var Pa = class {
|
|
|
6128
6140
|
now;
|
|
6129
6141
|
newId;
|
|
6130
6142
|
constructor(e, t, n = {}) {
|
|
6131
|
-
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ??
|
|
6143
|
+
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ?? Na;
|
|
6132
6144
|
}
|
|
6133
6145
|
current() {
|
|
6134
6146
|
return this.currentLayout;
|
|
@@ -6144,7 +6156,7 @@ var Pa = class {
|
|
|
6144
6156
|
}
|
|
6145
6157
|
async list() {
|
|
6146
6158
|
let e = await this.storage.list();
|
|
6147
|
-
return Array.isArray(e) ? e.map(
|
|
6159
|
+
return Array.isArray(e) ? e.map(Oa).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
6148
6160
|
}
|
|
6149
6161
|
save() {
|
|
6150
6162
|
return this.queue(() => {
|
|
@@ -6158,7 +6170,7 @@ var Pa = class {
|
|
|
6158
6170
|
}
|
|
6159
6171
|
open(e) {
|
|
6160
6172
|
return this.queue(async () => {
|
|
6161
|
-
let t =
|
|
6173
|
+
let t = ka(await this.storage.load(e));
|
|
6162
6174
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
6163
6175
|
this.cancelTimer(), this.applying++;
|
|
6164
6176
|
try {
|
|
@@ -6168,13 +6180,13 @@ var Pa = class {
|
|
|
6168
6180
|
} finally {
|
|
6169
6181
|
this.applying--;
|
|
6170
6182
|
}
|
|
6171
|
-
return this.cancelTimer(), this.currentLayout =
|
|
6183
|
+
return this.cancelTimer(), this.currentLayout = Pa(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
6172
6184
|
});
|
|
6173
6185
|
}
|
|
6174
6186
|
rename(e, t) {
|
|
6175
6187
|
let n = $(t);
|
|
6176
6188
|
return n ? this.queue(async () => {
|
|
6177
|
-
let t =
|
|
6189
|
+
let t = ka(await this.storage.load(e));
|
|
6178
6190
|
!t || t.id !== e || (await this.storage.save({
|
|
6179
6191
|
...t,
|
|
6180
6192
|
name: n
|
|
@@ -6252,7 +6264,7 @@ var Pa = class {
|
|
|
6252
6264
|
content: n.content
|
|
6253
6265
|
};
|
|
6254
6266
|
await this.storage.save(r);
|
|
6255
|
-
let i =
|
|
6267
|
+
let i = Pa(r);
|
|
6256
6268
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
6257
6269
|
}
|
|
6258
6270
|
forget() {
|
|
@@ -6273,6 +6285,6 @@ var Pa = class {
|
|
|
6273
6285
|
}
|
|
6274
6286
|
};
|
|
6275
6287
|
//#endregion
|
|
6276
|
-
export {
|
|
6288
|
+
export { hr as A, zr as C, Er as D, G as E, L as M, z as N, br as O, Rr as S, Lr as T, ci as _, Aa as a, Vr as b, xa as c, ba as d, wa as f, xi as g, Ai as h, ja as i, B as j, _r as k, Sa as l, oa as m, Ma as n, ya as o, ga as p, $ as r, va as s, Fa as t, Ta as u, li as v, Ir as w, Br as x, Hr as y };
|
|
6277
6289
|
|
|
6278
|
-
//# sourceMappingURL=LayoutSession-
|
|
6290
|
+
//# sourceMappingURL=LayoutSession-BJLUwx9d.js.map
|