@tradecanvas/chart 2.4.0 → 2.6.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 +41 -0
- package/dist/Chart.d.ts.map +1 -1
- package/dist/{LayoutSession-D7ztdedn.js → LayoutSession-D8TcwPy1.js} +510 -436
- package/dist/LayoutSession-D8TcwPy1.js.map +1 -0
- package/dist/LayoutSession-DDs1N5h2.cjs +2 -0
- package/dist/LayoutSession-DDs1N5h2.cjs.map +1 -0
- package/dist/{WidgetGoToDate-hcDtezRm.js → WidgetGoToDate-DnQxxvf1.js} +2 -2
- package/dist/{WidgetGoToDate-hcDtezRm.js.map → WidgetGoToDate-DnQxxvf1.js.map} +1 -1
- package/dist/{WidgetGoToDate-BNdngHlg.cjs → WidgetGoToDate-hNVxz-Zb.cjs} +2 -2
- package/dist/{WidgetGoToDate-BNdngHlg.cjs.map → WidgetGoToDate-hNVxz-Zb.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-DJQ5taqX.cjs → WidgetIndicatorPicker-DKxoB4Un.cjs} +2 -2
- package/dist/{WidgetIndicatorPicker-DJQ5taqX.cjs.map → WidgetIndicatorPicker-DKxoB4Un.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-BzV4Mm_W.js → WidgetIndicatorPicker-eK03W3LR.js} +2 -2
- package/dist/{WidgetIndicatorPicker-BzV4Mm_W.js.map → WidgetIndicatorPicker-eK03W3LR.js.map} +1 -1
- package/dist/{WidgetSymbolSearch-BOgfBOV6.cjs → WidgetSymbolSearch-C_yw9mLo.cjs} +2 -2
- package/dist/{WidgetSymbolSearch-BOgfBOV6.cjs.map → WidgetSymbolSearch-C_yw9mLo.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-BgFNnrV3.js → WidgetSymbolSearch-Dnkh_y4h.js} +2 -2
- package/dist/{WidgetSymbolSearch-BgFNnrV3.js.map → WidgetSymbolSearch-Dnkh_y4h.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -80
- package/dist/widget/ChartWidget.d.ts +5 -0
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetChartNav.d.ts +8 -0
- package/dist/widget/WidgetChartNav.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingEdit.d.ts +13 -0
- package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -1
- package/dist/widget/WidgetMarks.d.ts +60 -0
- package/dist/widget/WidgetMarks.d.ts.map +1 -0
- package/dist/widget/WidgetMenus.d.ts +2 -0
- package/dist/widget/WidgetMenus.d.ts.map +1 -1
- package/dist/widget/WidgetSelectionToolbar.d.ts +4 -0
- package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -1
- package/dist/widget/drawingMenu.d.ts +3 -1
- package/dist/widget/drawingMenu.d.ts.map +1 -1
- package/dist/widget/index.cjs +4 -3
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +1245 -1059
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/symbolInfoView.d.ts +9 -1
- package/dist/widget/symbolInfoView.d.ts.map +1 -1
- package/dist/widget/types.d.ts +8 -0
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widgetFeatures.d.ts +1 -1
- package/dist/widget/widgetFeatures.d.ts.map +1 -1
- package/dist/widgetFeatures-DpBWfQ8D.cjs +3 -0
- package/dist/widgetFeatures-DpBWfQ8D.cjs.map +1 -0
- package/dist/{widgetFeatures-BM6u0u74.js → widgetFeatures-sU-9JOSB.js} +3 -2
- package/dist/widgetFeatures-sU-9JOSB.js.map +1 -0
- package/package.json +3 -3
- package/dist/LayoutSession-D7ztdedn.js.map +0 -1
- package/dist/LayoutSession-ScBZ-Eci.cjs +0 -2
- package/dist/LayoutSession-ScBZ-Eci.cjs.map +0 -1
- package/dist/widgetFeatures-BM6u0u74.js.map +0 -1
- package/dist/widgetFeatures-BZ8OVPN2.cjs +0 -3
- package/dist/widgetFeatures-BZ8OVPN2.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as e } from "./indicatorLabel-BsidWCv1.js";
|
|
2
2
|
import { CHART_SPACING as t, DARK_THEME as n, DEFAULT_CHART_DENSITY as r, DEFAULT_PANEL_HEIGHT as i, LIGHT_THEME as a, LayerType as o, MIN_PANEL_HEIGHT as s, PRICE_AXIS_WIDTH as c, TIME_AXIS_HEIGHT as l, autoPricePrecision as u, barDateZone as d, barTimeUnit as f, barsAreDaily as p, chartStyleValue as m, computePriceLimits as h, computePriceRange as g, createMarketTheme as _, formatPrice as v, fractionTick as y, indicatorSource as b, isValidTimeZone as x, mergeBar as ee, niceNumber as te, normalizeBarTime as S, parseIndicatorSource as C, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as w, readIndicatorPlotStyles as ae, readPaneStyle as oe, resolveChartTheme as se, sessionMinute as T, setLocale as ce, stepDecimals as le, symbolTimeZone as ue, tickBarCount as de, timeframeToMs as E, zonedDateFormatter as fe } from "@tradecanvas/commons";
|
|
3
|
-
import { AlertDragHandler as pe, AlertManager as me, Animator as he, AreaRenderer as ge, AxisDragHandler as _e, BarCountdown as ve, BarRenderer as ye, BaselineRenderer as be, CandlestickRenderer as xe, ChartLegend as Se, ChartStateManager as D, CompareRenderer as
|
|
3
|
+
import { AlertDragHandler as pe, AlertManager as me, Animator as he, AreaRenderer as ge, AxisDragHandler as _e, BarCountdown as ve, BarRenderer as ye, BaselineRenderer as be, CandlestickRenderer as xe, ChartLegend as Se, ChartMarkManager as Ce, ChartStateManager as D, CompareRenderer as we, CompareSymbolIndicator as Te, CompareSymbolPaneIndicator as Ee, CorrelationCoefficientIndicator as De, CorrelationLogIndicator as Oe, CrosshairHandler as ke, CrosshairTooltip as Ae, CurrentPriceLine as je, DEFAULT_SESSION_HOURS as Me, DataExporter as O, DepthHeatmapRenderer as Ne, DrawingManager as Pe, DrawingRenderer as Fe, EquivolumeRenderer as Ie, EventBus as Le, GridRenderer as Re, HLCAreaRenderer as ze, HiLoRenderer as Be, HollowCandleRenderer as Ve, INDICATOR_WORKER_MIN_BARS as He, IndicatorEngine as Ue, InteractionManager as We, KagiRenderer as Ge, KeyboardHandler as Ke, LineRenderer as qe, LineWithMarkersRenderer as Je, MarketProfileRenderer as Ye, MeasureOverlay as Xe, PRICE_AXIS_ADD_STRIP as Ze, PanHandler as Qe, PaneResizeHandler as $e, PeriodLevelsRenderer as et, PinnedTooltip as tt, PivotMarkersRenderer as nt, PointAndFigureRenderer as rt, PriceAxis as it, PriceAxisAddButton as at, PriceLines as ot, RenderEngine as st, RenkoRenderer as ct, ReplayManager as lt, ResamplingAdapter as ut, ReshapeMemo as dt, SYMBOL_INDICATOR_IDS as ft, SYMBOL_ZONE_WAIT_MS as pt, Screenshot as k, SelectionBoxOverlay as mt, SessionBreaks as ht, SessionShading as gt, SignalMarkerManager as _t, SpreadIndicator as vt, StepLineRenderer as yt, StreamManager as bt, SymbolSeriesStore as xt, TimeAxis as St, TradeZoneManager as Ct, TradingManager as wt, TradingRenderer as Tt, UndoRedoManager as Et, Viewport as Dt, VolumeCandleRenderer as Ot, VolumeProfileRenderer as kt, VolumeRenderer as At, Watermark as jt, ZoomHandler as Mt, axisTimes as A, barTimeStepMs as Nt, findDominantSwing as Pt, gpuContextsLeft as Ft, idleCssCursor as It, indicatorWorkerPool as Lt, isCrosshairCursor as Rt, isPriceLevelAlert as zt, isRegularSession as Bt, loadWebGL as Vt, mergeSessionHours as Ht, pointAndFigureColumns as Ut, rangePresetStart as Wt, readAlertOptions as Gt, registerBuiltInDrawingTools as Kt, registerBuiltInIndicators as qt, servesTimeframe as Jt, sourceParam as j, streamAdapterOf as Yt, timestampToBarIndex as M, toHeikinAshi as Xt, toKagi as Zt, toLineBreak as Qt, toRangeBars as $t, toRenko as en, whenGpuContextFree as tn, withResampling as N, xToBarIndex as nn, xToTime as P, yToPrice as rn } from "@tradecanvas/core";
|
|
4
4
|
//#region src/regularHours.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
5
|
+
var an = 864e5, on = 10;
|
|
6
|
+
function sn(e, t) {
|
|
7
7
|
let n = ue(e);
|
|
8
8
|
if (!n || !x(n) || t.length < 2) return null;
|
|
9
9
|
let r = (e?.sessions ?? []).flatMap((e) => {
|
|
@@ -15,34 +15,34 @@ function on(e, t) {
|
|
|
15
15
|
});
|
|
16
16
|
if (r.length === 0) return null;
|
|
17
17
|
let i = f(t), a = Infinity;
|
|
18
|
-
for (let e = Math.max(1, t.length -
|
|
18
|
+
for (let e = Math.max(1, t.length - on); 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 < an)) 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) => Bt(e * i, o);
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/chartA11y.ts
|
|
33
|
-
var
|
|
33
|
+
var cn = {
|
|
34
34
|
role: "chart",
|
|
35
35
|
summary: "{what}. Last price {close}.",
|
|
36
36
|
empty: "Chart, no data.",
|
|
37
37
|
view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
|
|
38
38
|
bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
|
|
39
39
|
keys: "Arrow keys scroll and zoom, Home and End go to the start and the end. Comma and period read the bars one at a time."
|
|
40
|
-
}, F = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e),
|
|
40
|
+
}, F = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), ln = [
|
|
41
41
|
"role",
|
|
42
42
|
"aria-roledescription",
|
|
43
43
|
"aria-label",
|
|
44
44
|
"aria-describedby"
|
|
45
|
-
],
|
|
45
|
+
], un = 400, dn = 1e3, fn = class {
|
|
46
46
|
live;
|
|
47
47
|
help;
|
|
48
48
|
labels;
|
|
@@ -56,20 +56,20 @@ var sn = {
|
|
|
56
56
|
};
|
|
57
57
|
constructor(e, t, n = {}) {
|
|
58
58
|
this.container = e, this.source = t, this.labels = {
|
|
59
|
-
...
|
|
59
|
+
...cn,
|
|
60
60
|
...n
|
|
61
61
|
};
|
|
62
|
-
for (let t of
|
|
63
|
-
e.setAttribute("role", "application"), this.help =
|
|
62
|
+
for (let t of ln) this.before.set(t, e.getAttribute(t));
|
|
63
|
+
e.setAttribute("role", "application"), this.help = pn("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 = pn("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
|
+
...cn,
|
|
68
68
|
...e
|
|
69
69
|
}, this.applyLabels();
|
|
70
70
|
}
|
|
71
71
|
refresh(e = !1) {
|
|
72
|
-
let t =
|
|
72
|
+
let t = dn - (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 sn = {
|
|
|
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
|
+
}, un);
|
|
85
85
|
}
|
|
86
86
|
readBar(e) {
|
|
87
87
|
let t = this.source.bars();
|
|
@@ -100,7 +100,7 @@ var sn = {
|
|
|
100
100
|
high: a(i.high),
|
|
101
101
|
low: a(i.low),
|
|
102
102
|
close: a(i.close),
|
|
103
|
-
volume:
|
|
103
|
+
volume: mn(i.volume ?? 0)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
106
|
destroy() {
|
|
@@ -141,7 +141,7 @@ var sn = {
|
|
|
141
141
|
this.live.textContent = e;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
function
|
|
144
|
+
function pn(e, t) {
|
|
145
145
|
let n = document.createElement(e);
|
|
146
146
|
return n.className = t, Object.assign(n.style, {
|
|
147
147
|
position: "absolute",
|
|
@@ -155,57 +155,57 @@ function fn(e, t) {
|
|
|
155
155
|
border: "0"
|
|
156
156
|
}), n;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function mn(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 hn(e) {
|
|
164
164
|
switch (e) {
|
|
165
165
|
case "candlestick":
|
|
166
166
|
case "heikinAshi":
|
|
167
167
|
case "lineBreak":
|
|
168
168
|
case "rangeBars": return new xe();
|
|
169
|
-
case "line": return new
|
|
169
|
+
case "line": return new qe();
|
|
170
170
|
case "area": return new ge();
|
|
171
171
|
case "bar": return new ye();
|
|
172
|
-
case "hollowCandle": return new
|
|
172
|
+
case "hollowCandle": return new Ve();
|
|
173
173
|
case "baseline": return new be();
|
|
174
|
-
case "renko": return new
|
|
175
|
-
case "kagi": return new
|
|
176
|
-
case "pointAndFigure": return new
|
|
177
|
-
case "volumeCandles": return new
|
|
178
|
-
case "equivolume": return new
|
|
179
|
-
case "hlcArea": return new
|
|
180
|
-
case "stepLine": return new
|
|
181
|
-
case "lineWithMarkers": return new
|
|
182
|
-
case "hiLo": return new
|
|
174
|
+
case "renko": return new ct();
|
|
175
|
+
case "kagi": return new Ge();
|
|
176
|
+
case "pointAndFigure": return new rt();
|
|
177
|
+
case "volumeCandles": return new Ot();
|
|
178
|
+
case "equivolume": return new Ie();
|
|
179
|
+
case "hlcArea": return new ze();
|
|
180
|
+
case "stepLine": return new yt();
|
|
181
|
+
case "lineWithMarkers": return new Je();
|
|
182
|
+
case "hiLo": return new Be();
|
|
183
183
|
default: return new xe();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function gn(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 Xt(t);
|
|
190
190
|
case "renko": {
|
|
191
191
|
let e = n.renko?.boxSize;
|
|
192
|
-
return typeof e == "number" ?
|
|
192
|
+
return typeof e == "number" ? en(t, { brickSize: e }, i) : en(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 Qt(t, n.lineBreak?.lines ?? 3);
|
|
199
|
+
case "kagi": return Zt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent", i);
|
|
200
|
+
case "pointAndFigure": return vn(t, n, i).columns;
|
|
201
|
+
case "rangeBars": return $t(t, {
|
|
202
|
+
rangeSize: On(t, n, r),
|
|
203
203
|
includeForming: !0
|
|
204
204
|
}, i);
|
|
205
205
|
default: return t;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function _n(e) {
|
|
209
209
|
switch (e) {
|
|
210
210
|
case "heikinAshi":
|
|
211
211
|
case "renko":
|
|
@@ -217,71 +217,71 @@ function gn(e) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function I(e) {
|
|
220
|
-
return e !== "heikinAshi" &&
|
|
220
|
+
return e !== "heikinAshi" && _n(e);
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return
|
|
222
|
+
function vn(e, t = {}, n) {
|
|
223
|
+
return Ut(e, xn(e, t), t.pointAndFigure?.reversal ?? 3, n);
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
225
|
+
var yn = 50, bn = .01;
|
|
226
|
+
function xn(e, t = {}) {
|
|
227
227
|
let n = t.pointAndFigure?.boxSize;
|
|
228
228
|
if (typeof n == "number") return n;
|
|
229
|
-
let r =
|
|
230
|
-
return r > 0 ?
|
|
229
|
+
let r = Sn(e, e.length > 1 ? e.length - 1 : e.length);
|
|
230
|
+
return r > 0 ? Dn(te(r / yn, !0)) : Math.abs(e[e.length - 1]?.close ?? 0) * bn || 1;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Sn(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 Cn = 100, wn = 3, Tn = .01, En = 15, Dn = (e) => Number(e.toPrecision(En));
|
|
239
|
+
function On(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 >= wn ? An(e) : 0, a = Math.abs(e[e.length - 1]?.close ?? 0);
|
|
243
|
+
return Nn(Dn(te(i > 0 ? i : a * Tn || 1, !0)), n);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function kn(e) {
|
|
246
246
|
let t = e.length - 1;
|
|
247
247
|
return {
|
|
248
|
-
from: Math.max(0, t -
|
|
248
|
+
from: Math.max(0, t - Cn),
|
|
249
249
|
end: t
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
let { from: t, end: n } =
|
|
252
|
+
function An(e) {
|
|
253
|
+
let { from: t, end: n } = kn(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 jn(e, t) {
|
|
261
|
+
let { from: n, end: r } = kn(e);
|
|
262
262
|
if (r <= n) return t(e[e.length - 1]?.close ?? 0);
|
|
263
263
|
let i = -Infinity, a = Infinity;
|
|
264
264
|
for (let t = n; t < r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
|
|
265
|
-
return
|
|
266
|
-
}
|
|
267
|
-
function jn(e, t) {
|
|
268
|
-
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
265
|
+
return Mn(t(i), t(a));
|
|
269
266
|
}
|
|
270
267
|
function Mn(e, t) {
|
|
271
|
-
return
|
|
268
|
+
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
272
269
|
}
|
|
273
270
|
function Nn(e, t) {
|
|
271
|
+
return t === void 0 || !(t > 0) ? e : Dn(Math.max(1, Math.round(e / t)) * t);
|
|
272
|
+
}
|
|
273
|
+
function Pn(e, t) {
|
|
274
274
|
let n = t?.(e);
|
|
275
|
-
return n ? n.createRenderer() :
|
|
275
|
+
return n ? n.createRenderer() : hn(e);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Fn(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) : gn(e, t, r, i, a);
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/state/AutoSaveScheduler.ts
|
|
284
|
-
var
|
|
284
|
+
var In = class {
|
|
285
285
|
timer = null;
|
|
286
286
|
delayMs = 0;
|
|
287
287
|
key = null;
|
|
@@ -316,7 +316,7 @@ function L(e) {
|
|
|
316
316
|
let { open: t, high: n, low: r, close: i } = e;
|
|
317
317
|
return !(!isFinite(t) || !isFinite(n) || !isFinite(r) || !isFinite(i) || t < 0 || n < 0 || r < 0 || i < 0 || n < r || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Ln(e) {
|
|
320
320
|
return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
|
|
321
321
|
}
|
|
322
322
|
function R(e) {
|
|
@@ -330,24 +330,24 @@ function R(e) {
|
|
|
330
330
|
function z(e, t) {
|
|
331
331
|
return e === t || e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Rn(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 zn = {
|
|
341
341
|
index: -1,
|
|
342
342
|
changed: !1
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function Bn(e, t) {
|
|
345
345
|
if (e.length === 0) return t;
|
|
346
346
|
let n = S(t);
|
|
347
347
|
return f(e) === 1 ? n : n / 1e3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
let n =
|
|
349
|
+
function Vn(e, t) {
|
|
350
|
+
let n = Bn(e, t.time);
|
|
351
351
|
return n === t.time ? t : {
|
|
352
352
|
...t,
|
|
353
353
|
time: n
|
|
@@ -357,7 +357,7 @@ var B = class {
|
|
|
357
357
|
data = [];
|
|
358
358
|
changes = 0;
|
|
359
359
|
withSeriesTime(e) {
|
|
360
|
-
return
|
|
360
|
+
return Vn(this.data, e);
|
|
361
361
|
}
|
|
362
362
|
getData() {
|
|
363
363
|
return this.data;
|
|
@@ -369,7 +369,7 @@ var B = class {
|
|
|
369
369
|
let t = [];
|
|
370
370
|
for (let n = 0; n < e.length; n++) {
|
|
371
371
|
let r = e[n];
|
|
372
|
-
L(r) && t.push(
|
|
372
|
+
L(r) && t.push(Ln(r) ? r : R(r));
|
|
373
373
|
}
|
|
374
374
|
this.data = t, this.changes++;
|
|
375
375
|
}
|
|
@@ -378,7 +378,7 @@ var B = class {
|
|
|
378
378
|
for (let r = 0; r < e.length; r++) {
|
|
379
379
|
if (!L(e[r])) continue;
|
|
380
380
|
let i = this.withSeriesTime(e[r]);
|
|
381
|
-
i.time >= t || n.push(
|
|
381
|
+
i.time >= t || n.push(Ln(i) ? i : R(i));
|
|
382
382
|
}
|
|
383
383
|
if (n.length === 0) return 0;
|
|
384
384
|
n.sort((e, t) => e.time - t.time);
|
|
@@ -399,9 +399,9 @@ var B = class {
|
|
|
399
399
|
this.data[this.data.length - 1] = t;
|
|
400
400
|
}
|
|
401
401
|
replaceBar(e) {
|
|
402
|
-
if (!L(e)) return
|
|
403
|
-
let t = this.withSeriesTime(e), n =
|
|
404
|
-
if (n < 0) return
|
|
402
|
+
if (!L(e)) return zn;
|
|
403
|
+
let t = this.withSeriesTime(e), n = Rn(this.data, t.time);
|
|
404
|
+
if (n < 0) return zn;
|
|
405
405
|
let r = R(t);
|
|
406
406
|
return z(this.data[n], r) ? {
|
|
407
407
|
index: n,
|
|
@@ -431,7 +431,7 @@ function H(e, t) {
|
|
|
431
431
|
let r = S(t.time), i = S(n.time);
|
|
432
432
|
return r > i ? "append" : r === i ? "update" : "stale";
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Hn(e) {
|
|
435
435
|
return [
|
|
436
436
|
e.time,
|
|
437
437
|
e.open,
|
|
@@ -440,7 +440,7 @@ function Vn(e) {
|
|
|
440
440
|
e.close
|
|
441
441
|
].every(Number.isFinite);
|
|
442
442
|
}
|
|
443
|
-
var
|
|
443
|
+
var Un = class {
|
|
444
444
|
shown = new B();
|
|
445
445
|
whole = null;
|
|
446
446
|
aside = null;
|
|
@@ -483,7 +483,7 @@ var Hn = 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(Hn).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 Hn = 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(Wn(this.aside.getData(), e) ?? e), this.onLiveChange({ kind: "series" }), !0;
|
|
499
|
+
let t = Wn(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 Hn = 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(Bn(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 Hn = class {
|
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
598
|
if (!L(e)) return V;
|
|
599
|
-
let t = this.inSeriesUnit(e), n = this.whole, r = n ?
|
|
599
|
+
let t = this.inSeriesUnit(e), n = this.whole, r = n ? Rn(n, t.time) : -1;
|
|
600
600
|
if (n) {
|
|
601
601
|
if (r < 0 || !L(n[r])) return V;
|
|
602
602
|
let e = this.hoursFilter(n);
|
|
@@ -630,7 +630,7 @@ var Hn = class {
|
|
|
630
630
|
this.shown.updateLastBar(e);
|
|
631
631
|
}
|
|
632
632
|
inSeriesUnit(e) {
|
|
633
|
-
return
|
|
633
|
+
return Vn(this.whole ?? this.shown.getData(), e);
|
|
634
634
|
}
|
|
635
635
|
replaceHidden(e, t, n) {
|
|
636
636
|
let r = R(n), i = !z(e[t], r);
|
|
@@ -667,14 +667,14 @@ var Hn = class {
|
|
|
667
667
|
return !r || r(e.time);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
function
|
|
670
|
+
function Wn(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 Gn = class {
|
|
678
678
|
auto;
|
|
679
679
|
preferred;
|
|
680
680
|
pending = !0;
|
|
@@ -711,7 +711,7 @@ var Wn = class {
|
|
|
711
711
|
}
|
|
712
712
|
fit(e, t, n, r) {
|
|
713
713
|
if (t.length === 0) return;
|
|
714
|
-
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o =
|
|
714
|
+
let i = Math.max(0, n.visibleRange.from), a = Math.min(n.visibleRange.to, t.length - 1), o = qn(qn(g(t, i, a, 0), r.overlayRange(i, a)), r.compareRange(t, n)), s = r.volumeRatio(t, i, a), { priceMargin: c, volumeGap: l } = this.spacing, u = s === null ? c : s + l;
|
|
715
715
|
e.setScaleMargins(e.isInvertScale() ? {
|
|
716
716
|
top: u,
|
|
717
717
|
bottom: c
|
|
@@ -721,11 +721,11 @@ var Wn = class {
|
|
|
721
721
|
}), e.fitToPrices(o.min, o.max);
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
|
-
function
|
|
724
|
+
function Kn(e, t, n) {
|
|
725
725
|
for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
|
|
726
726
|
return !1;
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function qn(e, t) {
|
|
729
729
|
return e ? t ? {
|
|
730
730
|
min: Math.min(e.min, t.min),
|
|
731
731
|
max: Math.max(e.max, t.max)
|
|
@@ -733,18 +733,18 @@ function Kn(e, t) {
|
|
|
733
733
|
}
|
|
734
734
|
//#endregion
|
|
735
735
|
//#region src/model/DisplaySeries.ts
|
|
736
|
-
var
|
|
736
|
+
var Jn = class {
|
|
737
737
|
series = null;
|
|
738
738
|
madeAt = null;
|
|
739
739
|
epoch = 0;
|
|
740
|
-
memo = new
|
|
740
|
+
memo = new dt();
|
|
741
741
|
constructor(e) {
|
|
742
742
|
this.sources = e;
|
|
743
743
|
}
|
|
744
744
|
get() {
|
|
745
745
|
let e = this.sources.bars();
|
|
746
746
|
if (e.length === 0) return e;
|
|
747
|
-
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ?
|
|
747
|
+
let t = this.sources.chartType(), n = this.sources.chartTypeOptions(), r = t === "rangeBars" ? jn(e, (e) => this.sources.stepAt(e)) : void 0, i = this.sources.version(), a = this.madeAt;
|
|
748
748
|
return this.series && a && a.version === i && a.type === t && a.options === n && a.step === r && a.epoch === this.epoch ? this.series : (this.series = this.make(t, e, n, r), this.madeAt = {
|
|
749
749
|
version: i,
|
|
750
750
|
type: t,
|
|
@@ -761,14 +761,14 @@ var qn = class {
|
|
|
761
761
|
}
|
|
762
762
|
make(e, t, n, r) {
|
|
763
763
|
let { lookup: i } = this.sources;
|
|
764
|
-
if (e !== "pointAndFigure" || i(e)) return
|
|
765
|
-
let { columns: a, boxSize: o } =
|
|
764
|
+
if (e !== "pointAndFigure" || i(e)) return Fn(e, t, i, n, r, this.memo);
|
|
765
|
+
let { columns: a, boxSize: o } = vn(t, n, this.memo);
|
|
766
766
|
return this.sources.onBoxSize(o), a;
|
|
767
767
|
}
|
|
768
|
-
},
|
|
768
|
+
}, Yn = {
|
|
769
769
|
min: 0,
|
|
770
770
|
max: 100
|
|
771
|
-
},
|
|
771
|
+
}, Xn = class {
|
|
772
772
|
layout = null;
|
|
773
773
|
infos = null;
|
|
774
774
|
styles = /* @__PURE__ */ new Map();
|
|
@@ -776,7 +776,7 @@ var qn = class {
|
|
|
776
776
|
this.manager = e, this.sources = t, this.onLayout = n;
|
|
777
777
|
}
|
|
778
778
|
resolved() {
|
|
779
|
-
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(
|
|
779
|
+
return this.layout || (this.layout = this.manager.resolve(), this.onLayout(Zn(this.layout))), this.layout;
|
|
780
780
|
}
|
|
781
781
|
invalidate() {
|
|
782
782
|
this.layout = null, this.infos = null;
|
|
@@ -788,7 +788,7 @@ var qn = class {
|
|
|
788
788
|
if (this.infos) return this.infos;
|
|
789
789
|
let t = e(), { from: n, to: r } = t.visibleRange;
|
|
790
790
|
return this.infos = this.resolved().panels.map((e) => {
|
|
791
|
-
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...
|
|
791
|
+
let i = e.config.id, a = e.config.logScale ? this.sources.getPaneValueRange(i, n, r, !0) : null, o = a ?? this.sources.getPaneValueRange(i, n, r) ?? { ...Yn }, s = this.styles.get(i);
|
|
792
792
|
return {
|
|
793
793
|
instanceId: i,
|
|
794
794
|
members: this.sources.getPaneMembers(i),
|
|
@@ -848,7 +848,7 @@ var qn = class {
|
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
};
|
|
851
|
-
function
|
|
851
|
+
function Zn(e) {
|
|
852
852
|
let t = e.mainChartRect, n = t.y, r = t.y + t.height;
|
|
853
853
|
for (let t of e.panels) t.config.position !== "top" && t.config.position !== "bottom" || (n = Math.min(n, t.rect.y), r = Math.max(r, t.rect.y + t.rect.height));
|
|
854
854
|
return {
|
|
@@ -856,10 +856,10 @@ function Xn(e) {
|
|
|
856
856
|
bottom: r
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function Qn(e) {
|
|
860
860
|
return e.length > 0 ? { renames: e } : {};
|
|
861
861
|
}
|
|
862
|
-
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t),
|
|
862
|
+
var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), $n = class {
|
|
863
863
|
steps;
|
|
864
864
|
snapshot;
|
|
865
865
|
enabled;
|
|
@@ -895,7 +895,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Qn = class {
|
|
|
895
895
|
...o,
|
|
896
896
|
after: n,
|
|
897
897
|
at: i,
|
|
898
|
-
...
|
|
898
|
+
...Qn([...o.renames ?? [], ...r])
|
|
899
899
|
}
|
|
900
900
|
}) : this.steps.push({
|
|
901
901
|
...c,
|
|
@@ -904,7 +904,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Qn = class {
|
|
|
904
904
|
after: n,
|
|
905
905
|
subject: e,
|
|
906
906
|
at: i,
|
|
907
|
-
...
|
|
907
|
+
...Qn(r)
|
|
908
908
|
}
|
|
909
909
|
});
|
|
910
910
|
}
|
|
@@ -942,7 +942,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Qn = class {
|
|
|
942
942
|
}
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
|
-
},
|
|
945
|
+
}, er = class {
|
|
946
946
|
constructor(e, t, n) {
|
|
947
947
|
this.members = e, this.slots = t, this.handover = n;
|
|
948
948
|
}
|
|
@@ -1021,7 +1021,7 @@ var U = (e, t) => JSON.stringify(e) === JSON.stringify(t), Qn = class {
|
|
|
1021
1021
|
};
|
|
1022
1022
|
//#endregion
|
|
1023
1023
|
//#region src/model/IndicatorSetup.ts
|
|
1024
|
-
function
|
|
1024
|
+
function tr(e, t, n) {
|
|
1025
1025
|
let r = t.getPanels(), i = t.getMaximizedPanel();
|
|
1026
1026
|
return e.getActiveIndicators().map((t) => {
|
|
1027
1027
|
let a = r.find((e) => e.id === t.instanceId), o = e.getIndicatorConfig(t.instanceId), s = a ? n(t.instanceId) : null;
|
|
@@ -1049,7 +1049,7 @@ function er(e, t, n) {
|
|
|
1049
1049
|
};
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function nr(e, t) {
|
|
1053
1053
|
for (let [n, r] of t) n.paneSize !== void 0 && e.setPanelSize(r, n.paneSize), (n.paneSize !== void 0 || n.paneCollapsed) && e.setPanelCollapsed(r, !!n.paneCollapsed), n.paneSize !== void 0 && e.setPanelScale(r, {
|
|
1054
1054
|
log: !!n.paneLog,
|
|
1055
1055
|
invert: !!n.paneInvert,
|
|
@@ -1060,7 +1060,7 @@ function tr(e, t) {
|
|
|
1060
1060
|
let r = t.find(([e]) => e.paneMaximized);
|
|
1061
1061
|
e.setMaximizedPanel(r ? r[1] : null);
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function rr(e) {
|
|
1064
1064
|
let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1065
1065
|
if (r.has(e.instanceId) || i.has(e.instanceId)) return;
|
|
1066
1066
|
i.add(e.instanceId);
|
|
@@ -1074,23 +1074,23 @@ function nr(e) {
|
|
|
1074
1074
|
for (let t of e) a(t);
|
|
1075
1075
|
return n;
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function ir(e, t) {
|
|
1078
1078
|
return e.id === t.id && (e.pane ?? null) === (t.pane ?? null) && (e.scale ?? null) === (t.scale ?? null) && e.position === void 0 == (t.position === void 0);
|
|
1079
1079
|
}
|
|
1080
|
-
function
|
|
1080
|
+
function ar(e, t) {
|
|
1081
1081
|
let n = new Map(t.map((e) => [e.instanceId, e])), r = /* @__PURE__ */ new Set();
|
|
1082
1082
|
for (let t of e) {
|
|
1083
1083
|
let e = n.get(t.instanceId);
|
|
1084
|
-
e &&
|
|
1084
|
+
e && ir(t, e) && or(t, e) && r.add(t.instanceId);
|
|
1085
1085
|
}
|
|
1086
1086
|
for (let t of e) t.pane && !r.has(t.pane) && r.delete(t.instanceId);
|
|
1087
1087
|
return r;
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1089
|
+
function or(e, t) {
|
|
1090
1090
|
let n = Object.keys(e.params);
|
|
1091
1091
|
return n.length === Object.keys(t.params).length && n.every((e) => e in t.params);
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function sr(e, t) {
|
|
1094
1094
|
let n = { ...e };
|
|
1095
1095
|
for (let [e, r] of Object.entries(n)) {
|
|
1096
1096
|
let i = C(r), a = i && t.get(i.instanceId);
|
|
@@ -1100,11 +1100,11 @@ function or(e, t) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
//#endregion
|
|
1102
1102
|
//#region src/model/SymbolRequests.ts
|
|
1103
|
-
function
|
|
1103
|
+
function cr(e, t) {
|
|
1104
1104
|
let n = t.symbol;
|
|
1105
|
-
return
|
|
1105
|
+
return ft.has(e) && typeof n == "string" ? n.trim() : "";
|
|
1106
1106
|
}
|
|
1107
|
-
var
|
|
1107
|
+
var lr = class {
|
|
1108
1108
|
asked = /* @__PURE__ */ new Set();
|
|
1109
1109
|
constructor(e, t) {
|
|
1110
1110
|
this.readers = e, this.held = t;
|
|
@@ -1112,14 +1112,14 @@ var cr = class {
|
|
|
1112
1112
|
required() {
|
|
1113
1113
|
let e = /* @__PURE__ */ new Set();
|
|
1114
1114
|
for (let t of this.readers.getActiveIndicators()) {
|
|
1115
|
-
let n =
|
|
1115
|
+
let n = cr(t.id, t.params);
|
|
1116
1116
|
n && e.add(n);
|
|
1117
1117
|
}
|
|
1118
1118
|
return [...e];
|
|
1119
1119
|
}
|
|
1120
1120
|
readersOf(e) {
|
|
1121
1121
|
let t = e.trim();
|
|
1122
|
-
return this.readers.getActiveIndicators().filter((e) =>
|
|
1122
|
+
return this.readers.getActiveIndicators().filter((e) => ft.has(e.id) && String(e.params.symbol ?? "").trim() === t).map((e) => e.instanceId);
|
|
1123
1123
|
}
|
|
1124
1124
|
given(e) {
|
|
1125
1125
|
this.asked.delete(e.trim());
|
|
@@ -1130,20 +1130,20 @@ var cr = class {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
toAsk(e) {
|
|
1132
1132
|
this.forgetUnread();
|
|
1133
|
-
let t = this.readers.getIndicatorConfig(e), n = t ?
|
|
1133
|
+
let t = this.readers.getIndicatorConfig(e), n = t ? cr(t.id, t.params) : "";
|
|
1134
1134
|
return !n || this.held.has(n) || this.asked.has(n) ? null : (this.asked.add(n), n);
|
|
1135
1135
|
}
|
|
1136
|
-
},
|
|
1137
|
-
function
|
|
1138
|
-
if (!
|
|
1136
|
+
}, ur = (e, t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1137
|
+
function dr(e, t, n, r) {
|
|
1138
|
+
if (!ur(e, t)) {
|
|
1139
1139
|
for (let t of n) {
|
|
1140
1140
|
let n = r(t.id);
|
|
1141
|
-
if (n &&
|
|
1141
|
+
if (n && ur(e, n.chartRect)) return t.id;
|
|
1142
1142
|
}
|
|
1143
1143
|
return null;
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function fr(e, t, n, r) {
|
|
1147
1147
|
if (!e || e.position !== "top" && e.position !== "bottom" || t) return null;
|
|
1148
1148
|
let i = n();
|
|
1149
1149
|
return !i || i.chartRect.height < 24 ? null : {
|
|
@@ -1151,12 +1151,12 @@ function dr(e, t, n, r) {
|
|
|
1151
1151
|
data: r()
|
|
1152
1152
|
};
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function pr(e, t, n) {
|
|
1155
1155
|
return !n && e.some((e) => e.id === t);
|
|
1156
1156
|
}
|
|
1157
1157
|
//#endregion
|
|
1158
1158
|
//#region src/HistoryPager.ts
|
|
1159
|
-
var
|
|
1159
|
+
var mr = 5e3, hr = 6e4, gr = 500, _r = class {
|
|
1160
1160
|
loader = null;
|
|
1161
1161
|
pageSize = 500;
|
|
1162
1162
|
loading = !1;
|
|
@@ -1211,7 +1211,7 @@ var pr = 5e3, mr = 6e4, hr = 500, gr = class {
|
|
|
1211
1211
|
return n === this.seq ? (this.loading = !1, e instanceof Error && e.name === "AbortError" ? (this.emit({
|
|
1212
1212
|
state: "loaded",
|
|
1213
1213
|
count: 0
|
|
1214
|
-
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(
|
|
1214
|
+
}), 0) : (this.failures++, this.retryAt = this.now() + Math.min(hr, mr * 2 ** (this.failures - 1)), this.emit({
|
|
1215
1215
|
state: "error",
|
|
1216
1216
|
count: 0,
|
|
1217
1217
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -1244,10 +1244,10 @@ var pr = 5e3, mr = 6e4, hr = 500, gr = class {
|
|
|
1244
1244
|
};
|
|
1245
1245
|
//#endregion
|
|
1246
1246
|
//#region src/ThemeManager.ts
|
|
1247
|
-
function
|
|
1247
|
+
function vr(e, t) {
|
|
1248
1248
|
return e.family === t.family && e.sizeSmall === t.sizeSmall && e.sizeMedium === t.sizeMedium && e.sizeLarge === t.sizeLarge;
|
|
1249
1249
|
}
|
|
1250
|
-
var
|
|
1250
|
+
var yr = class e {
|
|
1251
1251
|
base;
|
|
1252
1252
|
shape = null;
|
|
1253
1253
|
font = null;
|
|
@@ -1272,7 +1272,7 @@ var vr = class e {
|
|
|
1272
1272
|
return this.base;
|
|
1273
1273
|
}
|
|
1274
1274
|
setTheme(t) {
|
|
1275
|
-
let n = e.read(t), r = this.font !== null &&
|
|
1275
|
+
let n = e.read(t), r = this.font !== null && vr(n.font, this.base.font);
|
|
1276
1276
|
this.base = n, r || (this.themeFont = n.font), this.shape && (this.base = {
|
|
1277
1277
|
...this.base,
|
|
1278
1278
|
shape: {
|
|
@@ -1354,7 +1354,7 @@ var vr = class e {
|
|
|
1354
1354
|
};
|
|
1355
1355
|
//#endregion
|
|
1356
1356
|
//#region src/style/styleOptions.ts
|
|
1357
|
-
function
|
|
1357
|
+
function br(e, t) {
|
|
1358
1358
|
return t ? {
|
|
1359
1359
|
...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
|
|
1360
1360
|
...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
|
|
@@ -1362,22 +1362,22 @@ function yr(e, t) {
|
|
|
1362
1362
|
...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
|
|
1363
1363
|
} : {};
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1365
|
+
function xr(e) {
|
|
1366
1366
|
let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
|
|
1367
1367
|
return {
|
|
1368
1368
|
...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
|
|
1369
1369
|
...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
|
|
1370
1370
|
...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
|
|
1371
1371
|
...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
|
|
1372
|
-
...
|
|
1373
|
-
...
|
|
1372
|
+
...br("horizontal", n?.hLine),
|
|
1373
|
+
...br("vertical", n?.vLine),
|
|
1374
1374
|
...r === void 0 ? {} : { "crosshair.labelBackground": r },
|
|
1375
1375
|
...e.overrides
|
|
1376
1376
|
};
|
|
1377
1377
|
}
|
|
1378
1378
|
//#endregion
|
|
1379
1379
|
//#region src/layout/LayoutManager.ts
|
|
1380
|
-
var
|
|
1380
|
+
var Sr = 200, Cr = 80, wr = .382, W = (e) => e.position === "top" || e.position === "bottom", Tr = class {
|
|
1381
1381
|
panels = [];
|
|
1382
1382
|
containerWidth = 0;
|
|
1383
1383
|
containerHeight = 0;
|
|
@@ -1394,8 +1394,8 @@ var xr = 200, Sr = 80, Cr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1394
1394
|
this.panels.push({
|
|
1395
1395
|
id: e,
|
|
1396
1396
|
position: t,
|
|
1397
|
-
size: n ?? (r ?
|
|
1398
|
-
minSize: r ?
|
|
1397
|
+
size: n ?? (r ? Sr : i),
|
|
1398
|
+
minSize: r ? Cr : s,
|
|
1399
1399
|
content: {
|
|
1400
1400
|
type: "indicator",
|
|
1401
1401
|
indicatorInstanceId: e
|
|
@@ -1477,7 +1477,7 @@ var xr = 200, Sr = 80, Cr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1477
1477
|
let n = this.panels.find((t) => t.id === e);
|
|
1478
1478
|
if (n) {
|
|
1479
1479
|
let r = n.position === "left" || n.position === "right", a = t === "left" || t === "right";
|
|
1480
|
-
n.position = t, r !== a && (n.size = a ?
|
|
1480
|
+
n.position = t, r !== a && (n.size = a ? Sr : i, n.minSize = a ? Cr : s), a && (n.collapsed = void 0, this.maximized === e && (this.maximized = null));
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
1483
|
setPanelSize(e, t) {
|
|
@@ -1489,7 +1489,7 @@ var xr = 200, Sr = 80, Cr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1489
1489
|
}
|
|
1490
1490
|
roomForOpen(e) {
|
|
1491
1491
|
let t = this.containerHeight - l;
|
|
1492
|
-
return t - Math.max(48, Math.ceil(t *
|
|
1492
|
+
return t - Math.max(48, Math.ceil(t * wr)) - e * 20;
|
|
1493
1493
|
}
|
|
1494
1494
|
setPanelHeightOnScreen(e, t) {
|
|
1495
1495
|
let n = this.panels.find((t) => t.id === e);
|
|
@@ -1610,8 +1610,8 @@ var xr = 200, Sr = 80, Cr = .382, W = (e) => e.position === "top" || e.position
|
|
|
1610
1610
|
getMainChartRect() {
|
|
1611
1611
|
return this.resolve().mainChartRect;
|
|
1612
1612
|
}
|
|
1613
|
-
},
|
|
1614
|
-
function
|
|
1613
|
+
}, Er = 14, Dr = 14, Or = 22, kr = 4;
|
|
1614
|
+
function Ar(e) {
|
|
1615
1615
|
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: o, measure: s } = e, l = e.tagPrecision ?? u(t, n), d = l, f = r === null ? [t, n] : [
|
|
1616
1616
|
t,
|
|
1617
1617
|
n,
|
|
@@ -1620,16 +1620,16 @@ function kr(e) {
|
|
|
1620
1620
|
for (let t of f) {
|
|
1621
1621
|
if (!Number.isFinite(t)) continue;
|
|
1622
1622
|
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : v(t, l, i), r = e.format ? n : v(t, d, i);
|
|
1623
|
-
p = Math.max(p, s(n, `500 ${o}px ${a}`) +
|
|
1623
|
+
p = Math.max(p, s(n, `500 ${o}px ${a}`) + Er, s(r, `bold 11px ${a}`) + Dr, s(r, `600 ${o}px ${a}`) + Or);
|
|
1624
1624
|
}
|
|
1625
|
-
return p <= c ? c : Math.ceil(p /
|
|
1625
|
+
return p <= c ? c : Math.ceil(p / kr) * kr;
|
|
1626
1626
|
}
|
|
1627
|
-
function
|
|
1627
|
+
function jr(e, t) {
|
|
1628
1628
|
return t > e || t <= e - 12 ? t : e;
|
|
1629
1629
|
}
|
|
1630
1630
|
//#endregion
|
|
1631
1631
|
//#region src/layout/labelWidths.ts
|
|
1632
|
-
var
|
|
1632
|
+
var Mr = 512, Nr = class {
|
|
1633
1633
|
widths = /* @__PURE__ */ new Map();
|
|
1634
1634
|
fonts;
|
|
1635
1635
|
forget = () => this.widths.clear();
|
|
@@ -1640,12 +1640,12 @@ var jr = 512, Mr = class {
|
|
|
1640
1640
|
let r = `${t}\n${e}`, i = this.widths.get(r);
|
|
1641
1641
|
if (i !== void 0) return i;
|
|
1642
1642
|
let a = n();
|
|
1643
|
-
return this.widths.size >=
|
|
1643
|
+
return this.widths.size >= Mr && this.widths.clear(), this.widths.set(r, a), a;
|
|
1644
1644
|
}
|
|
1645
1645
|
destroy() {
|
|
1646
1646
|
this.fonts?.removeEventListener("loadingdone", this.forget), this.widths.clear();
|
|
1647
1647
|
}
|
|
1648
|
-
},
|
|
1648
|
+
}, Pr = class {
|
|
1649
1649
|
netY = 0;
|
|
1650
1650
|
travelX = 0;
|
|
1651
1651
|
engaged = !1;
|
|
@@ -1661,8 +1661,8 @@ var jr = 512, Mr = class {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
return this.engaged;
|
|
1663
1663
|
}
|
|
1664
|
-
},
|
|
1665
|
-
function
|
|
1664
|
+
}, Fr = 1;
|
|
1665
|
+
function Ir(e, t) {
|
|
1666
1666
|
return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
|
|
1667
1667
|
}
|
|
1668
1668
|
function G(e) {
|
|
@@ -1676,24 +1676,24 @@ function G(e) {
|
|
|
1676
1676
|
//#endregion
|
|
1677
1677
|
//#region src/plugins/registry.ts
|
|
1678
1678
|
var K = /* @__PURE__ */ new Map();
|
|
1679
|
-
function
|
|
1679
|
+
function Lr(e) {
|
|
1680
1680
|
K.set(G(e), e);
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function Rr(e) {
|
|
1683
1683
|
return K.delete(e);
|
|
1684
1684
|
}
|
|
1685
|
-
function
|
|
1685
|
+
function zr() {
|
|
1686
1686
|
return [...K.values()];
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1688
|
+
function Br() {
|
|
1689
1689
|
K.clear();
|
|
1690
1690
|
}
|
|
1691
1691
|
//#endregion
|
|
1692
1692
|
//#region src/plugins/PluginManager.ts
|
|
1693
|
-
var
|
|
1693
|
+
var Vr = class {
|
|
1694
1694
|
plugins = /* @__PURE__ */ new Map();
|
|
1695
1695
|
constructor(e, t = {}) {
|
|
1696
|
-
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of
|
|
1696
|
+
if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of zr()) this.add(e);
|
|
1697
1697
|
for (let e of t.plugins ?? []) this.add(e);
|
|
1698
1698
|
}
|
|
1699
1699
|
register(e) {
|
|
@@ -1723,15 +1723,15 @@ var Br = class {
|
|
|
1723
1723
|
add(e) {
|
|
1724
1724
|
this.plugins.set(G(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
|
|
1725
1725
|
}
|
|
1726
|
-
},
|
|
1726
|
+
}, Hr = {
|
|
1727
1727
|
orderPlace: (e, t) => e.placeOrder(t),
|
|
1728
1728
|
orderModify: (e, t) => e.modifyOrder(t),
|
|
1729
1729
|
orderCancel: (e, t) => e.cancelOrder(t),
|
|
1730
1730
|
positionModify: (e, t) => e.modifyPosition(t),
|
|
1731
1731
|
positionClose: (e, t) => e.closePosition(t),
|
|
1732
|
-
positionReverse: (e, t, n) =>
|
|
1732
|
+
positionReverse: (e, t, n) => Ur(e, t, n)
|
|
1733
1733
|
};
|
|
1734
|
-
async function
|
|
1734
|
+
async function Ur(e, t, n) {
|
|
1735
1735
|
let { reversing: r } = n;
|
|
1736
1736
|
if (!r.has(t.positionId)) {
|
|
1737
1737
|
r.add(t.positionId);
|
|
@@ -1760,7 +1760,7 @@ async function Hr(e, t, n) {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
|
-
function
|
|
1763
|
+
function Wr(e, t) {
|
|
1764
1764
|
let n = [], r = null, i = {
|
|
1765
1765
|
positions: () => r ?? t.getPositions?.() ?? [],
|
|
1766
1766
|
reversing: /* @__PURE__ */ new Set()
|
|
@@ -1770,8 +1770,8 @@ function Ur(e, t) {
|
|
|
1770
1770
|
e.data && t.onFill?.(e.data);
|
|
1771
1771
|
};
|
|
1772
1772
|
e.on("orders", a), e.on("positions", o), e.on("error", s), e.on("fill", c), n.push(() => e.off("orders", a), () => e.off("positions", o), () => e.off("error", s), () => e.off("fill", c));
|
|
1773
|
-
for (let r of Object.keys(
|
|
1774
|
-
let a =
|
|
1773
|
+
for (let r of Object.keys(Hr)) {
|
|
1774
|
+
let a = Hr[r], o = t.onIntent(r, (n) => {
|
|
1775
1775
|
Promise.resolve(a(e, n, i)).catch((e) => t.onError({
|
|
1776
1776
|
message: `Execution command failed: ${r}`,
|
|
1777
1777
|
cause: e
|
|
@@ -1785,7 +1785,7 @@ function Ur(e, t) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
//#endregion
|
|
1787
1787
|
//#region src/replay/ReplayStepLoader.ts
|
|
1788
|
-
var
|
|
1788
|
+
var Gr = 1e3, Kr = class {
|
|
1789
1789
|
pieces = /* @__PURE__ */ new Map();
|
|
1790
1790
|
asked = /* @__PURE__ */ new Set();
|
|
1791
1791
|
inFlight = !1;
|
|
@@ -1818,7 +1818,7 @@ var Wr = 1e3, Gr = class {
|
|
|
1818
1818
|
this.done = !0;
|
|
1819
1819
|
}
|
|
1820
1820
|
ask(e, t) {
|
|
1821
|
-
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(
|
|
1821
|
+
let { ratio: n, barMs: r, step: i, report: a } = this.options, o = Math.max(1, Math.floor(Gr / n)), s = Math.min(e.length, t + o), c = s < e.length ? e[s].time : e[e.length - 1].time + r, l = e.slice(t, s);
|
|
1822
1822
|
for (let e of l) this.asked.add(e.time);
|
|
1823
1823
|
this.inFlight = !0, a({
|
|
1824
1824
|
state: "loading",
|
|
@@ -1859,12 +1859,12 @@ var Wr = 1e3, Gr = class {
|
|
|
1859
1859
|
...n === void 0 ? {} : { error: n }
|
|
1860
1860
|
});
|
|
1861
1861
|
}
|
|
1862
|
-
},
|
|
1863
|
-
function
|
|
1864
|
-
let n = (e.high - e.low) *
|
|
1865
|
-
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length *
|
|
1862
|
+
}, qr = 1 / 3, Jr = .25, Yr = .5;
|
|
1863
|
+
function Xr(e, t) {
|
|
1864
|
+
let n = (e.high - e.low) * Jr;
|
|
1865
|
+
return t.filter((t) => t.close > e.high + n || t.close < e.low - n).length <= t.length * Yr;
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function Zr(e) {
|
|
1868
1868
|
return e.close >= e.open ? [
|
|
1869
1869
|
e.open,
|
|
1870
1870
|
e.low,
|
|
@@ -1877,22 +1877,22 @@ function Xr(e) {
|
|
|
1877
1877
|
e.close
|
|
1878
1878
|
];
|
|
1879
1879
|
}
|
|
1880
|
-
function
|
|
1881
|
-
let r =
|
|
1880
|
+
function Qr(e, t, n) {
|
|
1881
|
+
let r = Zr(e), i = [
|
|
1882
1882
|
1,
|
|
1883
1883
|
2,
|
|
1884
1884
|
3
|
|
1885
1885
|
].map((e) => Math.abs(r[e] - r[e - 1])), a = i[0] + i[1] + i[2], o = [], s = 0;
|
|
1886
1886
|
return r.forEach((r, c) => {
|
|
1887
|
-
c > 0 && (s += a > 0 ? i[c - 1] / a :
|
|
1887
|
+
c > 0 && (s += a > 0 ? i[c - 1] / a : qr), !(c === 0 && t > 0) && o.push({
|
|
1888
1888
|
price: r,
|
|
1889
1889
|
time: e.time,
|
|
1890
1890
|
at: (t + s) / n
|
|
1891
1891
|
});
|
|
1892
1892
|
}), o;
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1895
|
-
let n = t.length > 0 &&
|
|
1894
|
+
function $r(e, t = []) {
|
|
1895
|
+
let n = t.length > 0 && Xr(e, t) ? t : [e], r = n.length, i = ei(n.flatMap((e, t) => Qr(e, t, r)), e), a = n.reduce((e, t) => e + (t.volume ?? 0), 0), o = 0;
|
|
1896
1896
|
return {
|
|
1897
1897
|
bar: e,
|
|
1898
1898
|
points: i,
|
|
@@ -1902,7 +1902,7 @@ function Qr(e, t = []) {
|
|
|
1902
1902
|
}))
|
|
1903
1903
|
};
|
|
1904
1904
|
}
|
|
1905
|
-
function
|
|
1905
|
+
function ei(e, t) {
|
|
1906
1906
|
let n = e.length - 1, r = e.map((e, r) => ({
|
|
1907
1907
|
...e,
|
|
1908
1908
|
price: r === 0 ? t.open : r === n ? t.close : Math.min(t.high, Math.max(t.low, e.price))
|
|
@@ -1917,7 +1917,7 @@ function $r(e, t) {
|
|
|
1917
1917
|
};
|
|
1918
1918
|
return i(t.high, (e, t) => e > t), i(t.low, (e, t) => e < t), r;
|
|
1919
1919
|
}
|
|
1920
|
-
function
|
|
1920
|
+
function ti(e, t) {
|
|
1921
1921
|
let n = e.points;
|
|
1922
1922
|
if (t <= n[0].at) return n[0].price;
|
|
1923
1923
|
for (let e = 1; e < n.length; e++) if (t <= n[e].at) {
|
|
@@ -1926,8 +1926,8 @@ function ei(e, t) {
|
|
|
1926
1926
|
}
|
|
1927
1927
|
return n[n.length - 1].price;
|
|
1928
1928
|
}
|
|
1929
|
-
var
|
|
1930
|
-
function
|
|
1929
|
+
var ni = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0;
|
|
1930
|
+
function ri(e, t) {
|
|
1931
1931
|
let n = 0, r = 0;
|
|
1932
1932
|
for (let i of e.volumeAt) {
|
|
1933
1933
|
if (t >= i.at) {
|
|
@@ -1938,10 +1938,10 @@ function ni(e, t) {
|
|
|
1938
1938
|
}
|
|
1939
1939
|
return n;
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1942
|
-
let n =
|
|
1941
|
+
function ii(e, t) {
|
|
1942
|
+
let n = ni(t);
|
|
1943
1943
|
if (n >= 1) return { ...e.bar };
|
|
1944
|
-
let r =
|
|
1944
|
+
let r = ti(e, n), i = Math.max(e.points[0].price, r), a = Math.min(e.points[0].price, r);
|
|
1945
1945
|
for (let t of e.points) {
|
|
1946
1946
|
if (t.at > n) break;
|
|
1947
1947
|
i = Math.max(i, t.price), a = Math.min(a, t.price);
|
|
@@ -1952,11 +1952,11 @@ function ri(e, t) {
|
|
|
1952
1952
|
high: i,
|
|
1953
1953
|
low: a,
|
|
1954
1954
|
close: r,
|
|
1955
|
-
volume:
|
|
1955
|
+
volume: ri(e, n)
|
|
1956
1956
|
};
|
|
1957
1957
|
}
|
|
1958
|
-
function
|
|
1959
|
-
let n =
|
|
1958
|
+
function ai(e, t) {
|
|
1959
|
+
let n = ni(t), r = 0;
|
|
1960
1960
|
for (let t of e.points) {
|
|
1961
1961
|
if (t.at > n) break;
|
|
1962
1962
|
r = t.at;
|
|
@@ -1969,12 +1969,12 @@ function q(e, t, n) {
|
|
|
1969
1969
|
if (a.at > n) break;
|
|
1970
1970
|
i = a.time, a.at > t && r.push([a.price, a.time]);
|
|
1971
1971
|
}
|
|
1972
|
-
let a =
|
|
1972
|
+
let a = ti(e, n);
|
|
1973
1973
|
return (r.length === 0 || r[r.length - 1][0] !== a) && r.push([a, i]), r;
|
|
1974
1974
|
}
|
|
1975
1975
|
//#endregion
|
|
1976
1976
|
//#region src/replay/replayStep.ts
|
|
1977
|
-
var
|
|
1977
|
+
var oi = [
|
|
1978
1978
|
"1m",
|
|
1979
1979
|
"3m",
|
|
1980
1980
|
"5m",
|
|
@@ -1985,27 +1985,27 @@ var ai = [
|
|
|
1985
1985
|
"4h",
|
|
1986
1986
|
"1d"
|
|
1987
1987
|
];
|
|
1988
|
-
function
|
|
1988
|
+
function si(e, t) {
|
|
1989
1989
|
let n = E(e);
|
|
1990
|
-
return n > 0 ?
|
|
1990
|
+
return n > 0 ? oi.filter((e) => {
|
|
1991
1991
|
let r = E(e);
|
|
1992
1992
|
return r < n && n % r === 0 && t(e);
|
|
1993
1993
|
}) : [];
|
|
1994
1994
|
}
|
|
1995
|
-
function
|
|
1996
|
-
let r =
|
|
1995
|
+
function ci(e, t, n) {
|
|
1996
|
+
let r = si(t, n);
|
|
1997
1997
|
if (e !== "auto") return r.includes(e) ? e : null;
|
|
1998
1998
|
let i = E(t);
|
|
1999
1999
|
return r.find((e) => i / E(e) <= 60) ?? null;
|
|
2000
2000
|
}
|
|
2001
2001
|
//#endregion
|
|
2002
2002
|
//#region src/model/AlertWatch.ts
|
|
2003
|
-
function
|
|
2003
|
+
function li(e, t) {
|
|
2004
2004
|
e.setBarTime(t.barTime);
|
|
2005
2005
|
let n = new Map([["price", t.price]]);
|
|
2006
|
-
t.lines &&
|
|
2006
|
+
t.lines && ui(e.getAlerts(), t.lines, n), e.checkChannels(n, { together: !0 }), e.checkDrawings(t.price);
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2008
|
+
function ui(e, t, n) {
|
|
2009
2009
|
let r = e.flatMap((e) => e.target ? [e.channel, e.target] : [e.channel]);
|
|
2010
2010
|
for (let e of r) {
|
|
2011
2011
|
if (n.has(e)) continue;
|
|
@@ -2015,7 +2015,7 @@ function li(e, t, n) {
|
|
|
2015
2015
|
typeof a == "number" && Number.isFinite(a) && n.set(e, a);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
|
-
function
|
|
2018
|
+
function di(e, t, n, r) {
|
|
2019
2019
|
let i = (e) => {
|
|
2020
2020
|
let i = e.indexOf(":");
|
|
2021
2021
|
if (i <= 0) return null;
|
|
@@ -2037,35 +2037,35 @@ function ui(e, t, n, r) {
|
|
|
2037
2037
|
});
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2040
|
+
function fi(e, t) {
|
|
2041
2041
|
let n = e.indexOf(":"), r = n > 0 ? t.get(e.slice(0, n)) : void 0;
|
|
2042
2042
|
return r ? r + e.slice(n) : e;
|
|
2043
2043
|
}
|
|
2044
|
-
var
|
|
2044
|
+
var pi = [
|
|
2045
2045
|
"crossing",
|
|
2046
2046
|
"crossingUp",
|
|
2047
2047
|
"crossingDown"
|
|
2048
2048
|
];
|
|
2049
|
-
function
|
|
2049
|
+
function mi(e, t, n, r, i) {
|
|
2050
2050
|
e.clearAlerts();
|
|
2051
2051
|
for (let a of t) {
|
|
2052
2052
|
if (a.triggered && !a.repeating || a.expired) continue;
|
|
2053
2053
|
if (a.drawingId) {
|
|
2054
|
-
r(a.drawingId) &&
|
|
2054
|
+
r(a.drawingId) && pi.includes(a.condition) && e.addDrawingAlert(a.drawingId, a.condition, a.message, a.repeating, a.label);
|
|
2055
2055
|
continue;
|
|
2056
2056
|
}
|
|
2057
2057
|
let t = {
|
|
2058
|
-
...
|
|
2059
|
-
...a.target ? { target:
|
|
2058
|
+
...Gt(a),
|
|
2059
|
+
...a.target ? { target: fi(a.target, n) } : {}
|
|
2060
2060
|
};
|
|
2061
2061
|
try {
|
|
2062
|
-
e.addAlert(a.price, a.condition, a.message, a.repeating,
|
|
2062
|
+
e.addAlert(a.price, a.condition, a.message, a.repeating, fi(a.channel, n), a.label, t);
|
|
2063
2063
|
} catch (e) {
|
|
2064
2064
|
i(e);
|
|
2065
2065
|
}
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
2068
|
-
var
|
|
2068
|
+
var hi = class {
|
|
2069
2069
|
kept = /* @__PURE__ */ new Map();
|
|
2070
2070
|
constructor(e) {
|
|
2071
2071
|
this.alerts = e;
|
|
@@ -2098,18 +2098,18 @@ function Y(e, t) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
return n;
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function gi(e) {
|
|
2102
2102
|
let t = 0, n = 0;
|
|
2103
2103
|
for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
|
|
2104
2104
|
let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
|
|
2105
2105
|
return [...a ? [r, i] : [i, r], [o.close, o.time]];
|
|
2106
2106
|
}
|
|
2107
|
-
function
|
|
2107
|
+
function _i(e) {
|
|
2108
2108
|
let t = [], n = Math.ceil(e.length / 500);
|
|
2109
|
-
for (let r = 0; r < e.length; r += n) t.push(...
|
|
2109
|
+
for (let r = 0; r < e.length; r += n) t.push(...gi(e.slice(r, r + n)));
|
|
2110
2110
|
return t;
|
|
2111
2111
|
}
|
|
2112
|
-
function
|
|
2112
|
+
function vi(e, t, n) {
|
|
2113
2113
|
let r = e[t];
|
|
2114
2114
|
return r ? n.time === null ? {
|
|
2115
2115
|
marks: [[r.close, r.time]],
|
|
@@ -2118,14 +2118,14 @@ function _i(e, t, n) {
|
|
|
2118
2118
|
fraction: n.fraction
|
|
2119
2119
|
}
|
|
2120
2120
|
} : r.time <= n.time ? null : {
|
|
2121
|
-
marks:
|
|
2121
|
+
marks: _i(e.slice(Y(e, n.time), t + 1)),
|
|
2122
2122
|
fed: {
|
|
2123
2123
|
time: r.time,
|
|
2124
2124
|
fraction: n.fraction
|
|
2125
2125
|
}
|
|
2126
2126
|
} : null;
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2128
|
+
function yi(e, t, n, r, i, a) {
|
|
2129
2129
|
let o = e[t];
|
|
2130
2130
|
if (!o) return null;
|
|
2131
2131
|
let s = {
|
|
@@ -2133,7 +2133,7 @@ function vi(e, t, n, r, i, a) {
|
|
|
2133
2133
|
fraction: r
|
|
2134
2134
|
};
|
|
2135
2135
|
if (i.time === null) return {
|
|
2136
|
-
marks: [[
|
|
2136
|
+
marks: [[ii(n, r).close, o.time]],
|
|
2137
2137
|
fed: s
|
|
2138
2138
|
};
|
|
2139
2139
|
if (o.time < i.time || o.time === i.time && r <= i.fraction) return null;
|
|
@@ -2142,28 +2142,28 @@ function vi(e, t, n, r, i, a) {
|
|
|
2142
2142
|
fed: s
|
|
2143
2143
|
};
|
|
2144
2144
|
let c = [], l = J(e, i.time);
|
|
2145
|
-
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(...
|
|
2145
|
+
return e[l]?.time === i.time && i.fraction < 1 && c.push(...q(a(e, l), i.fraction, 1)), c.push(..._i(e.slice(Y(e, i.time), t))), c.push(...q(n, -1, r)), {
|
|
2146
2146
|
marks: c,
|
|
2147
2147
|
fed: s
|
|
2148
2148
|
};
|
|
2149
2149
|
}
|
|
2150
2150
|
//#endregion
|
|
2151
2151
|
//#region src/Chart.ts
|
|
2152
|
-
var
|
|
2153
|
-
function
|
|
2152
|
+
var bi = "exchange";
|
|
2153
|
+
function xi(e) {
|
|
2154
2154
|
if (typeof e == "string" && e !== "exchange" && !x(e)) throw RangeError(`Unknown time zone: ${e}`);
|
|
2155
2155
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
2156
2156
|
}
|
|
2157
|
-
var
|
|
2157
|
+
var Si = .08, Ci = 20, wi = 8, Ti = 10, Ei = {
|
|
2158
2158
|
ArrowLeft: [-1, 0],
|
|
2159
2159
|
ArrowRight: [1, 0],
|
|
2160
2160
|
ArrowUp: [0, -1],
|
|
2161
2161
|
ArrowDown: [0, 1]
|
|
2162
|
-
},
|
|
2163
|
-
static version = "2.
|
|
2162
|
+
}, Di = new Set(["horizontalLine", "crossLine"]), Oi = new Set(["verticalLine", "crossLine"]), ki = class {
|
|
2163
|
+
static version = "2.6.0";
|
|
2164
2164
|
engine;
|
|
2165
2165
|
viewport;
|
|
2166
|
-
series = new
|
|
2166
|
+
series = new Un((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
|
|
2167
2167
|
themeManager;
|
|
2168
2168
|
layoutManager;
|
|
2169
2169
|
pluginManager;
|
|
@@ -2190,7 +2190,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2190
2190
|
renderDeferred = !1;
|
|
2191
2191
|
priceAxisWidth = c;
|
|
2192
2192
|
measureCtx;
|
|
2193
|
-
labelWidths = new
|
|
2193
|
+
labelWidths = new Nr();
|
|
2194
2194
|
containerSizeCache = null;
|
|
2195
2195
|
containerSizeCacheTime = 0;
|
|
2196
2196
|
lastEmittedRange = null;
|
|
@@ -2203,7 +2203,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2203
2203
|
unrestoredIndicators = [];
|
|
2204
2204
|
drawingAlerts = null;
|
|
2205
2205
|
zoomAreaMode = !1;
|
|
2206
|
-
priceAxisAddButton = new
|
|
2206
|
+
priceAxisAddButton = new at();
|
|
2207
2207
|
displayTz = null;
|
|
2208
2208
|
timeZoneSetting = null;
|
|
2209
2209
|
symbolInfo = null;
|
|
@@ -2214,7 +2214,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2214
2214
|
studyZoneReleaseQueued = !1;
|
|
2215
2215
|
sessionBreaks;
|
|
2216
2216
|
sessionShading;
|
|
2217
|
-
hostSessionHours = { ...
|
|
2217
|
+
hostSessionHours = { ...Me };
|
|
2218
2218
|
compareRenderer;
|
|
2219
2219
|
countdownInterval = null;
|
|
2220
2220
|
pausedFor = {
|
|
@@ -2231,9 +2231,16 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2231
2231
|
pivotMarkers;
|
|
2232
2232
|
alertManager;
|
|
2233
2233
|
signalMarkerManager;
|
|
2234
|
+
signalMarkerHovered = !1;
|
|
2235
|
+
lastHoverPos = {
|
|
2236
|
+
x: 0,
|
|
2237
|
+
y: 0
|
|
2238
|
+
};
|
|
2239
|
+
chartMarkManager;
|
|
2240
|
+
hoveredBadge = null;
|
|
2234
2241
|
tradeZoneManager;
|
|
2235
2242
|
measureOverlay;
|
|
2236
|
-
selectionBoxOverlay = new
|
|
2243
|
+
selectionBoxOverlay = new mt();
|
|
2237
2244
|
replayManager;
|
|
2238
2245
|
replayBarUnsub = null;
|
|
2239
2246
|
replaySeeking = !1;
|
|
@@ -2248,7 +2255,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2248
2255
|
replayForming = null;
|
|
2249
2256
|
replayPhaseUnsub = null;
|
|
2250
2257
|
undoRedoManager;
|
|
2251
|
-
autoSaveScheduler = new
|
|
2258
|
+
autoSaveScheduler = new In((e) => this.saveState(e));
|
|
2252
2259
|
animator;
|
|
2253
2260
|
crosshairTooltip;
|
|
2254
2261
|
pinnedTooltip;
|
|
@@ -2260,14 +2267,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2260
2267
|
disposed = !1;
|
|
2261
2268
|
chartTypeOptions = {};
|
|
2262
2269
|
mainSeriesVisible = !0;
|
|
2263
|
-
priceLines = new
|
|
2264
|
-
symbolSeries = new
|
|
2270
|
+
priceLines = new ot();
|
|
2271
|
+
symbolSeries = new xt();
|
|
2265
2272
|
extendedHours = !0;
|
|
2266
2273
|
replayRestarting = !1;
|
|
2267
2274
|
symbolRequests;
|
|
2268
2275
|
gridRenderer;
|
|
2269
2276
|
priceAxis;
|
|
2270
|
-
leftPriceAxis = new
|
|
2277
|
+
leftPriceAxis = new it();
|
|
2271
2278
|
leftScaleRequested = !1;
|
|
2272
2279
|
leftAxisWidth = c;
|
|
2273
2280
|
leftViewport = null;
|
|
@@ -2299,12 +2306,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2299
2306
|
snapshotKey = null;
|
|
2300
2307
|
historyCheckQueued = !1;
|
|
2301
2308
|
constructor(e, n) {
|
|
2302
|
-
n.timeZone != null &&
|
|
2309
|
+
n.timeZone != null && xi(n.timeZone), this.container = e, this.options = {
|
|
2303
2310
|
...n,
|
|
2304
2311
|
chartType: n.chartType ?? "candlestick"
|
|
2305
|
-
}, this.numberLocale = n.numberLocale ?? "en-US", this.priceFit = new
|
|
2312
|
+
}, this.numberLocale = n.numberLocale ?? "en-US", this.priceFit = new Gn(n.autoScale !== !1), this.density = n.density === "compact" ? "compact" : "comfortable";
|
|
2306
2313
|
let r = t[this.density];
|
|
2307
|
-
this.priceFit.setSpacing(r), this.display = new
|
|
2314
|
+
this.priceFit.setSpacing(r), this.display = new Jn({
|
|
2308
2315
|
bars: () => this.series.bars(),
|
|
2309
2316
|
version: () => this.series.version(),
|
|
2310
2317
|
chartType: () => this.options.chartType,
|
|
@@ -2312,7 +2319,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2312
2319
|
lookup: (e) => this.pluginManager.getChartType(e),
|
|
2313
2320
|
stepAt: (e) => this.stepAt(e),
|
|
2314
2321
|
onBoxSize: (e) => {
|
|
2315
|
-
this.chartRenderer instanceof
|
|
2322
|
+
this.chartRenderer instanceof rt && this.chartRenderer.setBoxSize(e);
|
|
2316
2323
|
}
|
|
2317
2324
|
});
|
|
2318
2325
|
let i = n.features ?? {};
|
|
@@ -2345,25 +2352,26 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2345
2352
|
alerts: i.alerts ?? !0,
|
|
2346
2353
|
replay: i.replay ?? !0,
|
|
2347
2354
|
sessionBreaks: i.sessionBreaks ?? !0,
|
|
2355
|
+
marks: i.marks ?? !0,
|
|
2348
2356
|
barCountdown: i.barCountdown ?? !0,
|
|
2349
2357
|
compareSymbols: i.compareSymbols ?? !0,
|
|
2350
2358
|
dataExport: i.dataExport ?? !0,
|
|
2351
2359
|
logScale: i.logScale ?? !0,
|
|
2352
2360
|
timeframes: i.timeframes ?? [],
|
|
2353
2361
|
defaultTimeframeFavorites: i.defaultTimeframeFavorites ?? []
|
|
2354
|
-
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new
|
|
2362
|
+
}, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.history = new _r({
|
|
2355
2363
|
oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
|
|
2356
2364
|
prepend: (e) => this.prependBars(e),
|
|
2357
2365
|
emit: (e) => this.eventBus.emit("historyLoad", e)
|
|
2358
|
-
}), this.themeManager = new
|
|
2366
|
+
}), this.themeManager = new yr(n.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(xr(n), "host", !1), this.container.style.backgroundColor || (this.container.style.backgroundColor = this.themeManager.getTheme().background, this.lastBackground = this.themeManager.getTheme().background), this.layoutManager = new Tr(), this.indicatorEngine = new Ue(), this.panes = new Xn(this.layoutManager, this.indicatorEngine, (e) => this.crosshairHandler.setReportBounds(e)), this.indicatorPanes = new er(this.indicatorEngine, this.layoutManager, {
|
|
2359
2367
|
passStyle: (e, t) => this.panes.passStyle(e, t),
|
|
2360
2368
|
renamePane: (e, t) => this.renamePane(e, t),
|
|
2361
2369
|
invalidateScales: () => this.panes.invalidateScales()
|
|
2362
|
-
}), this.symbolRequests = new
|
|
2370
|
+
}), this.symbolRequests = new lr(this.indicatorEngine, this.symbolSeries), this.pluginManager = new Vr(this.indicatorEngine, { plugins: n.plugins }), this.eventBus = new Le(), qt(this.indicatorEngine), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.indicatorEngine.register(new vt(this.symbolSeries)), this.indicatorEngine.register(new De(this.symbolSeries)), this.indicatorEngine.register(new Oe(this.symbolSeries)), n.indicatorWorker === "auto" && this.useIndicatorWorker(), this.drawingManager = new Pe(), Kt(this.drawingManager), this.drawingRenderer = new Fe(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingRenderer.setTimeFormat((e) => this.crosshairHandler.formatTime(e, this.getDisplayData())), this.drawingManager.setRequestRender(() => {
|
|
2363
2371
|
this.syncRenderContext(), this.engine.requestRender(o.Overlay), this.scheduleAutoSave();
|
|
2364
2372
|
}), this.drawingManager.setEventCallback((e, t) => {
|
|
2365
2373
|
this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
|
|
2366
|
-
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new
|
|
2374
|
+
}), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new Et(), this.indicatorHistory = new $n({
|
|
2367
2375
|
steps: this.undoRedoManager,
|
|
2368
2376
|
snapshot: () => this.getIndicatorSetup(),
|
|
2369
2377
|
enabled: () => this.features.drawingUndoRedo
|
|
@@ -2380,14 +2388,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2380
2388
|
primary: e[0] ?? null
|
|
2381
2389
|
})), this.drawingManager.setForeignHistory((e, t) => {
|
|
2382
2390
|
e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
|
|
2383
|
-
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), n.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new
|
|
2391
|
+
}), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), n.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new wt({
|
|
2384
2392
|
enabled: this.features.trading,
|
|
2385
2393
|
contextMenu: { enabled: this.features.tradingContextMenu }
|
|
2386
|
-
}), this.tradingRenderer = new
|
|
2394
|
+
}), this.tradingRenderer = new Tt(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.tradingManager.setEventCallback((e, t) => {
|
|
2387
2395
|
this.eventBus.emit(e, t);
|
|
2388
|
-
}), this.engine = new
|
|
2396
|
+
}), this.engine = new st(e, n.maxPixelRatio);
|
|
2389
2397
|
let s = this.engine.dprManager.getContainerSize();
|
|
2390
|
-
if (this.viewport = new
|
|
2398
|
+
if (this.viewport = new Dt(s.width, s.height, n.minBarSpacing ?? 2, n.maxBarSpacing ?? 30, n.rightMargin ?? r.rightMargin), this.viewport.setBarLayout(n.barLayout ?? r.barLayout), this.viewport.setScaleMargins({
|
|
2391
2399
|
top: r.priceMargin,
|
|
2392
2400
|
bottom: r.priceMargin
|
|
2393
2401
|
}), this.viewport.setPanLimits({
|
|
@@ -2397,7 +2405,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2397
2405
|
if (e.width <= 0 || e.height <= 0) return;
|
|
2398
2406
|
let t = this.viewport.isAtEnd();
|
|
2399
2407
|
this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
|
|
2400
|
-
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new
|
|
2408
|
+
}, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Re(), n.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new it(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new St(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new ke(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), n.crosshair?.mode && this.crosshairHandler.setMode(n.crosshair.mode), Rt(n.crosshair?.cursor) && this.crosshairHandler.setCursor(n.crosshair.cursor), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
|
|
2401
2409
|
if (e !== null && t) {
|
|
2402
2410
|
let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0, i = e > 0 ? n[e - 1]?.close : void 0, a = A(n), s = r ? a[e]?.time ?? r.time : void 0;
|
|
2403
2411
|
this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(o.Hover);
|
|
@@ -2411,7 +2419,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2411
2419
|
prevClose: i,
|
|
2412
2420
|
priceRange: c.priceRange,
|
|
2413
2421
|
plot: c.chartRect,
|
|
2414
|
-
barStepMs:
|
|
2422
|
+
barStepMs: Nt(a),
|
|
2415
2423
|
timeUnit: f(a)
|
|
2416
2424
|
});
|
|
2417
2425
|
} else this.crosshairTooltip.hide();
|
|
@@ -2427,14 +2435,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2427
2435
|
let e = this.crosshairHandler.getSyncedSlot();
|
|
2428
2436
|
e !== null && this.showSyncedBar(e);
|
|
2429
2437
|
}
|
|
2430
|
-
}), this.chartLegend = new Se(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setSpacing(
|
|
2438
|
+
}), this.chartLegend = new Se(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setSpacing(Zi(r)), this.chartLegend.setResizeListener(() => {
|
|
2431
2439
|
this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
|
|
2432
|
-
}), this.watermark = new
|
|
2440
|
+
}), this.watermark = new jt(), n.watermark && this.watermark.setConfig(n.watermark), this.volumeRenderer = new At(), this.volumeProfile = new kt(), this.marketProfile = new Ye(), this.depthHeatmap = new Ne(), this.periodLevels = new et(), this.pivotMarkers = new nt(), this.barCountdown = new ve(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new ht(), this.sessionShading = new gt(), this.compareRenderer = new we(), n.sessionBreaks ? this.sessionBreaks.setConfig({
|
|
2433
2441
|
visible: n.sessionBreaks.visible ?? !0,
|
|
2434
2442
|
color: n.sessionBreaks.color,
|
|
2435
2443
|
lineStyle: n.sessionBreaks.lineStyle,
|
|
2436
2444
|
lineWidth: n.sessionBreaks.lineWidth
|
|
2437
|
-
}) : n.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), n.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new
|
|
2445
|
+
}) : n.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), n.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new Ae(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new tt(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), n.priceFormat && this.applyPriceFormat(n.priceFormat), n.chartTypeOptions && (this.chartTypeOptions = w(n.chartTypeOptions)), n.highLowLines && this.priceLines.setHighLow(!0), n.shapes && this.themeManager.setShape(Ni(n.shapes)), n.font && this.themeManager.setFont(Mi(n.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), n.extendedHours === !1 && (this.extendedHours = !1), n.timeFormatter && this.applyTimeFormatter(n.timeFormatter), this.keyboardHandler = new Ke({
|
|
2438
2446
|
scrollBars: (e) => {
|
|
2439
2447
|
let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
|
|
2440
2448
|
this.viewport.scrollBy(e * t), this.updateViewportAndRender();
|
|
@@ -2451,7 +2459,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2451
2459
|
},
|
|
2452
2460
|
fitContent: () => this.fitContent()
|
|
2453
2461
|
}), this.keyboardHandler.setEnabled(this.features.keyboard), n.a11y !== !1) {
|
|
2454
|
-
this.a11y = new
|
|
2462
|
+
this.a11y = new fn(e, {
|
|
2455
2463
|
symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
|
|
2456
2464
|
timeframe: () => this.streamTimeframe ?? "",
|
|
2457
2465
|
chartType: () => this.options.chartType ?? "candlestick",
|
|
@@ -2482,7 +2490,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2482
2490
|
}
|
|
2483
2491
|
this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
|
|
2484
2492
|
}
|
|
2485
|
-
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new
|
|
2493
|
+
}, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new je(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new me(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.drawingAlerts = new hi(this.alertManager), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(zt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
|
|
2486
2494
|
this.eventBus.emit("alertTriggered", X(e)), this.eventBus.emit("dataUpdate", {
|
|
2487
2495
|
kind: "alert",
|
|
2488
2496
|
alert: "triggered",
|
|
@@ -2498,7 +2506,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2498
2506
|
this.eventBus.emit("alertExpired", X(e));
|
|
2499
2507
|
}), this.alertManager.on("updated", (e) => {
|
|
2500
2508
|
this.eventBus.emit("alertUpdate", X(e));
|
|
2501
|
-
}), this.signalMarkerManager = new
|
|
2509
|
+
}), this.signalMarkerManager = new _t(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
|
|
2502
2510
|
this.eventBus.emit("signalMarkerAdd", {
|
|
2503
2511
|
id: e.id,
|
|
2504
2512
|
source: e.source,
|
|
@@ -2506,14 +2514,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2506
2514
|
});
|
|
2507
2515
|
}), this.signalMarkerManager.on("removed", (e) => {
|
|
2508
2516
|
this.eventBus.emit("signalMarkerRemove", { id: e });
|
|
2509
|
-
}), this.tradeZoneManager = new
|
|
2517
|
+
}), this.chartMarkManager = new Ce(), this.chartMarkManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.chartMarkManager.setDataGetter(() => this.isTimeAligned() ? this.getDisplayData() : []), this.tradeZoneManager = new Ct(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(o.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
|
|
2510
2518
|
this.eventBus.emit("tradeZoneAdd", {
|
|
2511
2519
|
id: e.id,
|
|
2512
2520
|
direction: e.direction
|
|
2513
2521
|
});
|
|
2514
2522
|
}), this.tradeZoneManager.on("removed", (e) => {
|
|
2515
2523
|
this.eventBus.emit("tradeZoneRemove", { id: e });
|
|
2516
|
-
}), this.replayManager = new
|
|
2524
|
+
}), this.replayManager = new lt(), this.replayManager.on("complete", () => {
|
|
2517
2525
|
let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
|
|
2518
2526
|
t && this.eventBus.emit("replayComplete", {
|
|
2519
2527
|
barIndex: e,
|
|
@@ -2521,9 +2529,9 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2521
2529
|
});
|
|
2522
2530
|
}), this.replayManager.on("stateChange", (e) => {
|
|
2523
2531
|
this.replayRestarting || this.eventBus.emit("replayState", { state: e });
|
|
2524
|
-
}), this.measureOverlay = new
|
|
2525
|
-
let e = new
|
|
2526
|
-
this.interactionManager.setPanHandler(new
|
|
2532
|
+
}), this.measureOverlay = new Xe(), this.interactionManager = new We(e), this.features.panning) {
|
|
2533
|
+
let e = new Pr();
|
|
2534
|
+
this.interactionManager.setPanHandler(new Qe((t, n) => {
|
|
2527
2535
|
t && this.viewport.scrollBy(t), e.step(t, n, this.priceFit.isAuto()) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
|
|
2528
2536
|
}, () => e.reset()));
|
|
2529
2537
|
}
|
|
@@ -2535,7 +2543,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2535
2543
|
scales: !this.indicatorEngine.hasLeftScaleOverlays()
|
|
2536
2544
|
}
|
|
2537
2545
|
})), this.features.zooming) {
|
|
2538
|
-
this.interactionManager.setZoomHandler(new
|
|
2546
|
+
this.interactionManager.setZoomHandler(new Mt((e, t) => {
|
|
2539
2547
|
this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
|
|
2540
2548
|
}));
|
|
2541
2549
|
let e = new _e((e) => {
|
|
@@ -2556,14 +2564,18 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2556
2564
|
viewportOf: (e) => this.drawingPaneViewport(e),
|
|
2557
2565
|
hasPane: (e) => this.layoutManager.getPanels().some((t) => t.id === e),
|
|
2558
2566
|
valuesAt: (e, t) => this.indicatorEngine.getPaneValuesAt(e, t)
|
|
2559
|
-
}), this.interactionManager.setDrawingDoubleClick((e) => this.eventBus.emit("drawingDoubleClick", {
|
|
2567
|
+
}), this.interactionManager.setDrawingDoubleClick((e, t) => this.eventBus.emit("drawingDoubleClick", {
|
|
2568
|
+
id: e,
|
|
2569
|
+
x: t.x,
|
|
2570
|
+
y: t.y
|
|
2571
|
+
})), this.interactionManager.setDrawingContextMenu((e, t) => {
|
|
2560
2572
|
this.drawingManager.select(e) && this.eventBus.emit("drawingContextMenu", {
|
|
2561
2573
|
id: e,
|
|
2562
2574
|
x: t.x,
|
|
2563
2575
|
y: t.y
|
|
2564
2576
|
});
|
|
2565
2577
|
})), 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) => {
|
|
2566
|
-
let t =
|
|
2578
|
+
let t = rn(e.y, this.viewport.getState());
|
|
2567
2579
|
Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
|
|
2568
2580
|
price: t,
|
|
2569
2581
|
x: e.x,
|
|
@@ -2576,21 +2588,49 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2576
2588
|
let e = new pe(this.alertManager, () => this.viewport.getState());
|
|
2577
2589
|
this.interactionManager.setAlertDragHandler(e);
|
|
2578
2590
|
}
|
|
2579
|
-
let c = new
|
|
2591
|
+
let c = new $e();
|
|
2580
2592
|
c.configure(() => this.getResolvedLayout(), (e, t) => this.dragPanelTo(e, t)), this.interactionManager.setPaneResizeHandler(c), this.interactionManager.setAltClickHandler((e) => {
|
|
2581
2593
|
let t = this.getDisplayData();
|
|
2582
2594
|
if (t.length === 0) return;
|
|
2583
2595
|
let n = this.viewport.getState(), r = n.barWidth + n.barSpacing, i = Math.round((n.offset + e.x) / r);
|
|
2584
2596
|
i < 0 || i >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === i ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[i], i, this.themeManager.getTheme(), f(t), p(t) === !0), this.pinnedTooltip.reposition(this.viewport.getState(), this.series.bars()[i] ?? null, i, this.themeManager.getTheme()), this.engine.requestRender(o.Overlay));
|
|
2585
|
-
}), this.interactionManager.setSignalMarkerHitTest((e) => this.eventBus.hasListeners("signalMarkerHover") || this.eventBus.hasListeners("signalMarkerClick") ? this.signalMarkerManager.markerAt(e, this.viewport.getState()) : null, (e, t) =>
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2597
|
+
}), this.interactionManager.setSignalMarkerHitTest((e) => this.markBadgeAt(e) ?? (this.eventBus.hasListeners("signalMarkerHover") || this.eventBus.hasListeners("signalMarkerClick") ? this.signalMarkerManager.markerAt(e, this.viewport.getState()) : null), (e, t) => {
|
|
2598
|
+
let n = e !== null && e === this.hoveredBadge ? this.hoveredBadge : null;
|
|
2599
|
+
if (!n && this.chartMarkManager.setHovered(null) && this.eventBus.emit("markHover", {
|
|
2600
|
+
marks: null,
|
|
2601
|
+
x: t.x,
|
|
2602
|
+
y: t.y
|
|
2603
|
+
}), this.lastHoverPos = t, n) {
|
|
2604
|
+
this.signalMarkerHovered && (this.signalMarkerHovered = !1, this.eventBus.emit("signalMarkerHover", {
|
|
2605
|
+
marker: null,
|
|
2606
|
+
x: t.x,
|
|
2607
|
+
y: t.y
|
|
2608
|
+
})), this.chartMarkManager.setHovered(n), this.eventBus.emit("markHover", {
|
|
2609
|
+
marks: n.marks.map((e) => ({ ...e })),
|
|
2610
|
+
x: t.x,
|
|
2611
|
+
y: t.y
|
|
2612
|
+
});
|
|
2613
|
+
return;
|
|
2614
|
+
}
|
|
2615
|
+
e === null && !this.signalMarkerHovered || (this.signalMarkerHovered = e !== null, this.eventBus.emit("signalMarkerHover", {
|
|
2616
|
+
marker: e,
|
|
2617
|
+
x: t.x,
|
|
2618
|
+
y: t.y
|
|
2619
|
+
}));
|
|
2620
|
+
}, () => this.chartMarkManager.isHovering() || this.eventBus.hasListeners("signalMarkerClick")), this.interactionManager.setClickHandler((e) => {
|
|
2621
|
+
let t = this.getDisplayData(), n = this.features.marks ? this.chartMarkManager.badgeAt(e, this.viewport.getState()) : null;
|
|
2591
2622
|
if (n) {
|
|
2623
|
+
this.eventBus.emit("markClick", {
|
|
2624
|
+
marks: n.marks.map((e) => ({ ...e })),
|
|
2625
|
+
x: e.x,
|
|
2626
|
+
y: e.y
|
|
2627
|
+
});
|
|
2628
|
+
return;
|
|
2629
|
+
}
|
|
2630
|
+
let r = this.eventBus.hasListeners("signalMarkerClick") ? this.signalMarkerManager.markerAt(e, this.viewport.getState()) : null;
|
|
2631
|
+
if (r) {
|
|
2592
2632
|
this.eventBus.emit("signalMarkerClick", {
|
|
2593
|
-
marker:
|
|
2633
|
+
marker: r,
|
|
2594
2634
|
x: e.x,
|
|
2595
2635
|
y: e.y
|
|
2596
2636
|
});
|
|
@@ -2600,10 +2640,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2600
2640
|
x: e.x,
|
|
2601
2641
|
y: e.y
|
|
2602
2642
|
}), t.length === 0) return;
|
|
2603
|
-
let
|
|
2604
|
-
|
|
2605
|
-
bar: t[
|
|
2606
|
-
barIndex:
|
|
2643
|
+
let i = nn(e.x, this.viewport.getState());
|
|
2644
|
+
i < 0 || i >= t.length || this.eventBus.emit("barClick", {
|
|
2645
|
+
bar: t[i],
|
|
2646
|
+
barIndex: i,
|
|
2607
2647
|
point: e
|
|
2608
2648
|
});
|
|
2609
2649
|
}), this.interactionManager.setEscapeHandler(() => {
|
|
@@ -2645,7 +2685,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2645
2685
|
end: () => {
|
|
2646
2686
|
let e = this.selectionBoxOverlay.end();
|
|
2647
2687
|
if (e && this.zoomAreaMode) {
|
|
2648
|
-
if (e.x1 - e.x0 <
|
|
2688
|
+
if (e.x1 - e.x0 < wi) return;
|
|
2649
2689
|
this.zoomToBox(e), this.setZoomAreaMode(!1);
|
|
2650
2690
|
return;
|
|
2651
2691
|
}
|
|
@@ -2727,7 +2767,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2727
2767
|
let { visibleRange: e, chartRect: t } = this.viewport.getState();
|
|
2728
2768
|
if (t.width <= 0) return;
|
|
2729
2769
|
let { from: n, to: r } = e;
|
|
2730
|
-
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(
|
|
2770
|
+
this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Ci, r - n));
|
|
2731
2771
|
}));
|
|
2732
2772
|
}
|
|
2733
2773
|
useStreamHistory(e, t, n = !0) {
|
|
@@ -2810,7 +2850,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2810
2850
|
}
|
|
2811
2851
|
setChartType(e) {
|
|
2812
2852
|
let t = this.options.chartType ?? "candlestick";
|
|
2813
|
-
this.options.chartType = e, this.themeManager.setChartType(e), this.chartRenderer = this.createChartRenderer(e), this.display.invalidate(), this.chartLegend.setChartType(e), this.applyTimeSpacing(), this.updateViewportAndRender(!0), this.fitFewColumns(), this.markStateChanged(), e !== t && this.eventBus.emit("chartTypeChange", {
|
|
2853
|
+
this.options.chartType = e, this.themeManager.setChartType(e), this.chartRenderer = this.createChartRenderer(e), this.display.invalidate(), this.chartLegend.setChartType(e), this.applyTimeSpacing(), this.updateViewportAndRender(!0), this.fitFewColumns(), this.markStateChanged(), this.isTimeAligned() || this.dropMarkHover(), e !== t && this.eventBus.emit("chartTypeChange", {
|
|
2814
2854
|
type: e,
|
|
2815
2855
|
previous: t
|
|
2816
2856
|
});
|
|
@@ -2841,7 +2881,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2841
2881
|
return this.extendedHours;
|
|
2842
2882
|
}
|
|
2843
2883
|
sessionKeep(e) {
|
|
2844
|
-
return this.extendedHours ? null :
|
|
2884
|
+
return this.extendedHours ? null : sn(this.symbolInfo, e);
|
|
2845
2885
|
}
|
|
2846
2886
|
reapplyExtendedHours() {
|
|
2847
2887
|
if (!this.series.refilter()) return;
|
|
@@ -2852,7 +2892,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2852
2892
|
return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
|
|
2853
2893
|
}
|
|
2854
2894
|
setShapes(e) {
|
|
2855
|
-
let t =
|
|
2895
|
+
let t = Ni(e);
|
|
2856
2896
|
t.tagRadius !== void 0 && (this.themeManager.setShape({
|
|
2857
2897
|
...this.themeManager.getTheme().shape,
|
|
2858
2898
|
...t
|
|
@@ -2864,7 +2904,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2864
2904
|
setFont(e) {
|
|
2865
2905
|
if (e === null) this.themeManager.setFont(null);
|
|
2866
2906
|
else {
|
|
2867
|
-
let t =
|
|
2907
|
+
let t = Mi(e);
|
|
2868
2908
|
if (Object.keys(t).length === 0) return;
|
|
2869
2909
|
this.themeManager.setFont(t);
|
|
2870
2910
|
}
|
|
@@ -2883,7 +2923,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2883
2923
|
if (e !== "comfortable" && e !== "compact" || e === this.density) return;
|
|
2884
2924
|
this.density = e;
|
|
2885
2925
|
let n = t[e];
|
|
2886
|
-
this.priceFit.setSpacing(n), this.chartLegend.setSpacing(
|
|
2926
|
+
this.priceFit.setSpacing(n), this.chartLegend.setSpacing(Zi(n)), this.options.rightMargin === void 0 && this.viewport.setRightMargin(n.rightMargin), this.options.barLayout || this.viewport.setBarLayout(n.barLayout), this.updateViewportAndRender();
|
|
2887
2927
|
}
|
|
2888
2928
|
getDensity() {
|
|
2889
2929
|
return this.density;
|
|
@@ -2989,8 +3029,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
2989
3029
|
return {
|
|
2990
3030
|
...e,
|
|
2991
3031
|
priceRange: {
|
|
2992
|
-
min: t.min - n *
|
|
2993
|
-
max: t.max + n *
|
|
3032
|
+
min: t.min - n * Si,
|
|
3033
|
+
max: t.max + n * Si
|
|
2994
3034
|
},
|
|
2995
3035
|
logScale: !1,
|
|
2996
3036
|
scaleMode: "regular",
|
|
@@ -3058,8 +3098,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3058
3098
|
return t.drawn ? this.indicatorEngine.peekOutput(e) : this.indicatorEngine.getOutput(e);
|
|
3059
3099
|
}
|
|
3060
3100
|
useIndicatorWorker() {
|
|
3061
|
-
this.indicatorWorker =
|
|
3062
|
-
minBars:
|
|
3101
|
+
this.indicatorWorker = Lt.acquire(), this.indicatorEngine.useWorker(this.indicatorWorker.client, {
|
|
3102
|
+
minBars: He,
|
|
3063
3103
|
onLand: () => this.indicatorsLandedSoon()
|
|
3064
3104
|
});
|
|
3065
3105
|
}
|
|
@@ -3081,8 +3121,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3081
3121
|
return this.pluginManager;
|
|
3082
3122
|
}
|
|
3083
3123
|
static indicators() {
|
|
3084
|
-
let e = new
|
|
3085
|
-
return
|
|
3124
|
+
let e = new Ue();
|
|
3125
|
+
return qt(e), e.getAvailableIndicators();
|
|
3086
3126
|
}
|
|
3087
3127
|
setPanelPosition(e, t) {
|
|
3088
3128
|
this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
|
|
@@ -3298,7 +3338,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3298
3338
|
}
|
|
3299
3339
|
autoFib() {
|
|
3300
3340
|
if (!this.features.drawings) return null;
|
|
3301
|
-
let e = this.getDisplayData(), t = this.viewport.getState(), n =
|
|
3341
|
+
let e = this.getDisplayData(), t = this.viewport.getState(), n = Pt(e, t.visibleRange.from, t.visibleRange.to);
|
|
3302
3342
|
return n ? this.addDrawing({
|
|
3303
3343
|
type: "fibRetracement",
|
|
3304
3344
|
anchors: [n[0], n[1]]
|
|
@@ -3311,14 +3351,17 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3311
3351
|
return this.drawingManager.removeDrawings(e);
|
|
3312
3352
|
}
|
|
3313
3353
|
nudgeSelectedDrawings(e) {
|
|
3314
|
-
let t =
|
|
3354
|
+
let t = Ei[e.key];
|
|
3315
3355
|
if (!t || !this.features.drawings || e.ctrlKey || e.metaKey || e.altKey) return !1;
|
|
3316
|
-
let n = e.shiftKey ?
|
|
3356
|
+
let n = e.shiftKey ? Ti : 1, r = {
|
|
3317
3357
|
...this.viewport.getState(),
|
|
3318
3358
|
data: this.getDisplayData()
|
|
3319
3359
|
};
|
|
3320
3360
|
return this.drawingManager.nudge(t[0] * n, t[1] * n, r);
|
|
3321
3361
|
}
|
|
3362
|
+
getDrawingTextSize(e) {
|
|
3363
|
+
return this.drawingManager.textSizeOf(e);
|
|
3364
|
+
}
|
|
3322
3365
|
getDrawingTextRect(e) {
|
|
3323
3366
|
return this.drawingManager.isShown(e) ? this.drawingManager.textBoxOf(e, {
|
|
3324
3367
|
...this.viewport.getState(),
|
|
@@ -3454,7 +3497,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3454
3497
|
x: t.x,
|
|
3455
3498
|
y: t.y
|
|
3456
3499
|
};
|
|
3457
|
-
if ((e === "plot" || e === "priceAxis") && (r.price =
|
|
3500
|
+
if ((e === "plot" || e === "priceAxis") && (r.price = rn(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = P(t.x, n)), e === "pane") {
|
|
3458
3501
|
let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
|
|
3459
3502
|
e && (r.pane = e.instanceId);
|
|
3460
3503
|
}
|
|
@@ -3462,7 +3505,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3462
3505
|
}
|
|
3463
3506
|
applyPriceAxisAdd() {
|
|
3464
3507
|
let e = this.features.priceAxisAddButton && this.features.crosshair;
|
|
3465
|
-
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ?
|
|
3508
|
+
this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Ze : 0);
|
|
3466
3509
|
}
|
|
3467
3510
|
setPriceAxisAddButton(e) {
|
|
3468
3511
|
this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay);
|
|
@@ -3720,7 +3763,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3720
3763
|
}
|
|
3721
3764
|
checkAlerts(e) {
|
|
3722
3765
|
let t = this.replaySession ? this.series.liveBars() : this.series.bars(), n = this.indicatorEngine, r = this.replaySession || this.series.length() === 0 ? null : (e) => n.isComputingInWorker(e) ? void 0 : n.peekOutput(e)?.series;
|
|
3723
|
-
|
|
3766
|
+
li(this.alertManager, {
|
|
3724
3767
|
price: e,
|
|
3725
3768
|
barTime: t.length > 0 ? t[t.length - 1].time : null,
|
|
3726
3769
|
lines: r
|
|
@@ -3732,11 +3775,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3732
3775
|
async connect(e) {
|
|
3733
3776
|
let t = {
|
|
3734
3777
|
...e,
|
|
3735
|
-
adapter:
|
|
3778
|
+
adapter: Yt(e),
|
|
3736
3779
|
feed: void 0
|
|
3737
3780
|
};
|
|
3738
|
-
if (!
|
|
3739
|
-
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new
|
|
3781
|
+
if (!Jt(t.adapter, t.timeframe)) throw RangeError(`${t.adapter.name} cannot serve the ${t.timeframe} timeframe`);
|
|
3782
|
+
this.snapshotKey = null, this.holdReplayFor(t.symbol), this.disconnectStream(), this.streamManager = new bt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (e) => {
|
|
3740
3783
|
let n = this.streamSeriesKey(t.adapter);
|
|
3741
3784
|
n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(e) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(e) : (this.replaySession && this.useStreamHistory(t.adapter, t.historyPageSize, !1), this.setData(e)), this.snapshotKey = n, this.useStreamHistory(t.adapter, t.historyPageSize);
|
|
3742
3785
|
}), this.streamManager.on("barClose", (e) => {
|
|
@@ -3798,7 +3841,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3798
3841
|
}, 1e3);
|
|
3799
3842
|
}
|
|
3800
3843
|
streamSeriesKey(e) {
|
|
3801
|
-
let t = N(e), n = this.streamTimeframe, r = t instanceof
|
|
3844
|
+
let t = N(e), n = this.streamTimeframe, r = t instanceof ut && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
|
|
3802
3845
|
return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
|
|
3803
3846
|
}
|
|
3804
3847
|
setStreamTarget(e, t) {
|
|
@@ -3821,7 +3864,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3821
3864
|
async switchStream(e, t) {
|
|
3822
3865
|
if (!this.streamManager) return;
|
|
3823
3866
|
let n = this.streamAdapter;
|
|
3824
|
-
if (n && !
|
|
3867
|
+
if (n && !Jt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
|
|
3825
3868
|
this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(E(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
|
|
3826
3869
|
}
|
|
3827
3870
|
isIndicatorAllowed(e) {
|
|
@@ -3841,7 +3884,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3841
3884
|
}
|
|
3842
3885
|
connectExecution(e, t = {}) {
|
|
3843
3886
|
if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
|
|
3844
|
-
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown =
|
|
3887
|
+
this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Wr(e, {
|
|
3845
3888
|
onIntent: (e, t) => {
|
|
3846
3889
|
let n = (e) => t(e.payload);
|
|
3847
3890
|
return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
|
|
@@ -3972,7 +4015,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
3972
4015
|
setVisibleRangePreset(e) {
|
|
3973
4016
|
let t = this.getDisplayData();
|
|
3974
4017
|
if (t.length === 0) return;
|
|
3975
|
-
let n = t.length - 1, r = f(t), i =
|
|
4018
|
+
let n = t.length - 1, r = f(t), i = Wt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
|
|
3976
4019
|
if (a === null || a < t[0].time) {
|
|
3977
4020
|
this.fitContent();
|
|
3978
4021
|
return;
|
|
@@ -4157,14 +4200,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4157
4200
|
return this.crosshairHandler.getMode();
|
|
4158
4201
|
}
|
|
4159
4202
|
setCrosshairCursor(e) {
|
|
4160
|
-
!
|
|
4203
|
+
!Rt(e) || e === this.crosshairHandler.getCursor() || (this.crosshairHandler.setCursor(e), this.applyIdleCursor(), this.engine.requestRender(o.Hover), this.eventBus.emit("crosshairCursorChange", { cursor: e }));
|
|
4161
4204
|
}
|
|
4162
4205
|
getCrosshairCursor() {
|
|
4163
4206
|
return this.crosshairHandler.getCursor();
|
|
4164
4207
|
}
|
|
4165
4208
|
applyIdleCursor() {
|
|
4166
4209
|
let e = this.themeManager.getTheme(), t = e.style?.crosshair.vertical.color ?? e.crosshair;
|
|
4167
|
-
this.interactionManager.setIdleCursor(
|
|
4210
|
+
this.interactionManager.setIdleCursor(It(this.crosshairHandler.getCursor(), t, e.background));
|
|
4168
4211
|
}
|
|
4169
4212
|
setCrosshairPosition(e) {
|
|
4170
4213
|
e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(o.Hover);
|
|
@@ -4259,7 +4302,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4259
4302
|
return this.periodLevels.getPeriod();
|
|
4260
4303
|
}
|
|
4261
4304
|
setTimeZone(e) {
|
|
4262
|
-
|
|
4305
|
+
xi(e), this.timeZoneSetting = e, this.applyTimeZone();
|
|
4263
4306
|
}
|
|
4264
4307
|
getTimeZone() {
|
|
4265
4308
|
return this.timeZoneSetting;
|
|
@@ -4280,7 +4323,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4280
4323
|
this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
|
|
4281
4324
|
}
|
|
4282
4325
|
holdStudyZone() {
|
|
4283
|
-
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(),
|
|
4326
|
+
this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), pt);
|
|
4284
4327
|
}
|
|
4285
4328
|
endStudyZoneWait() {
|
|
4286
4329
|
this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
|
|
@@ -4372,7 +4415,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4372
4415
|
return this.sessionShading.isVisible();
|
|
4373
4416
|
}
|
|
4374
4417
|
setSessionShadingConfig(e) {
|
|
4375
|
-
this.hostSessionHours =
|
|
4418
|
+
this.hostSessionHours = Ht(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(o.Background);
|
|
4376
4419
|
}
|
|
4377
4420
|
setTooltipVisible(e) {
|
|
4378
4421
|
e || this.crosshairTooltip.hide();
|
|
@@ -4394,11 +4437,11 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4394
4437
|
return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
|
|
4395
4438
|
}
|
|
4396
4439
|
async takeGpu(e, t, n) {
|
|
4397
|
-
let { gpu: r, reason: i } = await
|
|
4398
|
-
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ?
|
|
4440
|
+
let { gpu: r, reason: i } = await Vt(e);
|
|
4441
|
+
return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? Ft() > 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());
|
|
4399
4442
|
}
|
|
4400
4443
|
waitForGpu(e) {
|
|
4401
|
-
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ?
|
|
4444
|
+
this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? tn(e) : null;
|
|
4402
4445
|
}
|
|
4403
4446
|
getRenderer() {
|
|
4404
4447
|
return this.engine.getGpu() ? "webgl" : "canvas";
|
|
@@ -4542,6 +4585,36 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4542
4585
|
setSignalMarkerStyle(e) {
|
|
4543
4586
|
this.signalMarkerManager.setStyle(e);
|
|
4544
4587
|
}
|
|
4588
|
+
setMarks(e) {
|
|
4589
|
+
this.marksChanged(() => this.chartMarkManager.setMarks(e), !0);
|
|
4590
|
+
}
|
|
4591
|
+
addMark(e) {
|
|
4592
|
+
return this.marksChanged(() => this.chartMarkManager.addMark(e), (e) => e !== null);
|
|
4593
|
+
}
|
|
4594
|
+
removeMark(e) {
|
|
4595
|
+
this.marksChanged(() => this.chartMarkManager.removeMark(e), !1);
|
|
4596
|
+
}
|
|
4597
|
+
marksChanged(e, t) {
|
|
4598
|
+
let n = this.chartMarkManager.count(), r = e(), i = this.chartMarkManager.count();
|
|
4599
|
+
return ((typeof t == "function" ? t(r) : t) || i !== n) && (this.dropMarkHover(), this.eventBus.emit("marksChange", { count: i })), r;
|
|
4600
|
+
}
|
|
4601
|
+
dropMarkHover() {
|
|
4602
|
+
this.hoveredBadge = null, this.chartMarkManager.setHovered(null) && this.eventBus.emit("markHover", {
|
|
4603
|
+
marks: null,
|
|
4604
|
+
x: this.lastHoverPos.x,
|
|
4605
|
+
y: this.lastHoverPos.y
|
|
4606
|
+
});
|
|
4607
|
+
}
|
|
4608
|
+
getMarks() {
|
|
4609
|
+
return this.chartMarkManager.getMarks();
|
|
4610
|
+
}
|
|
4611
|
+
clearMarks() {
|
|
4612
|
+
this.marksChanged(() => this.chartMarkManager.clearMarks(), !1);
|
|
4613
|
+
}
|
|
4614
|
+
markBadgeAt(e) {
|
|
4615
|
+
let t = this.features.marks ? this.chartMarkManager.badgeAt(e, this.viewport.getState()) : null;
|
|
4616
|
+
return t !== null && this.hoveredBadge !== null && t.marks[0].id === this.hoveredBadge.marks[0].id && t.marks.length === this.hoveredBadge.marks.length || (this.hoveredBadge = t), this.hoveredBadge;
|
|
4617
|
+
}
|
|
4545
4618
|
addTradeZone(e) {
|
|
4546
4619
|
return this.tradeZoneManager.addZone(e);
|
|
4547
4620
|
}
|
|
@@ -4568,7 +4641,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4568
4641
|
let t = this.replaySession ? this.replayOffset : 0;
|
|
4569
4642
|
if (!this.replaySession) {
|
|
4570
4643
|
if (this.series.length() === 0) return;
|
|
4571
|
-
this.series.beginReplay(), this.replaySession =
|
|
4644
|
+
this.series.beginReplay(), this.replaySession = Ri(this.currentSymbol);
|
|
4572
4645
|
}
|
|
4573
4646
|
let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
|
|
4574
4647
|
c.animate = c.animate === !0;
|
|
@@ -4579,13 +4652,13 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4579
4652
|
let m = r ? this.replayStepsOver(n, p, !0) : null;
|
|
4580
4653
|
this.priceFit.resume(), this.buildReplay(p, m, f);
|
|
4581
4654
|
let h = this.replayStepsSeries;
|
|
4582
|
-
h && c.startIndex !== void 0 && (c.startIndex =
|
|
4655
|
+
h && c.startIndex !== void 0 && (c.startIndex = Ki(h, p, c.startIndex));
|
|
4583
4656
|
let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
|
|
4584
4657
|
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);
|
|
4585
4658
|
}
|
|
4586
4659
|
buildReplay(e, t, n) {
|
|
4587
4660
|
let r = this.replaySession?.animate === !0, i = r ? null : t;
|
|
4588
|
-
this.replayPieces = r && t ?
|
|
4661
|
+
this.replayPieces = r && t ? Yi(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
|
|
4589
4662
|
let a = this.replayRestarting;
|
|
4590
4663
|
this.replayRestarting = !0;
|
|
4591
4664
|
try {
|
|
@@ -4599,7 +4672,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4599
4672
|
let n = t, a = e[t];
|
|
4600
4673
|
if (i) {
|
|
4601
4674
|
let r = i[t];
|
|
4602
|
-
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ?
|
|
4675
|
+
n = Z(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? Qi(c, r) : qi(e[n], i, t), a = Ji(i, e, t, n) ? e[n] : c;
|
|
4603
4676
|
}
|
|
4604
4677
|
let u = this.replayForming;
|
|
4605
4678
|
this.replayForming = null, s = t;
|
|
@@ -4623,7 +4696,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4623
4696
|
});
|
|
4624
4697
|
}), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
|
|
4625
4698
|
if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
|
|
4626
|
-
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i =
|
|
4699
|
+
let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Xi() ? ai(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = ii(r, i);
|
|
4627
4700
|
a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
|
|
4628
4701
|
index: t,
|
|
4629
4702
|
path: r
|
|
@@ -4641,19 +4714,19 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4641
4714
|
}
|
|
4642
4715
|
replayPathOf(e, t) {
|
|
4643
4716
|
let n = e[t];
|
|
4644
|
-
return
|
|
4717
|
+
return $r(n, this.replayPieces?.get(n.time) ?? this.replayLoader?.loader.piecesOf(n.time) ?? []);
|
|
4645
4718
|
}
|
|
4646
4719
|
loadReplaySteps(e, t) {
|
|
4647
4720
|
let n = this.replayLoader?.loader;
|
|
4648
4721
|
if (!n) return;
|
|
4649
4722
|
n.evictBefore(e[t].time);
|
|
4650
4723
|
let r = this.replayManager.getStepMs();
|
|
4651
|
-
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(
|
|
4724
|
+
n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(Pi / r) : 1);
|
|
4652
4725
|
}
|
|
4653
4726
|
useReplayLoader(e, t) {
|
|
4654
|
-
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ?
|
|
4727
|
+
let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? ci(e.step, r, (e) => Jt(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
|
|
4655
4728
|
if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
|
|
4656
|
-
let o = N(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new
|
|
4729
|
+
let o = N(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = E(r), u = new Kr({
|
|
4657
4730
|
source: s ? (e, t) => s.call(o, c, i, e, t) : null,
|
|
4658
4731
|
step: i,
|
|
4659
4732
|
ratio: Math.max(1, Math.round(l / E(i))),
|
|
@@ -4669,7 +4742,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4669
4742
|
feedReplayForming(e, t, n, r) {
|
|
4670
4743
|
let i = this.replaySession;
|
|
4671
4744
|
if (!i || !this.executionAdapter?.setMarkPrice) return;
|
|
4672
|
-
let a =
|
|
4745
|
+
let a = yi(e, t, n, r, {
|
|
4673
4746
|
time: i.fedTime,
|
|
4674
4747
|
fraction: i.fedFraction
|
|
4675
4748
|
}, (e, t) => this.replayPathOf(e, t));
|
|
@@ -4693,7 +4766,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4693
4766
|
if (n.length === 0) return;
|
|
4694
4767
|
let r = t.windowTime === null ? 0 : Math.min(J(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
|
|
4695
4768
|
this.useReplayLoader(t, !1);
|
|
4696
|
-
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 :
|
|
4769
|
+
let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : Vi(o ?? i, t.until);
|
|
4697
4770
|
if (s < 0 && this.canPageBackForReplay(t)) {
|
|
4698
4771
|
this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
|
|
4699
4772
|
return;
|
|
@@ -4701,7 +4774,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4701
4774
|
let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
|
|
4702
4775
|
l || (t.held = null), t.symbol = this.currentSymbol;
|
|
4703
4776
|
let d = this.replayManager.remainingMs();
|
|
4704
|
-
this.clearBarHolders(), t.animate &&
|
|
4777
|
+
this.clearBarHolders(), t.animate && Bi(t, this.replayCoarse, i);
|
|
4705
4778
|
let f = this.replayRestarting;
|
|
4706
4779
|
this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
|
|
4707
4780
|
try {
|
|
@@ -4724,14 +4797,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4724
4797
|
}
|
|
4725
4798
|
replayStepsOver(e, t, n = !1) {
|
|
4726
4799
|
if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
|
|
4727
|
-
let r =
|
|
4728
|
-
return r && (n ||
|
|
4800
|
+
let r = Gi(this.series.inHoursShown(e.steps), t);
|
|
4801
|
+
return r && (n || Ui(r, t)) ? r : null;
|
|
4729
4802
|
}
|
|
4730
4803
|
canPageBackForReplay(e) {
|
|
4731
|
-
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) <
|
|
4804
|
+
return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < Fi;
|
|
4732
4805
|
}
|
|
4733
4806
|
async pageBackForReplay(e) {
|
|
4734
|
-
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack =
|
|
4807
|
+
this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = Fi, this.rebaseReplay("older"));
|
|
4735
4808
|
}
|
|
4736
4809
|
holdReplay() {
|
|
4737
4810
|
let e = this.replaySession;
|
|
@@ -4761,10 +4834,10 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4761
4834
|
}
|
|
4762
4835
|
revealReplayMarks(e) {
|
|
4763
4836
|
let t = e !== null && this.replayOffset > 0 ? this.replayCoarse?.[0]?.time ?? -Infinity : -Infinity;
|
|
4764
|
-
this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4837
|
+
this.signalMarkerManager.setRevealUntil(e, t), this.chartMarkManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
|
|
4765
4838
|
}
|
|
4766
4839
|
replaySeekToTime(e) {
|
|
4767
|
-
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0,
|
|
4840
|
+
!this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, Vi(this.replayStepsSeries ?? this.replayCoarse, e)));
|
|
4768
4841
|
}
|
|
4769
4842
|
feedReplayPrice(e, t) {
|
|
4770
4843
|
let n = this.executionAdapter;
|
|
@@ -4779,7 +4852,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4779
4852
|
feedReplaySteps(e, t) {
|
|
4780
4853
|
let n = this.replaySession;
|
|
4781
4854
|
if (!n || !this.executionAdapter?.setMarkPrice) return;
|
|
4782
|
-
let r =
|
|
4855
|
+
let r = vi(e, t, {
|
|
4783
4856
|
time: n.fedTime,
|
|
4784
4857
|
fraction: n.fedFraction
|
|
4785
4858
|
});
|
|
@@ -4793,7 +4866,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4793
4866
|
}
|
|
4794
4867
|
replaySeekToBar(e) {
|
|
4795
4868
|
let t = this.replayStepsSeries;
|
|
4796
|
-
this.replaySeek(t && this.replayCoarse ?
|
|
4869
|
+
this.replaySeek(t && this.replayCoarse ? Ki(t, this.replayCoarse, e) : e);
|
|
4797
4870
|
}
|
|
4798
4871
|
replayPause() {
|
|
4799
4872
|
this.setHeldState("paused") || this.replayManager.pause();
|
|
@@ -4834,7 +4907,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4834
4907
|
let { x: r, y: c } = this.drawingManager.anchorPoint(t.type, e, n);
|
|
4835
4908
|
i = Math.min(i, r), a = Math.max(a, r), o = Math.min(o, c), s = Math.max(s, c);
|
|
4836
4909
|
}
|
|
4837
|
-
if (
|
|
4910
|
+
if (Di.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Oi.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;
|
|
4838
4911
|
let c = this.drawingManager.drawnExtent(e);
|
|
4839
4912
|
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 ? {
|
|
4840
4913
|
x: i,
|
|
@@ -4885,12 +4958,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4885
4958
|
});
|
|
4886
4959
|
}
|
|
4887
4960
|
restoreIndicators(e, t) {
|
|
4888
|
-
let n =
|
|
4961
|
+
let n = rr(e), r = /* @__PURE__ */ new Map();
|
|
4889
4962
|
this.unrestoredIndicators = [];
|
|
4890
4963
|
let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
|
|
4891
4964
|
if (t) {
|
|
4892
4965
|
let e = this.getIndicatorSetup();
|
|
4893
|
-
for (let t of
|
|
4966
|
+
for (let t of ar(e, n)) o.add(t);
|
|
4894
4967
|
for (let t of e) o.has(t.instanceId) || this.removeIndicator(t.instanceId);
|
|
4895
4968
|
let t = new Map(e.map((e) => [e.instanceId, e.pane]));
|
|
4896
4969
|
for (let e = !0; e;) {
|
|
@@ -4901,7 +4974,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4901
4974
|
}
|
|
4902
4975
|
}
|
|
4903
4976
|
} else for (let e of this.indicatorEngine.getActiveIndicators()) this.removeIndicator(e.instanceId);
|
|
4904
|
-
let s = (e) =>
|
|
4977
|
+
let s = (e) => sr(e, r);
|
|
4905
4978
|
for (let e of n) {
|
|
4906
4979
|
let n = null;
|
|
4907
4980
|
if (o.has(e.instanceId)) {
|
|
@@ -4934,7 +5007,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4934
5007
|
}
|
|
4935
5008
|
r.set(e.instanceId, n), a.push([e, n]), this.restoreLooks(n, e);
|
|
4936
5009
|
}
|
|
4937
|
-
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])),
|
|
5010
|
+
return this.indicatorEngine.orderIndicators(e.flatMap((e) => r.get(e.instanceId) ?? [])), nr(this.layoutManager, a), this.updateViewportAndRender(), r;
|
|
4938
5011
|
}
|
|
4939
5012
|
restoreLooks(e, t) {
|
|
4940
5013
|
let { plots: n, ...r } = this.indicatorEngine.getIndicatorStyle(e) ?? {
|
|
@@ -4954,7 +5027,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4954
5027
|
JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? oe(t.paneStyle) : null);
|
|
4955
5028
|
}
|
|
4956
5029
|
getIndicatorSetup() {
|
|
4957
|
-
return [...
|
|
5030
|
+
return [...tr(this.indicatorEngine, this.layoutManager, (e) => this.panes.style(e) ?? null), ...this.unrestoredIndicators];
|
|
4958
5031
|
}
|
|
4959
5032
|
applyIndicatorSetup(e) {
|
|
4960
5033
|
this.features.indicators && this.indicatorHistory.record(void 0, () => {
|
|
@@ -4963,7 +5036,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4963
5036
|
});
|
|
4964
5037
|
}
|
|
4965
5038
|
followIndicatorAlerts(e, t) {
|
|
4966
|
-
this.features.alerts &&
|
|
5039
|
+
this.features.alerts && di(this.alertManager, e, t, (e) => this.indicatorEngine.getIndicatorConfig(e)?.id);
|
|
4967
5040
|
}
|
|
4968
5041
|
beginIndicatorEdit(e) {
|
|
4969
5042
|
this.indicatorHistory.begin(e);
|
|
@@ -4987,17 +5060,17 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
4987
5060
|
keptPaneDrawings = [];
|
|
4988
5061
|
replayingIndicatorStep = !1;
|
|
4989
5062
|
takesDrawing(e, t) {
|
|
4990
|
-
return
|
|
5063
|
+
return pr(this.layoutManager.getPanels(), e, !!this.drawingManager.getDescriptor(t)?.priceOnly);
|
|
4991
5064
|
}
|
|
4992
5065
|
renamePane(e, t) {
|
|
4993
5066
|
this.layoutManager.renamePanel(e, t), this.replayingIndicatorStep || this.drawingManager.renamePanes(new Map([[e, t]])), this.indicatorHistory.renamed(e, t);
|
|
4994
5067
|
}
|
|
4995
5068
|
drawingPaneAt(e) {
|
|
4996
|
-
return
|
|
5069
|
+
return dr(e, this.viewport.getState().chartRect, this.layoutManager.getPanels(), (e) => this.drawingPaneViewport(e));
|
|
4997
5070
|
}
|
|
4998
5071
|
drawingPaneViewport(e) {
|
|
4999
5072
|
let t = this.layoutManager.getPanels().find((t) => t.id === e);
|
|
5000
|
-
return
|
|
5073
|
+
return fr(t, !!t && this.layoutManager.isPanelShownCollapsed(e), () => this.buildPanelRenderInfos().find((t) => t.instanceId === e)?.viewport, () => this.getDisplayData());
|
|
5001
5074
|
}
|
|
5002
5075
|
saveState(e) {
|
|
5003
5076
|
if (!this.features.saveLoad) return null;
|
|
@@ -5011,7 +5084,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5011
5084
|
let n = t.version >= 2 && this.features.indicators ? this.indicatorHistory.quietly(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
|
|
5012
5085
|
this.drawingManager.renamePanes(n);
|
|
5013
5086
|
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));
|
|
5014
|
-
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts &&
|
|
5087
|
+
this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts && mi(this.alertManager, t.alerts, n, (e) => this.drawingManager.hasPriceLevels(e), (e) => {
|
|
5015
5088
|
console.warn("Layout alert left out:", e);
|
|
5016
5089
|
}), this.markStateChanged();
|
|
5017
5090
|
}
|
|
@@ -5064,7 +5137,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5064
5137
|
}
|
|
5065
5138
|
setFeatures(e) {
|
|
5066
5139
|
let t = this.getLegendBottom();
|
|
5067
|
-
Object.assign(this.features, e), e.legend !== void 0 && this.getLegendBottom() !== t && this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), (e.priceAxisAddButton !== void 0 || e.crosshair !== void 0) && (this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay)), e.grid !== void 0 && this.engine.requestRender(o.Background), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.updateViewportAndRender()), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
|
|
5140
|
+
Object.assign(this.features, e), e.legend !== void 0 && this.getLegendBottom() !== t && this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), (e.priceAxisAddButton !== void 0 || e.crosshair !== void 0) && (this.applyPriceAxisAdd(), this.engine.requestRender(o.Overlay)), e.grid !== void 0 && this.engine.requestRender(o.Background), e.marks !== void 0 && (e.marks || this.dropMarkHover(), this.engine.requestRender(o.Overlay)), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.updateViewportAndRender()), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
|
|
5068
5141
|
}
|
|
5069
5142
|
resize() {
|
|
5070
5143
|
let e = this.engine.dprManager.readContainerSize();
|
|
@@ -5079,8 +5152,8 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5079
5152
|
this.disposed = !0, this.indicatorEngine.stopWorker(), this.indicatorWorker?.release(), this.indicatorWorker = null, this.stopWatchingVisibility?.(), this.stopWatchingVisibility = null, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.labelWidths.destroy(), this.container.innerHTML = "";
|
|
5080
5153
|
}
|
|
5081
5154
|
createChartRenderer(e) {
|
|
5082
|
-
let t =
|
|
5083
|
-
return t instanceof
|
|
5155
|
+
let t = Pn(e, (e) => this.pluginManager.getChartType(e));
|
|
5156
|
+
return t instanceof Be && t.setPriceText((e) => this.formatPrice(e)), t;
|
|
5084
5157
|
}
|
|
5085
5158
|
crosshairSeries() {
|
|
5086
5159
|
return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
|
|
@@ -5157,7 +5230,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5157
5230
|
this.priceFit.fit(this.viewport, e, t, {
|
|
5158
5231
|
overlayRange: (e, t) => this.indicatorEngine.getOverlayPriceRange(e, t),
|
|
5159
5232
|
compareRange: (e, t) => this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null,
|
|
5160
|
-
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() &&
|
|
5233
|
+
volumeRatio: (e, t, n) => this.features.volume && this.volumeRenderer.isVisible() && Kn(e, t, n) ? this.volumeRenderer.getHeightRatio() : null
|
|
5161
5234
|
});
|
|
5162
5235
|
}
|
|
5163
5236
|
updateViewportAndRender(e = !1) {
|
|
@@ -5172,7 +5245,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5172
5245
|
fitLeftAxisWidth() {
|
|
5173
5246
|
let e = this.leftViewport;
|
|
5174
5247
|
if (!e) return !1;
|
|
5175
|
-
let t = this.themeManager.getTheme(), n =
|
|
5248
|
+
let t = this.themeManager.getTheme(), n = Ar({
|
|
5176
5249
|
min: e.priceRange.min,
|
|
5177
5250
|
max: e.priceRange.max,
|
|
5178
5251
|
lastPrice: null,
|
|
@@ -5181,12 +5254,12 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5181
5254
|
fontFamily: t.font.family,
|
|
5182
5255
|
fontSizeSmall: t.font.sizeSmall,
|
|
5183
5256
|
measure: (e, t) => this.measureText(e, t)
|
|
5184
|
-
}), r =
|
|
5257
|
+
}), r = jr(this.leftAxisWidth, n);
|
|
5185
5258
|
return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.panes.invalidate(), this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
|
|
5186
5259
|
}
|
|
5187
5260
|
fitPriceAxisWidth() {
|
|
5188
5261
|
if (!this.features.priceAxis) return !1;
|
|
5189
|
-
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n =
|
|
5262
|
+
let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = Ar({
|
|
5190
5263
|
min: e.min,
|
|
5191
5264
|
max: e.max,
|
|
5192
5265
|
lastPrice: this.currentPriceLine.getPrice(),
|
|
@@ -5197,14 +5270,14 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5197
5270
|
fontFamily: t.font.family,
|
|
5198
5271
|
fontSizeSmall: t.font.sizeSmall,
|
|
5199
5272
|
measure: (e, t) => this.measureText(e, t)
|
|
5200
|
-
}), r =
|
|
5273
|
+
}), r = jr(this.priceAxisWidth, n);
|
|
5201
5274
|
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);
|
|
5202
5275
|
}
|
|
5203
5276
|
measureText(e, t) {
|
|
5204
5277
|
let n = this.engine.layerManager.getLayer(o.Main)?.ctx;
|
|
5205
|
-
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () =>
|
|
5278
|
+
if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => Ai(n, e, t));
|
|
5206
5279
|
let r = n ?? this.detachedMeasureContext();
|
|
5207
|
-
return r ?
|
|
5280
|
+
return r ? Ai(r, e, t) : e.length * 7;
|
|
5208
5281
|
}
|
|
5209
5282
|
detachedMeasureContext() {
|
|
5210
5283
|
return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
|
|
@@ -5271,6 +5344,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5271
5344
|
selectionBoxOverlay: this.selectionBoxOverlay,
|
|
5272
5345
|
priceAxisAddButton: this.priceAxisAddButton,
|
|
5273
5346
|
signalMarkerManager: this.signalMarkerManager,
|
|
5347
|
+
chartMarkManager: this.features.marks ? this.chartMarkManager : null,
|
|
5274
5348
|
tradeZoneManager: this.tradeZoneManager,
|
|
5275
5349
|
panels: e,
|
|
5276
5350
|
priceLimits: this.buildPriceLimits(),
|
|
@@ -5292,7 +5366,7 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5292
5366
|
});
|
|
5293
5367
|
}
|
|
5294
5368
|
drawOverlayPlugins(e, t) {
|
|
5295
|
-
let n =
|
|
5369
|
+
let n = Ir(this.pluginManager.getOverlays(), t);
|
|
5296
5370
|
if (n.length === 0) return;
|
|
5297
5371
|
let r = {
|
|
5298
5372
|
viewport: this.viewport.getState(),
|
|
@@ -5313,15 +5387,15 @@ var xi = .08, Si = 20, Ci = 8, wi = 10, Ti = {
|
|
|
5313
5387
|
};
|
|
5314
5388
|
}
|
|
5315
5389
|
};
|
|
5316
|
-
function
|
|
5390
|
+
function Ai(e, t, n) {
|
|
5317
5391
|
let r = e.font;
|
|
5318
5392
|
e.font = n;
|
|
5319
5393
|
let i = e.measureText(t).width;
|
|
5320
5394
|
return e.font = r, i;
|
|
5321
5395
|
}
|
|
5322
|
-
var
|
|
5323
|
-
function
|
|
5324
|
-
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <=
|
|
5396
|
+
var ji = 300;
|
|
5397
|
+
function Mi(e) {
|
|
5398
|
+
let t = {}, n = (e) => typeof e == "string" && e.trim() !== "" && e.length <= ji && !/[;{}<>\\]|\/\*/.test(e);
|
|
5325
5399
|
n(e.family) && (t.family = e.family), n(e.textFamily) && (t.textFamily = e.textFamily);
|
|
5326
5400
|
for (let n of [
|
|
5327
5401
|
"sizeSmall",
|
|
@@ -5333,7 +5407,7 @@ function ji(e) {
|
|
|
5333
5407
|
}
|
|
5334
5408
|
return t;
|
|
5335
5409
|
}
|
|
5336
|
-
function
|
|
5410
|
+
function Ni(e) {
|
|
5337
5411
|
let t = e.tagRadius;
|
|
5338
5412
|
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
|
|
5339
5413
|
}
|
|
@@ -5352,8 +5426,8 @@ function X(e) {
|
|
|
5352
5426
|
bars: e.bars
|
|
5353
5427
|
};
|
|
5354
5428
|
}
|
|
5355
|
-
var
|
|
5356
|
-
function
|
|
5429
|
+
var Pi = 8e3, Fi = 10, Ii = 50, Li = .001;
|
|
5430
|
+
function Ri(e) {
|
|
5357
5431
|
return {
|
|
5358
5432
|
price: null,
|
|
5359
5433
|
fedTime: null,
|
|
@@ -5368,48 +5442,48 @@ function Li(e) {
|
|
|
5368
5442
|
held: null
|
|
5369
5443
|
};
|
|
5370
5444
|
}
|
|
5371
|
-
function
|
|
5445
|
+
function zi(e, t) {
|
|
5372
5446
|
let n = e[t + 1];
|
|
5373
|
-
return n ? n.time - e[t].time :
|
|
5447
|
+
return n ? n.time - e[t].time : Wi(e);
|
|
5374
5448
|
}
|
|
5375
|
-
function
|
|
5449
|
+
function Bi(e, t, n) {
|
|
5376
5450
|
let r = e.fedTime;
|
|
5377
5451
|
if (r === null || !t || t.length === 0 || n.length === 0) return;
|
|
5378
|
-
let i =
|
|
5452
|
+
let i = zi(t, Z(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Z(n, a), s = n[o].time;
|
|
5379
5453
|
if (s > a) return;
|
|
5380
|
-
let c =
|
|
5454
|
+
let c = zi(n, o);
|
|
5381
5455
|
if (a === s && o > 0) {
|
|
5382
5456
|
e.fedTime = n[o - 1].time, e.fedFraction = 1;
|
|
5383
5457
|
return;
|
|
5384
5458
|
}
|
|
5385
5459
|
e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
|
|
5386
5460
|
}
|
|
5387
|
-
function
|
|
5461
|
+
function Vi(e, t) {
|
|
5388
5462
|
let n = Y(e, t), r = e.length - 1;
|
|
5389
|
-
return n > r && r >= 0 && e[r].time +
|
|
5463
|
+
return n > r && r >= 0 && e[r].time + Wi(e) <= t ? r : Math.max(-1, n - 2);
|
|
5390
5464
|
}
|
|
5391
|
-
function
|
|
5465
|
+
function Hi(e) {
|
|
5392
5466
|
let t = Infinity;
|
|
5393
5467
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
|
|
5394
5468
|
return t;
|
|
5395
5469
|
}
|
|
5396
|
-
function
|
|
5397
|
-
if (!(
|
|
5398
|
-
let n = Math.max(0, e.length -
|
|
5470
|
+
function Ui(e, t) {
|
|
5471
|
+
if (!(Hi(e) < Hi(t))) return !1;
|
|
5472
|
+
let n = Math.max(0, e.length - Ii);
|
|
5399
5473
|
for (let r = n; r < e.length; r++) {
|
|
5400
|
-
let n = t[Z(t, e[r].time)], i = (n.high - n.low) *
|
|
5474
|
+
let n = t[Z(t, e[r].time)], i = (n.high - n.low) * Li + 2 ** -52;
|
|
5401
5475
|
if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
|
|
5402
5476
|
}
|
|
5403
5477
|
return !0;
|
|
5404
5478
|
}
|
|
5405
|
-
function
|
|
5479
|
+
function Wi(e) {
|
|
5406
5480
|
let t = 0;
|
|
5407
5481
|
for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
|
|
5408
5482
|
return t > 0 ? t : Infinity;
|
|
5409
5483
|
}
|
|
5410
|
-
function
|
|
5484
|
+
function Gi(e, t) {
|
|
5411
5485
|
if (t.length === 0) return null;
|
|
5412
|
-
let n = t[t.length - 1].time +
|
|
5486
|
+
let n = t[t.length - 1].time + Wi(t), r = e.filter((e) => Hn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
|
|
5413
5487
|
for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
|
|
5414
5488
|
if (i.length === 0) return null;
|
|
5415
5489
|
let a = t.findIndex((e) => e.time >= i[0].time);
|
|
@@ -5425,26 +5499,26 @@ function Z(e, t) {
|
|
|
5425
5499
|
}
|
|
5426
5500
|
return n;
|
|
5427
5501
|
}
|
|
5428
|
-
function
|
|
5502
|
+
function Ki(e, t, n) {
|
|
5429
5503
|
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;
|
|
5430
5504
|
for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
|
|
5431
5505
|
return Math.max(0, a);
|
|
5432
5506
|
}
|
|
5433
|
-
function
|
|
5507
|
+
function qi(e, t, n) {
|
|
5434
5508
|
let r = n;
|
|
5435
5509
|
for (; r > 0 && t[r - 1].time >= e.time;) r--;
|
|
5436
5510
|
let i = {
|
|
5437
5511
|
...t[r],
|
|
5438
5512
|
time: e.time
|
|
5439
5513
|
};
|
|
5440
|
-
for (let e = r + 1; e <= n; e++) i =
|
|
5514
|
+
for (let e = r + 1; e <= n; e++) i = Qi(i, t[e]);
|
|
5441
5515
|
return i;
|
|
5442
5516
|
}
|
|
5443
|
-
function
|
|
5517
|
+
function Ji(e, t, n, r) {
|
|
5444
5518
|
let i = e[n + 1], a = t[r + 1];
|
|
5445
5519
|
return i !== void 0 && a !== void 0 && i.time >= a.time;
|
|
5446
5520
|
}
|
|
5447
|
-
function
|
|
5521
|
+
function Yi(e, t) {
|
|
5448
5522
|
let n = /* @__PURE__ */ new Map();
|
|
5449
5523
|
for (let r of e) {
|
|
5450
5524
|
let e = t[Z(t, r.time)].time, i = n.get(e);
|
|
@@ -5452,17 +5526,17 @@ function Ji(e, t) {
|
|
|
5452
5526
|
}
|
|
5453
5527
|
return n;
|
|
5454
5528
|
}
|
|
5455
|
-
function
|
|
5529
|
+
function Xi() {
|
|
5456
5530
|
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
5457
5531
|
}
|
|
5458
|
-
function
|
|
5532
|
+
function Zi(e) {
|
|
5459
5533
|
return {
|
|
5460
5534
|
inset: e.legendInset,
|
|
5461
5535
|
top: e.legendTop,
|
|
5462
5536
|
lineGap: e.legendLineGap
|
|
5463
5537
|
};
|
|
5464
5538
|
}
|
|
5465
|
-
function
|
|
5539
|
+
function Qi(e, t) {
|
|
5466
5540
|
return {
|
|
5467
5541
|
time: e.time,
|
|
5468
5542
|
open: e.open,
|
|
@@ -5474,26 +5548,26 @@ function Zi(e, t) {
|
|
|
5474
5548
|
}
|
|
5475
5549
|
//#endregion
|
|
5476
5550
|
//#region src/io/parseOHLCV.ts
|
|
5477
|
-
var
|
|
5551
|
+
var $i = [
|
|
5478
5552
|
"time",
|
|
5479
5553
|
"timestamp",
|
|
5480
5554
|
"date",
|
|
5481
5555
|
"datetime",
|
|
5482
5556
|
"t"
|
|
5483
|
-
],
|
|
5557
|
+
], ea = ["open", "o"], ta = ["high", "h"], na = ["low", "l"], ra = ["close", "c"], ia = [
|
|
5484
5558
|
"volume",
|
|
5485
5559
|
"vol",
|
|
5486
5560
|
"v"
|
|
5487
5561
|
];
|
|
5488
|
-
function
|
|
5562
|
+
function aa(e) {
|
|
5489
5563
|
let t = e.trim();
|
|
5490
|
-
return t ? t[0] === "[" || t[0] === "{" ?
|
|
5564
|
+
return t ? t[0] === "[" || t[0] === "{" ? oa(t) : sa(t) : {
|
|
5491
5565
|
data: [],
|
|
5492
5566
|
rowCount: 0,
|
|
5493
5567
|
skipped: 0
|
|
5494
5568
|
};
|
|
5495
5569
|
}
|
|
5496
|
-
function
|
|
5570
|
+
function oa(e) {
|
|
5497
5571
|
let t;
|
|
5498
5572
|
try {
|
|
5499
5573
|
t = JSON.parse(e);
|
|
@@ -5503,19 +5577,19 @@ function aa(e) {
|
|
|
5503
5577
|
if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
|
|
5504
5578
|
let n = [], r = 0;
|
|
5505
5579
|
for (let e of t) {
|
|
5506
|
-
let t = Array.isArray(e) ?
|
|
5580
|
+
let t = Array.isArray(e) ? fa(e) : da(e);
|
|
5507
5581
|
t ? n.push(t) : r++;
|
|
5508
5582
|
}
|
|
5509
|
-
return
|
|
5583
|
+
return ma(n, t.length, r);
|
|
5510
5584
|
}
|
|
5511
|
-
function
|
|
5585
|
+
function sa(e) {
|
|
5512
5586
|
let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
|
|
5513
5587
|
if (t.length === 0) return {
|
|
5514
5588
|
data: [],
|
|
5515
5589
|
rowCount: 0,
|
|
5516
5590
|
skipped: 0
|
|
5517
5591
|
};
|
|
5518
|
-
let n =
|
|
5592
|
+
let n = ca(t[0]), r = la(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? ua(r) : {
|
|
5519
5593
|
time: 0,
|
|
5520
5594
|
open: 1,
|
|
5521
5595
|
high: 2,
|
|
@@ -5526,7 +5600,7 @@ function oa(e) {
|
|
|
5526
5600
|
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");
|
|
5527
5601
|
let o = [], s = 0;
|
|
5528
5602
|
for (let e = +!!i; e < t.length; e++) {
|
|
5529
|
-
let r =
|
|
5603
|
+
let r = la(t[e], n), i = pa(r[a.time]), c = Q(r[a.open]), l = Q(r[a.high]), u = Q(r[a.low]), d = Q(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
|
|
5530
5604
|
if (i === null || ![
|
|
5531
5605
|
c,
|
|
5532
5606
|
l,
|
|
@@ -5545,9 +5619,9 @@ function oa(e) {
|
|
|
5545
5619
|
volume: Number.isFinite(f) ? f : 0
|
|
5546
5620
|
});
|
|
5547
5621
|
}
|
|
5548
|
-
return
|
|
5622
|
+
return ma(o, t.length - +!!i, s);
|
|
5549
5623
|
}
|
|
5550
|
-
function
|
|
5624
|
+
function ca(e) {
|
|
5551
5625
|
let t = {
|
|
5552
5626
|
",": 0,
|
|
5553
5627
|
";": 0,
|
|
@@ -5559,7 +5633,7 @@ function sa(e) {
|
|
|
5559
5633
|
for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
|
|
5560
5634
|
return n;
|
|
5561
5635
|
}
|
|
5562
|
-
function
|
|
5636
|
+
function la(e, t) {
|
|
5563
5637
|
let n = [], r = "", i = !1;
|
|
5564
5638
|
for (let a = 0; a < e.length; a++) {
|
|
5565
5639
|
let o = e[a];
|
|
@@ -5567,25 +5641,25 @@ function ca(e, t) {
|
|
|
5567
5641
|
}
|
|
5568
5642
|
return n.push(r), n;
|
|
5569
5643
|
}
|
|
5570
|
-
function
|
|
5644
|
+
function ua(e) {
|
|
5571
5645
|
let t = (t) => e.findIndex((e) => t.includes(e));
|
|
5572
5646
|
return {
|
|
5573
|
-
time: t(
|
|
5574
|
-
open: t(
|
|
5575
|
-
high: t(
|
|
5576
|
-
low: t(
|
|
5577
|
-
close: t(
|
|
5578
|
-
volume: t(
|
|
5647
|
+
time: t($i),
|
|
5648
|
+
open: t(ea),
|
|
5649
|
+
high: t(ta),
|
|
5650
|
+
low: t(na),
|
|
5651
|
+
close: t(ra),
|
|
5652
|
+
volume: t(ia)
|
|
5579
5653
|
};
|
|
5580
5654
|
}
|
|
5581
|
-
function
|
|
5655
|
+
function da(e) {
|
|
5582
5656
|
let t = (t) => {
|
|
5583
5657
|
for (let n of t) {
|
|
5584
5658
|
if (e[n] !== void 0) return e[n];
|
|
5585
5659
|
let t = n.toUpperCase();
|
|
5586
5660
|
if (e[t] !== void 0) return e[t];
|
|
5587
5661
|
}
|
|
5588
|
-
}, n =
|
|
5662
|
+
}, n = pa(String(t($i) ?? "")), r = Number(t(ea)), i = Number(t(ta)), a = Number(t(na)), o = Number(t(ra)), s = Number(t(ia) ?? 0);
|
|
5589
5663
|
return n === null || ![
|
|
5590
5664
|
r,
|
|
5591
5665
|
i,
|
|
@@ -5600,9 +5674,9 @@ function ua(e) {
|
|
|
5600
5674
|
volume: Number.isFinite(s) ? s : 0
|
|
5601
5675
|
};
|
|
5602
5676
|
}
|
|
5603
|
-
function
|
|
5677
|
+
function fa(e) {
|
|
5604
5678
|
if (e.length < 5) return null;
|
|
5605
|
-
let t =
|
|
5679
|
+
let t = pa(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;
|
|
5606
5680
|
return t === null || ![
|
|
5607
5681
|
n,
|
|
5608
5682
|
r,
|
|
@@ -5620,7 +5694,7 @@ function da(e) {
|
|
|
5620
5694
|
function Q(e) {
|
|
5621
5695
|
return e === void 0 || e.trim() === "" ? NaN : Number(e);
|
|
5622
5696
|
}
|
|
5623
|
-
function
|
|
5697
|
+
function pa(e) {
|
|
5624
5698
|
let t = e.trim();
|
|
5625
5699
|
if (!t) return null;
|
|
5626
5700
|
let n = Number(t);
|
|
@@ -5628,7 +5702,7 @@ function fa(e) {
|
|
|
5628
5702
|
let r = Date.parse(t);
|
|
5629
5703
|
return Number.isFinite(r) ? r : null;
|
|
5630
5704
|
}
|
|
5631
|
-
function
|
|
5705
|
+
function ma(e, t, n) {
|
|
5632
5706
|
e.sort((e, t) => e.time - t.time);
|
|
5633
5707
|
let r = [];
|
|
5634
5708
|
for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
|
|
@@ -5640,7 +5714,7 @@ function pa(e, t, n) {
|
|
|
5640
5714
|
}
|
|
5641
5715
|
//#endregion
|
|
5642
5716
|
//#region src/io/DragDropImporter.ts
|
|
5643
|
-
var
|
|
5717
|
+
var ha = class {
|
|
5644
5718
|
host;
|
|
5645
5719
|
overlay = null;
|
|
5646
5720
|
callbacks;
|
|
@@ -5661,19 +5735,19 @@ var ma = class {
|
|
|
5661
5735
|
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();
|
|
5662
5736
|
}
|
|
5663
5737
|
onDragEnter(e) {
|
|
5664
|
-
|
|
5738
|
+
ga(e) && (e.preventDefault(), this.depth++, this.showOverlay());
|
|
5665
5739
|
}
|
|
5666
5740
|
onDragOver(e) {
|
|
5667
|
-
|
|
5741
|
+
ga(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
|
|
5668
5742
|
}
|
|
5669
5743
|
onDragLeave(e) {
|
|
5670
|
-
|
|
5744
|
+
ga(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
|
|
5671
5745
|
}
|
|
5672
5746
|
async onDrop(e) {
|
|
5673
5747
|
e.preventDefault(), this.depth = 0, this.hideOverlay();
|
|
5674
5748
|
let t = e.dataTransfer?.files?.[0];
|
|
5675
5749
|
if (t) try {
|
|
5676
|
-
let e =
|
|
5750
|
+
let e = aa(await t.text());
|
|
5677
5751
|
if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
|
|
5678
5752
|
this.callbacks.onData(e.data, e, t);
|
|
5679
5753
|
} catch (e) {
|
|
@@ -5704,12 +5778,12 @@ var ma = class {
|
|
|
5704
5778
|
this.overlay?.remove(), this.overlay = null;
|
|
5705
5779
|
}
|
|
5706
5780
|
};
|
|
5707
|
-
function
|
|
5781
|
+
function ga(e) {
|
|
5708
5782
|
return e.dataTransfer?.types?.includes("Files") ?? !1;
|
|
5709
5783
|
}
|
|
5710
5784
|
//#endregion
|
|
5711
5785
|
//#region src/grid/gridShapes.ts
|
|
5712
|
-
var
|
|
5786
|
+
var _a = {
|
|
5713
5787
|
"1x1": {
|
|
5714
5788
|
cols: 1,
|
|
5715
5789
|
rows: 1
|
|
@@ -5914,11 +5988,11 @@ var ga = {
|
|
|
5914
5988
|
cols: 3,
|
|
5915
5989
|
rows: 3
|
|
5916
5990
|
}
|
|
5917
|
-
},
|
|
5918
|
-
function va(e) {
|
|
5919
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(ga, e);
|
|
5920
|
-
}
|
|
5991
|
+
}, va = Object.keys(_a);
|
|
5921
5992
|
function ya(e) {
|
|
5993
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(_a, e);
|
|
5994
|
+
}
|
|
5995
|
+
function ba(e) {
|
|
5922
5996
|
if (e.areas) return e.areas;
|
|
5923
5997
|
let t = [];
|
|
5924
5998
|
for (let n = 0; n < e.rows; n++) for (let r = 0; r < e.cols; r++) t.push([
|
|
@@ -5929,16 +6003,16 @@ function ya(e) {
|
|
|
5929
6003
|
]);
|
|
5930
6004
|
return t;
|
|
5931
6005
|
}
|
|
5932
|
-
function
|
|
6006
|
+
function xa(e) {
|
|
5933
6007
|
return e.areas?.length ?? e.cols * e.rows;
|
|
5934
6008
|
}
|
|
5935
|
-
function
|
|
6009
|
+
function Sa([e, t, n, r]) {
|
|
5936
6010
|
return `${t + 1} / ${e + 1} / span ${r} / span ${n}`;
|
|
5937
6011
|
}
|
|
5938
|
-
function
|
|
5939
|
-
e.style.gridArea = t ?
|
|
6012
|
+
function Ca(e, t) {
|
|
6013
|
+
e.style.gridArea = t ? Sa(t) : "";
|
|
5940
6014
|
}
|
|
5941
|
-
function
|
|
6015
|
+
function wa(e) {
|
|
5942
6016
|
if (!e.areas) return null;
|
|
5943
6017
|
let t = e.areas.find(([, , e, t]) => e * t > 1);
|
|
5944
6018
|
if (!t) return null;
|
|
@@ -5947,7 +6021,7 @@ function Ca(e) {
|
|
|
5947
6021
|
}
|
|
5948
6022
|
//#endregion
|
|
5949
6023
|
//#region src/state/layoutStorage.ts
|
|
5950
|
-
function
|
|
6024
|
+
function Ta(e) {
|
|
5951
6025
|
let t = {
|
|
5952
6026
|
id: e.id,
|
|
5953
6027
|
name: e.name,
|
|
@@ -5955,11 +6029,11 @@ function wa(e) {
|
|
|
5955
6029
|
};
|
|
5956
6030
|
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;
|
|
5957
6031
|
}
|
|
5958
|
-
var
|
|
5959
|
-
function
|
|
6032
|
+
var Ea = (e, t) => t.updatedAt - e.updatedAt;
|
|
6033
|
+
function Da(e) {
|
|
5960
6034
|
if (typeof e != "object" || !e) return null;
|
|
5961
6035
|
let t = e;
|
|
5962
|
-
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null :
|
|
6036
|
+
return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Ta({
|
|
5963
6037
|
id: t.id,
|
|
5964
6038
|
name: t.name,
|
|
5965
6039
|
updatedAt: t.updatedAt,
|
|
@@ -5968,17 +6042,17 @@ function Ea(e) {
|
|
|
5968
6042
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
5969
6043
|
});
|
|
5970
6044
|
}
|
|
5971
|
-
function
|
|
5972
|
-
let t =
|
|
6045
|
+
function Oa(e) {
|
|
6046
|
+
let t = Da(e), n = t ? e.content : void 0;
|
|
5973
6047
|
return t && typeof n == "string" ? {
|
|
5974
6048
|
...t,
|
|
5975
6049
|
content: n
|
|
5976
6050
|
} : null;
|
|
5977
6051
|
}
|
|
5978
|
-
function
|
|
6052
|
+
function ka(e = []) {
|
|
5979
6053
|
let t = new Map(e.map((e) => [e.id, { ...e }]));
|
|
5980
6054
|
return {
|
|
5981
|
-
list: () => [...t.values()].map(
|
|
6055
|
+
list: () => [...t.values()].map(Ta).sort(Ea),
|
|
5982
6056
|
load: (e) => {
|
|
5983
6057
|
let n = t.get(e);
|
|
5984
6058
|
return n ? { ...n } : null;
|
|
@@ -5991,7 +6065,7 @@ function Oa(e = []) {
|
|
|
5991
6065
|
}
|
|
5992
6066
|
};
|
|
5993
6067
|
}
|
|
5994
|
-
function
|
|
6068
|
+
function Aa(e = "tcw:layouts:") {
|
|
5995
6069
|
let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
|
|
5996
6070
|
let e;
|
|
5997
6071
|
try {
|
|
@@ -5999,10 +6073,10 @@ function ka(e = "tcw:layouts:") {
|
|
|
5999
6073
|
} catch {
|
|
6000
6074
|
return [];
|
|
6001
6075
|
}
|
|
6002
|
-
return Array.isArray(e) ? e.map(
|
|
6076
|
+
return Array.isArray(e) ? e.map(Da).filter((e) => e !== null) : [];
|
|
6003
6077
|
}, i = (e) => localStorage.setItem(t, JSON.stringify(e));
|
|
6004
6078
|
return {
|
|
6005
|
-
list: () => r().sort(
|
|
6079
|
+
list: () => r().sort(Ea),
|
|
6006
6080
|
load: (e) => {
|
|
6007
6081
|
let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
|
|
6008
6082
|
return t && i !== null ? {
|
|
@@ -6011,7 +6085,7 @@ function ka(e = "tcw:layouts:") {
|
|
|
6011
6085
|
} : null;
|
|
6012
6086
|
},
|
|
6013
6087
|
save: (e) => {
|
|
6014
|
-
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id),
|
|
6088
|
+
localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Ta(e)]);
|
|
6015
6089
|
},
|
|
6016
6090
|
remove: (e) => {
|
|
6017
6091
|
i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
|
|
@@ -6020,14 +6094,14 @@ function ka(e = "tcw:layouts:") {
|
|
|
6020
6094
|
}
|
|
6021
6095
|
//#endregion
|
|
6022
6096
|
//#region src/state/LayoutSession.ts
|
|
6023
|
-
var
|
|
6097
|
+
var ja = 80;
|
|
6024
6098
|
function $(e) {
|
|
6025
6099
|
return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
|
|
6026
6100
|
}
|
|
6027
|
-
function
|
|
6101
|
+
function Ma() {
|
|
6028
6102
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
6029
6103
|
}
|
|
6030
|
-
function
|
|
6104
|
+
function Na(e) {
|
|
6031
6105
|
let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
|
|
6032
6106
|
return {
|
|
6033
6107
|
id: t,
|
|
@@ -6038,7 +6112,7 @@ function Ma(e) {
|
|
|
6038
6112
|
...o === void 0 ? {} : { kind: o }
|
|
6039
6113
|
};
|
|
6040
6114
|
}
|
|
6041
|
-
var
|
|
6115
|
+
var Pa = class {
|
|
6042
6116
|
currentLayout = null;
|
|
6043
6117
|
savedContent = null;
|
|
6044
6118
|
dirty = !1;
|
|
@@ -6054,7 +6128,7 @@ var Na = class {
|
|
|
6054
6128
|
now;
|
|
6055
6129
|
newId;
|
|
6056
6130
|
constructor(e, t, n = {}) {
|
|
6057
|
-
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ??
|
|
6131
|
+
this.storage = e, this.host = t, this.options = n, this.autoSave = n.autoSave ?? !0, this.debounceMs = n.debounceMs ?? 1500, this.kind = n.kind ?? "chart", this.now = n.now ?? Date.now, this.newId = n.newId ?? Ma;
|
|
6058
6132
|
}
|
|
6059
6133
|
current() {
|
|
6060
6134
|
return this.currentLayout;
|
|
@@ -6070,7 +6144,7 @@ var Na = class {
|
|
|
6070
6144
|
}
|
|
6071
6145
|
async list() {
|
|
6072
6146
|
let e = await this.storage.list();
|
|
6073
|
-
return Array.isArray(e) ? e.map(
|
|
6147
|
+
return Array.isArray(e) ? e.map(Da).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
|
|
6074
6148
|
}
|
|
6075
6149
|
save() {
|
|
6076
6150
|
return this.queue(() => {
|
|
@@ -6084,7 +6158,7 @@ var Na = class {
|
|
|
6084
6158
|
}
|
|
6085
6159
|
open(e) {
|
|
6086
6160
|
return this.queue(async () => {
|
|
6087
|
-
let t =
|
|
6161
|
+
let t = Oa(await this.storage.load(e));
|
|
6088
6162
|
if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
|
|
6089
6163
|
this.cancelTimer(), this.applying++;
|
|
6090
6164
|
try {
|
|
@@ -6094,13 +6168,13 @@ var Na = class {
|
|
|
6094
6168
|
} finally {
|
|
6095
6169
|
this.applying--;
|
|
6096
6170
|
}
|
|
6097
|
-
return this.cancelTimer(), this.currentLayout =
|
|
6171
|
+
return this.cancelTimer(), this.currentLayout = Na(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
|
|
6098
6172
|
});
|
|
6099
6173
|
}
|
|
6100
6174
|
rename(e, t) {
|
|
6101
6175
|
let n = $(t);
|
|
6102
6176
|
return n ? this.queue(async () => {
|
|
6103
|
-
let t =
|
|
6177
|
+
let t = Oa(await this.storage.load(e));
|
|
6104
6178
|
!t || t.id !== e || (await this.storage.save({
|
|
6105
6179
|
...t,
|
|
6106
6180
|
name: n
|
|
@@ -6178,7 +6252,7 @@ var Na = class {
|
|
|
6178
6252
|
content: n.content
|
|
6179
6253
|
};
|
|
6180
6254
|
await this.storage.save(r);
|
|
6181
|
-
let i =
|
|
6255
|
+
let i = Na(r);
|
|
6182
6256
|
return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
|
|
6183
6257
|
}
|
|
6184
6258
|
forget() {
|
|
@@ -6199,6 +6273,6 @@ var Na = class {
|
|
|
6199
6273
|
}
|
|
6200
6274
|
};
|
|
6201
6275
|
//#endregion
|
|
6202
|
-
export {
|
|
6276
|
+
export { mr as A, Rr as C, Tr as D, G as E, L as M, z as N, yr as O, Lr as S, Ir as T, si as _, ka as a, Br as b, ba as c, ya as d, Ca as f, bi as g, ki as h, Aa as i, B as j, gr as k, xa as l, aa as m, ja as n, va as o, ha as p, $ as r, _a as s, Pa as t, wa as u, ci as v, Fr as w, zr as x, Vr as y };
|
|
6203
6277
|
|
|
6204
|
-
//# sourceMappingURL=LayoutSession-
|
|
6278
|
+
//# sourceMappingURL=LayoutSession-D8TcwPy1.js.map
|