@tradecanvas/chart 1.23.0 → 1.25.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 (73) hide show
  1. package/README.md +1 -1
  2. package/dist/Chart.d.ts +19 -0
  3. package/dist/Chart.d.ts.map +1 -1
  4. package/dist/DataManager.d.ts +9 -0
  5. package/dist/DataManager.d.ts.map +1 -1
  6. package/dist/{LayoutSession-B7RJJGZJ.js → LayoutSession-BD1CfXIS.js} +381 -346
  7. package/dist/LayoutSession-BD1CfXIS.js.map +1 -0
  8. package/dist/LayoutSession-DH9V8bYi.cjs +2 -0
  9. package/dist/LayoutSession-DH9V8bYi.cjs.map +1 -0
  10. package/dist/i18n-C040vB8g.cjs +2 -0
  11. package/dist/i18n-C040vB8g.cjs.map +1 -0
  12. package/dist/{i18n-fBzhlejv.js → i18n-FG3D2x5m.js} +3 -1
  13. package/dist/i18n-FG3D2x5m.js.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +56 -56
  18. package/dist/io/parseOHLCV.d.ts.map +1 -1
  19. package/dist/regularHours.d.ts.map +1 -1
  20. package/dist/widget/ChartWidget.d.ts +17 -0
  21. package/dist/widget/ChartWidget.d.ts.map +1 -1
  22. package/dist/widget/WidgetDrawingStyle.d.ts +4 -0
  23. package/dist/widget/WidgetDrawingStyle.d.ts.map +1 -1
  24. package/dist/widget/WidgetSelectionToolbar.d.ts +75 -0
  25. package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -0
  26. package/dist/widget/index.cjs +112 -3
  27. package/dist/widget/index.cjs.map +1 -1
  28. package/dist/widget/index.js +1052 -794
  29. package/dist/widget/index.js.map +1 -1
  30. package/dist/widget/locales/ar.d.ts.map +1 -1
  31. package/dist/widget/locales/cs.d.ts.map +1 -1
  32. package/dist/widget/locales/da.d.ts.map +1 -1
  33. package/dist/widget/locales/de.d.ts.map +1 -1
  34. package/dist/widget/locales/el.d.ts.map +1 -1
  35. package/dist/widget/locales/en.d.ts +1 -0
  36. package/dist/widget/locales/en.d.ts.map +1 -1
  37. package/dist/widget/locales/es.d.ts.map +1 -1
  38. package/dist/widget/locales/et.d.ts.map +1 -1
  39. package/dist/widget/locales/fa.d.ts.map +1 -1
  40. package/dist/widget/locales/fr.d.ts.map +1 -1
  41. package/dist/widget/locales/he.d.ts.map +1 -1
  42. package/dist/widget/locales/hu.d.ts.map +1 -1
  43. package/dist/widget/locales/id.d.ts.map +1 -1
  44. package/dist/widget/locales/index.cjs +1 -1
  45. package/dist/widget/locales/index.cjs.map +1 -1
  46. package/dist/widget/locales/index.js +29 -1
  47. package/dist/widget/locales/index.js.map +1 -1
  48. package/dist/widget/locales/it.d.ts.map +1 -1
  49. package/dist/widget/locales/ja.d.ts.map +1 -1
  50. package/dist/widget/locales/ko.d.ts.map +1 -1
  51. package/dist/widget/locales/ms.d.ts.map +1 -1
  52. package/dist/widget/locales/nb.d.ts.map +1 -1
  53. package/dist/widget/locales/nl.d.ts.map +1 -1
  54. package/dist/widget/locales/pl.d.ts.map +1 -1
  55. package/dist/widget/locales/pt.d.ts.map +1 -1
  56. package/dist/widget/locales/ro.d.ts.map +1 -1
  57. package/dist/widget/locales/ru.d.ts.map +1 -1
  58. package/dist/widget/locales/sk.d.ts.map +1 -1
  59. package/dist/widget/locales/sv.d.ts.map +1 -1
  60. package/dist/widget/locales/th.d.ts.map +1 -1
  61. package/dist/widget/locales/tr.d.ts.map +1 -1
  62. package/dist/widget/locales/vi.d.ts.map +1 -1
  63. package/dist/widget/locales/zh.d.ts.map +1 -1
  64. package/dist/widget/locales/zhHant.d.ts.map +1 -1
  65. package/dist/widget/widgetFeatures.d.ts +1 -1
  66. package/dist/widget/widgetFeatures.d.ts.map +1 -1
  67. package/package.json +3 -3
  68. package/dist/LayoutSession-B7RJJGZJ.js.map +0 -1
  69. package/dist/LayoutSession-b3U60maf.cjs +0 -2
  70. package/dist/LayoutSession-b3U60maf.cjs.map +0 -1
  71. package/dist/i18n-CIHfGH-4.cjs +0 -2
  72. package/dist/i18n-CIHfGH-4.cjs.map +0 -1
  73. package/dist/i18n-fBzhlejv.js.map +0 -1
@@ -1,47 +1,47 @@
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 _, priceStepAt as v, readChartStyleOverrides as ee, readChartTypeOptions as y, readIndicatorPlotStyles as te, readPaneStyle as ne, resolveChartTheme as re, sessionMinute as b, setLocale as ie, stepDecimals as ae, tickBarCount as oe, timeframeToMs as se, volumeColor as ce, zonedDateFormatter as le } from "@tradecanvas/commons";
2
- import { AlertDragHandler as ue, AlertManager as de, Animator as fe, AreaRenderer as pe, AxisDragHandler as me, BarCountdown as he, BarRenderer as ge, BaselineRenderer as _e, CandlestickRenderer as x, ChartLegend as ve, ChartStateManager as S, CompareRenderer as ye, CompareSymbolIndicator as be, CorrelationCoefficientIndicator as xe, CorrelationLogIndicator as Se, CrosshairHandler as Ce, CrosshairTooltip as we, CurrentPriceLine as Te, DEFAULT_SESSION_HOURS as Ee, DataExporter as C, DepthHeatmapRenderer as De, DrawingManager as Oe, DrawingRenderer as ke, EquivolumeRenderer as Ae, EventBus as je, GridRenderer as Me, HLCAreaRenderer as Ne, HiLoRenderer as Pe, HollowCandleRenderer as Fe, IndicatorEngine as Ie, InteractionManager as Le, KagiRenderer as Re, KeyboardHandler as ze, LineRenderer as Be, LineWithMarkersRenderer as Ve, MarketProfileRenderer as He, MeasureOverlay as Ue, PanHandler as We, PaneResizeHandler as Ge, PeriodLevelsRenderer as Ke, PinnedTooltip as qe, PivotMarkersRenderer as Je, PointAndFigureRenderer as Ye, PriceAxis as w, PriceAxisAddButton as Xe, PriceLines as Ze, RenderEngine as Qe, RenkoRenderer as $e, ReplayManager as et, Screenshot as T, SelectionBoxOverlay as tt, SessionBreaks as nt, SessionShading as rt, SignalMarkerManager as it, SpreadIndicator as at, StepLineRenderer as ot, StreamManager as st, SymbolSeriesStore as ct, TimeAxis as lt, TradeZoneManager as ut, TradingManager as dt, TradingRenderer as ft, UndoRedoManager as pt, Viewport as mt, VolumeCandleRenderer as ht, VolumeProfileRenderer as gt, VolumeRenderer as _t, Watermark as vt, ZoomHandler as yt, barTimeStepMs as bt, findDominantSwing as xt, gpuContextsLeft as St, isRegularSession as Ct, loadWebGL as wt, mergeSessionHours as Tt, rangePresetStart as Et, readAlertOptions as Dt, registerBuiltInDrawingTools as Ot, registerBuiltInIndicators as E, servesTimeframe as kt, sourceParam as D, timestampToBarIndex as O, toHeikinAshi as At, toKagi as jt, toLineBreak as Mt, toPointAndFigure as Nt, toRangeBars as Pt, toRenko as Ft, whenGpuContextFree as It, withResampling as Lt, xToBarIndex as Rt, xToTime as k, yToPrice as zt } 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, barTimeUnit as c, chartStyleValue as l, computePriceLimits as u, formatPrice as d, fractionTick as f, indicatorSource as p, isValidTimeZone as m, mergeBar as h, normalizeBarTime as g, parseIndicatorSource as _, priceFormatterFor as v, priceStepAt as ee, readChartStyleOverrides as y, readChartTypeOptions as b, readIndicatorPlotStyles as x, readPaneStyle as S, resolveChartTheme as te, sessionMinute as C, 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 w, 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 T, DepthHeatmapRenderer as Ee, DrawingManager as De, DrawingRenderer as Oe, EquivolumeRenderer as ke, EventBus as Ae, GridRenderer as je, HLCAreaRenderer as Me, HiLoRenderer as E, HollowCandleRenderer as Ne, IndicatorEngine as D, 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 O, PriceAxis as k, PriceAxisAddButton as Ke, PriceLines as qe, RenderEngine as Je, RenkoRenderer as Ye, ReplayManager as Xe, Screenshot as A, 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, priceToY as St, rangePresetStart as Ct, readAlertOptions as wt, registerBuiltInDrawingTools as Tt, registerBuiltInIndicators as j, servesTimeframe as M, sourceParam as N, timeToX as Et, timestampToBarIndex as P, toHeikinAshi as Dt, toKagi as Ot, toLineBreak as kt, toPointAndFigure as At, toRangeBars as jt, toRenko as Mt, whenGpuContextFree as Nt, withResampling as Pt, xToBarIndex as Ft, xToTime as F, yToPrice as It } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
- var Bt = 864e5, Vt = 10;
5
- function Ht(e, t) {
4
+ var Lt = 864e5, Rt = 10;
5
+ function zt(e, t) {
6
6
  let n = e?.timezone;
7
- if (!n || !p(n) || t.length < 2) return null;
7
+ if (!n || !m(n) || t.length < 2) return null;
8
8
  let r = (e?.sessions ?? []).flatMap((e) => {
9
- let t = b(e.start), n = b(e.end);
9
+ let t = C(e.start), n = C(e.end);
10
10
  return t === null || n === null ? [] : [{
11
11
  startMinute: t,
12
12
  endMinute: n
13
13
  }];
14
14
  });
15
15
  if (r.length === 0) return null;
16
- let i = Infinity;
17
- for (let e = Math.max(1, t.length - Vt); e < t.length; e++) {
18
- let n = h(t[e].time) - h(t[e - 1].time);
19
- n > 0 && n < i && (i = n);
16
+ let i = c(t), a = Infinity;
17
+ for (let e = Math.max(1, t.length - Rt); e < t.length; e++) {
18
+ let n = (t[e].time - t[e - 1].time) * i;
19
+ n > 0 && n < a && (a = n);
20
20
  }
21
- if (!(i < Bt)) return null;
22
- let a = {
21
+ if (!(a < Lt)) return null;
22
+ let o = {
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) => Ct(h(e), a);
28
+ return (e) => yt(e * i, o);
29
29
  }
30
30
  //#endregion
31
31
  //#region src/chartA11y.ts
32
- var Ut = {
32
+ var Bt = {
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
- }, A = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Wt = [
39
+ }, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Vt = [
40
40
  "role",
41
41
  "aria-roledescription",
42
42
  "aria-label",
43
43
  "aria-describedby"
44
- ], Gt = 400, Kt = 1e3, qt = class {
44
+ ], Ht = 400, Ut = 1e3, Wt = class {
45
45
  live;
46
46
  help;
47
47
  labels;
@@ -55,20 +55,20 @@ var Ut = {
55
55
  };
56
56
  constructor(e, t, n = {}) {
57
57
  this.container = e, this.source = t, this.labels = {
58
- ...Ut,
58
+ ...Bt,
59
59
  ...n
60
60
  };
61
- for (let t of Wt) this.before.set(t, e.getAttribute(t));
62
- e.setAttribute("role", "application"), this.help = Jt("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 = Jt("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 Vt) this.before.set(t, e.getAttribute(t));
62
+ e.setAttribute("role", "application"), this.help = Gt("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 = Gt("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
- ...Ut,
66
+ ...Bt,
67
67
  ...e
68
68
  }, this.applyLabels();
69
69
  }
70
70
  refresh(e = !1) {
71
- let t = Kt - (Date.now() - this.summaryAt);
71
+ let t = Ut - (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 Ut = {
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
- }, Gt);
83
+ }, Ht);
84
84
  }
85
85
  readBar(e) {
86
86
  let t = this.source.bars();
@@ -93,13 +93,13 @@ var Ut = {
93
93
  let i = t[this.cursor];
94
94
  this.source.showBar(i.time);
95
95
  let a = this.source.formatPrice;
96
- this.say(A(this.labels.bar, {
96
+ this.say(I(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: Yt(i.volume ?? 0)
102
+ volume: Kt(i.volume ?? 0)
103
103
  }));
104
104
  }
105
105
  destroy() {
@@ -118,7 +118,7 @@ var Ut = {
118
118
  this.labels.typeName ? this.labels.typeName(t) : t,
119
119
  this.source.timeframe()
120
120
  ].filter(Boolean).join(", ");
121
- return A(this.labels.summary, {
121
+ return I(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 Ut = {
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 A(this.labels.view, {
131
+ return I(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 Ut = {
140
140
  this.live.textContent = e;
141
141
  }
142
142
  };
143
- function Jt(e, t) {
143
+ function Gt(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 Jt(e, t) {
154
154
  border: "0"
155
155
  }), n;
156
156
  }
157
- function Yt(e) {
157
+ function Kt(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 Xt(e, t, n, r) {
162
+ function qt(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 Xt(e, t, n, r) {
169
169
  }
170
170
  //#endregion
171
171
  //#region src/charts/ChartTypeStrategy.ts
172
- function Zt(e) {
172
+ function Jt(e) {
173
173
  switch (e) {
174
174
  case "candlestick":
175
175
  case "heikinAshi":
176
176
  case "lineBreak":
177
- case "rangeBars": return new x();
178
- case "line": return new Be();
179
- case "area": return new pe();
180
- case "bar": return new ge();
181
- case "hollowCandle": return new Fe();
182
- case "baseline": return new _e();
183
- case "renko": return new $e();
184
- case "kagi": return new Re();
185
- case "pointAndFigure": return new Ye();
186
- case "volumeCandles": return new ht();
187
- case "equivolume": return new Ae();
188
- case "hlcArea": return new Ne();
189
- case "stepLine": return new ot();
190
- case "lineWithMarkers": return new Ve();
191
- case "hiLo": return new Pe();
192
- default: return new x();
177
+ case "rangeBars": return new ge();
178
+ case "line": return new Le();
179
+ case "area": return new de();
180
+ case "bar": return new me();
181
+ case "hollowCandle": return new Ne();
182
+ case "baseline": return new he();
183
+ case "renko": return new Ye();
184
+ case "kagi": return new Fe();
185
+ case "pointAndFigure": return new O();
186
+ case "volumeCandles": return new dt();
187
+ case "equivolume": return new ke();
188
+ case "hlcArea": return new Me();
189
+ case "stepLine": return new nt();
190
+ case "lineWithMarkers": return new Re();
191
+ case "hiLo": return new E();
192
+ default: return new ge();
193
193
  }
194
194
  }
195
- function Qt(e, t, n = {}) {
195
+ function Yt(e, t, n = {}) {
196
196
  if (t.length === 0) return t;
197
197
  switch (e) {
198
- case "heikinAshi": return At(t);
198
+ case "heikinAshi": return Dt(t);
199
199
  case "renko": {
200
200
  let e = n.renko?.boxSize;
201
- return typeof e == "number" ? Ft(t, { brickSize: e }) : Ft(t, {
201
+ return typeof e == "number" ? Mt(t, { brickSize: e }) : Mt(t, {
202
202
  brickSize: 0,
203
203
  useATR: !0,
204
204
  atrPeriod: n.renko?.atrPeriod ?? 14
205
205
  });
206
206
  }
207
- case "lineBreak": return Mt(t, n.lineBreak?.lines ?? 3);
208
- case "kagi": return jt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
- case "pointAndFigure": return Nt(t, M(t, n), n.pointAndFigure?.reversal ?? 3);
207
+ case "lineBreak": return kt(t, n.lineBreak?.lines ?? 3);
208
+ case "kagi": return Ot(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
+ case "pointAndFigure": return At(t, Zt(t, n), n.pointAndFigure?.reversal ?? 3);
210
210
  case "rangeBars": {
211
211
  let e = n.rangeBars?.range;
212
- return Pt(t, { rangeSize: typeof e == "number" ? e : N(t) * .005 });
212
+ return jt(t, { rangeSize: typeof e == "number" ? e : Qt(t) * .005 });
213
213
  }
214
214
  default: return t;
215
215
  }
216
216
  }
217
- function $t(e) {
217
+ function Xt(e) {
218
218
  switch (e) {
219
219
  case "heikinAshi":
220
220
  case "renko":
@@ -225,30 +225,30 @@ function $t(e) {
225
225
  default: return !1;
226
226
  }
227
227
  }
228
- function j(e) {
229
- return e !== "heikinAshi" && $t(e);
228
+ function L(e) {
229
+ return e !== "heikinAshi" && Xt(e);
230
230
  }
231
- function M(e, t = {}) {
231
+ function Zt(e, t = {}) {
232
232
  let n = t.pointAndFigure?.boxSize;
233
- return typeof n == "number" ? n : N(e) * .01;
233
+ return typeof n == "number" ? n : Qt(e) * .01;
234
234
  }
235
- function N(e) {
235
+ function Qt(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 en(e, t) {
240
+ function $t(e, t) {
241
241
  let n = t?.(e);
242
- return n ? n.createRenderer() : Zt(e);
242
+ return n ? n.createRenderer() : Jt(e);
243
243
  }
244
- function tn(e, t, n, r) {
244
+ function en(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) : Qt(e, t, r);
247
+ return i?.transform ? i.transform(t) : Yt(e, t, r);
248
248
  }
249
249
  //#endregion
250
250
  //#region src/state/AutoSaveScheduler.ts
251
- var nn = class {
251
+ var tn = class {
252
252
  timer = null;
253
253
  delayMs = 0;
254
254
  key = null;
@@ -278,15 +278,15 @@ var nn = class {
278
278
  };
279
279
  //#endregion
280
280
  //#region src/DataManager.ts
281
- function P(e) {
281
+ function R(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 F(e) {
286
+ function nn(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 I(e) {
289
+ function z(e) {
290
290
  return {
291
291
  ...e,
292
292
  high: Math.max(e.open, e.high, e.low, e.close),
@@ -294,8 +294,20 @@ function I(e) {
294
294
  volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
295
295
  };
296
296
  }
297
- var L = class {
297
+ var B = class {
298
298
  data = [];
299
+ inSeriesUnit(e) {
300
+ if (this.data.length === 0) return e;
301
+ let t = g(e);
302
+ return c(this.data) === 1 ? t : t / 1e3;
303
+ }
304
+ withSeriesTime(e) {
305
+ let t = this.inSeriesUnit(e.time);
306
+ return t === e.time ? e : {
307
+ ...e,
308
+ time: t
309
+ };
310
+ }
299
311
  getData() {
300
312
  return this.data;
301
313
  }
@@ -303,15 +315,16 @@ var L = class {
303
315
  let t = [];
304
316
  for (let n = 0; n < e.length; n++) {
305
317
  let r = e[n];
306
- P(r) && t.push(F(r) ? r : I(r));
318
+ R(r) && t.push(nn(r) ? r : z(r));
307
319
  }
308
320
  this.data = t;
309
321
  }
310
322
  prependBars(e) {
311
323
  let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
312
324
  for (let r = 0; r < e.length; r++) {
313
- let i = e[r];
314
- !P(i) || i.time >= t || n.push(F(i) ? i : I(i));
325
+ if (!R(e[r])) continue;
326
+ let i = this.withSeriesTime(e[r]);
327
+ i.time >= t || n.push(nn(i) ? i : z(i));
315
328
  }
316
329
  if (n.length === 0) return 0;
317
330
  n.sort((e, t) => e.time - t.time);
@@ -320,11 +333,11 @@ var L = class {
320
333
  return n.length = r, this.data = n.concat(this.data), r;
321
334
  }
322
335
  appendBar(e) {
323
- P(e) && this.data.push(I(e));
336
+ R(e) && this.data.push(z(this.withSeriesTime(e)));
324
337
  }
325
338
  updateLastBar(e) {
326
- if (!P(e)) return;
327
- let t = I(e);
339
+ if (!R(e)) return;
340
+ let t = z(this.withSeriesTime(e));
328
341
  if (this.data.length === 0) {
329
342
  this.data.push(t);
330
343
  return;
@@ -332,7 +345,7 @@ var L = class {
332
345
  this.data[this.data.length - 1] = t;
333
346
  }
334
347
  updateLastBarFromTick(e) {
335
- this.data.length !== 0 && (!isFinite(e.price) || e.price < 0 || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0) || (this.data[this.data.length - 1] = m(this.data[this.data.length - 1], e)));
348
+ this.data.length !== 0 && (!isFinite(e.price) || e.price < 0 || e.volume !== void 0 && (!isFinite(e.volume) || e.volume < 0) || (this.data[this.data.length - 1] = h(this.data[this.data.length - 1], this.withSeriesTime(e))));
336
349
  }
337
350
  getLength() {
338
351
  return this.data.length;
@@ -340,7 +353,7 @@ var L = class {
340
353
  clear() {
341
354
  this.data = [];
342
355
  }
343
- }, R = 5e3, rn = 6e4, an = 500, on = class {
356
+ }, rn = 5e3, an = 6e4, on = 500, sn = class {
344
357
  loader = null;
345
358
  pageSize = 500;
346
359
  loading = !1;
@@ -381,7 +394,7 @@ var L = class {
381
394
  try {
382
395
  r = await e(t, this.pageSize);
383
396
  } catch (e) {
384
- return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(rn, R * 2 ** (this.failures - 1)), this.emit({
397
+ return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(an, rn * 2 ** (this.failures - 1)), this.emit({
385
398
  state: "error",
386
399
  count: 0,
387
400
  error: e instanceof Error ? e.message : String(e)
@@ -411,7 +424,7 @@ var L = class {
411
424
  now() {
412
425
  return this.host.now ? this.host.now() : Date.now();
413
426
  }
414
- }, z = class t {
427
+ }, cn = class t {
415
428
  base;
416
429
  shape = null;
417
430
  chartType = "candlestick";
@@ -428,7 +441,7 @@ var L = class {
428
441
  return i;
429
442
  }
430
443
  getTheme() {
431
- return this.effective ??= re(this.base, this.chartType, this.merged()), this.effective;
444
+ return this.effective ??= te(this.base, this.chartType, this.merged()), this.effective;
432
445
  }
433
446
  getBaseTheme() {
434
447
  return this.base;
@@ -480,7 +493,7 @@ var L = class {
480
493
  return JSON.stringify(e) === JSON.stringify(this.getUserOverrides()) ? !1 : (this.user = new Map(Object.entries(e).map(([e, t]) => [e, { ...t }])), this.effective = null, !0);
481
494
  }
482
495
  getStyleValue(e) {
483
- return c(this.base, this.merged(), e, this.chartType);
496
+ return l(this.base, this.merged(), e, this.chartType);
484
497
  }
485
498
  layer(e) {
486
499
  return e === "host" ? this.host : this.user.get(this.base.name) ?? {};
@@ -497,7 +510,7 @@ var L = class {
497
510
  };
498
511
  //#endregion
499
512
  //#region src/style/styleOptions.ts
500
- function B(e, t) {
513
+ function ln(e, t) {
501
514
  return t ? {
502
515
  ...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
503
516
  ...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
@@ -505,22 +518,22 @@ function B(e, t) {
505
518
  ...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
506
519
  } : {};
507
520
  }
508
- function sn(e) {
521
+ function un(e) {
509
522
  let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
510
523
  return {
511
524
  ...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
512
525
  ...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
513
526
  ...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
514
527
  ...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
515
- ...B("horizontal", n?.hLine),
516
- ...B("vertical", n?.vLine),
528
+ ...ln("horizontal", n?.hLine),
529
+ ...ln("vertical", n?.vLine),
517
530
  ...r === void 0 ? {} : { "crosshair.labelBackground": r },
518
531
  ...e.overrides
519
532
  };
520
533
  }
521
534
  //#endregion
522
535
  //#region src/layout/LayoutManager.ts
523
- var cn = 200, ln = 80, V = (e) => e.position === "top" || e.position === "bottom", un = class {
536
+ var dn = 200, fn = 80, V = (e) => e.position === "top" || e.position === "bottom", pn = class {
524
537
  panels = [];
525
538
  containerWidth = 0;
526
539
  containerHeight = 0;
@@ -536,8 +549,8 @@ var cn = 200, ln = 80, V = (e) => e.position === "top" || e.position === "bottom
536
549
  this.panels.push({
537
550
  id: e,
538
551
  position: n,
539
- size: r ?? (a ? cn : t),
540
- minSize: a ? ln : i,
552
+ size: r ?? (a ? dn : t),
553
+ minSize: a ? fn : i,
541
554
  content: {
542
555
  type: "indicator",
543
556
  indicatorInstanceId: e
@@ -606,7 +619,7 @@ var cn = 200, ln = 80, V = (e) => e.position === "top" || e.position === "bottom
606
619
  let r = this.panels.find((t) => t.id === e);
607
620
  if (r) {
608
621
  let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
609
- r.position = n, a !== o && (r.size = o ? cn : t, r.minSize = o ? ln : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
622
+ r.position = n, a !== o && (r.size = o ? dn : t, r.minSize = o ? fn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
610
623
  }
611
624
  }
612
625
  setPanelSize(e, t) {
@@ -722,24 +735,24 @@ var cn = 200, ln = 80, V = (e) => e.position === "top" || e.position === "bottom
722
735
  getMainChartRect() {
723
736
  return this.resolve().mainChartRect;
724
737
  }
725
- }, dn = 14, fn = 14, pn = 22, mn = 4;
726
- function hn(e) {
727
- let { min: t, max: n, lastPrice: r, locale: i, fontFamily: o, fontSizeSmall: c, measure: l } = e, d = e.tagPrecision ?? s(t, n), f = d, p = r === null ? [t, n] : [
738
+ }, mn = 14, hn = 14, gn = 22, _n = 4;
739
+ function vn(e) {
740
+ let { min: t, max: n, lastPrice: r, locale: i, fontFamily: o, fontSizeSmall: c, measure: l } = e, u = e.tagPrecision ?? s(t, n), f = u, p = r === null ? [t, n] : [
728
741
  t,
729
742
  n,
730
743
  r
731
744
  ], m = a;
732
745
  for (let t of p) {
733
746
  if (!Number.isFinite(t)) continue;
734
- let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : u(t, d, i), r = e.format ? n : u(t, f, i);
735
- m = Math.max(m, l(n, `500 ${c}px ${o}`) + dn, l(r, `bold 11px ${o}`) + fn, l(r, `600 ${c}px ${o}`) + pn);
747
+ let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : d(t, u, i), r = e.format ? n : d(t, f, i);
748
+ m = Math.max(m, l(n, `500 ${c}px ${o}`) + mn, l(r, `bold 11px ${o}`) + hn, l(r, `600 ${c}px ${o}`) + gn);
736
749
  }
737
- return m <= a ? a : Math.ceil(m / mn) * mn;
750
+ return m <= a ? a : Math.ceil(m / _n) * _n;
738
751
  }
739
- function gn(e, t) {
752
+ function yn(e, t) {
740
753
  return t > e || t <= e - 12 ? t : e;
741
754
  }
742
- var _n = class {
755
+ var bn = class {
743
756
  netY = 0;
744
757
  travelX = 0;
745
758
  engaged = !1;
@@ -755,8 +768,8 @@ var _n = class {
755
768
  }
756
769
  return this.engaged;
757
770
  }
758
- }, vn = 1;
759
- function yn(e, t) {
771
+ }, xn = 1;
772
+ function Sn(e, t) {
760
773
  return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
761
774
  }
762
775
  function H(e) {
@@ -770,24 +783,24 @@ function H(e) {
770
783
  //#endregion
771
784
  //#region src/plugins/registry.ts
772
785
  var U = /* @__PURE__ */ new Map();
773
- function bn(e) {
786
+ function Cn(e) {
774
787
  U.set(H(e), e);
775
788
  }
776
- function xn(e) {
789
+ function wn(e) {
777
790
  return U.delete(e);
778
791
  }
779
- function Sn() {
792
+ function Tn() {
780
793
  return [...U.values()];
781
794
  }
782
- function Cn() {
795
+ function En() {
783
796
  U.clear();
784
797
  }
785
798
  //#endregion
786
799
  //#region src/plugins/PluginManager.ts
787
- var W = class {
800
+ var Dn = class {
788
801
  plugins = /* @__PURE__ */ new Map();
789
802
  constructor(e, t = {}) {
790
- if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Sn()) this.add(e);
803
+ if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Tn()) this.add(e);
791
804
  for (let e of t.plugins ?? []) this.add(e);
792
805
  }
793
806
  register(e) {
@@ -817,15 +830,15 @@ var W = class {
817
830
  add(e) {
818
831
  this.plugins.set(H(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
819
832
  }
820
- }, wn = {
833
+ }, On = {
821
834
  orderPlace: (e, t) => e.placeOrder(t),
822
835
  orderModify: (e, t) => e.modifyOrder(t),
823
836
  orderCancel: (e, t) => e.cancelOrder(t),
824
837
  positionModify: (e, t) => e.modifyPosition(t),
825
838
  positionClose: (e, t) => e.closePosition(t),
826
- positionReverse: (e, t, n) => Tn(e, t, n)
839
+ positionReverse: (e, t, n) => kn(e, t, n)
827
840
  };
828
- async function Tn(e, t, n) {
841
+ async function kn(e, t, n) {
829
842
  let { reversing: r } = n;
830
843
  if (!r.has(t.positionId)) {
831
844
  r.add(t.positionId);
@@ -854,7 +867,7 @@ async function Tn(e, t, n) {
854
867
  }
855
868
  }
856
869
  }
857
- function En(e, t) {
870
+ function An(e, t) {
858
871
  let n = [], r = null, i = {
859
872
  positions: () => r ?? t.getPositions?.() ?? [],
860
873
  reversing: /* @__PURE__ */ new Set()
@@ -864,8 +877,8 @@ function En(e, t) {
864
877
  e.data && t.onFill?.(e.data);
865
878
  };
866
879
  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) => {
880
+ for (let r of Object.keys(On)) {
881
+ let a = On[r], o = t.onIntent(r, (n) => {
869
882
  Promise.resolve(a(e, n, i)).catch((e) => t.onError({
870
883
  message: `Execution command failed: ${r}`,
871
884
  cause: e
@@ -879,16 +892,16 @@ function En(e, t) {
879
892
  }
880
893
  //#endregion
881
894
  //#region src/Chart.ts
882
- var Dn = {
895
+ var jn = {
883
896
  min: 0,
884
897
  max: 100
885
- }, On = 0xe8d4a51000, kn = "exchange";
886
- function An(e) {
887
- if (typeof e == "string" && e !== "exchange" && !p(e)) throw RangeError(`Unknown time zone: ${e}`);
898
+ }, Mn = "exchange";
899
+ function Nn(e) {
900
+ if (typeof e == "string" && e !== "exchange" && !m(e)) throw RangeError(`Unknown time zone: ${e}`);
888
901
  if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
889
902
  }
890
- var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
891
- static version = "1.23.0";
903
+ var Pn = 2, Fn = .08, In = 800, Ln = 20, Rn = 8, zn = new Set(["horizontalLine", "crossLine"]), Bn = new Set(["verticalLine", "crossLine"]), Vn = class {
904
+ static version = "1.25.0";
892
905
  engine;
893
906
  viewport;
894
907
  dataManager;
@@ -926,14 +939,14 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
926
939
  indicatorHistoryDepth = 0;
927
940
  removedDrawingAlerts = /* @__PURE__ */ new Map();
928
941
  zoomAreaMode = !1;
929
- priceAxisAddButton = new Xe();
942
+ priceAxisAddButton = new Ke();
930
943
  displayTz = null;
931
944
  timezoneSetting = null;
932
945
  symbolInfo = null;
933
946
  symbolInfoSeq = 0;
934
947
  sessionBreaks;
935
948
  sessionShading;
936
- hostSessionHours = { ...Ee };
949
+ hostSessionHours = { ...Te };
937
950
  compareRenderer;
938
951
  countdownInterval = null;
939
952
  volumeRenderer;
@@ -946,7 +959,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
946
959
  signalMarkerManager;
947
960
  tradeZoneManager;
948
961
  measureOverlay;
949
- selectionBoxOverlay = new tt();
962
+ selectionBoxOverlay = new Ze();
950
963
  replayManager;
951
964
  replayBarUnsub = null;
952
965
  replaySeeking = !1;
@@ -956,7 +969,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
956
969
  replayRevealMarks = !0;
957
970
  replayOffset = 0;
958
971
  undoRedoManager;
959
- autoSaveScheduler = new nn((e) => this.saveState(e));
972
+ autoSaveScheduler = new tn((e) => this.saveState(e));
960
973
  animator;
961
974
  crosshairTooltip;
962
975
  pinnedTooltip;
@@ -968,15 +981,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
968
981
  disposed = !1;
969
982
  chartTypeOptions = {};
970
983
  mainSeriesVisible = !0;
971
- priceLines = new Ze();
972
- symbolSeries = new ct();
984
+ priceLines = new qe();
985
+ symbolSeries = new it();
973
986
  extendedHours = !0;
974
987
  replayRestarting = !1;
975
988
  fullSeries = null;
976
989
  requestedSymbols = /* @__PURE__ */ new Set();
977
990
  gridRenderer;
978
991
  priceAxis;
979
- leftPriceAxis = new w();
992
+ leftPriceAxis = new k();
980
993
  leftScaleRequested = !1;
981
994
  leftAxisWidth = a;
982
995
  leftViewport = null;
@@ -1007,7 +1020,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1007
1020
  snapshotKey = null;
1008
1021
  historyCheckQueued = !1;
1009
1022
  constructor(e, t) {
1010
- t.timeZone != null && An(t.timeZone), this.container = e, this.options = {
1023
+ t.timeZone != null && Nn(t.timeZone), this.container = e, this.options = {
1011
1024
  ...t,
1012
1025
  chartType: t.chartType ?? "candlestick"
1013
1026
  }, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
@@ -1045,15 +1058,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1045
1058
  logScale: n.logScale ?? !0,
1046
1059
  timeframes: n.timeframes ?? [],
1047
1060
  defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
1048
- }, 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 L(), this.history = new on({
1061
+ }, 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 sn({
1049
1062
  oldestTime: () => this.dataManager.getData()[0]?.time ?? null,
1050
1063
  prepend: (e) => this.prependBars(e),
1051
1064
  emit: (e) => this.eventBus.emit("historyLoad", e)
1052
- }), this.themeManager = new z(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(sn(t), "host", !1), this.layoutManager = new un(), this.indicatorEngine = new Ie(), this.pluginManager = new W(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new je(), E(this.indicatorEngine), this.indicatorEngine.register(new be(this.symbolSeries)), this.indicatorEngine.register(new at(this.symbolSeries)), this.indicatorEngine.register(new xe(this.symbolSeries)), this.indicatorEngine.register(new Se(this.symbolSeries)), this.drawingManager = new Oe(), Ot(this.drawingManager), this.drawingRenderer = new ke(this.drawingManager), this.drawingManager.setRequestRender(() => {
1065
+ }), this.themeManager = new cn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(un(t), "host", !1), this.layoutManager = new pn(), this.indicatorEngine = new D(), this.pluginManager = new Dn(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ae(), j(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(), Tt(this.drawingManager), this.drawingRenderer = new Oe(this.drawingManager), this.drawingManager.setRequestRender(() => {
1053
1066
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1054
1067
  }), this.drawingManager.setEventCallback((e, t) => {
1055
1068
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1056
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new pt();
1069
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new lt();
1057
1070
  let i = "";
1058
1071
  this.undoRedoManager.setOnChange(() => {
1059
1072
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1066,42 +1079,43 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1066
1079
  primary: e[0] ?? null
1067
1080
  })), this.drawingManager.setForeignHistory((e, t) => {
1068
1081
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
1069
- }), 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 dt({
1082
+ }), 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({
1070
1083
  enabled: this.features.trading,
1071
1084
  contextMenu: { enabled: this.features.tradingContextMenu }
1072
- }), this.tradingRenderer = new ft(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1085
+ }), this.tradingRenderer = new ct(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1073
1086
  this.eventBus.emit(e, t);
1074
- }), this.engine = new Qe(e);
1087
+ }), this.engine = new Je(e);
1075
1088
  let a = this.engine.dprManager.getContainerSize();
1076
- if (this.viewport = new mt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1089
+ if (this.viewport = new ut(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1077
1090
  freePan: t.freePan ?? !0,
1078
1091
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1079
1092
  }), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1080
1093
  if (e.width <= 0 || e.height <= 0) return;
1081
1094
  let t = this.viewport.isAtEnd();
1082
1095
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
1083
- }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Me(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new w(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new lt(), this.crosshairHandler = new Ce(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setCallback((e, t) => {
1096
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new je(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new k(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new at(), this.crosshairHandler = new Se(), this.crosshairHandler.setLocale(this.numberLocale), this.applyTimeSpacing(), t.crosshair?.mode && this.crosshairHandler.setMode(t.crosshair.mode), this.crosshairHandler.setDataSource(() => this.crosshairSeries()), this.crosshairHandler.setCallback((e, t) => {
1084
1097
  if (e !== null && t) {
1085
- let n = this.dataManager.getData(), r = e < n.length ? n[e] : void 0;
1086
- this.chartLegend.setHoverBar(r ?? null);
1098
+ let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0;
1099
+ this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null);
1087
1100
  let i = this.viewport.getState(), a = t.y >= i.chartRect.y && t.y <= i.chartRect.y + i.chartRect.height;
1088
1101
  r && a && this.features.crosshairTooltip ? this.crosshairTooltip.show(t, r, this.themeManager.getTheme(), this.cachedContainerSize(), {
1089
1102
  prevClose: e > 0 ? n[e - 1]?.close : void 0,
1090
1103
  priceRange: i.priceRange,
1091
1104
  plot: i.chartRect,
1092
- barStepMs: bt(n)
1105
+ barStepMs: gt(n),
1106
+ timeUnit: c(n)
1093
1107
  }) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
1094
1108
  point: t,
1095
1109
  bar: r,
1096
1110
  barIndex: e
1097
1111
  });
1098
1112
  } else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
1099
- }), this.chartLegend = new ve(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new vt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new _t(), this.volumeProfile = new gt(), this.marketProfile = new He(), this.depthHeatmap = new De(), this.periodLevels = new Ke(), this.pivotMarkers = new Je(), this.barCountdown = new he(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new nt(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new rt(), this.compareRenderer = new ye(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1113
+ }), 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({
1100
1114
  visible: t.sessionBreaks.visible ?? !0,
1101
1115
  color: t.sessionBreaks.color,
1102
1116
  lineStyle: t.sessionBreaks.lineStyle,
1103
1117
  lineWidth: t.sessionBreaks.lineWidth
1104
- }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new fe(), this.crosshairTooltip = new we(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new qe(), 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 ze({
1118
+ }) : 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 = b(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Wn(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({
1105
1119
  scrollBars: (e) => {
1106
1120
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1107
1121
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1118,17 +1132,17 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1118
1132
  },
1119
1133
  fitContent: () => this.fitContent()
1120
1134
  }), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
1121
- this.a11y = new qt(e, {
1135
+ this.a11y = new Wt(e, {
1122
1136
  symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
1123
1137
  timeframe: () => this.streamTimeframe ?? "",
1124
1138
  chartType: () => this.options.chartType ?? "candlestick",
1125
1139
  bars: () => this.getDisplayData(),
1126
1140
  visibleRange: () => this.viewport.getState().visibleRange,
1127
1141
  formatPrice: (e) => this.formatPrice(e),
1128
- formatTime: (e) => le(this.numberLocale || "en-US", {
1142
+ formatTime: (e) => se(this.numberLocale || "en-US", {
1129
1143
  dateStyle: "medium",
1130
1144
  timeStyle: "short"
1131
- }, this.displayTz)(e > On ? e : e * 1e3),
1145
+ }, this.displayTz)(e * c(this.getDisplayData())),
1132
1146
  showBar: (e) => this.setCrosshairTime(e)
1133
1147
  }, t.a11y?.labels);
1134
1148
  for (let e of [
@@ -1148,22 +1162,22 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1148
1162
  }
1149
1163
  this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
1150
1164
  }
1151
- }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Te(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new de(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1152
- this.eventBus.emit("alertTriggered", K(e)), this.eventBus.emit("dataUpdate", {
1165
+ }, 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) => {
1166
+ this.eventBus.emit("alertTriggered", G(e)), this.eventBus.emit("dataUpdate", {
1153
1167
  alert: "triggered",
1154
1168
  alertId: e.id,
1155
1169
  price: e.price,
1156
1170
  message: e.message
1157
1171
  });
1158
1172
  }), this.alertManager.on("added", (e) => {
1159
- this.eventBus.emit("alertAdd", K(e));
1173
+ this.eventBus.emit("alertAdd", G(e));
1160
1174
  }), this.alertManager.on("removed", (e) => {
1161
1175
  this.eventBus.emit("alertRemove", { id: e });
1162
1176
  }), this.alertManager.on("expired", (e) => {
1163
- this.eventBus.emit("alertExpired", K(e));
1177
+ this.eventBus.emit("alertExpired", G(e));
1164
1178
  }), this.alertManager.on("updated", (e) => {
1165
- this.eventBus.emit("alertUpdate", K(e));
1166
- }), this.signalMarkerManager = new it(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1179
+ this.eventBus.emit("alertUpdate", G(e));
1180
+ }), this.signalMarkerManager = new et(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1167
1181
  this.eventBus.emit("signalMarkerAdd", {
1168
1182
  id: e.id,
1169
1183
  source: e.source,
@@ -1171,14 +1185,14 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1171
1185
  });
1172
1186
  }), this.signalMarkerManager.on("removed", (e) => {
1173
1187
  this.eventBus.emit("signalMarkerRemove", { id: e });
1174
- }), this.tradeZoneManager = new ut(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1188
+ }), this.tradeZoneManager = new ot(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1175
1189
  this.eventBus.emit("tradeZoneAdd", {
1176
1190
  id: e.id,
1177
1191
  direction: e.direction
1178
1192
  });
1179
1193
  }), this.tradeZoneManager.on("removed", (e) => {
1180
1194
  this.eventBus.emit("tradeZoneRemove", { id: e });
1181
- }), this.replayManager = new et(), this.replayManager.on("complete", () => {
1195
+ }), this.replayManager = new Xe(), this.replayManager.on("complete", () => {
1182
1196
  let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1183
1197
  t && this.eventBus.emit("replayComplete", {
1184
1198
  barIndex: e,
@@ -1186,9 +1200,9 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1186
1200
  });
1187
1201
  }), this.replayManager.on("stateChange", (e) => {
1188
1202
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1189
- }), this.measureOverlay = new Ue(), this.interactionManager = new Le(e), this.features.panning) {
1190
- let e = new _n();
1191
- this.interactionManager.setPanHandler(new We((t, n) => {
1203
+ }), this.measureOverlay = new Be(), this.interactionManager = new Pe(e), this.features.panning) {
1204
+ let e = new bn();
1205
+ this.interactionManager.setPanHandler(new Ve((t, n) => {
1192
1206
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.options.autoScale = !1, this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1193
1207
  }, () => e.reset()));
1194
1208
  }
@@ -1200,10 +1214,10 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1200
1214
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1201
1215
  }
1202
1216
  })), this.features.zooming) {
1203
- this.interactionManager.setZoomHandler(new yt((e, t) => {
1217
+ this.interactionManager.setZoomHandler(new ht((e, t) => {
1204
1218
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1205
1219
  }));
1206
- let e = new me((e) => {
1220
+ let e = new fe((e) => {
1207
1221
  this.options.autoScale = !1, this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
1208
1222
  }, (e) => {
1209
1223
  let t = this.viewport.getState().chartRect.width;
@@ -1223,7 +1237,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1223
1237
  y: t.y
1224
1238
  });
1225
1239
  })), 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) => {
1226
- let t = zt(e.y, this.viewport.getState());
1240
+ let t = It(e.y, this.viewport.getState());
1227
1241
  Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
1228
1242
  price: t,
1229
1243
  x: e.x,
@@ -1233,15 +1247,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1233
1247
  ...this.viewport.getState(),
1234
1248
  data: this.getDisplayData()
1235
1249
  })), this.features.alerts) {
1236
- let e = new ue(this.alertManager, () => this.viewport.getState());
1250
+ let e = new ce(this.alertManager, () => this.viewport.getState());
1237
1251
  this.interactionManager.setAlertDragHandler(e);
1238
1252
  }
1239
- let o = new Ge();
1253
+ let o = new He();
1240
1254
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1241
1255
  let t = this.getDisplayData();
1242
1256
  if (t.length === 0) return;
1243
1257
  let n = this.viewport.getState(), i = n.barWidth + n.barSpacing, a = Math.round((n.offset + e.x) / i);
1244
- a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme()), this.pinnedTooltip.reposition(this.viewport.getState(), this.dataManager.getData()[a] ?? null, a, this.themeManager.getTheme()), this.engine.requestRender(r.Overlay));
1258
+ a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme(), c(t)), this.pinnedTooltip.reposition(this.viewport.getState(), this.dataManager.getData()[a] ?? null, a, this.themeManager.getTheme()), this.engine.requestRender(r.Overlay));
1245
1259
  }), this.interactionManager.setSignalMarkerHitTest((e) => this.eventBus.hasListeners("signalMarkerHover") || this.eventBus.hasListeners("signalMarkerClick") ? this.signalMarkerManager.markerAt(e, this.viewport.getState()) : null, (e, t) => this.eventBus.emit("signalMarkerHover", {
1246
1260
  marker: e,
1247
1261
  x: t.x,
@@ -1260,7 +1274,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1260
1274
  x: e.x,
1261
1275
  y: e.y
1262
1276
  }), t.length === 0) return;
1263
- let r = Rt(e.x, this.viewport.getState());
1277
+ let r = Ft(e.x, this.viewport.getState());
1264
1278
  r < 0 || r >= t.length || this.eventBus.emit("barClick", {
1265
1279
  bar: t[r],
1266
1280
  barIndex: r,
@@ -1300,7 +1314,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1300
1314
  end: () => {
1301
1315
  let e = this.selectionBoxOverlay.end();
1302
1316
  if (e && this.zoomAreaMode) {
1303
- if (e.x1 - e.x0 < Fn) return;
1317
+ if (e.x1 - e.x0 < Rn) return;
1304
1318
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1305
1319
  return;
1306
1320
  }
@@ -1337,7 +1351,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1337
1351
  if (this.replaySession) return 0;
1338
1352
  let t = null;
1339
1353
  if (this.fullSeries) {
1340
- let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => qn(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1354
+ let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => Qn(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1341
1355
  this.fullSeries = [...i, ...this.fullSeries];
1342
1356
  let a = this.sessionKeep(this.fullSeries);
1343
1357
  t = i.length, e = a ? i.filter((e) => a(e.time)) : i;
@@ -1346,7 +1360,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1346
1360
  if (a === 0) return t ?? 0;
1347
1361
  let o = this.dataManager.getData();
1348
1362
  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) {
1349
- let e = Math.round(O(i, this.getDisplayData()));
1363
+ let e = Math.round(P(i, this.getDisplayData()));
1350
1364
  this.viewport.prependBars(e - r);
1351
1365
  }
1352
1366
  return this.updateViewportAndRender(), t ?? a;
@@ -1377,15 +1391,15 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1377
1391
  }
1378
1392
  checkHistory() {
1379
1393
  this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
1380
- if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || j(this.options.chartType)) return;
1394
+ if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || L(this.options.chartType)) return;
1381
1395
  let { from: e, to: t } = this.viewport.getState().visibleRange;
1382
- this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Pn, t - e));
1396
+ this.history.maybeLoad(Math.max(0, Math.floor(e)), Math.max(Ln, t - e));
1383
1397
  }));
1384
1398
  }
1385
1399
  useStreamHistory(e, t) {
1386
1400
  if (this.hostHistoryLoader) return;
1387
- let n = Lt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1388
- if (!r || i === null || oe(i) !== null) {
1401
+ let n = Pt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1402
+ if (!r || i === null || ie(i) !== null) {
1389
1403
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
1390
1404
  return;
1391
1405
  }
@@ -1451,17 +1465,17 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1451
1465
  });
1452
1466
  }
1453
1467
  applyTimeSpacing() {
1454
- let e = !this.tickStream && !j(this.options.chartType);
1468
+ let e = !this.tickStream && !L(this.options.chartType);
1455
1469
  this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
1456
1470
  }
1457
1471
  setChartTypeOptions(e) {
1458
1472
  this.chartTypeOptions = {
1459
1473
  ...this.chartTypeOptions,
1460
- ...y(e)
1474
+ ...b(e)
1461
1475
  }, this.displayDataCache = null, this.updateViewportAndRender(!0), this.markStateChanged();
1462
1476
  }
1463
1477
  getChartTypeOptions() {
1464
- return y(this.chartTypeOptions);
1478
+ return b(this.chartTypeOptions);
1465
1479
  }
1466
1480
  setExtendedHours(e) {
1467
1481
  e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
@@ -1470,7 +1484,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1470
1484
  return this.extendedHours;
1471
1485
  }
1472
1486
  sessionKeep(e) {
1473
- return this.extendedHours ? null : Ht(this.symbolInfo, e);
1487
+ return this.extendedHours ? null : zt(this.symbolInfo, e);
1474
1488
  }
1475
1489
  shownBars(e) {
1476
1490
  let t = this.sessionKeep(e);
@@ -1481,7 +1495,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1481
1495
  return this.fullSeries = t ? e.slice() : null, t ? e.filter((e) => t(e.time)) : e;
1482
1496
  }
1483
1497
  placeStreamBar(e) {
1484
- let t = q(this.dataManager.getData(), e);
1498
+ let t = K(this.dataManager.getData(), e);
1485
1499
  return t === "stale" ? !1 : (t === "append" ? this.dataManager.appendBar(e) : this.dataManager.updateLastBar(e), !0);
1486
1500
  }
1487
1501
  takeBar(e, t) {
@@ -1511,7 +1525,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1511
1525
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
1512
1526
  }
1513
1527
  setShapes(e) {
1514
- let t = zn(e);
1528
+ let t = Wn(e);
1515
1529
  t.tagRadius !== void 0 && (this.themeManager.setShape({
1516
1530
  ...this.themeManager.getTheme().shape,
1517
1531
  ...t
@@ -1556,7 +1570,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1556
1570
  setSymbolSeries(e, t) {
1557
1571
  e = e.trim(), this.symbolSeries.set(e, t), this.requestedSymbols.delete(e);
1558
1572
  let n = this.dataManager.getData(), r = !1;
1559
- 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);
1573
+ 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);
1560
1574
  r && (this.announceIndicatorUpdate(0), this.updateViewportAndRender());
1561
1575
  }
1562
1576
  forgetUnreadSymbols() {
@@ -1570,27 +1584,27 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1570
1584
  let e = /* @__PURE__ */ new Set();
1571
1585
  for (let t of this.indicatorEngine.getActiveIndicators()) {
1572
1586
  let n = t.params.symbol;
1573
- G.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1587
+ W.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1574
1588
  }
1575
1589
  return [...e];
1576
1590
  }
1577
1591
  requestMissingSymbols(e) {
1578
1592
  this.forgetUnreadSymbols();
1579
- let t = this.indicatorEngine.getIndicatorConfig(e), n = t && G.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1593
+ let t = this.indicatorEngine.getIndicatorConfig(e), n = t && W.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1580
1594
  !n || this.symbolSeries.has(n) || this.requestedSymbols.has(n) || (this.requestedSymbols.add(n), this.eventBus.emit("symbolSeriesRequest", { symbol: n }));
1581
1595
  }
1582
1596
  updateIndicator(e, t) {
1583
1597
  this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
1584
1598
  }
1585
1599
  updateIndicatorNow(e, t) {
1586
- let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? D(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1600
+ let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? N(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1587
1601
  this.indicatorEngine.updateIndicator(e, t, this.dataManager.getData()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
1588
1602
  instanceId: e,
1589
1603
  change: "params"
1590
1604
  }), this.requestMissingSymbols(e);
1591
1605
  let a = this.indicatorEngine.getIndicatorConfig(e);
1592
1606
  if (n?.placement === "overlay" && a && r && a.params[r] !== i) {
1593
- let t = g(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : g(i) ? null : a.pane ?? null;
1607
+ let t = _(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : _(i) ? null : a.pane ?? null;
1594
1608
  (n ?? void 0) !== a.pane && (this.indicatorEngine.setPane(e, n), this.eventBus.emit("indicatorChange", {
1595
1609
  instanceId: e,
1596
1610
  change: "pane"
@@ -1601,7 +1615,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1601
1615
  paneFor(e, t, n, r) {
1602
1616
  if (n) return this.paneHostOf(n, r);
1603
1617
  if (e.placement !== "overlay") return null;
1604
- let i = D(e), a = i ? g(t[i]) : null;
1618
+ let i = N(e), a = i ? _(t[i]) : null;
1605
1619
  return a ? this.paneHostOf(a.instanceId, r) : null;
1606
1620
  }
1607
1621
  paneHostOf(e, t) {
@@ -1644,8 +1658,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1644
1658
  return {
1645
1659
  ...e,
1646
1660
  priceRange: {
1647
- min: t.min - n * Mn,
1648
- max: t.max + n * Mn
1661
+ min: t.min - n * Fn,
1662
+ max: t.max + n * Fn
1649
1663
  },
1650
1664
  logScale: !1,
1651
1665
  scaleMode: "regular",
@@ -1692,7 +1706,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1692
1706
  this.indicatorEngine.setStyleDefaults(e, null);
1693
1707
  return;
1694
1708
  }
1695
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : te(n);
1709
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : x(n);
1696
1710
  this.indicatorEngine.setStyleDefaults(e, {
1697
1711
  ...r,
1698
1712
  ...i ? { plots: i } : {}
@@ -1700,7 +1714,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1700
1714
  }
1701
1715
  setPaneStyle(e, t) {
1702
1716
  let n = this.paneOf(e);
1703
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? ne(t) : null));
1717
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? S(t) : null));
1704
1718
  }
1705
1719
  setPaneStyleNow(e, t) {
1706
1720
  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());
@@ -1719,8 +1733,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1719
1733
  return this.pluginManager;
1720
1734
  }
1721
1735
  static indicators() {
1722
- let e = new Ie();
1723
- return E(e), e.getAvailableIndicators();
1736
+ let e = new D();
1737
+ return j(e), e.getAvailableIndicators();
1724
1738
  }
1725
1739
  setPanelPosition(e, t) {
1726
1740
  this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
@@ -1743,8 +1757,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1743
1757
  paneMoveHost(e, t) {
1744
1758
  let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
1745
1759
  if (!n || !r) return;
1746
- let i = D(r);
1747
- if (r.placement === "overlay" && i && g(n.params[i])) return;
1760
+ let i = N(r);
1761
+ if (r.placement === "overlay" && i && _(n.params[i])) return;
1748
1762
  if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
1749
1763
  if (t === "new") {
1750
1764
  let t = this.layoutManager.getPanels().some((t) => t.id === e);
@@ -1850,12 +1864,12 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1850
1864
  return this.features.legend ? e + this.chartLegend.getHeight() : e;
1851
1865
  }
1852
1866
  isTimeAligned() {
1853
- return j(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1867
+ return L(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1854
1868
  }
1855
1869
  roundPrice(e) {
1856
1870
  if (!Number.isFinite(e)) return e;
1857
1871
  let t = this.stepAt(e);
1858
- if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ae(t)));
1872
+ if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(re(t)));
1859
1873
  let { min: n, max: r } = this.viewport.getState().priceRange;
1860
1874
  return Number(e.toFixed(this.marketPricePrecision ?? s(n, r)));
1861
1875
  }
@@ -1865,7 +1879,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1865
1879
  }
1866
1880
  stepAt(e) {
1867
1881
  let t = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
1868
- return t !== void 0 && t > 0 ? t : this.marketConfig ? v(e, this.marketConfig) : void 0;
1882
+ return t !== void 0 && t > 0 ? t : this.marketConfig ? ee(e, this.marketConfig) : void 0;
1869
1883
  }
1870
1884
  getPriceStep(e) {
1871
1885
  let t = this.stepAt(e ?? this.lastClose());
@@ -1880,7 +1894,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1880
1894
  return this.priceFormatter;
1881
1895
  }
1882
1896
  applyPriceFormat(e) {
1883
- this.priceFormatter = _(e), this.priceUnit = e && typeof e != "function" ? d(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
1897
+ this.priceFormatter = v(e), this.priceUnit = e && typeof e != "function" ? f(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
1884
1898
  }
1885
1899
  setTimeFormatter(e) {
1886
1900
  this.applyTimeFormatter(e), this.engine.requestRender();
@@ -1891,7 +1905,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1891
1905
  formatPrice(e) {
1892
1906
  if (this.priceFormatter) return this.priceFormatter(e);
1893
1907
  let { min: t, max: n } = this.viewport.getState().priceRange;
1894
- return u(e, this.marketPricePrecision ?? s(t, n), this.numberLocale);
1908
+ return d(e, this.marketPricePrecision ?? s(t, n), this.numberLocale);
1895
1909
  }
1896
1910
  setDrawingTool(e) {
1897
1911
  this.features.drawings && (e && this.features.drawingTools.length > 0 && !this.features.drawingTools.includes(e) || (e && this.setZoomAreaMode(!1), this.drawingManager.setActiveTool(e)));
@@ -1936,7 +1950,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
1936
1950
  }
1937
1951
  autoFib() {
1938
1952
  if (!this.features.drawings) return null;
1939
- let e = this.getDisplayData(), t = this.viewport.getState(), n = xt(e, t.visibleRange.from, t.visibleRange.to);
1953
+ let e = this.getDisplayData(), t = this.viewport.getState(), n = _t(e, t.visibleRange.from, t.visibleRange.to);
1940
1954
  return n ? this.addDrawing({
1941
1955
  type: "fibRetracement",
1942
1956
  anchors: [n[0], n[1]]
@@ -2011,7 +2025,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2011
2025
  recordUndo(e) {
2012
2026
  if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
2013
2027
  let t = performance.now(), n = this.undoRedoManager.last();
2014
- if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Nn) {
2028
+ if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < In) {
2015
2029
  this.undoRedoManager.replaceLast({
2016
2030
  ...n,
2017
2031
  custom: {
@@ -2058,7 +2072,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2058
2072
  x: t.x,
2059
2073
  y: t.y
2060
2074
  };
2061
- if ((e === "plot" || e === "priceAxis") && (r.price = zt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = k(t.x, n)), e === "pane") {
2075
+ if ((e === "plot" || e === "priceAxis") && (r.price = It(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
2062
2076
  let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
2063
2077
  e && (r.pane = e.instanceId);
2064
2078
  }
@@ -2084,7 +2098,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2084
2098
  ...this.viewport.getState(),
2085
2099
  data: this.getDisplayData()
2086
2100
  };
2087
- this.setVisibleRange(k(e.x0, t), k(e.x1, t));
2101
+ this.setVisibleRange(F(e.x0, t), F(e.x1, t));
2088
2102
  }
2089
2103
  lockAllDrawings() {
2090
2104
  this.drawingManager.lockAllDrawings();
@@ -2129,7 +2143,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2129
2143
  for (let e of this.indicatorEngine.getActiveIndicators()) {
2130
2144
  let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
2131
2145
  if (!t) continue;
2132
- let r = Xt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2146
+ let r = qt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2133
2147
  key: e,
2134
2148
  title: e
2135
2149
  }));
@@ -2153,11 +2167,11 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2153
2167
  }
2154
2168
  getExportText(e = "csv", t = {}) {
2155
2169
  let { bars: n, columns: r } = this.getExportData(t);
2156
- return e === "json" ? C.toJSON(n, r) : C.toCSV(n, r);
2170
+ return e === "json" ? T.toJSON(n, r) : T.toCSV(n, r);
2157
2171
  }
2158
2172
  download(e, t, n) {
2159
2173
  let r = this.getExportText(e, n);
2160
- e === "json" ? C.download(r, t ?? "chart-data.json", "application/json") : C.download(r, t ?? "chart-data.csv", "text/csv");
2174
+ e === "json" ? T.download(r, t ?? "chart-data.json", "application/json") : T.download(r, t ?? "chart-data.csv", "text/csv");
2161
2175
  }
2162
2176
  setAutoSave(e, t = 5e3) {
2163
2177
  this.autoSaveScheduler.enable(e, t);
@@ -2207,7 +2221,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2207
2221
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2208
2222
  }
2209
2223
  updateIndicatorStyleNow(e, t) {
2210
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : te(n);
2224
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : x(n);
2211
2225
  this.indicatorEngine.updateIndicatorStyle(e, {
2212
2226
  ...r,
2213
2227
  ...i ? { plots: i } : {}
@@ -2317,8 +2331,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2317
2331
  this.features.trading && this.tradingManager.setConfig(e);
2318
2332
  }
2319
2333
  async connect(e) {
2320
- if (!kt(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2321
- this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new st(), this.streamManager.on("snapshot", (t) => {
2334
+ if (!M(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2335
+ this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new rt(), this.streamManager.on("snapshot", (t) => {
2322
2336
  let n = `${this.currentSymbol}|${this.streamTimeframe}`;
2323
2337
  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);
2324
2338
  }), this.streamManager.on("barClose", (e) => {
@@ -2326,7 +2340,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2326
2340
  this.replaySession.live.appendBar(e);
2327
2341
  return;
2328
2342
  }
2329
- let t = q(this.fullSeries ?? this.dataManager.getData(), e);
2343
+ let t = K(this.fullSeries ?? this.dataManager.getData(), e);
2330
2344
  if (t === "stale" || !this.takeBar(e, t)) return;
2331
2345
  let n = this.autoScrollOnNewBar && this.viewport.isAtEnd();
2332
2346
  if (!this.placeStreamBar(e)) return;
@@ -2338,7 +2352,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2338
2352
  return;
2339
2353
  }
2340
2354
  this.currentPriceLine.setPrice(e.close);
2341
- let t = q(this.fullSeries ?? this.dataManager.getData(), e);
2355
+ let t = K(this.fullSeries ?? this.dataManager.getData(), e);
2342
2356
  if (t === "stale" || !this.takeBar(e, t) || !this.placeStreamBar(e)) {
2343
2357
  this.scheduleRender();
2344
2358
  return;
@@ -2367,14 +2381,14 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2367
2381
  }), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
2368
2382
  let t = this.streamManager;
2369
2383
  if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
2370
- let n = se(e.timeframe);
2384
+ let n = ae(e.timeframe);
2371
2385
  this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
2372
2386
  this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
2373
2387
  }, 1e3);
2374
2388
  }
2375
2389
  setStreamTarget(e, t) {
2376
2390
  let n = this.announcedSymbol, r = this.announcedTimeframe;
2377
- this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = oe(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2391
+ this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = ie(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2378
2392
  symbol: e,
2379
2393
  previous: n
2380
2394
  })), t !== r && (this.announcedTimeframe = t, this.eventBus.emit("timeframeChange", {
@@ -2385,8 +2399,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2385
2399
  async switchStream(e, t) {
2386
2400
  if (!this.streamManager) return;
2387
2401
  let n = this.streamAdapter;
2388
- if (n && !kt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2389
- this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(se(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
2402
+ if (n && !M(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2403
+ 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);
2390
2404
  }
2391
2405
  isTimeframeAllowed(e) {
2392
2406
  let t = this.features.timeframes;
@@ -2401,7 +2415,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2401
2415
  }
2402
2416
  connectExecution(e, t = {}) {
2403
2417
  if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
2404
- this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = En(e, {
2418
+ this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = An(e, {
2405
2419
  onIntent: (e, t) => {
2406
2420
  let n = (e) => t(e.payload);
2407
2421
  return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
@@ -2492,18 +2506,18 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2492
2506
  goToTime(e) {
2493
2507
  let t = this.getDisplayData();
2494
2508
  if (t.length === 0 || !Number.isFinite(e)) return -1;
2495
- 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;
2509
+ let n = Math.max(0, Math.min(t.length - 1, Math.floor(P(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2496
2510
  return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
2497
2511
  }
2498
2512
  setVisibleRangePreset(e) {
2499
2513
  let t = this.getDisplayData();
2500
2514
  if (t.length === 0) return;
2501
- let n = t.length - 1, r = t[n].time > On ? 1 : 1e3, i = Et(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2515
+ let n = t.length - 1, r = c(t), i = Ct(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2502
2516
  if (a === null || a < t[0].time) {
2503
2517
  this.fitContent();
2504
2518
  return;
2505
2519
  }
2506
- let o = O(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2520
+ let o = P(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2507
2521
  this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
2508
2522
  }
2509
2523
  scrollToEnd() {
@@ -2515,9 +2529,9 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2515
2529
  this.viewport.scrollBy(e * (t + n)), this.updateViewportAndRender();
2516
2530
  }
2517
2531
  setVisibleRange(e, t) {
2518
- let n = this.dataManager.getData();
2532
+ let n = this.getDisplayData();
2519
2533
  if (n.length === 0) return;
2520
- let r = O(Math.min(e, t), n), i = O(Math.max(e, t), n);
2534
+ let r = P(Math.min(e, t), n), i = P(Math.max(e, t), n);
2521
2535
  this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
2522
2536
  }
2523
2537
  setPanLimits(e) {
@@ -2532,7 +2546,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2532
2546
  this.viewport.zoom(-.2, e / 2), this.updateViewportAndRender();
2533
2547
  }
2534
2548
  fitContent() {
2535
- let e = this.dataManager.getLength();
2549
+ let e = this.getDisplayData().length;
2536
2550
  e !== 0 && (this.viewport.zoomToBarRange(0, e - 1 + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender());
2537
2551
  }
2538
2552
  on(e, t) {
@@ -2560,7 +2574,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2560
2574
  this.applyStyle(e, t.layer ?? "host", !0);
2561
2575
  }
2562
2576
  setOverrides(e, t = {}) {
2563
- let n = t.layer ?? "host", { overrides: r, rejected: i } = ee(e);
2577
+ let n = t.layer ?? "host", { overrides: r, rejected: i } = y(e);
2564
2578
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
2565
2579
  let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
2566
2580
  this.themeManager.setOverrides(a, n) && this.styleChanged(n);
@@ -2579,7 +2593,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2579
2593
  return this.themeManager.getStyleValue(e);
2580
2594
  }
2581
2595
  applyStyle(e, t, n) {
2582
- let { overrides: r, rejected: i } = ee(e);
2596
+ let { overrides: r, rejected: i } = y(e);
2583
2597
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
2584
2598
  }
2585
2599
  styleChanged(e) {
@@ -2609,7 +2623,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2609
2623
  e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
2610
2624
  }
2611
2625
  setCrosshairTime(e) {
2612
- let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(O(e, t));
2626
+ let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(P(e, t));
2613
2627
  n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
2614
2628
  }
2615
2629
  getData() {
@@ -2671,7 +2685,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2671
2685
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2672
2686
  }
2673
2687
  setTimezone(e) {
2674
- An(e), this.timezoneSetting = e, this.applyTimezone();
2688
+ Nn(e), this.timezoneSetting = e, this.applyTimezone();
2675
2689
  }
2676
2690
  getTimezone() {
2677
2691
  return this.timezoneSetting;
@@ -2680,7 +2694,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2680
2694
  return this.displayTz;
2681
2695
  }
2682
2696
  applyTimezone() {
2683
- let e = this.symbolInfo?.timezone, t = this.timezoneSetting === "exchange" ? e && p(e) ? e : "UTC" : this.timezoneSetting;
2697
+ let e = this.symbolInfo?.timezone, t = this.timezoneSetting === "exchange" ? e && m(e) ? e : "UTC" : this.timezoneSetting;
2684
2698
  this.displayTz = t, this.timeAxis.setTimezoneOffset(t), this.crosshairHandler.setTimezoneOffset(t), this.crosshairTooltip.setTimezoneOffset(t), this.pinnedTooltip.setTimezone(t), this.sessionBreaks.setTimezone(t), this.engine.requestRender();
2685
2699
  }
2686
2700
  setSymbolInfo(e) {
@@ -2689,13 +2703,13 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2689
2703
  sessions: e.sessions?.map((e) => ({ ...e }))
2690
2704
  } : null, this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
2691
2705
  let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
2692
- let t = b(e.start), n = b(e.end);
2706
+ let t = C(e.start), n = C(e.end);
2693
2707
  return t === null || n === null ? [] : [{
2694
2708
  startMinute: t,
2695
2709
  endMinute: n
2696
2710
  }];
2697
2711
  }), n = this.symbolInfo?.timezone;
2698
- this.sessionShading.replaceConfig(t.length > 0 && n && p(n) ? {
2712
+ this.sessionShading.replaceConfig(t.length > 0 && n && m(n) ? {
2699
2713
  timeZone: n,
2700
2714
  windows: t,
2701
2715
  startMinute: t[0].startMinute,
@@ -2746,7 +2760,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2746
2760
  return this.sessionShading.isVisible();
2747
2761
  }
2748
2762
  setSessionShadingConfig(e) {
2749
- this.hostSessionHours = Tt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2763
+ this.hostSessionHours = xt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2750
2764
  }
2751
2765
  setTooltipVisible(e) {
2752
2766
  e || this.crosshairTooltip.hide();
@@ -2765,11 +2779,11 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2765
2779
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2766
2780
  }
2767
2781
  async takeGpu(e, t, n) {
2768
- let { gpu: r, reason: i } = await wt(e);
2769
- return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? St() > 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());
2782
+ let { gpu: r, reason: i } = await bt(e);
2783
+ 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());
2770
2784
  }
2771
2785
  waitForGpu(e) {
2772
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? It(e) : null;
2786
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Nt(e) : null;
2773
2787
  }
2774
2788
  getRenderer() {
2775
2789
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -2787,23 +2801,23 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2787
2801
  this.engine.getGpu() && this.engine.renderNow();
2788
2802
  }
2789
2803
  screenshot(e) {
2790
- this.features.screenshot && (this.freshFrame(), T.download(this.container, e, this.themeManager.getTheme().background));
2804
+ this.features.screenshot && (this.freshFrame(), A.download(this.container, e, this.themeManager.getTheme().background));
2791
2805
  }
2792
2806
  async copyScreenshot() {
2793
2807
  if (!this.features.screenshot) return !1;
2794
2808
  try {
2795
2809
  this.freshFrame();
2796
- let e = await T.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2810
+ let e = await A.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2797
2811
  return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
2798
2812
  } catch {
2799
2813
  return !1;
2800
2814
  }
2801
2815
  }
2802
2816
  screenshotDataURL() {
2803
- return this.features.screenshot ? (this.freshFrame(), T.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2817
+ return this.features.screenshot ? (this.freshFrame(), A.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2804
2818
  }
2805
2819
  async screenshotBlob() {
2806
- return this.features.screenshot ? (this.freshFrame(), T.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2820
+ return this.features.screenshot ? (this.freshFrame(), A.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2807
2821
  }
2808
2822
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
2809
2823
  if (!this.features.alerts) return null;
@@ -2931,7 +2945,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2931
2945
  let t = this.replaySession ? this.replayOffset : 0;
2932
2946
  if (!this.replaySession) {
2933
2947
  if (this.dataManager.getLength() === 0) return;
2934
- let e = new L();
2948
+ let e = new B();
2935
2949
  e.setData(this.fullSeries ?? this.dataManager.getData()), this.replaySession = {
2936
2950
  live: e,
2937
2951
  price: null,
@@ -2939,23 +2953,23 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
2939
2953
  };
2940
2954
  }
2941
2955
  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;
2942
- r !== void 0 && l === void 0 ? l = Hn(s, r) : c && l !== void 0 && (l += t);
2956
+ r !== void 0 && l === void 0 ? l = qn(s, r) : c && l !== void 0 && (l += t);
2943
2957
  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;
2944
2958
  l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
2945
- let f = n ? Kn(n, d) : null;
2959
+ let f = n ? Zn(n, d) : null;
2946
2960
  this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
2947
2961
  try {
2948
2962
  this.replayManager.load(f ?? d);
2949
2963
  } finally {
2950
2964
  this.replayRestarting = !1;
2951
2965
  }
2952
- f && o.startIndex !== void 0 && (o.startIndex = Yn(f, d, o.startIndex)), this.replayBarUnsub?.();
2966
+ f && o.startIndex !== void 0 && (o.startIndex = er(f, d, o.startIndex)), this.replayBarUnsub?.();
2953
2967
  let p = -1, m = -1, h = null, g = f ?? d;
2954
2968
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
2955
2969
  let t = e, n = d[e];
2956
2970
  if (f) {
2957
2971
  let r = f[e];
2958
- t = Jn(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? Zn(h, r) : Xn(d[t], f, e), n = h;
2972
+ t = $n(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? nr(h, r) : tr(d[t], f, e), n = h;
2959
2973
  }
2960
2974
  m = e;
2961
2975
  let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
@@ -3007,20 +3021,20 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3007
3021
  return;
3008
3022
  }
3009
3023
  if (i.time <= n.fedTime) return;
3010
- let a = e.slice(Un(e, n.fedTime), t + 1);
3024
+ let a = e.slice(Jn(e, n.fedTime), t + 1);
3011
3025
  n.fedTime = i.time;
3012
- let o = Math.ceil(a.length / Vn);
3013
- for (let e = 0; e < a.length; e += o) for (let [t, n] of Wn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3026
+ let o = Math.ceil(a.length / Kn);
3027
+ for (let e = 0; e < a.length; e += o) for (let [t, n] of Yn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3014
3028
  this.tradingManager.setCurrentPrice(i.close);
3015
3029
  }
3016
3030
  getReplayBarIndex() {
3017
3031
  if (!this.replaySession) return -1;
3018
3032
  let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
3019
- return t && this.replayCoarse ? Jn(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3033
+ return t && this.replayCoarse ? $n(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3020
3034
  }
3021
3035
  replaySeekToBar(e) {
3022
3036
  let t = this.replayStepsSeries;
3023
- this.replaySeek(t && this.replayCoarse ? Yn(t, this.replayCoarse, e) : e);
3037
+ this.replaySeek(t && this.replayCoarse ? er(t, this.replayCoarse, e) : e);
3024
3038
  }
3025
3039
  replayPause() {
3026
3040
  this.replayManager.pause();
@@ -3044,6 +3058,24 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3044
3058
  height: r
3045
3059
  };
3046
3060
  }
3061
+ getDrawingRect(e) {
3062
+ let t = this.drawingManager.getDrawings().find((t) => t.id === e);
3063
+ if (!t || !t.visible || t.anchors.length === 0) return null;
3064
+ let n = {
3065
+ ...this.viewport.getState(),
3066
+ data: this.getDisplayData()
3067
+ }, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
3068
+ for (let e of t.anchors) {
3069
+ let t = Et(e.time, n), r = St(e.price, n);
3070
+ i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
3071
+ }
3072
+ return zn.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Bn.has(t.type) && ([o, s] = [r.y, r.y + r.height]), i = Math.max(i, r.x), a = Math.min(a, r.x + r.width), o = Math.max(o, r.y), s = Math.min(s, r.y + r.height), i <= a && o <= s ? {
3073
+ x: i,
3074
+ y: o,
3075
+ width: a - i,
3076
+ height: s - o
3077
+ } : null;
3078
+ }
3047
3079
  endReplaySession() {
3048
3080
  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));
3049
3081
  }
@@ -3065,7 +3097,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3065
3097
  return this.replayManager.getProgress();
3066
3098
  }
3067
3099
  captureSnapshot() {
3068
- return S.capture({
3100
+ return w.capture({
3069
3101
  getDrawings: () => this.getDrawings(),
3070
3102
  getTheme: () => this.themeManager.getBaseTheme(),
3071
3103
  getAlerts: () => this.getAlerts(),
@@ -3078,14 +3110,14 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3078
3110
  });
3079
3111
  }
3080
3112
  restoreIndicators(e, t) {
3081
- let n = Ln(e), r = /* @__PURE__ */ new Map();
3113
+ let n = Hn(e), r = /* @__PURE__ */ new Map();
3082
3114
  this.unrestoredIndicators = [];
3083
3115
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3084
3116
  if (t) {
3085
3117
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3086
3118
  for (let n of t) {
3087
3119
  let t = e.get(n.instanceId);
3088
- t && Rn(n, t) && o.add(n.instanceId);
3120
+ t && Un(n, t) && o.add(n.instanceId);
3089
3121
  }
3090
3122
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3091
3123
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3093,8 +3125,8 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3093
3125
  let s = (e) => {
3094
3126
  let t = { ...e };
3095
3127
  for (let [e, n] of Object.entries(t)) {
3096
- let i = g(n), a = i && r.get(i.instanceId);
3097
- a && (t[e] = f(a, i.key));
3128
+ let i = _(n), a = i && r.get(i.instanceId);
3129
+ a && (t[e] = p(a, i.key));
3098
3130
  }
3099
3131
  return t;
3100
3132
  };
@@ -3145,7 +3177,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3145
3177
  let o = this.indicatorEngine.getIndicatorConfig(e);
3146
3178
  (t.visible ?? !0) !== (o?.visible ?? !0) && this.setIndicatorVisible(e, t.visible ?? !0);
3147
3179
  let s = t.levels ?? null;
3148
- JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? ne(t.paneStyle) : null);
3180
+ JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? S(t.paneStyle) : null);
3149
3181
  }
3150
3182
  restorePanes(e) {
3151
3183
  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, {
@@ -3226,7 +3258,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3226
3258
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3227
3259
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3228
3260
  if (JSON.stringify(n) === JSON.stringify(i)) return r;
3229
- 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 = {
3261
+ let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < In && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3230
3262
  type: "indicators",
3231
3263
  before: null,
3232
3264
  after: null
@@ -3254,12 +3286,12 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3254
3286
  }
3255
3287
  saveState(e) {
3256
3288
  if (!this.features.saveLoad) return null;
3257
- let t = this.captureSnapshot(), n = S.serialize(t);
3258
- return e && S.saveToStorage(e, t), n;
3289
+ let t = this.captureSnapshot(), n = w.serialize(t);
3290
+ return e && w.saveToStorage(e, t), n;
3259
3291
  }
3260
3292
  loadState(e) {
3261
3293
  if (!this.features.saveLoad) return;
3262
- let t = S.deserialize(e);
3294
+ let t = w.deserialize(e);
3263
3295
  this.chartTypeOptions = t.chartTypeOptions ?? {}, this.displayDataCache = null, t.chartType && this.setChartType(t.chartType), t.drawings && this.setDrawings(t.drawings), (t.theme === "dark" || t.theme === "light") && this.setTheme(t.theme), t.version >= 3 && this.themeManager.setUserOverrides(t.overrides ?? {}) && this.styleChanged("user");
3264
3296
  let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
3265
3297
  if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
@@ -3270,7 +3302,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3270
3302
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3271
3303
  return r ? r + e.slice(t) : e;
3272
3304
  }, r = t(e.channel), i = {
3273
- ...Dt(e),
3305
+ ...wt(e),
3274
3306
  ...e.target ? { target: t(e.target) } : {}
3275
3307
  };
3276
3308
  if (!e.expired) {
@@ -3290,19 +3322,19 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3290
3322
  }
3291
3323
  loadStateFromStorage(e) {
3292
3324
  if (!this.features.saveLoad) return !1;
3293
- let t = S.loadFromStorage(e);
3294
- return t ? (this.loadState(S.serialize(t)), !0) : !1;
3325
+ let t = w.loadFromStorage(e);
3326
+ return t ? (this.loadState(w.serialize(t)), !0) : !1;
3295
3327
  }
3296
3328
  downloadState(e) {
3297
- this.features.saveLoad && S.downloadFile(this.captureSnapshot(), e);
3329
+ this.features.saveLoad && w.downloadFile(this.captureSnapshot(), e);
3298
3330
  }
3299
3331
  async loadStateFromFile() {
3300
3332
  if (!this.features.saveLoad) return;
3301
- let e = await S.loadFromFile();
3302
- this.loadState(S.serialize(e));
3333
+ let e = await w.loadFromFile();
3334
+ this.loadState(w.serialize(e));
3303
3335
  }
3304
3336
  setLocale(e) {
3305
- ie(e), this.engine.requestRender();
3337
+ ne(e), this.engine.requestRender();
3306
3338
  }
3307
3339
  setNumberLocale(e) {
3308
3340
  this.numberLocale = e, this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.sessionBreaks.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
@@ -3318,22 +3350,22 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3318
3350
  candleDown: e.colorScheme.down,
3319
3351
  candleUpWick: e.colorScheme.up,
3320
3352
  candleDownWick: e.colorScheme.down,
3321
- volumeUp: ce(e.colorScheme.up),
3322
- volumeDown: ce(e.colorScheme.down)
3353
+ volumeUp: oe(e.colorScheme.up),
3354
+ volumeDown: oe(e.colorScheme.down)
3323
3355
  };
3324
3356
  this.themeManager.setTheme(t);
3325
3357
  }
3326
3358
  e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
3327
3359
  }
3328
3360
  applyPricePrecision(e) {
3329
- this.marketPricePrecision = e, this.priceAxis.setPricePrecision(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);
3361
+ this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? Pn), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3330
3362
  }
3331
3363
  getMarket() {
3332
3364
  return this.marketConfig;
3333
3365
  }
3334
3366
  getPriceLimits() {
3335
3367
  let e = this.marketConfig;
3336
- return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : l(e.priceLimits.referencePrice, e);
3368
+ return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : u(e.priceLimits.referencePrice, e);
3337
3369
  }
3338
3370
  setPriceLimits(e) {
3339
3371
  this.marketConfig?.priceLimits && (this.marketConfig = {
@@ -3363,15 +3395,18 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3363
3395
  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 = "";
3364
3396
  }
3365
3397
  createChartRenderer(e) {
3366
- let t = en(e, (e) => this.pluginManager.getChartType(e));
3367
- return t instanceof Pe && t.setPriceText((e) => this.formatPrice(e)), t;
3398
+ let t = $t(e, (e) => this.pluginManager.getChartType(e));
3399
+ return t instanceof E && t.setPriceText((e) => this.formatPrice(e)), t;
3400
+ }
3401
+ crosshairSeries() {
3402
+ return this.isTimeAligned() ? this.dataManager.getData() : this.getDisplayData();
3368
3403
  }
3369
3404
  getDisplayData() {
3370
3405
  if (this.displayDataCache) return this.displayDataCache;
3371
3406
  let e = this.dataManager.getData();
3372
3407
  if (e.length === 0) return e;
3373
- let t = tn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3374
- return this.chartRenderer instanceof Ye && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(M(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3408
+ let t = en(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3409
+ return this.chartRenderer instanceof O && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(Zt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3375
3410
  }
3376
3411
  recalcIndicatorsFrom(e, t) {
3377
3412
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3406,7 +3441,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3406
3441
  this.viewport.setScaleBaseline(t[e]?.close);
3407
3442
  }
3408
3443
  if (n) {
3409
- 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);
3444
+ let e = Gn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3410
3445
  if (e) {
3411
3446
  let t = r.priceRange, n = Math.min(t.min, e.min), i = Math.max(t.max, e.max);
3412
3447
  if (n < t.min || i > t.max) {
@@ -3430,7 +3465,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3430
3465
  fitLeftAxisWidth() {
3431
3466
  let e = this.leftViewport;
3432
3467
  if (!e) return !1;
3433
- let t = this.themeManager.getTheme(), n = hn({
3468
+ let t = this.themeManager.getTheme(), n = vn({
3434
3469
  min: e.priceRange.min,
3435
3470
  max: e.priceRange.max,
3436
3471
  lastPrice: null,
@@ -3439,12 +3474,12 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3439
3474
  fontFamily: t.font.family,
3440
3475
  fontSizeSmall: t.font.sizeSmall,
3441
3476
  measure: (e, t) => this.measureText(e, t)
3442
- }), r = gn(this.leftAxisWidth, n);
3477
+ }), r = yn(this.leftAxisWidth, n);
3443
3478
  return r === this.leftAxisWidth ? !1 : (this.leftAxisWidth = r, this.layoutManager.setLeftAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
3444
3479
  }
3445
3480
  fitPriceAxisWidth() {
3446
3481
  if (!this.features.priceAxis) return !1;
3447
- let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = hn({
3482
+ let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = vn({
3448
3483
  min: e.min,
3449
3484
  max: e.max,
3450
3485
  lastPrice: this.currentPriceLine.getPrice(),
@@ -3455,7 +3490,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3455
3490
  fontFamily: t.font.family,
3456
3491
  fontSizeSmall: t.font.sizeSmall,
3457
3492
  measure: (e, t) => this.measureText(e, t)
3458
- }), r = gn(this.priceAxisWidth, n);
3493
+ }), r = yn(this.priceAxisWidth, n);
3459
3494
  return r === this.priceAxisWidth ? !1 : (this.priceAxisWidth = r, this.layoutManager.setPriceAxisWidth(r), this.viewport.setPriceAxisWidth(r), this.resolvedLayoutCache = null, this.panelInfoCache = null, this.viewport.setChartRect(this.getResolvedLayout().mainChartRect), !0);
3460
3495
  }
3461
3496
  measureText(e, t) {
@@ -3499,7 +3534,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3499
3534
  buildPanelRenderInfos() {
3500
3535
  if (this.panelInfoCache) return this.panelInfoCache;
3501
3536
  let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
3502
- 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 = {
3537
+ 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) ?? { ...jn }, o = {
3503
3538
  x: e.rect.x,
3504
3539
  y: e.rect.y + 20,
3505
3540
  width: e.rect.width,
@@ -3581,7 +3616,7 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3581
3616
  });
3582
3617
  }
3583
3618
  drawOverlayPlugins(e, t) {
3584
- let n = yn(this.pluginManager.getOverlays(), t);
3619
+ let n = Sn(this.pluginManager.getOverlays(), t);
3585
3620
  if (n.length === 0) return;
3586
3621
  let r = {
3587
3622
  viewport: this.viewport.getState(),
@@ -3602,11 +3637,11 @@ var jn = 2, Mn = .08, Nn = 800, Pn = 20, Fn = 8, In = class {
3602
3637
  };
3603
3638
  }
3604
3639
  };
3605
- function Ln(e) {
3640
+ function Hn(e) {
3606
3641
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3607
3642
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3608
3643
  i.add(e.instanceId);
3609
- let o = [e.pane, ...Object.values(e.params).map((e) => g(e)?.instanceId)];
3644
+ let o = [e.pane, ...Object.values(e.params).map((e) => _(e)?.instanceId)];
3610
3645
  for (let e of o) {
3611
3646
  let n = e ? t.get(e) : void 0;
3612
3647
  n && a(n);
@@ -3616,26 +3651,26 @@ function Ln(e) {
3616
3651
  for (let t of e) a(t);
3617
3652
  return n;
3618
3653
  }
3619
- function Rn(e, t) {
3654
+ function Un(e, t) {
3620
3655
  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);
3621
3656
  }
3622
- function zn(e) {
3657
+ function Wn(e) {
3623
3658
  let t = e.tagRadius;
3624
3659
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3625
3660
  }
3626
- var G = new Set([
3661
+ var W = new Set([
3627
3662
  "compareSymbol",
3628
3663
  "spread",
3629
3664
  "correlation",
3630
3665
  "correlationlog"
3631
3666
  ]);
3632
- function Bn(e, t) {
3667
+ function Gn(e, t) {
3633
3668
  return e ? t ? {
3634
3669
  min: Math.min(e.min, t.min),
3635
3670
  max: Math.max(e.max, t.max)
3636
3671
  } : e : t;
3637
3672
  }
3638
- function K(e) {
3673
+ function G(e) {
3639
3674
  return {
3640
3675
  id: e.id,
3641
3676
  price: e.price,
@@ -3650,8 +3685,8 @@ function K(e) {
3650
3685
  bars: e.bars
3651
3686
  };
3652
3687
  }
3653
- var Vn = 500;
3654
- function Hn(e, t) {
3688
+ var Kn = 500;
3689
+ function qn(e, t) {
3655
3690
  let n = 0, r = e.length;
3656
3691
  for (; n < r;) {
3657
3692
  let i = n + r >> 1;
@@ -3659,7 +3694,7 @@ function Hn(e, t) {
3659
3694
  }
3660
3695
  return n;
3661
3696
  }
3662
- function Un(e, t) {
3697
+ function Jn(e, t) {
3663
3698
  let n = 0, r = e.length;
3664
3699
  for (; n < r;) {
3665
3700
  let i = n + r >> 1;
@@ -3667,20 +3702,20 @@ function Un(e, t) {
3667
3702
  }
3668
3703
  return n;
3669
3704
  }
3670
- function Wn(e) {
3705
+ function Yn(e) {
3671
3706
  let t = 0, n = 0;
3672
3707
  for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
3673
3708
  let r = [e[t].low, e[t].time], i = [e[n].high, e[n].time], a = t === n ? e[t].close >= e[t].open : t < n, o = e[e.length - 1];
3674
3709
  return [...a ? [r, i] : [i, r], [o.close, o.time]];
3675
3710
  }
3676
- function Gn(e) {
3711
+ function Xn(e) {
3677
3712
  let t = 0;
3678
3713
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
3679
3714
  return t > 0 ? t : Infinity;
3680
3715
  }
3681
- function Kn(e, t) {
3716
+ function Zn(e, t) {
3682
3717
  if (t.length === 0) return null;
3683
- let n = t[t.length - 1].time + Gn(t), r = e.filter((e) => qn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3718
+ let n = t[t.length - 1].time + Xn(t), r = e.filter((e) => Qn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3684
3719
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
3685
3720
  if (i.length === 0) return null;
3686
3721
  let a = t.findIndex((e) => e.time >= i[0].time);
@@ -3688,7 +3723,7 @@ function Kn(e, t) {
3688
3723
  let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
3689
3724
  return [...o, ...s];
3690
3725
  }
3691
- function qn(e) {
3726
+ function Qn(e) {
3692
3727
  return [
3693
3728
  e.time,
3694
3729
  e.open,
@@ -3697,7 +3732,7 @@ function qn(e) {
3697
3732
  e.close
3698
3733
  ].every(Number.isFinite);
3699
3734
  }
3700
- function Jn(e, t) {
3735
+ function $n(e, t) {
3701
3736
  let n = 0, r = e.length - 1;
3702
3737
  for (; n < r;) {
3703
3738
  let i = n + r + 1 >> 1;
@@ -3705,22 +3740,22 @@ function Jn(e, t) {
3705
3740
  }
3706
3741
  return n;
3707
3742
  }
3708
- function Yn(e, t, n) {
3743
+ function er(e, t, n) {
3709
3744
  let r = Math.max(0, Math.min(Math.floor(Number.isFinite(n) ? n : 0), t.length - 1)), i = r + 1 < t.length ? t[r + 1].time : Infinity, a = -1;
3710
3745
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
3711
3746
  return Math.max(0, a);
3712
3747
  }
3713
- function Xn(e, t, n) {
3748
+ function tr(e, t, n) {
3714
3749
  let r = n;
3715
3750
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
3716
3751
  let i = {
3717
3752
  ...t[r],
3718
3753
  time: e.time
3719
3754
  };
3720
- for (let e = r + 1; e <= n; e++) i = Zn(i, t[e]);
3755
+ for (let e = r + 1; e <= n; e++) i = nr(i, t[e]);
3721
3756
  return i;
3722
3757
  }
3723
- function Zn(e, t) {
3758
+ function nr(e, t) {
3724
3759
  return {
3725
3760
  time: e.time,
3726
3761
  open: e.open,
@@ -3730,34 +3765,34 @@ function Zn(e, t) {
3730
3765
  volume: (e.volume ?? 0) + (t.volume ?? 0)
3731
3766
  };
3732
3767
  }
3733
- function q(e, t) {
3768
+ function K(e, t) {
3734
3769
  let n = e[e.length - 1];
3735
3770
  if (!n) return "append";
3736
- let r = h(t.time), i = h(n.time);
3771
+ let r = g(t.time), i = g(n.time);
3737
3772
  return r > i ? "append" : r === i ? "update" : "stale";
3738
3773
  }
3739
3774
  //#endregion
3740
3775
  //#region src/io/parseOHLCV.ts
3741
- var Qn = [
3776
+ var rr = [
3742
3777
  "time",
3743
3778
  "timestamp",
3744
3779
  "date",
3745
3780
  "datetime",
3746
3781
  "t"
3747
- ], $n = ["open", "o"], er = ["high", "h"], tr = ["low", "l"], nr = ["close", "c"], rr = [
3782
+ ], ir = ["open", "o"], ar = ["high", "h"], or = ["low", "l"], sr = ["close", "c"], cr = [
3748
3783
  "volume",
3749
3784
  "vol",
3750
3785
  "v"
3751
3786
  ];
3752
- function ir(e) {
3787
+ function lr(e) {
3753
3788
  let t = e.trim();
3754
- return t ? t[0] === "[" || t[0] === "{" ? ar(t) : or(t) : {
3789
+ return t ? t[0] === "[" || t[0] === "{" ? ur(t) : dr(t) : {
3755
3790
  data: [],
3756
3791
  rowCount: 0,
3757
3792
  skipped: 0
3758
3793
  };
3759
3794
  }
3760
- function ar(e) {
3795
+ function ur(e) {
3761
3796
  let t;
3762
3797
  try {
3763
3798
  t = JSON.parse(e);
@@ -3767,19 +3802,19 @@ function ar(e) {
3767
3802
  if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
3768
3803
  let n = [], r = 0;
3769
3804
  for (let e of t) {
3770
- let t = Array.isArray(e) ? dr(e) : ur(e);
3805
+ let t = Array.isArray(e) ? gr(e) : hr(e);
3771
3806
  t ? n.push(t) : r++;
3772
3807
  }
3773
- return fr(n, t.length, r);
3808
+ return _r(n, t.length, r);
3774
3809
  }
3775
- function or(e) {
3810
+ function dr(e) {
3776
3811
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
3777
3812
  if (t.length === 0) return {
3778
3813
  data: [],
3779
3814
  rowCount: 0,
3780
3815
  skipped: 0
3781
3816
  };
3782
- let n = sr(t[0]), r = cr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? lr(r) : {
3817
+ let n = fr(t[0]), r = pr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? mr(r) : {
3783
3818
  time: 0,
3784
3819
  open: 1,
3785
3820
  high: 2,
@@ -3790,7 +3825,7 @@ function or(e) {
3790
3825
  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");
3791
3826
  let o = [], s = 0;
3792
3827
  for (let e = +!!i; e < t.length; e++) {
3793
- let r = cr(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;
3828
+ let r = pr(t[e], n), i = J(r[a.time]), c = q(r[a.open]), l = q(r[a.high]), u = q(r[a.low]), d = q(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
3794
3829
  if (i === null || ![
3795
3830
  c,
3796
3831
  l,
@@ -3809,9 +3844,9 @@ function or(e) {
3809
3844
  volume: Number.isFinite(f) ? f : 0
3810
3845
  });
3811
3846
  }
3812
- return fr(o, t.length - +!!i, s);
3847
+ return _r(o, t.length - +!!i, s);
3813
3848
  }
3814
- function sr(e) {
3849
+ function fr(e) {
3815
3850
  let t = {
3816
3851
  ",": 0,
3817
3852
  ";": 0,
@@ -3823,7 +3858,7 @@ function sr(e) {
3823
3858
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
3824
3859
  return n;
3825
3860
  }
3826
- function cr(e, t) {
3861
+ function pr(e, t) {
3827
3862
  let n = [], r = "", i = !1;
3828
3863
  for (let a = 0; a < e.length; a++) {
3829
3864
  let o = e[a];
@@ -3831,25 +3866,25 @@ function cr(e, t) {
3831
3866
  }
3832
3867
  return n.push(r), n;
3833
3868
  }
3834
- function lr(e) {
3869
+ function mr(e) {
3835
3870
  let t = (t) => e.findIndex((e) => t.includes(e));
3836
3871
  return {
3837
- time: t(Qn),
3838
- open: t($n),
3839
- high: t(er),
3840
- low: t(tr),
3841
- close: t(nr),
3842
- volume: t(rr)
3872
+ time: t(rr),
3873
+ open: t(ir),
3874
+ high: t(ar),
3875
+ low: t(or),
3876
+ close: t(sr),
3877
+ volume: t(cr)
3843
3878
  };
3844
3879
  }
3845
- function ur(e) {
3880
+ function hr(e) {
3846
3881
  let t = (t) => {
3847
3882
  for (let n of t) {
3848
3883
  if (e[n] !== void 0) return e[n];
3849
3884
  let t = n.toUpperCase();
3850
3885
  if (e[t] !== void 0) return e[t];
3851
3886
  }
3852
- }, n = Y(String(t(Qn) ?? "")), r = Number(t($n)), i = Number(t(er)), a = Number(t(tr)), o = Number(t(nr)), s = Number(t(rr) ?? 0);
3887
+ }, n = J(String(t(rr) ?? "")), r = Number(t(ir)), i = Number(t(ar)), a = Number(t(or)), o = Number(t(sr)), s = Number(t(cr) ?? 0);
3853
3888
  return n === null || ![
3854
3889
  r,
3855
3890
  i,
@@ -3864,9 +3899,9 @@ function ur(e) {
3864
3899
  volume: Number.isFinite(s) ? s : 0
3865
3900
  };
3866
3901
  }
3867
- function dr(e) {
3902
+ function gr(e) {
3868
3903
  if (e.length < 5) return null;
3869
- 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;
3904
+ let t = J(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;
3870
3905
  return t === null || ![
3871
3906
  n,
3872
3907
  r,
@@ -3881,18 +3916,18 @@ function dr(e) {
3881
3916
  volume: Number.isFinite(o) ? o : 0
3882
3917
  };
3883
3918
  }
3884
- function J(e) {
3919
+ function q(e) {
3885
3920
  return e === void 0 || e.trim() === "" ? NaN : Number(e);
3886
3921
  }
3887
- function Y(e) {
3922
+ function J(e) {
3888
3923
  let t = e.trim();
3889
3924
  if (!t) return null;
3890
3925
  let n = Number(t);
3891
- if (Number.isFinite(n) && n > 0) return n < 0xe8d4a51000 ? n * 1e3 : n;
3926
+ if (Number.isFinite(n) && n > 0) return g(n);
3892
3927
  let r = Date.parse(t);
3893
3928
  return Number.isFinite(r) ? r : null;
3894
3929
  }
3895
- function fr(e, t, n) {
3930
+ function _r(e, t, n) {
3896
3931
  e.sort((e, t) => e.time - t.time);
3897
3932
  let r = [];
3898
3933
  for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
@@ -3904,7 +3939,7 @@ function fr(e, t, n) {
3904
3939
  }
3905
3940
  //#endregion
3906
3941
  //#region src/io/DragDropImporter.ts
3907
- var pr = class {
3942
+ var vr = class {
3908
3943
  host;
3909
3944
  overlay = null;
3910
3945
  callbacks;
@@ -3925,19 +3960,19 @@ var pr = class {
3925
3960
  this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
3926
3961
  }
3927
3962
  onDragEnter(e) {
3928
- X(e) && (e.preventDefault(), this.depth++, this.showOverlay());
3963
+ Y(e) && (e.preventDefault(), this.depth++, this.showOverlay());
3929
3964
  }
3930
3965
  onDragOver(e) {
3931
- X(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
3966
+ Y(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
3932
3967
  }
3933
3968
  onDragLeave(e) {
3934
- X(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
3969
+ Y(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
3935
3970
  }
3936
3971
  async onDrop(e) {
3937
3972
  e.preventDefault(), this.depth = 0, this.hideOverlay();
3938
3973
  let t = e.dataTransfer?.files?.[0];
3939
3974
  if (t) try {
3940
- let e = ir(await t.text());
3975
+ let e = lr(await t.text());
3941
3976
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
3942
3977
  this.callbacks.onData(e.data, e, t);
3943
3978
  } catch (e) {
@@ -3968,12 +4003,12 @@ var pr = class {
3968
4003
  this.overlay?.remove(), this.overlay = null;
3969
4004
  }
3970
4005
  };
3971
- function X(e) {
4006
+ function Y(e) {
3972
4007
  return e.dataTransfer?.types?.includes("Files") ?? !1;
3973
4008
  }
3974
4009
  //#endregion
3975
4010
  //#region src/state/layoutStorage.ts
3976
- function Z(e) {
4011
+ function X(e) {
3977
4012
  let t = {
3978
4013
  id: e.id,
3979
4014
  name: e.name,
@@ -3981,11 +4016,11 @@ function Z(e) {
3981
4016
  };
3982
4017
  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;
3983
4018
  }
3984
- var mr = (e, t) => t.updatedAt - e.updatedAt;
4019
+ var Z = (e, t) => t.updatedAt - e.updatedAt;
3985
4020
  function Q(e) {
3986
4021
  if (typeof e != "object" || !e) return null;
3987
4022
  let t = e;
3988
- return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Z({
4023
+ return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : X({
3989
4024
  id: t.id,
3990
4025
  name: t.name,
3991
4026
  updatedAt: t.updatedAt,
@@ -3994,17 +4029,17 @@ function Q(e) {
3994
4029
  kind: typeof t.kind == "string" ? t.kind : void 0
3995
4030
  });
3996
4031
  }
3997
- function hr(e) {
4032
+ function yr(e) {
3998
4033
  let t = Q(e), n = t ? e.content : void 0;
3999
4034
  return t && typeof n == "string" ? {
4000
4035
  ...t,
4001
4036
  content: n
4002
4037
  } : null;
4003
4038
  }
4004
- function gr(e = []) {
4039
+ function br(e = []) {
4005
4040
  let t = new Map(e.map((e) => [e.id, { ...e }]));
4006
4041
  return {
4007
- list: () => [...t.values()].map(Z).sort(mr),
4042
+ list: () => [...t.values()].map(X).sort(Z),
4008
4043
  load: (e) => {
4009
4044
  let n = t.get(e);
4010
4045
  return n ? { ...n } : null;
@@ -4017,7 +4052,7 @@ function gr(e = []) {
4017
4052
  }
4018
4053
  };
4019
4054
  }
4020
- function _r(e = "tcw:layouts:") {
4055
+ function xr(e = "tcw:layouts:") {
4021
4056
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
4022
4057
  let e;
4023
4058
  try {
@@ -4028,7 +4063,7 @@ function _r(e = "tcw:layouts:") {
4028
4063
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
4029
4064
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
4030
4065
  return {
4031
- list: () => r().sort(mr),
4066
+ list: () => r().sort(Z),
4032
4067
  load: (e) => {
4033
4068
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
4034
4069
  return t && i !== null ? {
@@ -4037,7 +4072,7 @@ function _r(e = "tcw:layouts:") {
4037
4072
  } : null;
4038
4073
  },
4039
4074
  save: (e) => {
4040
- localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Z(e)]);
4075
+ localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), X(e)]);
4041
4076
  },
4042
4077
  remove: (e) => {
4043
4078
  i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
@@ -4046,14 +4081,14 @@ function _r(e = "tcw:layouts:") {
4046
4081
  }
4047
4082
  //#endregion
4048
4083
  //#region src/state/LayoutSession.ts
4049
- var vr = 80;
4084
+ var Sr = 80;
4050
4085
  function $(e) {
4051
4086
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
4052
4087
  }
4053
- function yr() {
4088
+ function Cr() {
4054
4089
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4055
4090
  }
4056
- function br(e) {
4091
+ function wr(e) {
4057
4092
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
4058
4093
  return {
4059
4094
  id: t,
@@ -4064,7 +4099,7 @@ function br(e) {
4064
4099
  ...o === void 0 ? {} : { kind: o }
4065
4100
  };
4066
4101
  }
4067
- var xr = class {
4102
+ var Tr = class {
4068
4103
  currentLayout = null;
4069
4104
  savedContent = null;
4070
4105
  dirty = !1;
@@ -4080,7 +4115,7 @@ var xr = class {
4080
4115
  now;
4081
4116
  newId;
4082
4117
  constructor(e, t, n = {}) {
4083
- 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 ?? yr;
4118
+ 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 ?? Cr;
4084
4119
  }
4085
4120
  current() {
4086
4121
  return this.currentLayout;
@@ -4110,7 +4145,7 @@ var xr = class {
4110
4145
  }
4111
4146
  open(e) {
4112
4147
  return this.queue(async () => {
4113
- let t = hr(await this.storage.load(e));
4148
+ let t = yr(await this.storage.load(e));
4114
4149
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4115
4150
  this.cancelTimer(), this.applying++;
4116
4151
  try {
@@ -4120,13 +4155,13 @@ var xr = class {
4120
4155
  } finally {
4121
4156
  this.applying--;
4122
4157
  }
4123
- return this.cancelTimer(), this.currentLayout = br(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4158
+ return this.cancelTimer(), this.currentLayout = wr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4124
4159
  });
4125
4160
  }
4126
4161
  rename(e, t) {
4127
4162
  let n = $(t);
4128
4163
  return n ? this.queue(async () => {
4129
- let t = hr(await this.storage.load(e));
4164
+ let t = yr(await this.storage.load(e));
4130
4165
  !t || t.id !== e || (await this.storage.save({
4131
4166
  ...t,
4132
4167
  name: n
@@ -4204,7 +4239,7 @@ var xr = class {
4204
4239
  content: n.content
4205
4240
  };
4206
4241
  await this.storage.save(r);
4207
- let i = br(r);
4242
+ let i = wr(r);
4208
4243
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4209
4244
  }
4210
4245
  forget() {
@@ -4225,6 +4260,6 @@ var xr = class {
4225
4260
  }
4226
4261
  };
4227
4262
  //#endregion
4228
- export { Xt as C, L as S, H as _, gr as a, an as b, In as c, Cn as d, Sn as f, yn as g, vn as h, _r as i, kn as l, xn as m, vr as n, pr as o, bn as p, $ as r, ir as s, xr as t, W as u, un as v, R as x, z as y };
4263
+ export { qt as C, B as S, H as _, br as a, on as b, Vn as c, En as d, Tn as f, Sn as g, xn as h, xr as i, Mn as l, wn as m, Sr as n, vr as o, Cn as p, $ as r, lr as s, Tr as t, Dn as u, pn as v, rn as x, cn as y };
4229
4264
 
4230
- //# sourceMappingURL=LayoutSession-B7RJJGZJ.js.map
4265
+ //# sourceMappingURL=LayoutSession-BD1CfXIS.js.map