@tradecanvas/chart 1.13.0 → 1.16.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.
Files changed (81) hide show
  1. package/README.md +14 -1
  2. package/dist/Chart.d.ts +11 -0
  3. package/dist/Chart.d.ts.map +1 -1
  4. package/dist/LayoutSession-DTuRPKS5.cjs +2 -0
  5. package/dist/LayoutSession-DTuRPKS5.cjs.map +1 -0
  6. package/dist/{LayoutSession-CiDh-H9-.js → LayoutSession-DdX4GEPK.js} +267 -238
  7. package/dist/LayoutSession-DdX4GEPK.js.map +1 -0
  8. package/dist/frameworks/syncIndicators.d.ts +23 -0
  9. package/dist/frameworks/syncIndicators.d.ts.map +1 -0
  10. package/dist/{i18n-BU-BoBDZ.js → i18n-BH0McEvQ.js} +59 -1
  11. package/dist/i18n-BH0McEvQ.js.map +1 -0
  12. package/dist/{i18n-DkzAxytR.cjs → i18n-D0C88QUR.cjs} +2 -2
  13. package/dist/i18n-D0C88QUR.cjs.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +38 -13
  19. package/dist/index.js.map +1 -1
  20. package/dist/widget/ChartWidget.d.ts +30 -4
  21. package/dist/widget/ChartWidget.d.ts.map +1 -1
  22. package/dist/widget/WidgetHotkeySheet.d.ts +12 -1
  23. package/dist/widget/WidgetHotkeySheet.d.ts.map +1 -1
  24. package/dist/widget/WidgetSettings.d.ts +16 -3
  25. package/dist/widget/WidgetSettings.d.ts.map +1 -1
  26. package/dist/widget/hostHotkeys.d.ts +34 -0
  27. package/dist/widget/hostHotkeys.d.ts.map +1 -0
  28. package/dist/widget/index.cjs +48 -9
  29. package/dist/widget/index.cjs.map +1 -1
  30. package/dist/widget/index.d.ts +1 -1
  31. package/dist/widget/index.d.ts.map +1 -1
  32. package/dist/widget/index.js +1380 -1022
  33. package/dist/widget/index.js.map +1 -1
  34. package/dist/widget/locales/ar.d.ts.map +1 -1
  35. package/dist/widget/locales/cs.d.ts.map +1 -1
  36. package/dist/widget/locales/da.d.ts.map +1 -1
  37. package/dist/widget/locales/de.d.ts.map +1 -1
  38. package/dist/widget/locales/el.d.ts.map +1 -1
  39. package/dist/widget/locales/en.d.ts +29 -0
  40. package/dist/widget/locales/en.d.ts.map +1 -1
  41. package/dist/widget/locales/es.d.ts.map +1 -1
  42. package/dist/widget/locales/et.d.ts.map +1 -1
  43. package/dist/widget/locales/fa.d.ts.map +1 -1
  44. package/dist/widget/locales/fr.d.ts.map +1 -1
  45. package/dist/widget/locales/he.d.ts.map +1 -1
  46. package/dist/widget/locales/hu.d.ts.map +1 -1
  47. package/dist/widget/locales/id.d.ts.map +1 -1
  48. package/dist/widget/locales/index.cjs +1 -1
  49. package/dist/widget/locales/index.cjs.map +1 -1
  50. package/dist/widget/locales/index.js +813 -1
  51. package/dist/widget/locales/index.js.map +1 -1
  52. package/dist/widget/locales/it.d.ts.map +1 -1
  53. package/dist/widget/locales/ja.d.ts.map +1 -1
  54. package/dist/widget/locales/ko.d.ts.map +1 -1
  55. package/dist/widget/locales/ms.d.ts.map +1 -1
  56. package/dist/widget/locales/nb.d.ts.map +1 -1
  57. package/dist/widget/locales/nl.d.ts.map +1 -1
  58. package/dist/widget/locales/pl.d.ts.map +1 -1
  59. package/dist/widget/locales/pt.d.ts.map +1 -1
  60. package/dist/widget/locales/ro.d.ts.map +1 -1
  61. package/dist/widget/locales/ru.d.ts.map +1 -1
  62. package/dist/widget/locales/sk.d.ts.map +1 -1
  63. package/dist/widget/locales/sv.d.ts.map +1 -1
  64. package/dist/widget/locales/th.d.ts.map +1 -1
  65. package/dist/widget/locales/tr.d.ts.map +1 -1
  66. package/dist/widget/locales/vi.d.ts.map +1 -1
  67. package/dist/widget/locales/zh.d.ts.map +1 -1
  68. package/dist/widget/locales/zhHant.d.ts.map +1 -1
  69. package/dist/widget/settingsControls.d.ts.map +1 -1
  70. package/dist/widget/types.d.ts +23 -6
  71. package/dist/widget/types.d.ts.map +1 -1
  72. package/dist/widget/widgetConfig.d.ts +0 -12
  73. package/dist/widget/widgetConfig.d.ts.map +1 -1
  74. package/dist/widget/widgetSettingsLook.d.ts +35 -0
  75. package/dist/widget/widgetSettingsLook.d.ts.map +1 -0
  76. package/package.json +3 -3
  77. package/dist/LayoutSession-BOUFA2gH.cjs +0 -2
  78. package/dist/LayoutSession-BOUFA2gH.cjs.map +0 -1
  79. package/dist/LayoutSession-CiDh-H9-.js.map +0 -1
  80. package/dist/i18n-BU-BoBDZ.js.map +0 -1
  81. package/dist/i18n-DkzAxytR.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
- import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PRICE_AXIS_WIDTH as a, TIME_AXIS_HEIGHT as o, autoPricePrecision as s, chartStyleValue as c, computePriceLimits as l, formatPrice as u, fractionTick as d, indicatorSource as f, isValidTimeZone as p, mergeBar as m, normalizeBarTime as h, parseIndicatorSource as g, priceFormatterFor as _, readChartStyleOverrides as v, readChartTypeOptions as y, readIndicatorPlotStyles as b, readPaneStyle as ee, resolveChartTheme as te, sessionMinute as x, setLocale as ne, stepDecimals as re, tickBarCount as ie, timeframeToMs as ae, volumeColor as oe, zonedDateFormatter as se } from "@tradecanvas/commons";
2
- import { AlertDragHandler as ce, AlertManager as le, Animator as ue, AreaRenderer as de, AxisDragHandler as fe, BarCountdown as pe, BarRenderer as me, BaselineRenderer as he, CandlestickRenderer as ge, ChartLegend as _e, ChartStateManager as S, CompareRenderer as ve, CompareSymbolIndicator as ye, CorrelationCoefficientIndicator as be, CorrelationLogIndicator as xe, CrosshairHandler as Se, CrosshairTooltip as Ce, CurrentPriceLine as we, DEFAULT_SESSION_HOURS as Te, DataExporter as C, DepthHeatmapRenderer as Ee, DrawingManager as De, DrawingRenderer as Oe, EquivolumeRenderer as ke, EventBus as Ae, GridRenderer as je, HLCAreaRenderer as Me, HiLoRenderer as w, HollowCandleRenderer as Ne, IndicatorEngine as T, InteractionManager as Pe, KagiRenderer as Fe, KeyboardHandler as Ie, LineRenderer as Le, LineWithMarkersRenderer as Re, MarketProfileRenderer as ze, MeasureOverlay as Be, PanHandler as Ve, PaneResizeHandler as He, PeriodLevelsRenderer as Ue, PinnedTooltip as We, PivotMarkersRenderer as Ge, PointAndFigureRenderer as E, PriceAxis as D, PriceAxisAddButton as Ke, PriceLines as qe, RenderEngine as Je, RenkoRenderer as Ye, ReplayManager as Xe, Screenshot as O, SelectionBoxOverlay as Ze, SessionBreaks as Qe, SessionShading as $e, SignalMarkerManager as et, SpreadIndicator as tt, StepLineRenderer as nt, StreamManager as rt, SymbolSeriesStore as it, TimeAxis as at, TradeZoneManager as ot, TradingManager as st, TradingRenderer as ct, UndoRedoManager as lt, Viewport as ut, VolumeCandleRenderer as dt, VolumeProfileRenderer as ft, VolumeRenderer as pt, Watermark as mt, ZoomHandler as ht, barTimeStepMs as gt, findDominantSwing as _t, gpuContextsLeft as vt, isRegularSession as yt, loadWebGL as bt, mergeSessionHours as xt, rangePresetStart as St, readAlertOptions as Ct, registerBuiltInDrawingTools as wt, registerBuiltInIndicators as k, servesTimeframe as A, sourceParam as j, timestampToBarIndex as M, toHeikinAshi as Tt, toKagi as Et, toLineBreak as Dt, toPointAndFigure as Ot, toRangeBars as kt, toRenko as N, whenGpuContextFree as At, withResampling as jt, xToBarIndex as Mt, xToTime as P, yToPrice as F } from "@tradecanvas/core";
1
+ import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PRICE_AXIS_WIDTH as a, TIME_AXIS_HEIGHT as o, autoPricePrecision as s, chartStyleValue as c, computePriceLimits as l, formatPrice as u, fractionTick as d, indicatorSource as f, isValidTimeZone as p, mergeBar as m, normalizeBarTime as h, parseIndicatorSource as g, priceFormatterFor as _, readChartStyleOverrides as v, readChartTypeOptions as y, readIndicatorPlotStyles as ee, readPaneStyle as b, resolveChartTheme as te, sessionMinute as x, setLocale as ne, stepDecimals as re, tickBarCount as ie, timeframeToMs as ae, volumeColor as oe, zonedDateFormatter as se } from "@tradecanvas/commons";
2
+ import { AlertDragHandler as ce, AlertManager as le, Animator as ue, AreaRenderer as de, AxisDragHandler as fe, BarCountdown as pe, BarRenderer as me, BaselineRenderer as he, CandlestickRenderer as ge, ChartLegend as _e, ChartStateManager as S, CompareRenderer as ve, CompareSymbolIndicator as ye, CorrelationCoefficientIndicator as be, CorrelationLogIndicator as xe, CrosshairHandler as Se, CrosshairTooltip as Ce, CurrentPriceLine as we, DEFAULT_SESSION_HOURS as Te, DataExporter as C, DepthHeatmapRenderer as Ee, DrawingManager as De, DrawingRenderer as Oe, EquivolumeRenderer as ke, EventBus as Ae, GridRenderer as je, HLCAreaRenderer as Me, HiLoRenderer as w, HollowCandleRenderer as Ne, IndicatorEngine as Pe, InteractionManager as Fe, KagiRenderer as Ie, KeyboardHandler as Le, LineRenderer as Re, LineWithMarkersRenderer as ze, MarketProfileRenderer as Be, MeasureOverlay as Ve, PanHandler as He, PaneResizeHandler as Ue, PeriodLevelsRenderer as We, PinnedTooltip as Ge, PivotMarkersRenderer as Ke, PointAndFigureRenderer as qe, PriceAxis as Je, PriceAxisAddButton as Ye, PriceLines as Xe, RenderEngine as Ze, RenkoRenderer as Qe, ReplayManager as $e, Screenshot as T, SelectionBoxOverlay as et, SessionBreaks as tt, SessionShading as nt, SignalMarkerManager as rt, SpreadIndicator as it, StepLineRenderer as at, StreamManager as ot, SymbolSeriesStore as st, TimeAxis as ct, TradeZoneManager as lt, TradingManager as ut, TradingRenderer as dt, UndoRedoManager as ft, Viewport as pt, VolumeCandleRenderer as mt, VolumeProfileRenderer as ht, VolumeRenderer as gt, Watermark as _t, ZoomHandler as vt, barTimeStepMs as yt, findDominantSwing as bt, gpuContextsLeft as xt, isRegularSession as St, loadWebGL as Ct, mergeSessionHours as wt, rangePresetStart as Tt, readAlertOptions as Et, registerBuiltInDrawingTools as Dt, registerBuiltInIndicators as E, servesTimeframe as Ot, sourceParam as D, timestampToBarIndex as O, toHeikinAshi as kt, toKagi as At, toLineBreak as jt, toPointAndFigure as Mt, toRangeBars as Nt, toRenko as Pt, whenGpuContextFree as Ft, withResampling as It, xToBarIndex as Lt, xToTime as k, yToPrice as Rt } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
- var Nt = 864e5, Pt = 10;
5
- function Ft(e, t) {
4
+ var zt = 864e5, Bt = 10;
5
+ function Vt(e, t) {
6
6
  let n = e?.timezone;
7
7
  if (!n || !p(n) || t.length < 2) return null;
8
8
  let r = (e?.sessions ?? []).flatMap((e) => {
@@ -14,34 +14,34 @@ function Ft(e, t) {
14
14
  });
15
15
  if (r.length === 0) return null;
16
16
  let i = Infinity;
17
- for (let e = Math.max(1, t.length - Pt); e < t.length; e++) {
17
+ for (let e = Math.max(1, t.length - Bt); e < t.length; e++) {
18
18
  let n = h(t[e].time) - h(t[e - 1].time);
19
19
  n > 0 && n < i && (i = n);
20
20
  }
21
- if (!(i < Nt)) return null;
21
+ if (!(i < zt)) return null;
22
22
  let a = {
23
23
  timeZone: n,
24
24
  windows: r,
25
25
  startMinute: r[0].startMinute,
26
26
  endMinute: r[r.length - 1].endMinute
27
27
  };
28
- return (e) => yt(h(e), a);
28
+ return (e) => St(h(e), a);
29
29
  }
30
30
  //#endregion
31
31
  //#region src/chartA11y.ts
32
- var I = {
32
+ var Ht = {
33
33
  role: "chart",
34
34
  summary: "{what}. Last price {close}.",
35
35
  empty: "Chart, no data.",
36
36
  view: "Showing {count} bars, {from} to {to}. High {high}, low {low}.",
37
37
  bar: "{time}: open {open}, high {high}, low {low}, close {close}, volume {volume}.",
38
38
  keys: "Arrow keys scroll and zoom, Home and End go to the start and the end. Comma and period read the bars one at a time."
39
- }, L = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), It = [
39
+ }, A = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Ut = [
40
40
  "role",
41
41
  "aria-roledescription",
42
42
  "aria-label",
43
43
  "aria-describedby"
44
- ], Lt = 400, Rt = 1e3, zt = class {
44
+ ], Wt = 400, Gt = 1e3, Kt = class {
45
45
  live;
46
46
  help;
47
47
  labels;
@@ -55,20 +55,20 @@ var I = {
55
55
  };
56
56
  constructor(e, t, n = {}) {
57
57
  this.container = e, this.source = t, this.labels = {
58
- ...I,
58
+ ...Ht,
59
59
  ...n
60
60
  };
61
- for (let t of It) this.before.set(t, e.getAttribute(t));
62
- e.setAttribute("role", "application"), this.help = Bt("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 = Bt("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();
61
+ for (let t of Ut) this.before.set(t, e.getAttribute(t));
62
+ e.setAttribute("role", "application"), this.help = qt("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 = qt("div", "tc-sr-only tc-sr-live"), this.live.setAttribute("aria-live", "polite"), this.live.setAttribute("aria-atomic", "true"), e.append(this.help, this.live), e.addEventListener("blur", this.onBlur), this.applyLabels();
63
63
  }
64
64
  setLabels(e) {
65
65
  this.labels = {
66
- ...I,
66
+ ...Ht,
67
67
  ...e
68
68
  }, this.applyLabels();
69
69
  }
70
70
  refresh(e = !1) {
71
- let t = Rt - (Date.now() - this.summaryAt);
71
+ let t = Gt - (Date.now() - this.summaryAt);
72
72
  if (e || t <= 0 || this.container.getAttribute("aria-label") === this.labels.empty) {
73
73
  this.summaryTimer && clearTimeout(this.summaryTimer), this.summaryTimer = null, this.summaryAt = Date.now(), this.container.setAttribute("aria-label", this.summary());
74
74
  return;
@@ -80,7 +80,7 @@ var I = {
80
80
  viewMoved() {
81
81
  this.cursor = null, this.viewTimer && clearTimeout(this.viewTimer), this.viewTimer = setTimeout(() => {
82
82
  this.viewTimer = null, this.say(this.viewText());
83
- }, Lt);
83
+ }, Wt);
84
84
  }
85
85
  readBar(e) {
86
86
  let t = this.source.bars();
@@ -93,13 +93,13 @@ var I = {
93
93
  let i = t[this.cursor];
94
94
  this.source.showBar(i.time);
95
95
  let a = this.source.formatPrice;
96
- this.say(L(this.labels.bar, {
96
+ this.say(A(this.labels.bar, {
97
97
  time: this.source.formatTime(i.time),
98
98
  open: a(i.open),
99
99
  high: a(i.high),
100
100
  low: a(i.low),
101
101
  close: a(i.close),
102
- volume: Vt(i.volume ?? 0)
102
+ volume: Jt(i.volume ?? 0)
103
103
  }));
104
104
  }
105
105
  destroy() {
@@ -118,7 +118,7 @@ var I = {
118
118
  this.labels.typeName ? this.labels.typeName(t) : t,
119
119
  this.source.timeframe()
120
120
  ].filter(Boolean).join(", ");
121
- return L(this.labels.summary, {
121
+ return A(this.labels.summary, {
122
122
  what: n,
123
123
  close: this.source.formatPrice(e[e.length - 1].close)
124
124
  });
@@ -128,7 +128,7 @@ var I = {
128
128
  if (e.length === 0) return this.labels.empty;
129
129
  let t = this.source.visibleRange(), n = Math.max(0, Math.min(e.length - 1, Math.ceil(t.from))), r = Math.max(n, Math.min(e.length - 1, Math.floor(t.to))), i = -Infinity, a = Infinity;
130
130
  for (let t = n; t <= r; t++) i = Math.max(i, e[t].high), a = Math.min(a, e[t].low);
131
- return L(this.labels.view, {
131
+ return A(this.labels.view, {
132
132
  count: r - n + 1,
133
133
  from: this.source.formatTime(e[n].time),
134
134
  to: this.source.formatTime(e[r].time),
@@ -140,7 +140,7 @@ var I = {
140
140
  this.live.textContent = e;
141
141
  }
142
142
  };
143
- function Bt(e, t) {
143
+ function qt(e, t) {
144
144
  let n = document.createElement(e);
145
145
  return n.className = t, Object.assign(n.style, {
146
146
  position: "absolute",
@@ -154,12 +154,12 @@ function Bt(e, t) {
154
154
  border: "0"
155
155
  }), n;
156
156
  }
157
- function Vt(e) {
157
+ function Jt(e) {
158
158
  return Number.isInteger(e) ? String(e) : e.toFixed(2);
159
159
  }
160
160
  //#endregion
161
161
  //#region src/indicatorLabel.ts
162
- function Ht(e, t, n, r) {
162
+ function Yt(e, t, n, r) {
163
163
  let i = Object.keys(n || t).map((e) => t[e]).filter((e) => typeof e == "number" && Number.isFinite(e)).slice(0, 3).map((e) => String(Number(e.toFixed(4)))), a = typeof t.symbol == "string" && t.symbol ? [t.symbol] : [];
164
164
  return [
165
165
  e === "spread" && t.mode === "ratio" ? "Ratio" : r ?? e.toUpperCase(),
@@ -169,52 +169,52 @@ function Ht(e, t, n, r) {
169
169
  }
170
170
  //#endregion
171
171
  //#region src/charts/ChartTypeStrategy.ts
172
- function Ut(e) {
172
+ function Xt(e) {
173
173
  switch (e) {
174
174
  case "candlestick":
175
175
  case "heikinAshi":
176
176
  case "lineBreak":
177
177
  case "rangeBars": return new ge();
178
- case "line": return new Le();
178
+ case "line": return new Re();
179
179
  case "area": return new de();
180
180
  case "bar": return new me();
181
181
  case "hollowCandle": return new Ne();
182
182
  case "baseline": return new he();
183
- case "renko": return new Ye();
184
- case "kagi": return new Fe();
185
- case "pointAndFigure": return new E();
186
- case "volumeCandles": return new dt();
183
+ case "renko": return new Qe();
184
+ case "kagi": return new Ie();
185
+ case "pointAndFigure": return new qe();
186
+ case "volumeCandles": return new mt();
187
187
  case "equivolume": return new ke();
188
188
  case "hlcArea": return new Me();
189
- case "stepLine": return new nt();
190
- case "lineWithMarkers": return new Re();
189
+ case "stepLine": return new at();
190
+ case "lineWithMarkers": return new ze();
191
191
  case "hiLo": return new w();
192
192
  default: return new ge();
193
193
  }
194
194
  }
195
- function Wt(e, t, n = {}) {
195
+ function Zt(e, t, n = {}) {
196
196
  if (t.length === 0) return t;
197
197
  switch (e) {
198
- case "heikinAshi": return Tt(t);
198
+ case "heikinAshi": return kt(t);
199
199
  case "renko": {
200
200
  let e = n.renko?.boxSize;
201
- return typeof e == "number" ? N(t, { brickSize: e }) : N(t, {
201
+ return typeof e == "number" ? Pt(t, { brickSize: e }) : Pt(t, {
202
202
  brickSize: 0,
203
203
  useATR: !0,
204
204
  atrPeriod: n.renko?.atrPeriod ?? 14
205
205
  });
206
206
  }
207
- case "lineBreak": return Dt(t, n.lineBreak?.lines ?? 3);
208
- case "kagi": return Et(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
- case "pointAndFigure": return Ot(t, qt(t, n), n.pointAndFigure?.reversal ?? 3);
207
+ case "lineBreak": return jt(t, n.lineBreak?.lines ?? 3);
208
+ case "kagi": return At(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
+ case "pointAndFigure": return Mt(t, en(t, n), n.pointAndFigure?.reversal ?? 3);
210
210
  case "rangeBars": {
211
211
  let e = n.rangeBars?.range;
212
- return kt(t, { rangeSize: typeof e == "number" ? e : Jt(t) * .005 });
212
+ return Nt(t, { rangeSize: typeof e == "number" ? e : j(t) * .005 });
213
213
  }
214
214
  default: return t;
215
215
  }
216
216
  }
217
- function Gt(e) {
217
+ function Qt(e) {
218
218
  switch (e) {
219
219
  case "heikinAshi":
220
220
  case "renko":
@@ -225,30 +225,30 @@ function Gt(e) {
225
225
  default: return !1;
226
226
  }
227
227
  }
228
- function Kt(e) {
229
- return e !== "heikinAshi" && Gt(e);
228
+ function $t(e) {
229
+ return e !== "heikinAshi" && Qt(e);
230
230
  }
231
- function qt(e, t = {}) {
231
+ function en(e, t = {}) {
232
232
  let n = t.pointAndFigure?.boxSize;
233
- return typeof n == "number" ? n : Jt(e) * .01;
233
+ return typeof n == "number" ? n : j(e) * .01;
234
234
  }
235
- function Jt(e) {
235
+ function j(e) {
236
236
  let t = 0;
237
237
  for (let n of e) t += n.close;
238
238
  return t / e.length;
239
239
  }
240
- function Yt(e, t) {
240
+ function tn(e, t) {
241
241
  let n = t?.(e);
242
- return n ? n.createRenderer() : Ut(e);
242
+ return n ? n.createRenderer() : Xt(e);
243
243
  }
244
- function Xt(e, t, n, r) {
244
+ function nn(e, t, n, r) {
245
245
  if (t.length === 0) return t;
246
246
  let i = n?.(e);
247
- return i?.transform ? i.transform(t) : Wt(e, t, r);
247
+ return i?.transform ? i.transform(t) : Zt(e, t, r);
248
248
  }
249
249
  //#endregion
250
250
  //#region src/state/AutoSaveScheduler.ts
251
- var Zt = class {
251
+ var rn = class {
252
252
  timer = null;
253
253
  delayMs = 0;
254
254
  key = null;
@@ -278,15 +278,15 @@ var Zt = class {
278
278
  };
279
279
  //#endregion
280
280
  //#region src/DataManager.ts
281
- function R(e) {
281
+ function M(e) {
282
282
  if (!e || typeof e.time != "number" || !Number.isFinite(e.time)) return !1;
283
283
  let { open: t, high: n, low: r, close: i } = e;
284
284
  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));
285
285
  }
286
- function Qt(e) {
286
+ function N(e) {
287
287
  return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
288
288
  }
289
- function z(e) {
289
+ function P(e) {
290
290
  return {
291
291
  ...e,
292
292
  high: Math.max(e.open, e.high, e.low, e.close),
@@ -294,7 +294,7 @@ function z(e) {
294
294
  volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
295
295
  };
296
296
  }
297
- var B = class {
297
+ var F = class {
298
298
  data = [];
299
299
  getData() {
300
300
  return this.data;
@@ -303,7 +303,7 @@ var B = class {
303
303
  let t = [];
304
304
  for (let n = 0; n < e.length; n++) {
305
305
  let r = e[n];
306
- R(r) && t.push(Qt(r) ? r : z(r));
306
+ M(r) && t.push(N(r) ? r : P(r));
307
307
  }
308
308
  this.data = t;
309
309
  }
@@ -311,7 +311,7 @@ var B = class {
311
311
  let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
312
312
  for (let r = 0; r < e.length; r++) {
313
313
  let i = e[r];
314
- !R(i) || i.time >= t || n.push(Qt(i) ? i : z(i));
314
+ !M(i) || i.time >= t || n.push(N(i) ? i : P(i));
315
315
  }
316
316
  if (n.length === 0) return 0;
317
317
  n.sort((e, t) => e.time - t.time);
@@ -320,11 +320,11 @@ var B = class {
320
320
  return n.length = r, this.data = n.concat(this.data), r;
321
321
  }
322
322
  appendBar(e) {
323
- R(e) && this.data.push(z(e));
323
+ M(e) && this.data.push(P(e));
324
324
  }
325
325
  updateLastBar(e) {
326
- if (!R(e)) return;
327
- let t = z(e);
326
+ if (!M(e)) return;
327
+ let t = P(e);
328
328
  if (this.data.length === 0) {
329
329
  this.data.push(t);
330
330
  return;
@@ -340,7 +340,7 @@ var B = class {
340
340
  clear() {
341
341
  this.data = [];
342
342
  }
343
- }, $t = 5e3, en = 6e4, tn = 500, nn = class {
343
+ }, I = 5e3, an = 6e4, on = 500, sn = class {
344
344
  loader = null;
345
345
  pageSize = 500;
346
346
  loading = !1;
@@ -381,7 +381,7 @@ var B = class {
381
381
  try {
382
382
  r = await e(t, this.pageSize);
383
383
  } catch (e) {
384
- return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(en, $t * 2 ** (this.failures - 1)), this.emit({
384
+ return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(an, I * 2 ** (this.failures - 1)), this.emit({
385
385
  state: "error",
386
386
  count: 0,
387
387
  error: e instanceof Error ? e.message : String(e)
@@ -411,7 +411,7 @@ var B = class {
411
411
  now() {
412
412
  return this.host.now ? this.host.now() : Date.now();
413
413
  }
414
- }, rn = class t {
414
+ }, L = class t {
415
415
  base;
416
416
  shape = null;
417
417
  chartType = "candlestick";
@@ -497,7 +497,7 @@ var B = class {
497
497
  };
498
498
  //#endregion
499
499
  //#region src/style/styleOptions.ts
500
- function an(e, t) {
500
+ function R(e, t) {
501
501
  return t ? {
502
502
  ...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
503
503
  ...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
@@ -505,22 +505,22 @@ function an(e, t) {
505
505
  ...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
506
506
  } : {};
507
507
  }
508
- function on(e) {
508
+ function cn(e) {
509
509
  let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
510
510
  return {
511
511
  ...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
512
512
  ...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
513
513
  ...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
514
514
  ...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
515
- ...an("horizontal", n?.hLine),
516
- ...an("vertical", n?.vLine),
515
+ ...R("horizontal", n?.hLine),
516
+ ...R("vertical", n?.vLine),
517
517
  ...r === void 0 ? {} : { "crosshair.labelBackground": r },
518
518
  ...e.overrides
519
519
  };
520
520
  }
521
521
  //#endregion
522
522
  //#region src/layout/LayoutManager.ts
523
- var sn = 200, cn = 80, V = (e) => e.position === "top" || e.position === "bottom", ln = class {
523
+ var z = 200, B = 80, V = (e) => e.position === "top" || e.position === "bottom", ln = class {
524
524
  panels = [];
525
525
  containerWidth = 0;
526
526
  containerHeight = 0;
@@ -536,8 +536,8 @@ var sn = 200, cn = 80, V = (e) => e.position === "top" || e.position === "bottom
536
536
  this.panels.push({
537
537
  id: e,
538
538
  position: n,
539
- size: r ?? (a ? sn : t),
540
- minSize: a ? cn : i,
539
+ size: r ?? (a ? z : t),
540
+ minSize: a ? B : i,
541
541
  content: {
542
542
  type: "indicator",
543
543
  indicatorInstanceId: e
@@ -606,7 +606,7 @@ var sn = 200, cn = 80, V = (e) => e.position === "top" || e.position === "bottom
606
606
  let r = this.panels.find((t) => t.id === e);
607
607
  if (r) {
608
608
  let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
609
- r.position = n, a !== o && (r.size = o ? sn : t, r.minSize = o ? cn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
609
+ r.position = n, a !== o && (r.size = o ? z : t, r.minSize = o ? B : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
610
610
  }
611
611
  }
612
612
  setPanelSize(e, t) {
@@ -776,18 +776,18 @@ function yn(e) {
776
776
  function bn(e) {
777
777
  return U.delete(e);
778
778
  }
779
- function xn() {
779
+ function W() {
780
780
  return [...U.values()];
781
781
  }
782
- function Sn() {
782
+ function xn() {
783
783
  U.clear();
784
784
  }
785
785
  //#endregion
786
786
  //#region src/plugins/PluginManager.ts
787
- var Cn = class {
787
+ var Sn = class {
788
788
  plugins = /* @__PURE__ */ new Map();
789
789
  constructor(e, t = {}) {
790
- if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of xn()) this.add(e);
790
+ if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of W()) this.add(e);
791
791
  for (let e of t.plugins ?? []) this.add(e);
792
792
  }
793
793
  register(e) {
@@ -817,15 +817,15 @@ var Cn = class {
817
817
  add(e) {
818
818
  this.plugins.set(H(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
819
819
  }
820
- }, wn = {
820
+ }, Cn = {
821
821
  orderPlace: (e, t) => e.placeOrder(t),
822
822
  orderModify: (e, t) => e.modifyOrder(t),
823
823
  orderCancel: (e, t) => e.cancelOrder(t),
824
824
  positionModify: (e, t) => e.modifyPosition(t),
825
825
  positionClose: (e, t) => e.closePosition(t),
826
- positionReverse: (e, t, n) => Tn(e, t, n)
826
+ positionReverse: (e, t, n) => wn(e, t, n)
827
827
  };
828
- async function Tn(e, t, n) {
828
+ async function wn(e, t, n) {
829
829
  let { reversing: r } = n;
830
830
  if (!r.has(t.positionId)) {
831
831
  r.add(t.positionId);
@@ -854,7 +854,7 @@ async function Tn(e, t, n) {
854
854
  }
855
855
  }
856
856
  }
857
- function En(e, t) {
857
+ function Tn(e, t) {
858
858
  let n = [], r = null, i = {
859
859
  positions: () => r ?? t.getPositions?.() ?? [],
860
860
  reversing: /* @__PURE__ */ new Set()
@@ -864,8 +864,8 @@ function En(e, t) {
864
864
  e.data && t.onFill?.(e.data);
865
865
  };
866
866
  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));
867
- for (let r of Object.keys(wn)) {
868
- let a = wn[r], o = t.onIntent(r, (n) => {
867
+ for (let r of Object.keys(Cn)) {
868
+ let a = Cn[r], o = t.onIntent(r, (n) => {
869
869
  Promise.resolve(a(e, n, i)).catch((e) => t.onError({
870
870
  message: `Execution command failed: ${r}`,
871
871
  cause: e
@@ -879,16 +879,16 @@ function En(e, t) {
879
879
  }
880
880
  //#endregion
881
881
  //#region src/Chart.ts
882
- var Dn = {
882
+ var En = {
883
883
  min: 0,
884
884
  max: 100
885
- }, On = 0xe8d4a51000, kn = "exchange";
886
- function An(e) {
885
+ }, Dn = 0xe8d4a51000, On = "exchange";
886
+ function kn(e) {
887
887
  if (typeof e == "string" && e !== "exchange" && !p(e)) throw RangeError(`Unknown time zone: ${e}`);
888
888
  if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
889
889
  }
890
- var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
891
- static version = "1.13.0";
890
+ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
891
+ static version = "1.16.0";
892
892
  engine;
893
893
  viewport;
894
894
  dataManager;
@@ -926,7 +926,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
926
926
  indicatorHistoryDepth = 0;
927
927
  removedDrawingAlerts = /* @__PURE__ */ new Map();
928
928
  zoomAreaMode = !1;
929
- priceAxisAddButton = new Ke();
929
+ priceAxisAddButton = new Ye();
930
930
  displayTz = null;
931
931
  timezoneSetting = null;
932
932
  symbolInfo = null;
@@ -946,15 +946,17 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
946
946
  signalMarkerManager;
947
947
  tradeZoneManager;
948
948
  measureOverlay;
949
- selectionBoxOverlay = new Ze();
949
+ selectionBoxOverlay = new et();
950
950
  replayManager;
951
951
  replayBarUnsub = null;
952
952
  replaySeeking = !1;
953
953
  replaySession = null;
954
954
  replayStepsSeries = null;
955
955
  replayCoarse = null;
956
+ replayRevealMarks = !0;
957
+ replayOffset = 0;
956
958
  undoRedoManager;
957
- autoSaveScheduler = new Zt((e) => this.saveState(e));
959
+ autoSaveScheduler = new rn((e) => this.saveState(e));
958
960
  animator;
959
961
  crosshairTooltip;
960
962
  pinnedTooltip;
@@ -966,15 +968,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
966
968
  disposed = !1;
967
969
  chartTypeOptions = {};
968
970
  mainSeriesVisible = !0;
969
- priceLines = new qe();
970
- symbolSeries = new it();
971
+ priceLines = new Xe();
972
+ symbolSeries = new st();
971
973
  extendedHours = !0;
972
974
  replayRestarting = !1;
973
975
  fullSeries = null;
974
976
  requestedSymbols = /* @__PURE__ */ new Set();
975
977
  gridRenderer;
976
978
  priceAxis;
977
- leftPriceAxis = new D();
979
+ leftPriceAxis = new Je();
978
980
  leftScaleRequested = !1;
979
981
  leftAxisWidth = a;
980
982
  leftViewport = null;
@@ -1004,7 +1006,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1004
1006
  snapshotKey = null;
1005
1007
  historyCheckQueued = !1;
1006
1008
  constructor(e, t) {
1007
- t.timeZone != null && An(t.timeZone), this.container = e, this.options = {
1009
+ t.timeZone != null && kn(t.timeZone), this.container = e, this.options = {
1008
1010
  ...t,
1009
1011
  chartType: t.chartType ?? "candlestick"
1010
1012
  }, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
@@ -1042,15 +1044,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1042
1044
  logScale: n.logScale ?? !0,
1043
1045
  timeframes: n.timeframes ?? [],
1044
1046
  defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
1045
- }, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.dataManager = new B(), this.history = new nn({
1047
+ }, e.style.position = "relative", e.style.overflow = "hidden", e.tabIndex = 0, e.style.outline = "none", e.style.userSelect = "none", e.style.webkitUserSelect = "none", this.dataManager = new F(), this.history = new sn({
1046
1048
  oldestTime: () => this.dataManager.getData()[0]?.time ?? null,
1047
1049
  prepend: (e) => this.prependBars(e),
1048
1050
  emit: (e) => this.eventBus.emit("historyLoad", e)
1049
- }), this.themeManager = new rn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(on(t), "host", !1), this.layoutManager = new ln(), this.indicatorEngine = new T(), this.pluginManager = new Cn(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ae(), k(this.indicatorEngine), this.indicatorEngine.register(new ye(this.symbolSeries)), this.indicatorEngine.register(new tt(this.symbolSeries)), this.indicatorEngine.register(new be(this.symbolSeries)), this.indicatorEngine.register(new xe(this.symbolSeries)), this.drawingManager = new De(), wt(this.drawingManager), this.drawingRenderer = new Oe(this.drawingManager), this.drawingManager.setRequestRender(() => {
1051
+ }), this.themeManager = new L(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(cn(t), "host", !1), this.layoutManager = new ln(), this.indicatorEngine = new Pe(), this.pluginManager = new Sn(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ae(), E(this.indicatorEngine), this.indicatorEngine.register(new ye(this.symbolSeries)), this.indicatorEngine.register(new it(this.symbolSeries)), this.indicatorEngine.register(new be(this.symbolSeries)), this.indicatorEngine.register(new xe(this.symbolSeries)), this.drawingManager = new De(), Dt(this.drawingManager), this.drawingRenderer = new Oe(this.drawingManager), this.drawingManager.setRequestRender(() => {
1050
1052
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1051
1053
  }), this.drawingManager.setEventCallback((e, t) => {
1052
1054
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1053
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new lt();
1055
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new ft();
1054
1056
  let i = "";
1055
1057
  this.undoRedoManager.setOnChange(() => {
1056
1058
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1063,21 +1065,21 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1063
1065
  primary: e[0] ?? null
1064
1066
  })), this.drawingManager.setForeignHistory((e, t) => {
1065
1067
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
1066
- }), this.drawingManager.setDataGetter(() => this.dataManager.getData()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new st({
1068
+ }), this.drawingManager.setDataGetter(() => this.dataManager.getData()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new ut({
1067
1069
  enabled: this.features.trading,
1068
1070
  contextMenu: { enabled: this.features.tradingContextMenu }
1069
- }), this.tradingRenderer = new ct(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1071
+ }), this.tradingRenderer = new dt(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1070
1072
  this.eventBus.emit(e, t);
1071
- }), this.engine = new Je(e);
1073
+ }), this.engine = new Ze(e);
1072
1074
  let a = this.engine.dprManager.getContainerSize();
1073
- if (this.viewport = new ut(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1075
+ if (this.viewport = new pt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1074
1076
  freePan: t.freePan ?? !0,
1075
1077
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1076
1078
  }), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1077
1079
  if (e.width <= 0 || e.height <= 0) return;
1078
1080
  let t = this.viewport.isAtEnd();
1079
1081
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
1080
- }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new je(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new D(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new at(), this.crosshairHandler = new Se(), this.crosshairHandler.setLocale(this.numberLocale), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setCallback((e, t) => {
1082
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new je(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new Je(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new ct(), this.crosshairHandler = new Se(), this.crosshairHandler.setLocale(this.numberLocale), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setCallback((e, t) => {
1081
1083
  if (e !== null && t) {
1082
1084
  let n = this.dataManager.getData(), r = e < n.length ? n[e] : void 0;
1083
1085
  this.chartLegend.setHoverBar(r ?? null);
@@ -1086,19 +1088,19 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1086
1088
  prevClose: e > 0 ? n[e - 1]?.close : void 0,
1087
1089
  priceRange: i.priceRange,
1088
1090
  plot: i.chartRect,
1089
- barStepMs: gt(n)
1091
+ barStepMs: yt(n)
1090
1092
  }) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
1091
1093
  point: t,
1092
1094
  bar: r,
1093
1095
  barIndex: e
1094
1096
  });
1095
1097
  } else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
1096
- }), this.chartLegend = new _e(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new mt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new pt(), this.volumeProfile = new ft(), this.marketProfile = new ze(), this.depthHeatmap = new Ee(), this.periodLevels = new Ue(), this.pivotMarkers = new Ge(), this.barCountdown = new pe(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new Qe(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new $e(), this.compareRenderer = new ve(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1098
+ }), this.chartLegend = new _e(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new _t(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new gt(), this.volumeProfile = new ht(), this.marketProfile = new Be(), this.depthHeatmap = new Ee(), this.periodLevels = new We(), this.pivotMarkers = new Ke(), this.barCountdown = new pe(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new tt(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new nt(), this.compareRenderer = new ve(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1097
1099
  visible: t.sessionBreaks.visible ?? !0,
1098
1100
  color: t.sessionBreaks.color,
1099
1101
  lineStyle: t.sessionBreaks.lineStyle,
1100
1102
  lineWidth: t.sessionBreaks.lineWidth
1101
- }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new ue(), this.crosshairTooltip = new Ce(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new We(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = y(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(zn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Ie({
1103
+ }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new ue(), this.crosshairTooltip = new Ce(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Ge(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = y(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Rn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Le({
1102
1104
  scrollBars: (e) => {
1103
1105
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1104
1106
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1115,7 +1117,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1115
1117
  },
1116
1118
  fitContent: () => this.fitContent()
1117
1119
  }), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
1118
- this.a11y = new zt(e, {
1120
+ this.a11y = new Kt(e, {
1119
1121
  symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
1120
1122
  timeframe: () => this.streamTimeframe ?? "",
1121
1123
  chartType: () => this.options.chartType ?? "candlestick",
@@ -1125,7 +1127,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1125
1127
  formatTime: (e) => se(this.numberLocale || "en-US", {
1126
1128
  dateStyle: "medium",
1127
1129
  timeStyle: "short"
1128
- }, this.displayTz)(e > On ? e : e * 1e3),
1130
+ }, this.displayTz)(e > Dn ? e : e * 1e3),
1129
1131
  showBar: (e) => this.setCrosshairTime(e)
1130
1132
  }, t.a11y?.labels);
1131
1133
  for (let e of [
@@ -1146,21 +1148,21 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1146
1148
  this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
1147
1149
  }
1148
1150
  }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new we(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new le(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1149
- this.eventBus.emit("alertTriggered", G(e)), this.eventBus.emit("dataUpdate", {
1151
+ this.eventBus.emit("alertTriggered", K(e)), this.eventBus.emit("dataUpdate", {
1150
1152
  alert: "triggered",
1151
1153
  alertId: e.id,
1152
1154
  price: e.price,
1153
1155
  message: e.message
1154
1156
  });
1155
1157
  }), this.alertManager.on("added", (e) => {
1156
- this.eventBus.emit("alertAdd", G(e));
1158
+ this.eventBus.emit("alertAdd", K(e));
1157
1159
  }), this.alertManager.on("removed", (e) => {
1158
1160
  this.eventBus.emit("alertRemove", { id: e });
1159
1161
  }), this.alertManager.on("expired", (e) => {
1160
- this.eventBus.emit("alertExpired", G(e));
1162
+ this.eventBus.emit("alertExpired", K(e));
1161
1163
  }), this.alertManager.on("updated", (e) => {
1162
- this.eventBus.emit("alertUpdate", G(e));
1163
- }), this.signalMarkerManager = new et(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1164
+ this.eventBus.emit("alertUpdate", K(e));
1165
+ }), this.signalMarkerManager = new rt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1164
1166
  this.eventBus.emit("signalMarkerAdd", {
1165
1167
  id: e.id,
1166
1168
  source: e.source,
@@ -1168,18 +1170,24 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1168
1170
  });
1169
1171
  }), this.signalMarkerManager.on("removed", (e) => {
1170
1172
  this.eventBus.emit("signalMarkerRemove", { id: e });
1171
- }), this.tradeZoneManager = new ot(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1173
+ }), this.tradeZoneManager = new lt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1172
1174
  this.eventBus.emit("tradeZoneAdd", {
1173
1175
  id: e.id,
1174
1176
  direction: e.direction
1175
1177
  });
1176
1178
  }), this.tradeZoneManager.on("removed", (e) => {
1177
1179
  this.eventBus.emit("tradeZoneRemove", { id: e });
1178
- }), this.replayManager = new Xe(), this.replayManager.on("stateChange", (e) => {
1180
+ }), this.replayManager = new $e(), this.replayManager.on("complete", () => {
1181
+ let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1182
+ t && this.eventBus.emit("replayComplete", {
1183
+ barIndex: e,
1184
+ time: t.time
1185
+ });
1186
+ }), this.replayManager.on("stateChange", (e) => {
1179
1187
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1180
- }), this.measureOverlay = new Be(), this.interactionManager = new Pe(e), this.features.panning) {
1188
+ }), this.measureOverlay = new Ve(), this.interactionManager = new Fe(e), this.features.panning) {
1181
1189
  let e = new gn();
1182
- this.interactionManager.setPanHandler(new Ve((t, n) => {
1190
+ this.interactionManager.setPanHandler(new He((t, n) => {
1183
1191
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.options.autoScale = !1, this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1184
1192
  }, () => e.reset()));
1185
1193
  }
@@ -1191,7 +1199,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1191
1199
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1192
1200
  }
1193
1201
  })), this.features.zooming) {
1194
- this.interactionManager.setZoomHandler(new ht((e, t) => {
1202
+ this.interactionManager.setZoomHandler(new vt((e, t) => {
1195
1203
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1196
1204
  }));
1197
1205
  let e = new fe((e) => {
@@ -1214,7 +1222,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1214
1222
  y: t.y
1215
1223
  });
1216
1224
  })), this.interactionManager.setChartContextMenu((e, t) => this.eventBus.hasListeners("chartContextMenu") ? (this.eventBus.emit("chartContextMenu", this.contextAt(e, t)), !0) : !1), this.priceAxisAddButton.setEnabled(this.features.priceAxisAddButton && this.features.crosshair), this.interactionManager.setPriceAxisAddButton(this.priceAxisAddButton, (e) => {
1217
- let t = F(e.y, this.viewport.getState());
1225
+ let t = Rt(e.y, this.viewport.getState());
1218
1226
  Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
1219
1227
  price: t,
1220
1228
  x: e.x,
@@ -1227,7 +1235,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1227
1235
  let e = new ce(this.alertManager, () => this.viewport.getState());
1228
1236
  this.interactionManager.setAlertDragHandler(e);
1229
1237
  }
1230
- let o = new He();
1238
+ let o = new Ue();
1231
1239
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1232
1240
  let t = this.getDisplayData();
1233
1241
  if (t.length === 0) return;
@@ -1251,7 +1259,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1251
1259
  x: e.x,
1252
1260
  y: e.y
1253
1261
  }), t.length === 0) return;
1254
- let r = Mt(e.x, this.viewport.getState());
1262
+ let r = Lt(e.x, this.viewport.getState());
1255
1263
  r < 0 || r >= t.length || this.eventBus.emit("barClick", {
1256
1264
  bar: t[r],
1257
1265
  barIndex: r,
@@ -1291,7 +1299,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1291
1299
  end: () => {
1292
1300
  let e = this.selectionBoxOverlay.end();
1293
1301
  if (e && this.zoomAreaMode) {
1294
- if (e.x1 - e.x0 < Fn) return;
1302
+ if (e.x1 - e.x0 < Pn) return;
1295
1303
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1296
1304
  return;
1297
1305
  }
@@ -1337,7 +1345,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1337
1345
  if (a === 0) return t ?? 0;
1338
1346
  let o = this.dataManager.getData();
1339
1347
  if (this.crosshairHandler.setData(o), this.displayDataCache = null, this.sessionBreaks.invalidateCache(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.unpin(), this.measureOverlay.end(), this.recalcIndicators(o), i !== void 0) {
1340
- let e = Math.round(M(i, this.getDisplayData()));
1348
+ let e = Math.round(O(i, this.getDisplayData()));
1341
1349
  this.viewport.prependBars(e - r);
1342
1350
  }
1343
1351
  return this.updateViewportAndRender(), t ?? a;
@@ -1368,14 +1376,14 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1368
1376
  }
1369
1377
  checkHistory() {
1370
1378
  this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
1371
- if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || Kt(this.options.chartType)) return;
1379
+ if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || $t(this.options.chartType)) return;
1372
1380
  let { from: e, to: t } = this.viewport.getState().visibleRange;
1373
- this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Pn, t - e));
1381
+ this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Nn, t - e));
1374
1382
  }));
1375
1383
  }
1376
1384
  useStreamHistory(e, t) {
1377
1385
  if (this.hostHistoryLoader) return;
1378
- let n = jt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1386
+ let n = It(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1379
1387
  if (!r || i === null || ie(i) !== null) {
1380
1388
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
1381
1389
  return;
@@ -1457,7 +1465,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1457
1465
  return this.extendedHours;
1458
1466
  }
1459
1467
  sessionKeep(e) {
1460
- return this.extendedHours ? null : Ft(this.symbolInfo, e);
1468
+ return this.extendedHours ? null : Vt(this.symbolInfo, e);
1461
1469
  }
1462
1470
  shownBars(e) {
1463
1471
  let t = this.sessionKeep(e);
@@ -1468,7 +1476,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1468
1476
  return this.fullSeries = t ? e.slice() : null, t ? e.filter((e) => t(e.time)) : e;
1469
1477
  }
1470
1478
  placeStreamBar(e) {
1471
- let t = K(this.dataManager.getData(), e);
1479
+ let t = q(this.dataManager.getData(), e);
1472
1480
  return t === "stale" ? !1 : (t === "append" ? this.dataManager.appendBar(e) : this.dataManager.updateLastBar(e), !0);
1473
1481
  }
1474
1482
  takeBar(e, t) {
@@ -1498,7 +1506,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1498
1506
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
1499
1507
  }
1500
1508
  setShapes(e) {
1501
- let t = zn(e);
1509
+ let t = Rn(e);
1502
1510
  t.tagRadius !== void 0 && (this.themeManager.setShape({
1503
1511
  ...this.themeManager.getTheme().shape,
1504
1512
  ...t
@@ -1543,7 +1551,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1543
1551
  setSymbolSeries(e, t) {
1544
1552
  e = e.trim(), this.symbolSeries.set(e, t), this.requestedSymbols.delete(e);
1545
1553
  let n = this.dataManager.getData(), r = !1;
1546
- for (let t of this.indicatorEngine.getActiveIndicators()) !W.has(t.id) || String(t.params.symbol ?? "").trim() !== e.trim() || (this.indicatorEngine.updateIndicator(t.instanceId, {}, n), r = !0);
1554
+ for (let t of this.indicatorEngine.getActiveIndicators()) !G.has(t.id) || String(t.params.symbol ?? "").trim() !== e.trim() || (this.indicatorEngine.updateIndicator(t.instanceId, {}, n), r = !0);
1547
1555
  r && (this.announceIndicatorUpdate(0), this.updateViewportAndRender());
1548
1556
  }
1549
1557
  forgetUnreadSymbols() {
@@ -1557,20 +1565,20 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1557
1565
  let e = /* @__PURE__ */ new Set();
1558
1566
  for (let t of this.indicatorEngine.getActiveIndicators()) {
1559
1567
  let n = t.params.symbol;
1560
- W.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1568
+ G.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1561
1569
  }
1562
1570
  return [...e];
1563
1571
  }
1564
1572
  requestMissingSymbols(e) {
1565
1573
  this.forgetUnreadSymbols();
1566
- let t = this.indicatorEngine.getIndicatorConfig(e), n = t && W.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1574
+ let t = this.indicatorEngine.getIndicatorConfig(e), n = t && G.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1567
1575
  !n || this.symbolSeries.has(n) || this.requestedSymbols.has(n) || (this.requestedSymbols.add(n), this.eventBus.emit("symbolSeriesRequest", { symbol: n }));
1568
1576
  }
1569
1577
  updateIndicator(e, t) {
1570
1578
  this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
1571
1579
  }
1572
1580
  updateIndicatorNow(e, t) {
1573
- let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? j(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1581
+ let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? D(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1574
1582
  this.indicatorEngine.updateIndicator(e, t, this.dataManager.getData()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
1575
1583
  instanceId: e,
1576
1584
  change: "params"
@@ -1588,7 +1596,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1588
1596
  paneFor(e, t, n, r) {
1589
1597
  if (n) return this.paneHostOf(n, r);
1590
1598
  if (e.placement !== "overlay") return null;
1591
- let i = j(e), a = i ? g(t[i]) : null;
1599
+ let i = D(e), a = i ? g(t[i]) : null;
1592
1600
  return a ? this.paneHostOf(a.instanceId, r) : null;
1593
1601
  }
1594
1602
  paneHostOf(e, t) {
@@ -1631,8 +1639,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1631
1639
  return {
1632
1640
  ...e,
1633
1641
  priceRange: {
1634
- min: t.min - n * Mn,
1635
- max: t.max + n * Mn
1642
+ min: t.min - n * jn,
1643
+ max: t.max + n * jn
1636
1644
  },
1637
1645
  logScale: !1,
1638
1646
  scaleMode: "regular",
@@ -1679,7 +1687,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1679
1687
  this.indicatorEngine.setStyleDefaults(e, null);
1680
1688
  return;
1681
1689
  }
1682
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : b(n);
1690
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ee(n);
1683
1691
  this.indicatorEngine.setStyleDefaults(e, {
1684
1692
  ...r,
1685
1693
  ...i ? { plots: i } : {}
@@ -1687,7 +1695,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1687
1695
  }
1688
1696
  setPaneStyle(e, t) {
1689
1697
  let n = this.paneOf(e);
1690
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? ee(t) : null));
1698
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? b(t) : null));
1691
1699
  }
1692
1700
  setPaneStyleNow(e, t) {
1693
1701
  JSON.stringify(t) !== JSON.stringify(this.paneStyles.get(e) ?? null) && (t ? this.paneStyles.set(e, t) : this.paneStyles.delete(e), this.panelInfoCache = null, this.syncRenderContext(), this.engine.requestRender(), this.markStateChanged());
@@ -1706,8 +1714,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1706
1714
  return this.pluginManager;
1707
1715
  }
1708
1716
  static indicators() {
1709
- let e = new T();
1710
- return k(e), e.getAvailableIndicators();
1717
+ let e = new Pe();
1718
+ return E(e), e.getAvailableIndicators();
1711
1719
  }
1712
1720
  setPanelPosition(e, t) {
1713
1721
  this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
@@ -1730,7 +1738,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1730
1738
  paneMoveHost(e, t) {
1731
1739
  let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
1732
1740
  if (!n || !r) return;
1733
- let i = j(r);
1741
+ let i = D(r);
1734
1742
  if (r.placement === "overlay" && i && g(n.params[i])) return;
1735
1743
  if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
1736
1744
  if (t === "new") {
@@ -1837,7 +1845,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1837
1845
  return this.features.legend ? e + this.chartLegend.getHeight() : e;
1838
1846
  }
1839
1847
  isTimeAligned() {
1840
- return Kt(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1848
+ return $t(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1841
1849
  }
1842
1850
  roundPrice(e) {
1843
1851
  if (!Number.isFinite(e)) return e;
@@ -1909,7 +1917,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1909
1917
  }
1910
1918
  autoFib() {
1911
1919
  if (!this.features.drawings) return null;
1912
- let e = this.getDisplayData(), t = this.viewport.getState(), n = _t(e, t.visibleRange.from, t.visibleRange.to);
1920
+ let e = this.getDisplayData(), t = this.viewport.getState(), n = bt(e, t.visibleRange.from, t.visibleRange.to);
1913
1921
  return n ? this.addDrawing({
1914
1922
  type: "fibRetracement",
1915
1923
  anchors: [n[0], n[1]]
@@ -1984,7 +1992,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1984
1992
  recordUndo(e) {
1985
1993
  if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
1986
1994
  let t = performance.now(), n = this.undoRedoManager.last();
1987
- if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Nn) {
1995
+ if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Mn) {
1988
1996
  this.undoRedoManager.replaceLast({
1989
1997
  ...n,
1990
1998
  custom: {
@@ -2031,7 +2039,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2031
2039
  x: t.x,
2032
2040
  y: t.y
2033
2041
  };
2034
- if ((e === "plot" || e === "priceAxis") && (r.price = F(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = P(t.x, n)), e === "pane") {
2042
+ if ((e === "plot" || e === "priceAxis") && (r.price = Rt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = k(t.x, n)), e === "pane") {
2035
2043
  let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
2036
2044
  e && (r.pane = e.instanceId);
2037
2045
  }
@@ -2057,7 +2065,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2057
2065
  ...this.viewport.getState(),
2058
2066
  data: this.getDisplayData()
2059
2067
  };
2060
- this.setVisibleRange(P(e.x0, t), P(e.x1, t));
2068
+ this.setVisibleRange(k(e.x0, t), k(e.x1, t));
2061
2069
  }
2062
2070
  lockAllDrawings() {
2063
2071
  this.drawingManager.lockAllDrawings();
@@ -2102,7 +2110,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2102
2110
  for (let e of this.indicatorEngine.getActiveIndicators()) {
2103
2111
  let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
2104
2112
  if (!t) continue;
2105
- let r = Ht(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2113
+ let r = Yt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2106
2114
  key: e,
2107
2115
  title: e
2108
2116
  }));
@@ -2180,7 +2188,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2180
2188
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2181
2189
  }
2182
2190
  updateIndicatorStyleNow(e, t) {
2183
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : b(n);
2191
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ee(n);
2184
2192
  this.indicatorEngine.updateIndicatorStyle(e, {
2185
2193
  ...r,
2186
2194
  ...i ? { plots: i } : {}
@@ -2290,8 +2298,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2290
2298
  this.features.trading && this.tradingManager.setConfig(e);
2291
2299
  }
2292
2300
  async connect(e) {
2293
- if (!A(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2294
- this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new rt(), this.streamManager.on("snapshot", (t) => {
2301
+ if (!Ot(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2302
+ this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new ot(), this.streamManager.on("snapshot", (t) => {
2295
2303
  let n = `${this.currentSymbol}|${this.streamTimeframe}`;
2296
2304
  this.replaySession ? this.replaySession.live.setData(t) : n === this.snapshotKey && this.dataManager.getLength() > 0 ? this.mergeSnapshot(t) : this.setData(t), this.snapshotKey = n, this.useStreamHistory(e.adapter, e.historyPageSize);
2297
2305
  }), this.streamManager.on("barClose", (e) => {
@@ -2299,7 +2307,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2299
2307
  this.replaySession.live.appendBar(e);
2300
2308
  return;
2301
2309
  }
2302
- let t = K(this.fullSeries ?? this.dataManager.getData(), e);
2310
+ let t = q(this.fullSeries ?? this.dataManager.getData(), e);
2303
2311
  if (t === "stale" || !this.takeBar(e, t)) return;
2304
2312
  let n = this.autoScrollOnNewBar && this.viewport.isAtEnd();
2305
2313
  if (!this.placeStreamBar(e)) return;
@@ -2311,7 +2319,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2311
2319
  return;
2312
2320
  }
2313
2321
  this.currentPriceLine.setPrice(e.close);
2314
- let t = K(this.fullSeries ?? this.dataManager.getData(), e);
2322
+ let t = q(this.fullSeries ?? this.dataManager.getData(), e);
2315
2323
  if (t === "stale" || !this.takeBar(e, t) || !this.placeStreamBar(e)) {
2316
2324
  this.scheduleRender();
2317
2325
  return;
@@ -2358,7 +2366,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2358
2366
  async switchStream(e, t) {
2359
2367
  if (!this.streamManager) return;
2360
2368
  let n = this.streamAdapter;
2361
- if (n && !A(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2369
+ if (n && !Ot(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2362
2370
  this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(ae(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
2363
2371
  }
2364
2372
  isTimeframeAllowed(e) {
@@ -2374,7 +2382,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2374
2382
  }
2375
2383
  connectExecution(e, t = {}) {
2376
2384
  if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
2377
- this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = En(e, {
2385
+ this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Tn(e, {
2378
2386
  onIntent: (e, t) => {
2379
2387
  let n = (e) => t(e.payload);
2380
2388
  return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
@@ -2465,18 +2473,18 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2465
2473
  goToTime(e) {
2466
2474
  let t = this.getDisplayData();
2467
2475
  if (t.length === 0 || !Number.isFinite(e)) return -1;
2468
- let n = Math.max(0, Math.min(t.length - 1, Math.floor(M(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2476
+ let n = Math.max(0, Math.min(t.length - 1, Math.floor(O(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2469
2477
  return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
2470
2478
  }
2471
2479
  setVisibleRangePreset(e) {
2472
2480
  let t = this.getDisplayData();
2473
2481
  if (t.length === 0) return;
2474
- let n = t.length - 1, r = t[n].time > On ? 1 : 1e3, i = St(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2482
+ let n = t.length - 1, r = t[n].time > Dn ? 1 : 1e3, i = Tt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2475
2483
  if (a === null || a < t[0].time) {
2476
2484
  this.fitContent();
2477
2485
  return;
2478
2486
  }
2479
- let o = M(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2487
+ let o = O(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2480
2488
  this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
2481
2489
  }
2482
2490
  scrollToEnd() {
@@ -2490,7 +2498,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2490
2498
  setVisibleRange(e, t) {
2491
2499
  let n = this.dataManager.getData();
2492
2500
  if (n.length === 0) return;
2493
- let r = M(Math.min(e, t), n), i = M(Math.max(e, t), n);
2501
+ let r = O(Math.min(e, t), n), i = O(Math.max(e, t), n);
2494
2502
  this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
2495
2503
  }
2496
2504
  setPanLimits(e) {
@@ -2582,7 +2590,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2582
2590
  e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
2583
2591
  }
2584
2592
  setCrosshairTime(e) {
2585
- let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(M(e, t));
2593
+ let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(O(e, t));
2586
2594
  n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
2587
2595
  }
2588
2596
  getData() {
@@ -2644,7 +2652,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2644
2652
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2645
2653
  }
2646
2654
  setTimezone(e) {
2647
- An(e), this.timezoneSetting = e, this.applyTimezone();
2655
+ kn(e), this.timezoneSetting = e, this.applyTimezone();
2648
2656
  }
2649
2657
  getTimezone() {
2650
2658
  return this.timezoneSetting;
@@ -2707,7 +2715,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2707
2715
  return this.sessionShading.isVisible();
2708
2716
  }
2709
2717
  setSessionShadingConfig(e) {
2710
- this.hostSessionHours = xt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2718
+ this.hostSessionHours = wt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2711
2719
  }
2712
2720
  setTooltipVisible(e) {
2713
2721
  e || this.crosshairTooltip.hide();
@@ -2726,11 +2734,11 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2726
2734
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2727
2735
  }
2728
2736
  async takeGpu(e, t, n) {
2729
- let { gpu: r, reason: i } = await bt(e);
2730
- return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? vt() > 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());
2737
+ let { gpu: r, reason: i } = await Ct(e);
2738
+ return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? xt() > 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());
2731
2739
  }
2732
2740
  waitForGpu(e) {
2733
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? At(e) : null;
2741
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Ft(e) : null;
2734
2742
  }
2735
2743
  getRenderer() {
2736
2744
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -2748,23 +2756,23 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2748
2756
  this.engine.getGpu() && this.engine.renderNow();
2749
2757
  }
2750
2758
  screenshot(e) {
2751
- this.features.screenshot && (this.freshFrame(), O.download(this.container, e, this.themeManager.getTheme().background));
2759
+ this.features.screenshot && (this.freshFrame(), T.download(this.container, e, this.themeManager.getTheme().background));
2752
2760
  }
2753
2761
  async copyScreenshot() {
2754
2762
  if (!this.features.screenshot) return !1;
2755
2763
  try {
2756
2764
  this.freshFrame();
2757
- let e = await O.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2765
+ let e = await T.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2758
2766
  return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
2759
2767
  } catch {
2760
2768
  return !1;
2761
2769
  }
2762
2770
  }
2763
2771
  screenshotDataURL() {
2764
- return this.features.screenshot ? (this.freshFrame(), O.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2772
+ return this.features.screenshot ? (this.freshFrame(), T.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2765
2773
  }
2766
2774
  async screenshotBlob() {
2767
- return this.features.screenshot ? (this.freshFrame(), O.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2775
+ return this.features.screenshot ? (this.freshFrame(), T.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2768
2776
  }
2769
2777
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
2770
2778
  if (!this.features.alerts) return null;
@@ -2888,45 +2896,58 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2888
2896
  }
2889
2897
  replayStart(e) {
2890
2898
  if (!this.features.replay) return;
2891
- if (this.history.reset(), !this.replaySession) {
2899
+ this.history.reset();
2900
+ let t = this.replaySession ? this.replayOffset : 0;
2901
+ if (!this.replaySession) {
2892
2902
  if (this.dataManager.getLength() === 0) return;
2893
- let e = new B();
2903
+ let e = new F();
2894
2904
  e.setData(this.fullSeries ?? this.dataManager.getData()), this.replaySession = {
2895
2905
  live: e,
2896
2906
  price: null,
2897
2907
  fedTime: null
2898
2908
  };
2899
2909
  }
2900
- let t = this.shownBars(this.replaySession.live.getData()), { steps: n, ...r } = e ?? {}, i = n ? Gn(n, t) : null;
2901
- this.replayStepsSeries = i, this.replayCoarse = t, this.options.autoScale = !0, this.replayRestarting = !0;
2910
+ let { steps: n, startTime: r, hideHistory: i, revealMarks: a, ...o } = e ?? {}, s = this.shownBars(this.replaySession.live.getData()), c = t > 0 && r === void 0 && i !== !1, l = o.startIndex;
2911
+ r !== void 0 && l === void 0 ? l = Vn(s, r) : c && l !== void 0 && (l += t);
2912
+ let u = c ? t : i && l !== void 0 && l > 0 ? Math.min(Math.floor(l), s.length - 1) : 0, d = u > 0 ? s.slice(u) : s;
2913
+ l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
2914
+ let f = n ? Gn(n, d) : null;
2915
+ this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
2902
2916
  try {
2903
- this.replayManager.load(i ?? t);
2917
+ this.replayManager.load(f ?? d);
2904
2918
  } finally {
2905
2919
  this.replayRestarting = !1;
2906
2920
  }
2907
- i && r.startIndex !== void 0 && (r.startIndex = Jn(i, t, r.startIndex)), this.replayBarUnsub?.();
2908
- let a = -1, o = -1, s = null, c = i ?? t;
2921
+ f && o.startIndex !== void 0 && (o.startIndex = Jn(f, d, o.startIndex)), this.replayBarUnsub?.();
2922
+ let p = -1, m = -1, h = null, g = f ?? d;
2909
2923
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
2910
- let n = e, r = t[e];
2911
- if (i) {
2912
- let c = i[e];
2913
- n = qn(t, c.time), s = s !== null && o === e - 1 && n === a - 1 && s ? Xn(s, c) : Yn(t[n], i, e), r = s;
2924
+ let t = e, n = d[e];
2925
+ if (f) {
2926
+ let r = f[e];
2927
+ t = qn(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? Xn(h, r) : Yn(d[t], f, e), n = h;
2914
2928
  }
2915
- o = e;
2916
- let l = n + 1, u = a > 0 && l >= a && this.dataManager.getLength() === a, d = !(u && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
2917
- if (u) {
2918
- i && l > a && this.dataManager.updateLastBar(t[a - 1]);
2919
- for (let e = a; e < l - 1; e++) this.dataManager.appendBar(t[e]);
2920
- l > a ? this.dataManager.appendBar(r) : this.dataManager.updateLastBar(r), this.recalcIndicatorsFrom(this.dataManager.getData(), Math.max(0, a - 1));
2921
- } else this.dataManager.setData([...t.slice(0, n), r]), this.recalcIndicators(this.dataManager.getData());
2922
- a = l, this.currentPriceLine.setPrice(r.close, n > 0 ? t[n - 1].close : void 0), this.crosshairHandler.setData(this.dataManager.getData()), this.displayDataCache = null, this.updateViewportAndRender(d), this.feedReplaySteps(c, e);
2923
- let f = c[e + 1]?.time ?? c[e].time + (e > 0 ? c[e].time - c[e - 1].time : 0);
2924
- this.eventBus.emit("replayStep", {
2925
- barIndex: n,
2926
- time: t[n].time,
2927
- until: f
2929
+ m = e;
2930
+ let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
2931
+ if (i) {
2932
+ f && r > p && this.dataManager.updateLastBar(d[p - 1]);
2933
+ for (let e = p; e < r - 1; e++) this.dataManager.appendBar(d[e]);
2934
+ r > p ? this.dataManager.appendBar(n) : this.dataManager.updateLastBar(n), this.recalcIndicatorsFrom(this.dataManager.getData(), Math.max(0, p - 1));
2935
+ } else this.dataManager.setData([...d.slice(0, t), n]), this.recalcIndicators(this.dataManager.getData());
2936
+ p = r, this.currentPriceLine.setPrice(n.close, t > 0 ? d[t - 1].close : void 0), this.crosshairHandler.setData(this.dataManager.getData());
2937
+ let o = g[e + 1]?.time ?? g[e].time + (e > 0 ? g[e].time - g[e - 1].time : 1);
2938
+ this.replayRevealMarks && this.revealReplayMarks(o), this.displayDataCache = null, this.updateViewportAndRender(a), this.feedReplaySteps(g, e), this.eventBus.emit("replayStep", {
2939
+ barIndex: t,
2940
+ time: d[t].time,
2941
+ until: o,
2942
+ total: d.length
2928
2943
  });
2929
- }), this.replayManager.play(r);
2944
+ });
2945
+ let _ = g[Math.max(0, Math.min(Math.floor(Number(o.startIndex ?? 0)) || 0, g.length - 1))];
2946
+ this.revealReplayMarks(this.replayRevealMarks ? _?.time ?? null : null), !o.paused && o.startIndex !== void 0 && o.startIndex >= 1 && this.replaySeek(o.startIndex - 1), this.replayManager.play(o);
2947
+ }
2948
+ revealReplayMarks(e) {
2949
+ let t = e !== null && this.replayOffset > 0 ? this.replayCoarse?.[0]?.time ?? -Infinity : -Infinity;
2950
+ this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
2930
2951
  }
2931
2952
  replaySeekToTime(e) {
2932
2953
  if (!this.replaySession || !this.replayCoarse) return;
@@ -2957,7 +2978,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2957
2978
  if (i.time <= n.fedTime) return;
2958
2979
  let a = e.slice(Hn(e, n.fedTime), t + 1);
2959
2980
  n.fedTime = i.time;
2960
- let o = Math.ceil(a.length / Vn);
2981
+ let o = Math.ceil(a.length / Bn);
2961
2982
  for (let e = 0; e < a.length; e += o) for (let [t, n] of Un(a.slice(e, e + o))) r.setMarkPrice(t, n);
2962
2983
  this.tradingManager.setCurrentPrice(i.close);
2963
2984
  }
@@ -2993,7 +3014,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2993
3014
  };
2994
3015
  }
2995
3016
  endReplaySession() {
2996
- this.replaySession && (this.returnMarkToLive(), this.replaySession = null, this.replayStepsSeries = null, this.replayCoarse = null, this.replayBarUnsub?.(), this.replayBarUnsub = null, this.replayManager.stop());
3017
+ this.replaySession && (this.returnMarkToLive(), this.replaySession = null, this.replayStepsSeries = null, this.replayCoarse = null, this.replayBarUnsub?.(), this.replayBarUnsub = null, this.replayManager.stop(), this.replayOffset = 0, this.revealReplayMarks(null));
2997
3018
  }
2998
3019
  replaySeek(e) {
2999
3020
  this.replaySeeking = !0;
@@ -3026,14 +3047,14 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3026
3047
  });
3027
3048
  }
3028
3049
  restoreIndicators(e, t) {
3029
- let n = Ln(e), r = /* @__PURE__ */ new Map();
3050
+ let n = In(e), r = /* @__PURE__ */ new Map();
3030
3051
  this.unrestoredIndicators = [];
3031
3052
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3032
3053
  if (t) {
3033
3054
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3034
3055
  for (let n of t) {
3035
3056
  let t = e.get(n.instanceId);
3036
- t && Rn(n, t) && o.add(n.instanceId);
3057
+ t && Ln(n, t) && o.add(n.instanceId);
3037
3058
  }
3038
3059
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3039
3060
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3093,7 +3114,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3093
3114
  let o = this.indicatorEngine.getIndicatorConfig(e);
3094
3115
  (t.visible ?? !0) !== (o?.visible ?? !0) && this.setIndicatorVisible(e, t.visible ?? !0);
3095
3116
  let s = t.levels ?? null;
3096
- JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? ee(t.paneStyle) : null);
3117
+ JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? b(t.paneStyle) : null);
3097
3118
  }
3098
3119
  restorePanes(e) {
3099
3120
  for (let [t, n] of e) t.paneSize !== void 0 && this.layoutManager.setPanelSize(n, t.paneSize), (t.paneSize !== void 0 || t.paneCollapsed) && this.layoutManager.setPanelCollapsed(n, !!t.paneCollapsed), t.paneSize !== void 0 && this.layoutManager.setPanelScale(n, {
@@ -3174,7 +3195,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3174
3195
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3175
3196
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3176
3197
  if (JSON.stringify(n) === JSON.stringify(i)) return r;
3177
- let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Nn && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3198
+ let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Mn && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3178
3199
  type: "indicators",
3179
3200
  before: null,
3180
3201
  after: null
@@ -3218,7 +3239,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3218
3239
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3219
3240
  return r ? r + e.slice(t) : e;
3220
3241
  }, r = t(e.channel), i = {
3221
- ...Ct(e),
3242
+ ...Et(e),
3222
3243
  ...e.target ? { target: t(e.target) } : {}
3223
3244
  };
3224
3245
  if (!e.expired) {
@@ -3274,7 +3295,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3274
3295
  e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
3275
3296
  }
3276
3297
  applyPricePrecision(e) {
3277
- this.marketPricePrecision = e, this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? jn), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3298
+ this.marketPricePrecision = e, this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? An), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3278
3299
  }
3279
3300
  getMarket() {
3280
3301
  return this.marketConfig;
@@ -3304,15 +3325,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3304
3325
  this.disposed = !0, 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.container.innerHTML = "";
3305
3326
  }
3306
3327
  createChartRenderer(e) {
3307
- let t = Yt(e, (e) => this.pluginManager.getChartType(e));
3328
+ let t = tn(e, (e) => this.pluginManager.getChartType(e));
3308
3329
  return t instanceof w && t.setPriceText((e) => this.formatPrice(e)), t;
3309
3330
  }
3310
3331
  getDisplayData() {
3311
3332
  if (this.displayDataCache) return this.displayDataCache;
3312
3333
  let e = this.dataManager.getData();
3313
3334
  if (e.length === 0) return e;
3314
- let t = Xt(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3315
- return this.chartRenderer instanceof E && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(qt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3335
+ let t = nn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3336
+ return this.chartRenderer instanceof qe && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(en(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3316
3337
  }
3317
3338
  recalcIndicatorsFrom(e, t) {
3318
3339
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3344,7 +3365,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3344
3365
  this.viewport.setScaleBaseline(t[e]?.close);
3345
3366
  }
3346
3367
  if (n) {
3347
- let e = Bn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3368
+ let e = zn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3348
3369
  if (e) {
3349
3370
  let t = r.priceRange, n = Math.min(t.min, e.min), i = Math.max(t.max, e.max);
3350
3371
  if (n < t.min || i > t.max) {
@@ -3436,7 +3457,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3436
3457
  buildPanelRenderInfos() {
3437
3458
  if (this.panelInfoCache) return this.panelInfoCache;
3438
3459
  let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
3439
- let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...Dn }, o = {
3460
+ let i = e.config.logScale ? this.indicatorEngine.getPaneValueRange(e.config.id, n, r, !0) : null, a = i ?? this.indicatorEngine.getPaneValueRange(e.config.id, n, r) ?? { ...En }, o = {
3440
3461
  x: e.rect.x,
3441
3462
  y: e.rect.y + 20,
3442
3463
  width: e.rect.width,
@@ -3540,7 +3561,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3540
3561
  } : null;
3541
3562
  }
3542
3563
  };
3543
- function Ln(e) {
3564
+ function In(e) {
3544
3565
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3545
3566
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3546
3567
  i.add(e.instanceId);
@@ -3554,26 +3575,26 @@ function Ln(e) {
3554
3575
  for (let t of e) a(t);
3555
3576
  return n;
3556
3577
  }
3557
- function Rn(e, t) {
3578
+ function Ln(e, t) {
3558
3579
  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);
3559
3580
  }
3560
- function zn(e) {
3581
+ function Rn(e) {
3561
3582
  let t = e.tagRadius;
3562
3583
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3563
3584
  }
3564
- var W = new Set([
3585
+ var G = new Set([
3565
3586
  "compareSymbol",
3566
3587
  "spread",
3567
3588
  "correlation",
3568
3589
  "correlationlog"
3569
3590
  ]);
3570
- function Bn(e, t) {
3591
+ function zn(e, t) {
3571
3592
  return e ? t ? {
3572
3593
  min: Math.min(e.min, t.min),
3573
3594
  max: Math.max(e.max, t.max)
3574
3595
  } : e : t;
3575
3596
  }
3576
- function G(e) {
3597
+ function K(e) {
3577
3598
  return {
3578
3599
  id: e.id,
3579
3600
  price: e.price,
@@ -3588,7 +3609,15 @@ function G(e) {
3588
3609
  bars: e.bars
3589
3610
  };
3590
3611
  }
3591
- var Vn = 500;
3612
+ var Bn = 500;
3613
+ function Vn(e, t) {
3614
+ let n = 0, r = e.length;
3615
+ for (; n < r;) {
3616
+ let i = n + r >> 1;
3617
+ e[i].time < t ? n = i + 1 : r = i;
3618
+ }
3619
+ return n;
3620
+ }
3592
3621
  function Hn(e, t) {
3593
3622
  let n = 0, r = e.length;
3594
3623
  for (; n < r;) {
@@ -3660,7 +3689,7 @@ function Xn(e, t) {
3660
3689
  volume: (e.volume ?? 0) + (t.volume ?? 0)
3661
3690
  };
3662
3691
  }
3663
- function K(e, t) {
3692
+ function q(e, t) {
3664
3693
  let n = e[e.length - 1];
3665
3694
  if (!n) return "append";
3666
3695
  let r = h(t.time), i = h(n.time);
@@ -3697,10 +3726,10 @@ function ir(e) {
3697
3726
  if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
3698
3727
  let n = [], r = 0;
3699
3728
  for (let e of t) {
3700
- let t = Array.isArray(e) ? lr(e) : cr(e);
3729
+ let t = Array.isArray(e) ? ur(e) : lr(e);
3701
3730
  t ? n.push(t) : r++;
3702
3731
  }
3703
- return ur(n, t.length, r);
3732
+ return dr(n, t.length, r);
3704
3733
  }
3705
3734
  function ar(e) {
3706
3735
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
@@ -3709,7 +3738,7 @@ function ar(e) {
3709
3738
  rowCount: 0,
3710
3739
  skipped: 0
3711
3740
  };
3712
- let n = or(t[0]), r = q(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? sr(r) : {
3741
+ let n = or(t[0]), r = sr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? cr(r) : {
3713
3742
  time: 0,
3714
3743
  open: 1,
3715
3744
  high: 2,
@@ -3720,7 +3749,7 @@ function ar(e) {
3720
3749
  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");
3721
3750
  let o = [], s = 0;
3722
3751
  for (let e = +!!i; e < t.length; e++) {
3723
- let r = q(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
3752
+ let r = sr(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
3724
3753
  if (i === null || ![
3725
3754
  c,
3726
3755
  l,
@@ -3739,7 +3768,7 @@ function ar(e) {
3739
3768
  volume: Number.isFinite(f) ? f : 0
3740
3769
  });
3741
3770
  }
3742
- return ur(o, t.length - +!!i, s);
3771
+ return dr(o, t.length - +!!i, s);
3743
3772
  }
3744
3773
  function or(e) {
3745
3774
  let t = {
@@ -3753,7 +3782,7 @@ function or(e) {
3753
3782
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
3754
3783
  return n;
3755
3784
  }
3756
- function q(e, t) {
3785
+ function sr(e, t) {
3757
3786
  let n = [], r = "", i = !1;
3758
3787
  for (let a = 0; a < e.length; a++) {
3759
3788
  let o = e[a];
@@ -3761,7 +3790,7 @@ function q(e, t) {
3761
3790
  }
3762
3791
  return n.push(r), n;
3763
3792
  }
3764
- function sr(e) {
3793
+ function cr(e) {
3765
3794
  let t = (t) => e.findIndex((e) => t.includes(e));
3766
3795
  return {
3767
3796
  time: t(Zn),
@@ -3772,7 +3801,7 @@ function sr(e) {
3772
3801
  volume: t(nr)
3773
3802
  };
3774
3803
  }
3775
- function cr(e) {
3804
+ function lr(e) {
3776
3805
  let t = (t) => {
3777
3806
  for (let n of t) {
3778
3807
  if (e[n] !== void 0) return e[n];
@@ -3794,7 +3823,7 @@ function cr(e) {
3794
3823
  volume: Number.isFinite(s) ? s : 0
3795
3824
  };
3796
3825
  }
3797
- function lr(e) {
3826
+ function ur(e) {
3798
3827
  if (e.length < 5) return null;
3799
3828
  let t = Y(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;
3800
3829
  return t === null || ![
@@ -3822,7 +3851,7 @@ function Y(e) {
3822
3851
  let r = Date.parse(t);
3823
3852
  return Number.isFinite(r) ? r : null;
3824
3853
  }
3825
- function ur(e, t, n) {
3854
+ function dr(e, t, n) {
3826
3855
  e.sort((e, t) => e.time - t.time);
3827
3856
  let r = [];
3828
3857
  for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
@@ -3834,7 +3863,7 @@ function ur(e, t, n) {
3834
3863
  }
3835
3864
  //#endregion
3836
3865
  //#region src/io/DragDropImporter.ts
3837
- var dr = class {
3866
+ var fr = class {
3838
3867
  host;
3839
3868
  overlay = null;
3840
3869
  callbacks;
@@ -3911,7 +3940,7 @@ function Z(e) {
3911
3940
  };
3912
3941
  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;
3913
3942
  }
3914
- var fr = (e, t) => t.updatedAt - e.updatedAt;
3943
+ var pr = (e, t) => t.updatedAt - e.updatedAt;
3915
3944
  function Q(e) {
3916
3945
  if (typeof e != "object" || !e) return null;
3917
3946
  let t = e;
@@ -3924,17 +3953,17 @@ function Q(e) {
3924
3953
  kind: typeof t.kind == "string" ? t.kind : void 0
3925
3954
  });
3926
3955
  }
3927
- function pr(e) {
3956
+ function mr(e) {
3928
3957
  let t = Q(e), n = t ? e.content : void 0;
3929
3958
  return t && typeof n == "string" ? {
3930
3959
  ...t,
3931
3960
  content: n
3932
3961
  } : null;
3933
3962
  }
3934
- function mr(e = []) {
3963
+ function hr(e = []) {
3935
3964
  let t = new Map(e.map((e) => [e.id, { ...e }]));
3936
3965
  return {
3937
- list: () => [...t.values()].map(Z).sort(fr),
3966
+ list: () => [...t.values()].map(Z).sort(pr),
3938
3967
  load: (e) => {
3939
3968
  let n = t.get(e);
3940
3969
  return n ? { ...n } : null;
@@ -3947,7 +3976,7 @@ function mr(e = []) {
3947
3976
  }
3948
3977
  };
3949
3978
  }
3950
- function hr(e = "tcw:layouts:") {
3979
+ function gr(e = "tcw:layouts:") {
3951
3980
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
3952
3981
  let e;
3953
3982
  try {
@@ -3958,7 +3987,7 @@ function hr(e = "tcw:layouts:") {
3958
3987
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
3959
3988
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
3960
3989
  return {
3961
- list: () => r().sort(fr),
3990
+ list: () => r().sort(pr),
3962
3991
  load: (e) => {
3963
3992
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
3964
3993
  return t && i !== null ? {
@@ -3976,14 +4005,14 @@ function hr(e = "tcw:layouts:") {
3976
4005
  }
3977
4006
  //#endregion
3978
4007
  //#region src/state/LayoutSession.ts
3979
- var gr = 80;
4008
+ var _r = 80;
3980
4009
  function $(e) {
3981
4010
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
3982
4011
  }
3983
- function _r() {
4012
+ function vr() {
3984
4013
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
3985
4014
  }
3986
- function vr(e) {
4015
+ function yr(e) {
3987
4016
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
3988
4017
  return {
3989
4018
  id: t,
@@ -3994,7 +4023,7 @@ function vr(e) {
3994
4023
  ...o === void 0 ? {} : { kind: o }
3995
4024
  };
3996
4025
  }
3997
- var yr = class {
4026
+ var br = class {
3998
4027
  currentLayout = null;
3999
4028
  savedContent = null;
4000
4029
  dirty = !1;
@@ -4010,7 +4039,7 @@ var yr = class {
4010
4039
  now;
4011
4040
  newId;
4012
4041
  constructor(e, t, n = {}) {
4013
- 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 ?? _r;
4042
+ 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 ?? vr;
4014
4043
  }
4015
4044
  current() {
4016
4045
  return this.currentLayout;
@@ -4040,7 +4069,7 @@ var yr = class {
4040
4069
  }
4041
4070
  open(e) {
4042
4071
  return this.queue(async () => {
4043
- let t = pr(await this.storage.load(e));
4072
+ let t = mr(await this.storage.load(e));
4044
4073
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4045
4074
  this.cancelTimer(), this.applying++;
4046
4075
  try {
@@ -4050,13 +4079,13 @@ var yr = class {
4050
4079
  } finally {
4051
4080
  this.applying--;
4052
4081
  }
4053
- return this.cancelTimer(), this.currentLayout = vr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4082
+ return this.cancelTimer(), this.currentLayout = yr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4054
4083
  });
4055
4084
  }
4056
4085
  rename(e, t) {
4057
4086
  let n = $(t);
4058
4087
  return n ? this.queue(async () => {
4059
- let t = pr(await this.storage.load(e));
4088
+ let t = mr(await this.storage.load(e));
4060
4089
  !t || t.id !== e || (await this.storage.save({
4061
4090
  ...t,
4062
4091
  name: n
@@ -4134,7 +4163,7 @@ var yr = class {
4134
4163
  content: n.content
4135
4164
  };
4136
4165
  await this.storage.save(r);
4137
- let i = vr(r);
4166
+ let i = yr(r);
4138
4167
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4139
4168
  }
4140
4169
  forget() {
@@ -4155,6 +4184,6 @@ var yr = class {
4155
4184
  }
4156
4185
  };
4157
4186
  //#endregion
4158
- export { Ht as C, B as S, H as _, mr as a, tn as b, In as c, Sn as d, xn as f, vn as g, _n as h, hr as i, kn as l, bn as m, gr as n, dr as o, yn as p, $ as r, rr as s, yr as t, Cn as u, ln as v, $t as x, rn as y };
4187
+ export { Yt as C, F as S, H as _, hr as a, on as b, Fn as c, xn as d, W as f, vn as g, _n as h, gr as i, On as l, bn as m, _r as n, fr as o, yn as p, $ as r, rr as s, br as t, Sn as u, ln as v, I as x, L as y };
4159
4188
 
4160
- //# sourceMappingURL=LayoutSession-CiDh-H9-.js.map
4189
+ //# sourceMappingURL=LayoutSession-DdX4GEPK.js.map