@tradecanvas/chart 1.81.0 → 1.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chart.d.ts +14 -1
- package/dist/Chart.d.ts.map +1 -1
- package/dist/{LayoutSession-C4Lp1X6t.js → LayoutSession-CLlUszTA.js} +388 -370
- package/dist/LayoutSession-CLlUszTA.js.map +1 -0
- package/dist/LayoutSession-Cs8SJ1LU.cjs +2 -0
- package/dist/LayoutSession-Cs8SJ1LU.cjs.map +1 -0
- package/dist/{WidgetCommandPalette-B1jaXJ-I.cjs → WidgetCommandPalette-BNBL1mO2.cjs} +2 -2
- package/dist/{WidgetCommandPalette-B1jaXJ-I.cjs.map → WidgetCommandPalette-BNBL1mO2.cjs.map} +1 -1
- package/dist/{WidgetCommandPalette-Bvr6Od3p.js → WidgetCommandPalette-p4DQCe57.js} +2 -2
- package/dist/{WidgetCommandPalette-Bvr6Od3p.js.map → WidgetCommandPalette-p4DQCe57.js.map} +1 -1
- package/dist/{WidgetDrawingSettings-B8JKpke1.cjs → WidgetDrawingSettings-BqGuAMz3.cjs} +2 -2
- package/dist/{WidgetDrawingSettings-B8JKpke1.cjs.map → WidgetDrawingSettings-BqGuAMz3.cjs.map} +1 -1
- package/dist/{WidgetDrawingSettings-CsR3GuFG.js → WidgetDrawingSettings-D7l2NkVj.js} +2 -2
- package/dist/{WidgetDrawingSettings-CsR3GuFG.js.map → WidgetDrawingSettings-D7l2NkVj.js.map} +1 -1
- package/dist/{WidgetIndicatorPicker-B72LdJy1.cjs → WidgetIndicatorPicker-BOxIKUn-.cjs} +2 -2
- package/dist/{WidgetIndicatorPicker-B72LdJy1.cjs.map → WidgetIndicatorPicker-BOxIKUn-.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-Cb2m62oH.js → WidgetIndicatorPicker-Bk0y6c35.js} +2 -2
- package/dist/{WidgetIndicatorPicker-Cb2m62oH.js.map → WidgetIndicatorPicker-Bk0y6c35.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-BiX1ZOhS.js → WidgetIndicatorSettings-BmOqq2Fv.js} +3 -3
- package/dist/{WidgetIndicatorSettings-BiX1ZOhS.js.map → WidgetIndicatorSettings-BmOqq2Fv.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-DhFQasHT.cjs → WidgetIndicatorSettings-DrPcNSxS.cjs} +2 -2
- package/dist/{WidgetIndicatorSettings-DhFQasHT.cjs.map → WidgetIndicatorSettings-DrPcNSxS.cjs.map} +1 -1
- package/dist/{WidgetSettings-bO72SYQ6.cjs → WidgetSettings-B57_tUke.cjs} +2 -2
- package/dist/WidgetSettings-B57_tUke.cjs.map +1 -0
- package/dist/{WidgetSettings-CkvK-3d9.js → WidgetSettings-C6m55YF0.js} +17 -4
- package/dist/WidgetSettings-C6m55YF0.js.map +1 -0
- package/dist/{WidgetSymbolSearch-DeBxGj4a.cjs → WidgetSymbolSearch-8HMKUv2P.cjs} +2 -2
- package/dist/{WidgetSymbolSearch-DeBxGj4a.cjs.map → WidgetSymbolSearch-8HMKUv2P.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-WOskcBJN.js → WidgetSymbolSearch-BdI1egoq.js} +2 -2
- package/dist/{WidgetSymbolSearch-WOskcBJN.js.map → WidgetSymbolSearch-BdI1egoq.js.map} +1 -1
- package/dist/{i18n-Ci4pfuXw.js → i18n-BMzvClhl.js} +11 -1
- package/dist/i18n-BMzvClhl.js.map +1 -0
- package/dist/i18n-Dq-eMISy.cjs +2 -0
- package/dist/i18n-Dq-eMISy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{indicatorInputWords-BfWHWL0K.cjs → indicatorInputWords-DGObUFDn.cjs} +2 -2
- package/dist/{indicatorInputWords-BfWHWL0K.cjs.map → indicatorInputWords-DGObUFDn.cjs.map} +1 -1
- package/dist/{indicatorInputWords-DpkxBon4.js → indicatorInputWords-Dn_gEPug.js} +2 -2
- package/dist/{indicatorInputWords-DpkxBon4.js.map → indicatorInputWords-Dn_gEPug.js.map} +1 -1
- package/dist/widget/ChartWidget.d.ts +9 -1
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetChartSettings.d.ts +2 -0
- package/dist/widget/WidgetChartSettings.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingSidebar.d.ts +27 -0
- package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
- package/dist/widget/WidgetSettings.d.ts.map +1 -1
- package/dist/widget/chartSettingsStore.d.ts.map +1 -1
- package/dist/widget/index.cjs +12 -4
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +1157 -1034
- 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 +5 -0
- 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 +141 -1
- 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/types.d.ts +4 -0
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetConfig.d.ts.map +1 -1
- package/dist/{widgetLocales-D-QYU_9U.js → widgetLocales-BX7VRdl5.js} +2 -1
- package/dist/widgetLocales-BX7VRdl5.js.map +1 -0
- package/dist/widgetLocales-C_XTkni5.cjs +2 -0
- package/dist/widgetLocales-C_XTkni5.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/LayoutSession-C4Lp1X6t.js.map +0 -1
- package/dist/LayoutSession-CeayqT91.cjs +0 -2
- package/dist/LayoutSession-CeayqT91.cjs.map +0 -1
- package/dist/WidgetSettings-CkvK-3d9.js.map +0 -1
- package/dist/WidgetSettings-bO72SYQ6.cjs.map +0 -1
- package/dist/i18n-Ci4pfuXw.js.map +0 -1
- package/dist/i18n-hMXCt55K.cjs +0 -2
- package/dist/i18n-hMXCt55K.cjs.map +0 -1
- package/dist/widgetLocales-D-QYU_9U.js.map +0 -1
- package/dist/widgetLocales-fhdzLs5l.cjs +0 -2
- package/dist/widgetLocales-fhdzLs5l.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./indicatorLabel-BsidWCv1.js";
|
|
2
2
|
import { DARK_THEME as t, DEFAULT_PANEL_HEIGHT as n, LIGHT_THEME as r, LayerType as i, MIN_PANEL_HEIGHT as a, PHI as o, PRICE_AXIS_WIDTH as s, TIME_AXIS_HEIGHT as c, autoPricePrecision as l, barDateZone as u, barTimeUnit as d, barsAreDaily as f, chartStyleValue as p, computePriceLimits as m, computePriceRange as h, createMarketTheme as g, formatPrice as _, fractionTick as v, indicatorSource as y, isValidTimeZone as b, mergeBar as ee, niceNumber as te, normalizeBarTime as x, parseIndicatorSource as S, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as ae, readIndicatorPlotStyles as oe, readPaneStyle as se, resolveChartTheme as ce, sessionMinute as C, setLocale as le, stepDecimals as ue, symbolTimeZone as w, tickBarCount as de, timeframeToMs as T, 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 E, 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 D, 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, IndicatorEngine as Ve, InteractionManager as He, KagiRenderer as Ue, KeyboardHandler as We, LineRenderer as Ge, LineWithMarkersRenderer as Ke, MarketProfileRenderer as qe, MeasureOverlay as Je, PRICE_AXIS_ADD_STRIP as Ye, PRICE_SCALE_MARGIN as O, PanHandler as Xe, PaneResizeHandler as Ze, PeriodLevelsRenderer as Qe, PinnedTooltip as $e, PivotMarkersRenderer as et, PointAndFigureRenderer as tt, PriceAxis as nt, PriceAxisAddButton as rt, PriceLines as it, RenderEngine as at, RenkoRenderer as ot, ReplayManager as st, ResamplingAdapter as ct, ReshapeMemo as lt, SYMBOL_INDICATOR_IDS as ut, SYMBOL_ZONE_WAIT_MS as dt, Screenshot as k, SelectionBoxOverlay as ft, SessionBreaks as pt, SessionShading as mt, SignalMarkerManager as ht, SpreadIndicator as gt, StepLineRenderer as _t, StreamManager as vt, SymbolSeriesStore as yt, TimeAxis as bt, TradeZoneManager as xt, TradingManager as St, TradingRenderer as Ct, UndoRedoManager as wt, Viewport as Tt, VolumeCandleRenderer as Et, VolumeProfileRenderer as Dt, VolumeRenderer as Ot, Watermark as kt, ZoomHandler as At, axisTimes as A, barTimeStepMs as jt, findDominantSwing as Mt, gpuContextsLeft as Nt,
|
|
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 E, 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 D, 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, IndicatorEngine as Ve, InteractionManager as He, KagiRenderer as Ue, KeyboardHandler as We, LineRenderer as Ge, LineWithMarkersRenderer as Ke, MarketProfileRenderer as qe, MeasureOverlay as Je, PRICE_AXIS_ADD_STRIP as Ye, PRICE_SCALE_MARGIN as O, PanHandler as Xe, PaneResizeHandler as Ze, PeriodLevelsRenderer as Qe, PinnedTooltip as $e, PivotMarkersRenderer as et, PointAndFigureRenderer as tt, PriceAxis as nt, PriceAxisAddButton as rt, PriceLines as it, RenderEngine as at, RenkoRenderer as ot, ReplayManager as st, ResamplingAdapter as ct, ReshapeMemo as lt, SYMBOL_INDICATOR_IDS as ut, SYMBOL_ZONE_WAIT_MS as dt, Screenshot as k, SelectionBoxOverlay as ft, SessionBreaks as pt, SessionShading as mt, SignalMarkerManager as ht, SpreadIndicator as gt, StepLineRenderer as _t, StreamManager as vt, SymbolSeriesStore as yt, TimeAxis as bt, TradeZoneManager as xt, TradingManager as St, TradingRenderer as Ct, UndoRedoManager as wt, Viewport as Tt, VolumeCandleRenderer as Et, VolumeProfileRenderer as Dt, VolumeRenderer as Ot, Watermark as kt, ZoomHandler as At, axisTimes as A, barTimeStepMs as jt, findDominantSwing as Mt, gpuContextsLeft as Nt, idleCssCursor as Pt, isCrosshairCursor as Ft, isPriceLevelAlert as It, isRegularSession as Lt, loadWebGL as Rt, mergeSessionHours as zt, pointAndFigureColumns as Bt, rangePresetStart as Vt, readAlertOptions as Ht, registerBuiltInDrawingTools as Ut, registerBuiltInIndicators as Wt, servesTimeframe as j, sourceParam as M, streamAdapterOf as Gt, timestampToBarIndex as N, toHeikinAshi as Kt, toKagi as qt, toLineBreak as Jt, toRangeBars as Yt, toRenko as Xt, whenGpuContextFree as Zt, withResampling as P, xToBarIndex as Qt, xToTime as F, yToPrice as $t } from "@tradecanvas/core";
|
|
4
4
|
//#region src/regularHours.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var en = 864e5, tn = 10;
|
|
6
|
+
function nn(e, t) {
|
|
7
7
|
let n = w(e);
|
|
8
8
|
if (!n || !b(n) || t.length < 2) return null;
|
|
9
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
@@ -15,34 +15,34 @@ function en(e, t) {
|
|
|
15
15
|
});
|
|
16
16
|
if (r.length === 0) return null;
|
|
17
17
|
let i = d(t), a = Infinity;
|
|
18
|
-
for (let e = Math.max(1, t.length -
|
|
18
|
+
for (let e = Math.max(1, t.length - tn); 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 < en)) return null;
|
|
23
23
|
let o = {
|
|
24
24
|
timeZone: n,
|
|
25
25
|
windows: r,
|
|
26
26
|
startMinute: r[0].startMinute,
|
|
27
27
|
endMinute: r[r.length - 1].endMinute
|
|
28
28
|
};
|
|
29
|
-
return (e) =>
|
|
29
|
+
return (e) => Lt(e * i, o);
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/chartA11y.ts
|
|
33
|
-
var
|
|
33
|
+
var rn = {
|
|
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
|
-
}, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e),
|
|
40
|
+
}, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), an = [
|
|
41
41
|
"role",
|
|
42
42
|
"aria-roledescription",
|
|
43
43
|
"aria-label",
|
|
44
44
|
"aria-describedby"
|
|
45
|
-
],
|
|
45
|
+
], on = 400, sn = 1e3, cn = class {
|
|
46
46
|
live;
|
|
47
47
|
help;
|
|
48
48
|
labels;
|
|
@@ -56,20 +56,20 @@ var tn = {
|
|
|
56
56
|
};
|
|
57
57
|
constructor(e, t, n = {}) {
|
|
58
58
|
this.container = e, this.source = t, this.labels = {
|
|
59
|
-
...
|
|
59
|
+
...rn,
|
|
60
60
|
...n
|
|
61
61
|
};
|
|
62
|
-
for (let t of
|
|
63
|
-
e.setAttribute("role", "application"), this.help =
|
|
62
|
+
for (let t of an) this.before.set(t, e.getAttribute(t));
|
|
63
|
+
e.setAttribute("role", "application"), this.help = ln("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 = ln("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
|
+
...rn,
|
|
68
68
|
...e
|
|
69
69
|
}, this.applyLabels();
|
|
70
70
|
}
|
|
71
71
|
refresh(e = !1) {
|
|
72
|
-
let t =
|
|
72
|
+
let t = sn - (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 tn = {
|
|
|
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
|
+
}, on);
|
|
85
85
|
}
|
|
86
86
|
readBar(e) {
|
|
87
87
|
let t = this.source.bars();
|
|
@@ -100,7 +100,7 @@ var tn = {
|
|
|
100
100
|
high: a(i.high),
|
|
101
101
|
low: a(i.low),
|
|
102
102
|
close: a(i.close),
|
|
103
|
-
volume:
|
|
103
|
+
volume: un(i.volume ?? 0)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
destroy() {
|
|
@@ -141,7 +141,7 @@ var tn = {
|
|
|
141
141
|
this.live.textContent = e;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
function
|
|
144
|
+
function ln(e, t) {
|
|
145
145
|
let n = document.createElement(e);
|
|
146
146
|
return n.className = t, Object.assign(n.style, {
|
|
147
147
|
position: "absolute",
|
|
@@ -155,12 +155,12 @@ function sn(e, t) {
|
|
|
155
155
|
border: "0"
|
|
156
156
|
}), n;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function un(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 dn(e) {
|
|
164
164
|
switch (e) {
|
|
165
165
|
case "candlestick":
|
|
166
166
|
case "heikinAshi":
|
|
@@ -183,29 +183,29 @@ function ln(e) {
|
|
|
183
183
|
default: return new xe();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function fn(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 Kt(t);
|
|
190
190
|
case "renko": {
|
|
191
191
|
let e = n.renko?.boxSize;
|
|
192
|
-
return typeof e == "number" ?
|
|
192
|
+
return typeof e == "number" ? Xt(t, { brickSize: e }, i) : Xt(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 Jt(t, n.lineBreak?.lines ?? 3);
|
|
199
|
+
case "kagi": return qt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
200
|
+
case "pointAndFigure": return mn(t, n, i).columns;
|
|
201
|
+
case "rangeBars": return Yt(t, {
|
|
202
|
+
rangeSize: Cn(t, n, r),
|
|
203
203
|
includeForming: !0
|
|
204
204
|
}, i);
|
|
205
205
|
default: return t;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function pn(e) {
|
|
209
209
|
switch (e) {
|
|
210
210
|
case "heikinAshi":
|
|
211
211
|
case "renko":
|
|
@@ -217,71 +217,71 @@ function dn(e) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function L(e) {
|
|
220
|
-
return e !== "heikinAshi" &&
|
|
220
|
+
return e !== "heikinAshi" && pn(e);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
222
|
+
function mn(e, t = {}, n) {
|
|
223
|
+
return Bt(e, _n(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
225
|
+
var hn = 50, gn = .01;
|
|
226
|
+
function _n(e, t = {}) {
|
|
227
227
|
let n = t.pointAndFigure?.boxSize;
|
|
228
228
|
if (typeof n == "number") return n;
|
|
229
|
-
let r =
|
|
230
|
-
return r > 0 ? R(te(r /
|
|
229
|
+
let r = vn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
230
|
+
return r > 0 ? R(te(r / hn, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * gn || 1;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function vn(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 yn = 100, bn = 3, xn = .01, Sn = 15, R = (e) => Number(e.toPrecision(Sn));
|
|
239
|
+
function Cn(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 >= bn ? Tn(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
243
|
+
return On(R(te(i > 0 ? i : a * xn || 1, !0)), n);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function wn(e) {
|
|
246
246
|
let t = e.length - 1;
|
|
247
247
|
return {
|
|
248
|
-
from: Math.max(0, t -
|
|
248
|
+
from: Math.max(0, t - yn),
|
|
249
249
|
end: t
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
let { from: t, end: n } =
|
|
252
|
+
function Tn(e) {
|
|
253
|
+
let { from: t, end: n } = wn(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 En(e, t) {
|
|
261
|
+
let { from: n, end: r } = wn(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 Dn(t(i), t(a));
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function Dn(e, t) {
|
|
268
268
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function On(e, t) {
|
|
271
271
|
return t === void 0 || !(t > 0) ? e : R(Math.max(1, Math.round(e / t)) * t);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function kn(e, t) {
|
|
274
274
|
let n = t?.(e);
|
|
275
|
-
return n ? n.createRenderer() :
|
|
275
|
+
return n ? n.createRenderer() : dn(e);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function An(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) : fn(e, t, r, i, a);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/state/AutoSaveScheduler.ts
|
|
284
|
-
var
|
|
284
|
+
var jn = class {
|
|
285
285
|
timer = null;
|
|
286
286
|
delayMs = 0;
|
|
287
287
|
key = null;
|
|
@@ -316,7 +316,7 @@ function z(e) {
|
|
|
316
316
|
let { open: t, high: n, low: r, close: i } = e;
|
|
317
317
|
return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Mn(e) {
|
|
320
320
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
321
321
|
}
|
|
322
322
|
function B(e) {
|
|
@@ -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 Nn(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 Pn(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 Fn = {
|
|
341
341
|
index: -1,
|
|
342
342
|
changed: !1
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function In(e, t) {
|
|
345
345
|
if (e.length === 0) return t;
|
|
346
346
|
let n = x(t);
|
|
347
347
|
return d(e) === 1 ? n : n / 1e3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
let n =
|
|
349
|
+
function Ln(e, t) {
|
|
350
|
+
let n = In(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 Rn = class {
|
|
357
357
|
data = [];
|
|
358
358
|
changes = 0;
|
|
359
359
|
withSeriesTime(e) {
|
|
360
|
-
return
|
|
360
|
+
return Ln(this.data, e);
|
|
361
361
|
}
|
|
362
362
|
getData() {
|
|
363
363
|
return this.data;
|
|
@@ -369,7 +369,7 @@ var In = class {
|
|
|
369
369
|
let t = [];
|
|
370
370
|
for (let n = 0; n < e.length; n++) {
|
|
371
371
|
let r = e[n];
|
|
372
|
-
z(r) && t.push(
|
|
372
|
+
z(r) && t.push(Mn(r) ? r : B(r));
|
|
373
373
|
}
|
|
374
374
|
this.data = t, this.changes++;
|
|
375
375
|
}
|
|
@@ -378,7 +378,7 @@ var In = class {
|
|
|
378
378
|
for (let r = 0; r < e.length; r++) {
|
|
379
379
|
if (!z(e[r])) continue;
|
|
380
380
|
let i = this.withSeriesTime(e[r]);
|
|
381
|
-
i.time >= t || n.push(
|
|
381
|
+
i.time >= t || n.push(Mn(i) ? i : B(i));
|
|
382
382
|
}
|
|
383
383
|
if (n.length === 0) return 0;
|
|
384
384
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -399,11 +399,11 @@ var In = class {
|
|
|
399
399
|
this.data[this.data.length - 1] = t;
|
|
400
400
|
}
|
|
401
401
|
replaceBar(e) {
|
|
402
|
-
if (!z(e)) return
|
|
403
|
-
let t = this.withSeriesTime(e), n =
|
|
404
|
-
if (n < 0) return
|
|
402
|
+
if (!z(e)) return Fn;
|
|
403
|
+
let t = this.withSeriesTime(e), n = Pn(this.data, t.time);
|
|
404
|
+
if (n < 0) return Fn;
|
|
405
405
|
let r = B(t);
|
|
406
|
-
return
|
|
406
|
+
return Nn(this.data[n], r) ? {
|
|
407
407
|
index: n,
|
|
408
408
|
changed: !1
|
|
409
409
|
} : (this.data[n] = r, this.changes++, {
|
|
@@ -431,7 +431,7 @@ function H(e, t) {
|
|
|
431
431
|
let r = x(t.time), i = x(n.time);
|
|
432
432
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function zn(e) {
|
|
435
435
|
return [
|
|
436
436
|
e.time,
|
|
437
437
|
e.open,
|
|
@@ -440,8 +440,8 @@ function Ln(e) {
|
|
|
440
440
|
e.close
|
|
441
441
|
].every(Number.isFinite);
|
|
442
442
|
}
|
|
443
|
-
var
|
|
444
|
-
shown = new
|
|
443
|
+
var Bn = class {
|
|
444
|
+
shown = new Rn();
|
|
445
445
|
whole = null;
|
|
446
446
|
aside = null;
|
|
447
447
|
shownRevision = 0;
|
|
@@ -483,7 +483,7 @@ var Rn = 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(zn).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 Rn = 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(Vn(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = Vn(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 Rn = 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(In(this.whole, e.time))) return this.wrote("hidden", !1);
|
|
557
557
|
let n = this.shown.getLength();
|
|
558
558
|
this.shown.updateLastBarFromTick(e);
|
|
559
559
|
let r = this.whole, i = this.shown.getData()[this.shown.getLength() - 1];
|
|
@@ -596,7 +596,7 @@ var Rn = class {
|
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
if (!z(e)) return V;
|
|
599
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Pn(n, t.time) : -1;
|
|
600
600
|
if (n) {
|
|
601
601
|
if (r < 0 || !z(n[r])) return V;
|
|
602
602
|
let e = this.hoursFilter(n);
|
|
@@ -610,7 +610,7 @@ var Rn = class {
|
|
|
610
610
|
});
|
|
611
611
|
}
|
|
612
612
|
beginReplay() {
|
|
613
|
-
this.aside || (this.aside = new
|
|
613
|
+
this.aside || (this.aside = new Rn(), this.aside.setData(this.whole ?? this.shown.getData()));
|
|
614
614
|
}
|
|
615
615
|
endReplay() {
|
|
616
616
|
let e = this.aside;
|
|
@@ -630,10 +630,10 @@ var Rn = class {
|
|
|
630
630
|
this.shown.updateLastBar(e);
|
|
631
631
|
}
|
|
632
632
|
inSeriesUnit(e) {
|
|
633
|
-
return
|
|
633
|
+
return Ln(this.whole ?? this.shown.getData(), e);
|
|
634
634
|
}
|
|
635
635
|
replaceHidden(e, t, n) {
|
|
636
|
-
let r = B(n), i = !
|
|
636
|
+
let r = B(n), i = !Nn(e[t], r);
|
|
637
637
|
return i && (e[t] = r), {
|
|
638
638
|
to: "hidden",
|
|
639
639
|
index: -1,
|
|
@@ -667,14 +667,14 @@ var Rn = class {
|
|
|
667
667
|
return !r || r(e.time);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
function
|
|
670
|
+
function Vn(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 Hn = o ** -7, Un = class {
|
|
678
678
|
auto;
|
|
679
679
|
preferred;
|
|
680
680
|
pending = !0;
|
|
@@ -707,7 +707,7 @@ var Bn = o ** -7, Vn = class {
|
|
|
707
707
|
}
|
|
708
708
|
fit(e, t, n, r) {
|
|
709
709
|
if (t.length === 0) return;
|
|
710
|
-
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o =
|
|
710
|
+
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o = Gn(Gn(h(t, i, a, 0), r.overlayRange(i, a)), r.compareRange(t, n)), s = r.volumeRatio(t, i, a), c = s === null ? O : s + Hn;
|
|
711
711
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
712
712
|
top: c,
|
|
713
713
|
bottom: O
|
|
@@ -717,11 +717,11 @@ var Bn = o ** -7, Vn = class {
|
|
|
717
717
|
}), e.fitToPrices(o.min, o.max);
|
|
718
718
|
}
|
|
719
719
|
};
|
|
720
|
-
function
|
|
720
|
+
function Wn(e, t, n) {
|
|
721
721
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
722
722
|
return !1;
|
|
723
723
|
}
|
|
724
|
-
function
|
|
724
|
+
function Gn(e, t) {
|
|
725
725
|
return e ? t ? {
|
|
726
726
|
min: Math.min(e.min, t.min),
|
|
727
727
|
max: Math.max(e.max, t.max)
|
|
@@ -729,7 +729,7 @@ function Un(e, t) {
|
|
|
729
729
|
}
|
|
730
730
|
//#endregion
|
|
731
731
|
//#region src/model/DisplaySeries.ts
|
|
732
|
-
var
|
|
732
|
+
var Kn = class {
|
|
733
733
|
series = null;
|
|
734
734
|
madeAt = null;
|
|
735
735
|
epoch = 0;
|
|
@@ -740,7 +740,7 @@ var Wn = class {
|
|
|
740
740
|
get() {
|
|
741
741
|
let e = this.sources.bars();
|
|
742
742
|
if (e.length === 0) return e;
|
|
743
|
-
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ?
|
|
743
|
+
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ? En(e, (e) => this.sources.stepAt(e)) : void 0, i = this.sources.version(), a = this.madeAt;
|
|
744
744
|
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
745
|
version: i,
|
|
746
746
|
type: t,
|
|
@@ -757,14 +757,14 @@ var Wn = class {
|
|
|
757
757
|
}
|
|
758
758
|
make(e, t, n, r) {
|
|
759
759
|
let { lookup: i } = this.sources;
|
|
760
|
-
if (e !== "pointAndFigure" || i(e)) return
|
|
761
|
-
let { columns: a, boxSize: o } =
|
|
760
|
+
if (e !== "pointAndFigure" || i(e)) return An(e, t, i, n, r, this.memo);
|
|
761
|
+
let { columns: a, boxSize: o } = mn(t, n, this.memo);
|
|
762
762
|
return this.sources.onBoxSize(o), a;
|
|
763
763
|
}
|
|
764
|
-
},
|
|
764
|
+
}, qn = {
|
|
765
765
|
min: 0,
|
|
766
766
|
max: 100
|
|
767
|
-
},
|
|
767
|
+
}, Jn = class {
|
|
768
768
|
layout = null;
|
|
769
769
|
infos = null;
|
|
770
770
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -772,7 +772,7 @@ var Wn = class {
|
|
|
772
772
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
773
773
|
}
|
|
774
774
|
resolved() {
|
|
775
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
775
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(Yn(this.layout))), this.layout;
|
|
776
776
|
}
|
|
777
777
|
invalidate() {
|
|
778
778
|
this.layout = null, this.infos = null;
|
|
@@ -784,7 +784,7 @@ var Wn = class {
|
|
|
784
784
|
if (this.infos) return this.infos;
|
|
785
785
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
786
786
|
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) ?? { ...
|
|
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) ?? { ...qn }, s = this.styles.get(i);
|
|
788
788
|
return {
|
|
789
789
|
instanceId: i,
|
|
790
790
|
members: this.sources.getPaneMembers(i),
|
|
@@ -844,7 +844,7 @@ var Wn = class {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
};
|
|
847
|
-
function
|
|
847
|
+
function Yn(e) {
|
|
848
848
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
849
849
|
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
850
|
return {
|
|
@@ -852,10 +852,10 @@ function qn(e) {
|
|
|
852
852
|
bottom: r
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function Xn(e) {
|
|
856
856
|
return e.length > 0 ? { renames: e } : {};
|
|
857
857
|
}
|
|
858
|
-
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t),
|
|
858
|
+
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Zn = class {
|
|
859
859
|
steps;
|
|
860
860
|
snapshot;
|
|
861
861
|
enabled;
|
|
@@ -891,7 +891,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
891
891
|
...o,
|
|
892
892
|
after: n,
|
|
893
893
|
at: i,
|
|
894
|
-
...
|
|
894
|
+
...Xn([...o.renames ?? [], ...r])
|
|
895
895
|
}
|
|
896
896
|
}) : this.steps.push({
|
|
897
897
|
...c,
|
|
@@ -900,7 +900,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
900
900
|
after: n,
|
|
901
901
|
subject: e,
|
|
902
902
|
at: i,
|
|
903
|
-
...
|
|
903
|
+
...Xn(r)
|
|
904
904
|
}
|
|
905
905
|
});
|
|
906
906
|
}
|
|
@@ -938,7 +938,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
938
938
|
}
|
|
939
939
|
});
|
|
940
940
|
}
|
|
941
|
-
},
|
|
941
|
+
}, Qn = class {
|
|
942
942
|
constructor(e, t, n) {
|
|
943
943
|
this.members = e, this.slots = t, this.handover = n;
|
|
944
944
|
}
|
|
@@ -1017,7 +1017,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Yn = class {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
//#endregion
|
|
1019
1019
|
//#region src/model/IndicatorSetup.ts
|
|
1020
|
-
function
|
|
1020
|
+
function $n(e, t, n) {
|
|
1021
1021
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1022
1022
|
return e.getActiveIndicators().map((t) => {
|
|
1023
1023
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1045,7 +1045,7 @@ function Zn(e, t, n) {
|
|
|
1045
1045
|
};
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1048
|
+
function er(e, t) {
|
|
1049
1049
|
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
1050
|
log: !!n.paneLog,
|
|
1051
1051
|
invert: !!n.paneInvert,
|
|
@@ -1056,7 +1056,7 @@ function Qn(e, t) {
|
|
|
1056
1056
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1057
1057
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function tr(e) {
|
|
1060
1060
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1061
1061
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1062
1062
|
i.add(e.instanceId);
|
|
@@ -1070,23 +1070,23 @@ function $n(e) {
|
|
|
1070
1070
|
for (let t of e) a(t);
|
|
1071
1071
|
return n;
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function nr(e, t) {
|
|
1074
1074
|
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
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function rr(e, t) {
|
|
1077
1077
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1078
1078
|
for (let t of e) {
|
|
1079
1079
|
let e = n.get(t.instanceId);
|
|
1080
|
-
e &&
|
|
1080
|
+
e && nr(t, e) && ir(t, e) && r.add(t.instanceId);
|
|
1081
1081
|
}
|
|
1082
1082
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1083
1083
|
return r;
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function ir(e, t) {
|
|
1086
1086
|
let n = Object.keys(e.params);
|
|
1087
1087
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function ar(e, t) {
|
|
1090
1090
|
let n = { ...e };
|
|
1091
1091
|
for (let [e, r] of Object.entries(n)) {
|
|
1092
1092
|
let i = S(r), a = i && t.get(i.instanceId);
|
|
@@ -1096,11 +1096,11 @@ function rr(e, t) {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region src/model/SymbolRequests.ts
|
|
1099
|
-
function
|
|
1099
|
+
function or(e, t) {
|
|
1100
1100
|
let n = t.symbol;
|
|
1101
1101
|
return ut.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1102
1102
|
}
|
|
1103
|
-
var
|
|
1103
|
+
var sr = class {
|
|
1104
1104
|
asked = /* @__PURE__ */ new Set();
|
|
1105
1105
|
constructor(e, t) {
|
|
1106
1106
|
this.readers = e, this.held = t;
|
|
@@ -1108,7 +1108,7 @@ var ar = class {
|
|
|
1108
1108
|
required() {
|
|
1109
1109
|
let e = /* @__PURE__ */ new Set();
|
|
1110
1110
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1111
|
-
let n =
|
|
1111
|
+
let n = or(t.id, t.params);
|
|
1112
1112
|
n && e.add(n);
|
|
1113
1113
|
}
|
|
1114
1114
|
return [...e];
|
|
@@ -1126,20 +1126,20 @@ var ar = class {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
toAsk(e) {
|
|
1128
1128
|
this.forgetUnread();
|
|
1129
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1129
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? or(t.id, t.params) : "";
|
|
1130
1130
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1131
1131
|
}
|
|
1132
|
-
},
|
|
1133
|
-
function
|
|
1134
|
-
if (!
|
|
1132
|
+
}, cr = (e, t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1133
|
+
function lr(e, t, n, r) {
|
|
1134
|
+
if (!cr(e, t)) {
|
|
1135
1135
|
for (let t of n) {
|
|
1136
1136
|
let n = r(t.id);
|
|
1137
|
-
if (n &&
|
|
1137
|
+
if (n && cr(e, n.chartRect)) return t.id;
|
|
1138
1138
|
}
|
|
1139
1139
|
return null;
|
|
1140
1140
|
}
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function ur(e, t, n, r) {
|
|
1143
1143
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1144
1144
|
let i = n();
|
|
1145
1145
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1147,12 +1147,12 @@ function cr(e, t, n, r) {
|
|
|
1147
1147
|
data: r()
|
|
1148
1148
|
};
|
|
1149
1149
|
}
|
|
1150
|
-
function
|
|
1150
|
+
function dr(e, t, n) {
|
|
1151
1151
|
return !n && e.some((e) => e.id === t);
|
|
1152
1152
|
}
|
|
1153
1153
|
//#endregion
|
|
1154
1154
|
//#region src/HistoryPager.ts
|
|
1155
|
-
var
|
|
1155
|
+
var fr = 5e3, pr = 6e4, mr = 500, hr = class {
|
|
1156
1156
|
loader = null;
|
|
1157
1157
|
pageSize = 500;
|
|
1158
1158
|
loading = !1;
|
|
@@ -1207,7 +1207,7 @@ var ur = 5e3, dr = 6e4, fr = 500, pr = class {
|
|
|
1207
1207
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1208
1208
|
state: "loaded",
|
|
1209
1209
|
count: 0
|
|
1210
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1210
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(pr, fr * 2 ** (this.failures - 1)), this.emit({
|
|
1211
1211
|
state: "error",
|
|
1212
1212
|
count: 0,
|
|
1213
1213
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1240,10 +1240,10 @@ var ur = 5e3, dr = 6e4, fr = 500, pr = class {
|
|
|
1240
1240
|
};
|
|
1241
1241
|
//#endregion
|
|
1242
1242
|
//#region src/ThemeManager.ts
|
|
1243
|
-
function
|
|
1243
|
+
function gr(e, t) {
|
|
1244
1244
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1245
1245
|
}
|
|
1246
|
-
var
|
|
1246
|
+
var _r = class e {
|
|
1247
1247
|
base;
|
|
1248
1248
|
shape = null;
|
|
1249
1249
|
font = null;
|
|
@@ -1268,7 +1268,7 @@ var hr = class e {
|
|
|
1268
1268
|
return this.base;
|
|
1269
1269
|
}
|
|
1270
1270
|
setTheme(t) {
|
|
1271
|
-
let n = e.read(t), r = this.font !== null &&
|
|
1271
|
+
let n = e.read(t), r = this.font !== null && gr(n.font, this.base.font);
|
|
1272
1272
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1273
1273
|
...this.base,
|
|
1274
1274
|
shape: {
|
|
@@ -1350,7 +1350,7 @@ var hr = class e {
|
|
|
1350
1350
|
};
|
|
1351
1351
|
//#endregion
|
|
1352
1352
|
//#region src/style/styleOptions.ts
|
|
1353
|
-
function
|
|
1353
|
+
function vr(e, t) {
|
|
1354
1354
|
return t ? {
|
|
1355
1355
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1356
1356
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1358,22 +1358,22 @@ function gr(e, t) {
|
|
|
1358
1358
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1359
1359
|
} : {};
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function yr(e) {
|
|
1362
1362
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1363
1363
|
return {
|
|
1364
1364
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1365
1365
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1366
1366
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1367
1367
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1368
|
-
...
|
|
1369
|
-
...
|
|
1368
|
+
...vr("horizontal", n?.hLine),
|
|
1369
|
+
...vr("vertical", n?.vLine),
|
|
1370
1370
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1371
1371
|
...e.overrides
|
|
1372
1372
|
};
|
|
1373
1373
|
}
|
|
1374
1374
|
//#endregion
|
|
1375
1375
|
//#region src/layout/LayoutManager.ts
|
|
1376
|
-
var
|
|
1376
|
+
var br = 200, xr = 80, W = (e) => e.position === "top" || e.position === "bottom", Sr = class {
|
|
1377
1377
|
panels = [];
|
|
1378
1378
|
containerWidth = 0;
|
|
1379
1379
|
containerHeight = 0;
|
|
@@ -1390,8 +1390,8 @@ var vr = 200, yr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1390
1390
|
this.panels.push({
|
|
1391
1391
|
id: e,
|
|
1392
1392
|
position: t,
|
|
1393
|
-
size: r ?? (i ?
|
|
1394
|
-
minSize: i ?
|
|
1393
|
+
size: r ?? (i ? br : n),
|
|
1394
|
+
minSize: i ? xr : a,
|
|
1395
1395
|
content: {
|
|
1396
1396
|
type: "indicator",
|
|
1397
1397
|
indicatorInstanceId: e
|
|
@@ -1460,7 +1460,7 @@ var vr = 200, yr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1460
1460
|
let r = this.panels.find((t) => t.id === e);
|
|
1461
1461
|
if (r) {
|
|
1462
1462
|
let i = r.position === "left" || r.position === "right", o = t === "left" || t === "right";
|
|
1463
|
-
r.position = t, i !== o && (r.size = o ?
|
|
1463
|
+
r.position = t, i !== o && (r.size = o ? br : n, r.minSize = o ? xr : a), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
1466
|
setPanelSize(e, t) {
|
|
@@ -1580,8 +1580,8 @@ var vr = 200, yr = 80, W = (e) => e.position === "top" || e.position === "bottom
|
|
|
1580
1580
|
getMainChartRect() {
|
|
1581
1581
|
return this.resolve().mainChartRect;
|
|
1582
1582
|
}
|
|
1583
|
-
},
|
|
1584
|
-
function
|
|
1583
|
+
}, Cr = 14, wr = 14, Tr = 22, Er = 4;
|
|
1584
|
+
function Dr(e) {
|
|
1585
1585
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure: c } = e, u = e.tagPrecision ?? l(t, n), d = u, f = r === null ? [t, n] : [
|
|
1586
1586
|
t,
|
|
1587
1587
|
n,
|
|
@@ -1590,16 +1590,16 @@ function Tr(e) {
|
|
|
1590
1590
|
for (let t of f) {
|
|
1591
1591
|
if (!Number.isFinite(t)) continue;
|
|
1592
1592
|
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : _(t, u, i), r = e.format ? n : _(t, d, i);
|
|
1593
|
-
p = Math.max(p, c(n, `500 ${o}px ${a}`) +
|
|
1593
|
+
p = Math.max(p, c(n, `500 ${o}px ${a}`) + Cr, c(r, `bold 11px ${a}`) + wr, c(r, `600 ${o}px ${a}`) + Tr);
|
|
1594
1594
|
}
|
|
1595
|
-
return p <= s ? s : Math.ceil(p /
|
|
1595
|
+
return p <= s ? s : Math.ceil(p / Er) * Er;
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function Or(e, t) {
|
|
1598
1598
|
return t > e || t <= e - 12 ? t : e;
|
|
1599
1599
|
}
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/layout/labelWidths.ts
|
|
1602
|
-
var
|
|
1602
|
+
var kr = 512, Ar = class {
|
|
1603
1603
|
widths = /* @__PURE__ */ new Map();
|
|
1604
1604
|
fonts;
|
|
1605
1605
|
forget = () => this.widths.clear();
|
|
@@ -1610,12 +1610,12 @@ var Dr = 512, Or = class {
|
|
|
1610
1610
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1611
1611
|
if (i !== void 0) return i;
|
|
1612
1612
|
let a = n();
|
|
1613
|
-
return this.widths.size >=
|
|
1613
|
+
return this.widths.size >= kr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1614
1614
|
}
|
|
1615
1615
|
destroy() {
|
|
1616
1616
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1617
1617
|
}
|
|
1618
|
-
},
|
|
1618
|
+
}, jr = class {
|
|
1619
1619
|
netY = 0;
|
|
1620
1620
|
travelX = 0;
|
|
1621
1621
|
engaged = !1;
|
|
@@ -1631,8 +1631,8 @@ var Dr = 512, Or = class {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
return this.engaged;
|
|
1633
1633
|
}
|
|
1634
|
-
},
|
|
1635
|
-
function
|
|
1634
|
+
}, Mr = 1;
|
|
1635
|
+
function Nr(e, t) {
|
|
1636
1636
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1637
1637
|
}
|
|
1638
1638
|
function G(e) {
|
|
@@ -1646,24 +1646,24 @@ function G(e) {
|
|
|
1646
1646
|
//#endregion
|
|
1647
1647
|
//#region src/plugins/registry.ts
|
|
1648
1648
|
var K = /* @__PURE__ */ new Map();
|
|
1649
|
-
function
|
|
1649
|
+
function Pr(e) {
|
|
1650
1650
|
K.set(G(e), e);
|
|
1651
1651
|
}
|
|
1652
|
-
function
|
|
1652
|
+
function Fr(e) {
|
|
1653
1653
|
return K.delete(e);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function Ir() {
|
|
1656
1656
|
return [...K.values()];
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1658
|
+
function Lr() {
|
|
1659
1659
|
K.clear();
|
|
1660
1660
|
}
|
|
1661
1661
|
//#endregion
|
|
1662
1662
|
//#region src/plugins/PluginManager.ts
|
|
1663
|
-
var
|
|
1663
|
+
var Rr = class {
|
|
1664
1664
|
plugins = /* @__PURE__ */ new Map();
|
|
1665
1665
|
constructor(e, t = {}) {
|
|
1666
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1666
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Ir()) this.add(e);
|
|
1667
1667
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1668
1668
|
}
|
|
1669
1669
|
register(e) {
|
|
@@ -1693,15 +1693,15 @@ var Ir = class {
|
|
|
1693
1693
|
add(e) {
|
|
1694
1694
|
this.plugins.set(G(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1695
1695
|
}
|
|
1696
|
-
},
|
|
1696
|
+
}, zr = {
|
|
1697
1697
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1698
1698
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1699
1699
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1700
1700
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1701
1701
|
positionClose: (e, t) => e.closePosition(t),
|
|
1702
|
-
positionReverse: (e, t, n) =>
|
|
1702
|
+
positionReverse: (e, t, n) => Br(e, t, n)
|
|
1703
1703
|
};
|
|
1704
|
-
async function
|
|
1704
|
+
async function Br(e, t, n) {
|
|
1705
1705
|
let { reversing: r } = n;
|
|
1706
1706
|
if (!r.has(t.positionId)) {
|
|
1707
1707
|
r.add(t.positionId);
|
|
@@ -1730,7 +1730,7 @@ async function Rr(e, t, n) {
|
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
1732
|
}
|
|
1733
|
-
function
|
|
1733
|
+
function Vr(e, t) {
|
|
1734
1734
|
let n = [], r = null, i = {
|
|
1735
1735
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1736
1736
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1740,8 +1740,8 @@ function zr(e, t) {
|
|
|
1740
1740
|
e.data && t.onFill?.(e.data);
|
|
1741
1741
|
};
|
|
1742
1742
|
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 =
|
|
1743
|
+
for (let r of Object.keys(zr)) {
|
|
1744
|
+
let a = zr[r], o = t.onIntent(r, (n) => {
|
|
1745
1745
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1746
1746
|
message: `Execution command failed: ${r}`,
|
|
1747
1747
|
cause: e
|
|
@@ -1755,7 +1755,7 @@ function zr(e, t) {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
//#endregion
|
|
1757
1757
|
//#region src/replay/ReplayStepLoader.ts
|
|
1758
|
-
var
|
|
1758
|
+
var Hr = 1e3, Ur = class {
|
|
1759
1759
|
pieces = /* @__PURE__ */ new Map();
|
|
1760
1760
|
asked = /* @__PURE__ */ new Set();
|
|
1761
1761
|
inFlight = !1;
|
|
@@ -1788,7 +1788,7 @@ var Br = 1e3, Vr = class {
|
|
|
1788
1788
|
this.done = !0;
|
|
1789
1789
|
}
|
|
1790
1790
|
ask(e, t) {
|
|
1791
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1791
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(Hr / 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
1792
|
for (let e of l) this.asked.add(e.time);
|
|
1793
1793
|
this.inFlight = !0, a({
|
|
1794
1794
|
state: "loading",
|
|
@@ -1829,12 +1829,12 @@ var Br = 1e3, Vr = class {
|
|
|
1829
1829
|
...n === void 0 ? {} : { error: n }
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
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 *
|
|
1832
|
+
}, Wr = 1 / 3, Gr = .25, Kr = .5;
|
|
1833
|
+
function qr(e, t) {
|
|
1834
|
+
let n = (e.high - e.low) * Gr;
|
|
1835
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * Kr;
|
|
1836
1836
|
}
|
|
1837
|
-
function
|
|
1837
|
+
function Jr(e) {
|
|
1838
1838
|
return e.close >= e.open ? [
|
|
1839
1839
|
e.open,
|
|
1840
1840
|
e.low,
|
|
@@ -1847,22 +1847,22 @@ function Kr(e) {
|
|
|
1847
1847
|
e.close
|
|
1848
1848
|
];
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
let r =
|
|
1850
|
+
function Yr(e, t, n) {
|
|
1851
|
+
let r = Jr(e), i = [
|
|
1852
1852
|
1,
|
|
1853
1853
|
2,
|
|
1854
1854
|
3
|
|
1855
1855
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1856
1856
|
return r.forEach((r, c) => {
|
|
1857
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1857
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : Wr), !(c === 0 && t > 0) && o.push({
|
|
1858
1858
|
price: r,
|
|
1859
1859
|
time: e.time,
|
|
1860
1860
|
at: (t + s) / n
|
|
1861
1861
|
});
|
|
1862
1862
|
}), o;
|
|
1863
1863
|
}
|
|
1864
|
-
function
|
|
1865
|
-
let n = t.length > 0 &&
|
|
1864
|
+
function Xr(e, t = []) {
|
|
1865
|
+
let n = t.length > 0 && qr(e, t) ? t : [e], r = n.length, i = Zr(n.flatMap((e, t) => Yr(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1866
1866
|
return {
|
|
1867
1867
|
bar: e,
|
|
1868
1868
|
points: i,
|
|
@@ -1872,7 +1872,7 @@ function Jr(e, t = []) {
|
|
|
1872
1872
|
}))
|
|
1873
1873
|
};
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function Zr(e, t) {
|
|
1876
1876
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1877
1877
|
...e,
|
|
1878
1878
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1887,7 +1887,7 @@ function Yr(e, t) {
|
|
|
1887
1887
|
};
|
|
1888
1888
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Qr(e, t) {
|
|
1891
1891
|
let n = e.points;
|
|
1892
1892
|
if (t <= n[0].at) return n[0].price;
|
|
1893
1893
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1896,8 +1896,8 @@ function Xr(e, t) {
|
|
|
1896
1896
|
}
|
|
1897
1897
|
return n[n.length - 1].price;
|
|
1898
1898
|
}
|
|
1899
|
-
var
|
|
1900
|
-
function
|
|
1899
|
+
var $r = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1900
|
+
function ei(e, t) {
|
|
1901
1901
|
let n = 0, r = 0;
|
|
1902
1902
|
for (let i of e.volumeAt) {
|
|
1903
1903
|
if (t >= i.at) {
|
|
@@ -1908,10 +1908,10 @@ function Qr(e, t) {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
return n;
|
|
1910
1910
|
}
|
|
1911
|
-
function
|
|
1912
|
-
let n =
|
|
1911
|
+
function ti(e, t) {
|
|
1912
|
+
let n = $r(t);
|
|
1913
1913
|
if (n >= 1) return { ...e.bar };
|
|
1914
|
-
let r =
|
|
1914
|
+
let r = Qr(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1915
1915
|
for (let t of e.points) {
|
|
1916
1916
|
if (t.at > n) break;
|
|
1917
1917
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1922,11 +1922,11 @@ function $r(e, t) {
|
|
|
1922
1922
|
high: i,
|
|
1923
1923
|
low: a,
|
|
1924
1924
|
close: r,
|
|
1925
|
-
volume:
|
|
1925
|
+
volume: ei(e, n)
|
|
1926
1926
|
};
|
|
1927
1927
|
}
|
|
1928
|
-
function
|
|
1929
|
-
let n =
|
|
1928
|
+
function ni(e, t) {
|
|
1929
|
+
let n = $r(t), r = 0;
|
|
1930
1930
|
for (let t of e.points) {
|
|
1931
1931
|
if (t.at > n) break;
|
|
1932
1932
|
r = t.at;
|
|
@@ -1939,12 +1939,12 @@ function q(e, t, n) {
|
|
|
1939
1939
|
if (a.at > n) break;
|
|
1940
1940
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1941
1941
|
}
|
|
1942
|
-
let a =
|
|
1942
|
+
let a = Qr(e, n);
|
|
1943
1943
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1944
1944
|
}
|
|
1945
1945
|
//#endregion
|
|
1946
1946
|
//#region src/replay/replayStep.ts
|
|
1947
|
-
var
|
|
1947
|
+
var ri = [
|
|
1948
1948
|
"1m",
|
|
1949
1949
|
"3m",
|
|
1950
1950
|
"5m",
|
|
@@ -1955,27 +1955,27 @@ var ti = [
|
|
|
1955
1955
|
"4h",
|
|
1956
1956
|
"1d"
|
|
1957
1957
|
];
|
|
1958
|
-
function
|
|
1958
|
+
function ii(e, t) {
|
|
1959
1959
|
let n = T(e);
|
|
1960
|
-
return n > 0 ?
|
|
1960
|
+
return n > 0 ? ri.filter((e) => {
|
|
1961
1961
|
let r = T(e);
|
|
1962
1962
|
return r < n && n % r === 0 && t(e);
|
|
1963
1963
|
}) : [];
|
|
1964
1964
|
}
|
|
1965
|
-
function
|
|
1966
|
-
let r =
|
|
1965
|
+
function ai(e, t, n) {
|
|
1966
|
+
let r = ii(t, n);
|
|
1967
1967
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1968
1968
|
let i = T(t);
|
|
1969
1969
|
return r.find((e) => i / T(e) <= 60) ?? null;
|
|
1970
1970
|
}
|
|
1971
1971
|
//#endregion
|
|
1972
1972
|
//#region src/model/AlertWatch.ts
|
|
1973
|
-
function
|
|
1973
|
+
function oi(e, t) {
|
|
1974
1974
|
e.setBarTime(t.barTime);
|
|
1975
1975
|
let n = new Map([["price", t.price]]);
|
|
1976
|
-
t.lines &&
|
|
1976
|
+
t.lines && si(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function si(e, t, n) {
|
|
1979
1979
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
1980
1980
|
for (let e of r) {
|
|
1981
1981
|
if (n.has(e)) continue;
|
|
@@ -1985,7 +1985,7 @@ function ai(e, t, n) {
|
|
|
1985
1985
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
1986
1986
|
}
|
|
1987
1987
|
}
|
|
1988
|
-
function
|
|
1988
|
+
function ci(e, t, n, r) {
|
|
1989
1989
|
let i = (e) => {
|
|
1990
1990
|
let i = e.indexOf(":");
|
|
1991
1991
|
if (i <= 0) return null;
|
|
@@ -2007,35 +2007,35 @@ function oi(e, t, n, r) {
|
|
|
2007
2007
|
});
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
function
|
|
2010
|
+
function li(e, t) {
|
|
2011
2011
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2012
2012
|
return r ? r + e.slice(n) : e;
|
|
2013
2013
|
}
|
|
2014
|
-
var
|
|
2014
|
+
var ui = [
|
|
2015
2015
|
"crossing",
|
|
2016
2016
|
"crossingUp",
|
|
2017
2017
|
"crossingDown"
|
|
2018
2018
|
];
|
|
2019
|
-
function
|
|
2019
|
+
function di(e, t, n, r, i) {
|
|
2020
2020
|
e.clearAlerts();
|
|
2021
2021
|
for (let a of t) {
|
|
2022
2022
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2023
2023
|
if (a.drawingId) {
|
|
2024
|
-
r(a.drawingId) &&
|
|
2024
|
+
r(a.drawingId) && ui.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2025
2025
|
continue;
|
|
2026
2026
|
}
|
|
2027
2027
|
let t = {
|
|
2028
|
-
...
|
|
2029
|
-
...a.target ? { target:
|
|
2028
|
+
...Ht(a),
|
|
2029
|
+
...a.target ? { target: li(a.target, n) } : {}
|
|
2030
2030
|
};
|
|
2031
2031
|
try {
|
|
2032
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2032
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, li(a.channel, n), a.label, t);
|
|
2033
2033
|
} catch (e) {
|
|
2034
2034
|
i(e);
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
var
|
|
2038
|
+
var fi = class {
|
|
2039
2039
|
kept = /* @__PURE__ */ new Map();
|
|
2040
2040
|
constructor(e) {
|
|
2041
2041
|
this.alerts = e;
|
|
@@ -2068,18 +2068,18 @@ function Y(e, t) {
|
|
|
2068
2068
|
}
|
|
2069
2069
|
return n;
|
|
2070
2070
|
}
|
|
2071
|
-
function
|
|
2071
|
+
function pi(e) {
|
|
2072
2072
|
let t = 0, n = 0;
|
|
2073
2073
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
2074
2074
|
let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
|
|
2075
2075
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2077
|
+
function mi(e) {
|
|
2078
2078
|
let t = [], n = Math.ceil(e.length / 500);
|
|
2079
|
-
for (let r = 0; r < e.length; r += n) t.push(...
|
|
2079
|
+
for (let r = 0; r < e.length; r += n) t.push(...pi(e.slice(r, r + n)));
|
|
2080
2080
|
return t;
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function hi(e, t, n) {
|
|
2083
2083
|
let r = e[t];
|
|
2084
2084
|
return r ? n.time === null ? {
|
|
2085
2085
|
marks: [[r.close, r.time]],
|
|
@@ -2088,14 +2088,14 @@ function pi(e, t, n) {
|
|
|
2088
2088
|
fraction: n.fraction
|
|
2089
2089
|
}
|
|
2090
2090
|
} : r.time <= n.time ? null : {
|
|
2091
|
-
marks:
|
|
2091
|
+
marks: mi(e.slice(Y(e, n.time), t + 1)),
|
|
2092
2092
|
fed: {
|
|
2093
2093
|
time: r.time,
|
|
2094
2094
|
fraction: n.fraction
|
|
2095
2095
|
}
|
|
2096
2096
|
} : null;
|
|
2097
2097
|
}
|
|
2098
|
-
function
|
|
2098
|
+
function gi(e, t, n, r, i, a) {
|
|
2099
2099
|
let o = e[t];
|
|
2100
2100
|
if (!o) return null;
|
|
2101
2101
|
let s = {
|
|
@@ -2103,7 +2103,7 @@ function mi(e, t, n, r, i, a) {
|
|
|
2103
2103
|
fraction: r
|
|
2104
2104
|
};
|
|
2105
2105
|
if (i.time === null) return {
|
|
2106
|
-
marks: [[
|
|
2106
|
+
marks: [[ti(n, r).close, o.time]],
|
|
2107
2107
|
fed: s
|
|
2108
2108
|
};
|
|
2109
2109
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
@@ -2112,19 +2112,19 @@ function mi(e, t, n, r, i, a) {
|
|
|
2112
2112
|
fed: s
|
|
2113
2113
|
};
|
|
2114
2114
|
let c = [], l = J(e, i.time);
|
|
2115
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...
|
|
2115
|
+
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...mi(e.slice(Y(e, i.time), t))), c.push(...q(n, -1, r)), {
|
|
2116
2116
|
marks: c,
|
|
2117
2117
|
fed: s
|
|
2118
2118
|
};
|
|
2119
2119
|
}
|
|
2120
2120
|
//#endregion
|
|
2121
2121
|
//#region src/Chart.ts
|
|
2122
|
-
var
|
|
2123
|
-
function
|
|
2122
|
+
var _i = "exchange", vi = _i;
|
|
2123
|
+
function yi(e) {
|
|
2124
2124
|
if (typeof e == "string" && e !== "exchange" && !b(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
2125
2125
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2126
2126
|
}
|
|
2127
|
-
function
|
|
2127
|
+
function bi(e, t) {
|
|
2128
2128
|
let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : w(e);
|
|
2129
2129
|
return i === void 0 ? e : {
|
|
2130
2130
|
...e,
|
|
@@ -2132,16 +2132,16 @@ function vi(e, t) {
|
|
|
2132
2132
|
timezone: i
|
|
2133
2133
|
};
|
|
2134
2134
|
}
|
|
2135
|
-
var
|
|
2135
|
+
var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
2136
2136
|
ArrowLeft: [-1, 0],
|
|
2137
2137
|
ArrowRight: [1, 0],
|
|
2138
2138
|
ArrowUp: [0, -1],
|
|
2139
2139
|
ArrowDown: [0, 1]
|
|
2140
|
-
},
|
|
2141
|
-
static version = "1.
|
|
2140
|
+
}, Ei = new Set(["horizontalLine", "crossLine"]), Di = new Set(["verticalLine", "crossLine"]), Oi = class {
|
|
2141
|
+
static version = "1.82.0";
|
|
2142
2142
|
engine;
|
|
2143
2143
|
viewport;
|
|
2144
|
-
series = new
|
|
2144
|
+
series = new Bn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2145
2145
|
themeManager;
|
|
2146
2146
|
layoutManager;
|
|
2147
2147
|
pluginManager;
|
|
@@ -2166,7 +2166,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2166
2166
|
renderDeferred = !1;
|
|
2167
2167
|
priceAxisWidth = s;
|
|
2168
2168
|
measureCtx;
|
|
2169
|
-
labelWidths = new
|
|
2169
|
+
labelWidths = new Ar();
|
|
2170
2170
|
containerSizeCache = null;
|
|
2171
2171
|
containerSizeCacheTime = 0;
|
|
2172
2172
|
lastEmittedRange = null;
|
|
@@ -2224,7 +2224,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2224
2224
|
replayForming = null;
|
|
2225
2225
|
replayPhaseUnsub = null;
|
|
2226
2226
|
undoRedoManager;
|
|
2227
|
-
autoSaveScheduler = new
|
|
2227
|
+
autoSaveScheduler = new jn((e) => this.saveState(e));
|
|
2228
2228
|
animator;
|
|
2229
2229
|
crosshairTooltip;
|
|
2230
2230
|
pinnedTooltip;
|
|
@@ -2274,10 +2274,10 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2274
2274
|
snapshotKey = null;
|
|
2275
2275
|
historyCheckQueued = !1;
|
|
2276
2276
|
constructor(e, t) {
|
|
2277
|
-
t.timeZone != null &&
|
|
2277
|
+
t.timeZone != null && yi(t.timeZone), this.container = e, this.options = {
|
|
2278
2278
|
...t,
|
|
2279
2279
|
chartType: t.chartType ?? "candlestick"
|
|
2280
|
-
}, this.numberLocale = t.numberLocale ?? "en-US", this.priceFit = new
|
|
2280
|
+
}, this.numberLocale = t.numberLocale ?? "en-US", this.priceFit = new Un(t.autoScale !== !1), this.display = new Kn({
|
|
2281
2281
|
bars: () => this.series.bars(),
|
|
2282
2282
|
version: () => this.series.version(),
|
|
2283
2283
|
chartType: () => this.options.chartType,
|
|
@@ -2310,6 +2310,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2310
2310
|
legend: n.legend ?? !0,
|
|
2311
2311
|
indicatorValueLabels: n.indicatorValueLabels ?? !1,
|
|
2312
2312
|
alignAxisLabels: n.alignAxisLabels ?? !0,
|
|
2313
|
+
drawingAxisSpans: n.drawingAxisSpans ?? !0,
|
|
2313
2314
|
volume: n.volume ?? !0,
|
|
2314
2315
|
watermark: n.watermark ?? !0,
|
|
2315
2316
|
saveLoad: n.saveLoad ?? !0,
|
|
@@ -2323,19 +2324,19 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2323
2324
|
logScale: n.logScale ?? !0,
|
|
2324
2325
|
timeframes: n.timeframes ?? [],
|
|
2325
2326
|
defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
|
|
2326
|
-
}, 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
|
|
2327
|
+
}, 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 hr({
|
|
2327
2328
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2328
2329
|
prepend: (e) => this.prependBars(e),
|
|
2329
2330
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2330
|
-
}), this.themeManager = new
|
|
2331
|
+
}), this.themeManager = new _r(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(yr(t), "host", !1), this.container.style.backgroundColor || (this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background), this.layoutManager = new Sr(), this.indicatorEngine = new Ve(), this.panes = new Jn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new Qn(this.indicatorEngine, this.layoutManager, {
|
|
2331
2332
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2332
2333
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2333
2334
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2334
|
-
}), this.symbolRequests = new
|
|
2335
|
+
}), this.symbolRequests = new sr(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Rr(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ie(), Wt(this.indicatorEngine), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new gt(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.indicatorEngine.register(new De(this.symbolSeries)), this.drawingManager = new Ne(), Ut(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(() => {
|
|
2335
2336
|
this.syncRenderContext(), this.engine.requestRender(i.Overlay), this.scheduleAutoSave();
|
|
2336
2337
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2337
2338
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2338
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new wt(), this.indicatorHistory = new
|
|
2339
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new wt(), this.indicatorHistory = new Zn({
|
|
2339
2340
|
steps: this.undoRedoManager,
|
|
2340
2341
|
snapshot: () => this.getIndicatorSetup(),
|
|
2341
2342
|
enabled: () => this.features.drawingUndoRedo
|
|
@@ -2366,7 +2367,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2366
2367
|
if (e.width <= 0 || e.height <= 0) return;
|
|
2367
2368
|
let t = this.viewport.isAtEnd();
|
|
2368
2369
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2369
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Le(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new nt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new bt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Oe(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2370
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Le(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new nt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new bt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Oe(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), Ft(t.crosshair?.cursor) && this.crosshairHandler.setCursor(t.crosshair.cursor), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2370
2371
|
if (e !== null && t) {
|
|
2371
2372
|
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = A(n), s = r ? o[e]?.time ?? r.time : void 0;
|
|
2372
2373
|
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(i.Hover);
|
|
@@ -2403,7 +2404,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2403
2404
|
color: t.sessionBreaks.color,
|
|
2404
2405
|
lineStyle: t.sessionBreaks.lineStyle,
|
|
2405
2406
|
lineWidth: t.sessionBreaks.lineWidth
|
|
2406
|
-
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.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 $e(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = ae(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(
|
|
2407
|
+
}) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.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 $e(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = ae(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Mi(t.shapes)), t.font && this.themeManager.setFont(ji(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new We({
|
|
2407
2408
|
scrollBars: (e) => {
|
|
2408
2409
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2409
2410
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2420,7 +2421,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2420
2421
|
},
|
|
2421
2422
|
fitContent: () => this.fitContent()
|
|
2422
2423
|
}), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
|
|
2423
|
-
this.a11y = new
|
|
2424
|
+
this.a11y = new cn(e, {
|
|
2424
2425
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
2425
2426
|
timeframe: () => this.streamTimeframe ?? "",
|
|
2426
2427
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
@@ -2451,7 +2452,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2451
2452
|
}
|
|
2452
2453
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2453
2454
|
}
|
|
2454
|
-
}, 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(i.Overlay)), this.drawingAlerts = new
|
|
2455
|
+
}, 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(i.Overlay)), this.drawingAlerts = new fi(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(It).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2455
2456
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2456
2457
|
kind: "alert",
|
|
2457
2458
|
alert: "triggered",
|
|
@@ -2491,7 +2492,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2491
2492
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2492
2493
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2493
2494
|
}), this.measureOverlay = new Je(), this.interactionManager = new He(e), this.features.panning) {
|
|
2494
|
-
let e = new
|
|
2495
|
+
let e = new jr();
|
|
2495
2496
|
this.interactionManager.setPanHandler(new Xe((t, n) => {
|
|
2496
2497
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2497
2498
|
}, () => e.reset()));
|
|
@@ -2517,7 +2518,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2517
2518
|
e === "price" ? (this.priceFit.resume(), this.updateViewportAndRender()) : this.fitContent();
|
|
2518
2519
|
});
|
|
2519
2520
|
}
|
|
2520
|
-
if (this.features.crosshair && this.interactionManager.setCrosshairHandler(this.crosshairHandler), this.features.drawings && (this.interactionManager.setDrawingManager(this.drawingManager, () => ({
|
|
2521
|
+
if (this.features.crosshair && (this.interactionManager.setCrosshairHandler(this.crosshairHandler), this.applyIdleCursor()), this.features.drawings && (this.interactionManager.setDrawingManager(this.drawingManager, () => ({
|
|
2521
2522
|
...this.viewport.getState(),
|
|
2522
2523
|
data: this.getDisplayData()
|
|
2523
2524
|
})), this.drawingManager.setPanes({
|
|
@@ -2532,7 +2533,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2532
2533
|
y: t.y
|
|
2533
2534
|
});
|
|
2534
2535
|
})), 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) => {
|
|
2535
|
-
let t =
|
|
2536
|
+
let t = $t(e.y, this.viewport.getState());
|
|
2536
2537
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
2537
2538
|
price: t,
|
|
2538
2539
|
x: e.x,
|
|
@@ -2569,7 +2570,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2569
2570
|
x: e.x,
|
|
2570
2571
|
y: e.y
|
|
2571
2572
|
}), t.length === 0) return;
|
|
2572
|
-
let r =
|
|
2573
|
+
let r = Qt(e.x, this.viewport.getState());
|
|
2573
2574
|
r < 0 || r >= t.length || this.eventBus.emit("barClick", {
|
|
2574
2575
|
bar: t[r],
|
|
2575
2576
|
barIndex: r,
|
|
@@ -2614,7 +2615,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2614
2615
|
end: () => {
|
|
2615
2616
|
let e = this.selectionBoxOverlay.end();
|
|
2616
2617
|
if (e && this.zoomAreaMode) {
|
|
2617
|
-
if (e.x1 - e.x0 <
|
|
2618
|
+
if (e.x1 - e.x0 < Ci) return;
|
|
2618
2619
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
2619
2620
|
return;
|
|
2620
2621
|
}
|
|
@@ -2696,7 +2697,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2696
2697
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2697
2698
|
if (t.width <= 0) return;
|
|
2698
2699
|
let { from: n, to: r } = e;
|
|
2699
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2700
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Si, r - n));
|
|
2700
2701
|
}));
|
|
2701
2702
|
}
|
|
2702
2703
|
useStreamHistory(e, t, n = !0) {
|
|
@@ -2810,7 +2811,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2810
2811
|
return this.extendedHours;
|
|
2811
2812
|
}
|
|
2812
2813
|
sessionKeep(e) {
|
|
2813
|
-
return this.extendedHours ? null :
|
|
2814
|
+
return this.extendedHours ? null : nn(this.symbolInfo, e);
|
|
2814
2815
|
}
|
|
2815
2816
|
reapplyExtendedHours() {
|
|
2816
2817
|
if (!this.series.refilter()) return;
|
|
@@ -2821,7 +2822,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2821
2822
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2822
2823
|
}
|
|
2823
2824
|
setShapes(e) {
|
|
2824
|
-
let t =
|
|
2825
|
+
let t = Mi(e);
|
|
2825
2826
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2826
2827
|
...this.themeManager.getTheme().shape,
|
|
2827
2828
|
...t
|
|
@@ -2833,7 +2834,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2833
2834
|
setFont(e) {
|
|
2834
2835
|
if (e === null) this.themeManager.setFont(null);
|
|
2835
2836
|
else {
|
|
2836
|
-
let t =
|
|
2837
|
+
let t = ji(e);
|
|
2837
2838
|
if (Object.keys(t).length === 0) return;
|
|
2838
2839
|
this.themeManager.setFont(t);
|
|
2839
2840
|
}
|
|
@@ -2949,8 +2950,8 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
2949
2950
|
return {
|
|
2950
2951
|
...e,
|
|
2951
2952
|
priceRange: {
|
|
2952
|
-
min: t.min - n *
|
|
2953
|
-
max: t.max + n *
|
|
2953
|
+
min: t.min - n * xi,
|
|
2954
|
+
max: t.max + n * xi
|
|
2954
2955
|
},
|
|
2955
2956
|
logScale: !1,
|
|
2956
2957
|
scaleMode: "regular",
|
|
@@ -3025,7 +3026,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3025
3026
|
}
|
|
3026
3027
|
static indicators() {
|
|
3027
3028
|
let e = new Ve();
|
|
3028
|
-
return
|
|
3029
|
+
return Wt(e), e.getAvailableIndicators();
|
|
3029
3030
|
}
|
|
3030
3031
|
setPanelPosition(e, t) {
|
|
3031
3032
|
this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
|
|
@@ -3112,6 +3113,12 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3112
3113
|
isAxisLabelsAligned() {
|
|
3113
3114
|
return this.features.alignAxisLabels;
|
|
3114
3115
|
}
|
|
3116
|
+
setDrawingAxisSpansVisible(e) {
|
|
3117
|
+
this.features.drawingAxisSpans = e, this.syncRenderContext(), this.engine.requestRender();
|
|
3118
|
+
}
|
|
3119
|
+
isDrawingAxisSpansVisible() {
|
|
3120
|
+
return this.features.drawingAxisSpans;
|
|
3121
|
+
}
|
|
3115
3122
|
setPaneTitlesVisible(e) {
|
|
3116
3123
|
this.paneTitles = e, this.engine.requestRender();
|
|
3117
3124
|
}
|
|
@@ -3242,9 +3249,9 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3242
3249
|
return this.drawingManager.removeDrawings(e);
|
|
3243
3250
|
}
|
|
3244
3251
|
nudgeSelectedDrawings(e) {
|
|
3245
|
-
let t =
|
|
3252
|
+
let t = Ti[e.key];
|
|
3246
3253
|
if (!t || !this.features.drawings || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
3247
|
-
let n = e.shiftKey ?
|
|
3254
|
+
let n = e.shiftKey ? wi : 1, r = {
|
|
3248
3255
|
...this.viewport.getState(),
|
|
3249
3256
|
data: this.getDisplayData()
|
|
3250
3257
|
};
|
|
@@ -3385,7 +3392,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3385
3392
|
x: t.x,
|
|
3386
3393
|
y: t.y
|
|
3387
3394
|
};
|
|
3388
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
3395
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = $t(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
|
|
3389
3396
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
3390
3397
|
e && (r.pane = e.instanceId);
|
|
3391
3398
|
}
|
|
@@ -3651,7 +3658,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3651
3658
|
}
|
|
3652
3659
|
checkAlerts(e) {
|
|
3653
3660
|
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.replaySession || this.series.length() === 0 ? null : (e) => this.indicatorEngine.getOutput(e)?.series;
|
|
3654
|
-
|
|
3661
|
+
oi(this.alertManager, {
|
|
3655
3662
|
price: e,
|
|
3656
3663
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3657
3664
|
lines: n
|
|
@@ -3663,7 +3670,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3663
3670
|
async connect(e) {
|
|
3664
3671
|
let t = {
|
|
3665
3672
|
...e,
|
|
3666
|
-
adapter:
|
|
3673
|
+
adapter: Gt(e),
|
|
3667
3674
|
feed: void 0
|
|
3668
3675
|
};
|
|
3669
3676
|
if (!j(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
@@ -3772,7 +3779,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3772
3779
|
}
|
|
3773
3780
|
connectExecution(e, t = {}) {
|
|
3774
3781
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3775
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3782
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Vr(e, {
|
|
3776
3783
|
onIntent: (e, t) => {
|
|
3777
3784
|
let n = (e) => t(e.payload);
|
|
3778
3785
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -3903,7 +3910,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
3903
3910
|
setVisibleRangePreset(e) {
|
|
3904
3911
|
let t = this.getDisplayData();
|
|
3905
3912
|
if (t.length === 0) return;
|
|
3906
|
-
let n = t.length - 1, r = d(t), i =
|
|
3913
|
+
let n = t.length - 1, r = d(t), i = Vt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
3907
3914
|
if (a === null || a < t[0].time) {
|
|
3908
3915
|
this.fitContent();
|
|
3909
3916
|
return;
|
|
@@ -4030,7 +4037,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4030
4037
|
this.eventBus.disableTauriBridge();
|
|
4031
4038
|
}
|
|
4032
4039
|
setTheme(e) {
|
|
4033
|
-
this.themeManager.setTheme(e), this.syncRenderContext(), this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background, this.engine.requestRender(), this.eventBus.emit("themeChange", { theme: e }), this.markStateChanged();
|
|
4040
|
+
this.themeManager.setTheme(e), this.syncRenderContext(), this.applyIdleCursor(), this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background, this.engine.requestRender(), this.eventBus.emit("themeChange", { theme: e }), this.markStateChanged();
|
|
4034
4041
|
}
|
|
4035
4042
|
getTheme() {
|
|
4036
4043
|
return this.themeManager.getBaseTheme();
|
|
@@ -4062,7 +4069,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4062
4069
|
i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
|
|
4063
4070
|
}
|
|
4064
4071
|
styleChanged(e) {
|
|
4065
|
-
this.syncRenderContext();
|
|
4072
|
+
this.syncRenderContext(), this.applyIdleCursor();
|
|
4066
4073
|
let t = this.themeManager.getTheme().background;
|
|
4067
4074
|
t !== this.lastBackground && (this.container.style.backgroundColor = t, this.lastBackground = t), this.engine.requestRender(), this.eventBus.emit("styleChange", { layer: e }), e === "user" && this.markStateChanged();
|
|
4068
4075
|
}
|
|
@@ -4087,6 +4094,16 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4087
4094
|
getCrosshairMode() {
|
|
4088
4095
|
return this.crosshairHandler.getMode();
|
|
4089
4096
|
}
|
|
4097
|
+
setCrosshairCursor(e) {
|
|
4098
|
+
!Ft(e) || e === this.crosshairHandler.getCursor() || (this.crosshairHandler.setCursor(e), this.applyIdleCursor(), this.engine.requestRender(i.Hover), this.eventBus.emit("crosshairCursorChange", { cursor: e }));
|
|
4099
|
+
}
|
|
4100
|
+
getCrosshairCursor() {
|
|
4101
|
+
return this.crosshairHandler.getCursor();
|
|
4102
|
+
}
|
|
4103
|
+
applyIdleCursor() {
|
|
4104
|
+
let e = this.themeManager.getTheme(), t = e.style?.crosshair.vertical.color ?? e.crosshair;
|
|
4105
|
+
this.interactionManager.setIdleCursor(Pt(this.crosshairHandler.getCursor(), t, e.background));
|
|
4106
|
+
}
|
|
4090
4107
|
setCrosshairPosition(e) {
|
|
4091
4108
|
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(i.Hover);
|
|
4092
4109
|
}
|
|
@@ -4180,7 +4197,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4180
4197
|
return this.periodLevels.getPeriod();
|
|
4181
4198
|
}
|
|
4182
4199
|
setTimeZone(e) {
|
|
4183
|
-
|
|
4200
|
+
yi(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
4184
4201
|
}
|
|
4185
4202
|
getTimeZone() {
|
|
4186
4203
|
return this.timeZoneSetting;
|
|
@@ -4245,7 +4262,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4245
4262
|
}
|
|
4246
4263
|
useSymbolInfo(e) {
|
|
4247
4264
|
let t = e && this.symbolInfo?.symbol === e.symbol ? w(this.symbolInfo) : void 0;
|
|
4248
|
-
this.symbolInfo = e ?
|
|
4265
|
+
this.symbolInfo = e ? bi({
|
|
4249
4266
|
...e,
|
|
4250
4267
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
4251
4268
|
}, t) : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(i.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
@@ -4270,7 +4287,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4270
4287
|
if (!e || typeof e != "object") return;
|
|
4271
4288
|
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
4272
4289
|
if (!n(e.symbol)) return;
|
|
4273
|
-
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i =
|
|
4290
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = bi({
|
|
4274
4291
|
...r,
|
|
4275
4292
|
...e,
|
|
4276
4293
|
symbol: e.symbol || r?.symbol || t
|
|
@@ -4309,7 +4326,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4309
4326
|
return this.sessionShading.isVisible();
|
|
4310
4327
|
}
|
|
4311
4328
|
setSessionShadingConfig(e) {
|
|
4312
|
-
this.hostSessionHours =
|
|
4329
|
+
this.hostSessionHours = zt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(i.Background);
|
|
4313
4330
|
}
|
|
4314
4331
|
setTooltipVisible(e) {
|
|
4315
4332
|
e || this.crosshairTooltip.hide();
|
|
@@ -4331,11 +4348,11 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4331
4348
|
return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
|
|
4332
4349
|
}
|
|
4333
4350
|
async takeGpu(e, t, n) {
|
|
4334
|
-
let { gpu: r, reason: i } = await
|
|
4351
|
+
let { gpu: r, reason: i } = await Rt(e);
|
|
4335
4352
|
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? Nt() > 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());
|
|
4336
4353
|
}
|
|
4337
4354
|
waitForGpu(e) {
|
|
4338
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
4355
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Zt(e) : null;
|
|
4339
4356
|
}
|
|
4340
4357
|
getRenderer() {
|
|
4341
4358
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -4505,7 +4522,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4505
4522
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
4506
4523
|
if (!this.replaySession) {
|
|
4507
4524
|
if (this.series.length() === 0) return;
|
|
4508
|
-
this.series.beginReplay(), this.replaySession =
|
|
4525
|
+
this.series.beginReplay(), this.replaySession = Li(this.currentSymbol);
|
|
4509
4526
|
}
|
|
4510
4527
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4511
4528
|
c.animate = c.animate === !0;
|
|
@@ -4516,13 +4533,13 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4516
4533
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4517
4534
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4518
4535
|
let h = this.replayStepsSeries;
|
|
4519
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4536
|
+
h && c.startIndex !== void 0 && (c.startIndex = Wi(h, p, c.startIndex));
|
|
4520
4537
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4521
4538
|
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);
|
|
4522
4539
|
}
|
|
4523
4540
|
buildReplay(e, t, n) {
|
|
4524
4541
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4525
|
-
this.replayPieces = r && t ?
|
|
4542
|
+
this.replayPieces = r && t ? qi(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4526
4543
|
let a = this.replayRestarting;
|
|
4527
4544
|
this.replayRestarting = !0;
|
|
4528
4545
|
try {
|
|
@@ -4536,7 +4553,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4536
4553
|
let n = t, a = e[t];
|
|
4537
4554
|
if (i) {
|
|
4538
4555
|
let r = i[t];
|
|
4539
|
-
n = Q(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ?
|
|
4556
|
+
n = Q(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? Yi(c, r) : Gi(e[n], i, t), a = Ki(i, e, t, n) ? e[n] : c;
|
|
4540
4557
|
}
|
|
4541
4558
|
let u = this.replayForming;
|
|
4542
4559
|
this.replayForming = null, s = t;
|
|
@@ -4560,7 +4577,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4560
4577
|
});
|
|
4561
4578
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4562
4579
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4563
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4580
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Ji() ? ni(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = ti(r, i);
|
|
4564
4581
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4565
4582
|
index: t,
|
|
4566
4583
|
path: r
|
|
@@ -4578,19 +4595,19 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4578
4595
|
}
|
|
4579
4596
|
replayPathOf(e, t) {
|
|
4580
4597
|
let n = e[t];
|
|
4581
|
-
return
|
|
4598
|
+
return Xr(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4582
4599
|
}
|
|
4583
4600
|
loadReplaySteps(e, t) {
|
|
4584
4601
|
let n = this.replayLoader?.loader;
|
|
4585
4602
|
if (!n) return;
|
|
4586
4603
|
n.evictBefore(e[t].time);
|
|
4587
4604
|
let r = this.replayManager.getStepMs();
|
|
4588
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
4605
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(Ni / r) : 1);
|
|
4589
4606
|
}
|
|
4590
4607
|
useReplayLoader(e, t) {
|
|
4591
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4608
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? ai(e.step, r, (e) => j(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
4592
4609
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4593
|
-
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = T(r), u = new
|
|
4610
|
+
let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = T(r), u = new Ur({
|
|
4594
4611
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4595
4612
|
step: i,
|
|
4596
4613
|
ratio: Math.max(1, Math.round(l / T(i))),
|
|
@@ -4606,7 +4623,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4606
4623
|
feedReplayForming(e, t, n, r) {
|
|
4607
4624
|
let i = this.replaySession;
|
|
4608
4625
|
if (!i || !this.executionAdapter?.setMarkPrice) return;
|
|
4609
|
-
let a =
|
|
4626
|
+
let a = gi(e, t, n, r, {
|
|
4610
4627
|
time: i.fedTime,
|
|
4611
4628
|
fraction: i.fedFraction
|
|
4612
4629
|
}, (e, t) => this.replayPathOf(e, t));
|
|
@@ -4630,7 +4647,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4630
4647
|
if (n.length === 0) return;
|
|
4631
4648
|
let r = t.windowTime === null ? 0 : Math.min(J(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4632
4649
|
this.useReplayLoader(t, !1);
|
|
4633
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4650
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Bi(o ?? i, t.until);
|
|
4634
4651
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4635
4652
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4636
4653
|
return;
|
|
@@ -4638,7 +4655,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4638
4655
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4639
4656
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4640
4657
|
let d = this.replayManager.remainingMs();
|
|
4641
|
-
this.clearBarHolders(), t.animate &&
|
|
4658
|
+
this.clearBarHolders(), t.animate && zi(t, this.replayCoarse, i);
|
|
4642
4659
|
let f = this.replayRestarting;
|
|
4643
4660
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4644
4661
|
try {
|
|
@@ -4661,14 +4678,14 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4661
4678
|
}
|
|
4662
4679
|
replayStepsOver(e, t, n = !1) {
|
|
4663
4680
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4664
|
-
let r =
|
|
4665
|
-
return r && (n ||
|
|
4681
|
+
let r = Ui(this.series.inHoursShown(e.steps), t);
|
|
4682
|
+
return r && (n || Hi(r, t)) ? r : null;
|
|
4666
4683
|
}
|
|
4667
4684
|
canPageBackForReplay(e) {
|
|
4668
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4685
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < Pi;
|
|
4669
4686
|
}
|
|
4670
4687
|
async pageBackForReplay(e) {
|
|
4671
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4688
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = Pi, this.rebaseReplay("older"));
|
|
4672
4689
|
}
|
|
4673
4690
|
holdReplay() {
|
|
4674
4691
|
let e = this.replaySession;
|
|
@@ -4701,7 +4718,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4701
4718
|
this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4702
4719
|
}
|
|
4703
4720
|
replaySeekToTime(e) {
|
|
4704
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4721
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, Bi(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4705
4722
|
}
|
|
4706
4723
|
feedReplayPrice(e, t) {
|
|
4707
4724
|
let n = this.executionAdapter;
|
|
@@ -4716,7 +4733,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4716
4733
|
feedReplaySteps(e, t) {
|
|
4717
4734
|
let n = this.replaySession;
|
|
4718
4735
|
if (!n || !this.executionAdapter?.setMarkPrice) return;
|
|
4719
|
-
let r =
|
|
4736
|
+
let r = hi(e, t, {
|
|
4720
4737
|
time: n.fedTime,
|
|
4721
4738
|
fraction: n.fedFraction
|
|
4722
4739
|
});
|
|
@@ -4730,7 +4747,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4730
4747
|
}
|
|
4731
4748
|
replaySeekToBar(e) {
|
|
4732
4749
|
let t = this.replayStepsSeries;
|
|
4733
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4750
|
+
this.replaySeek(t && this.replayCoarse ? Wi(t, this.replayCoarse, e) : e);
|
|
4734
4751
|
}
|
|
4735
4752
|
replayPause() {
|
|
4736
4753
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4771,7 +4788,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4771
4788
|
let { x: r, y: c } = this.drawingManager.anchorPoint(t.type, e, n);
|
|
4772
4789
|
i = Math.min(i, r), a = Math.max(a, r), o = Math.min(o, c), s = Math.max(s, c);
|
|
4773
4790
|
}
|
|
4774
|
-
if (
|
|
4791
|
+
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;
|
|
4775
4792
|
let c = this.drawingManager.drawnExtent(e);
|
|
4776
4793
|
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 ? {
|
|
4777
4794
|
x: i,
|
|
@@ -4822,12 +4839,12 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4822
4839
|
});
|
|
4823
4840
|
}
|
|
4824
4841
|
restoreIndicators(e, t) {
|
|
4825
|
-
let n =
|
|
4842
|
+
let n = tr(e), r = /* @__PURE__ */ new Map();
|
|
4826
4843
|
this.unrestoredIndicators = [];
|
|
4827
4844
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4828
4845
|
if (t) {
|
|
4829
4846
|
let e = this.getIndicatorSetup();
|
|
4830
|
-
for (let t of
|
|
4847
|
+
for (let t of rr(e, n)) o.add(t);
|
|
4831
4848
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4832
4849
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4833
4850
|
for (let e = !0; e;) {
|
|
@@ -4838,7 +4855,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4838
4855
|
}
|
|
4839
4856
|
}
|
|
4840
4857
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4841
|
-
let s = (e) =>
|
|
4858
|
+
let s = (e) => ar(e, r);
|
|
4842
4859
|
for (let e of n) {
|
|
4843
4860
|
let n = null;
|
|
4844
4861
|
if (o.has(e.instanceId)) {
|
|
@@ -4871,7 +4888,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4871
4888
|
}
|
|
4872
4889
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
4873
4890
|
}
|
|
4874
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
4891
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), er(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
4875
4892
|
}
|
|
4876
4893
|
restoreLooks(e, t) {
|
|
4877
4894
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -4891,7 +4908,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4891
4908
|
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? se(t.paneStyle) : null);
|
|
4892
4909
|
}
|
|
4893
4910
|
getIndicatorSetup() {
|
|
4894
|
-
return [
|
|
4911
|
+
return [...$n(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
4895
4912
|
}
|
|
4896
4913
|
applyIndicatorSetup(e) {
|
|
4897
4914
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -4900,7 +4917,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4900
4917
|
});
|
|
4901
4918
|
}
|
|
4902
4919
|
followIndicatorAlerts(e, t) {
|
|
4903
|
-
this.features.alerts &&
|
|
4920
|
+
this.features.alerts && ci(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
4904
4921
|
}
|
|
4905
4922
|
beginIndicatorEdit(e) {
|
|
4906
4923
|
this.indicatorHistory.begin(e);
|
|
@@ -4924,17 +4941,17 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4924
4941
|
keptPaneDrawings = [];
|
|
4925
4942
|
replayingIndicatorStep = !1;
|
|
4926
4943
|
takesDrawing(e, t) {
|
|
4927
|
-
return
|
|
4944
|
+
return dr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
4928
4945
|
}
|
|
4929
4946
|
renamePane(e, t) {
|
|
4930
4947
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
4931
4948
|
}
|
|
4932
4949
|
drawingPaneAt(e) {
|
|
4933
|
-
return
|
|
4950
|
+
return lr(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
4934
4951
|
}
|
|
4935
4952
|
drawingPaneViewport(e) {
|
|
4936
4953
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
4937
|
-
return
|
|
4954
|
+
return ur(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
4938
4955
|
}
|
|
4939
4956
|
saveState(e) {
|
|
4940
4957
|
if (!this.features.saveLoad) return null;
|
|
@@ -4948,7 +4965,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
4948
4965
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
4949
4966
|
this.drawingManager.renamePanes(n);
|
|
4950
4967
|
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));
|
|
4951
|
-
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 &&
|
|
4968
|
+
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 && di(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
4952
4969
|
console.warn("Layout alert left out:", e);
|
|
4953
4970
|
}), this.markStateChanged();
|
|
4954
4971
|
}
|
|
@@ -5016,7 +5033,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5016
5033
|
this.disposed = !0, this.stopWatchingVisibility?.(), this.stopWatchingVisibility = null, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.labelWidths.destroy(), this.container.innerHTML = "";
|
|
5017
5034
|
}
|
|
5018
5035
|
createChartRenderer(e) {
|
|
5019
|
-
let t =
|
|
5036
|
+
let t = kn(e, (e) => this.pluginManager.getChartType(e));
|
|
5020
5037
|
return t instanceof ze && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5021
5038
|
}
|
|
5022
5039
|
crosshairSeries() {
|
|
@@ -5094,7 +5111,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5094
5111
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5095
5112
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5096
5113
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5097
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5114
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && Wn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5098
5115
|
});
|
|
5099
5116
|
}
|
|
5100
5117
|
updateViewportAndRender(e = !1) {
|
|
@@ -5109,7 +5126,7 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5109
5126
|
fitLeftAxisWidth() {
|
|
5110
5127
|
let e = this.leftViewport;
|
|
5111
5128
|
if (!e) return !1;
|
|
5112
|
-
let t = this.themeManager.getTheme(), n =
|
|
5129
|
+
let t = this.themeManager.getTheme(), n = Dr({
|
|
5113
5130
|
min: e.priceRange.min,
|
|
5114
5131
|
max: e.priceRange.max,
|
|
5115
5132
|
lastPrice: null,
|
|
@@ -5118,12 +5135,12 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5118
5135
|
fontFamily: t.font.family,
|
|
5119
5136
|
fontSizeSmall: t.font.sizeSmall,
|
|
5120
5137
|
measure: (e, t) => this.measureText(e, t)
|
|
5121
|
-
}), r =
|
|
5138
|
+
}), r = Or(this.leftAxisWidth, n);
|
|
5122
5139
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5123
5140
|
}
|
|
5124
5141
|
fitPriceAxisWidth() {
|
|
5125
5142
|
if (!this.features.priceAxis) return !1;
|
|
5126
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5143
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = Dr({
|
|
5127
5144
|
min: e.min,
|
|
5128
5145
|
max: e.max,
|
|
5129
5146
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5134,14 +5151,14 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5134
5151
|
fontFamily: t.font.family,
|
|
5135
5152
|
fontSizeSmall: t.font.sizeSmall,
|
|
5136
5153
|
measure: (e, t) => this.measureText(e, t)
|
|
5137
|
-
}), r =
|
|
5154
|
+
}), r = Or(this.priceAxisWidth, n);
|
|
5138
5155
|
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);
|
|
5139
5156
|
}
|
|
5140
5157
|
measureText(e, t) {
|
|
5141
5158
|
let n = this.engine.layerManager.getLayer(i.Main)?.ctx;
|
|
5142
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
5159
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => ki(n, e, t));
|
|
5143
5160
|
let r = n ?? this.detachedMeasureContext();
|
|
5144
|
-
return r ?
|
|
5161
|
+
return r ? ki(r, e, t) : e.length * 7;
|
|
5145
5162
|
}
|
|
5146
5163
|
detachedMeasureContext() {
|
|
5147
5164
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -5223,12 +5240,13 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5223
5240
|
paneTitles: this.paneTitles,
|
|
5224
5241
|
indicatorValueLabels: this.features.indicatorValueLabels,
|
|
5225
5242
|
alignAxisLabels: this.features.alignAxisLabels,
|
|
5243
|
+
drawingAxisSpans: this.features.drawingAxisSpans,
|
|
5226
5244
|
formatPrice: (e) => this.formatPrice(e),
|
|
5227
5245
|
renderOverlayPlugins: (e, t) => this.drawOverlayPlugins(e, t)
|
|
5228
5246
|
});
|
|
5229
5247
|
}
|
|
5230
5248
|
drawOverlayPlugins(e, t) {
|
|
5231
|
-
let n =
|
|
5249
|
+
let n = Nr(this.pluginManager.getOverlays(), t);
|
|
5232
5250
|
if (n.length === 0) return;
|
|
5233
5251
|
let r = {
|
|
5234
5252
|
viewport: this.viewport.getState(),
|
|
@@ -5249,15 +5267,15 @@ var yi = .08, bi = 20, xi = 8, Si = 10, Ci = {
|
|
|
5249
5267
|
};
|
|
5250
5268
|
}
|
|
5251
5269
|
};
|
|
5252
|
-
function
|
|
5270
|
+
function ki(e, t, n) {
|
|
5253
5271
|
let r = e.font;
|
|
5254
5272
|
e.font = n;
|
|
5255
5273
|
let i = e.measureText(t).width;
|
|
5256
5274
|
return e.font = r, i;
|
|
5257
5275
|
}
|
|
5258
|
-
var
|
|
5259
|
-
function
|
|
5260
|
-
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <=
|
|
5276
|
+
var Ai = 300;
|
|
5277
|
+
function ji(e) {
|
|
5278
|
+
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <= Ai && !/[;{}<>\\]|\/\*/.test(e);
|
|
5261
5279
|
n(e.family) && (t.family = e.family), n(e.textFamily) && (t.textFamily = e.textFamily);
|
|
5262
5280
|
for (let n of [
|
|
5263
5281
|
"sizeSmall",
|
|
@@ -5269,7 +5287,7 @@ function ki(e) {
|
|
|
5269
5287
|
}
|
|
5270
5288
|
return t;
|
|
5271
5289
|
}
|
|
5272
|
-
function
|
|
5290
|
+
function Mi(e) {
|
|
5273
5291
|
let t = e.tagRadius;
|
|
5274
5292
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
5275
5293
|
}
|
|
@@ -5288,8 +5306,8 @@ function X(e) {
|
|
|
5288
5306
|
bars: e.bars
|
|
5289
5307
|
};
|
|
5290
5308
|
}
|
|
5291
|
-
var
|
|
5292
|
-
function
|
|
5309
|
+
var Ni = 8e3, Pi = 10, Fi = 50, Ii = .001;
|
|
5310
|
+
function Li(e) {
|
|
5293
5311
|
return {
|
|
5294
5312
|
price: null,
|
|
5295
5313
|
fedTime: null,
|
|
@@ -5304,36 +5322,36 @@ function Fi(e) {
|
|
|
5304
5322
|
held: null
|
|
5305
5323
|
};
|
|
5306
5324
|
}
|
|
5307
|
-
function
|
|
5325
|
+
function Ri(e, t) {
|
|
5308
5326
|
let n = e[t + 1];
|
|
5309
5327
|
return n ? n.time - e[t].time : Z(e);
|
|
5310
5328
|
}
|
|
5311
|
-
function
|
|
5329
|
+
function zi(e, t, n) {
|
|
5312
5330
|
let r = e.fedTime;
|
|
5313
5331
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5314
|
-
let i =
|
|
5332
|
+
let i = Ri(t, Q(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Q(n, a), s = n[o].time;
|
|
5315
5333
|
if (s > a) return;
|
|
5316
|
-
let c =
|
|
5334
|
+
let c = Ri(n, o);
|
|
5317
5335
|
if (a === s && o > 0) {
|
|
5318
5336
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
5319
5337
|
return;
|
|
5320
5338
|
}
|
|
5321
5339
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5322
5340
|
}
|
|
5323
|
-
function
|
|
5341
|
+
function Bi(e, t) {
|
|
5324
5342
|
let n = Y(e, t), r = e.length - 1;
|
|
5325
5343
|
return n > r && r >= 0 && e[r].time + Z(e) <= t ? r : Math.max(-1, n - 2);
|
|
5326
5344
|
}
|
|
5327
|
-
function
|
|
5345
|
+
function Vi(e) {
|
|
5328
5346
|
let t = Infinity;
|
|
5329
5347
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
5330
5348
|
return t;
|
|
5331
5349
|
}
|
|
5332
|
-
function
|
|
5333
|
-
if (!(
|
|
5334
|
-
let n = Math.max(0, e.length -
|
|
5350
|
+
function Hi(e, t) {
|
|
5351
|
+
if (!(Vi(e) < Vi(t))) return !1;
|
|
5352
|
+
let n = Math.max(0, e.length - Fi);
|
|
5335
5353
|
for (let r = n; r < e.length; r++) {
|
|
5336
|
-
let n = t[Q(t, e[r].time)], i = (n.high - n.low) *
|
|
5354
|
+
let n = t[Q(t, e[r].time)], i = (n.high - n.low) * Ii + 2 ** -52;
|
|
5337
5355
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5338
5356
|
}
|
|
5339
5357
|
return !0;
|
|
@@ -5343,9 +5361,9 @@ function Z(e) {
|
|
|
5343
5361
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5344
5362
|
return t > 0 ? t : Infinity;
|
|
5345
5363
|
}
|
|
5346
|
-
function
|
|
5364
|
+
function Ui(e, t) {
|
|
5347
5365
|
if (t.length === 0) return null;
|
|
5348
|
-
let n = t[t.length - 1].time + Z(t), r = e.filter((e) =>
|
|
5366
|
+
let n = t[t.length - 1].time + Z(t), r = e.filter((e) => zn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5349
5367
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5350
5368
|
if (i.length === 0) return null;
|
|
5351
5369
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5361,26 +5379,26 @@ function Q(e, t) {
|
|
|
5361
5379
|
}
|
|
5362
5380
|
return n;
|
|
5363
5381
|
}
|
|
5364
|
-
function
|
|
5382
|
+
function Wi(e, t, n) {
|
|
5365
5383
|
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;
|
|
5366
5384
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5367
5385
|
return Math.max(0, a);
|
|
5368
5386
|
}
|
|
5369
|
-
function
|
|
5387
|
+
function Gi(e, t, n) {
|
|
5370
5388
|
let r = n;
|
|
5371
5389
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5372
5390
|
let i = {
|
|
5373
5391
|
...t[r],
|
|
5374
5392
|
time: e.time
|
|
5375
5393
|
};
|
|
5376
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5394
|
+
for (let e = r + 1; e <= n; e++) i = Yi(i, t[e]);
|
|
5377
5395
|
return i;
|
|
5378
5396
|
}
|
|
5379
|
-
function
|
|
5397
|
+
function Ki(e, t, n, r) {
|
|
5380
5398
|
let i = e[n + 1], a = t[r + 1];
|
|
5381
5399
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5382
5400
|
}
|
|
5383
|
-
function
|
|
5401
|
+
function qi(e, t) {
|
|
5384
5402
|
let n = /* @__PURE__ */ new Map();
|
|
5385
5403
|
for (let r of e) {
|
|
5386
5404
|
let e = t[Q(t, r.time)].time, i = n.get(e);
|
|
@@ -5388,10 +5406,10 @@ function Gi(e, t) {
|
|
|
5388
5406
|
}
|
|
5389
5407
|
return n;
|
|
5390
5408
|
}
|
|
5391
|
-
function
|
|
5409
|
+
function Ji() {
|
|
5392
5410
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5393
5411
|
}
|
|
5394
|
-
function
|
|
5412
|
+
function Yi(e, t) {
|
|
5395
5413
|
return {
|
|
5396
5414
|
time: e.time,
|
|
5397
5415
|
open: e.open,
|
|
@@ -5403,26 +5421,26 @@ function qi(e, t) {
|
|
|
5403
5421
|
}
|
|
5404
5422
|
//#endregion
|
|
5405
5423
|
//#region src/io/parseOHLCV.ts
|
|
5406
|
-
var
|
|
5424
|
+
var Xi = [
|
|
5407
5425
|
"time",
|
|
5408
5426
|
"timestamp",
|
|
5409
5427
|
"date",
|
|
5410
5428
|
"datetime",
|
|
5411
5429
|
"t"
|
|
5412
|
-
],
|
|
5430
|
+
], Zi = ["open", "o"], Qi = ["high", "h"], $i = ["low", "l"], ea = ["close", "c"], ta = [
|
|
5413
5431
|
"volume",
|
|
5414
5432
|
"vol",
|
|
5415
5433
|
"v"
|
|
5416
5434
|
];
|
|
5417
|
-
function
|
|
5435
|
+
function na(e) {
|
|
5418
5436
|
let t = e.trim();
|
|
5419
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5437
|
+
return t ? t[0] === "[" || t[0] === "{" ? ra(t) : ia(t) : {
|
|
5420
5438
|
data: [],
|
|
5421
5439
|
rowCount: 0,
|
|
5422
5440
|
skipped: 0
|
|
5423
5441
|
};
|
|
5424
5442
|
}
|
|
5425
|
-
function
|
|
5443
|
+
function ra(e) {
|
|
5426
5444
|
let t;
|
|
5427
5445
|
try {
|
|
5428
5446
|
t = JSON.parse(e);
|
|
@@ -5432,19 +5450,19 @@ function ta(e) {
|
|
|
5432
5450
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5433
5451
|
let n = [], r = 0;
|
|
5434
5452
|
for (let e of t) {
|
|
5435
|
-
let t = Array.isArray(e) ?
|
|
5453
|
+
let t = Array.isArray(e) ? la(e) : ca(e);
|
|
5436
5454
|
t ? n.push(t) : r++;
|
|
5437
5455
|
}
|
|
5438
|
-
return
|
|
5456
|
+
return da(n, t.length, r);
|
|
5439
5457
|
}
|
|
5440
|
-
function
|
|
5458
|
+
function ia(e) {
|
|
5441
5459
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5442
5460
|
if (t.length === 0) return {
|
|
5443
5461
|
data: [],
|
|
5444
5462
|
rowCount: 0,
|
|
5445
5463
|
skipped: 0
|
|
5446
5464
|
};
|
|
5447
|
-
let n =
|
|
5465
|
+
let n = aa(t[0]), r = oa(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? sa(r) : {
|
|
5448
5466
|
time: 0,
|
|
5449
5467
|
open: 1,
|
|
5450
5468
|
high: 2,
|
|
@@ -5455,7 +5473,7 @@ function na(e) {
|
|
|
5455
5473
|
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");
|
|
5456
5474
|
let o = [], s = 0;
|
|
5457
5475
|
for (let e = +!!i; e < t.length; e++) {
|
|
5458
|
-
let r =
|
|
5476
|
+
let r = oa(t[e], n), i = ua(r[a.time]), c = $(r[a.open]), l = $(r[a.high]), u = $(r[a.low]), d = $(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
5459
5477
|
if (i === null || ![
|
|
5460
5478
|
c,
|
|
5461
5479
|
l,
|
|
@@ -5474,9 +5492,9 @@ function na(e) {
|
|
|
5474
5492
|
volume: Number.isFinite(f) ? f : 0
|
|
5475
5493
|
});
|
|
5476
5494
|
}
|
|
5477
|
-
return
|
|
5495
|
+
return da(o, t.length - +!!i, s);
|
|
5478
5496
|
}
|
|
5479
|
-
function
|
|
5497
|
+
function aa(e) {
|
|
5480
5498
|
let t = {
|
|
5481
5499
|
",": 0,
|
|
5482
5500
|
";": 0,
|
|
@@ -5488,7 +5506,7 @@ function ra(e) {
|
|
|
5488
5506
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5489
5507
|
return n;
|
|
5490
5508
|
}
|
|
5491
|
-
function
|
|
5509
|
+
function oa(e, t) {
|
|
5492
5510
|
let n = [], r = "", i = !1;
|
|
5493
5511
|
for (let a = 0; a < e.length; a++) {
|
|
5494
5512
|
let o = e[a];
|
|
@@ -5496,25 +5514,25 @@ function ia(e, t) {
|
|
|
5496
5514
|
}
|
|
5497
5515
|
return n.push(r), n;
|
|
5498
5516
|
}
|
|
5499
|
-
function
|
|
5517
|
+
function sa(e) {
|
|
5500
5518
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5501
5519
|
return {
|
|
5502
|
-
time: t(
|
|
5503
|
-
open: t(
|
|
5504
|
-
high: t(
|
|
5505
|
-
low: t(
|
|
5506
|
-
close: t(
|
|
5507
|
-
volume: t(
|
|
5520
|
+
time: t(Xi),
|
|
5521
|
+
open: t(Zi),
|
|
5522
|
+
high: t(Qi),
|
|
5523
|
+
low: t($i),
|
|
5524
|
+
close: t(ea),
|
|
5525
|
+
volume: t(ta)
|
|
5508
5526
|
};
|
|
5509
5527
|
}
|
|
5510
|
-
function
|
|
5528
|
+
function ca(e) {
|
|
5511
5529
|
let t = (t) => {
|
|
5512
5530
|
for (let n of t) {
|
|
5513
5531
|
if (e[n] !== void 0) return e[n];
|
|
5514
5532
|
let t = n.toUpperCase();
|
|
5515
5533
|
if (e[t] !== void 0) return e[t];
|
|
5516
5534
|
}
|
|
5517
|
-
}, n =
|
|
5535
|
+
}, n = ua(String(t(Xi) ?? "")), r = Number(t(Zi)), i = Number(t(Qi)), a = Number(t($i)), o = Number(t(ea)), s = Number(t(ta) ?? 0);
|
|
5518
5536
|
return n === null || ![
|
|
5519
5537
|
r,
|
|
5520
5538
|
i,
|
|
@@ -5529,9 +5547,9 @@ function oa(e) {
|
|
|
5529
5547
|
volume: Number.isFinite(s) ? s : 0
|
|
5530
5548
|
};
|
|
5531
5549
|
}
|
|
5532
|
-
function
|
|
5550
|
+
function la(e) {
|
|
5533
5551
|
if (e.length < 5) return null;
|
|
5534
|
-
let t =
|
|
5552
|
+
let t = ua(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;
|
|
5535
5553
|
return t === null || ![
|
|
5536
5554
|
n,
|
|
5537
5555
|
r,
|
|
@@ -5549,7 +5567,7 @@ function sa(e) {
|
|
|
5549
5567
|
function $(e) {
|
|
5550
5568
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5551
5569
|
}
|
|
5552
|
-
function
|
|
5570
|
+
function ua(e) {
|
|
5553
5571
|
let t = e.trim();
|
|
5554
5572
|
if (!t) return null;
|
|
5555
5573
|
let n = Number(t);
|
|
@@ -5557,7 +5575,7 @@ function ca(e) {
|
|
|
5557
5575
|
let r = Date.parse(t);
|
|
5558
5576
|
return Number.isFinite(r) ? r : null;
|
|
5559
5577
|
}
|
|
5560
|
-
function
|
|
5578
|
+
function da(e, t, n) {
|
|
5561
5579
|
e.sort((e, t) => e.time - t.time);
|
|
5562
5580
|
let r = [];
|
|
5563
5581
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5569,7 +5587,7 @@ function la(e, t, n) {
|
|
|
5569
5587
|
}
|
|
5570
5588
|
//#endregion
|
|
5571
5589
|
//#region src/io/DragDropImporter.ts
|
|
5572
|
-
var
|
|
5590
|
+
var fa = class {
|
|
5573
5591
|
host;
|
|
5574
5592
|
overlay = null;
|
|
5575
5593
|
callbacks;
|
|
@@ -5590,19 +5608,19 @@ var ua = class {
|
|
|
5590
5608
|
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();
|
|
5591
5609
|
}
|
|
5592
5610
|
onDragEnter(e) {
|
|
5593
|
-
|
|
5611
|
+
pa(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5594
5612
|
}
|
|
5595
5613
|
onDragOver(e) {
|
|
5596
|
-
|
|
5614
|
+
pa(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5597
5615
|
}
|
|
5598
5616
|
onDragLeave(e) {
|
|
5599
|
-
|
|
5617
|
+
pa(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5600
5618
|
}
|
|
5601
5619
|
async onDrop(e) {
|
|
5602
5620
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5603
5621
|
let t = e.dataTransfer?.files?.[0];
|
|
5604
5622
|
if (t) try {
|
|
5605
|
-
let e =
|
|
5623
|
+
let e = na(await t.text());
|
|
5606
5624
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5607
5625
|
this.callbacks.onData(e.data, e, t);
|
|
5608
5626
|
} catch (e) {
|
|
@@ -5633,12 +5651,12 @@ var ua = class {
|
|
|
5633
5651
|
this.overlay?.remove(), this.overlay = null;
|
|
5634
5652
|
}
|
|
5635
5653
|
};
|
|
5636
|
-
function
|
|
5654
|
+
function pa(e) {
|
|
5637
5655
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5638
5656
|
}
|
|
5639
5657
|
//#endregion
|
|
5640
5658
|
//#region src/state/layoutStorage.ts
|
|
5641
|
-
function
|
|
5659
|
+
function ma(e) {
|
|
5642
5660
|
let t = {
|
|
5643
5661
|
id: e.id,
|
|
5644
5662
|
name: e.name,
|
|
@@ -5646,11 +5664,11 @@ function fa(e) {
|
|
|
5646
5664
|
};
|
|
5647
5665
|
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;
|
|
5648
5666
|
}
|
|
5649
|
-
var
|
|
5650
|
-
function
|
|
5667
|
+
var ha = (e, t) => t.updatedAt - e.updatedAt;
|
|
5668
|
+
function ga(e) {
|
|
5651
5669
|
if (typeof e != "object" || !e) return null;
|
|
5652
5670
|
let t = e;
|
|
5653
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
5671
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : ma({
|
|
5654
5672
|
id: t.id,
|
|
5655
5673
|
name: t.name,
|
|
5656
5674
|
updatedAt: t.updatedAt,
|
|
@@ -5659,17 +5677,17 @@ function ma(e) {
|
|
|
5659
5677
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
5660
5678
|
});
|
|
5661
5679
|
}
|
|
5662
|
-
function
|
|
5663
|
-
let t =
|
|
5680
|
+
function _a(e) {
|
|
5681
|
+
let t = ga(e), n = t ? e.content : void 0;
|
|
5664
5682
|
return t && typeof n == "string" ? {
|
|
5665
5683
|
...t,
|
|
5666
5684
|
content: n
|
|
5667
5685
|
} : null;
|
|
5668
5686
|
}
|
|
5669
|
-
function
|
|
5687
|
+
function va(e = []) {
|
|
5670
5688
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
5671
5689
|
return {
|
|
5672
|
-
list: () => [...t.values()].map(
|
|
5690
|
+
list: () => [...t.values()].map(ma).sort(ha),
|
|
5673
5691
|
load: (e) => {
|
|
5674
5692
|
let n = t.get(e);
|
|
5675
5693
|
return n ? { ...n } : null;
|
|
@@ -5682,7 +5700,7 @@ function ga(e = []) {
|
|
|
5682
5700
|
}
|
|
5683
5701
|
};
|
|
5684
5702
|
}
|
|
5685
|
-
function
|
|
5703
|
+
function ya(e = "tcw:layouts:") {
|
|
5686
5704
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
5687
5705
|
let e;
|
|
5688
5706
|
try {
|
|
@@ -5690,10 +5708,10 @@ function _a(e = "tcw:layouts:") {
|
|
|
5690
5708
|
} catch {
|
|
5691
5709
|
return [];
|
|
5692
5710
|
}
|
|
5693
|
-
return Array.isArray(e) ? e.map(
|
|
5711
|
+
return Array.isArray(e) ? e.map(ga).filter((e) => e !== null) : [];
|
|
5694
5712
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
5695
5713
|
return {
|
|
5696
|
-
list: () => r().sort(
|
|
5714
|
+
list: () => r().sort(ha),
|
|
5697
5715
|
load: (e) => {
|
|
5698
5716
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
5699
5717
|
return t && i !== null ? {
|
|
@@ -5702,7 +5720,7 @@ function _a(e = "tcw:layouts:") {
|
|
|
5702
5720
|
} : null;
|
|
5703
5721
|
},
|
|
5704
5722
|
save: (e) => {
|
|
5705
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
5723
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), ma(e)]);
|
|
5706
5724
|
},
|
|
5707
5725
|
remove: (e) => {
|
|
5708
5726
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -5711,14 +5729,14 @@ function _a(e = "tcw:layouts:") {
|
|
|
5711
5729
|
}
|
|
5712
5730
|
//#endregion
|
|
5713
5731
|
//#region src/state/LayoutSession.ts
|
|
5714
|
-
var
|
|
5715
|
-
function
|
|
5732
|
+
var ba = 80;
|
|
5733
|
+
function xa(e) {
|
|
5716
5734
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
5717
5735
|
}
|
|
5718
|
-
function
|
|
5736
|
+
function Sa() {
|
|
5719
5737
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
5720
5738
|
}
|
|
5721
|
-
function
|
|
5739
|
+
function Ca(e) {
|
|
5722
5740
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
5723
5741
|
return {
|
|
5724
5742
|
id: t,
|
|
@@ -5729,7 +5747,7 @@ function xa(e) {
|
|
|
5729
5747
|
...o === void 0 ? {} : { kind: o }
|
|
5730
5748
|
};
|
|
5731
5749
|
}
|
|
5732
|
-
var
|
|
5750
|
+
var wa = class {
|
|
5733
5751
|
currentLayout = null;
|
|
5734
5752
|
savedContent = null;
|
|
5735
5753
|
dirty = !1;
|
|
@@ -5745,7 +5763,7 @@ var Sa = class {
|
|
|
5745
5763
|
now;
|
|
5746
5764
|
newId;
|
|
5747
5765
|
constructor(e, t, n = {}) {
|
|
5748
|
-
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 ??
|
|
5766
|
+
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 ?? Sa;
|
|
5749
5767
|
}
|
|
5750
5768
|
current() {
|
|
5751
5769
|
return this.currentLayout;
|
|
@@ -5761,7 +5779,7 @@ var Sa = class {
|
|
|
5761
5779
|
}
|
|
5762
5780
|
async list() {
|
|
5763
5781
|
let e = await this.storage.list();
|
|
5764
|
-
return Array.isArray(e) ? e.map(
|
|
5782
|
+
return Array.isArray(e) ? e.map(ga).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
5765
5783
|
}
|
|
5766
5784
|
save() {
|
|
5767
5785
|
return this.queue(() => {
|
|
@@ -5770,12 +5788,12 @@ var Sa = class {
|
|
|
5770
5788
|
});
|
|
5771
5789
|
}
|
|
5772
5790
|
saveAs(e) {
|
|
5773
|
-
let t =
|
|
5791
|
+
let t = xa(e);
|
|
5774
5792
|
return t ? this.queue(() => this.write(this.newId(), t)) : Promise.reject(/* @__PURE__ */ Error("A layout needs a name"));
|
|
5775
5793
|
}
|
|
5776
5794
|
open(e) {
|
|
5777
5795
|
return this.queue(async () => {
|
|
5778
|
-
let t =
|
|
5796
|
+
let t = _a(await this.storage.load(e));
|
|
5779
5797
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
5780
5798
|
this.cancelTimer(), this.applying++;
|
|
5781
5799
|
try {
|
|
@@ -5785,13 +5803,13 @@ var Sa = class {
|
|
|
5785
5803
|
} finally {
|
|
5786
5804
|
this.applying--;
|
|
5787
5805
|
}
|
|
5788
|
-
return this.cancelTimer(), this.currentLayout =
|
|
5806
|
+
return this.cancelTimer(), this.currentLayout = Ca(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
5789
5807
|
});
|
|
5790
5808
|
}
|
|
5791
5809
|
rename(e, t) {
|
|
5792
|
-
let n =
|
|
5810
|
+
let n = xa(t);
|
|
5793
5811
|
return n ? this.queue(async () => {
|
|
5794
|
-
let t =
|
|
5812
|
+
let t = _a(await this.storage.load(e));
|
|
5795
5813
|
!t || t.id !== e || (await this.storage.save({
|
|
5796
5814
|
...t,
|
|
5797
5815
|
name: n
|
|
@@ -5869,7 +5887,7 @@ var Sa = class {
|
|
|
5869
5887
|
content: n.content
|
|
5870
5888
|
};
|
|
5871
5889
|
await this.storage.save(r);
|
|
5872
|
-
let i =
|
|
5890
|
+
let i = Ca(r);
|
|
5873
5891
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
5874
5892
|
}
|
|
5875
5893
|
forget() {
|
|
@@ -5890,6 +5908,6 @@ var Sa = class {
|
|
|
5890
5908
|
}
|
|
5891
5909
|
};
|
|
5892
5910
|
//#endregion
|
|
5893
|
-
export {
|
|
5911
|
+
export { mr as C, Nn as D, z as E, _r as S, Rn as T, Fr as _, va as a, G as b, Oi as c, ii as d, ai as f, Pr as g, Ir as h, ya as i, vi as l, Lr as m, ba as n, fa as o, Rr as p, xa as r, na as s, wa as t, _i as u, Mr as v, fr as w, Sr as x, Nr as y };
|
|
5894
5912
|
|
|
5895
|
-
//# sourceMappingURL=LayoutSession-
|
|
5913
|
+
//# sourceMappingURL=LayoutSession-CLlUszTA.js.map
|