@tradecanvas/chart 1.84.1 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chart.d.ts +13 -17
- package/dist/Chart.d.ts.map +1 -1
- package/dist/LayoutSession-CoYba3EO.cjs +2 -0
- package/dist/LayoutSession-CoYba3EO.cjs.map +1 -0
- package/dist/{LayoutSession-BhA7O3fL.js → LayoutSession-D1AIWXuH.js} +755 -721
- package/dist/LayoutSession-D1AIWXuH.js.map +1 -0
- package/dist/{WidgetCommandPalette-DHGvEl9n.js → WidgetCommandPalette-BRVQZRQe.js} +2 -2
- package/dist/{WidgetCommandPalette-DHGvEl9n.js.map → WidgetCommandPalette-BRVQZRQe.js.map} +1 -1
- package/dist/{WidgetCommandPalette-Ol8Z923q.cjs → WidgetCommandPalette-CdqVGBYg.cjs} +2 -2
- package/dist/{WidgetCommandPalette-Ol8Z923q.cjs.map → WidgetCommandPalette-CdqVGBYg.cjs.map} +1 -1
- package/dist/{WidgetDrawingSettings-XL1Z9-ly.cjs → WidgetDrawingSettings-CFksb9-G.cjs} +2 -2
- package/dist/{WidgetDrawingSettings-XL1Z9-ly.cjs.map → WidgetDrawingSettings-CFksb9-G.cjs.map} +1 -1
- package/dist/{WidgetDrawingSettings-CSB88SvC.js → WidgetDrawingSettings-DBBFUUg7.js} +2 -2
- package/dist/{WidgetDrawingSettings-CSB88SvC.js.map → WidgetDrawingSettings-DBBFUUg7.js.map} +1 -1
- package/dist/{WidgetIndicatorPicker-a4rpptDc.js → WidgetIndicatorPicker-CcIYSWPd.js} +2 -2
- package/dist/{WidgetIndicatorPicker-a4rpptDc.js.map → WidgetIndicatorPicker-CcIYSWPd.js.map} +1 -1
- package/dist/{WidgetIndicatorPicker-K01RJSLs.cjs → WidgetIndicatorPicker-DiB_819o.cjs} +2 -2
- package/dist/{WidgetIndicatorPicker-K01RJSLs.cjs.map → WidgetIndicatorPicker-DiB_819o.cjs.map} +1 -1
- package/dist/{WidgetIndicatorSettings-BmIFp19I.js → WidgetIndicatorSettings-DcRbZpJJ.js} +3 -3
- package/dist/{WidgetIndicatorSettings-BmIFp19I.js.map → WidgetIndicatorSettings-DcRbZpJJ.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-CJWR-x9q.cjs → WidgetIndicatorSettings-GnMFEumO.cjs} +2 -2
- package/dist/{WidgetIndicatorSettings-CJWR-x9q.cjs.map → WidgetIndicatorSettings-GnMFEumO.cjs.map} +1 -1
- package/dist/{WidgetSettings-D6COgRaB.cjs → WidgetSettings-BnXD_NEb.cjs} +2 -2
- package/dist/{WidgetSettings-D6COgRaB.cjs.map → WidgetSettings-BnXD_NEb.cjs.map} +1 -1
- package/dist/{WidgetSettings-9clgY3_1.js → WidgetSettings-Ds8LIQJL.js} +2 -2
- package/dist/{WidgetSettings-9clgY3_1.js.map → WidgetSettings-Ds8LIQJL.js.map} +1 -1
- package/dist/{WidgetSymbolSearch-6EB31v-O.cjs → WidgetSymbolSearch-CB27E553.cjs} +2 -2
- package/dist/{WidgetSymbolSearch-6EB31v-O.cjs.map → WidgetSymbolSearch-CB27E553.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-DToOqJoG.js → WidgetSymbolSearch-W9ZoSxTR.js} +2 -2
- package/dist/{WidgetSymbolSearch-DToOqJoG.js.map → WidgetSymbolSearch-W9ZoSxTR.js.map} +1 -1
- package/dist/{i18n-nWmX3G55.js → i18n-BudCuwZD.js} +1 -3
- package/dist/i18n-BudCuwZD.js.map +1 -0
- package/dist/i18n-D8MhJwUv.cjs +2 -0
- package/dist/i18n-D8MhJwUv.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/{indicatorInputWords-D0SGBaUD.js → indicatorInputWords-BfiSCSB-.js} +2 -2
- package/dist/{indicatorInputWords-D0SGBaUD.js.map → indicatorInputWords-BfiSCSB-.js.map} +1 -1
- package/dist/{indicatorInputWords-HqTGFokF.cjs → indicatorInputWords-CdAL8a73.cjs} +2 -2
- package/dist/{indicatorInputWords-HqTGFokF.cjs.map → indicatorInputWords-CdAL8a73.cjs.map} +1 -1
- package/dist/layout/LayoutManager.d.ts +23 -0
- package/dist/layout/LayoutManager.d.ts.map +1 -1
- package/dist/model/PriceFit.d.ts +8 -3
- package/dist/model/PriceFit.d.ts.map +1 -1
- package/dist/widget/ChartWidget.d.ts +4 -3
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetDock.d.ts +10 -1
- package/dist/widget/WidgetDock.d.ts.map +1 -1
- package/dist/widget/WidgetLegendView.d.ts +9 -2
- package/dist/widget/WidgetLegendView.d.ts.map +1 -1
- package/dist/widget/index.cjs +92 -33
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +1193 -1128
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/locales/ar.d.ts.map +1 -1
- package/dist/widget/locales/cs.d.ts.map +1 -1
- package/dist/widget/locales/da.d.ts.map +1 -1
- package/dist/widget/locales/de.d.ts.map +1 -1
- package/dist/widget/locales/el.d.ts.map +1 -1
- package/dist/widget/locales/en.d.ts +0 -2
- package/dist/widget/locales/en.d.ts.map +1 -1
- package/dist/widget/locales/es.d.ts.map +1 -1
- package/dist/widget/locales/et.d.ts.map +1 -1
- package/dist/widget/locales/fa.d.ts.map +1 -1
- package/dist/widget/locales/fr.d.ts.map +1 -1
- package/dist/widget/locales/he.d.ts.map +1 -1
- package/dist/widget/locales/hu.d.ts.map +1 -1
- package/dist/widget/locales/id.d.ts.map +1 -1
- package/dist/widget/locales/index.cjs +1 -1
- package/dist/widget/locales/index.cjs.map +1 -1
- package/dist/widget/locales/index.js +1 -29
- package/dist/widget/locales/index.js.map +1 -1
- package/dist/widget/locales/it.d.ts.map +1 -1
- package/dist/widget/locales/ja.d.ts.map +1 -1
- package/dist/widget/locales/ko.d.ts.map +1 -1
- package/dist/widget/locales/ms.d.ts.map +1 -1
- package/dist/widget/locales/nb.d.ts.map +1 -1
- package/dist/widget/locales/nl.d.ts.map +1 -1
- package/dist/widget/locales/pl.d.ts.map +1 -1
- package/dist/widget/locales/pt.d.ts.map +1 -1
- package/dist/widget/locales/ro.d.ts.map +1 -1
- package/dist/widget/locales/ru.d.ts.map +1 -1
- package/dist/widget/locales/sk.d.ts.map +1 -1
- package/dist/widget/locales/sv.d.ts.map +1 -1
- package/dist/widget/locales/th.d.ts.map +1 -1
- package/dist/widget/locales/tr.d.ts.map +1 -1
- package/dist/widget/locales/vi.d.ts.map +1 -1
- package/dist/widget/locales/zh.d.ts.map +1 -1
- package/dist/widget/locales/zhHant.d.ts.map +1 -1
- package/dist/widget/widgetUI.d.ts +22 -10
- package/dist/widget/widgetUI.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-BhA7O3fL.js.map +0 -1
- package/dist/LayoutSession-Cj6jHPeY.cjs +0 -2
- package/dist/LayoutSession-Cj6jHPeY.cjs.map +0 -1
- package/dist/i18n-D0SPfH2s.cjs +0 -2
- package/dist/i18n-D0SPfH2s.cjs.map +0 -1
- package/dist/i18n-nWmX3G55.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { t as e } from "./indicatorLabel-BsidWCv1.js";
|
|
2
|
-
import {
|
|
3
|
-
import { AlertDragHandler as
|
|
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, ChartStateManager as D, CompareRenderer as Ce, CompareSymbolIndicator as we, CompareSymbolPaneIndicator as Te, CorrelationCoefficientIndicator as Ee, CorrelationLogIndicator as De, CrosshairHandler as Oe, CrosshairTooltip as ke, CurrentPriceLine as Ae, DEFAULT_SESSION_HOURS as je, DataExporter as O, DepthHeatmapRenderer as Me, DrawingManager as Ne, DrawingRenderer as Pe, EquivolumeRenderer as Fe, EventBus as Ie, GridRenderer as Le, HLCAreaRenderer as Re, HiLoRenderer as ze, HollowCandleRenderer as Be, INDICATOR_WORKER_MIN_BARS as Ve, IndicatorEngine as He, InteractionManager as Ue, KagiRenderer as We, KeyboardHandler as Ge, LineRenderer as Ke, LineWithMarkersRenderer as qe, MarketProfileRenderer as Je, MeasureOverlay as Ye, PRICE_AXIS_ADD_STRIP as Xe, PanHandler as Ze, PaneResizeHandler as Qe, PeriodLevelsRenderer as $e, PinnedTooltip as et, PivotMarkersRenderer as tt, PointAndFigureRenderer as nt, PriceAxis as rt, PriceAxisAddButton as it, PriceLines as at, RenderEngine as ot, RenkoRenderer as st, ReplayManager as ct, ResamplingAdapter as lt, ReshapeMemo as ut, SYMBOL_INDICATOR_IDS as dt, SYMBOL_ZONE_WAIT_MS as ft, Screenshot as k, SelectionBoxOverlay as pt, SessionBreaks as mt, SessionShading as ht, SignalMarkerManager as gt, SpreadIndicator as _t, StepLineRenderer as vt, StreamManager as yt, SymbolSeriesStore as bt, TimeAxis as xt, TradeZoneManager as St, TradingManager as Ct, TradingRenderer as wt, UndoRedoManager as Tt, Viewport as Et, VolumeCandleRenderer as Dt, VolumeProfileRenderer as Ot, VolumeRenderer as kt, Watermark as At, ZoomHandler as jt, axisTimes as A, barTimeStepMs as Mt, findDominantSwing as Nt, gpuContextsLeft as Pt, idleCssCursor as Ft, indicatorWorkerPool as It, isCrosshairCursor as Lt, isPriceLevelAlert as Rt, isRegularSession as zt, loadWebGL as Bt, mergeSessionHours as Vt, pointAndFigureColumns as Ht, rangePresetStart as Ut, readAlertOptions as Wt, registerBuiltInDrawingTools as Gt, registerBuiltInIndicators as Kt, servesTimeframe as qt, sourceParam as j, streamAdapterOf as Jt, timestampToBarIndex as M, toHeikinAshi as Yt, toKagi as Xt, toLineBreak as Zt, toRangeBars as Qt, toRenko as $t, whenGpuContextFree as en, withResampling as N, xToBarIndex as tn, xToTime as P, yToPrice as nn } from "@tradecanvas/core";
|
|
4
4
|
//#region src/regularHours.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let n =
|
|
8
|
-
if (!n || !
|
|
5
|
+
var rn = 864e5, an = 10;
|
|
6
|
+
function on(e, t) {
|
|
7
|
+
let n = ue(e);
|
|
8
|
+
if (!n || !x(n) || t.length < 2) return null;
|
|
9
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
10
|
-
let t =
|
|
10
|
+
let t = T(e.start), n = T(e.end);
|
|
11
11
|
return t === null || n === null ? [] : [{
|
|
12
12
|
startMinute: t,
|
|
13
13
|
endMinute: n
|
|
14
14
|
}];
|
|
15
15
|
});
|
|
16
16
|
if (r.length === 0) return null;
|
|
17
|
-
let i =
|
|
18
|
-
for (let e = Math.max(1, t.length -
|
|
17
|
+
let i = f(t), a = Infinity;
|
|
18
|
+
for (let e = Math.max(1, t.length - an); 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 < rn)) return null;
|
|
23
23
|
let o = {
|
|
24
24
|
timeZone: n,
|
|
25
25
|
windows: r,
|
|
@@ -30,19 +30,19 @@ function an(e, t) {
|
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/chartA11y.ts
|
|
33
|
-
var
|
|
33
|
+
var sn = {
|
|
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
|
-
},
|
|
40
|
+
}, F = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), cn = [
|
|
41
41
|
"role",
|
|
42
42
|
"aria-roledescription",
|
|
43
43
|
"aria-label",
|
|
44
44
|
"aria-describedby"
|
|
45
|
-
],
|
|
45
|
+
], ln = 400, un = 1e3, dn = class {
|
|
46
46
|
live;
|
|
47
47
|
help;
|
|
48
48
|
labels;
|
|
@@ -56,20 +56,20 @@ var on = {
|
|
|
56
56
|
};
|
|
57
57
|
constructor(e, t, n = {}) {
|
|
58
58
|
this.container = e, this.source = t, this.labels = {
|
|
59
|
-
...
|
|
59
|
+
...sn,
|
|
60
60
|
...n
|
|
61
61
|
};
|
|
62
|
-
for (let t of
|
|
63
|
-
e.setAttribute("role", "application"), this.help =
|
|
62
|
+
for (let t of cn) this.before.set(t, e.getAttribute(t));
|
|
63
|
+
e.setAttribute("role", "application"), this.help = fn("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 = fn("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
|
+
...sn,
|
|
68
68
|
...e
|
|
69
69
|
}, this.applyLabels();
|
|
70
70
|
}
|
|
71
71
|
refresh(e = !1) {
|
|
72
|
-
let t =
|
|
72
|
+
let t = un - (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 on = {
|
|
|
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
|
+
}, ln);
|
|
85
85
|
}
|
|
86
86
|
readBar(e) {
|
|
87
87
|
let t = this.source.bars();
|
|
@@ -94,13 +94,13 @@ var on = {
|
|
|
94
94
|
let i = t[this.cursor];
|
|
95
95
|
this.source.showBar(i.time);
|
|
96
96
|
let a = this.source.formatPrice;
|
|
97
|
-
this.say(
|
|
97
|
+
this.say(F(this.labels.bar, {
|
|
98
98
|
time: this.source.formatTime(i.time),
|
|
99
99
|
open: a(i.open),
|
|
100
100
|
high: a(i.high),
|
|
101
101
|
low: a(i.low),
|
|
102
102
|
close: a(i.close),
|
|
103
|
-
volume:
|
|
103
|
+
volume: pn(i.volume ?? 0)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
destroy() {
|
|
@@ -119,7 +119,7 @@ var on = {
|
|
|
119
119
|
this.labels.typeName ? this.labels.typeName(t) : t,
|
|
120
120
|
this.source.timeframe()
|
|
121
121
|
].filter(Boolean).join(", ");
|
|
122
|
-
return
|
|
122
|
+
return F(this.labels.summary, {
|
|
123
123
|
what: n,
|
|
124
124
|
close: this.source.formatPrice(e[e.length - 1].close)
|
|
125
125
|
});
|
|
@@ -129,7 +129,7 @@ var on = {
|
|
|
129
129
|
if (e.length === 0) return this.labels.empty;
|
|
130
130
|
let t = this.source.visibleRange(), n = Math.max(0, Math.min(e.length - 1, Math.ceil(t.from))), r = Math.max(n, Math.min(e.length - 1, Math.floor(t.to))), i = -Infinity, a = Infinity;
|
|
131
131
|
for (let t = n; t <= r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
132
|
-
return
|
|
132
|
+
return F(this.labels.view, {
|
|
133
133
|
count: r - n + 1,
|
|
134
134
|
from: this.source.formatTime(e[n].time),
|
|
135
135
|
to: this.source.formatTime(e[r].time),
|
|
@@ -141,7 +141,7 @@ var on = {
|
|
|
141
141
|
this.live.textContent = e;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
function
|
|
144
|
+
function fn(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 dn(e, t) {
|
|
|
155
155
|
border: "0"
|
|
156
156
|
}), n;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function pn(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 mn(e) {
|
|
164
164
|
switch (e) {
|
|
165
165
|
case "candlestick":
|
|
166
166
|
case "heikinAshi":
|
|
167
167
|
case "lineBreak":
|
|
168
|
-
case "rangeBars": return new
|
|
169
|
-
case "line": return new
|
|
170
|
-
case "area": return new
|
|
171
|
-
case "bar": return new
|
|
172
|
-
case "hollowCandle": return new
|
|
173
|
-
case "baseline": return new
|
|
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
|
|
183
|
-
default: return new
|
|
168
|
+
case "rangeBars": return new xe();
|
|
169
|
+
case "line": return new Ke();
|
|
170
|
+
case "area": return new ge();
|
|
171
|
+
case "bar": return new ye();
|
|
172
|
+
case "hollowCandle": return new Be();
|
|
173
|
+
case "baseline": return new be();
|
|
174
|
+
case "renko": return new st();
|
|
175
|
+
case "kagi": return new We();
|
|
176
|
+
case "pointAndFigure": return new nt();
|
|
177
|
+
case "volumeCandles": return new Dt();
|
|
178
|
+
case "equivolume": return new Fe();
|
|
179
|
+
case "hlcArea": return new Re();
|
|
180
|
+
case "stepLine": return new vt();
|
|
181
|
+
case "lineWithMarkers": return new qe();
|
|
182
|
+
case "hiLo": return new ze();
|
|
183
|
+
default: return new xe();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function hn(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 Yt(t);
|
|
190
190
|
case "renko": {
|
|
191
191
|
let e = n.renko?.boxSize;
|
|
192
|
-
return typeof e == "number" ?
|
|
192
|
+
return typeof e == "number" ? $t(t, { brickSize: e }, i) : $t(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 Zt(t, n.lineBreak?.lines ?? 3);
|
|
199
|
+
case "kagi": return Xt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
200
|
+
case "pointAndFigure": return _n(t, n, i).columns;
|
|
201
|
+
case "rangeBars": return Qt(t, {
|
|
202
|
+
rangeSize: Dn(t, n, r),
|
|
203
203
|
includeForming: !0
|
|
204
204
|
}, i);
|
|
205
205
|
default: return t;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function gn(e) {
|
|
209
209
|
switch (e) {
|
|
210
210
|
case "heikinAshi":
|
|
211
211
|
case "renko":
|
|
@@ -216,72 +216,72 @@ function hn(e) {
|
|
|
216
216
|
default: return !1;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
return e !== "heikinAshi" &&
|
|
219
|
+
function I(e) {
|
|
220
|
+
return e !== "heikinAshi" && gn(e);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return Ht(e,
|
|
222
|
+
function _n(e, t = {}, n) {
|
|
223
|
+
return Ht(e, bn(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
225
|
+
var vn = 50, yn = .01;
|
|
226
|
+
function bn(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 = xn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
230
|
+
return r > 0 ? En(te(r / vn, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * yn || 1;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function xn(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 Sn = 100, Cn = 3, wn = .01, Tn = 15, En = (e) => Number(e.toPrecision(Tn));
|
|
239
|
+
function Dn(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 >= Cn ? kn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
243
|
+
return Mn(En(te(i > 0 ? i : a * wn || 1, !0)), n);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function On(e) {
|
|
246
246
|
let t = e.length - 1;
|
|
247
247
|
return {
|
|
248
|
-
from: Math.max(0, t -
|
|
248
|
+
from: Math.max(0, t - Sn),
|
|
249
249
|
end: t
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
let { from: t, end: n } =
|
|
252
|
+
function kn(e) {
|
|
253
|
+
let { from: t, end: n } = On(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 An(e, t) {
|
|
261
|
+
let { from: n, end: r } = On(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
|
|
265
|
+
return jn(t(i), t(a));
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function jn(e, t) {
|
|
268
268
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
return t === void 0 || !(t > 0) ? e :
|
|
270
|
+
function Mn(e, t) {
|
|
271
|
+
return t === void 0 || !(t > 0) ? e : En(Math.max(1, Math.round(e / t)) * t);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Nn(e, t) {
|
|
274
274
|
let n = t?.(e);
|
|
275
|
-
return n ? n.createRenderer() :
|
|
275
|
+
return n ? n.createRenderer() : mn(e);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Pn(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) : hn(e, t, r, i, a);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/state/AutoSaveScheduler.ts
|
|
284
|
-
var
|
|
284
|
+
var Fn = class {
|
|
285
285
|
timer = null;
|
|
286
286
|
delayMs = 0;
|
|
287
287
|
key = null;
|
|
@@ -311,15 +311,15 @@ var Nn = class {
|
|
|
311
311
|
};
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/DataManager.ts
|
|
314
|
-
function
|
|
314
|
+
function L(e) {
|
|
315
315
|
if (!e || typeof e.time != "number" || !Number.isFinite(e.time)) return !1;
|
|
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 In(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
|
-
function
|
|
322
|
+
function R(e) {
|
|
323
323
|
return {
|
|
324
324
|
...e,
|
|
325
325
|
high: Math.max(e.open, e.high, e.low, e.close),
|
|
@@ -327,37 +327,37 @@ function B(e) {
|
|
|
327
327
|
volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
function
|
|
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 Ln(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 Rn = {
|
|
341
341
|
index: -1,
|
|
342
342
|
changed: !1
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function zn(e, t) {
|
|
345
345
|
if (e.length === 0) return t;
|
|
346
|
-
let n =
|
|
347
|
-
return
|
|
346
|
+
let n = S(t);
|
|
347
|
+
return f(e) === 1 ? n : n / 1e3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
let n =
|
|
349
|
+
function Bn(e, t) {
|
|
350
|
+
let n = zn(e, t.time);
|
|
351
351
|
return n === t.time ? t : {
|
|
352
352
|
...t,
|
|
353
353
|
time: n
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
var
|
|
356
|
+
var B = class {
|
|
357
357
|
data = [];
|
|
358
358
|
changes = 0;
|
|
359
359
|
withSeriesTime(e) {
|
|
360
|
-
return
|
|
360
|
+
return Bn(this.data, e);
|
|
361
361
|
}
|
|
362
362
|
getData() {
|
|
363
363
|
return this.data;
|
|
@@ -369,16 +369,16 @@ var H = class {
|
|
|
369
369
|
let t = [];
|
|
370
370
|
for (let n = 0; n < e.length; n++) {
|
|
371
371
|
let r = e[n];
|
|
372
|
-
|
|
372
|
+
L(r) && t.push(In(r) ? r : R(r));
|
|
373
373
|
}
|
|
374
374
|
this.data = t, this.changes++;
|
|
375
375
|
}
|
|
376
376
|
prependBars(e) {
|
|
377
377
|
let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
|
|
378
378
|
for (let r = 0; r < e.length; r++) {
|
|
379
|
-
if (!
|
|
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(In(i) ? i : R(i));
|
|
382
382
|
}
|
|
383
383
|
if (n.length === 0) return 0;
|
|
384
384
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -387,11 +387,11 @@ var H = class {
|
|
|
387
387
|
return n.length = r, this.data = n.concat(this.data), this.changes++, r;
|
|
388
388
|
}
|
|
389
389
|
appendBar(e) {
|
|
390
|
-
|
|
390
|
+
L(e) && (this.data.push(R(this.withSeriesTime(e))), this.changes++);
|
|
391
391
|
}
|
|
392
392
|
updateLastBar(e) {
|
|
393
|
-
if (!
|
|
394
|
-
let t =
|
|
393
|
+
if (!L(e)) return;
|
|
394
|
+
let t = R(this.withSeriesTime(e));
|
|
395
395
|
if (this.changes++, this.data.length === 0) {
|
|
396
396
|
this.data.push(t);
|
|
397
397
|
return;
|
|
@@ -399,11 +399,11 @@ var H = class {
|
|
|
399
399
|
this.data[this.data.length - 1] = t;
|
|
400
400
|
}
|
|
401
401
|
replaceBar(e) {
|
|
402
|
-
if (!
|
|
403
|
-
let t = this.withSeriesTime(e), n =
|
|
404
|
-
if (n < 0) return
|
|
405
|
-
let r =
|
|
406
|
-
return
|
|
402
|
+
if (!L(e)) return Rn;
|
|
403
|
+
let t = this.withSeriesTime(e), n = Ln(this.data, t.time);
|
|
404
|
+
if (n < 0) return Rn;
|
|
405
|
+
let r = R(t);
|
|
406
|
+
return z(this.data[n], r) ? {
|
|
407
407
|
index: n,
|
|
408
408
|
changed: !1
|
|
409
409
|
} : (this.data[n] = r, this.changes++, {
|
|
@@ -420,18 +420,18 @@ var H = class {
|
|
|
420
420
|
clear() {
|
|
421
421
|
this.data = [], this.changes++;
|
|
422
422
|
}
|
|
423
|
-
},
|
|
423
|
+
}, V = {
|
|
424
424
|
to: "none",
|
|
425
425
|
index: -1,
|
|
426
426
|
changed: !1
|
|
427
427
|
};
|
|
428
|
-
function
|
|
428
|
+
function H(e, t) {
|
|
429
429
|
let n = e[e.length - 1];
|
|
430
430
|
if (!n) return "append";
|
|
431
|
-
let r =
|
|
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 Vn(e) {
|
|
435
435
|
return [
|
|
436
436
|
e.time,
|
|
437
437
|
e.open,
|
|
@@ -440,8 +440,8 @@ function zn(e) {
|
|
|
440
440
|
e.close
|
|
441
441
|
].every(Number.isFinite);
|
|
442
442
|
}
|
|
443
|
-
var
|
|
444
|
-
shown = new
|
|
443
|
+
var Hn = class {
|
|
444
|
+
shown = new B();
|
|
445
445
|
whole = null;
|
|
446
446
|
aside = null;
|
|
447
447
|
shownRevision = 0;
|
|
@@ -483,7 +483,7 @@ var Bn = 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(Vn).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 Bn = 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(Un(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = Un(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 Bn = 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(zn(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];
|
|
@@ -565,14 +565,14 @@ var Bn = class {
|
|
|
565
565
|
}
|
|
566
566
|
placeStreamBar(e) {
|
|
567
567
|
if (this.aside) {
|
|
568
|
-
let t =
|
|
568
|
+
let t = H(this.aside.getData(), e);
|
|
569
569
|
return t === "append" ? this.aside.appendBar(e) : t === "update" && this.aside.updateLastBar(e), this.wrote(t === "stale" ? "none" : "aside", !1);
|
|
570
570
|
}
|
|
571
|
-
let t = this.inSeriesUnit(e), n =
|
|
571
|
+
let t = this.inSeriesUnit(e), n = H(this.whole ?? this.shown.getData(), t);
|
|
572
572
|
if (n === "stale") return this.wrote("none", !1);
|
|
573
573
|
let r = this.startWholeSeries(t, n);
|
|
574
574
|
if (!this.take(t, n)) return this.wrote("hidden", r);
|
|
575
|
-
let i = this.shown.getLength(), a =
|
|
575
|
+
let i = this.shown.getLength(), a = H(this.shown.getData(), t);
|
|
576
576
|
return a === "stale" ? {
|
|
577
577
|
to: "none",
|
|
578
578
|
before: i,
|
|
@@ -586,7 +586,7 @@ var Bn = class {
|
|
|
586
586
|
replace(e) {
|
|
587
587
|
if (this.aside) {
|
|
588
588
|
let { index: t, changed: n } = this.aside.replaceBar(e);
|
|
589
|
-
return t < 0 ?
|
|
589
|
+
return t < 0 ? V : (n && this.onLiveChange({
|
|
590
590
|
kind: "bar",
|
|
591
591
|
time: this.aside.getData()[t].time
|
|
592
592
|
}), {
|
|
@@ -595,22 +595,22 @@ var Bn = class {
|
|
|
595
595
|
changed: n
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
if (!
|
|
599
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
598
|
+
if (!L(e)) return V;
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Ln(n, t.time) : -1;
|
|
600
600
|
if (n) {
|
|
601
|
-
if (r < 0 || !
|
|
601
|
+
if (r < 0 || !L(n[r])) return V;
|
|
602
602
|
let e = this.hoursFilter(n);
|
|
603
603
|
if (e && !e(t.time)) return this.replaceHidden(n, r, t);
|
|
604
604
|
}
|
|
605
605
|
let { index: i, changed: a } = this.shown.replaceBar(t);
|
|
606
|
-
return i < 0 ?
|
|
606
|
+
return i < 0 ? V : (a && (n && (n[r] = this.shown.getData()[i]), this.shownRevision++), {
|
|
607
607
|
to: "shown",
|
|
608
608
|
index: i,
|
|
609
609
|
changed: a
|
|
610
610
|
});
|
|
611
611
|
}
|
|
612
612
|
beginReplay() {
|
|
613
|
-
this.aside || (this.aside = new
|
|
613
|
+
this.aside || (this.aside = new B(), this.aside.setData(this.whole ?? this.shown.getData()));
|
|
614
614
|
}
|
|
615
615
|
endReplay() {
|
|
616
616
|
let e = this.aside;
|
|
@@ -630,10 +630,10 @@ var Bn = class {
|
|
|
630
630
|
this.shown.updateLastBar(e);
|
|
631
631
|
}
|
|
632
632
|
inSeriesUnit(e) {
|
|
633
|
-
return
|
|
633
|
+
return Bn(this.whole ?? this.shown.getData(), e);
|
|
634
634
|
}
|
|
635
635
|
replaceHidden(e, t, n) {
|
|
636
|
-
let r =
|
|
636
|
+
let r = R(n), i = !z(e[t], r);
|
|
637
637
|
return i && (e[t] = r), {
|
|
638
638
|
to: "hidden",
|
|
639
639
|
index: -1,
|
|
@@ -667,21 +667,25 @@ var Bn = class {
|
|
|
667
667
|
return !r || r(e.time);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
function
|
|
670
|
+
function Un(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 Wn = class {
|
|
678
678
|
auto;
|
|
679
679
|
preferred;
|
|
680
680
|
pending = !0;
|
|
681
681
|
arriving = !0;
|
|
682
|
+
spacing = t[r];
|
|
682
683
|
constructor(e) {
|
|
683
684
|
this.auto = e, this.preferred = e;
|
|
684
685
|
}
|
|
686
|
+
setSpacing(e) {
|
|
687
|
+
this.spacing = e;
|
|
688
|
+
}
|
|
685
689
|
isAuto() {
|
|
686
690
|
return this.auto;
|
|
687
691
|
}
|
|
@@ -707,21 +711,21 @@ var Hn = o ** -7, Un = class {
|
|
|
707
711
|
}
|
|
708
712
|
fit(e, t, n, r) {
|
|
709
713
|
if (t.length === 0) return;
|
|
710
|
-
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 = Kn(Kn(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;
|
|
711
715
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
712
|
-
top:
|
|
713
|
-
bottom: k
|
|
714
|
-
} : {
|
|
715
|
-
top: k,
|
|
716
|
+
top: u,
|
|
716
717
|
bottom: c
|
|
718
|
+
} : {
|
|
719
|
+
top: c,
|
|
720
|
+
bottom: u
|
|
717
721
|
}), e.fitToPrices(o.min, o.max);
|
|
718
722
|
}
|
|
719
723
|
};
|
|
720
|
-
function
|
|
724
|
+
function Gn(e, t, n) {
|
|
721
725
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
722
726
|
return !1;
|
|
723
727
|
}
|
|
724
|
-
function
|
|
728
|
+
function Kn(e, t) {
|
|
725
729
|
return e ? t ? {
|
|
726
730
|
min: Math.min(e.min, t.min),
|
|
727
731
|
max: Math.max(e.max, t.max)
|
|
@@ -729,18 +733,18 @@ function Gn(e, t) {
|
|
|
729
733
|
}
|
|
730
734
|
//#endregion
|
|
731
735
|
//#region src/model/DisplaySeries.ts
|
|
732
|
-
var
|
|
736
|
+
var qn = class {
|
|
733
737
|
series = null;
|
|
734
738
|
madeAt = null;
|
|
735
739
|
epoch = 0;
|
|
736
|
-
memo = new
|
|
740
|
+
memo = new ut();
|
|
737
741
|
constructor(e) {
|
|
738
742
|
this.sources = e;
|
|
739
743
|
}
|
|
740
744
|
get() {
|
|
741
745
|
let e = this.sources.bars();
|
|
742
746
|
if (e.length === 0) return e;
|
|
743
|
-
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" ? An(e, (e) => this.sources.stepAt(e)) : void 0, i = this.sources.version(), a = this.madeAt;
|
|
744
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 = {
|
|
745
749
|
version: i,
|
|
746
750
|
type: t,
|
|
@@ -757,14 +761,14 @@ var Kn = class {
|
|
|
757
761
|
}
|
|
758
762
|
make(e, t, n, r) {
|
|
759
763
|
let { lookup: i } = this.sources;
|
|
760
|
-
if (e !== "pointAndFigure" || i(e)) return
|
|
761
|
-
let { columns: a, boxSize: o } =
|
|
764
|
+
if (e !== "pointAndFigure" || i(e)) return Pn(e, t, i, n, r, this.memo);
|
|
765
|
+
let { columns: a, boxSize: o } = _n(t, n, this.memo);
|
|
762
766
|
return this.sources.onBoxSize(o), a;
|
|
763
767
|
}
|
|
764
|
-
},
|
|
768
|
+
}, Jn = {
|
|
765
769
|
min: 0,
|
|
766
770
|
max: 100
|
|
767
|
-
},
|
|
771
|
+
}, Yn = class {
|
|
768
772
|
layout = null;
|
|
769
773
|
infos = null;
|
|
770
774
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -772,7 +776,7 @@ var Kn = class {
|
|
|
772
776
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
773
777
|
}
|
|
774
778
|
resolved() {
|
|
775
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
779
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(Xn(this.layout))), this.layout;
|
|
776
780
|
}
|
|
777
781
|
invalidate() {
|
|
778
782
|
this.layout = null, this.infos = null;
|
|
@@ -784,7 +788,7 @@ var Kn = class {
|
|
|
784
788
|
if (this.infos) return this.infos;
|
|
785
789
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
786
790
|
return this.infos = this.resolved().panels.map((e) => {
|
|
787
|
-
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) ?? { ...Jn }, s = this.styles.get(i);
|
|
788
792
|
return {
|
|
789
793
|
instanceId: i,
|
|
790
794
|
members: this.sources.getPaneMembers(i),
|
|
@@ -844,7 +848,7 @@ var Kn = class {
|
|
|
844
848
|
}
|
|
845
849
|
}
|
|
846
850
|
};
|
|
847
|
-
function
|
|
851
|
+
function Xn(e) {
|
|
848
852
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
849
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));
|
|
850
854
|
return {
|
|
@@ -852,10 +856,10 @@ function Yn(e) {
|
|
|
852
856
|
bottom: r
|
|
853
857
|
};
|
|
854
858
|
}
|
|
855
|
-
function
|
|
859
|
+
function Zn(e) {
|
|
856
860
|
return e.length > 0 ? { renames: e } : {};
|
|
857
861
|
}
|
|
858
|
-
var
|
|
862
|
+
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Qn = class {
|
|
859
863
|
steps;
|
|
860
864
|
snapshot;
|
|
861
865
|
enabled;
|
|
@@ -877,21 +881,21 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
877
881
|
this.renames = i;
|
|
878
882
|
}
|
|
879
883
|
let o = this.snapshot();
|
|
880
|
-
return
|
|
884
|
+
return U(n, o) || this.push(e, n, o, r), a;
|
|
881
885
|
}
|
|
882
886
|
push(e, t, n, r) {
|
|
883
|
-
let i = this.now(), a = this.steps.last(), o = a?.type === "indicators" ? a.indicators : void 0, s = e !== void 0 && o?.subject === e && i - (o.at ?? 0) < 800 &&
|
|
887
|
+
let i = this.now(), a = this.steps.last(), o = a?.type === "indicators" ? a.indicators : void 0, s = e !== void 0 && o?.subject === e && i - (o.at ?? 0) < 800 && U(o.after, t), c = {
|
|
884
888
|
type: "indicators",
|
|
885
889
|
before: null,
|
|
886
890
|
after: null
|
|
887
891
|
};
|
|
888
|
-
s && o ?
|
|
892
|
+
s && o ? U(o.before, n) ? this.steps.dropLast() : this.steps.replaceLast({
|
|
889
893
|
...c,
|
|
890
894
|
indicators: {
|
|
891
895
|
...o,
|
|
892
896
|
after: n,
|
|
893
897
|
at: i,
|
|
894
|
-
...
|
|
898
|
+
...Zn([...o.renames ?? [], ...r])
|
|
895
899
|
}
|
|
896
900
|
}) : this.steps.push({
|
|
897
901
|
...c,
|
|
@@ -900,7 +904,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
900
904
|
after: n,
|
|
901
905
|
subject: e,
|
|
902
906
|
at: i,
|
|
903
|
-
...
|
|
907
|
+
...Zn(r)
|
|
904
908
|
}
|
|
905
909
|
});
|
|
906
910
|
}
|
|
@@ -926,7 +930,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
926
930
|
if (!e) return;
|
|
927
931
|
this.edit = null, this.depth--;
|
|
928
932
|
let t = this.snapshot();
|
|
929
|
-
|
|
933
|
+
U(t, e.before) || this.steps.push({
|
|
930
934
|
type: "indicators",
|
|
931
935
|
before: null,
|
|
932
936
|
after: null,
|
|
@@ -938,7 +942,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
938
942
|
}
|
|
939
943
|
});
|
|
940
944
|
}
|
|
941
|
-
},
|
|
945
|
+
}, $n = class {
|
|
942
946
|
constructor(e, t, n) {
|
|
943
947
|
this.members = e, this.slots = t, this.handover = n;
|
|
944
948
|
}
|
|
@@ -957,24 +961,24 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
957
961
|
paneFor(e, t, n, r) {
|
|
958
962
|
if (n) return this.hostOf(n, r);
|
|
959
963
|
if (e.placement !== "overlay") return null;
|
|
960
|
-
let i =
|
|
964
|
+
let i = j(e), a = i ? C(t[i]) : null;
|
|
961
965
|
return a ? this.hostOf(a.instanceId, r) : null;
|
|
962
966
|
}
|
|
963
967
|
sourceOf(e) {
|
|
964
|
-
let t = this.members.getIndicatorDescriptor(e), n = t ?
|
|
968
|
+
let t = this.members.getIndicatorDescriptor(e), n = t ? j(t) : null;
|
|
965
969
|
return n ? this.members.getIndicatorConfig(e)?.params[n] : void 0;
|
|
966
970
|
}
|
|
967
971
|
followSource(e, t) {
|
|
968
|
-
let n = this.members.getIndicatorDescriptor(e), r = this.members.getIndicatorConfig(e), i = n ?
|
|
972
|
+
let n = this.members.getIndicatorDescriptor(e), r = this.members.getIndicatorConfig(e), i = n ? j(n) : null;
|
|
969
973
|
if (n?.placement !== "overlay" || !r || !i || r.params[i] === t) return !1;
|
|
970
|
-
let a =
|
|
974
|
+
let a = C(r.params[i]), o = a ? this.hostOf(a.instanceId, e) : C(t) ? null : r.pane ?? null;
|
|
971
975
|
return (o ?? void 0) === r.pane ? !1 : (this.members.setPane(e, o), !0);
|
|
972
976
|
}
|
|
973
977
|
moveHost(e, t) {
|
|
974
978
|
let n = this.members.getIndicatorConfig(e), r = this.members.getIndicatorDescriptor(e);
|
|
975
979
|
if (!n || !r) return;
|
|
976
|
-
let i =
|
|
977
|
-
if (r.placement === "overlay" && i &&
|
|
980
|
+
let i = j(r);
|
|
981
|
+
if (r.placement === "overlay" && i && C(n.params[i])) return;
|
|
978
982
|
if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
|
|
979
983
|
if (t === "new") return r.placement === "panel" && !this.ownsPane(e) ? null : void 0;
|
|
980
984
|
let a = this.hostOf(t, e);
|
|
@@ -1017,7 +1021,7 @@ var G = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
|
1017
1021
|
};
|
|
1018
1022
|
//#endregion
|
|
1019
1023
|
//#region src/model/IndicatorSetup.ts
|
|
1020
|
-
function
|
|
1024
|
+
function er(e, t, n) {
|
|
1021
1025
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1022
1026
|
return e.getActiveIndicators().map((t) => {
|
|
1023
1027
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1045,7 +1049,7 @@ function $n(e, t, n) {
|
|
|
1045
1049
|
};
|
|
1046
1050
|
});
|
|
1047
1051
|
}
|
|
1048
|
-
function
|
|
1052
|
+
function tr(e, t) {
|
|
1049
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, {
|
|
1050
1054
|
log: !!n.paneLog,
|
|
1051
1055
|
invert: !!n.paneInvert,
|
|
@@ -1056,11 +1060,11 @@ function er(e, t) {
|
|
|
1056
1060
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1057
1061
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1058
1062
|
}
|
|
1059
|
-
function
|
|
1063
|
+
function nr(e) {
|
|
1060
1064
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1061
1065
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1062
1066
|
i.add(e.instanceId);
|
|
1063
|
-
let o = [e.pane, ...Object.values(e.params).map((e) =>
|
|
1067
|
+
let o = [e.pane, ...Object.values(e.params).map((e) => C(e)?.instanceId)];
|
|
1064
1068
|
for (let e of o) {
|
|
1065
1069
|
let n = e ? t.get(e) : void 0;
|
|
1066
1070
|
n && a(n);
|
|
@@ -1070,37 +1074,37 @@ function tr(e) {
|
|
|
1070
1074
|
for (let t of e) a(t);
|
|
1071
1075
|
return n;
|
|
1072
1076
|
}
|
|
1073
|
-
function
|
|
1077
|
+
function rr(e, t) {
|
|
1074
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);
|
|
1075
1079
|
}
|
|
1076
|
-
function
|
|
1080
|
+
function ir(e, t) {
|
|
1077
1081
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1078
1082
|
for (let t of e) {
|
|
1079
1083
|
let e = n.get(t.instanceId);
|
|
1080
|
-
e &&
|
|
1084
|
+
e && rr(t, e) && ar(t, e) && r.add(t.instanceId);
|
|
1081
1085
|
}
|
|
1082
1086
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1083
1087
|
return r;
|
|
1084
1088
|
}
|
|
1085
|
-
function
|
|
1089
|
+
function ar(e, t) {
|
|
1086
1090
|
let n = Object.keys(e.params);
|
|
1087
1091
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1088
1092
|
}
|
|
1089
|
-
function
|
|
1093
|
+
function or(e, t) {
|
|
1090
1094
|
let n = { ...e };
|
|
1091
1095
|
for (let [e, r] of Object.entries(n)) {
|
|
1092
|
-
let i =
|
|
1093
|
-
a && (n[e] =
|
|
1096
|
+
let i = C(r), a = i && t.get(i.instanceId);
|
|
1097
|
+
a && (n[e] = b(a, i.key));
|
|
1094
1098
|
}
|
|
1095
1099
|
return n;
|
|
1096
1100
|
}
|
|
1097
1101
|
//#endregion
|
|
1098
1102
|
//#region src/model/SymbolRequests.ts
|
|
1099
|
-
function
|
|
1103
|
+
function sr(e, t) {
|
|
1100
1104
|
let n = t.symbol;
|
|
1101
|
-
return
|
|
1105
|
+
return dt.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1102
1106
|
}
|
|
1103
|
-
var
|
|
1107
|
+
var cr = class {
|
|
1104
1108
|
asked = /* @__PURE__ */ new Set();
|
|
1105
1109
|
constructor(e, t) {
|
|
1106
1110
|
this.readers = e, this.held = t;
|
|
@@ -1108,14 +1112,14 @@ var sr = class {
|
|
|
1108
1112
|
required() {
|
|
1109
1113
|
let e = /* @__PURE__ */ new Set();
|
|
1110
1114
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1111
|
-
let n =
|
|
1115
|
+
let n = sr(t.id, t.params);
|
|
1112
1116
|
n && e.add(n);
|
|
1113
1117
|
}
|
|
1114
1118
|
return [...e];
|
|
1115
1119
|
}
|
|
1116
1120
|
readersOf(e) {
|
|
1117
1121
|
let t = e.trim();
|
|
1118
|
-
return this.readers.getActiveIndicators().filter((e) =>
|
|
1122
|
+
return this.readers.getActiveIndicators().filter((e) => dt.has(e.id) && String(e.params.symbol ?? "").trim() === t).map((e) => e.instanceId);
|
|
1119
1123
|
}
|
|
1120
1124
|
given(e) {
|
|
1121
1125
|
this.asked.delete(e.trim());
|
|
@@ -1126,20 +1130,20 @@ var sr = class {
|
|
|
1126
1130
|
}
|
|
1127
1131
|
toAsk(e) {
|
|
1128
1132
|
this.forgetUnread();
|
|
1129
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1133
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? sr(t.id, t.params) : "";
|
|
1130
1134
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1131
1135
|
}
|
|
1132
|
-
},
|
|
1133
|
-
function
|
|
1134
|
-
if (!
|
|
1136
|
+
}, lr = (e, t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1137
|
+
function ur(e, t, n, r) {
|
|
1138
|
+
if (!lr(e, t)) {
|
|
1135
1139
|
for (let t of n) {
|
|
1136
1140
|
let n = r(t.id);
|
|
1137
|
-
if (n &&
|
|
1141
|
+
if (n && lr(e, n.chartRect)) return t.id;
|
|
1138
1142
|
}
|
|
1139
1143
|
return null;
|
|
1140
1144
|
}
|
|
1141
1145
|
}
|
|
1142
|
-
function
|
|
1146
|
+
function dr(e, t, n, r) {
|
|
1143
1147
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1144
1148
|
let i = n();
|
|
1145
1149
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1147,12 +1151,12 @@ function ur(e, t, n, r) {
|
|
|
1147
1151
|
data: r()
|
|
1148
1152
|
};
|
|
1149
1153
|
}
|
|
1150
|
-
function
|
|
1154
|
+
function fr(e, t, n) {
|
|
1151
1155
|
return !n && e.some((e) => e.id === t);
|
|
1152
1156
|
}
|
|
1153
1157
|
//#endregion
|
|
1154
1158
|
//#region src/HistoryPager.ts
|
|
1155
|
-
var
|
|
1159
|
+
var pr = 5e3, mr = 6e4, hr = 500, gr = class {
|
|
1156
1160
|
loader = null;
|
|
1157
1161
|
pageSize = 500;
|
|
1158
1162
|
loading = !1;
|
|
@@ -1207,7 +1211,7 @@ var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
|
1207
1211
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1208
1212
|
state: "loaded",
|
|
1209
1213
|
count: 0
|
|
1210
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1214
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(mr, pr * 2 ** (this.failures - 1)), this.emit({
|
|
1211
1215
|
state: "error",
|
|
1212
1216
|
count: 0,
|
|
1213
1217
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1240,10 +1244,10 @@ var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
|
1240
1244
|
};
|
|
1241
1245
|
//#endregion
|
|
1242
1246
|
//#region src/ThemeManager.ts
|
|
1243
|
-
function
|
|
1247
|
+
function _r(e, t) {
|
|
1244
1248
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1245
1249
|
}
|
|
1246
|
-
var
|
|
1250
|
+
var vr = class e {
|
|
1247
1251
|
base;
|
|
1248
1252
|
shape = null;
|
|
1249
1253
|
font = null;
|
|
@@ -1256,10 +1260,10 @@ var _r = class e {
|
|
|
1256
1260
|
this.base = e.read(t), this.themeFont = this.base.font;
|
|
1257
1261
|
}
|
|
1258
1262
|
static read(e) {
|
|
1259
|
-
if (!e || e === "dark") return { ...
|
|
1260
|
-
if (e === "light") return { ...
|
|
1261
|
-
let { style:
|
|
1262
|
-
return
|
|
1263
|
+
if (!e || e === "dark") return { ...n };
|
|
1264
|
+
if (e === "light") return { ...a };
|
|
1265
|
+
let { style: t, ...r } = e;
|
|
1266
|
+
return r;
|
|
1263
1267
|
}
|
|
1264
1268
|
getTheme() {
|
|
1265
1269
|
return this.effective ??= se(this.base, this.chartType, this.merged()), this.effective;
|
|
@@ -1268,7 +1272,7 @@ var _r = class e {
|
|
|
1268
1272
|
return this.base;
|
|
1269
1273
|
}
|
|
1270
1274
|
setTheme(t) {
|
|
1271
|
-
let n = e.read(t), r = this.font !== null &&
|
|
1275
|
+
let n = e.read(t), r = this.font !== null && _r(n.font, this.base.font);
|
|
1272
1276
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1273
1277
|
...this.base,
|
|
1274
1278
|
shape: {
|
|
@@ -1333,7 +1337,7 @@ var _r = class e {
|
|
|
1333
1337
|
return JSON.stringify(e) === JSON.stringify(this.getUserOverrides()) ? !1 : (this.user = new Map(Object.entries(e).map(([e, t]) => [e, { ...t }])), this.effective = null, !0);
|
|
1334
1338
|
}
|
|
1335
1339
|
getStyleValue(e) {
|
|
1336
|
-
return
|
|
1340
|
+
return m(this.base, this.merged(), e, this.chartType);
|
|
1337
1341
|
}
|
|
1338
1342
|
layer(e) {
|
|
1339
1343
|
return e === "host" ? this.host : this.user.get(this.base.name) ?? {};
|
|
@@ -1350,7 +1354,7 @@ var _r = class e {
|
|
|
1350
1354
|
};
|
|
1351
1355
|
//#endregion
|
|
1352
1356
|
//#region src/style/styleOptions.ts
|
|
1353
|
-
function
|
|
1357
|
+
function yr(e, t) {
|
|
1354
1358
|
return t ? {
|
|
1355
1359
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1356
1360
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1358,40 +1362,40 @@ function vr(e, t) {
|
|
|
1358
1362
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1359
1363
|
} : {};
|
|
1360
1364
|
}
|
|
1361
|
-
function
|
|
1365
|
+
function br(e) {
|
|
1362
1366
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1363
1367
|
return {
|
|
1364
1368
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1365
1369
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1366
1370
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1367
1371
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1368
|
-
...
|
|
1369
|
-
...
|
|
1372
|
+
...yr("horizontal", n?.hLine),
|
|
1373
|
+
...yr("vertical", n?.vLine),
|
|
1370
1374
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1371
1375
|
...e.overrides
|
|
1372
1376
|
};
|
|
1373
1377
|
}
|
|
1374
1378
|
//#endregion
|
|
1375
1379
|
//#region src/layout/LayoutManager.ts
|
|
1376
|
-
var
|
|
1380
|
+
var xr = 200, Sr = 80, Cr = .382, W = (e) => e.position === "top" || e.position === "bottom", wr = class {
|
|
1377
1381
|
panels = [];
|
|
1378
1382
|
containerWidth = 0;
|
|
1379
1383
|
containerHeight = 0;
|
|
1380
|
-
priceAxisWidth =
|
|
1384
|
+
priceAxisWidth = c;
|
|
1381
1385
|
leftAxisWidth = 0;
|
|
1382
1386
|
maximized = null;
|
|
1383
1387
|
aside = /* @__PURE__ */ new Set();
|
|
1384
1388
|
resize(e, t) {
|
|
1385
1389
|
this.containerWidth = e, this.containerHeight = t;
|
|
1386
1390
|
}
|
|
1387
|
-
addPanel(e, t = "bottom",
|
|
1391
|
+
addPanel(e, t = "bottom", n) {
|
|
1388
1392
|
this.maximized = null;
|
|
1389
|
-
let
|
|
1393
|
+
let r = t === "left" || t === "right";
|
|
1390
1394
|
this.panels.push({
|
|
1391
1395
|
id: e,
|
|
1392
1396
|
position: t,
|
|
1393
|
-
size:
|
|
1394
|
-
minSize:
|
|
1397
|
+
size: n ?? (r ? xr : i),
|
|
1398
|
+
minSize: r ? Sr : s,
|
|
1395
1399
|
content: {
|
|
1396
1400
|
type: "indicator",
|
|
1397
1401
|
indicatorInstanceId: e
|
|
@@ -1410,14 +1414,14 @@ var br = 200, xr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1410
1414
|
}
|
|
1411
1415
|
setPanelCollapsed(e, t) {
|
|
1412
1416
|
let n = this.panels.find((t) => t.id === e);
|
|
1413
|
-
return !n || !
|
|
1417
|
+
return !n || !W(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
|
|
1414
1418
|
}
|
|
1415
1419
|
isPanelCollapsed(e) {
|
|
1416
1420
|
return !!this.panels.find((t) => t.id === e)?.collapsed;
|
|
1417
1421
|
}
|
|
1418
1422
|
isPanelShownCollapsed(e) {
|
|
1419
1423
|
let t = this.panels.find((t) => t.id === e);
|
|
1420
|
-
return !t || !
|
|
1424
|
+
return !t || !W(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
|
|
1421
1425
|
}
|
|
1422
1426
|
setPanelScale(e, t) {
|
|
1423
1427
|
let n = this.panels.find((t) => t.id === e);
|
|
@@ -1433,7 +1437,7 @@ var br = 200, xr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1433
1437
|
}
|
|
1434
1438
|
setMaximizedPanel(e) {
|
|
1435
1439
|
let t = e === null ? null : this.panels.find((t) => t.id === e);
|
|
1436
|
-
return e !== null && (!t || !
|
|
1440
|
+
return e !== null && (!t || !W(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
|
|
1437
1441
|
}
|
|
1438
1442
|
getMaximizedPanel() {
|
|
1439
1443
|
return this.maximized;
|
|
@@ -1454,22 +1458,48 @@ var br = 200, xr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1454
1458
|
this.panels = [...this.panels].sort((e, n) => t(e) - t(n));
|
|
1455
1459
|
}
|
|
1456
1460
|
shownSize(e, t) {
|
|
1457
|
-
return
|
|
1461
|
+
return W(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
|
|
1462
|
+
}
|
|
1463
|
+
squeezed(e) {
|
|
1464
|
+
let t = /* @__PURE__ */ new Map();
|
|
1465
|
+
if (this.maximized) return t;
|
|
1466
|
+
let n = e.filter((e) => !e.collapsed), r = n.reduce((e, t) => e + t.size, 0), i = this.roomForOpen(e.length - n.length);
|
|
1467
|
+
if (n.length === 0 || r <= i) return t;
|
|
1468
|
+
let a = Math.max(i, n.length * 20), o = 0;
|
|
1469
|
+
for (let e of n) {
|
|
1470
|
+
let n = Math.max(20, Math.floor(e.size * a / r));
|
|
1471
|
+
t.set(e.id, n), o += n;
|
|
1472
|
+
}
|
|
1473
|
+
let s = n[n.length - 1];
|
|
1474
|
+
return o < a && t.set(s.id, t.get(s.id) + a - o), t;
|
|
1458
1475
|
}
|
|
1459
1476
|
setPanelPosition(e, t) {
|
|
1460
|
-
let
|
|
1461
|
-
if (
|
|
1462
|
-
let
|
|
1463
|
-
|
|
1477
|
+
let n = this.panels.find((t) => t.id === e);
|
|
1478
|
+
if (n) {
|
|
1479
|
+
let r = n.position === "left" || n.position === "right", a = t === "left" || t === "right";
|
|
1480
|
+
n.position = t, r !== a && (n.size = a ? xr : i, n.minSize = a ? Sr : s), a && (n.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1464
1481
|
}
|
|
1465
1482
|
}
|
|
1466
1483
|
setPanelSize(e, t) {
|
|
1467
1484
|
let n = this.panels.find((t) => t.id === e);
|
|
1468
1485
|
if (n) {
|
|
1469
|
-
let e =
|
|
1486
|
+
let e = W(n) ? this.containerHeight - l - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
|
|
1470
1487
|
n.size = Math.max(n.minSize, r), n.collapsed = void 0, this.maximized = null;
|
|
1471
1488
|
}
|
|
1472
1489
|
}
|
|
1490
|
+
roomForOpen(e) {
|
|
1491
|
+
let t = this.containerHeight - l;
|
|
1492
|
+
return t - Math.max(48, Math.ceil(t * Cr)) - e * 20;
|
|
1493
|
+
}
|
|
1494
|
+
setPanelHeightOnScreen(e, t) {
|
|
1495
|
+
let n = this.panels.find((t) => t.id === e);
|
|
1496
|
+
if (!n || !W(n) || this.maximized) return this.setPanelSize(e, t);
|
|
1497
|
+
let r = this.panels.filter((e) => W(e) && !this.aside.has(e.id) && e !== n), i = r.filter((e) => !e.collapsed), a = i.reduce((e, t) => e + t.size, 0), o = this.roomForOpen(r.length - i.length);
|
|
1498
|
+
if (i.length === 0 || t + a <= o) return this.setPanelSize(e, t);
|
|
1499
|
+
let s = o - i.length * 20, c = Math.min(Math.max(t, 20), s);
|
|
1500
|
+
if (c >= o) return this.setPanelSize(e, t);
|
|
1501
|
+
n.size = Math.max(n.minSize, Math.round(c * a / (o - c))), n.collapsed = void 0;
|
|
1502
|
+
}
|
|
1473
1503
|
setPriceAxisWidth(e) {
|
|
1474
1504
|
this.priceAxisWidth = e;
|
|
1475
1505
|
}
|
|
@@ -1484,122 +1514,122 @@ var br = 200, xr = 80, K = (e) => e.position === "top" || e.position === "bottom
|
|
|
1484
1514
|
return this.aside = new Set(e), t;
|
|
1485
1515
|
}
|
|
1486
1516
|
resolve() {
|
|
1487
|
-
let e = this.panels.filter((e) => !this.aside.has(e.id)), t = e.filter((e) => e.position === "left"), n = e.filter((e) => e.position === "right"), r = e.filter((e) => e.position === "top"), i = e.filter((e) => e.position === "bottom"), a = (r.length + i.length - 1) * 20, o = this.maximized ? e.find((e) => e.id === this.maximized) : void 0, s = Math.max(o?.minSize ?? 0, this.containerHeight -
|
|
1488
|
-
x:
|
|
1489
|
-
y:
|
|
1490
|
-
width: Math.max(0, this.containerWidth -
|
|
1491
|
-
height: Math.max(0, this.containerHeight -
|
|
1492
|
-
},
|
|
1493
|
-
for (let e of t)
|
|
1517
|
+
let e = this.panels.filter((e) => !this.aside.has(e.id)), t = e.filter((e) => e.position === "left"), n = e.filter((e) => e.position === "right"), r = e.filter((e) => e.position === "top"), i = e.filter((e) => e.position === "bottom"), a = (r.length + i.length - 1) * 20, o = this.maximized ? e.find((e) => e.id === this.maximized) : void 0, s = Math.max(o?.minSize ?? 0, this.containerHeight - l - 48 - a), c = this.squeezed([...r, ...i]), u = (e) => c.get(e.id) ?? this.shownSize(e, s), d = t.reduce((e, t) => e + t.size, 0), f = n.reduce((e, t) => e + t.size, 0), p = r.reduce((e, t) => e + u(t), 0), m = i.reduce((e, t) => e + u(t), 0), h = d + this.leftAxisWidth, g = {
|
|
1518
|
+
x: h,
|
|
1519
|
+
y: p,
|
|
1520
|
+
width: Math.max(0, this.containerWidth - h - f - this.priceAxisWidth),
|
|
1521
|
+
height: Math.max(0, this.containerHeight - p - m - l)
|
|
1522
|
+
}, _ = [], v = [], y = 0;
|
|
1523
|
+
for (let e of t) _.push({
|
|
1494
1524
|
config: e,
|
|
1495
1525
|
rect: {
|
|
1496
|
-
x:
|
|
1526
|
+
x: y,
|
|
1497
1527
|
y: 0,
|
|
1498
1528
|
width: e.size,
|
|
1499
|
-
height: this.containerHeight -
|
|
1529
|
+
height: this.containerHeight - l
|
|
1500
1530
|
}
|
|
1501
|
-
}),
|
|
1531
|
+
}), v.push({
|
|
1502
1532
|
panelId: e.id,
|
|
1503
1533
|
rect: {
|
|
1504
|
-
x:
|
|
1534
|
+
x: y + e.size - 2,
|
|
1505
1535
|
y: 0,
|
|
1506
1536
|
width: 4,
|
|
1507
1537
|
height: this.containerHeight
|
|
1508
1538
|
},
|
|
1509
1539
|
orientation: "vertical"
|
|
1510
|
-
}),
|
|
1511
|
-
let
|
|
1540
|
+
}), y += e.size;
|
|
1541
|
+
let b = 0;
|
|
1512
1542
|
for (let e of r) {
|
|
1513
|
-
let t =
|
|
1514
|
-
|
|
1543
|
+
let t = u(e);
|
|
1544
|
+
_.push({
|
|
1515
1545
|
config: e,
|
|
1516
1546
|
rect: {
|
|
1517
|
-
x:
|
|
1518
|
-
y,
|
|
1519
|
-
width:
|
|
1547
|
+
x: h,
|
|
1548
|
+
y: b,
|
|
1549
|
+
width: g.width,
|
|
1520
1550
|
height: t
|
|
1521
1551
|
}
|
|
1522
|
-
}),
|
|
1552
|
+
}), v.push({
|
|
1523
1553
|
panelId: e.id,
|
|
1524
1554
|
rect: {
|
|
1525
|
-
x:
|
|
1526
|
-
y:
|
|
1527
|
-
width:
|
|
1555
|
+
x: h,
|
|
1556
|
+
y: b + t - 2,
|
|
1557
|
+
width: g.width,
|
|
1528
1558
|
height: 4
|
|
1529
1559
|
},
|
|
1530
1560
|
orientation: "horizontal"
|
|
1531
|
-
}),
|
|
1561
|
+
}), b += t;
|
|
1532
1562
|
}
|
|
1533
|
-
|
|
1563
|
+
b = g.y + g.height;
|
|
1534
1564
|
for (let e of i) {
|
|
1535
|
-
let t =
|
|
1536
|
-
|
|
1565
|
+
let t = u(e);
|
|
1566
|
+
_.push({
|
|
1537
1567
|
config: e,
|
|
1538
1568
|
rect: {
|
|
1539
|
-
x:
|
|
1540
|
-
y,
|
|
1541
|
-
width:
|
|
1569
|
+
x: h,
|
|
1570
|
+
y: b,
|
|
1571
|
+
width: g.width,
|
|
1542
1572
|
height: t
|
|
1543
1573
|
}
|
|
1544
|
-
}),
|
|
1574
|
+
}), v.push({
|
|
1545
1575
|
panelId: e.id,
|
|
1546
1576
|
rect: {
|
|
1547
|
-
x:
|
|
1548
|
-
y:
|
|
1549
|
-
width:
|
|
1577
|
+
x: h,
|
|
1578
|
+
y: b - 2,
|
|
1579
|
+
width: g.width,
|
|
1550
1580
|
height: 4
|
|
1551
1581
|
},
|
|
1552
1582
|
orientation: "horizontal"
|
|
1553
|
-
}),
|
|
1583
|
+
}), b += t;
|
|
1554
1584
|
}
|
|
1555
|
-
|
|
1556
|
-
for (let e of n)
|
|
1585
|
+
y = h + g.width + this.priceAxisWidth;
|
|
1586
|
+
for (let e of n) _.push({
|
|
1557
1587
|
config: e,
|
|
1558
1588
|
rect: {
|
|
1559
|
-
x:
|
|
1589
|
+
x: y,
|
|
1560
1590
|
y: 0,
|
|
1561
1591
|
width: e.size,
|
|
1562
|
-
height: this.containerHeight -
|
|
1592
|
+
height: this.containerHeight - l
|
|
1563
1593
|
}
|
|
1564
|
-
}),
|
|
1594
|
+
}), v.push({
|
|
1565
1595
|
panelId: e.id,
|
|
1566
1596
|
rect: {
|
|
1567
|
-
x:
|
|
1597
|
+
x: y - 2,
|
|
1568
1598
|
y: 0,
|
|
1569
1599
|
width: 4,
|
|
1570
1600
|
height: this.containerHeight
|
|
1571
1601
|
},
|
|
1572
1602
|
orientation: "vertical"
|
|
1573
|
-
}),
|
|
1603
|
+
}), y += e.size;
|
|
1574
1604
|
return {
|
|
1575
|
-
mainChartRect:
|
|
1576
|
-
panels:
|
|
1577
|
-
dividers:
|
|
1605
|
+
mainChartRect: g,
|
|
1606
|
+
panels: _,
|
|
1607
|
+
dividers: v
|
|
1578
1608
|
};
|
|
1579
1609
|
}
|
|
1580
1610
|
getMainChartRect() {
|
|
1581
1611
|
return this.resolve().mainChartRect;
|
|
1582
1612
|
}
|
|
1583
|
-
},
|
|
1584
|
-
function
|
|
1585
|
-
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure:
|
|
1613
|
+
}, Tr = 14, Er = 14, Dr = 22, Or = 4;
|
|
1614
|
+
function kr(e) {
|
|
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] : [
|
|
1586
1616
|
t,
|
|
1587
1617
|
n,
|
|
1588
1618
|
r
|
|
1589
|
-
], p =
|
|
1619
|
+
], p = c;
|
|
1590
1620
|
for (let t of f) {
|
|
1591
1621
|
if (!Number.isFinite(t)) continue;
|
|
1592
|
-
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) :
|
|
1593
|
-
p = Math.max(p,
|
|
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}`) + Tr, s(r, `bold 11px ${a}`) + Er, s(r, `600 ${o}px ${a}`) + Dr);
|
|
1594
1624
|
}
|
|
1595
|
-
return p <=
|
|
1625
|
+
return p <= c ? c : Math.ceil(p / Or) * Or;
|
|
1596
1626
|
}
|
|
1597
|
-
function
|
|
1627
|
+
function Ar(e, t) {
|
|
1598
1628
|
return t > e || t <= e - 12 ? t : e;
|
|
1599
1629
|
}
|
|
1600
1630
|
//#endregion
|
|
1601
1631
|
//#region src/layout/labelWidths.ts
|
|
1602
|
-
var
|
|
1632
|
+
var jr = 512, Mr = class {
|
|
1603
1633
|
widths = /* @__PURE__ */ new Map();
|
|
1604
1634
|
fonts;
|
|
1605
1635
|
forget = () => this.widths.clear();
|
|
@@ -1610,12 +1640,12 @@ var kr = 512, Ar = class {
|
|
|
1610
1640
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1611
1641
|
if (i !== void 0) return i;
|
|
1612
1642
|
let a = n();
|
|
1613
|
-
return this.widths.size >=
|
|
1643
|
+
return this.widths.size >= jr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1614
1644
|
}
|
|
1615
1645
|
destroy() {
|
|
1616
1646
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1617
1647
|
}
|
|
1618
|
-
},
|
|
1648
|
+
}, Nr = class {
|
|
1619
1649
|
netY = 0;
|
|
1620
1650
|
travelX = 0;
|
|
1621
1651
|
engaged = !1;
|
|
@@ -1631,11 +1661,11 @@ var kr = 512, Ar = class {
|
|
|
1631
1661
|
}
|
|
1632
1662
|
return this.engaged;
|
|
1633
1663
|
}
|
|
1634
|
-
},
|
|
1635
|
-
function
|
|
1664
|
+
}, Pr = 1;
|
|
1665
|
+
function Fr(e, t) {
|
|
1636
1666
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1637
1667
|
}
|
|
1638
|
-
function
|
|
1668
|
+
function G(e) {
|
|
1639
1669
|
switch (e.kind) {
|
|
1640
1670
|
case "indicator": return `indicator:${e.plugin.descriptor.id}`;
|
|
1641
1671
|
case "drawing": return `drawing:${e.plugin.descriptor.type}`;
|
|
@@ -1645,25 +1675,25 @@ function q(e) {
|
|
|
1645
1675
|
}
|
|
1646
1676
|
//#endregion
|
|
1647
1677
|
//#region src/plugins/registry.ts
|
|
1648
|
-
var
|
|
1649
|
-
function
|
|
1650
|
-
|
|
1678
|
+
var K = /* @__PURE__ */ new Map();
|
|
1679
|
+
function Ir(e) {
|
|
1680
|
+
K.set(G(e), e);
|
|
1651
1681
|
}
|
|
1652
|
-
function
|
|
1653
|
-
return
|
|
1682
|
+
function Lr(e) {
|
|
1683
|
+
return K.delete(e);
|
|
1654
1684
|
}
|
|
1655
|
-
function
|
|
1656
|
-
return [...
|
|
1685
|
+
function Rr() {
|
|
1686
|
+
return [...K.values()];
|
|
1657
1687
|
}
|
|
1658
|
-
function
|
|
1659
|
-
|
|
1688
|
+
function zr() {
|
|
1689
|
+
K.clear();
|
|
1660
1690
|
}
|
|
1661
1691
|
//#endregion
|
|
1662
1692
|
//#region src/plugins/PluginManager.ts
|
|
1663
|
-
var
|
|
1693
|
+
var Br = class {
|
|
1664
1694
|
plugins = /* @__PURE__ */ new Map();
|
|
1665
1695
|
constructor(e, t = {}) {
|
|
1666
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1696
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Rr()) this.add(e);
|
|
1667
1697
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1668
1698
|
}
|
|
1669
1699
|
register(e) {
|
|
@@ -1691,17 +1721,17 @@ var Rr = class {
|
|
|
1691
1721
|
return e;
|
|
1692
1722
|
}
|
|
1693
1723
|
add(e) {
|
|
1694
|
-
this.plugins.set(
|
|
1724
|
+
this.plugins.set(G(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1695
1725
|
}
|
|
1696
|
-
},
|
|
1726
|
+
}, Vr = {
|
|
1697
1727
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1698
1728
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1699
1729
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1700
1730
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1701
1731
|
positionClose: (e, t) => e.closePosition(t),
|
|
1702
|
-
positionReverse: (e, t, n) =>
|
|
1732
|
+
positionReverse: (e, t, n) => Hr(e, t, n)
|
|
1703
1733
|
};
|
|
1704
|
-
async function
|
|
1734
|
+
async function Hr(e, t, n) {
|
|
1705
1735
|
let { reversing: r } = n;
|
|
1706
1736
|
if (!r.has(t.positionId)) {
|
|
1707
1737
|
r.add(t.positionId);
|
|
@@ -1730,7 +1760,7 @@ async function Br(e, t, n) {
|
|
|
1730
1760
|
}
|
|
1731
1761
|
}
|
|
1732
1762
|
}
|
|
1733
|
-
function
|
|
1763
|
+
function Ur(e, t) {
|
|
1734
1764
|
let n = [], r = null, i = {
|
|
1735
1765
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1736
1766
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1740,8 +1770,8 @@ function Vr(e, t) {
|
|
|
1740
1770
|
e.data && t.onFill?.(e.data);
|
|
1741
1771
|
};
|
|
1742
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));
|
|
1743
|
-
for (let r of Object.keys(
|
|
1744
|
-
let a =
|
|
1773
|
+
for (let r of Object.keys(Vr)) {
|
|
1774
|
+
let a = Vr[r], o = t.onIntent(r, (n) => {
|
|
1745
1775
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1746
1776
|
message: `Execution command failed: ${r}`,
|
|
1747
1777
|
cause: e
|
|
@@ -1755,7 +1785,7 @@ function Vr(e, t) {
|
|
|
1755
1785
|
}
|
|
1756
1786
|
//#endregion
|
|
1757
1787
|
//#region src/replay/ReplayStepLoader.ts
|
|
1758
|
-
var
|
|
1788
|
+
var Wr = 1e3, Gr = class {
|
|
1759
1789
|
pieces = /* @__PURE__ */ new Map();
|
|
1760
1790
|
asked = /* @__PURE__ */ new Set();
|
|
1761
1791
|
inFlight = !1;
|
|
@@ -1788,7 +1818,7 @@ var Hr = 1e3, Ur = class {
|
|
|
1788
1818
|
this.done = !0;
|
|
1789
1819
|
}
|
|
1790
1820
|
ask(e, t) {
|
|
1791
|
-
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(Wr / 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);
|
|
1792
1822
|
for (let e of l) this.asked.add(e.time);
|
|
1793
1823
|
this.inFlight = !0, a({
|
|
1794
1824
|
state: "loading",
|
|
@@ -1829,12 +1859,12 @@ var Hr = 1e3, Ur = class {
|
|
|
1829
1859
|
...n === void 0 ? {} : { error: n }
|
|
1830
1860
|
});
|
|
1831
1861
|
}
|
|
1832
|
-
},
|
|
1833
|
-
function
|
|
1834
|
-
let n = (e.high - e.low) *
|
|
1835
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1862
|
+
}, Kr = 1 / 3, qr = .25, Jr = .5;
|
|
1863
|
+
function Yr(e, t) {
|
|
1864
|
+
let n = (e.high - e.low) * qr;
|
|
1865
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * Jr;
|
|
1836
1866
|
}
|
|
1837
|
-
function
|
|
1867
|
+
function Xr(e) {
|
|
1838
1868
|
return e.close >= e.open ? [
|
|
1839
1869
|
e.open,
|
|
1840
1870
|
e.low,
|
|
@@ -1847,22 +1877,22 @@ function Jr(e) {
|
|
|
1847
1877
|
e.close
|
|
1848
1878
|
];
|
|
1849
1879
|
}
|
|
1850
|
-
function
|
|
1851
|
-
let r =
|
|
1880
|
+
function Zr(e, t, n) {
|
|
1881
|
+
let r = Xr(e), i = [
|
|
1852
1882
|
1,
|
|
1853
1883
|
2,
|
|
1854
1884
|
3
|
|
1855
1885
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1856
1886
|
return r.forEach((r, c) => {
|
|
1857
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1887
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : Kr), !(c === 0 && t > 0) && o.push({
|
|
1858
1888
|
price: r,
|
|
1859
1889
|
time: e.time,
|
|
1860
1890
|
at: (t + s) / n
|
|
1861
1891
|
});
|
|
1862
1892
|
}), o;
|
|
1863
1893
|
}
|
|
1864
|
-
function
|
|
1865
|
-
let n = t.length > 0 &&
|
|
1894
|
+
function Qr(e, t = []) {
|
|
1895
|
+
let n = t.length > 0 && Yr(e, t) ? t : [e], r = n.length, i = $r(n.flatMap((e, t) => Zr(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1866
1896
|
return {
|
|
1867
1897
|
bar: e,
|
|
1868
1898
|
points: i,
|
|
@@ -1872,7 +1902,7 @@ function Xr(e, t = []) {
|
|
|
1872
1902
|
}))
|
|
1873
1903
|
};
|
|
1874
1904
|
}
|
|
1875
|
-
function
|
|
1905
|
+
function $r(e, t) {
|
|
1876
1906
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1877
1907
|
...e,
|
|
1878
1908
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1887,7 +1917,7 @@ function Zr(e, t) {
|
|
|
1887
1917
|
};
|
|
1888
1918
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1889
1919
|
}
|
|
1890
|
-
function
|
|
1920
|
+
function ei(e, t) {
|
|
1891
1921
|
let n = e.points;
|
|
1892
1922
|
if (t <= n[0].at) return n[0].price;
|
|
1893
1923
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1896,8 +1926,8 @@ function Qr(e, t) {
|
|
|
1896
1926
|
}
|
|
1897
1927
|
return n[n.length - 1].price;
|
|
1898
1928
|
}
|
|
1899
|
-
var
|
|
1900
|
-
function
|
|
1929
|
+
var ti = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1930
|
+
function ni(e, t) {
|
|
1901
1931
|
let n = 0, r = 0;
|
|
1902
1932
|
for (let i of e.volumeAt) {
|
|
1903
1933
|
if (t >= i.at) {
|
|
@@ -1908,10 +1938,10 @@ function ei(e, t) {
|
|
|
1908
1938
|
}
|
|
1909
1939
|
return n;
|
|
1910
1940
|
}
|
|
1911
|
-
function
|
|
1912
|
-
let n =
|
|
1941
|
+
function ri(e, t) {
|
|
1942
|
+
let n = ti(t);
|
|
1913
1943
|
if (n >= 1) return { ...e.bar };
|
|
1914
|
-
let r =
|
|
1944
|
+
let r = ei(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1915
1945
|
for (let t of e.points) {
|
|
1916
1946
|
if (t.at > n) break;
|
|
1917
1947
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1922,29 +1952,29 @@ function ti(e, t) {
|
|
|
1922
1952
|
high: i,
|
|
1923
1953
|
low: a,
|
|
1924
1954
|
close: r,
|
|
1925
|
-
volume:
|
|
1955
|
+
volume: ni(e, n)
|
|
1926
1956
|
};
|
|
1927
1957
|
}
|
|
1928
|
-
function
|
|
1929
|
-
let n =
|
|
1958
|
+
function ii(e, t) {
|
|
1959
|
+
let n = ti(t), r = 0;
|
|
1930
1960
|
for (let t of e.points) {
|
|
1931
1961
|
if (t.at > n) break;
|
|
1932
1962
|
r = t.at;
|
|
1933
1963
|
}
|
|
1934
1964
|
return r;
|
|
1935
1965
|
}
|
|
1936
|
-
function
|
|
1966
|
+
function q(e, t, n) {
|
|
1937
1967
|
let r = [], i = e.bar.time;
|
|
1938
1968
|
for (let a of e.points) {
|
|
1939
1969
|
if (a.at > n) break;
|
|
1940
1970
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1941
1971
|
}
|
|
1942
|
-
let a =
|
|
1972
|
+
let a = ei(e, n);
|
|
1943
1973
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1944
1974
|
}
|
|
1945
1975
|
//#endregion
|
|
1946
1976
|
//#region src/replay/replayStep.ts
|
|
1947
|
-
var
|
|
1977
|
+
var ai = [
|
|
1948
1978
|
"1m",
|
|
1949
1979
|
"3m",
|
|
1950
1980
|
"5m",
|
|
@@ -1955,27 +1985,27 @@ var ri = [
|
|
|
1955
1985
|
"4h",
|
|
1956
1986
|
"1d"
|
|
1957
1987
|
];
|
|
1958
|
-
function
|
|
1988
|
+
function oi(e, t) {
|
|
1959
1989
|
let n = E(e);
|
|
1960
|
-
return n > 0 ?
|
|
1990
|
+
return n > 0 ? ai.filter((e) => {
|
|
1961
1991
|
let r = E(e);
|
|
1962
1992
|
return r < n && n % r === 0 && t(e);
|
|
1963
1993
|
}) : [];
|
|
1964
1994
|
}
|
|
1965
|
-
function
|
|
1966
|
-
let r =
|
|
1995
|
+
function si(e, t, n) {
|
|
1996
|
+
let r = oi(t, n);
|
|
1967
1997
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1968
1998
|
let i = E(t);
|
|
1969
1999
|
return r.find((e) => i / E(e) <= 60) ?? null;
|
|
1970
2000
|
}
|
|
1971
2001
|
//#endregion
|
|
1972
2002
|
//#region src/model/AlertWatch.ts
|
|
1973
|
-
function
|
|
2003
|
+
function ci(e, t) {
|
|
1974
2004
|
e.setBarTime(t.barTime);
|
|
1975
2005
|
let n = new Map([["price", t.price]]);
|
|
1976
|
-
t.lines &&
|
|
2006
|
+
t.lines && li(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
1977
2007
|
}
|
|
1978
|
-
function
|
|
2008
|
+
function li(e, t, n) {
|
|
1979
2009
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
1980
2010
|
for (let e of r) {
|
|
1981
2011
|
if (n.has(e)) continue;
|
|
@@ -1985,7 +2015,7 @@ function si(e, t, n) {
|
|
|
1985
2015
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
1986
2016
|
}
|
|
1987
2017
|
}
|
|
1988
|
-
function
|
|
2018
|
+
function ui(e, t, n, r) {
|
|
1989
2019
|
let i = (e) => {
|
|
1990
2020
|
let i = e.indexOf(":");
|
|
1991
2021
|
if (i <= 0) return null;
|
|
@@ -2007,35 +2037,35 @@ function ci(e, t, n, r) {
|
|
|
2007
2037
|
});
|
|
2008
2038
|
}
|
|
2009
2039
|
}
|
|
2010
|
-
function
|
|
2040
|
+
function di(e, t) {
|
|
2011
2041
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2012
2042
|
return r ? r + e.slice(n) : e;
|
|
2013
2043
|
}
|
|
2014
|
-
var
|
|
2044
|
+
var fi = [
|
|
2015
2045
|
"crossing",
|
|
2016
2046
|
"crossingUp",
|
|
2017
2047
|
"crossingDown"
|
|
2018
2048
|
];
|
|
2019
|
-
function
|
|
2049
|
+
function pi(e, t, n, r, i) {
|
|
2020
2050
|
e.clearAlerts();
|
|
2021
2051
|
for (let a of t) {
|
|
2022
2052
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2023
2053
|
if (a.drawingId) {
|
|
2024
|
-
r(a.drawingId) &&
|
|
2054
|
+
r(a.drawingId) && fi.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2025
2055
|
continue;
|
|
2026
2056
|
}
|
|
2027
2057
|
let t = {
|
|
2028
2058
|
...Wt(a),
|
|
2029
|
-
...a.target ? { target:
|
|
2059
|
+
...a.target ? { target: di(a.target, n) } : {}
|
|
2030
2060
|
};
|
|
2031
2061
|
try {
|
|
2032
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2062
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, di(a.channel, n), a.label, t);
|
|
2033
2063
|
} catch (e) {
|
|
2034
2064
|
i(e);
|
|
2035
2065
|
}
|
|
2036
2066
|
}
|
|
2037
2067
|
}
|
|
2038
|
-
var
|
|
2068
|
+
var mi = class {
|
|
2039
2069
|
kept = /* @__PURE__ */ new Map();
|
|
2040
2070
|
constructor(e) {
|
|
2041
2071
|
this.alerts = e;
|
|
@@ -2052,7 +2082,7 @@ var fi = class {
|
|
|
2052
2082
|
return this.kept.clear(), this.alerts.pruneDrawingAlerts(e);
|
|
2053
2083
|
}
|
|
2054
2084
|
};
|
|
2055
|
-
function
|
|
2085
|
+
function J(e, t) {
|
|
2056
2086
|
let n = 0, r = e.length;
|
|
2057
2087
|
for (; n < r;) {
|
|
2058
2088
|
let i = n + r >> 1;
|
|
@@ -2060,7 +2090,7 @@ function pi(e, t) {
|
|
|
2060
2090
|
}
|
|
2061
2091
|
return n;
|
|
2062
2092
|
}
|
|
2063
|
-
function
|
|
2093
|
+
function Y(e, t) {
|
|
2064
2094
|
let n = 0, r = e.length;
|
|
2065
2095
|
for (; n < r;) {
|
|
2066
2096
|
let i = n + r >> 1;
|
|
@@ -2088,7 +2118,7 @@ function _i(e, t, n) {
|
|
|
2088
2118
|
fraction: n.fraction
|
|
2089
2119
|
}
|
|
2090
2120
|
} : r.time <= n.time ? null : {
|
|
2091
|
-
marks: gi(e.slice(
|
|
2121
|
+
marks: gi(e.slice(Y(e, n.time), t + 1)),
|
|
2092
2122
|
fed: {
|
|
2093
2123
|
time: r.time,
|
|
2094
2124
|
fraction: n.fraction
|
|
@@ -2103,45 +2133,37 @@ function vi(e, t, n, r, i, a) {
|
|
|
2103
2133
|
fraction: r
|
|
2104
2134
|
};
|
|
2105
2135
|
if (i.time === null) return {
|
|
2106
|
-
marks: [[
|
|
2136
|
+
marks: [[ri(n, r).close, o.time]],
|
|
2107
2137
|
fed: s
|
|
2108
2138
|
};
|
|
2109
2139
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
2110
2140
|
if (o.time === i.time) return {
|
|
2111
|
-
marks:
|
|
2141
|
+
marks: q(n, i.fraction, r),
|
|
2112
2142
|
fed: s
|
|
2113
2143
|
};
|
|
2114
|
-
let c = [], l =
|
|
2115
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...
|
|
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(...gi(e.slice(Y(e, i.time), t))), c.push(...q(n, -1, r)), {
|
|
2116
2146
|
marks: c,
|
|
2117
2147
|
fed: s
|
|
2118
2148
|
};
|
|
2119
2149
|
}
|
|
2120
2150
|
//#endregion
|
|
2121
2151
|
//#region src/Chart.ts
|
|
2122
|
-
var yi = "exchange"
|
|
2123
|
-
function
|
|
2124
|
-
if (typeof e == "string" && e !== "exchange" && !
|
|
2152
|
+
var yi = "exchange";
|
|
2153
|
+
function bi(e) {
|
|
2154
|
+
if (typeof e == "string" && e !== "exchange" && !x(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
2125
2155
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2126
2156
|
}
|
|
2127
|
-
|
|
2128
|
-
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : T(e);
|
|
2129
|
-
return i === void 0 ? e : {
|
|
2130
|
-
...e,
|
|
2131
|
-
timeZone: i,
|
|
2132
|
-
timezone: i
|
|
2133
|
-
};
|
|
2134
|
-
}
|
|
2135
|
-
var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
2157
|
+
var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
2136
2158
|
ArrowLeft: [-1, 0],
|
|
2137
2159
|
ArrowRight: [1, 0],
|
|
2138
2160
|
ArrowUp: [0, -1],
|
|
2139
2161
|
ArrowDown: [0, 1]
|
|
2140
|
-
},
|
|
2141
|
-
static version = "
|
|
2162
|
+
}, Ei = new Set(["horizontalLine", "crossLine"]), Di = new Set(["verticalLine", "crossLine"]), Oi = class {
|
|
2163
|
+
static version = "2.0.0-beta.1";
|
|
2142
2164
|
engine;
|
|
2143
2165
|
viewport;
|
|
2144
|
-
series = new
|
|
2166
|
+
series = new Hn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2145
2167
|
themeManager;
|
|
2146
2168
|
layoutManager;
|
|
2147
2169
|
pluginManager;
|
|
@@ -2166,9 +2188,9 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2166
2188
|
lastBackground = null;
|
|
2167
2189
|
renderScheduled = !1;
|
|
2168
2190
|
renderDeferred = !1;
|
|
2169
|
-
priceAxisWidth =
|
|
2191
|
+
priceAxisWidth = c;
|
|
2170
2192
|
measureCtx;
|
|
2171
|
-
labelWidths = new
|
|
2193
|
+
labelWidths = new Mr();
|
|
2172
2194
|
containerSizeCache = null;
|
|
2173
2195
|
containerSizeCacheTime = 0;
|
|
2174
2196
|
lastEmittedRange = null;
|
|
@@ -2181,7 +2203,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2181
2203
|
unrestoredIndicators = [];
|
|
2182
2204
|
drawingAlerts = null;
|
|
2183
2205
|
zoomAreaMode = !1;
|
|
2184
|
-
priceAxisAddButton = new
|
|
2206
|
+
priceAxisAddButton = new it();
|
|
2185
2207
|
displayTz = null;
|
|
2186
2208
|
timeZoneSetting = null;
|
|
2187
2209
|
symbolInfo = null;
|
|
@@ -2192,7 +2214,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2192
2214
|
studyZoneReleaseQueued = !1;
|
|
2193
2215
|
sessionBreaks;
|
|
2194
2216
|
sessionShading;
|
|
2195
|
-
hostSessionHours = { ...
|
|
2217
|
+
hostSessionHours = { ...je };
|
|
2196
2218
|
compareRenderer;
|
|
2197
2219
|
countdownInterval = null;
|
|
2198
2220
|
pausedFor = {
|
|
@@ -2211,7 +2233,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2211
2233
|
signalMarkerManager;
|
|
2212
2234
|
tradeZoneManager;
|
|
2213
2235
|
measureOverlay;
|
|
2214
|
-
selectionBoxOverlay = new
|
|
2236
|
+
selectionBoxOverlay = new pt();
|
|
2215
2237
|
replayManager;
|
|
2216
2238
|
replayBarUnsub = null;
|
|
2217
2239
|
replaySeeking = !1;
|
|
@@ -2226,7 +2248,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2226
2248
|
replayForming = null;
|
|
2227
2249
|
replayPhaseUnsub = null;
|
|
2228
2250
|
undoRedoManager;
|
|
2229
|
-
autoSaveScheduler = new
|
|
2251
|
+
autoSaveScheduler = new Fn((e) => this.saveState(e));
|
|
2230
2252
|
animator;
|
|
2231
2253
|
crosshairTooltip;
|
|
2232
2254
|
pinnedTooltip;
|
|
@@ -2238,16 +2260,16 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2238
2260
|
disposed = !1;
|
|
2239
2261
|
chartTypeOptions = {};
|
|
2240
2262
|
mainSeriesVisible = !0;
|
|
2241
|
-
priceLines = new
|
|
2242
|
-
symbolSeries = new
|
|
2263
|
+
priceLines = new at();
|
|
2264
|
+
symbolSeries = new bt();
|
|
2243
2265
|
extendedHours = !0;
|
|
2244
2266
|
replayRestarting = !1;
|
|
2245
2267
|
symbolRequests;
|
|
2246
2268
|
gridRenderer;
|
|
2247
2269
|
priceAxis;
|
|
2248
|
-
leftPriceAxis = new
|
|
2270
|
+
leftPriceAxis = new rt();
|
|
2249
2271
|
leftScaleRequested = !1;
|
|
2250
|
-
leftAxisWidth =
|
|
2272
|
+
leftAxisWidth = c;
|
|
2251
2273
|
leftViewport = null;
|
|
2252
2274
|
timeAxis;
|
|
2253
2275
|
options;
|
|
@@ -2261,6 +2283,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2261
2283
|
priceUnit = null;
|
|
2262
2284
|
paneTitles = !0;
|
|
2263
2285
|
priceFit;
|
|
2286
|
+
density;
|
|
2264
2287
|
keyboardHandler = null;
|
|
2265
2288
|
a11y = null;
|
|
2266
2289
|
onWindowKeyDown = null;
|
|
@@ -2275,11 +2298,13 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2275
2298
|
hostHistoryLoader = !1;
|
|
2276
2299
|
snapshotKey = null;
|
|
2277
2300
|
historyCheckQueued = !1;
|
|
2278
|
-
constructor(e,
|
|
2279
|
-
|
|
2280
|
-
...
|
|
2281
|
-
chartType:
|
|
2282
|
-
}, this.numberLocale =
|
|
2301
|
+
constructor(e, n) {
|
|
2302
|
+
n.timeZone != null && bi(n.timeZone), this.container = e, this.options = {
|
|
2303
|
+
...n,
|
|
2304
|
+
chartType: n.chartType ?? "candlestick"
|
|
2305
|
+
}, this.numberLocale = n.numberLocale ?? "en-US", this.priceFit = new Wn(n.autoScale !== !1), this.density = n.density === "compact" ? "compact" : "comfortable";
|
|
2306
|
+
let r = t[this.density];
|
|
2307
|
+
this.priceFit.setSpacing(r), this.display = new qn({
|
|
2283
2308
|
bars: () => this.series.bars(),
|
|
2284
2309
|
version: () => this.series.version(),
|
|
2285
2310
|
chartType: () => this.options.chartType,
|
|
@@ -2287,66 +2312,66 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2287
2312
|
lookup: (e) => this.pluginManager.getChartType(e),
|
|
2288
2313
|
stepAt: (e) => this.stepAt(e),
|
|
2289
2314
|
onBoxSize: (e) => {
|
|
2290
|
-
this.chartRenderer instanceof
|
|
2315
|
+
this.chartRenderer instanceof nt && this.chartRenderer.setBoxSize(e);
|
|
2291
2316
|
}
|
|
2292
2317
|
});
|
|
2293
|
-
let
|
|
2318
|
+
let i = n.features ?? {};
|
|
2294
2319
|
this.features = {
|
|
2295
|
-
drawings:
|
|
2296
|
-
drawingTools:
|
|
2297
|
-
drawingMagnet:
|
|
2298
|
-
drawingUndoRedo:
|
|
2299
|
-
trading:
|
|
2300
|
-
tradingContextMenu:
|
|
2301
|
-
priceAxisAddButton:
|
|
2302
|
-
indicators:
|
|
2303
|
-
indicatorIds:
|
|
2304
|
-
panning:
|
|
2305
|
-
zooming:
|
|
2306
|
-
crosshair:
|
|
2307
|
-
crosshairTooltip:
|
|
2308
|
-
keyboard:
|
|
2309
|
-
priceAxis:
|
|
2310
|
-
timeAxis:
|
|
2311
|
-
grid:
|
|
2312
|
-
legend:
|
|
2313
|
-
indicatorValueLabels:
|
|
2314
|
-
alignAxisLabels:
|
|
2315
|
-
drawingAxisSpans:
|
|
2316
|
-
volume:
|
|
2317
|
-
watermark:
|
|
2318
|
-
saveLoad:
|
|
2319
|
-
screenshot:
|
|
2320
|
-
alerts:
|
|
2321
|
-
replay:
|
|
2322
|
-
sessionBreaks:
|
|
2323
|
-
barCountdown:
|
|
2324
|
-
compareSymbols:
|
|
2325
|
-
dataExport:
|
|
2326
|
-
logScale:
|
|
2327
|
-
timeframes:
|
|
2328
|
-
defaultTimeframeFavorites:
|
|
2329
|
-
}, 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
|
|
2320
|
+
drawings: i.drawings ?? !0,
|
|
2321
|
+
drawingTools: i.drawingTools ?? [],
|
|
2322
|
+
drawingMagnet: i.drawingMagnet ?? !0,
|
|
2323
|
+
drawingUndoRedo: i.drawingUndoRedo ?? !0,
|
|
2324
|
+
trading: i.trading ?? !0,
|
|
2325
|
+
tradingContextMenu: i.tradingContextMenu ?? !1,
|
|
2326
|
+
priceAxisAddButton: i.priceAxisAddButton ?? !1,
|
|
2327
|
+
indicators: i.indicators ?? !0,
|
|
2328
|
+
indicatorIds: i.indicatorIds ?? [],
|
|
2329
|
+
panning: i.panning ?? !0,
|
|
2330
|
+
zooming: i.zooming ?? !0,
|
|
2331
|
+
crosshair: i.crosshair ?? !0,
|
|
2332
|
+
crosshairTooltip: i.crosshairTooltip ?? !0,
|
|
2333
|
+
keyboard: i.keyboard ?? !0,
|
|
2334
|
+
priceAxis: i.priceAxis ?? !0,
|
|
2335
|
+
timeAxis: i.timeAxis ?? !0,
|
|
2336
|
+
grid: i.grid ?? n.grid?.visible ?? !0,
|
|
2337
|
+
legend: i.legend ?? !0,
|
|
2338
|
+
indicatorValueLabels: i.indicatorValueLabels ?? !1,
|
|
2339
|
+
alignAxisLabels: i.alignAxisLabels ?? !0,
|
|
2340
|
+
drawingAxisSpans: i.drawingAxisSpans ?? !0,
|
|
2341
|
+
volume: i.volume ?? !0,
|
|
2342
|
+
watermark: i.watermark ?? !0,
|
|
2343
|
+
saveLoad: i.saveLoad ?? !0,
|
|
2344
|
+
screenshot: i.screenshot ?? !0,
|
|
2345
|
+
alerts: i.alerts ?? !0,
|
|
2346
|
+
replay: i.replay ?? !0,
|
|
2347
|
+
sessionBreaks: i.sessionBreaks ?? !0,
|
|
2348
|
+
barCountdown: i.barCountdown ?? !0,
|
|
2349
|
+
compareSymbols: i.compareSymbols ?? !0,
|
|
2350
|
+
dataExport: i.dataExport ?? !0,
|
|
2351
|
+
logScale: i.logScale ?? !0,
|
|
2352
|
+
timeframes: i.timeframes ?? [],
|
|
2353
|
+
defaultTimeframeFavorites: i.defaultTimeframeFavorites ?? []
|
|
2354
|
+
}, 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 gr({
|
|
2330
2355
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2331
2356
|
prepend: (e) => this.prependBars(e),
|
|
2332
2357
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2333
|
-
}), this.themeManager = new
|
|
2358
|
+
}), this.themeManager = new vr(n.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(br(n), "host", !1), this.container.style.backgroundColor || (this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background), this.layoutManager = new wr(), this.indicatorEngine = new He(), this.panes = new Yn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new $n(this.indicatorEngine, this.layoutManager, {
|
|
2334
2359
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2335
2360
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2336
2361
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2337
|
-
}), this.symbolRequests = new
|
|
2338
|
-
this.syncRenderContext(), this.engine.requestRender(
|
|
2362
|
+
}), this.symbolRequests = new cr(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Br(this.indicatorEngine, { plugins: n.plugins }), this.eventBus = new Ie(), Kt(this.indicatorEngine), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new _t(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.indicatorEngine.register(new De(this.symbolSeries)), n.indicatorWorker === "auto" && this.useIndicatorWorker(), this.drawingManager = new Ne(), Gt(this.drawingManager), this.drawingRenderer = new Pe(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingRenderer.setTimeFormat((e) => this.crosshairHandler.formatTime(e, this.getDisplayData())), this.drawingManager.setRequestRender(() => {
|
|
2363
|
+
this.syncRenderContext(), this.engine.requestRender(o.Overlay), this.scheduleAutoSave();
|
|
2339
2364
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2340
2365
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2341
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new
|
|
2366
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new Tt(), this.indicatorHistory = new Qn({
|
|
2342
2367
|
steps: this.undoRedoManager,
|
|
2343
2368
|
snapshot: () => this.getIndicatorSetup(),
|
|
2344
2369
|
enabled: () => this.features.drawingUndoRedo
|
|
2345
2370
|
});
|
|
2346
|
-
let
|
|
2371
|
+
let a = "";
|
|
2347
2372
|
this.undoRedoManager.setOnChange(() => {
|
|
2348
2373
|
let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
|
|
2349
|
-
n !==
|
|
2374
|
+
n !== a && (a = n, this.eventBus.emit("historyChange", {
|
|
2350
2375
|
canUndo: e,
|
|
2351
2376
|
canRedo: t
|
|
2352
2377
|
}));
|
|
@@ -2355,24 +2380,27 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2355
2380
|
primary: e[0] ?? null
|
|
2356
2381
|
})), this.drawingManager.setForeignHistory((e, t) => {
|
|
2357
2382
|
e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
|
|
2358
|
-
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()),
|
|
2383
|
+
}), 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 Ct({
|
|
2359
2384
|
enabled: this.features.trading,
|
|
2360
2385
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
2361
|
-
}), this.tradingRenderer = new
|
|
2386
|
+
}), this.tradingRenderer = new wt(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
2362
2387
|
this.eventBus.emit(e, t);
|
|
2363
|
-
}), this.engine = new
|
|
2364
|
-
let
|
|
2365
|
-
if (this.viewport = new
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
}),
|
|
2388
|
+
}), this.engine = new ot(e, n.maxPixelRatio);
|
|
2389
|
+
let s = this.engine.dprManager.getContainerSize();
|
|
2390
|
+
if (this.viewport = new Et(s.width, s.height, n.minBarSpacing ?? 2, n.maxBarSpacing ?? 30, n.rightMargin ?? r.rightMargin), this.viewport.setBarLayout(n.barLayout ?? r.barLayout), this.viewport.setScaleMargins({
|
|
2391
|
+
top: r.priceMargin,
|
|
2392
|
+
bottom: r.priceMargin
|
|
2393
|
+
}), this.viewport.setPanLimits({
|
|
2394
|
+
freePan: n.freePan ?? !0,
|
|
2395
|
+
minVisibleBars: n.panLimits?.minVisibleBars ?? 3
|
|
2396
|
+
}), n.minBarUnit !== void 0 && this.viewport.setMinBarUnit(n.minBarUnit), this.layoutManager.resize(s.width, s.height), this.engine.onContainerResize = (e) => {
|
|
2369
2397
|
if (e.width <= 0 || e.height <= 0) return;
|
|
2370
2398
|
let t = this.viewport.isAtEnd();
|
|
2371
2399
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2372
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new
|
|
2400
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Le(), n.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new rt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new xt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Oe(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), n.crosshair?.mode && this.crosshairHandler.setMode(n.crosshair.mode), Lt(n.crosshair?.cursor) && this.crosshairHandler.setCursor(n.crosshair.cursor), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2373
2401
|
if (e !== null && t) {
|
|
2374
|
-
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0,
|
|
2375
|
-
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(
|
|
2402
|
+
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;
|
|
2403
|
+
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(o.Hover);
|
|
2376
2404
|
let c = this.viewport.getState(), l = t.y >= c.chartRect.y && t.y <= c.chartRect.y + c.chartRect.height;
|
|
2377
2405
|
if (r && l && this.features.crosshairTooltip) {
|
|
2378
2406
|
let e = s === r.time ? r : {
|
|
@@ -2380,11 +2408,11 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2380
2408
|
time: s ?? r.time
|
|
2381
2409
|
};
|
|
2382
2410
|
this.crosshairTooltip.show(t, e, this.themeManager.getTheme(), this.cachedContainerSize(), {
|
|
2383
|
-
prevClose:
|
|
2411
|
+
prevClose: i,
|
|
2384
2412
|
priceRange: c.priceRange,
|
|
2385
2413
|
plot: c.chartRect,
|
|
2386
|
-
barStepMs: Mt(
|
|
2387
|
-
timeUnit:
|
|
2414
|
+
barStepMs: Mt(a),
|
|
2415
|
+
timeUnit: f(a)
|
|
2388
2416
|
});
|
|
2389
2417
|
} else this.crosshairTooltip.hide();
|
|
2390
2418
|
this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
|
|
@@ -2392,21 +2420,21 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2392
2420
|
bar: r,
|
|
2393
2421
|
barIndex: e,
|
|
2394
2422
|
...s === void 0 ? {} : { time: s },
|
|
2395
|
-
...
|
|
2423
|
+
...i === void 0 ? {} : { prevClose: i }
|
|
2396
2424
|
});
|
|
2397
2425
|
} else {
|
|
2398
|
-
this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.features.legend && this.engine.requestRender(
|
|
2426
|
+
this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.features.legend && this.engine.requestRender(o.Hover), this.eventBus.emit("crosshairLeave", {});
|
|
2399
2427
|
let e = this.crosshairHandler.getSyncedSlot();
|
|
2400
2428
|
e !== null && this.showSyncedBar(e);
|
|
2401
2429
|
}
|
|
2402
|
-
}), this.chartLegend = new
|
|
2430
|
+
}), this.chartLegend = new Se(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setSpacing(Xi(r)), this.chartLegend.setResizeListener(() => {
|
|
2403
2431
|
this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
|
|
2404
|
-
}), this.watermark = new
|
|
2405
|
-
visible:
|
|
2406
|
-
color:
|
|
2407
|
-
lineStyle:
|
|
2408
|
-
lineWidth:
|
|
2409
|
-
}) :
|
|
2432
|
+
}), this.watermark = new At(), n.watermark && this.watermark.setConfig(n.watermark), this.volumeRenderer = new kt(), this.volumeProfile = new Ot(), this.marketProfile = new Je(), this.depthHeatmap = new Me(), this.periodLevels = new $e(), this.pivotMarkers = new tt(), this.barCountdown = new ve(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new mt(), this.sessionShading = new ht(), this.compareRenderer = new Ce(), n.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
2433
|
+
visible: n.sessionBreaks.visible ?? !0,
|
|
2434
|
+
color: n.sessionBreaks.color,
|
|
2435
|
+
lineStyle: n.sessionBreaks.lineStyle,
|
|
2436
|
+
lineWidth: n.sessionBreaks.lineWidth
|
|
2437
|
+
}) : n.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), n.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new ke(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new et(), 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(Mi(n.shapes)), n.font && this.themeManager.setFont(ji(n.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), n.extendedHours === !1 && (this.extendedHours = !1), n.timeFormatter && this.applyTimeFormatter(n.timeFormatter), this.keyboardHandler = new Ge({
|
|
2410
2438
|
scrollBars: (e) => {
|
|
2411
2439
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2412
2440
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2422,8 +2450,8 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2422
2450
|
this.viewport.scrollToEnd(), this.updateViewportAndRender();
|
|
2423
2451
|
},
|
|
2424
2452
|
fitContent: () => this.fitContent()
|
|
2425
|
-
}), this.keyboardHandler.setEnabled(this.features.keyboard),
|
|
2426
|
-
this.a11y = new
|
|
2453
|
+
}), this.keyboardHandler.setEnabled(this.features.keyboard), n.a11y !== !1) {
|
|
2454
|
+
this.a11y = new dn(e, {
|
|
2427
2455
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
2428
2456
|
timeframe: () => this.streamTimeframe ?? "",
|
|
2429
2457
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
@@ -2432,7 +2460,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2432
2460
|
formatPrice: (e) => this.formatPrice(e),
|
|
2433
2461
|
formatTime: (e) => this.spokenBarTime(e),
|
|
2434
2462
|
showBar: (e) => this.setCrosshairTime(e)
|
|
2435
|
-
},
|
|
2463
|
+
}, n.a11y?.labels);
|
|
2436
2464
|
for (let e of [
|
|
2437
2465
|
"dataUpdate",
|
|
2438
2466
|
"chartTypeChange",
|
|
@@ -2454,7 +2482,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2454
2482
|
}
|
|
2455
2483
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2456
2484
|
}
|
|
2457
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new
|
|
2485
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ae(), 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 mi(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(Rt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2458
2486
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2459
2487
|
kind: "alert",
|
|
2460
2488
|
alert: "triggered",
|
|
@@ -2470,7 +2498,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2470
2498
|
this.eventBus.emit("alertExpired", X(e));
|
|
2471
2499
|
}), this.alertManager.on("updated", (e) => {
|
|
2472
2500
|
this.eventBus.emit("alertUpdate", X(e));
|
|
2473
|
-
}), this.signalMarkerManager = new
|
|
2501
|
+
}), this.signalMarkerManager = new gt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
2474
2502
|
this.eventBus.emit("signalMarkerAdd", {
|
|
2475
2503
|
id: e.id,
|
|
2476
2504
|
source: e.source,
|
|
@@ -2478,14 +2506,14 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2478
2506
|
});
|
|
2479
2507
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
2480
2508
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
2481
|
-
}), this.tradeZoneManager = new
|
|
2509
|
+
}), this.tradeZoneManager = new St(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
2482
2510
|
this.eventBus.emit("tradeZoneAdd", {
|
|
2483
2511
|
id: e.id,
|
|
2484
2512
|
direction: e.direction
|
|
2485
2513
|
});
|
|
2486
2514
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
2487
2515
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
2488
|
-
}), this.replayManager = new
|
|
2516
|
+
}), this.replayManager = new ct(), this.replayManager.on("complete", () => {
|
|
2489
2517
|
let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
|
|
2490
2518
|
t && this.eventBus.emit("replayComplete", {
|
|
2491
2519
|
barIndex: e,
|
|
@@ -2493,9 +2521,9 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2493
2521
|
});
|
|
2494
2522
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2495
2523
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2496
|
-
}), this.measureOverlay = new
|
|
2497
|
-
let e = new
|
|
2498
|
-
this.interactionManager.setPanHandler(new
|
|
2524
|
+
}), this.measureOverlay = new Ye(), this.interactionManager = new Ue(e), this.features.panning) {
|
|
2525
|
+
let e = new Nr();
|
|
2526
|
+
this.interactionManager.setPanHandler(new Ze((t, n) => {
|
|
2499
2527
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2500
2528
|
}, () => e.reset()));
|
|
2501
2529
|
}
|
|
@@ -2507,10 +2535,10 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2507
2535
|
scales: !this.indicatorEngine.hasLeftScaleOverlays()
|
|
2508
2536
|
}
|
|
2509
2537
|
})), this.features.zooming) {
|
|
2510
|
-
this.interactionManager.setZoomHandler(new
|
|
2538
|
+
this.interactionManager.setZoomHandler(new jt((e, t) => {
|
|
2511
2539
|
this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
|
|
2512
2540
|
}));
|
|
2513
|
-
let e = new
|
|
2541
|
+
let e = new _e((e) => {
|
|
2514
2542
|
this.holdPriceScale(), this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
|
|
2515
2543
|
}, (e) => {
|
|
2516
2544
|
let t = this.viewport.getState().chartRect.width;
|
|
@@ -2535,7 +2563,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2535
2563
|
y: t.y
|
|
2536
2564
|
});
|
|
2537
2565
|
})), 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) => {
|
|
2538
|
-
let t =
|
|
2566
|
+
let t = nn(e.y, this.viewport.getState());
|
|
2539
2567
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
2540
2568
|
price: t,
|
|
2541
2569
|
x: e.x,
|
|
@@ -2545,15 +2573,15 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2545
2573
|
...this.viewport.getState(),
|
|
2546
2574
|
data: this.getDisplayData()
|
|
2547
2575
|
})), this.features.alerts) {
|
|
2548
|
-
let e = new
|
|
2576
|
+
let e = new pe(this.alertManager, () => this.viewport.getState());
|
|
2549
2577
|
this.interactionManager.setAlertDragHandler(e);
|
|
2550
2578
|
}
|
|
2551
|
-
let
|
|
2552
|
-
|
|
2579
|
+
let c = new Qe();
|
|
2580
|
+
c.configure(() => this.getResolvedLayout(), (e, t) => this.dragPanelTo(e, t)), this.interactionManager.setPaneResizeHandler(c), this.interactionManager.setAltClickHandler((e) => {
|
|
2553
2581
|
let t = this.getDisplayData();
|
|
2554
2582
|
if (t.length === 0) return;
|
|
2555
|
-
let n = this.viewport.getState(), r = n.barWidth + n.barSpacing,
|
|
2556
|
-
|
|
2583
|
+
let n = this.viewport.getState(), r = n.barWidth + n.barSpacing, i = Math.round((n.offset + e.x) / r);
|
|
2584
|
+
i < 0 || i >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === i ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[i], i, this.themeManager.getTheme(), f(t), p(t) === !0), this.pinnedTooltip.reposition(this.viewport.getState(), this.series.bars()[i] ?? null, i, this.themeManager.getTheme()), this.engine.requestRender(o.Overlay));
|
|
2557
2585
|
}), this.interactionManager.setSignalMarkerHitTest((e) => this.eventBus.hasListeners("signalMarkerHover") || this.eventBus.hasListeners("signalMarkerClick") ? this.signalMarkerManager.markerAt(e, this.viewport.getState()) : null, (e, t) => this.eventBus.emit("signalMarkerHover", {
|
|
2558
2586
|
marker: e,
|
|
2559
2587
|
x: t.x,
|
|
@@ -2572,7 +2600,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2572
2600
|
x: e.x,
|
|
2573
2601
|
y: e.y
|
|
2574
2602
|
}), t.length === 0) return;
|
|
2575
|
-
let r =
|
|
2603
|
+
let r = tn(e.x, this.viewport.getState());
|
|
2576
2604
|
r < 0 || r >= t.length || this.eventBus.emit("barClick", {
|
|
2577
2605
|
bar: t[r],
|
|
2578
2606
|
barIndex: r,
|
|
@@ -2590,7 +2618,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2590
2618
|
});
|
|
2591
2619
|
return;
|
|
2592
2620
|
}
|
|
2593
|
-
this.pinnedTooltip.isPinned() && (this.pinnedTooltip.unpin(), this.engine.requestRender(
|
|
2621
|
+
this.pinnedTooltip.isPinned() && (this.pinnedTooltip.unpin(), this.engine.requestRender(o.Overlay));
|
|
2594
2622
|
}), this.interactionManager.setConfirmHandler(() => this.features.trading && this.tradingManager.isBracketActive() ? (this.tradingManager.confirmBracket(), !0) : !1), this.interactionManager.setMeasureHandlers({
|
|
2595
2623
|
begin: (e) => {
|
|
2596
2624
|
this.measureOverlay.begin(e, this.viewport.getState(), this.getDisplayData());
|
|
@@ -2602,8 +2630,8 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2602
2630
|
this.measureOverlay.end();
|
|
2603
2631
|
}
|
|
2604
2632
|
});
|
|
2605
|
-
let
|
|
2606
|
-
let t =
|
|
2633
|
+
let l, u = (e) => {
|
|
2634
|
+
let t = l ? this.drawingPaneViewport(l) : null, n = t ? t.chartRect : this.viewport.getState().chartRect;
|
|
2607
2635
|
return {
|
|
2608
2636
|
x: Math.max(n.x, Math.min(n.x + n.width, e.x)),
|
|
2609
2637
|
y: Math.max(n.y, Math.min(n.y + n.height, e.y))
|
|
@@ -2611,13 +2639,13 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2611
2639
|
};
|
|
2612
2640
|
this.interactionManager.setBoxSelectHandlers({
|
|
2613
2641
|
begin: (e) => {
|
|
2614
|
-
|
|
2642
|
+
l = this.zoomAreaMode ? void 0 : this.drawingPaneAt(e), this.selectionBoxOverlay.begin(u(e));
|
|
2615
2643
|
},
|
|
2616
|
-
move: (e) => this.selectionBoxOverlay.update(
|
|
2644
|
+
move: (e) => this.selectionBoxOverlay.update(u(e)),
|
|
2617
2645
|
end: () => {
|
|
2618
2646
|
let e = this.selectionBoxOverlay.end();
|
|
2619
2647
|
if (e && this.zoomAreaMode) {
|
|
2620
|
-
if (e.x1 - e.x0 <
|
|
2648
|
+
if (e.x1 - e.x0 < Ci) return;
|
|
2621
2649
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
2622
2650
|
return;
|
|
2623
2651
|
}
|
|
@@ -2626,17 +2654,17 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2626
2654
|
...this.viewport.getState(),
|
|
2627
2655
|
data: this.getDisplayData()
|
|
2628
2656
|
};
|
|
2629
|
-
|
|
2657
|
+
l !== null && (e.isClick ? this.drawingManager.toggleSelectionAt({
|
|
2630
2658
|
x: e.x1,
|
|
2631
2659
|
y: e.y1
|
|
2632
|
-
}, t) : this.drawingManager.selectInRect(e, t,
|
|
2660
|
+
}, t) : this.drawingManager.selectInRect(e, t, l), this.engine.requestRender(o.Overlay));
|
|
2633
2661
|
},
|
|
2634
2662
|
cancel: () => {
|
|
2635
2663
|
this.selectionBoxOverlay.cancel(), this.setZoomAreaMode(!1);
|
|
2636
2664
|
}
|
|
2637
2665
|
}), this.interactionManager.setOverlayDirtyCallback((e) => {
|
|
2638
|
-
this.engine.requestRender(e ?
|
|
2639
|
-
}), this.interactionManager.setPageScroll(
|
|
2666
|
+
this.engine.requestRender(e ? o.Hover : o.Overlay);
|
|
2667
|
+
}), this.interactionManager.setPageScroll(n.pageScroll ?? !1), this.interactionManager.attach(), n.timeZone !== void 0 && n.timeZone !== null && this.setTimeZone(n.timeZone), n.leftPriceScale && (this.leftScaleRequested = !0), this.syncRenderContext(), this.engine.start(), this.watchVisibility(e, n.pauseWhenHidden !== !1), this.engine.onGpuLost = () => this.eventBus.emit("rendererChange", {
|
|
2640
2668
|
renderer: "canvas",
|
|
2641
2669
|
reason: "contextLost"
|
|
2642
2670
|
}), this.engine.onGpuRestored = () => this.eventBus.emit("rendererChange", {
|
|
@@ -2659,7 +2687,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2659
2687
|
loadDuringReplay(e) {
|
|
2660
2688
|
this.snapshotKey = null, this.history.reset(), this.alertManager.clearLastValues();
|
|
2661
2689
|
let t = e[e.length - 1];
|
|
2662
|
-
t &&
|
|
2690
|
+
t && L(t) && this.alertManager.seedLastValue("price", t.close), this.replaySession && (this.replaySession.price = null), this.series.load(e);
|
|
2663
2691
|
}
|
|
2664
2692
|
prependBars(e) {
|
|
2665
2693
|
if (this.replaySession) return this.series.prepend(e).taken;
|
|
@@ -2667,7 +2695,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2667
2695
|
if (i === 0) return a;
|
|
2668
2696
|
let o = this.series.bars();
|
|
2669
2697
|
if (this.crosshairHandler.setData(o), this.display.reset(), this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), r !== void 0) {
|
|
2670
|
-
let e = Math.round(
|
|
2698
|
+
let e = Math.round(M(r, this.getDisplayData()));
|
|
2671
2699
|
this.viewport.prependBars(e - n);
|
|
2672
2700
|
}
|
|
2673
2701
|
return this.updateViewportAndRender(), a;
|
|
@@ -2695,17 +2723,17 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2695
2723
|
}
|
|
2696
2724
|
checkHistory() {
|
|
2697
2725
|
this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
|
|
2698
|
-
if (this.historyCheckQueued = !1, !this.replayPages() || !this.history.hasLoader() ||
|
|
2726
|
+
if (this.historyCheckQueued = !1, !this.replayPages() || !this.history.hasLoader() || I(this.options.chartType)) return;
|
|
2699
2727
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2700
2728
|
if (t.width <= 0) return;
|
|
2701
2729
|
let { from: n, to: r } = e;
|
|
2702
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2730
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Si, r - n));
|
|
2703
2731
|
}));
|
|
2704
2732
|
}
|
|
2705
2733
|
useStreamHistory(e, t, n = !0) {
|
|
2706
2734
|
if (this.hostHistoryLoader) return;
|
|
2707
|
-
let r =
|
|
2708
|
-
if (!i || a === null ||
|
|
2735
|
+
let r = N(e), i = r.fetchHistoryBefore, a = this.streamTimeframe;
|
|
2736
|
+
if (!i || a === null || de(a) !== null) {
|
|
2709
2737
|
this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
|
|
2710
2738
|
return;
|
|
2711
2739
|
}
|
|
@@ -2713,7 +2741,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2713
2741
|
this.history.setLoader((e, t) => i.call(r, o, a, e, t), t), this.historyFromStream = !0, n && this.checkHistory();
|
|
2714
2742
|
}
|
|
2715
2743
|
appendBar(e) {
|
|
2716
|
-
if (!
|
|
2744
|
+
if (!L(e)) return;
|
|
2717
2745
|
let t = this.series.append(e);
|
|
2718
2746
|
if (t.to !== "shown") {
|
|
2719
2747
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -2723,7 +2751,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2723
2751
|
this.crosshairHandler.setData(i), this.recalcIndicatorsFrom(i, i.length - 2), this.currentPriceLine.setPrice(e.close, i[i.length - 2]?.close), this.updateViewportAndRender(n), i.length !== r && this.emitBars(i.length), this.followLivePrice(e.close);
|
|
2724
2752
|
}
|
|
2725
2753
|
appendBars(e) {
|
|
2726
|
-
if (e = e.filter(
|
|
2754
|
+
if (e = e.filter(L), e.length === 0) return;
|
|
2727
2755
|
let t = e[e.length - 1].close, n = this.series.appendMany(e);
|
|
2728
2756
|
if (n.shown === 0) {
|
|
2729
2757
|
this.takeLivePrice(t), n.aside || this.scheduleRender();
|
|
@@ -2733,7 +2761,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2733
2761
|
this.recalcIndicatorsFrom(a, i - 1), this.crosshairHandler.setData(a), this.currentPriceLine.setPrice(t, a[a.length - 2]?.close), this.updateViewportAndRender(r), a.length !== i && this.emitBars(a.length), this.followLivePrice(t);
|
|
2734
2762
|
}
|
|
2735
2763
|
updateLastBar(e) {
|
|
2736
|
-
if (!
|
|
2764
|
+
if (!L(e)) return;
|
|
2737
2765
|
let t = this.series.updateLast(e);
|
|
2738
2766
|
if (t.to !== "shown") {
|
|
2739
2767
|
this.takeLivePrice(e.close), t.to === "hidden" && this.scheduleRender();
|
|
@@ -2755,7 +2783,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2755
2783
|
this.recalcIndicatorsFrom(n, n.length - 1), this.followLivePrice(e.price), this.scheduleRender();
|
|
2756
2784
|
}
|
|
2757
2785
|
updateBar(e) {
|
|
2758
|
-
if (!
|
|
2786
|
+
if (!L(e)) return !1;
|
|
2759
2787
|
let t = this.series.replace(e);
|
|
2760
2788
|
return t.to === "none" ? !1 : (t.to === "shown" && t.changed && this.showCorrection(t.index), !0);
|
|
2761
2789
|
}
|
|
@@ -2773,7 +2801,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2773
2801
|
let r = this.isTimeAligned();
|
|
2774
2802
|
if (r && t >= e) {
|
|
2775
2803
|
let e = this.getDisplayData();
|
|
2776
|
-
e[t] && this.pinnedTooltip.pin(e[t], t, this.themeManager.getTheme(),
|
|
2804
|
+
e[t] && this.pinnedTooltip.pin(e[t], t, this.themeManager.getTheme(), f(e), p(e) === !0);
|
|
2777
2805
|
}
|
|
2778
2806
|
n !== null && (!r || n === e || n === e + 1) && this.crosshairHandler.refresh();
|
|
2779
2807
|
}
|
|
@@ -2789,22 +2817,22 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2789
2817
|
}
|
|
2790
2818
|
fitFewColumns() {
|
|
2791
2819
|
let e = this.options.chartType;
|
|
2792
|
-
if (!
|
|
2820
|
+
if (!I(e) || this.pluginManager.getChartType(e)) return;
|
|
2793
2821
|
let t = this.getDisplayData().length, { chartRect: n, barWidth: r, barSpacing: i } = this.viewport.getState(), a = n.width / (r + i);
|
|
2794
2822
|
t > 0 && a > t + this.viewport.getRightMargin() && this.fitContent();
|
|
2795
2823
|
}
|
|
2796
2824
|
applyTimeSpacing() {
|
|
2797
|
-
let e = !this.tickStream && !
|
|
2825
|
+
let e = !this.tickStream && !I(this.options.chartType);
|
|
2798
2826
|
this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
|
|
2799
2827
|
}
|
|
2800
2828
|
setChartTypeOptions(e) {
|
|
2801
2829
|
this.chartTypeOptions = {
|
|
2802
2830
|
...this.chartTypeOptions,
|
|
2803
|
-
...
|
|
2831
|
+
...w(e)
|
|
2804
2832
|
}, this.updateViewportAndRender(!0), this.fitFewColumns(), this.a11y?.refresh(!0), this.markStateChanged();
|
|
2805
2833
|
}
|
|
2806
2834
|
getChartTypeOptions() {
|
|
2807
|
-
return
|
|
2835
|
+
return w(this.chartTypeOptions);
|
|
2808
2836
|
}
|
|
2809
2837
|
setExtendedHours(e) {
|
|
2810
2838
|
e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
|
|
@@ -2813,7 +2841,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2813
2841
|
return this.extendedHours;
|
|
2814
2842
|
}
|
|
2815
2843
|
sessionKeep(e) {
|
|
2816
|
-
return this.extendedHours ? null :
|
|
2844
|
+
return this.extendedHours ? null : on(this.symbolInfo, e);
|
|
2817
2845
|
}
|
|
2818
2846
|
reapplyExtendedHours() {
|
|
2819
2847
|
if (!this.series.refilter()) return;
|
|
@@ -2824,7 +2852,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2824
2852
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2825
2853
|
}
|
|
2826
2854
|
setShapes(e) {
|
|
2827
|
-
let t =
|
|
2855
|
+
let t = Mi(e);
|
|
2828
2856
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2829
2857
|
...this.themeManager.getTheme().shape,
|
|
2830
2858
|
...t
|
|
@@ -2836,7 +2864,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2836
2864
|
setFont(e) {
|
|
2837
2865
|
if (e === null) this.themeManager.setFont(null);
|
|
2838
2866
|
else {
|
|
2839
|
-
let t =
|
|
2867
|
+
let t = ji(e);
|
|
2840
2868
|
if (Object.keys(t).length === 0) return;
|
|
2841
2869
|
this.themeManager.setFont(t);
|
|
2842
2870
|
}
|
|
@@ -2846,11 +2874,20 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2846
2874
|
return { ...this.themeManager.getTheme().font };
|
|
2847
2875
|
}
|
|
2848
2876
|
setBarLayout(e) {
|
|
2849
|
-
e !== "golden" && e !== "classic" || e
|
|
2877
|
+
e !== "golden" && e !== "classic" || (this.options.barLayout = e, e !== this.viewport.getBarLayout() && (this.viewport.setBarLayout(e), this.updateViewportAndRender()));
|
|
2850
2878
|
}
|
|
2851
2879
|
getBarLayout() {
|
|
2852
2880
|
return this.viewport.getBarLayout();
|
|
2853
2881
|
}
|
|
2882
|
+
setDensity(e) {
|
|
2883
|
+
if (e !== "comfortable" && e !== "compact" || e === this.density) return;
|
|
2884
|
+
this.density = e;
|
|
2885
|
+
let n = t[e];
|
|
2886
|
+
this.priceFit.setSpacing(n), this.chartLegend.setSpacing(Xi(n)), this.options.rightMargin === void 0 && this.viewport.setRightMargin(n.rightMargin), this.options.barLayout || this.viewport.setBarLayout(n.barLayout), this.updateViewportAndRender();
|
|
2887
|
+
}
|
|
2888
|
+
getDensity() {
|
|
2889
|
+
return this.density;
|
|
2890
|
+
}
|
|
2854
2891
|
setMainSeriesVisible(e) {
|
|
2855
2892
|
this.mainSeriesVisible = e, this.syncRenderContext(), this.engine.requestRender();
|
|
2856
2893
|
}
|
|
@@ -2864,7 +2901,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2864
2901
|
return this.priceLines.isHighLowVisible();
|
|
2865
2902
|
}
|
|
2866
2903
|
setBidAsk(e) {
|
|
2867
|
-
this.priceLines.setBidAsk(e), this.engine.requestRender(
|
|
2904
|
+
this.priceLines.setBidAsk(e), this.engine.requestRender(o.Overlay);
|
|
2868
2905
|
}
|
|
2869
2906
|
getBidAsk() {
|
|
2870
2907
|
return this.priceLines.getBidAsk();
|
|
@@ -2952,8 +2989,8 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
2952
2989
|
return {
|
|
2953
2990
|
...e,
|
|
2954
2991
|
priceRange: {
|
|
2955
|
-
min: t.min - n *
|
|
2956
|
-
max: t.max + n *
|
|
2992
|
+
min: t.min - n * xi,
|
|
2993
|
+
max: t.max + n * xi
|
|
2957
2994
|
},
|
|
2958
2995
|
logScale: !1,
|
|
2959
2996
|
scaleMode: "regular",
|
|
@@ -3022,7 +3059,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3022
3059
|
}
|
|
3023
3060
|
useIndicatorWorker() {
|
|
3024
3061
|
this.indicatorWorker = It.acquire(), this.indicatorEngine.useWorker(this.indicatorWorker.client, {
|
|
3025
|
-
minBars:
|
|
3062
|
+
minBars: Ve,
|
|
3026
3063
|
onLand: () => this.indicatorsLandedSoon()
|
|
3027
3064
|
});
|
|
3028
3065
|
}
|
|
@@ -3044,7 +3081,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3044
3081
|
return this.pluginManager;
|
|
3045
3082
|
}
|
|
3046
3083
|
static indicators() {
|
|
3047
|
-
let e = new
|
|
3084
|
+
let e = new He();
|
|
3048
3085
|
return Kt(e), e.getAvailableIndicators();
|
|
3049
3086
|
}
|
|
3050
3087
|
setPanelPosition(e, t) {
|
|
@@ -3059,6 +3096,12 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3059
3096
|
size: t
|
|
3060
3097
|
}), this.markStateChanged();
|
|
3061
3098
|
}
|
|
3099
|
+
dragPanelTo(e, t) {
|
|
3100
|
+
this.layoutManager.setPanelHeightOnScreen(e, t), this.updateViewportAndRender(), this.eventBus.emit("paneResize", {
|
|
3101
|
+
instanceId: e,
|
|
3102
|
+
size: t
|
|
3103
|
+
}), this.markStateChanged();
|
|
3104
|
+
}
|
|
3062
3105
|
moveIndicatorToPane(e, t) {
|
|
3063
3106
|
return this.indicatorHistory.record(e, () => this.moveIndicatorToPaneNow(e, t));
|
|
3064
3107
|
}
|
|
@@ -3166,14 +3209,14 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3166
3209
|
}), n;
|
|
3167
3210
|
}
|
|
3168
3211
|
isTimeAligned() {
|
|
3169
|
-
return
|
|
3212
|
+
return I(this.options.chartType) ? !1 : this.getDisplayData().length === this.series.length();
|
|
3170
3213
|
}
|
|
3171
3214
|
roundPrice(e) {
|
|
3172
3215
|
if (!Number.isFinite(e)) return e;
|
|
3173
3216
|
let t = this.stepAt(e);
|
|
3174
3217
|
if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(le(t)));
|
|
3175
3218
|
let { min: n, max: r } = this.viewport.getState().priceRange;
|
|
3176
|
-
return Number(e.toFixed(this.marketPricePrecision ??
|
|
3219
|
+
return Number(e.toFixed(this.marketPricePrecision ?? u(n, r)));
|
|
3177
3220
|
}
|
|
3178
3221
|
lastClose() {
|
|
3179
3222
|
let e = this.series.bars();
|
|
@@ -3186,7 +3229,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3186
3229
|
getPriceStep(e) {
|
|
3187
3230
|
let t = this.stepAt(e ?? this.lastClose());
|
|
3188
3231
|
if (t !== void 0) return t;
|
|
3189
|
-
let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ??
|
|
3232
|
+
let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ?? u(n, r);
|
|
3190
3233
|
return Number((10 ** -i).toFixed(i));
|
|
3191
3234
|
}
|
|
3192
3235
|
setPriceFormat(e) {
|
|
@@ -3196,7 +3239,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3196
3239
|
return this.priceFormatter;
|
|
3197
3240
|
}
|
|
3198
3241
|
applyPriceFormat(e) {
|
|
3199
|
-
this.priceFormatter = ne(e), this.priceUnit = e && typeof e != "function" ?
|
|
3242
|
+
this.priceFormatter = ne(e), this.priceUnit = e && typeof e != "function" ? y(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
|
|
3200
3243
|
}
|
|
3201
3244
|
setTimeFormatter(e) {
|
|
3202
3245
|
this.applyTimeFormatter(e), this.engine.requestRender();
|
|
@@ -3207,7 +3250,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3207
3250
|
formatPrice(e) {
|
|
3208
3251
|
if (this.priceFormatter) return this.priceFormatter(e);
|
|
3209
3252
|
let { min: t, max: n } = this.viewport.getState().priceRange;
|
|
3210
|
-
return
|
|
3253
|
+
return v(e, this.marketPricePrecision ?? u(t, n), this.numberLocale);
|
|
3211
3254
|
}
|
|
3212
3255
|
setDrawingTool(e) {
|
|
3213
3256
|
this.features.drawings && (e && this.features.drawingTools.length > 0 && !this.features.drawingTools.includes(e) || (e && this.setZoomAreaMode(!1), this.drawingManager.setActiveTool(e)));
|
|
@@ -3268,9 +3311,9 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3268
3311
|
return this.drawingManager.removeDrawings(e);
|
|
3269
3312
|
}
|
|
3270
3313
|
nudgeSelectedDrawings(e) {
|
|
3271
|
-
let t =
|
|
3314
|
+
let t = Ti[e.key];
|
|
3272
3315
|
if (!t || !this.features.drawings || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
3273
|
-
let n = e.shiftKey ?
|
|
3316
|
+
let n = e.shiftKey ? wi : 1, r = {
|
|
3274
3317
|
...this.viewport.getState(),
|
|
3275
3318
|
data: this.getDisplayData()
|
|
3276
3319
|
};
|
|
@@ -3411,7 +3454,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3411
3454
|
x: t.x,
|
|
3412
3455
|
y: t.y
|
|
3413
3456
|
};
|
|
3414
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
3457
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = nn(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = P(t.x, n)), e === "pane") {
|
|
3415
3458
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
3416
3459
|
e && (r.pane = e.instanceId);
|
|
3417
3460
|
}
|
|
@@ -3419,10 +3462,10 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3419
3462
|
}
|
|
3420
3463
|
applyPriceAxisAdd() {
|
|
3421
3464
|
let e = this.features.priceAxisAddButton && this.features.crosshair;
|
|
3422
|
-
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ?
|
|
3465
|
+
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Xe : 0);
|
|
3423
3466
|
}
|
|
3424
3467
|
setPriceAxisAddButton(e) {
|
|
3425
|
-
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(
|
|
3468
|
+
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay);
|
|
3426
3469
|
}
|
|
3427
3470
|
setEraserMode(e) {
|
|
3428
3471
|
e && this.setZoomAreaMode(!1), this.drawingManager.setEraser(e && this.features.drawings);
|
|
@@ -3441,7 +3484,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3441
3484
|
...this.viewport.getState(),
|
|
3442
3485
|
data: this.getDisplayData()
|
|
3443
3486
|
};
|
|
3444
|
-
this.setVisibleRange(
|
|
3487
|
+
this.setVisibleRange(P(e.x0, t), P(e.x1, t));
|
|
3445
3488
|
}
|
|
3446
3489
|
lockAllDrawings() {
|
|
3447
3490
|
this.drawingManager.lockAllDrawings();
|
|
@@ -3677,7 +3720,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3677
3720
|
}
|
|
3678
3721
|
checkAlerts(e) {
|
|
3679
3722
|
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;
|
|
3680
|
-
|
|
3723
|
+
ci(this.alertManager, {
|
|
3681
3724
|
price: e,
|
|
3682
3725
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3683
3726
|
lines: r
|
|
@@ -3689,15 +3732,15 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3689
3732
|
async connect(e) {
|
|
3690
3733
|
let t = {
|
|
3691
3734
|
...e,
|
|
3692
|
-
adapter:
|
|
3735
|
+
adapter: Jt(e),
|
|
3693
3736
|
feed: void 0
|
|
3694
3737
|
};
|
|
3695
|
-
if (!
|
|
3696
|
-
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new
|
|
3738
|
+
if (!qt(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
3739
|
+
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new yt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (e) => {
|
|
3697
3740
|
let n = this.streamSeriesKey(t.adapter);
|
|
3698
3741
|
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);
|
|
3699
3742
|
}), this.streamManager.on("barClose", (e) => {
|
|
3700
|
-
if (!
|
|
3743
|
+
if (!L(e)) return;
|
|
3701
3744
|
let t = this.series.placeStreamBar(e);
|
|
3702
3745
|
if (t.to === "none") {
|
|
3703
3746
|
this.updateBar(e);
|
|
@@ -3709,7 +3752,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3709
3752
|
}), this.streamManager.on("barCorrection", (e) => {
|
|
3710
3753
|
this.updateBar(e);
|
|
3711
3754
|
}), this.streamManager.on("barUpdate", (e) => {
|
|
3712
|
-
if (!
|
|
3755
|
+
if (!L(e)) return;
|
|
3713
3756
|
let t = this.series.placeStreamBar(e);
|
|
3714
3757
|
if (t.to === "none" || (this.replaySession || this.currentPriceLine.setPrice(e.close), this.replaySession)) return;
|
|
3715
3758
|
let n = t.before;
|
|
@@ -3734,7 +3777,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3734
3777
|
};
|
|
3735
3778
|
return;
|
|
3736
3779
|
}
|
|
3737
|
-
this.currentPriceLine.setPrice(e, t ?? void 0), this.engine.requestRender(
|
|
3780
|
+
this.currentPriceLine.setPrice(e, t ?? void 0), this.engine.requestRender(o.Overlay);
|
|
3738
3781
|
}
|
|
3739
3782
|
}), this.streamManager.on("connectionChange", (e) => {
|
|
3740
3783
|
this.eventBus.emit("dataUpdate", {
|
|
@@ -3751,22 +3794,22 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3751
3794
|
if (this.resolveStreamSymbol(t.adapter, t.symbol), await n.connect(t), this.streamManager !== n) return;
|
|
3752
3795
|
let r = E(t.timeframe);
|
|
3753
3796
|
this.barCountdown.setTimeframeMs(r), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
|
|
3754
|
-
this.barCountdown.isVisible() && this.engine.requestRender(
|
|
3797
|
+
this.barCountdown.isVisible() && this.engine.requestRender(o.Hover);
|
|
3755
3798
|
}, 1e3);
|
|
3756
3799
|
}
|
|
3757
3800
|
streamSeriesKey(e) {
|
|
3758
|
-
let t =
|
|
3801
|
+
let t = N(e), n = this.streamTimeframe, r = t instanceof lt && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3759
3802
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3760
3803
|
}
|
|
3761
3804
|
setStreamTarget(e, t) {
|
|
3762
3805
|
let n = this.announcedSymbol;
|
|
3763
|
-
this.currentSymbol = e, this.streamTimeframe = t, this.tickStream =
|
|
3806
|
+
this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = de(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
|
|
3764
3807
|
symbol: e,
|
|
3765
3808
|
previous: n
|
|
3766
3809
|
})), this.useTimeframe(t);
|
|
3767
3810
|
}
|
|
3768
3811
|
setDataTimeframe(e) {
|
|
3769
|
-
this.streamManager || (this.useTimeframe(e), this.engine.requestRender(
|
|
3812
|
+
this.streamManager || (this.useTimeframe(e), this.engine.requestRender(o.Hover));
|
|
3770
3813
|
}
|
|
3771
3814
|
useTimeframe(e) {
|
|
3772
3815
|
let t = this.announcedTimeframe;
|
|
@@ -3778,7 +3821,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3778
3821
|
async switchStream(e, t) {
|
|
3779
3822
|
if (!this.streamManager) return;
|
|
3780
3823
|
let n = this.streamAdapter;
|
|
3781
|
-
if (n && !
|
|
3824
|
+
if (n && !qt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
3782
3825
|
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);
|
|
3783
3826
|
}
|
|
3784
3827
|
isIndicatorAllowed(e) {
|
|
@@ -3798,7 +3841,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3798
3841
|
}
|
|
3799
3842
|
connectExecution(e, t = {}) {
|
|
3800
3843
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3801
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3844
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Ur(e, {
|
|
3802
3845
|
onIntent: (e, t) => {
|
|
3803
3846
|
let n = (e) => t(e.payload);
|
|
3804
3847
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -3822,13 +3865,13 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3822
3865
|
return this.executionAdapter;
|
|
3823
3866
|
}
|
|
3824
3867
|
setBarCountdownVisible(e) {
|
|
3825
|
-
this.barCountdown.setVisible(e && this.features.barCountdown), this.engine.requestRender(
|
|
3868
|
+
this.barCountdown.setVisible(e && this.features.barCountdown), this.engine.requestRender(o.Hover);
|
|
3826
3869
|
}
|
|
3827
3870
|
isBarCountdownVisible() {
|
|
3828
3871
|
return this.barCountdown.isVisible();
|
|
3829
3872
|
}
|
|
3830
3873
|
setSessionBreaksVisible(e) {
|
|
3831
|
-
this.sessionBreaks.setVisible(e), this.engine.requestRender(
|
|
3874
|
+
this.sessionBreaks.setVisible(e), this.engine.requestRender(o.Background);
|
|
3832
3875
|
}
|
|
3833
3876
|
addCompareSymbol(e, t, n, r) {
|
|
3834
3877
|
this.features.compareSymbols && (this.compareRenderer.addSymbol({
|
|
@@ -3901,7 +3944,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3901
3944
|
return this.viewport.getScaleMode();
|
|
3902
3945
|
}
|
|
3903
3946
|
setSessionBreaksConfig(e) {
|
|
3904
|
-
this.sessionBreaks.setConfig(e), this.engine.requestRender(
|
|
3947
|
+
this.sessionBreaks.setConfig(e), this.engine.requestRender(o.Background);
|
|
3905
3948
|
}
|
|
3906
3949
|
getConnectionState() {
|
|
3907
3950
|
return this.streamManager?.getConnectionState() ?? "disconnected";
|
|
@@ -3923,18 +3966,18 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3923
3966
|
goToTime(e) {
|
|
3924
3967
|
let t = this.getDisplayData();
|
|
3925
3968
|
if (t.length === 0 || !Number.isFinite(e)) return -1;
|
|
3926
|
-
let n = Math.max(0, Math.min(t.length - 1, Math.floor(
|
|
3969
|
+
let n = Math.max(0, Math.min(t.length - 1, Math.floor(M(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
|
|
3927
3970
|
return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
|
|
3928
3971
|
}
|
|
3929
3972
|
setVisibleRangePreset(e) {
|
|
3930
3973
|
let t = this.getDisplayData();
|
|
3931
3974
|
if (t.length === 0) return;
|
|
3932
|
-
let n = t.length - 1, r =
|
|
3975
|
+
let n = t.length - 1, r = f(t), i = Ut(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
3933
3976
|
if (a === null || a < t[0].time) {
|
|
3934
3977
|
this.fitContent();
|
|
3935
3978
|
return;
|
|
3936
3979
|
}
|
|
3937
|
-
let o =
|
|
3980
|
+
let o = M(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
|
|
3938
3981
|
this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
|
|
3939
3982
|
}
|
|
3940
3983
|
scrollToEnd() {
|
|
@@ -3959,7 +4002,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
3959
4002
|
setVisibleRange(e, t) {
|
|
3960
4003
|
let n = this.getDisplayData();
|
|
3961
4004
|
if (n.length === 0) return;
|
|
3962
|
-
let r =
|
|
4005
|
+
let r = M(Math.min(e, t), n), i = M(Math.max(e, t), n);
|
|
3963
4006
|
this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
|
|
3964
4007
|
}
|
|
3965
4008
|
suspend() {
|
|
@@ -4096,7 +4139,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4096
4139
|
this.watermark.setConfig({
|
|
4097
4140
|
text: e,
|
|
4098
4141
|
...t
|
|
4099
|
-
}), this.engine.requestRender(
|
|
4142
|
+
}), this.engine.requestRender(o.Background);
|
|
4100
4143
|
}
|
|
4101
4144
|
setAutoScale(e) {
|
|
4102
4145
|
this.priceFit.setAuto(e, this.series.length() > 0), this.updateViewportAndRender();
|
|
@@ -4108,13 +4151,13 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4108
4151
|
return this.priceFit.isAuto();
|
|
4109
4152
|
}
|
|
4110
4153
|
setCrosshairMode(e) {
|
|
4111
|
-
this.crosshairHandler.setMode(e), this.engine.requestRender(
|
|
4154
|
+
this.crosshairHandler.setMode(e), this.engine.requestRender(o.Hover);
|
|
4112
4155
|
}
|
|
4113
4156
|
getCrosshairMode() {
|
|
4114
4157
|
return this.crosshairHandler.getMode();
|
|
4115
4158
|
}
|
|
4116
4159
|
setCrosshairCursor(e) {
|
|
4117
|
-
!Lt(e) || e === this.crosshairHandler.getCursor() || (this.crosshairHandler.setCursor(e), this.applyIdleCursor(), this.engine.requestRender(
|
|
4160
|
+
!Lt(e) || e === this.crosshairHandler.getCursor() || (this.crosshairHandler.setCursor(e), this.applyIdleCursor(), this.engine.requestRender(o.Hover), this.eventBus.emit("crosshairCursorChange", { cursor: e }));
|
|
4118
4161
|
}
|
|
4119
4162
|
getCrosshairCursor() {
|
|
4120
4163
|
return this.crosshairHandler.getCursor();
|
|
@@ -4124,11 +4167,11 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4124
4167
|
this.interactionManager.setIdleCursor(Ft(this.crosshairHandler.getCursor(), t, e.background));
|
|
4125
4168
|
}
|
|
4126
4169
|
setCrosshairPosition(e) {
|
|
4127
|
-
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(
|
|
4170
|
+
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(o.Hover);
|
|
4128
4171
|
}
|
|
4129
4172
|
setCrosshairTime(e) {
|
|
4130
|
-
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(
|
|
4131
|
-
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.showSyncedBar(n), this.engine.requestRender(
|
|
4173
|
+
let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(M(e, t));
|
|
4174
|
+
n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.showSyncedBar(n), this.engine.requestRender(o.Hover));
|
|
4132
4175
|
}
|
|
4133
4176
|
showSyncedBar(e) {
|
|
4134
4177
|
if (e === null) {
|
|
@@ -4137,7 +4180,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4137
4180
|
}
|
|
4138
4181
|
let t = this.crosshairSeries(), n = e >= 0 && e < t.length ? t[e] : void 0, r = n && e > 0 ? t[e - 1] : void 0;
|
|
4139
4182
|
this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(n ?? null, r ?? null);
|
|
4140
|
-
let i = n ?
|
|
4183
|
+
let i = n ? A(t)[e]?.time ?? n.time : void 0;
|
|
4141
4184
|
this.eventBus.emit("crosshairSync", {
|
|
4142
4185
|
barIndex: e,
|
|
4143
4186
|
...n ? { bar: n } : {},
|
|
@@ -4149,7 +4192,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4149
4192
|
return this.series.bars();
|
|
4150
4193
|
}
|
|
4151
4194
|
setGridVisible(e) {
|
|
4152
|
-
this.gridRenderer.setVisible(e), this.engine.requestRender(
|
|
4195
|
+
this.gridRenderer.setVisible(e), this.engine.requestRender(o.Background);
|
|
4153
4196
|
}
|
|
4154
4197
|
isGridVisible() {
|
|
4155
4198
|
return this.gridRenderer.isVisible();
|
|
@@ -4161,22 +4204,22 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4161
4204
|
return this.features.volume && this.volumeRenderer.isVisible();
|
|
4162
4205
|
}
|
|
4163
4206
|
setVolumeProfileVisible(e) {
|
|
4164
|
-
this.volumeProfile.setVisible(e), this.engine.requestRender(
|
|
4207
|
+
this.volumeProfile.setVisible(e), this.engine.requestRender(o.Main);
|
|
4165
4208
|
}
|
|
4166
4209
|
isVolumeProfileVisible() {
|
|
4167
4210
|
return this.volumeProfile.isVisible();
|
|
4168
4211
|
}
|
|
4169
4212
|
setVolumeProfileConfig(e) {
|
|
4170
|
-
e.buckets !== void 0 && this.volumeProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.volumeProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.volumeProfile.setOpacity(e.opacity), e.highlightPoC !== void 0 && this.volumeProfile.setHighlightPoC(e.highlightPoC), this.engine.requestRender(
|
|
4213
|
+
e.buckets !== void 0 && this.volumeProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.volumeProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.volumeProfile.setOpacity(e.opacity), e.highlightPoC !== void 0 && this.volumeProfile.setHighlightPoC(e.highlightPoC), this.engine.requestRender(o.Main);
|
|
4171
4214
|
}
|
|
4172
4215
|
setMarketProfileVisible(e) {
|
|
4173
|
-
this.marketProfile.setVisible(e), this.engine.requestRender(
|
|
4216
|
+
this.marketProfile.setVisible(e), this.engine.requestRender(o.Main);
|
|
4174
4217
|
}
|
|
4175
4218
|
isMarketProfileVisible() {
|
|
4176
4219
|
return this.marketProfile.isVisible();
|
|
4177
4220
|
}
|
|
4178
4221
|
setMarketProfileConfig(e) {
|
|
4179
|
-
e.buckets !== void 0 && this.marketProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.marketProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.marketProfile.setOpacity(e.opacity), e.valueAreaPct !== void 0 && this.marketProfile.setValueAreaPct(e.valueAreaPct), e.highlightPoC !== void 0 && this.marketProfile.setHighlightPoC(e.highlightPoC), e.showStats !== void 0 && this.marketProfile.setShowStats(e.showStats), e.splitBySession !== void 0 && this.marketProfile.setSplitBySession(e.splitBySession), e.letters !== void 0 && this.marketProfile.setLetters(e.letters), this.engine.requestRender(
|
|
4222
|
+
e.buckets !== void 0 && this.marketProfile.setBuckets(e.buckets), e.widthRatio !== void 0 && this.marketProfile.setWidthRatio(e.widthRatio), e.opacity !== void 0 && this.marketProfile.setOpacity(e.opacity), e.valueAreaPct !== void 0 && this.marketProfile.setValueAreaPct(e.valueAreaPct), e.highlightPoC !== void 0 && this.marketProfile.setHighlightPoC(e.highlightPoC), e.showStats !== void 0 && this.marketProfile.setShowStats(e.showStats), e.splitBySession !== void 0 && this.marketProfile.setSplitBySession(e.splitBySession), e.letters !== void 0 && this.marketProfile.setLetters(e.letters), this.engine.requestRender(o.Main);
|
|
4180
4223
|
}
|
|
4181
4224
|
getMarketProfileConfig() {
|
|
4182
4225
|
return this.marketProfile.getConfig();
|
|
@@ -4185,38 +4228,38 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4185
4228
|
return this.marketProfile.getStats();
|
|
4186
4229
|
}
|
|
4187
4230
|
setDepthHeatmapVisible(e) {
|
|
4188
|
-
this.depthHeatmap.setVisible(e), this.engine.requestRender(
|
|
4231
|
+
this.depthHeatmap.setVisible(e), this.engine.requestRender(o.Main);
|
|
4189
4232
|
}
|
|
4190
4233
|
isDepthHeatmapVisible() {
|
|
4191
4234
|
return this.depthHeatmap.isVisible();
|
|
4192
4235
|
}
|
|
4193
4236
|
setDepthHeatmapConfig(e) {
|
|
4194
|
-
e.opacity !== void 0 && this.depthHeatmap.setOpacity(e.opacity), e.capacity !== void 0 && this.depthHeatmap.setCapacity(e.capacity), this.engine.requestRender(
|
|
4237
|
+
e.opacity !== void 0 && this.depthHeatmap.setOpacity(e.opacity), e.capacity !== void 0 && this.depthHeatmap.setCapacity(e.capacity), this.engine.requestRender(o.Main);
|
|
4195
4238
|
}
|
|
4196
4239
|
getDepthHeatmapConfig() {
|
|
4197
4240
|
return this.depthHeatmap.getConfig();
|
|
4198
4241
|
}
|
|
4199
4242
|
pushDepthSnapshot(e, t) {
|
|
4200
4243
|
let n = this.series.bars(), r = t ?? n[n.length - 1]?.time;
|
|
4201
|
-
r === void 0 || !Number.isFinite(r) || (this.depthHeatmap.push(r, e), this.depthHeatmap.isVisible() && this.engine.requestRender(
|
|
4244
|
+
r === void 0 || !Number.isFinite(r) || (this.depthHeatmap.push(r, e), this.depthHeatmap.isVisible() && this.engine.requestRender(o.Main));
|
|
4202
4245
|
}
|
|
4203
4246
|
clearDepthHeatmap() {
|
|
4204
|
-
this.depthHeatmap.clear(), this.engine.requestRender(
|
|
4247
|
+
this.depthHeatmap.clear(), this.engine.requestRender(o.Main);
|
|
4205
4248
|
}
|
|
4206
4249
|
setPeriodLevelsVisible(e) {
|
|
4207
|
-
this.periodLevels.setVisible(e), this.engine.requestRender(
|
|
4250
|
+
this.periodLevels.setVisible(e), this.engine.requestRender(o.Main);
|
|
4208
4251
|
}
|
|
4209
4252
|
isPeriodLevelsVisible() {
|
|
4210
4253
|
return this.periodLevels.isVisible();
|
|
4211
4254
|
}
|
|
4212
4255
|
setPeriodLevelsPeriod(e) {
|
|
4213
|
-
this.periodLevels.setPeriod(e), this.engine.requestRender(
|
|
4256
|
+
this.periodLevels.setPeriod(e), this.engine.requestRender(o.Main);
|
|
4214
4257
|
}
|
|
4215
4258
|
getPeriodLevelsPeriod() {
|
|
4216
4259
|
return this.periodLevels.getPeriod();
|
|
4217
4260
|
}
|
|
4218
4261
|
setTimeZone(e) {
|
|
4219
|
-
|
|
4262
|
+
bi(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
4220
4263
|
}
|
|
4221
4264
|
getTimeZone() {
|
|
4222
4265
|
return this.timeZoneSetting;
|
|
@@ -4225,22 +4268,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4225
4268
|
return this.displayTz;
|
|
4226
4269
|
}
|
|
4227
4270
|
getExchangeTimeZone() {
|
|
4228
|
-
return [
|
|
4229
|
-
}
|
|
4230
|
-
setTimezone(e) {
|
|
4231
|
-
this.setTimeZone(e);
|
|
4232
|
-
}
|
|
4233
|
-
getTimezone() {
|
|
4234
|
-
return this.getTimeZone();
|
|
4235
|
-
}
|
|
4236
|
-
getEffectiveTimezone() {
|
|
4237
|
-
return this.getEffectiveTimeZone();
|
|
4238
|
-
}
|
|
4239
|
-
getExchangeTimezone() {
|
|
4240
|
-
return this.getExchangeTimeZone();
|
|
4241
|
-
}
|
|
4242
|
-
setTimezoneOffset(e) {
|
|
4243
|
-
this.setTimeZone(e);
|
|
4271
|
+
return [ue(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && x(e)) ?? null;
|
|
4244
4272
|
}
|
|
4245
4273
|
applyExchangeZone() {
|
|
4246
4274
|
let e = this.getExchangeTimeZone();
|
|
@@ -4252,7 +4280,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4252
4280
|
this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
|
|
4253
4281
|
}
|
|
4254
4282
|
holdStudyZone() {
|
|
4255
|
-
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(),
|
|
4283
|
+
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), ft);
|
|
4256
4284
|
}
|
|
4257
4285
|
endStudyZoneWait() {
|
|
4258
4286
|
this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
|
|
@@ -4266,8 +4294,8 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4266
4294
|
}));
|
|
4267
4295
|
}
|
|
4268
4296
|
spokenBarTime(e) {
|
|
4269
|
-
let t = this.getDisplayData(), n = e *
|
|
4270
|
-
return
|
|
4297
|
+
let t = this.getDisplayData(), n = e * f(t), r = this.numberLocale || "en-US";
|
|
4298
|
+
return p(t) === !0 ? fe(r, { dateStyle: "medium" }, d(n, this.displayTz, this.getExchangeTimeZone()))(n) : fe(r, {
|
|
4271
4299
|
dateStyle: "medium",
|
|
4272
4300
|
timeStyle: "short"
|
|
4273
4301
|
}, this.displayTz)(n);
|
|
@@ -4280,23 +4308,22 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4280
4308
|
this.studyZoneHeld = !1, this.endStudyZoneWait(), this.useSymbolInfo(e);
|
|
4281
4309
|
}
|
|
4282
4310
|
useSymbolInfo(e) {
|
|
4283
|
-
|
|
4284
|
-
this.symbolInfo = e ? Si({
|
|
4311
|
+
this.symbolInfo = e ? {
|
|
4285
4312
|
...e,
|
|
4286
4313
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
4287
|
-
}
|
|
4288
|
-
let
|
|
4289
|
-
let t =
|
|
4314
|
+
} : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(o.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
4315
|
+
let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
|
|
4316
|
+
let t = T(e.start), n = T(e.end);
|
|
4290
4317
|
return t === null || n === null ? [] : [{
|
|
4291
4318
|
startMinute: t,
|
|
4292
4319
|
endMinute: n
|
|
4293
4320
|
}];
|
|
4294
|
-
}),
|
|
4295
|
-
this.sessionShading.replaceConfig(
|
|
4296
|
-
timeZone:
|
|
4297
|
-
windows:
|
|
4298
|
-
startMinute:
|
|
4299
|
-
endMinute:
|
|
4321
|
+
}), n = ue(this.symbolInfo);
|
|
4322
|
+
this.sessionShading.replaceConfig(t.length > 0 && n && x(n) ? {
|
|
4323
|
+
timeZone: n,
|
|
4324
|
+
windows: t,
|
|
4325
|
+
startMinute: t[0].startMinute,
|
|
4326
|
+
endMinute: t[t.length - 1].endMinute
|
|
4300
4327
|
} : this.hostSessionHours), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), this.reapplyExtendedHours(), this.updateViewportAndRender(), this.eventBus.emit("symbolInfoChange", { info: this.symbolInfo });
|
|
4301
4328
|
}
|
|
4302
4329
|
getSymbolInfo() {
|
|
@@ -4306,15 +4333,15 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4306
4333
|
if (!e || typeof e != "object") return;
|
|
4307
4334
|
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
4308
4335
|
if (!n(e.symbol)) return;
|
|
4309
|
-
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i =
|
|
4336
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = {
|
|
4310
4337
|
...r,
|
|
4311
4338
|
...e,
|
|
4312
4339
|
symbol: e.symbol || r?.symbol || t
|
|
4313
|
-
}
|
|
4340
|
+
};
|
|
4314
4341
|
r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
|
|
4315
4342
|
}
|
|
4316
4343
|
resolveStreamSymbol(e, t) {
|
|
4317
|
-
let n =
|
|
4344
|
+
let n = N(e), r = n.resolveSymbol?.bind(n);
|
|
4318
4345
|
if (this.symbolInfo && this.symbolInfo.symbol !== t ? (r ? this.holdStudyZone() : this.studyZoneHeld = !1, this.useSymbolInfo(null)) : r && this.studyZoneHeld && this.holdStudyZone(), !r) {
|
|
4319
4346
|
this.releaseStudyZone();
|
|
4320
4347
|
return;
|
|
@@ -4327,40 +4354,40 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4327
4354
|
});
|
|
4328
4355
|
}
|
|
4329
4356
|
setPivotMarkersVisible(e) {
|
|
4330
|
-
this.pivotMarkers.setVisible(e), this.engine.requestRender(
|
|
4357
|
+
this.pivotMarkers.setVisible(e), this.engine.requestRender(o.Overlay);
|
|
4331
4358
|
}
|
|
4332
4359
|
isPivotMarkersVisible() {
|
|
4333
4360
|
return this.pivotMarkers.isVisible();
|
|
4334
4361
|
}
|
|
4335
4362
|
setPivotMarkersConfig(e) {
|
|
4336
|
-
(e.left !== void 0 || e.right !== void 0) && this.pivotMarkers.setStrength(e.left ?? 5, e.right ?? e.left ?? 5), e.showLabels !== void 0 && this.pivotMarkers.setShowLabels(e.showLabels), e.structureLabels !== void 0 && this.pivotMarkers.setStructureLabels(e.structureLabels), this.engine.requestRender(
|
|
4363
|
+
(e.left !== void 0 || e.right !== void 0) && this.pivotMarkers.setStrength(e.left ?? 5, e.right ?? e.left ?? 5), e.showLabels !== void 0 && this.pivotMarkers.setShowLabels(e.showLabels), e.structureLabels !== void 0 && this.pivotMarkers.setStructureLabels(e.structureLabels), this.engine.requestRender(o.Overlay);
|
|
4337
4364
|
}
|
|
4338
4365
|
getPivotMarkersConfig() {
|
|
4339
4366
|
return this.pivotMarkers.getConfig();
|
|
4340
4367
|
}
|
|
4341
4368
|
setSessionShadingVisible(e) {
|
|
4342
|
-
this.sessionShading.setVisible(e), this.engine.requestRender(
|
|
4369
|
+
this.sessionShading.setVisible(e), this.engine.requestRender(o.Background);
|
|
4343
4370
|
}
|
|
4344
4371
|
isSessionShadingVisible() {
|
|
4345
4372
|
return this.sessionShading.isVisible();
|
|
4346
4373
|
}
|
|
4347
4374
|
setSessionShadingConfig(e) {
|
|
4348
|
-
this.hostSessionHours = Vt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(
|
|
4375
|
+
this.hostSessionHours = Vt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(o.Background);
|
|
4349
4376
|
}
|
|
4350
4377
|
setTooltipVisible(e) {
|
|
4351
4378
|
e || this.crosshairTooltip.hide();
|
|
4352
4379
|
}
|
|
4353
4380
|
setLegend(e) {
|
|
4354
|
-
this.chartLegend.setConfig(e), this.engine.requestRender(
|
|
4381
|
+
this.chartLegend.setConfig(e), this.engine.requestRender(o.Hover);
|
|
4355
4382
|
}
|
|
4356
4383
|
isLegendVisible() {
|
|
4357
4384
|
return this.features.legend && this.chartLegend.getConfig().visible;
|
|
4358
4385
|
}
|
|
4359
4386
|
setSymbolName(e) {
|
|
4360
|
-
this.chartLegend.setSymbol(e), this.engine.requestRender(
|
|
4387
|
+
this.chartLegend.setSymbol(e), this.engine.requestRender(o.Hover);
|
|
4361
4388
|
}
|
|
4362
4389
|
setStatusText(e) {
|
|
4363
|
-
this.chartLegend.setStatusText(e), this.engine.requestRender(
|
|
4390
|
+
this.chartLegend.setStatusText(e), this.engine.requestRender(o.Hover);
|
|
4364
4391
|
}
|
|
4365
4392
|
async setRenderer(e) {
|
|
4366
4393
|
let t = ++this.rendererToken;
|
|
@@ -4371,7 +4398,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4371
4398
|
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? Pt() > 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());
|
|
4372
4399
|
}
|
|
4373
4400
|
waitForGpu(e) {
|
|
4374
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
4401
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? en(e) : null;
|
|
4375
4402
|
}
|
|
4376
4403
|
getRenderer() {
|
|
4377
4404
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -4393,7 +4420,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4393
4420
|
this.engine.getGpu() && this.engine.renderNow();
|
|
4394
4421
|
}
|
|
4395
4422
|
screenshot(e) {
|
|
4396
|
-
this.features.screenshot && (this.freshFrame(),
|
|
4423
|
+
this.features.screenshot && (this.freshFrame(), k.download(this.container, e, this.themeManager.getTheme().background));
|
|
4397
4424
|
}
|
|
4398
4425
|
async copyScreenshot() {
|
|
4399
4426
|
if (!this.features.screenshot) return !1;
|
|
@@ -4401,7 +4428,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4401
4428
|
if (!t?.write || !e) return !1;
|
|
4402
4429
|
try {
|
|
4403
4430
|
this.freshFrame();
|
|
4404
|
-
let n =
|
|
4431
|
+
let n = k.toBlob(this.container, this.themeManager.getTheme().background).then((e) => {
|
|
4405
4432
|
if (!e) throw Error("No chart image to copy");
|
|
4406
4433
|
return e;
|
|
4407
4434
|
});
|
|
@@ -4419,10 +4446,10 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4419
4446
|
}
|
|
4420
4447
|
}
|
|
4421
4448
|
screenshotDataURL() {
|
|
4422
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
4449
|
+
return this.features.screenshot ? (this.freshFrame(), k.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
|
|
4423
4450
|
}
|
|
4424
4451
|
async screenshotBlob() {
|
|
4425
|
-
return this.features.screenshot ? (this.freshFrame(),
|
|
4452
|
+
return this.features.screenshot ? (this.freshFrame(), k.toBlob(this.container, this.themeManager.getTheme().background)) : null;
|
|
4426
4453
|
}
|
|
4427
4454
|
addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
|
|
4428
4455
|
if (!this.features.alerts) return null;
|
|
@@ -4495,7 +4522,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4495
4522
|
this.alertManager.saveToStorage(e);
|
|
4496
4523
|
}
|
|
4497
4524
|
loadAlerts(e) {
|
|
4498
|
-
this.alertManager.loadFromStorage(e), this.alertManager.pruneDrawingAlerts(new Set(this.drawingManager.getDrawings().map((e) => e.id))), this.engine.requestRender(
|
|
4525
|
+
this.alertManager.loadFromStorage(e), this.alertManager.pruneDrawingAlerts(new Set(this.drawingManager.getDrawings().map((e) => e.id))), this.engine.requestRender(o.Overlay);
|
|
4499
4526
|
}
|
|
4500
4527
|
addSignalMarker(e) {
|
|
4501
4528
|
return this.signalMarkerManager.addMarker(e);
|
|
@@ -4541,24 +4568,24 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4541
4568
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
4542
4569
|
if (!this.replaySession) {
|
|
4543
4570
|
if (this.series.length() === 0) return;
|
|
4544
|
-
this.series.beginReplay(), this.replaySession =
|
|
4571
|
+
this.series.beginReplay(), this.replaySession = Li(this.currentSymbol);
|
|
4545
4572
|
}
|
|
4546
4573
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4547
4574
|
c.animate = c.animate === !0;
|
|
4548
4575
|
let l = this.series.inHoursShown(this.series.liveBars()), u = t > 0 && i === void 0 && a !== !1, d = c.startIndex;
|
|
4549
|
-
i !== void 0 && d === void 0 ? d =
|
|
4576
|
+
i !== void 0 && d === void 0 ? d = J(l, i) : u && d !== void 0 && (d += t);
|
|
4550
4577
|
let f = u ? t : a && d !== void 0 && d > 0 ? Math.min(Math.floor(d), l.length - 1) : 0, p = f > 0 ? l.slice(f) : l;
|
|
4551
4578
|
d !== void 0 && (c.startIndex = d - f), n.windowTime = f > 0 ? p[0]?.time ?? null : null, n.steps = r ?? null, n.stepsSymbol = this.currentSymbol, n.until = null, n.animate = c.animate, n.step = c.animate ? s ?? null : null, this.replayRevealMarks = o !== !1, this.useReplayLoader(n, !0);
|
|
4552
4579
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4553
4580
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4554
4581
|
let h = this.replayStepsSeries;
|
|
4555
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4582
|
+
h && c.startIndex !== void 0 && (c.startIndex = Gi(h, p, c.startIndex));
|
|
4556
4583
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4557
4584
|
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);
|
|
4558
4585
|
}
|
|
4559
4586
|
buildReplay(e, t, n) {
|
|
4560
4587
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4561
|
-
this.replayPieces = r && t ?
|
|
4588
|
+
this.replayPieces = r && t ? Ji(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4562
4589
|
let a = this.replayRestarting;
|
|
4563
4590
|
this.replayRestarting = !0;
|
|
4564
4591
|
try {
|
|
@@ -4572,7 +4599,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4572
4599
|
let n = t, a = e[t];
|
|
4573
4600
|
if (i) {
|
|
4574
4601
|
let r = i[t];
|
|
4575
|
-
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ?
|
|
4602
|
+
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? Zi(c, r) : Ki(e[n], i, t), a = qi(i, e, t, n) ? e[n] : c;
|
|
4576
4603
|
}
|
|
4577
4604
|
let u = this.replayForming;
|
|
4578
4605
|
this.replayForming = null, s = t;
|
|
@@ -4596,7 +4623,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4596
4623
|
});
|
|
4597
4624
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4598
4625
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4599
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4626
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Yi() ? ii(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = ri(r, i);
|
|
4600
4627
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4601
4628
|
index: t,
|
|
4602
4629
|
path: r
|
|
@@ -4614,19 +4641,19 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4614
4641
|
}
|
|
4615
4642
|
replayPathOf(e, t) {
|
|
4616
4643
|
let n = e[t];
|
|
4617
|
-
return
|
|
4644
|
+
return Qr(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4618
4645
|
}
|
|
4619
4646
|
loadReplaySteps(e, t) {
|
|
4620
4647
|
let n = this.replayLoader?.loader;
|
|
4621
4648
|
if (!n) return;
|
|
4622
4649
|
n.evictBefore(e[t].time);
|
|
4623
4650
|
let r = this.replayManager.getStepMs();
|
|
4624
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
4651
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(Ni / r) : 1);
|
|
4625
4652
|
}
|
|
4626
4653
|
useReplayLoader(e, t) {
|
|
4627
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4654
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? si(e.step, r, (e) => qt(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
4628
4655
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4629
|
-
let o =
|
|
4656
|
+
let o = N(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new Gr({
|
|
4630
4657
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4631
4658
|
step: i,
|
|
4632
4659
|
ratio: Math.max(1, Math.round(l / E(i))),
|
|
@@ -4664,9 +4691,9 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4664
4691
|
if (!t) return;
|
|
4665
4692
|
let n = this.series.inHoursShown(this.series.liveBars());
|
|
4666
4693
|
if (n.length === 0) return;
|
|
4667
|
-
let r = t.windowTime === null ? 0 : Math.min(
|
|
4694
|
+
let r = t.windowTime === null ? 0 : Math.min(J(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4668
4695
|
this.useReplayLoader(t, !1);
|
|
4669
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4696
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Bi(o ?? i, t.until);
|
|
4670
4697
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4671
4698
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4672
4699
|
return;
|
|
@@ -4674,7 +4701,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4674
4701
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4675
4702
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4676
4703
|
let d = this.replayManager.remainingMs();
|
|
4677
|
-
this.clearBarHolders(), t.animate &&
|
|
4704
|
+
this.clearBarHolders(), t.animate && zi(t, this.replayCoarse, i);
|
|
4678
4705
|
let f = this.replayRestarting;
|
|
4679
4706
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4680
4707
|
try {
|
|
@@ -4697,14 +4724,14 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4697
4724
|
}
|
|
4698
4725
|
replayStepsOver(e, t, n = !1) {
|
|
4699
4726
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4700
|
-
let r =
|
|
4701
|
-
return r && (n ||
|
|
4727
|
+
let r = Wi(this.series.inHoursShown(e.steps), t);
|
|
4728
|
+
return r && (n || Hi(r, t)) ? r : null;
|
|
4702
4729
|
}
|
|
4703
4730
|
canPageBackForReplay(e) {
|
|
4704
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4731
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < Pi;
|
|
4705
4732
|
}
|
|
4706
4733
|
async pageBackForReplay(e) {
|
|
4707
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4734
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = Pi, this.rebaseReplay("older"));
|
|
4708
4735
|
}
|
|
4709
4736
|
holdReplay() {
|
|
4710
4737
|
let e = this.replaySession;
|
|
@@ -4737,7 +4764,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4737
4764
|
this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4738
4765
|
}
|
|
4739
4766
|
replaySeekToTime(e) {
|
|
4740
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4767
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, Bi(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4741
4768
|
}
|
|
4742
4769
|
feedReplayPrice(e, t) {
|
|
4743
4770
|
let n = this.executionAdapter;
|
|
@@ -4766,7 +4793,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4766
4793
|
}
|
|
4767
4794
|
replaySeekToBar(e) {
|
|
4768
4795
|
let t = this.replayStepsSeries;
|
|
4769
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4796
|
+
this.replaySeek(t && this.replayCoarse ? Gi(t, this.replayCoarse, e) : e);
|
|
4770
4797
|
}
|
|
4771
4798
|
replayPause() {
|
|
4772
4799
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4807,7 +4834,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4807
4834
|
let { x: r, y: c } = this.drawingManager.anchorPoint(t.type, e, n);
|
|
4808
4835
|
i = Math.min(i, r), a = Math.max(a, r), o = Math.min(o, c), s = Math.max(s, c);
|
|
4809
4836
|
}
|
|
4810
|
-
if (
|
|
4837
|
+
if (Ei.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Di.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;
|
|
4811
4838
|
let c = this.drawingManager.drawnExtent(e);
|
|
4812
4839
|
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 ? {
|
|
4813
4840
|
x: i,
|
|
@@ -4858,12 +4885,12 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4858
4885
|
});
|
|
4859
4886
|
}
|
|
4860
4887
|
restoreIndicators(e, t) {
|
|
4861
|
-
let n =
|
|
4888
|
+
let n = nr(e), r = /* @__PURE__ */ new Map();
|
|
4862
4889
|
this.unrestoredIndicators = [];
|
|
4863
4890
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4864
4891
|
if (t) {
|
|
4865
4892
|
let e = this.getIndicatorSetup();
|
|
4866
|
-
for (let t of
|
|
4893
|
+
for (let t of ir(e, n)) o.add(t);
|
|
4867
4894
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4868
4895
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4869
4896
|
for (let e = !0; e;) {
|
|
@@ -4874,7 +4901,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4874
4901
|
}
|
|
4875
4902
|
}
|
|
4876
4903
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4877
|
-
let s = (e) =>
|
|
4904
|
+
let s = (e) => or(e, r);
|
|
4878
4905
|
for (let e of n) {
|
|
4879
4906
|
let n = null;
|
|
4880
4907
|
if (o.has(e.instanceId)) {
|
|
@@ -4907,7 +4934,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4907
4934
|
}
|
|
4908
4935
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
4909
4936
|
}
|
|
4910
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
4937
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), tr(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
4911
4938
|
}
|
|
4912
4939
|
restoreLooks(e, t) {
|
|
4913
4940
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -4927,7 +4954,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4927
4954
|
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? oe(t.paneStyle) : null);
|
|
4928
4955
|
}
|
|
4929
4956
|
getIndicatorSetup() {
|
|
4930
|
-
return [
|
|
4957
|
+
return [...er(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
4931
4958
|
}
|
|
4932
4959
|
applyIndicatorSetup(e) {
|
|
4933
4960
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -4936,7 +4963,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4936
4963
|
});
|
|
4937
4964
|
}
|
|
4938
4965
|
followIndicatorAlerts(e, t) {
|
|
4939
|
-
this.features.alerts &&
|
|
4966
|
+
this.features.alerts && ui(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
4940
4967
|
}
|
|
4941
4968
|
beginIndicatorEdit(e) {
|
|
4942
4969
|
this.indicatorHistory.begin(e);
|
|
@@ -4960,17 +4987,17 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4960
4987
|
keptPaneDrawings = [];
|
|
4961
4988
|
replayingIndicatorStep = !1;
|
|
4962
4989
|
takesDrawing(e, t) {
|
|
4963
|
-
return
|
|
4990
|
+
return fr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
4964
4991
|
}
|
|
4965
4992
|
renamePane(e, t) {
|
|
4966
4993
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
4967
4994
|
}
|
|
4968
4995
|
drawingPaneAt(e) {
|
|
4969
|
-
return
|
|
4996
|
+
return ur(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
4970
4997
|
}
|
|
4971
4998
|
drawingPaneViewport(e) {
|
|
4972
4999
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
4973
|
-
return
|
|
5000
|
+
return dr(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
4974
5001
|
}
|
|
4975
5002
|
saveState(e) {
|
|
4976
5003
|
if (!this.features.saveLoad) return null;
|
|
@@ -4984,7 +5011,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
4984
5011
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
4985
5012
|
this.drawingManager.renamePanes(n);
|
|
4986
5013
|
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));
|
|
4987
|
-
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 &&
|
|
5014
|
+
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 && pi(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
4988
5015
|
console.warn("Layout alert left out:", e);
|
|
4989
5016
|
}), this.markStateChanged();
|
|
4990
5017
|
}
|
|
@@ -5011,7 +5038,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5011
5038
|
return this.numberLocale;
|
|
5012
5039
|
}
|
|
5013
5040
|
setMarket(e) {
|
|
5014
|
-
this.marketConfig = e, this.studyZoneHeld = !1, this.endStudyZoneWait(), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), e.colorScheme && this.themeManager.setTheme(
|
|
5041
|
+
this.marketConfig = e, this.studyZoneHeld = !1, this.endStudyZoneWait(), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.applyExchangeZone(), e.colorScheme && this.themeManager.setTheme(_(this.themeManager.getBaseTheme(), e.colorScheme)), e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender(), this.eventBus.emit("marketChange", { market: e });
|
|
5015
5042
|
}
|
|
5016
5043
|
applyPricePrecision(e) {
|
|
5017
5044
|
this.marketPricePrecision = e, this.viewport.setPricePrecision(e), this.pinnedTooltip.setPricePrecision(e), this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e), this.tradeZoneManager.setPricePrecision(e), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
|
|
@@ -5021,7 +5048,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5021
5048
|
}
|
|
5022
5049
|
getPriceLimits() {
|
|
5023
5050
|
let e = this.marketConfig;
|
|
5024
|
-
return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null :
|
|
5051
|
+
return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : h(e.priceLimits.referencePrice, e);
|
|
5025
5052
|
}
|
|
5026
5053
|
setPriceLimits(e) {
|
|
5027
5054
|
this.marketConfig?.priceLimits && (this.marketConfig = {
|
|
@@ -5037,14 +5064,14 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5037
5064
|
}
|
|
5038
5065
|
setFeatures(e) {
|
|
5039
5066
|
let t = this.getLegendBottom();
|
|
5040
|
-
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(
|
|
5067
|
+
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.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();
|
|
5041
5068
|
}
|
|
5042
5069
|
resize() {
|
|
5043
5070
|
let e = this.engine.dprManager.readContainerSize();
|
|
5044
5071
|
if (e.width <= 0 || e.height <= 0) return;
|
|
5045
5072
|
this.containerSizeCache = e, this.containerSizeCacheTime = Date.now();
|
|
5046
5073
|
let t = this.engine.dprManager.getDpr();
|
|
5047
|
-
this.engine.layerManager.resize(e, t);
|
|
5074
|
+
this.engine.layerManager.resize(e, t, this.engine.dprManager.getDeviceSize());
|
|
5048
5075
|
let n = this.viewport.isAtEnd();
|
|
5049
5076
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(n), this.eventBus.emit("resize", e);
|
|
5050
5077
|
}
|
|
@@ -5052,8 +5079,8 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5052
5079
|
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 = "";
|
|
5053
5080
|
}
|
|
5054
5081
|
createChartRenderer(e) {
|
|
5055
|
-
let t =
|
|
5056
|
-
return t instanceof
|
|
5082
|
+
let t = Nn(e, (e) => this.pluginManager.getChartType(e));
|
|
5083
|
+
return t instanceof ze && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5057
5084
|
}
|
|
5058
5085
|
crosshairSeries() {
|
|
5059
5086
|
return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
|
|
@@ -5071,7 +5098,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5071
5098
|
}
|
|
5072
5099
|
exportBars() {
|
|
5073
5100
|
if (this.isTimeAligned()) return this.series.bars();
|
|
5074
|
-
let e = this.getDisplayData(), t =
|
|
5101
|
+
let e = this.getDisplayData(), t = A(e);
|
|
5075
5102
|
return e.map((e, n) => ({
|
|
5076
5103
|
...e,
|
|
5077
5104
|
time: t[n]?.time ?? e.time
|
|
@@ -5130,7 +5157,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5130
5157
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5131
5158
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5132
5159
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5133
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5160
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && Gn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5134
5161
|
});
|
|
5135
5162
|
}
|
|
5136
5163
|
updateViewportAndRender(e = !1) {
|
|
@@ -5145,7 +5172,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5145
5172
|
fitLeftAxisWidth() {
|
|
5146
5173
|
let e = this.leftViewport;
|
|
5147
5174
|
if (!e) return !1;
|
|
5148
|
-
let t = this.themeManager.getTheme(), n =
|
|
5175
|
+
let t = this.themeManager.getTheme(), n = kr({
|
|
5149
5176
|
min: e.priceRange.min,
|
|
5150
5177
|
max: e.priceRange.max,
|
|
5151
5178
|
lastPrice: null,
|
|
@@ -5154,12 +5181,12 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5154
5181
|
fontFamily: t.font.family,
|
|
5155
5182
|
fontSizeSmall: t.font.sizeSmall,
|
|
5156
5183
|
measure: (e, t) => this.measureText(e, t)
|
|
5157
|
-
}), r =
|
|
5184
|
+
}), r = Ar(this.leftAxisWidth, n);
|
|
5158
5185
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5159
5186
|
}
|
|
5160
5187
|
fitPriceAxisWidth() {
|
|
5161
5188
|
if (!this.features.priceAxis) return !1;
|
|
5162
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5189
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = kr({
|
|
5163
5190
|
min: e.min,
|
|
5164
5191
|
max: e.max,
|
|
5165
5192
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5170,14 +5197,14 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5170
5197
|
fontFamily: t.font.family,
|
|
5171
5198
|
fontSizeSmall: t.font.sizeSmall,
|
|
5172
5199
|
measure: (e, t) => this.measureText(e, t)
|
|
5173
|
-
}), r =
|
|
5200
|
+
}), r = Ar(this.priceAxisWidth, n);
|
|
5174
5201
|
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);
|
|
5175
5202
|
}
|
|
5176
5203
|
measureText(e, t) {
|
|
5177
|
-
let n = this.engine.layerManager.getLayer(
|
|
5178
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
5204
|
+
let n = this.engine.layerManager.getLayer(o.Main)?.ctx;
|
|
5205
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => ki(n, e, t));
|
|
5179
5206
|
let r = n ?? this.detachedMeasureContext();
|
|
5180
|
-
return r ?
|
|
5207
|
+
return r ? ki(r, e, t) : e.length * 7;
|
|
5181
5208
|
}
|
|
5182
5209
|
detachedMeasureContext() {
|
|
5183
5210
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -5265,7 +5292,7 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5265
5292
|
});
|
|
5266
5293
|
}
|
|
5267
5294
|
drawOverlayPlugins(e, t) {
|
|
5268
|
-
let n =
|
|
5295
|
+
let n = Fr(this.pluginManager.getOverlays(), t);
|
|
5269
5296
|
if (n.length === 0) return;
|
|
5270
5297
|
let r = {
|
|
5271
5298
|
viewport: this.viewport.getState(),
|
|
@@ -5286,15 +5313,15 @@ var Ci = .08, wi = 20, Ti = 8, Ei = 10, Di = {
|
|
|
5286
5313
|
};
|
|
5287
5314
|
}
|
|
5288
5315
|
};
|
|
5289
|
-
function
|
|
5316
|
+
function ki(e, t, n) {
|
|
5290
5317
|
let r = e.font;
|
|
5291
5318
|
e.font = n;
|
|
5292
5319
|
let i = e.measureText(t).width;
|
|
5293
5320
|
return e.font = r, i;
|
|
5294
5321
|
}
|
|
5295
|
-
var
|
|
5296
|
-
function
|
|
5297
|
-
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <=
|
|
5322
|
+
var Ai = 300;
|
|
5323
|
+
function ji(e) {
|
|
5324
|
+
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <= Ai && !/[;{}<>\\]|\/\*/.test(e);
|
|
5298
5325
|
n(e.family) && (t.family = e.family), n(e.textFamily) && (t.textFamily = e.textFamily);
|
|
5299
5326
|
for (let n of [
|
|
5300
5327
|
"sizeSmall",
|
|
@@ -5306,7 +5333,7 @@ function Ni(e) {
|
|
|
5306
5333
|
}
|
|
5307
5334
|
return t;
|
|
5308
5335
|
}
|
|
5309
|
-
function
|
|
5336
|
+
function Mi(e) {
|
|
5310
5337
|
let t = e.tagRadius;
|
|
5311
5338
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
5312
5339
|
}
|
|
@@ -5325,8 +5352,8 @@ function X(e) {
|
|
|
5325
5352
|
bars: e.bars
|
|
5326
5353
|
};
|
|
5327
5354
|
}
|
|
5328
|
-
var
|
|
5329
|
-
function
|
|
5355
|
+
var Ni = 8e3, Pi = 10, Fi = 50, Ii = .001;
|
|
5356
|
+
function Li(e) {
|
|
5330
5357
|
return {
|
|
5331
5358
|
price: null,
|
|
5332
5359
|
fedTime: null,
|
|
@@ -5341,48 +5368,48 @@ function zi(e) {
|
|
|
5341
5368
|
held: null
|
|
5342
5369
|
};
|
|
5343
5370
|
}
|
|
5344
|
-
function
|
|
5371
|
+
function Ri(e, t) {
|
|
5345
5372
|
let n = e[t + 1];
|
|
5346
|
-
return n ? n.time - e[t].time :
|
|
5373
|
+
return n ? n.time - e[t].time : Ui(e);
|
|
5347
5374
|
}
|
|
5348
|
-
function
|
|
5375
|
+
function zi(e, t, n) {
|
|
5349
5376
|
let r = e.fedTime;
|
|
5350
5377
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5351
|
-
let i =
|
|
5378
|
+
let i = Ri(t, Z(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Z(n, a), s = n[o].time;
|
|
5352
5379
|
if (s > a) return;
|
|
5353
|
-
let c =
|
|
5380
|
+
let c = Ri(n, o);
|
|
5354
5381
|
if (a === s && o > 0) {
|
|
5355
5382
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
5356
5383
|
return;
|
|
5357
5384
|
}
|
|
5358
5385
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5359
5386
|
}
|
|
5360
|
-
function
|
|
5361
|
-
let n =
|
|
5362
|
-
return n > r && r >= 0 && e[r].time +
|
|
5387
|
+
function Bi(e, t) {
|
|
5388
|
+
let n = Y(e, t), r = e.length - 1;
|
|
5389
|
+
return n > r && r >= 0 && e[r].time + Ui(e) <= t ? r : Math.max(-1, n - 2);
|
|
5363
5390
|
}
|
|
5364
|
-
function
|
|
5391
|
+
function Vi(e) {
|
|
5365
5392
|
let t = Infinity;
|
|
5366
5393
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
5367
5394
|
return t;
|
|
5368
5395
|
}
|
|
5369
|
-
function
|
|
5370
|
-
if (!(
|
|
5371
|
-
let n = Math.max(0, e.length -
|
|
5396
|
+
function Hi(e, t) {
|
|
5397
|
+
if (!(Vi(e) < Vi(t))) return !1;
|
|
5398
|
+
let n = Math.max(0, e.length - Fi);
|
|
5372
5399
|
for (let r = n; r < e.length; r++) {
|
|
5373
|
-
let n = t[Z(t, e[r].time)], i = (n.high - n.low) *
|
|
5400
|
+
let n = t[Z(t, e[r].time)], i = (n.high - n.low) * Ii + 2 ** -52;
|
|
5374
5401
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5375
5402
|
}
|
|
5376
5403
|
return !0;
|
|
5377
5404
|
}
|
|
5378
|
-
function
|
|
5405
|
+
function Ui(e) {
|
|
5379
5406
|
let t = 0;
|
|
5380
5407
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5381
5408
|
return t > 0 ? t : Infinity;
|
|
5382
5409
|
}
|
|
5383
|
-
function
|
|
5410
|
+
function Wi(e, t) {
|
|
5384
5411
|
if (t.length === 0) return null;
|
|
5385
|
-
let n = t[t.length - 1].time +
|
|
5412
|
+
let n = t[t.length - 1].time + Ui(t), r = e.filter((e) => Vn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5386
5413
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5387
5414
|
if (i.length === 0) return null;
|
|
5388
5415
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5398,26 +5425,26 @@ function Z(e, t) {
|
|
|
5398
5425
|
}
|
|
5399
5426
|
return n;
|
|
5400
5427
|
}
|
|
5401
|
-
function
|
|
5428
|
+
function Gi(e, t, n) {
|
|
5402
5429
|
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;
|
|
5403
5430
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5404
5431
|
return Math.max(0, a);
|
|
5405
5432
|
}
|
|
5406
|
-
function
|
|
5433
|
+
function Ki(e, t, n) {
|
|
5407
5434
|
let r = n;
|
|
5408
5435
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5409
5436
|
let i = {
|
|
5410
5437
|
...t[r],
|
|
5411
5438
|
time: e.time
|
|
5412
5439
|
};
|
|
5413
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5440
|
+
for (let e = r + 1; e <= n; e++) i = Zi(i, t[e]);
|
|
5414
5441
|
return i;
|
|
5415
5442
|
}
|
|
5416
|
-
function
|
|
5443
|
+
function qi(e, t, n, r) {
|
|
5417
5444
|
let i = e[n + 1], a = t[r + 1];
|
|
5418
5445
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5419
5446
|
}
|
|
5420
|
-
function
|
|
5447
|
+
function Ji(e, t) {
|
|
5421
5448
|
let n = /* @__PURE__ */ new Map();
|
|
5422
5449
|
for (let r of e) {
|
|
5423
5450
|
let e = t[Z(t, r.time)].time, i = n.get(e);
|
|
@@ -5425,10 +5452,17 @@ function Xi(e, t) {
|
|
|
5425
5452
|
}
|
|
5426
5453
|
return n;
|
|
5427
5454
|
}
|
|
5428
|
-
function
|
|
5455
|
+
function Yi() {
|
|
5429
5456
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5430
5457
|
}
|
|
5431
|
-
function
|
|
5458
|
+
function Xi(e) {
|
|
5459
|
+
return {
|
|
5460
|
+
inset: e.legendInset,
|
|
5461
|
+
top: e.legendTop,
|
|
5462
|
+
lineGap: e.legendLineGap
|
|
5463
|
+
};
|
|
5464
|
+
}
|
|
5465
|
+
function Zi(e, t) {
|
|
5432
5466
|
return {
|
|
5433
5467
|
time: e.time,
|
|
5434
5468
|
open: e.open,
|
|
@@ -5440,26 +5474,26 @@ function Qi(e, t) {
|
|
|
5440
5474
|
}
|
|
5441
5475
|
//#endregion
|
|
5442
5476
|
//#region src/io/parseOHLCV.ts
|
|
5443
|
-
var
|
|
5477
|
+
var Qi = [
|
|
5444
5478
|
"time",
|
|
5445
5479
|
"timestamp",
|
|
5446
5480
|
"date",
|
|
5447
5481
|
"datetime",
|
|
5448
5482
|
"t"
|
|
5449
|
-
],
|
|
5483
|
+
], $i = ["open", "o"], ea = ["high", "h"], ta = ["low", "l"], na = ["close", "c"], ra = [
|
|
5450
5484
|
"volume",
|
|
5451
5485
|
"vol",
|
|
5452
5486
|
"v"
|
|
5453
5487
|
];
|
|
5454
|
-
function
|
|
5488
|
+
function ia(e) {
|
|
5455
5489
|
let t = e.trim();
|
|
5456
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5490
|
+
return t ? t[0] === "[" || t[0] === "{" ? aa(t) : oa(t) : {
|
|
5457
5491
|
data: [],
|
|
5458
5492
|
rowCount: 0,
|
|
5459
5493
|
skipped: 0
|
|
5460
5494
|
};
|
|
5461
5495
|
}
|
|
5462
|
-
function
|
|
5496
|
+
function aa(e) {
|
|
5463
5497
|
let t;
|
|
5464
5498
|
try {
|
|
5465
5499
|
t = JSON.parse(e);
|
|
@@ -5469,19 +5503,19 @@ function oa(e) {
|
|
|
5469
5503
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5470
5504
|
let n = [], r = 0;
|
|
5471
5505
|
for (let e of t) {
|
|
5472
|
-
let t = Array.isArray(e) ?
|
|
5506
|
+
let t = Array.isArray(e) ? da(e) : ua(e);
|
|
5473
5507
|
t ? n.push(t) : r++;
|
|
5474
5508
|
}
|
|
5475
|
-
return
|
|
5509
|
+
return pa(n, t.length, r);
|
|
5476
5510
|
}
|
|
5477
|
-
function
|
|
5511
|
+
function oa(e) {
|
|
5478
5512
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5479
5513
|
if (t.length === 0) return {
|
|
5480
5514
|
data: [],
|
|
5481
5515
|
rowCount: 0,
|
|
5482
5516
|
skipped: 0
|
|
5483
5517
|
};
|
|
5484
|
-
let n =
|
|
5518
|
+
let n = sa(t[0]), r = ca(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? la(r) : {
|
|
5485
5519
|
time: 0,
|
|
5486
5520
|
open: 1,
|
|
5487
5521
|
high: 2,
|
|
@@ -5492,7 +5526,7 @@ function sa(e) {
|
|
|
5492
5526
|
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");
|
|
5493
5527
|
let o = [], s = 0;
|
|
5494
5528
|
for (let e = +!!i; e < t.length; e++) {
|
|
5495
|
-
let r =
|
|
5529
|
+
let r = ca(t[e], n), i = fa(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;
|
|
5496
5530
|
if (i === null || ![
|
|
5497
5531
|
c,
|
|
5498
5532
|
l,
|
|
@@ -5511,9 +5545,9 @@ function sa(e) {
|
|
|
5511
5545
|
volume: Number.isFinite(f) ? f : 0
|
|
5512
5546
|
});
|
|
5513
5547
|
}
|
|
5514
|
-
return
|
|
5548
|
+
return pa(o, t.length - +!!i, s);
|
|
5515
5549
|
}
|
|
5516
|
-
function
|
|
5550
|
+
function sa(e) {
|
|
5517
5551
|
let t = {
|
|
5518
5552
|
",": 0,
|
|
5519
5553
|
";": 0,
|
|
@@ -5525,7 +5559,7 @@ function ca(e) {
|
|
|
5525
5559
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5526
5560
|
return n;
|
|
5527
5561
|
}
|
|
5528
|
-
function
|
|
5562
|
+
function ca(e, t) {
|
|
5529
5563
|
let n = [], r = "", i = !1;
|
|
5530
5564
|
for (let a = 0; a < e.length; a++) {
|
|
5531
5565
|
let o = e[a];
|
|
@@ -5533,25 +5567,25 @@ function la(e, t) {
|
|
|
5533
5567
|
}
|
|
5534
5568
|
return n.push(r), n;
|
|
5535
5569
|
}
|
|
5536
|
-
function
|
|
5570
|
+
function la(e) {
|
|
5537
5571
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5538
5572
|
return {
|
|
5539
|
-
time: t(
|
|
5540
|
-
open: t(
|
|
5541
|
-
high: t(
|
|
5542
|
-
low: t(
|
|
5543
|
-
close: t(
|
|
5544
|
-
volume: t(
|
|
5573
|
+
time: t(Qi),
|
|
5574
|
+
open: t($i),
|
|
5575
|
+
high: t(ea),
|
|
5576
|
+
low: t(ta),
|
|
5577
|
+
close: t(na),
|
|
5578
|
+
volume: t(ra)
|
|
5545
5579
|
};
|
|
5546
5580
|
}
|
|
5547
|
-
function
|
|
5581
|
+
function ua(e) {
|
|
5548
5582
|
let t = (t) => {
|
|
5549
5583
|
for (let n of t) {
|
|
5550
5584
|
if (e[n] !== void 0) return e[n];
|
|
5551
5585
|
let t = n.toUpperCase();
|
|
5552
5586
|
if (e[t] !== void 0) return e[t];
|
|
5553
5587
|
}
|
|
5554
|
-
}, n =
|
|
5588
|
+
}, n = fa(String(t(Qi) ?? "")), r = Number(t($i)), i = Number(t(ea)), a = Number(t(ta)), o = Number(t(na)), s = Number(t(ra) ?? 0);
|
|
5555
5589
|
return n === null || ![
|
|
5556
5590
|
r,
|
|
5557
5591
|
i,
|
|
@@ -5566,9 +5600,9 @@ function da(e) {
|
|
|
5566
5600
|
volume: Number.isFinite(s) ? s : 0
|
|
5567
5601
|
};
|
|
5568
5602
|
}
|
|
5569
|
-
function
|
|
5603
|
+
function da(e) {
|
|
5570
5604
|
if (e.length < 5) return null;
|
|
5571
|
-
let t =
|
|
5605
|
+
let t = fa(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;
|
|
5572
5606
|
return t === null || ![
|
|
5573
5607
|
n,
|
|
5574
5608
|
r,
|
|
@@ -5586,15 +5620,15 @@ function fa(e) {
|
|
|
5586
5620
|
function Q(e) {
|
|
5587
5621
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5588
5622
|
}
|
|
5589
|
-
function
|
|
5623
|
+
function fa(e) {
|
|
5590
5624
|
let t = e.trim();
|
|
5591
5625
|
if (!t) return null;
|
|
5592
5626
|
let n = Number(t);
|
|
5593
|
-
if (Number.isFinite(n) && n > 0) return
|
|
5627
|
+
if (Number.isFinite(n) && n > 0) return S(n);
|
|
5594
5628
|
let r = Date.parse(t);
|
|
5595
5629
|
return Number.isFinite(r) ? r : null;
|
|
5596
5630
|
}
|
|
5597
|
-
function
|
|
5631
|
+
function pa(e, t, n) {
|
|
5598
5632
|
e.sort((e, t) => e.time - t.time);
|
|
5599
5633
|
let r = [];
|
|
5600
5634
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5606,7 +5640,7 @@ function ma(e, t, n) {
|
|
|
5606
5640
|
}
|
|
5607
5641
|
//#endregion
|
|
5608
5642
|
//#region src/io/DragDropImporter.ts
|
|
5609
|
-
var
|
|
5643
|
+
var ma = class {
|
|
5610
5644
|
host;
|
|
5611
5645
|
overlay = null;
|
|
5612
5646
|
callbacks;
|
|
@@ -5627,19 +5661,19 @@ var ha = class {
|
|
|
5627
5661
|
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();
|
|
5628
5662
|
}
|
|
5629
5663
|
onDragEnter(e) {
|
|
5630
|
-
|
|
5664
|
+
ha(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5631
5665
|
}
|
|
5632
5666
|
onDragOver(e) {
|
|
5633
|
-
|
|
5667
|
+
ha(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5634
5668
|
}
|
|
5635
5669
|
onDragLeave(e) {
|
|
5636
|
-
|
|
5670
|
+
ha(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5637
5671
|
}
|
|
5638
5672
|
async onDrop(e) {
|
|
5639
5673
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5640
5674
|
let t = e.dataTransfer?.files?.[0];
|
|
5641
5675
|
if (t) try {
|
|
5642
|
-
let e =
|
|
5676
|
+
let e = ia(await t.text());
|
|
5643
5677
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5644
5678
|
this.callbacks.onData(e.data, e, t);
|
|
5645
5679
|
} catch (e) {
|
|
@@ -5670,12 +5704,12 @@ var ha = class {
|
|
|
5670
5704
|
this.overlay?.remove(), this.overlay = null;
|
|
5671
5705
|
}
|
|
5672
5706
|
};
|
|
5673
|
-
function
|
|
5707
|
+
function ha(e) {
|
|
5674
5708
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5675
5709
|
}
|
|
5676
5710
|
//#endregion
|
|
5677
5711
|
//#region src/grid/gridShapes.ts
|
|
5678
|
-
var
|
|
5712
|
+
var ga = {
|
|
5679
5713
|
"1x1": {
|
|
5680
5714
|
cols: 1,
|
|
5681
5715
|
rows: 1
|
|
@@ -5880,11 +5914,11 @@ var _a = {
|
|
|
5880
5914
|
cols: 3,
|
|
5881
5915
|
rows: 3
|
|
5882
5916
|
}
|
|
5883
|
-
},
|
|
5884
|
-
function
|
|
5885
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(
|
|
5917
|
+
}, _a = Object.keys(ga);
|
|
5918
|
+
function va(e) {
|
|
5919
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(ga, e);
|
|
5886
5920
|
}
|
|
5887
|
-
function
|
|
5921
|
+
function ya(e) {
|
|
5888
5922
|
if (e.areas) return e.areas;
|
|
5889
5923
|
let t = [];
|
|
5890
5924
|
for (let n = 0; n < e.rows; n++) for (let r = 0; r < e.cols; r++) t.push([
|
|
@@ -5895,16 +5929,16 @@ function ba(e) {
|
|
|
5895
5929
|
]);
|
|
5896
5930
|
return t;
|
|
5897
5931
|
}
|
|
5898
|
-
function
|
|
5932
|
+
function ba(e) {
|
|
5899
5933
|
return e.areas?.length ?? e.cols * e.rows;
|
|
5900
5934
|
}
|
|
5901
|
-
function
|
|
5935
|
+
function xa([e, t, n, r]) {
|
|
5902
5936
|
return `${t + 1} / ${e + 1} / span ${r} / span ${n}`;
|
|
5903
5937
|
}
|
|
5904
|
-
function
|
|
5905
|
-
e.style.gridArea = t ?
|
|
5938
|
+
function Sa(e, t) {
|
|
5939
|
+
e.style.gridArea = t ? xa(t) : "";
|
|
5906
5940
|
}
|
|
5907
|
-
function
|
|
5941
|
+
function Ca(e) {
|
|
5908
5942
|
if (!e.areas) return null;
|
|
5909
5943
|
let t = e.areas.find(([, , e, t]) => e * t > 1);
|
|
5910
5944
|
if (!t) return null;
|
|
@@ -5913,7 +5947,7 @@ function wa(e) {
|
|
|
5913
5947
|
}
|
|
5914
5948
|
//#endregion
|
|
5915
5949
|
//#region src/state/layoutStorage.ts
|
|
5916
|
-
function
|
|
5950
|
+
function wa(e) {
|
|
5917
5951
|
let t = {
|
|
5918
5952
|
id: e.id,
|
|
5919
5953
|
name: e.name,
|
|
@@ -5921,11 +5955,11 @@ function Ta(e) {
|
|
|
5921
5955
|
};
|
|
5922
5956
|
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;
|
|
5923
5957
|
}
|
|
5924
|
-
var
|
|
5925
|
-
function
|
|
5958
|
+
var Ta = (e, t) => t.updatedAt - e.updatedAt;
|
|
5959
|
+
function Ea(e) {
|
|
5926
5960
|
if (typeof e != "object" || !e) return null;
|
|
5927
5961
|
let t = e;
|
|
5928
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
5962
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : wa({
|
|
5929
5963
|
id: t.id,
|
|
5930
5964
|
name: t.name,
|
|
5931
5965
|
updatedAt: t.updatedAt,
|
|
@@ -5934,17 +5968,17 @@ function Da(e) {
|
|
|
5934
5968
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
5935
5969
|
});
|
|
5936
5970
|
}
|
|
5937
|
-
function
|
|
5938
|
-
let t =
|
|
5971
|
+
function Da(e) {
|
|
5972
|
+
let t = Ea(e), n = t ? e.content : void 0;
|
|
5939
5973
|
return t && typeof n == "string" ? {
|
|
5940
5974
|
...t,
|
|
5941
5975
|
content: n
|
|
5942
5976
|
} : null;
|
|
5943
5977
|
}
|
|
5944
|
-
function
|
|
5978
|
+
function Oa(e = []) {
|
|
5945
5979
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
5946
5980
|
return {
|
|
5947
|
-
list: () => [...t.values()].map(
|
|
5981
|
+
list: () => [...t.values()].map(wa).sort(Ta),
|
|
5948
5982
|
load: (e) => {
|
|
5949
5983
|
let n = t.get(e);
|
|
5950
5984
|
return n ? { ...n } : null;
|
|
@@ -5957,7 +5991,7 @@ function ka(e = []) {
|
|
|
5957
5991
|
}
|
|
5958
5992
|
};
|
|
5959
5993
|
}
|
|
5960
|
-
function
|
|
5994
|
+
function ka(e = "tcw:layouts:") {
|
|
5961
5995
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
5962
5996
|
let e;
|
|
5963
5997
|
try {
|
|
@@ -5965,10 +5999,10 @@ function Aa(e = "tcw:layouts:") {
|
|
|
5965
5999
|
} catch {
|
|
5966
6000
|
return [];
|
|
5967
6001
|
}
|
|
5968
|
-
return Array.isArray(e) ? e.map(
|
|
6002
|
+
return Array.isArray(e) ? e.map(Ea).filter((e) => e !== null) : [];
|
|
5969
6003
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
5970
6004
|
return {
|
|
5971
|
-
list: () => r().sort(
|
|
6005
|
+
list: () => r().sort(Ta),
|
|
5972
6006
|
load: (e) => {
|
|
5973
6007
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
5974
6008
|
return t && i !== null ? {
|
|
@@ -5977,7 +6011,7 @@ function Aa(e = "tcw:layouts:") {
|
|
|
5977
6011
|
} : null;
|
|
5978
6012
|
},
|
|
5979
6013
|
save: (e) => {
|
|
5980
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
6014
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), wa(e)]);
|
|
5981
6015
|
},
|
|
5982
6016
|
remove: (e) => {
|
|
5983
6017
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -5986,14 +6020,14 @@ function Aa(e = "tcw:layouts:") {
|
|
|
5986
6020
|
}
|
|
5987
6021
|
//#endregion
|
|
5988
6022
|
//#region src/state/LayoutSession.ts
|
|
5989
|
-
var
|
|
6023
|
+
var Aa = 80;
|
|
5990
6024
|
function $(e) {
|
|
5991
6025
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
5992
6026
|
}
|
|
5993
|
-
function
|
|
6027
|
+
function ja() {
|
|
5994
6028
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
5995
6029
|
}
|
|
5996
|
-
function
|
|
6030
|
+
function Ma(e) {
|
|
5997
6031
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
5998
6032
|
return {
|
|
5999
6033
|
id: t,
|
|
@@ -6004,7 +6038,7 @@ function Na(e) {
|
|
|
6004
6038
|
...o === void 0 ? {} : { kind: o }
|
|
6005
6039
|
};
|
|
6006
6040
|
}
|
|
6007
|
-
var
|
|
6041
|
+
var Na = class {
|
|
6008
6042
|
currentLayout = null;
|
|
6009
6043
|
savedContent = null;
|
|
6010
6044
|
dirty = !1;
|
|
@@ -6020,7 +6054,7 @@ var Pa = class {
|
|
|
6020
6054
|
now;
|
|
6021
6055
|
newId;
|
|
6022
6056
|
constructor(e, t, n = {}) {
|
|
6023
|
-
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 ??
|
|
6057
|
+
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 ?? ja;
|
|
6024
6058
|
}
|
|
6025
6059
|
current() {
|
|
6026
6060
|
return this.currentLayout;
|
|
@@ -6036,7 +6070,7 @@ var Pa = class {
|
|
|
6036
6070
|
}
|
|
6037
6071
|
async list() {
|
|
6038
6072
|
let e = await this.storage.list();
|
|
6039
|
-
return Array.isArray(e) ? e.map(
|
|
6073
|
+
return Array.isArray(e) ? e.map(Ea).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
6040
6074
|
}
|
|
6041
6075
|
save() {
|
|
6042
6076
|
return this.queue(() => {
|
|
@@ -6050,7 +6084,7 @@ var Pa = class {
|
|
|
6050
6084
|
}
|
|
6051
6085
|
open(e) {
|
|
6052
6086
|
return this.queue(async () => {
|
|
6053
|
-
let t =
|
|
6087
|
+
let t = Da(await this.storage.load(e));
|
|
6054
6088
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
6055
6089
|
this.cancelTimer(), this.applying++;
|
|
6056
6090
|
try {
|
|
@@ -6060,13 +6094,13 @@ var Pa = class {
|
|
|
6060
6094
|
} finally {
|
|
6061
6095
|
this.applying--;
|
|
6062
6096
|
}
|
|
6063
|
-
return this.cancelTimer(), this.currentLayout =
|
|
6097
|
+
return this.cancelTimer(), this.currentLayout = Ma(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
6064
6098
|
});
|
|
6065
6099
|
}
|
|
6066
6100
|
rename(e, t) {
|
|
6067
6101
|
let n = $(t);
|
|
6068
6102
|
return n ? this.queue(async () => {
|
|
6069
|
-
let t =
|
|
6103
|
+
let t = Da(await this.storage.load(e));
|
|
6070
6104
|
!t || t.id !== e || (await this.storage.save({
|
|
6071
6105
|
...t,
|
|
6072
6106
|
name: n
|
|
@@ -6144,7 +6178,7 @@ var Pa = class {
|
|
|
6144
6178
|
content: n.content
|
|
6145
6179
|
};
|
|
6146
6180
|
await this.storage.save(r);
|
|
6147
|
-
let i =
|
|
6181
|
+
let i = Ma(r);
|
|
6148
6182
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
6149
6183
|
}
|
|
6150
6184
|
forget() {
|
|
@@ -6165,6 +6199,6 @@ var Pa = class {
|
|
|
6165
6199
|
}
|
|
6166
6200
|
};
|
|
6167
6201
|
//#endregion
|
|
6168
|
-
export {
|
|
6202
|
+
export { pr as A, Lr as C, wr as D, G as E, L as M, z as N, vr as O, Ir as S, Fr as T, oi as _, Oa as a, zr as b, ya as c, va as d, Sa as f, yi as g, Oi as h, ka as i, B as j, hr as k, ba as l, ia as m, Aa as n, _a as o, ma as p, $ as r, ga as s, Na as t, Ca as u, si as v, Pr as w, Rr as x, Br as y };
|
|
6169
6203
|
|
|
6170
|
-
//# sourceMappingURL=LayoutSession-
|
|
6204
|
+
//# sourceMappingURL=LayoutSession-D1AIWXuH.js.map
|