@tradecanvas/chart 1.32.0 → 1.35.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 (106) hide show
  1. package/README.md +4 -4
  2. package/dist/Chart.d.ts +39 -1
  3. package/dist/Chart.d.ts.map +1 -1
  4. package/dist/{LayoutSession-B8vZsDaL.js → LayoutSession-CbqemKK4.js} +383 -336
  5. package/dist/LayoutSession-CbqemKK4.js.map +1 -0
  6. package/dist/LayoutSession-YDUD_7LQ.cjs +2 -0
  7. package/dist/LayoutSession-YDUD_7LQ.cjs.map +1 -0
  8. package/dist/{i18n-BPt_Qbx8.js → i18n-BbTfjEM4.js} +83 -9
  9. package/dist/i18n-BbTfjEM4.js.map +1 -0
  10. package/dist/i18n-yiJSpIn5.cjs +2 -0
  11. package/dist/i18n-yiJSpIn5.cjs.map +1 -0
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +53 -53
  16. package/dist/widget/ChartWidget.d.ts +35 -8
  17. package/dist/widget/ChartWidget.d.ts.map +1 -1
  18. package/dist/widget/WidgetChartNav.d.ts +9 -2
  19. package/dist/widget/WidgetChartNav.d.ts.map +1 -1
  20. package/dist/widget/WidgetDepthLadder.d.ts +2 -0
  21. package/dist/widget/WidgetDepthLadder.d.ts.map +1 -1
  22. package/dist/widget/WidgetDrawingSidebar.d.ts +9 -0
  23. package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
  24. package/dist/widget/WidgetIndicatorLegend.d.ts +4 -0
  25. package/dist/widget/WidgetIndicatorLegend.d.ts.map +1 -1
  26. package/dist/widget/WidgetIndicatorPicker.d.ts +96 -0
  27. package/dist/widget/WidgetIndicatorPicker.d.ts.map +1 -0
  28. package/dist/widget/WidgetIndicatorSettings.d.ts +51 -23
  29. package/dist/widget/WidgetIndicatorSettings.d.ts.map +1 -1
  30. package/dist/widget/WidgetSelectionToolbar.d.ts +6 -1
  31. package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -1
  32. package/dist/widget/WidgetStatusBar.d.ts +63 -4
  33. package/dist/widget/WidgetStatusBar.d.ts.map +1 -1
  34. package/dist/widget/WidgetStyles.d.ts.map +1 -1
  35. package/dist/widget/WidgetToolbar.d.ts +9 -11
  36. package/dist/widget/WidgetToolbar.d.ts.map +1 -1
  37. package/dist/widget/WidgetTradeMenu.d.ts +29 -0
  38. package/dist/widget/WidgetTradeMenu.d.ts.map +1 -0
  39. package/dist/widget/drawingHotkeys.d.ts +6 -0
  40. package/dist/widget/drawingHotkeys.d.ts.map +1 -0
  41. package/dist/widget/focusTrap.d.ts +5 -2
  42. package/dist/widget/focusTrap.d.ts.map +1 -1
  43. package/dist/widget/index.cjs +859 -235
  44. package/dist/widget/index.cjs.map +1 -1
  45. package/dist/widget/index.js +2196 -1969
  46. package/dist/widget/index.js.map +1 -1
  47. package/dist/widget/indicatorDefaults.d.ts +18 -0
  48. package/dist/widget/indicatorDefaults.d.ts.map +1 -0
  49. package/dist/widget/indicatorSearch.d.ts +13 -0
  50. package/dist/widget/indicatorSearch.d.ts.map +1 -0
  51. package/dist/widget/indicatorSettingsTabs.d.ts +32 -0
  52. package/dist/widget/indicatorSettingsTabs.d.ts.map +1 -0
  53. package/dist/widget/locales/ar.d.ts.map +1 -1
  54. package/dist/widget/locales/cs.d.ts.map +1 -1
  55. package/dist/widget/locales/da.d.ts.map +1 -1
  56. package/dist/widget/locales/de.d.ts.map +1 -1
  57. package/dist/widget/locales/el.d.ts.map +1 -1
  58. package/dist/widget/locales/en.d.ts +39 -2
  59. package/dist/widget/locales/en.d.ts.map +1 -1
  60. package/dist/widget/locales/es.d.ts.map +1 -1
  61. package/dist/widget/locales/et.d.ts.map +1 -1
  62. package/dist/widget/locales/fa.d.ts.map +1 -1
  63. package/dist/widget/locales/fr.d.ts.map +1 -1
  64. package/dist/widget/locales/he.d.ts.map +1 -1
  65. package/dist/widget/locales/hu.d.ts.map +1 -1
  66. package/dist/widget/locales/id.d.ts.map +1 -1
  67. package/dist/widget/locales/index.cjs +1 -1
  68. package/dist/widget/locales/index.cjs.map +1 -1
  69. package/dist/widget/locales/index.js +1093 -57
  70. package/dist/widget/locales/index.js.map +1 -1
  71. package/dist/widget/locales/it.d.ts.map +1 -1
  72. package/dist/widget/locales/ja.d.ts.map +1 -1
  73. package/dist/widget/locales/ko.d.ts.map +1 -1
  74. package/dist/widget/locales/ms.d.ts.map +1 -1
  75. package/dist/widget/locales/nb.d.ts.map +1 -1
  76. package/dist/widget/locales/nl.d.ts.map +1 -1
  77. package/dist/widget/locales/pl.d.ts.map +1 -1
  78. package/dist/widget/locales/pt.d.ts.map +1 -1
  79. package/dist/widget/locales/ro.d.ts.map +1 -1
  80. package/dist/widget/locales/ru.d.ts.map +1 -1
  81. package/dist/widget/locales/sk.d.ts.map +1 -1
  82. package/dist/widget/locales/sv.d.ts.map +1 -1
  83. package/dist/widget/locales/th.d.ts.map +1 -1
  84. package/dist/widget/locales/tr.d.ts.map +1 -1
  85. package/dist/widget/locales/vi.d.ts.map +1 -1
  86. package/dist/widget/locales/zh.d.ts.map +1 -1
  87. package/dist/widget/locales/zhHant.d.ts.map +1 -1
  88. package/dist/widget/symbolInfoView.d.ts +59 -0
  89. package/dist/widget/symbolInfoView.d.ts.map +1 -0
  90. package/dist/widget/types.d.ts +19 -17
  91. package/dist/widget/types.d.ts.map +1 -1
  92. package/dist/widget/widgetConfig.d.ts +1 -3
  93. package/dist/widget/widgetConfig.d.ts.map +1 -1
  94. package/dist/widget/widgetFeatures.d.ts +1 -1
  95. package/dist/widget/widgetFeatures.d.ts.map +1 -1
  96. package/dist/widget/widgetTimeframes.d.ts +9 -0
  97. package/dist/widget/widgetTimeframes.d.ts.map +1 -1
  98. package/dist/widget/widgetUI.d.ts +6 -9
  99. package/dist/widget/widgetUI.d.ts.map +1 -1
  100. package/package.json +3 -3
  101. package/dist/LayoutSession-B8vZsDaL.js.map +0 -1
  102. package/dist/LayoutSession-Du0WuDJi.cjs +0 -2
  103. package/dist/LayoutSession-Du0WuDJi.cjs.map +0 -1
  104. package/dist/i18n-BPt_Qbx8.js.map +0 -1
  105. package/dist/i18n-DWtAiG7D.cjs +0 -2
  106. package/dist/i18n-DWtAiG7D.cjs.map +0 -1
@@ -1,10 +1,10 @@
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, padPriceRange as _, parseIndicatorSource as v, priceFormatterFor as ee, priceStepAt as te, readChartStyleOverrides as ne, readChartTypeOptions as y, readIndicatorPlotStyles as b, readPaneStyle as x, resolveChartTheme as re, sessionMinute as S, 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 ve, ChartLegend as ye, ChartStateManager as C, CompareRenderer as be, CompareSymbolIndicator as xe, CorrelationCoefficientIndicator as Se, CorrelationLogIndicator as Ce, CrosshairHandler as we, CrosshairTooltip as Te, CurrentPriceLine as Ee, DEFAULT_SESSION_HOURS as De, DataExporter as w, DepthHeatmapRenderer as Oe, DrawingManager as ke, DrawingRenderer as Ae, EquivolumeRenderer as je, EventBus as Me, GridRenderer as Ne, HLCAreaRenderer as Pe, HiLoRenderer as T, HollowCandleRenderer as Fe, IndicatorEngine as E, InteractionManager as Ie, KagiRenderer as Le, KeyboardHandler as Re, LineRenderer as ze, LineWithMarkersRenderer as Be, MarketProfileRenderer as Ve, MeasureOverlay as He, PanHandler as Ue, PaneResizeHandler as We, PeriodLevelsRenderer as Ge, PinnedTooltip as Ke, PivotMarkersRenderer as qe, PointAndFigureRenderer as D, PriceAxis as O, PriceAxisAddButton as Je, PriceLines as Ye, RenderEngine as Xe, RenkoRenderer as Ze, ReplayManager as Qe, Screenshot as k, SelectionBoxOverlay as $e, SessionBreaks as et, SessionShading as tt, SignalMarkerManager as nt, SpreadIndicator as rt, StepLineRenderer as it, StreamManager as at, SymbolSeriesStore as ot, TimeAxis as st, TradeZoneManager as ct, TradingManager as lt, TradingRenderer as ut, UndoRedoManager as dt, Viewport as ft, VolumeCandleRenderer as pt, VolumeProfileRenderer as mt, VolumeRenderer as ht, Watermark as gt, ZoomHandler as _t, barTimeStepMs as vt, findDominantSwing as yt, gpuContextsLeft as bt, isRegularSession as xt, loadWebGL as St, mergeSessionHours as Ct, priceToY as wt, rangePresetStart as Tt, readAlertOptions as Et, registerBuiltInDrawingTools as Dt, registerBuiltInIndicators as A, servesTimeframe as j, sourceParam as M, timeToX as Ot, timestampToBarIndex as N, toHeikinAshi as kt, toKagi as At, toLineBreak as jt, toPointAndFigure as Mt, toRangeBars as Nt, toRenko as P, whenGpuContextFree as Pt, withResampling as Ft, xToBarIndex as It, xToTime as F, yToPrice as Lt } 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, PHI as a, PRICE_AXIS_WIDTH as o, TIME_AXIS_HEIGHT as s, autoPricePrecision as c, barTimeUnit as l, chartStyleValue as u, computePriceLimits as d, computePriceRange as f, formatPrice as p, fractionTick as m, indicatorSource as h, isValidTimeZone as g, mergeBar as _, normalizeBarTime as v, parseIndicatorSource as y, priceFormatterFor as ee, priceStepAt as te, readChartStyleOverrides as b, readChartTypeOptions as x, readIndicatorPlotStyles as ne, readPaneStyle as re, resolveChartTheme as ie, sessionMinute as S, setLocale as ae, stepDecimals as oe, tickBarCount as se, timeframeToMs 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 ve, ChartLegend as ye, ChartStateManager as C, CompareRenderer as be, CompareSymbolIndicator as xe, CorrelationCoefficientIndicator as Se, CorrelationLogIndicator as Ce, CrosshairHandler as we, CrosshairTooltip as Te, CurrentPriceLine as Ee, DEFAULT_SESSION_HOURS as De, DataExporter as w, DepthHeatmapRenderer as Oe, DrawingManager as ke, DrawingRenderer as Ae, EquivolumeRenderer as je, EventBus as Me, GridRenderer as Ne, HLCAreaRenderer as Pe, HiLoRenderer as Fe, HollowCandleRenderer as Ie, IndicatorEngine as Le, InteractionManager as Re, KagiRenderer as ze, KeyboardHandler as Be, LineRenderer as Ve, LineWithMarkersRenderer as He, MarketProfileRenderer as Ue, MeasureOverlay as We, PRICE_SCALE_MARGIN as T, PanHandler as Ge, PaneResizeHandler as Ke, PeriodLevelsRenderer as qe, PinnedTooltip as Je, PivotMarkersRenderer as Ye, PointAndFigureRenderer as E, PriceAxis as D, PriceAxisAddButton as Xe, PriceLines as Ze, RenderEngine as Qe, RenkoRenderer as $e, ReplayManager as et, SYMBOL_INDICATOR_IDS as O, Screenshot as k, 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, priceToY as Et, rangePresetStart as Dt, readAlertOptions as Ot, registerBuiltInDrawingTools as kt, registerBuiltInIndicators as At, servesTimeframe as jt, sourceParam as A, timeToX as Mt, timestampToBarIndex as j, toHeikinAshi as Nt, toKagi as Pt, toLineBreak as Ft, toPointAndFigure as It, toRangeBars as Lt, toRenko as Rt, whenGpuContextFree as zt, withResampling as Bt, xToBarIndex as Vt, xToTime as M, yToPrice as Ht } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
- var Rt = 864e5, zt = 10;
5
- function Bt(e, t) {
4
+ var Ut = 864e5, Wt = 10;
5
+ function Gt(e, t) {
6
6
  let n = e?.timezone;
7
- if (!n || !m(n) || t.length < 2) return null;
7
+ if (!n || !g(n) || t.length < 2) return null;
8
8
  let r = (e?.sessions ?? []).flatMap((e) => {
9
9
  let t = S(e.start), n = S(e.end);
10
10
  return t === null || n === null ? [] : [{
@@ -13,35 +13,35 @@ function Bt(e, t) {
13
13
  }];
14
14
  });
15
15
  if (r.length === 0) return null;
16
- let i = c(t), a = Infinity;
17
- for (let e = Math.max(1, t.length - zt); e < t.length; e++) {
16
+ let i = l(t), a = Infinity;
17
+ for (let e = Math.max(1, t.length - Wt); e < t.length; e++) {
18
18
  let n = (t[e].time - t[e - 1].time) * i;
19
19
  n > 0 && n < a && (a = n);
20
20
  }
21
- if (!(a < Rt)) return null;
21
+ if (!(a < Ut)) return null;
22
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) => xt(e * i, o);
28
+ return (e) => Ct(e * i, o);
29
29
  }
30
30
  //#endregion
31
31
  //#region src/chartA11y.ts
32
- var Vt = {
32
+ var Kt = {
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
- }, I = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Ht = [
39
+ }, N = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), qt = [
40
40
  "role",
41
41
  "aria-roledescription",
42
42
  "aria-label",
43
43
  "aria-describedby"
44
- ], Ut = 400, Wt = 1e3, Gt = class {
44
+ ], Jt = 400, Yt = 1e3, Xt = class {
45
45
  live;
46
46
  help;
47
47
  labels;
@@ -55,20 +55,20 @@ var Vt = {
55
55
  };
56
56
  constructor(e, t, n = {}) {
57
57
  this.container = e, this.source = t, this.labels = {
58
- ...Vt,
58
+ ...Kt,
59
59
  ...n
60
60
  };
61
- for (let t of Ht) this.before.set(t, e.getAttribute(t));
62
- e.setAttribute("role", "application"), this.help = Kt("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 = Kt("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 qt) this.before.set(t, e.getAttribute(t));
62
+ e.setAttribute("role", "application"), this.help = Zt("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 = Zt("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
- ...Vt,
66
+ ...Kt,
67
67
  ...e
68
68
  }, this.applyLabels();
69
69
  }
70
70
  refresh(e = !1) {
71
- let t = Wt - (Date.now() - this.summaryAt);
71
+ let t = Yt - (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 Vt = {
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
- }, Ut);
83
+ }, Jt);
84
84
  }
85
85
  readBar(e) {
86
86
  let t = this.source.bars();
@@ -93,13 +93,13 @@ var Vt = {
93
93
  let i = t[this.cursor];
94
94
  this.source.showBar(i.time);
95
95
  let a = this.source.formatPrice;
96
- this.say(I(this.labels.bar, {
96
+ this.say(N(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: qt(i.volume ?? 0)
102
+ volume: Qt(i.volume ?? 0)
103
103
  }));
104
104
  }
105
105
  destroy() {
@@ -118,7 +118,7 @@ var Vt = {
118
118
  this.labels.typeName ? this.labels.typeName(t) : t,
119
119
  this.source.timeframe()
120
120
  ].filter(Boolean).join(", ");
121
- return I(this.labels.summary, {
121
+ return N(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 Vt = {
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 I(this.labels.view, {
131
+ return N(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 Vt = {
140
140
  this.live.textContent = e;
141
141
  }
142
142
  };
143
- function Kt(e, t) {
143
+ function Zt(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 Kt(e, t) {
154
154
  border: "0"
155
155
  }), n;
156
156
  }
157
- function qt(e) {
157
+ function Qt(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 Jt(e, t, n, r) {
162
+ function $t(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 Jt(e, t, n, r) {
169
169
  }
170
170
  //#endregion
171
171
  //#region src/charts/ChartTypeStrategy.ts
172
- function Yt(e) {
172
+ function en(e) {
173
173
  switch (e) {
174
174
  case "candlestick":
175
175
  case "heikinAshi":
176
176
  case "lineBreak":
177
177
  case "rangeBars": return new ve();
178
- case "line": return new ze();
178
+ case "line": return new Ve();
179
179
  case "area": return new pe();
180
180
  case "bar": return new ge();
181
- case "hollowCandle": return new Fe();
181
+ case "hollowCandle": return new Ie();
182
182
  case "baseline": return new _e();
183
- case "renko": return new Ze();
184
- case "kagi": return new Le();
185
- case "pointAndFigure": return new D();
186
- case "volumeCandles": return new pt();
183
+ case "renko": return new $e();
184
+ case "kagi": return new ze();
185
+ case "pointAndFigure": return new E();
186
+ case "volumeCandles": return new ht();
187
187
  case "equivolume": return new je();
188
188
  case "hlcArea": return new Pe();
189
- case "stepLine": return new it();
190
- case "lineWithMarkers": return new Be();
191
- case "hiLo": return new T();
189
+ case "stepLine": return new ot();
190
+ case "lineWithMarkers": return new He();
191
+ case "hiLo": return new Fe();
192
192
  default: return new ve();
193
193
  }
194
194
  }
195
- function Xt(e, t, n = {}) {
195
+ function tn(e, t, n = {}) {
196
196
  if (t.length === 0) return t;
197
197
  switch (e) {
198
- case "heikinAshi": return kt(t);
198
+ case "heikinAshi": return Nt(t);
199
199
  case "renko": {
200
200
  let e = n.renko?.boxSize;
201
- return typeof e == "number" ? P(t, { brickSize: e }) : P(t, {
201
+ return typeof e == "number" ? Rt(t, { brickSize: e }) : Rt(t, {
202
202
  brickSize: 0,
203
203
  useATR: !0,
204
204
  atrPeriod: n.renko?.atrPeriod ?? 14
205
205
  });
206
206
  }
207
- case "lineBreak": return jt(t, n.lineBreak?.lines ?? 3);
208
- case "kagi": return At(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
- case "pointAndFigure": return Mt(t, Qt(t, n), n.pointAndFigure?.reversal ?? 3);
207
+ case "lineBreak": return Ft(t, n.lineBreak?.lines ?? 3);
208
+ case "kagi": return Pt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
+ case "pointAndFigure": return It(t, F(t, n), n.pointAndFigure?.reversal ?? 3);
210
210
  case "rangeBars": {
211
211
  let e = n.rangeBars?.range;
212
- return Nt(t, { rangeSize: typeof e == "number" ? e : $t(t) * .005 });
212
+ return Lt(t, { rangeSize: typeof e == "number" ? e : I(t) * .005 });
213
213
  }
214
214
  default: return t;
215
215
  }
216
216
  }
217
- function Zt(e) {
217
+ function nn(e) {
218
218
  switch (e) {
219
219
  case "heikinAshi":
220
220
  case "renko":
@@ -225,30 +225,30 @@ function Zt(e) {
225
225
  default: return !1;
226
226
  }
227
227
  }
228
- function L(e) {
229
- return e !== "heikinAshi" && Zt(e);
228
+ function P(e) {
229
+ return e !== "heikinAshi" && nn(e);
230
230
  }
231
- function Qt(e, t = {}) {
231
+ function F(e, t = {}) {
232
232
  let n = t.pointAndFigure?.boxSize;
233
- return typeof n == "number" ? n : $t(e) * .01;
233
+ return typeof n == "number" ? n : I(e) * .01;
234
234
  }
235
- function $t(e) {
235
+ function I(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 rn(e, t) {
241
241
  let n = t?.(e);
242
- return n ? n.createRenderer() : Yt(e);
242
+ return n ? n.createRenderer() : en(e);
243
243
  }
244
- function tn(e, t, n, r) {
244
+ function an(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) : Xt(e, t, r);
247
+ return i?.transform ? i.transform(t) : tn(e, t, r);
248
248
  }
249
249
  //#endregion
250
250
  //#region src/state/AutoSaveScheduler.ts
251
- var nn = class {
251
+ var on = class {
252
252
  timer = null;
253
253
  delayMs = 0;
254
254
  key = null;
@@ -278,12 +278,12 @@ var nn = class {
278
278
  };
279
279
  //#endregion
280
280
  //#region src/DataManager.ts
281
- function R(e) {
281
+ function L(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 rn(e) {
286
+ function R(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
289
  function z(e) {
@@ -298,8 +298,8 @@ var B = class {
298
298
  data = [];
299
299
  inSeriesUnit(e) {
300
300
  if (this.data.length === 0) return e;
301
- let t = g(e);
302
- return c(this.data) === 1 ? t : t / 1e3;
301
+ let t = v(e);
302
+ return l(this.data) === 1 ? t : t / 1e3;
303
303
  }
304
304
  withSeriesTime(e) {
305
305
  let t = this.inSeriesUnit(e.time);
@@ -315,16 +315,16 @@ var B = class {
315
315
  let t = [];
316
316
  for (let n = 0; n < e.length; n++) {
317
317
  let r = e[n];
318
- R(r) && t.push(rn(r) ? r : z(r));
318
+ L(r) && t.push(R(r) ? r : z(r));
319
319
  }
320
320
  this.data = t;
321
321
  }
322
322
  prependBars(e) {
323
323
  let t = this.data.length > 0 ? this.data[0].time : Infinity, n = [];
324
324
  for (let r = 0; r < e.length; r++) {
325
- if (!R(e[r])) continue;
325
+ if (!L(e[r])) continue;
326
326
  let i = this.withSeriesTime(e[r]);
327
- i.time >= t || n.push(rn(i) ? i : z(i));
327
+ i.time >= t || n.push(R(i) ? i : z(i));
328
328
  }
329
329
  if (n.length === 0) return 0;
330
330
  n.sort((e, t) => e.time - t.time);
@@ -333,10 +333,10 @@ var B = class {
333
333
  return n.length = r, this.data = n.concat(this.data), r;
334
334
  }
335
335
  appendBar(e) {
336
- R(e) && this.data.push(z(this.withSeriesTime(e)));
336
+ L(e) && this.data.push(z(this.withSeriesTime(e)));
337
337
  }
338
338
  updateLastBar(e) {
339
- if (!R(e)) return;
339
+ if (!L(e)) return;
340
340
  let t = z(this.withSeriesTime(e));
341
341
  if (this.data.length === 0) {
342
342
  this.data.push(t);
@@ -345,7 +345,7 @@ var B = class {
345
345
  this.data[this.data.length - 1] = t;
346
346
  }
347
347
  updateLastBarFromTick(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))));
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] = _(this.data[this.data.length - 1], this.withSeriesTime(e))));
349
349
  }
350
350
  getLength() {
351
351
  return this.data.length;
@@ -353,7 +353,7 @@ var B = class {
353
353
  clear() {
354
354
  this.data = [];
355
355
  }
356
- }, an = 5e3, on = 6e4, sn = 500, cn = class {
356
+ }, V = 5e3, sn = 6e4, cn = 500, ln = class {
357
357
  loader = null;
358
358
  pageSize = 500;
359
359
  loading = !1;
@@ -394,7 +394,7 @@ var B = class {
394
394
  try {
395
395
  r = await e(t, this.pageSize);
396
396
  } catch (e) {
397
- return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(on, an * 2 ** (this.failures - 1)), this.emit({
397
+ return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(sn, V * 2 ** (this.failures - 1)), this.emit({
398
398
  state: "error",
399
399
  count: 0,
400
400
  error: e instanceof Error ? e.message : String(e)
@@ -424,7 +424,7 @@ var B = class {
424
424
  now() {
425
425
  return this.host.now ? this.host.now() : Date.now();
426
426
  }
427
- }, ln = class t {
427
+ }, un = class t {
428
428
  base;
429
429
  shape = null;
430
430
  chartType = "candlestick";
@@ -441,7 +441,7 @@ var B = class {
441
441
  return i;
442
442
  }
443
443
  getTheme() {
444
- return this.effective ??= re(this.base, this.chartType, this.merged()), this.effective;
444
+ return this.effective ??= ie(this.base, this.chartType, this.merged()), this.effective;
445
445
  }
446
446
  getBaseTheme() {
447
447
  return this.base;
@@ -493,7 +493,7 @@ var B = class {
493
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);
494
494
  }
495
495
  getStyleValue(e) {
496
- return l(this.base, this.merged(), e, this.chartType);
496
+ return u(this.base, this.merged(), e, this.chartType);
497
497
  }
498
498
  layer(e) {
499
499
  return e === "host" ? this.host : this.user.get(this.base.name) ?? {};
@@ -510,7 +510,7 @@ var B = class {
510
510
  };
511
511
  //#endregion
512
512
  //#region src/style/styleOptions.ts
513
- function un(e, t) {
513
+ function dn(e, t) {
514
514
  return t ? {
515
515
  ...t.visible === void 0 ? {} : { [`crosshair.${e}.visible`]: t.visible },
516
516
  ...t.color === void 0 ? {} : { [`crosshair.${e}.color`]: t.color },
@@ -518,26 +518,26 @@ function un(e, t) {
518
518
  ...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
519
519
  } : {};
520
520
  }
521
- function dn(e) {
521
+ function fn(e) {
522
522
  let { grid: t, crosshair: n } = e, r = n?.vLine?.labelBackground ?? n?.hLine?.labelBackground;
523
523
  return {
524
524
  ...t?.hLineColor === void 0 ? {} : { "grid.horizontal.color": t.hLineColor },
525
525
  ...t?.hLineStyle === void 0 ? {} : { "grid.horizontal.style": t.hLineStyle },
526
526
  ...t?.vLineColor === void 0 ? {} : { "grid.vertical.color": t.vLineColor },
527
527
  ...t?.vLineStyle === void 0 ? {} : { "grid.vertical.style": t.vLineStyle },
528
- ...un("horizontal", n?.hLine),
529
- ...un("vertical", n?.vLine),
528
+ ...dn("horizontal", n?.hLine),
529
+ ...dn("vertical", n?.vLine),
530
530
  ...r === void 0 ? {} : { "crosshair.labelBackground": r },
531
531
  ...e.overrides
532
532
  };
533
533
  }
534
534
  //#endregion
535
535
  //#region src/layout/LayoutManager.ts
536
- var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom", mn = class {
536
+ var pn = 200, mn = 80, H = (e) => e.position === "top" || e.position === "bottom", hn = class {
537
537
  panels = [];
538
538
  containerWidth = 0;
539
539
  containerHeight = 0;
540
- priceAxisWidth = a;
540
+ priceAxisWidth = o;
541
541
  leftAxisWidth = 0;
542
542
  maximized = null;
543
543
  resize(e, t) {
@@ -549,8 +549,8 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
549
549
  this.panels.push({
550
550
  id: e,
551
551
  position: n,
552
- size: r ?? (a ? fn : t),
553
- minSize: a ? pn : i,
552
+ size: r ?? (a ? pn : t),
553
+ minSize: a ? mn : i,
554
554
  content: {
555
555
  type: "indicator",
556
556
  indicatorInstanceId: e
@@ -569,14 +569,14 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
569
569
  }
570
570
  setPanelCollapsed(e, t) {
571
571
  let n = this.panels.find((t) => t.id === e);
572
- return !n || !V(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
572
+ return !n || !H(n) || this.maximized === null && !!n.collapsed === t ? !1 : (this.maximized = null, n.collapsed = t || void 0, !0);
573
573
  }
574
574
  isPanelCollapsed(e) {
575
575
  return !!this.panels.find((t) => t.id === e)?.collapsed;
576
576
  }
577
577
  isPanelShownCollapsed(e) {
578
578
  let t = this.panels.find((t) => t.id === e);
579
- return !t || !V(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
579
+ return !t || !H(t) ? !1 : this.maximized === null ? !!t.collapsed : this.maximized !== e;
580
580
  }
581
581
  setPanelScale(e, t) {
582
582
  let n = this.panels.find((t) => t.id === e);
@@ -592,7 +592,7 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
592
592
  }
593
593
  setMaximizedPanel(e) {
594
594
  let t = e === null ? null : this.panels.find((t) => t.id === e);
595
- return e !== null && (!t || !V(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
595
+ return e !== null && (!t || !H(t)) || this.maximized === e ? !1 : (this.maximized = e, t && (t.collapsed = void 0), !0);
596
596
  }
597
597
  getMaximizedPanel() {
598
598
  return this.maximized;
@@ -613,19 +613,19 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
613
613
  this.panels = [...this.panels].sort((e, n) => t(e) - t(n));
614
614
  }
615
615
  shownSize(e, t) {
616
- return V(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
616
+ return H(e) ? this.maximized ? e.id === this.maximized ? t : 20 : e.collapsed ? 20 : e.size : e.size;
617
617
  }
618
618
  setPanelPosition(e, n) {
619
619
  let r = this.panels.find((t) => t.id === e);
620
620
  if (r) {
621
621
  let a = r.position === "left" || r.position === "right", o = n === "left" || n === "right";
622
- r.position = n, a !== o && (r.size = o ? fn : t, r.minSize = o ? pn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
622
+ r.position = n, a !== o && (r.size = o ? pn : t, r.minSize = o ? mn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
623
623
  }
624
624
  }
625
625
  setPanelSize(e, t) {
626
626
  let n = this.panels.find((t) => t.id === e);
627
627
  if (n) {
628
- let e = V(n) ? this.containerHeight - o - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
628
+ let e = H(n) ? this.containerHeight - s - 48 : this.containerWidth / 2, r = e > n.minSize ? Math.min(t, e) : t;
629
629
  n.size = Math.max(n.minSize, r), n.collapsed = void 0, this.maximized = null;
630
630
  }
631
631
  }
@@ -639,11 +639,11 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
639
639
  return this.panels;
640
640
  }
641
641
  resolve() {
642
- let e = this.panels.filter((e) => e.position === "left"), t = this.panels.filter((e) => e.position === "right"), n = this.panels.filter((e) => e.position === "top"), r = this.panels.filter((e) => e.position === "bottom"), i = (n.length + r.length - 1) * 20, a = this.maximized ? this.panels.find((e) => e.id === this.maximized) : void 0, s = Math.max(a?.minSize ?? 0, this.containerHeight - o - 48 - i), c = (e) => this.shownSize(e, s), l = e.reduce((e, t) => e + t.size, 0), u = t.reduce((e, t) => e + t.size, 0), d = n.reduce((e, t) => e + c(t), 0), f = r.reduce((e, t) => e + c(t), 0), p = l + this.leftAxisWidth, m = {
642
+ let e = this.panels.filter((e) => e.position === "left"), t = this.panels.filter((e) => e.position === "right"), n = this.panels.filter((e) => e.position === "top"), r = this.panels.filter((e) => e.position === "bottom"), i = (n.length + r.length - 1) * 20, a = this.maximized ? this.panels.find((e) => e.id === this.maximized) : void 0, o = Math.max(a?.minSize ?? 0, this.containerHeight - s - 48 - i), c = (e) => this.shownSize(e, o), l = e.reduce((e, t) => e + t.size, 0), u = t.reduce((e, t) => e + t.size, 0), d = n.reduce((e, t) => e + c(t), 0), f = r.reduce((e, t) => e + c(t), 0), p = l + this.leftAxisWidth, m = {
643
643
  x: p,
644
644
  y: d,
645
645
  width: Math.max(0, this.containerWidth - p - u - this.priceAxisWidth),
646
- height: Math.max(0, this.containerHeight - d - f - o)
646
+ height: Math.max(0, this.containerHeight - d - f - s)
647
647
  }, h = [], g = [], _ = 0;
648
648
  for (let t of e) h.push({
649
649
  config: t,
@@ -651,7 +651,7 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
651
651
  x: _,
652
652
  y: 0,
653
653
  width: t.size,
654
- height: this.containerHeight - o
654
+ height: this.containerHeight - s
655
655
  }
656
656
  }), g.push({
657
657
  panelId: t.id,
@@ -714,7 +714,7 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
714
714
  x: _,
715
715
  y: 0,
716
716
  width: e.size,
717
- height: this.containerHeight - o
717
+ height: this.containerHeight - s
718
718
  }
719
719
  }), g.push({
720
720
  panelId: e.id,
@@ -735,24 +735,24 @@ var fn = 200, pn = 80, V = (e) => e.position === "top" || e.position === "bottom
735
735
  getMainChartRect() {
736
736
  return this.resolve().mainChartRect;
737
737
  }
738
- }, hn = 14, gn = 14, _n = 22, vn = 4;
739
- function yn(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] : [
738
+ }, gn = 14, _n = 14, vn = 22, yn = 4;
739
+ function bn(e) {
740
+ let { min: t, max: n, lastPrice: r, locale: i, fontFamily: a, fontSizeSmall: s, measure: l } = e, u = e.tagPrecision ?? c(t, n), d = u, f = r === null ? [t, n] : [
741
741
  t,
742
742
  n,
743
743
  r
744
- ], m = a;
745
- for (let t of p) {
744
+ ], m = o;
745
+ for (let t of f) {
746
746
  if (!Number.isFinite(t)) continue;
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}`) + hn, l(r, `bold 11px ${o}`) + gn, l(r, `600 ${c}px ${o}`) + _n);
747
+ let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : p(t, u, i), r = e.format ? n : p(t, d, i);
748
+ m = Math.max(m, l(n, `500 ${s}px ${a}`) + gn, l(r, `bold 11px ${a}`) + _n, l(r, `600 ${s}px ${a}`) + vn);
749
749
  }
750
- return m <= a ? a : Math.ceil(m / vn) * vn;
750
+ return m <= o ? o : Math.ceil(m / yn) * yn;
751
751
  }
752
- function bn(e, t) {
752
+ function xn(e, t) {
753
753
  return t > e || t <= e - 12 ? t : e;
754
754
  }
755
- var xn = class {
755
+ var Sn = class {
756
756
  netY = 0;
757
757
  travelX = 0;
758
758
  engaged = !1;
@@ -768,11 +768,11 @@ var xn = class {
768
768
  }
769
769
  return this.engaged;
770
770
  }
771
- }, Sn = 1;
772
- function Cn(e, t) {
771
+ }, Cn = 1;
772
+ function wn(e, t) {
773
773
  return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
774
774
  }
775
- function H(e) {
775
+ function U(e) {
776
776
  switch (e.kind) {
777
777
  case "indicator": return `indicator:${e.plugin.descriptor.id}`;
778
778
  case "drawing": return `drawing:${e.plugin.descriptor.type}`;
@@ -782,25 +782,25 @@ function H(e) {
782
782
  }
783
783
  //#endregion
784
784
  //#region src/plugins/registry.ts
785
- var U = /* @__PURE__ */ new Map();
786
- function wn(e) {
787
- U.set(H(e), e);
788
- }
785
+ var W = /* @__PURE__ */ new Map();
789
786
  function Tn(e) {
790
- return U.delete(e);
787
+ W.set(U(e), e);
791
788
  }
792
- function En() {
793
- return [...U.values()];
789
+ function En(e) {
790
+ return W.delete(e);
794
791
  }
795
792
  function Dn() {
796
- U.clear();
793
+ return [...W.values()];
794
+ }
795
+ function On() {
796
+ W.clear();
797
797
  }
798
798
  //#endregion
799
799
  //#region src/plugins/PluginManager.ts
800
- var On = class {
800
+ var kn = class {
801
801
  plugins = /* @__PURE__ */ new Map();
802
802
  constructor(e, t = {}) {
803
- if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of En()) this.add(e);
803
+ if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Dn()) this.add(e);
804
804
  for (let e of t.plugins ?? []) this.add(e);
805
805
  }
806
806
  register(e) {
@@ -828,17 +828,17 @@ var On = class {
828
828
  return e;
829
829
  }
830
830
  add(e) {
831
- this.plugins.set(H(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
831
+ this.plugins.set(U(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
832
832
  }
833
- }, kn = {
833
+ }, An = {
834
834
  orderPlace: (e, t) => e.placeOrder(t),
835
835
  orderModify: (e, t) => e.modifyOrder(t),
836
836
  orderCancel: (e, t) => e.cancelOrder(t),
837
837
  positionModify: (e, t) => e.modifyPosition(t),
838
838
  positionClose: (e, t) => e.closePosition(t),
839
- positionReverse: (e, t, n) => An(e, t, n)
839
+ positionReverse: (e, t, n) => jn(e, t, n)
840
840
  };
841
- async function An(e, t, n) {
841
+ async function jn(e, t, n) {
842
842
  let { reversing: r } = n;
843
843
  if (!r.has(t.positionId)) {
844
844
  r.add(t.positionId);
@@ -867,7 +867,7 @@ async function An(e, t, n) {
867
867
  }
868
868
  }
869
869
  }
870
- function jn(e, t) {
870
+ function Mn(e, t) {
871
871
  let n = [], r = null, i = {
872
872
  positions: () => r ?? t.getPositions?.() ?? [],
873
873
  reversing: /* @__PURE__ */ new Set()
@@ -877,8 +877,8 @@ function jn(e, t) {
877
877
  e.data && t.onFill?.(e.data);
878
878
  };
879
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));
880
- for (let r of Object.keys(kn)) {
881
- let a = kn[r], o = t.onIntent(r, (n) => {
880
+ for (let r of Object.keys(An)) {
881
+ let a = An[r], o = t.onIntent(r, (n) => {
882
882
  Promise.resolve(a(e, n, i)).catch((e) => t.onError({
883
883
  message: `Execution command failed: ${r}`,
884
884
  cause: e
@@ -892,16 +892,16 @@ function jn(e, t) {
892
892
  }
893
893
  //#endregion
894
894
  //#region src/Chart.ts
895
- var Mn = {
895
+ var Nn = {
896
896
  min: 0,
897
897
  max: 100
898
- }, Nn = "exchange";
899
- function Pn(e) {
900
- if (typeof e == "string" && e !== "exchange" && !m(e)) throw RangeError(`Unknown time zone: ${e}`);
898
+ }, Pn = "exchange";
899
+ function Fn(e) {
900
+ if (typeof e == "string" && e !== "exchange" && !g(e)) throw RangeError(`Unknown time zone: ${e}`);
901
901
  if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
902
902
  }
903
- var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine", "crossLine"]), Vn = new Set(["verticalLine", "crossLine"]), Hn = class {
904
- static version = "1.32.0";
903
+ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontalLine", "crossLine"]), Hn = new Set(["verticalLine", "crossLine"]), Un = class {
904
+ static version = "1.35.0";
905
905
  engine;
906
906
  viewport;
907
907
  dataManager;
@@ -926,7 +926,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
926
926
  lastBackground = null;
927
927
  renderScheduled = !1;
928
928
  renderDeferred = !1;
929
- priceAxisWidth = a;
929
+ priceAxisWidth = o;
930
930
  measureCtx;
931
931
  containerSizeCache = null;
932
932
  containerSizeCacheTime = 0;
@@ -938,9 +938,10 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
938
938
  barCountdown;
939
939
  unrestoredIndicators = [];
940
940
  indicatorHistoryDepth = 0;
941
+ indicatorEdit = null;
941
942
  removedDrawingAlerts = /* @__PURE__ */ new Map();
942
943
  zoomAreaMode = !1;
943
- priceAxisAddButton = new Je();
944
+ priceAxisAddButton = new Xe();
944
945
  displayTz = null;
945
946
  timezoneSetting = null;
946
947
  symbolInfo = null;
@@ -966,7 +967,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
966
967
  signalMarkerManager;
967
968
  tradeZoneManager;
968
969
  measureOverlay;
969
- selectionBoxOverlay = new $e();
970
+ selectionBoxOverlay = new tt();
970
971
  replayManager;
971
972
  replayBarUnsub = null;
972
973
  replaySeeking = !1;
@@ -976,7 +977,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
976
977
  replayRevealMarks = !0;
977
978
  replayOffset = 0;
978
979
  undoRedoManager;
979
- autoSaveScheduler = new nn((e) => this.saveState(e));
980
+ autoSaveScheduler = new on((e) => this.saveState(e));
980
981
  animator;
981
982
  crosshairTooltip;
982
983
  pinnedTooltip;
@@ -988,17 +989,17 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
988
989
  disposed = !1;
989
990
  chartTypeOptions = {};
990
991
  mainSeriesVisible = !0;
991
- priceLines = new Ye();
992
- symbolSeries = new ot();
992
+ priceLines = new Ze();
993
+ symbolSeries = new ct();
993
994
  extendedHours = !0;
994
995
  replayRestarting = !1;
995
996
  fullSeries = null;
996
997
  requestedSymbols = /* @__PURE__ */ new Set();
997
998
  gridRenderer;
998
999
  priceAxis;
999
- leftPriceAxis = new O();
1000
+ leftPriceAxis = new D();
1000
1001
  leftScaleRequested = !1;
1001
- leftAxisWidth = a;
1002
+ leftAxisWidth = o;
1002
1003
  leftViewport = null;
1003
1004
  timeAxis;
1004
1005
  options;
@@ -1027,7 +1028,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1027
1028
  snapshotKey = null;
1028
1029
  historyCheckQueued = !1;
1029
1030
  constructor(e, t) {
1030
- t.timeZone != null && Pn(t.timeZone), this.container = e, this.options = {
1031
+ t.timeZone != null && Fn(t.timeZone), this.container = e, this.options = {
1031
1032
  ...t,
1032
1033
  chartType: t.chartType ?? "candlestick"
1033
1034
  }, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
@@ -1051,7 +1052,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1051
1052
  timeAxis: n.timeAxis ?? !0,
1052
1053
  grid: n.grid ?? t.grid?.visible ?? !0,
1053
1054
  legend: n.legend ?? !0,
1054
- indicatorValueLabels: n.indicatorValueLabels ?? !0,
1055
+ indicatorValueLabels: n.indicatorValueLabels ?? !1,
1055
1056
  volume: n.volume ?? !0,
1056
1057
  watermark: n.watermark ?? !0,
1057
1058
  saveLoad: n.saveLoad ?? !0,
@@ -1065,15 +1066,15 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1065
1066
  logScale: n.logScale ?? !0,
1066
1067
  timeframes: n.timeframes ?? [],
1067
1068
  defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
1068
- }, 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 cn({
1069
+ }, 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 ln({
1069
1070
  oldestTime: () => this.dataManager.getData()[0]?.time ?? null,
1070
1071
  prepend: (e) => this.prependBars(e),
1071
1072
  emit: (e) => this.eventBus.emit("historyLoad", e)
1072
- }), this.themeManager = new ln(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(dn(t), "host", !1), this.layoutManager = new mn(), this.indicatorEngine = new E(), this.pluginManager = new On(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Me(), A(this.indicatorEngine), this.indicatorEngine.register(new xe(this.symbolSeries)), this.indicatorEngine.register(new rt(this.symbolSeries)), this.indicatorEngine.register(new Se(this.symbolSeries)), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.drawingManager = new ke(), Dt(this.drawingManager), this.drawingRenderer = new Ae(this.drawingManager), this.drawingManager.setRequestRender(() => {
1073
+ }), this.themeManager = new un(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(fn(t), "host", !1), this.layoutManager = new hn(), this.indicatorEngine = new Le(), this.pluginManager = new kn(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Me(), At(this.indicatorEngine), this.indicatorEngine.register(new xe(this.symbolSeries)), this.indicatorEngine.register(new at(this.symbolSeries)), this.indicatorEngine.register(new Se(this.symbolSeries)), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.drawingManager = new ke(), kt(this.drawingManager), this.drawingRenderer = new Ae(this.drawingManager), this.drawingManager.setRequestRender(() => {
1073
1074
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1074
1075
  }), this.drawingManager.setEventCallback((e, t) => {
1075
1076
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1076
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new dt();
1077
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new pt();
1077
1078
  let i = "";
1078
1079
  this.undoRedoManager.setOnChange(() => {
1079
1080
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1086,21 +1087,21 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1086
1087
  primary: e[0] ?? null
1087
1088
  })), this.drawingManager.setForeignHistory((e, t) => {
1088
1089
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
1089
- }), 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 lt({
1090
+ }), 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({
1090
1091
  enabled: this.features.trading,
1091
1092
  contextMenu: { enabled: this.features.tradingContextMenu }
1092
- }), this.tradingRenderer = new ut(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1093
+ }), this.tradingRenderer = new ft(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1093
1094
  this.eventBus.emit(e, t);
1094
- }), this.engine = new Xe(e, t.maxPixelRatio);
1095
+ }), this.engine = new Qe(e, t.maxPixelRatio);
1095
1096
  let a = this.engine.dprManager.getContainerSize();
1096
- if (this.viewport = new ft(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1097
+ if (this.viewport = new mt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1097
1098
  freePan: t.freePan ?? !0,
1098
1099
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1099
1100
  }), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1100
1101
  if (e.width <= 0 || e.height <= 0) return;
1101
1102
  let t = this.viewport.isAtEnd();
1102
1103
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t);
1103
- }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ne(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new O(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.timeAxis = new st(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new we(), 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) => {
1104
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ne(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new D(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new lt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new we(), 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) => {
1104
1105
  if (e !== null && t) {
1105
1106
  let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0;
1106
1107
  this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null);
@@ -1109,20 +1110,20 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1109
1110
  prevClose: e > 0 ? n[e - 1]?.close : void 0,
1110
1111
  priceRange: i.priceRange,
1111
1112
  plot: i.chartRect,
1112
- barStepMs: vt(n),
1113
- timeUnit: c(n)
1113
+ barStepMs: bt(n),
1114
+ timeUnit: l(n)
1114
1115
  }) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
1115
1116
  point: t,
1116
1117
  bar: r,
1117
1118
  barIndex: e
1118
1119
  });
1119
1120
  } else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
1120
- }), this.chartLegend = new ye(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new gt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new ht(), this.volumeProfile = new mt(), this.marketProfile = new Ve(), this.depthHeatmap = new Oe(), this.periodLevels = new Ge(), this.pivotMarkers = new qe(), this.barCountdown = new he(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new et(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new tt(), this.compareRenderer = new be(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1121
+ }), this.chartLegend = new ye(), 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 Ue(), this.depthHeatmap = new Oe(), this.periodLevels = new qe(), this.pivotMarkers = new Ye(), 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 be(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1121
1122
  visible: t.sessionBreaks.visible ?? !0,
1122
1123
  color: t.sessionBreaks.color,
1123
1124
  lineStyle: t.sessionBreaks.lineStyle,
1124
1125
  lineWidth: t.sessionBreaks.lineWidth
1125
- }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new fe(), this.crosshairTooltip = new Te(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Ke(), 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(Gn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Re({
1126
+ }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new fe(), this.crosshairTooltip = new Te(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Je(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = x(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Kn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Be({
1126
1127
  scrollBars: (e) => {
1127
1128
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1128
1129
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1139,7 +1140,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1139
1140
  },
1140
1141
  fitContent: () => this.fitContent()
1141
1142
  }), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
1142
- this.a11y = new Gt(e, {
1143
+ this.a11y = new Xt(e, {
1143
1144
  symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
1144
1145
  timeframe: () => this.streamTimeframe ?? "",
1145
1146
  chartType: () => this.options.chartType ?? "candlestick",
@@ -1149,7 +1150,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1149
1150
  formatTime: (e) => le(this.numberLocale || "en-US", {
1150
1151
  dateStyle: "medium",
1151
1152
  timeStyle: "short"
1152
- }, this.displayTz)(e * c(this.getDisplayData())),
1153
+ }, this.displayTz)(e * l(this.getDisplayData())),
1153
1154
  showBar: (e) => this.setCrosshairTime(e)
1154
1155
  }, t.a11y?.labels);
1155
1156
  for (let e of [
@@ -1184,7 +1185,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1184
1185
  this.eventBus.emit("alertExpired", G(e));
1185
1186
  }), this.alertManager.on("updated", (e) => {
1186
1187
  this.eventBus.emit("alertUpdate", G(e));
1187
- }), this.signalMarkerManager = new nt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1188
+ }), this.signalMarkerManager = new it(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1188
1189
  this.eventBus.emit("signalMarkerAdd", {
1189
1190
  id: e.id,
1190
1191
  source: e.source,
@@ -1192,14 +1193,14 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1192
1193
  });
1193
1194
  }), this.signalMarkerManager.on("removed", (e) => {
1194
1195
  this.eventBus.emit("signalMarkerRemove", { id: e });
1195
- }), this.tradeZoneManager = new ct(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1196
+ }), this.tradeZoneManager = new ut(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1196
1197
  this.eventBus.emit("tradeZoneAdd", {
1197
1198
  id: e.id,
1198
1199
  direction: e.direction
1199
1200
  });
1200
1201
  }), this.tradeZoneManager.on("removed", (e) => {
1201
1202
  this.eventBus.emit("tradeZoneRemove", { id: e });
1202
- }), this.replayManager = new Qe(), this.replayManager.on("complete", () => {
1203
+ }), this.replayManager = new et(), this.replayManager.on("complete", () => {
1203
1204
  let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1204
1205
  t && this.eventBus.emit("replayComplete", {
1205
1206
  barIndex: e,
@@ -1207,9 +1208,9 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1207
1208
  });
1208
1209
  }), this.replayManager.on("stateChange", (e) => {
1209
1210
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1210
- }), this.measureOverlay = new He(), this.interactionManager = new Ie(e), this.features.panning) {
1211
- let e = new xn();
1212
- this.interactionManager.setPanHandler(new Ue((t, n) => {
1211
+ }), this.measureOverlay = new We(), this.interactionManager = new Re(e), this.features.panning) {
1212
+ let e = new Sn();
1213
+ this.interactionManager.setPanHandler(new Ge((t, n) => {
1213
1214
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.options.autoScale = !1, this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1214
1215
  }, () => e.reset()));
1215
1216
  }
@@ -1221,7 +1222,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1221
1222
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1222
1223
  }
1223
1224
  })), this.features.zooming) {
1224
- this.interactionManager.setZoomHandler(new _t((e, t) => {
1225
+ this.interactionManager.setZoomHandler(new yt((e, t) => {
1225
1226
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1226
1227
  }));
1227
1228
  let e = new me((e) => {
@@ -1244,7 +1245,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1244
1245
  y: t.y
1245
1246
  });
1246
1247
  })), 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) => {
1247
- let t = Lt(e.y, this.viewport.getState());
1248
+ let t = Ht(e.y, this.viewport.getState());
1248
1249
  Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
1249
1250
  price: t,
1250
1251
  x: e.x,
@@ -1257,12 +1258,12 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1257
1258
  let e = new ue(this.alertManager, () => this.viewport.getState());
1258
1259
  this.interactionManager.setAlertDragHandler(e);
1259
1260
  }
1260
- let o = new We();
1261
+ let o = new Ke();
1261
1262
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1262
1263
  let t = this.getDisplayData();
1263
1264
  if (t.length === 0) return;
1264
1265
  let n = this.viewport.getState(), i = n.barWidth + n.barSpacing, a = Math.round((n.offset + e.x) / i);
1265
- 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));
1266
+ a < 0 || a >= t.length || (this.pinnedTooltip.isPinned() && this.pinnedTooltip.getPinnedIndex() === a ? this.pinnedTooltip.unpin() : this.pinnedTooltip.pin(t[a], a, this.themeManager.getTheme(), l(t)), this.pinnedTooltip.reposition(this.viewport.getState(), this.dataManager.getData()[a] ?? null, a, this.themeManager.getTheme()), this.engine.requestRender(r.Overlay));
1266
1267
  }), 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", {
1267
1268
  marker: e,
1268
1269
  x: t.x,
@@ -1281,7 +1282,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1281
1282
  x: e.x,
1282
1283
  y: e.y
1283
1284
  }), t.length === 0) return;
1284
- let r = It(e.x, this.viewport.getState());
1285
+ let r = Vt(e.x, this.viewport.getState());
1285
1286
  r < 0 || r >= t.length || this.eventBus.emit("barClick", {
1286
1287
  bar: t[r],
1287
1288
  barIndex: r,
@@ -1321,7 +1322,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1321
1322
  end: () => {
1322
1323
  let e = this.selectionBoxOverlay.end();
1323
1324
  if (e && this.zoomAreaMode) {
1324
- if (e.x1 - e.x0 < zn) return;
1325
+ if (e.x1 - e.x0 < Bn) return;
1325
1326
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1326
1327
  return;
1327
1328
  }
@@ -1358,7 +1359,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1358
1359
  if (this.replaySession) return 0;
1359
1360
  let t = null;
1360
1361
  if (this.fullSeries) {
1361
- let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => $n(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1362
+ let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => tr(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1362
1363
  this.fullSeries = [...i, ...this.fullSeries];
1363
1364
  let a = this.sessionKeep(this.fullSeries);
1364
1365
  t = i.length, e = a ? i.filter((e) => a(e.time)) : i;
@@ -1367,7 +1368,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1367
1368
  if (a === 0) return t ?? 0;
1368
1369
  let o = this.dataManager.getData();
1369
1370
  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) {
1370
- let e = Math.round(N(i, this.getDisplayData()));
1371
+ let e = Math.round(j(i, this.getDisplayData()));
1371
1372
  this.viewport.prependBars(e - r);
1372
1373
  }
1373
1374
  return this.updateViewportAndRender(), t ?? a;
@@ -1398,17 +1399,17 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1398
1399
  }
1399
1400
  checkHistory() {
1400
1401
  this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
1401
- if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || L(this.options.chartType)) return;
1402
+ if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || P(this.options.chartType)) return;
1402
1403
  let { visibleRange: e, chartRect: t } = this.viewport.getState();
1403
1404
  if (t.width <= 0) return;
1404
1405
  let { from: n, to: r } = e;
1405
- this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Rn, r - n));
1406
+ this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(zn, r - n));
1406
1407
  }));
1407
1408
  }
1408
1409
  useStreamHistory(e, t) {
1409
1410
  if (this.hostHistoryLoader) return;
1410
- let n = Ft(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1411
- if (!r || i === null || oe(i) !== null) {
1411
+ let n = Bt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1412
+ if (!r || i === null || se(i) !== null) {
1412
1413
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
1413
1414
  return;
1414
1415
  }
@@ -1474,17 +1475,17 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1474
1475
  });
1475
1476
  }
1476
1477
  applyTimeSpacing() {
1477
- let e = !this.tickStream && !L(this.options.chartType);
1478
+ let e = !this.tickStream && !P(this.options.chartType);
1478
1479
  this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
1479
1480
  }
1480
1481
  setChartTypeOptions(e) {
1481
1482
  this.chartTypeOptions = {
1482
1483
  ...this.chartTypeOptions,
1483
- ...y(e)
1484
+ ...x(e)
1484
1485
  }, this.displayDataCache = null, this.updateViewportAndRender(!0), this.markStateChanged();
1485
1486
  }
1486
1487
  getChartTypeOptions() {
1487
- return y(this.chartTypeOptions);
1488
+ return x(this.chartTypeOptions);
1488
1489
  }
1489
1490
  setExtendedHours(e) {
1490
1491
  e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
@@ -1493,7 +1494,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1493
1494
  return this.extendedHours;
1494
1495
  }
1495
1496
  sessionKeep(e) {
1496
- return this.extendedHours ? null : Bt(this.symbolInfo, e);
1497
+ return this.extendedHours ? null : Gt(this.symbolInfo, e);
1497
1498
  }
1498
1499
  shownBars(e) {
1499
1500
  let t = this.sessionKeep(e);
@@ -1534,7 +1535,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1534
1535
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
1535
1536
  }
1536
1537
  setShapes(e) {
1537
- let t = Gn(e);
1538
+ let t = Kn(e);
1538
1539
  t.tagRadius !== void 0 && (this.themeManager.setShape({
1539
1540
  ...this.themeManager.getTheme().shape,
1540
1541
  ...t
@@ -1565,7 +1566,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1565
1566
  return this.recordIndicators(void 0, () => this.addIndicatorNow(e, t, n, r));
1566
1567
  }
1567
1568
  addIndicatorNow(e, t, n, r) {
1568
- if (!this.features.indicators || this.features.indicatorIds.length > 0 && !this.features.indicatorIds.includes(e)) return null;
1569
+ if (!this.isIndicatorAllowed(e)) return null;
1569
1570
  let i = this.indicatorEngine.getAvailableIndicators().find((t) => t.id === e), a = i ? this.paneFor(i, t, r.pane) : null, o = this.indicatorEngine.addIndicator(e, t, this.dataManager.getData(), {
1570
1571
  ...a ? { pane: a } : {},
1571
1572
  ...r.scale === "left" ? { scale: "left" } : {},
@@ -1579,7 +1580,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1579
1580
  setSymbolSeries(e, t) {
1580
1581
  e = e.trim(), this.symbolSeries.set(e, t), this.requestedSymbols.delete(e);
1581
1582
  let n = this.dataManager.getData(), r = !1;
1582
- 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);
1583
+ for (let t of this.indicatorEngine.getActiveIndicators()) !O.has(t.id) || String(t.params.symbol ?? "").trim() !== e.trim() || (this.indicatorEngine.updateIndicator(t.instanceId, {}, n), r = !0);
1583
1584
  r && (this.announceIndicatorUpdate(0), this.updateViewportAndRender());
1584
1585
  }
1585
1586
  forgetUnreadSymbols() {
@@ -1593,27 +1594,27 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1593
1594
  let e = /* @__PURE__ */ new Set();
1594
1595
  for (let t of this.indicatorEngine.getActiveIndicators()) {
1595
1596
  let n = t.params.symbol;
1596
- W.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1597
+ O.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1597
1598
  }
1598
1599
  return [...e];
1599
1600
  }
1600
1601
  requestMissingSymbols(e) {
1601
1602
  this.forgetUnreadSymbols();
1602
- let t = this.indicatorEngine.getIndicatorConfig(e), n = t && W.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1603
+ let t = this.indicatorEngine.getIndicatorConfig(e), n = t && O.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1603
1604
  !n || this.symbolSeries.has(n) || this.requestedSymbols.has(n) || (this.requestedSymbols.add(n), this.eventBus.emit("symbolSeriesRequest", { symbol: n }));
1604
1605
  }
1605
1606
  updateIndicator(e, t) {
1606
1607
  this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
1607
1608
  }
1608
1609
  updateIndicatorNow(e, t) {
1609
- let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? M(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1610
+ let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? A(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1610
1611
  this.indicatorEngine.updateIndicator(e, t, this.dataManager.getData()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
1611
1612
  instanceId: e,
1612
1613
  change: "params"
1613
1614
  }), this.requestMissingSymbols(e);
1614
1615
  let a = this.indicatorEngine.getIndicatorConfig(e);
1615
1616
  if (n?.placement === "overlay" && a && r && a.params[r] !== i) {
1616
- let t = v(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : v(i) ? null : a.pane ?? null;
1617
+ let t = y(a.params[r]), n = t ? this.paneHostOf(t.instanceId, e) : y(i) ? null : a.pane ?? null;
1617
1618
  (n ?? void 0) !== a.pane && (this.indicatorEngine.setPane(e, n), this.eventBus.emit("indicatorChange", {
1618
1619
  instanceId: e,
1619
1620
  change: "pane"
@@ -1624,7 +1625,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1624
1625
  paneFor(e, t, n, r) {
1625
1626
  if (n) return this.paneHostOf(n, r);
1626
1627
  if (e.placement !== "overlay") return null;
1627
- let i = M(e), a = i ? v(t[i]) : null;
1628
+ let i = A(e), a = i ? y(t[i]) : null;
1628
1629
  return a ? this.paneHostOf(a.instanceId, r) : null;
1629
1630
  }
1630
1631
  paneHostOf(e, t) {
@@ -1715,7 +1716,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1715
1716
  this.indicatorEngine.setStyleDefaults(e, null);
1716
1717
  return;
1717
1718
  }
1718
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : b(n);
1719
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ne(n);
1719
1720
  this.indicatorEngine.setStyleDefaults(e, {
1720
1721
  ...r,
1721
1722
  ...i ? { plots: i } : {}
@@ -1723,7 +1724,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1723
1724
  }
1724
1725
  setPaneStyle(e, t) {
1725
1726
  let n = this.paneOf(e);
1726
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? x(t) : null));
1727
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? re(t) : null));
1727
1728
  }
1728
1729
  setPaneStyleNow(e, t) {
1729
1730
  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());
@@ -1742,8 +1743,8 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1742
1743
  return this.pluginManager;
1743
1744
  }
1744
1745
  static indicators() {
1745
- let e = new E();
1746
- return A(e), e.getAvailableIndicators();
1746
+ let e = new Le();
1747
+ return At(e), e.getAvailableIndicators();
1747
1748
  }
1748
1749
  setPanelPosition(e, t) {
1749
1750
  this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
@@ -1766,8 +1767,8 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1766
1767
  paneMoveHost(e, t) {
1767
1768
  let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
1768
1769
  if (!n || !r) return;
1769
- let i = M(r);
1770
- if (r.placement === "overlay" && i && v(n.params[i])) return;
1770
+ let i = A(r);
1771
+ if (r.placement === "overlay" && i && y(n.params[i])) return;
1771
1772
  if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
1772
1773
  if (t === "new") {
1773
1774
  let t = this.layoutManager.getPanels().some((t) => t.id === e);
@@ -1873,14 +1874,14 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1873
1874
  return this.features.legend ? e + this.chartLegend.getHeight() : e;
1874
1875
  }
1875
1876
  isTimeAligned() {
1876
- return L(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1877
+ return P(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1877
1878
  }
1878
1879
  roundPrice(e) {
1879
1880
  if (!Number.isFinite(e)) return e;
1880
1881
  let t = this.stepAt(e);
1881
- if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ae(t)));
1882
+ if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(oe(t)));
1882
1883
  let { min: n, max: r } = this.viewport.getState().priceRange;
1883
- return Number(e.toFixed(this.marketPricePrecision ?? s(n, r)));
1884
+ return Number(e.toFixed(this.marketPricePrecision ?? c(n, r)));
1884
1885
  }
1885
1886
  lastClose() {
1886
1887
  let e = this.dataManager.getData();
@@ -1893,7 +1894,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1893
1894
  getPriceStep(e) {
1894
1895
  let t = this.stepAt(e ?? this.lastClose());
1895
1896
  if (t !== void 0) return t;
1896
- let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ?? s(n, r);
1897
+ let { min: n, max: r } = this.viewport.getState().priceRange, i = this.marketPricePrecision ?? c(n, r);
1897
1898
  return Number((10 ** -i).toFixed(i));
1898
1899
  }
1899
1900
  setPriceFormat(e) {
@@ -1903,7 +1904,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1903
1904
  return this.priceFormatter;
1904
1905
  }
1905
1906
  applyPriceFormat(e) {
1906
- this.priceFormatter = ee(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);
1907
+ this.priceFormatter = ee(e), this.priceUnit = e && typeof e != "function" ? m(e) : null, this.viewport.setPriceFormat(this.priceFormatter, this.priceUnit), this.crosshairTooltip.setPriceFormatter(this.priceFormatter), this.pinnedTooltip.setPriceFormatter(this.priceFormatter);
1907
1908
  }
1908
1909
  setTimeFormatter(e) {
1909
1910
  this.applyTimeFormatter(e), this.engine.requestRender();
@@ -1914,7 +1915,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1914
1915
  formatPrice(e) {
1915
1916
  if (this.priceFormatter) return this.priceFormatter(e);
1916
1917
  let { min: t, max: n } = this.viewport.getState().priceRange;
1917
- return d(e, this.marketPricePrecision ?? s(t, n), this.numberLocale);
1918
+ return p(e, this.marketPricePrecision ?? c(t, n), this.numberLocale);
1918
1919
  }
1919
1920
  setDrawingTool(e) {
1920
1921
  this.features.drawings && (e && this.features.drawingTools.length > 0 && !this.features.drawingTools.includes(e) || (e && this.setZoomAreaMode(!1), this.drawingManager.setActiveTool(e)));
@@ -1959,7 +1960,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
1959
1960
  }
1960
1961
  autoFib() {
1961
1962
  if (!this.features.drawings) return null;
1962
- let e = this.getDisplayData(), t = this.viewport.getState(), n = yt(e, t.visibleRange.from, t.visibleRange.to);
1963
+ let e = this.getDisplayData(), t = this.viewport.getState(), n = xt(e, t.visibleRange.from, t.visibleRange.to);
1963
1964
  return n ? this.addDrawing({
1964
1965
  type: "fibRetracement",
1965
1966
  anchors: [n[0], n[1]]
@@ -2034,7 +2035,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2034
2035
  recordUndo(e) {
2035
2036
  if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
2036
2037
  let t = performance.now(), n = this.undoRedoManager.last();
2037
- if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Ln) {
2038
+ if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Rn) {
2038
2039
  this.undoRedoManager.replaceLast({
2039
2040
  ...n,
2040
2041
  custom: {
@@ -2081,7 +2082,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2081
2082
  x: t.x,
2082
2083
  y: t.y
2083
2084
  };
2084
- if ((e === "plot" || e === "priceAxis") && (r.price = Lt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = F(t.x, n)), e === "pane") {
2085
+ if ((e === "plot" || e === "priceAxis") && (r.price = Ht(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = M(t.x, n)), e === "pane") {
2085
2086
  let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
2086
2087
  e && (r.pane = e.instanceId);
2087
2088
  }
@@ -2107,7 +2108,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2107
2108
  ...this.viewport.getState(),
2108
2109
  data: this.getDisplayData()
2109
2110
  };
2110
- this.setVisibleRange(F(e.x0, t), F(e.x1, t));
2111
+ this.setVisibleRange(M(e.x0, t), M(e.x1, t));
2111
2112
  }
2112
2113
  lockAllDrawings() {
2113
2114
  this.drawingManager.lockAllDrawings();
@@ -2152,7 +2153,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2152
2153
  for (let e of this.indicatorEngine.getActiveIndicators()) {
2153
2154
  let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
2154
2155
  if (!t) continue;
2155
- let r = Jt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2156
+ let r = $t(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2156
2157
  key: e,
2157
2158
  title: e
2158
2159
  }));
@@ -2219,6 +2220,18 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2219
2220
  change: "visible"
2220
2221
  }));
2221
2222
  }
2223
+ setIndicatorIntervals(e, t) {
2224
+ this.recordIndicators(e, () => this.setIndicatorIntervalsNow(e, t));
2225
+ }
2226
+ setIndicatorIntervalsNow(e, t) {
2227
+ this.indicatorEngine.setIntervals(e, t) && (this.updateViewportAndRender(), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
2228
+ instanceId: e,
2229
+ change: "intervals"
2230
+ }));
2231
+ }
2232
+ getIndicatorIntervals(e) {
2233
+ return this.indicatorEngine.getIntervals(e);
2234
+ }
2222
2235
  getIndicatorConfig(e) {
2223
2236
  let t = this.indicatorEngine.getIndicatorConfig(e);
2224
2237
  return t ? {
@@ -2230,7 +2243,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2230
2243
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2231
2244
  }
2232
2245
  updateIndicatorStyleNow(e, t) {
2233
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : b(n);
2246
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ne(n);
2234
2247
  this.indicatorEngine.updateIndicatorStyle(e, {
2235
2248
  ...r,
2236
2249
  ...i ? { plots: i } : {}
@@ -2340,8 +2353,8 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2340
2353
  this.features.trading && this.tradingManager.setConfig(e);
2341
2354
  }
2342
2355
  async connect(e) {
2343
- if (!j(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2344
- this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new at(), this.streamManager.on("snapshot", (t) => {
2356
+ if (!jt(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2357
+ this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new st(), this.streamManager.on("snapshot", (t) => {
2345
2358
  let n = `${this.currentSymbol}|${this.streamTimeframe}`;
2346
2359
  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);
2347
2360
  }), this.streamManager.on("barClose", (e) => {
@@ -2390,26 +2403,37 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2390
2403
  }), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
2391
2404
  let t = this.streamManager;
2392
2405
  if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
2393
- let n = se(e.timeframe);
2406
+ let n = ce(e.timeframe);
2394
2407
  this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
2395
2408
  this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
2396
2409
  }, 1e3);
2397
2410
  }
2398
2411
  setStreamTarget(e, t) {
2399
- let n = this.announcedSymbol, r = this.announcedTimeframe;
2400
- this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = oe(t) !== null, this.applyTimeSpacing(), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2412
+ let n = this.announcedSymbol;
2413
+ this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = se(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2401
2414
  symbol: e,
2402
2415
  previous: n
2403
- })), t !== r && (this.announcedTimeframe = t, this.eventBus.emit("timeframeChange", {
2404
- timeframe: t,
2405
- previous: r
2416
+ })), this.useTimeframe(t);
2417
+ }
2418
+ setDataTimeframe(e) {
2419
+ this.streamManager || (this.useTimeframe(e), this.engine.requestRender(r.Hover));
2420
+ }
2421
+ useTimeframe(e) {
2422
+ let t = this.announcedTimeframe;
2423
+ this.chartLegend.setTimeframe(e ?? ""), this.indicatorEngine.setTimeframe(e) && this.updateViewportAndRender(), e !== t && (this.announcedTimeframe = e, e && this.eventBus.emit("timeframeChange", {
2424
+ timeframe: e,
2425
+ previous: t
2406
2426
  }));
2407
2427
  }
2408
2428
  async switchStream(e, t) {
2409
2429
  if (!this.streamManager) return;
2410
2430
  let n = this.streamAdapter;
2411
- if (n && !j(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2412
- 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);
2431
+ if (n && !jt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2432
+ this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(ce(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
2433
+ }
2434
+ isIndicatorAllowed(e) {
2435
+ let t = this.features.indicatorIds;
2436
+ return this.features.indicators && (t.length === 0 || t.includes(e));
2413
2437
  }
2414
2438
  isTimeframeAllowed(e) {
2415
2439
  let t = this.features.timeframes;
@@ -2424,7 +2448,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2424
2448
  }
2425
2449
  connectExecution(e, t = {}) {
2426
2450
  if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
2427
- this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = jn(e, {
2451
+ this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Mn(e, {
2428
2452
  onIntent: (e, t) => {
2429
2453
  let n = (e) => t(e.payload);
2430
2454
  return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
@@ -2515,18 +2539,18 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2515
2539
  goToTime(e) {
2516
2540
  let t = this.getDisplayData();
2517
2541
  if (t.length === 0 || !Number.isFinite(e)) return -1;
2518
- let n = Math.max(0, Math.min(t.length - 1, Math.floor(N(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2542
+ let n = Math.max(0, Math.min(t.length - 1, Math.floor(j(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2519
2543
  return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
2520
2544
  }
2521
2545
  setVisibleRangePreset(e) {
2522
2546
  let t = this.getDisplayData();
2523
2547
  if (t.length === 0) return;
2524
- let n = t.length - 1, r = c(t), i = Tt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2548
+ let n = t.length - 1, r = l(t), i = Dt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2525
2549
  if (a === null || a < t[0].time) {
2526
2550
  this.fitContent();
2527
2551
  return;
2528
2552
  }
2529
- let o = N(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2553
+ let o = j(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2530
2554
  this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
2531
2555
  }
2532
2556
  scrollToEnd() {
@@ -2540,7 +2564,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2540
2564
  setVisibleRange(e, t) {
2541
2565
  let n = this.getDisplayData();
2542
2566
  if (n.length === 0) return;
2543
- let r = N(Math.min(e, t), n), i = N(Math.max(e, t), n);
2567
+ let r = j(Math.min(e, t), n), i = j(Math.max(e, t), n);
2544
2568
  this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
2545
2569
  }
2546
2570
  suspend() {
@@ -2646,7 +2670,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2646
2670
  this.applyStyle(e, t.layer ?? "host", !0);
2647
2671
  }
2648
2672
  setOverrides(e, t = {}) {
2649
- let n = t.layer ?? "host", { overrides: r, rejected: i } = ne(e);
2673
+ let n = t.layer ?? "host", { overrides: r, rejected: i } = b(e);
2650
2674
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
2651
2675
  let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
2652
2676
  this.themeManager.setOverrides(a, n) && this.styleChanged(n);
@@ -2665,7 +2689,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2665
2689
  return this.themeManager.getStyleValue(e);
2666
2690
  }
2667
2691
  applyStyle(e, t, n) {
2668
- let { overrides: r, rejected: i } = ne(e);
2692
+ let { overrides: r, rejected: i } = b(e);
2669
2693
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
2670
2694
  }
2671
2695
  styleChanged(e) {
@@ -2695,7 +2719,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2695
2719
  e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
2696
2720
  }
2697
2721
  setCrosshairTime(e) {
2698
- let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(N(e, t));
2722
+ let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(j(e, t));
2699
2723
  n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
2700
2724
  }
2701
2725
  getData() {
@@ -2708,7 +2732,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2708
2732
  return this.gridRenderer.isVisible();
2709
2733
  }
2710
2734
  setVolumeVisible(e) {
2711
- this.volumeRenderer.setVisible(e), this.engine.requestRender(r.Main);
2735
+ this.volumeRenderer.setVisible(e), this.updateViewportAndRender();
2712
2736
  }
2713
2737
  setVolumeProfileVisible(e) {
2714
2738
  this.volumeProfile.setVisible(e), this.engine.requestRender(r.Main);
@@ -2757,7 +2781,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2757
2781
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2758
2782
  }
2759
2783
  setTimezone(e) {
2760
- Pn(e), this.timezoneSetting = e, this.applyTimezone();
2784
+ Fn(e), this.timezoneSetting = e, this.applyTimezone();
2761
2785
  }
2762
2786
  getTimezone() {
2763
2787
  return this.timezoneSetting;
@@ -2766,14 +2790,14 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2766
2790
  return this.displayTz;
2767
2791
  }
2768
2792
  applyTimezone() {
2769
- let e = this.symbolInfo?.timezone, t = this.timezoneSetting === "exchange" ? e && m(e) ? e : "UTC" : this.timezoneSetting;
2793
+ let e = this.symbolInfo?.timezone, t = this.timezoneSetting === "exchange" ? e && g(e) ? e : "UTC" : this.timezoneSetting;
2770
2794
  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();
2771
2795
  }
2772
2796
  setSymbolInfo(e) {
2773
2797
  this.symbolInfo = e ? {
2774
2798
  ...e,
2775
2799
  sessions: e.sessions?.map((e) => ({ ...e }))
2776
- } : null, this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
2800
+ } : null, this.chartLegend.setExchange(this.symbolInfo?.exchange ?? ""), this.engine.requestRender(r.Hover), this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
2777
2801
  let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
2778
2802
  let t = S(e.start), n = S(e.end);
2779
2803
  return t === null || n === null ? [] : [{
@@ -2781,7 +2805,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2781
2805
  endMinute: n
2782
2806
  }];
2783
2807
  }), n = this.symbolInfo?.timezone;
2784
- this.sessionShading.replaceConfig(t.length > 0 && n && m(n) ? {
2808
+ this.sessionShading.replaceConfig(t.length > 0 && n && g(n) ? {
2785
2809
  timeZone: n,
2786
2810
  windows: t,
2787
2811
  startMinute: t[0].startMinute,
@@ -2832,7 +2856,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2832
2856
  return this.sessionShading.isVisible();
2833
2857
  }
2834
2858
  setSessionShadingConfig(e) {
2835
- this.hostSessionHours = Ct(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2859
+ this.hostSessionHours = Tt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2836
2860
  }
2837
2861
  setTooltipVisible(e) {
2838
2862
  e || this.crosshairTooltip.hide();
@@ -2851,11 +2875,11 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
2851
2875
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2852
2876
  }
2853
2877
  async takeGpu(e, t, n) {
2854
- let { gpu: r, reason: i } = await St(e);
2855
- return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? bt() > 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());
2878
+ let { gpu: r, reason: i } = await wt(e);
2879
+ 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());
2856
2880
  }
2857
2881
  waitForGpu(e) {
2858
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? Pt(e) : null;
2882
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? zt(e) : null;
2859
2883
  }
2860
2884
  getRenderer() {
2861
2885
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -3029,23 +3053,23 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3029
3053
  };
3030
3054
  }
3031
3055
  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;
3032
- r !== void 0 && l === void 0 ? l = Jn(s, r) : c && l !== void 0 && (l += t);
3056
+ r !== void 0 && l === void 0 ? l = Xn(s, r) : c && l !== void 0 && (l += t);
3033
3057
  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;
3034
3058
  l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
3035
- let f = n ? Qn(n, d) : null;
3059
+ let f = n ? er(n, d) : null;
3036
3060
  this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
3037
3061
  try {
3038
3062
  this.replayManager.load(f ?? d);
3039
3063
  } finally {
3040
3064
  this.replayRestarting = !1;
3041
3065
  }
3042
- f && o.startIndex !== void 0 && (o.startIndex = tr(f, d, o.startIndex)), this.replayBarUnsub?.();
3066
+ f && o.startIndex !== void 0 && (o.startIndex = rr(f, d, o.startIndex)), this.replayBarUnsub?.();
3043
3067
  let p = -1, m = -1, h = null, g = f ?? d;
3044
3068
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
3045
3069
  let t = e, n = d[e];
3046
3070
  if (f) {
3047
3071
  let r = f[e];
3048
- t = er(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? rr(h, r) : nr(d[t], f, e), n = h;
3072
+ t = nr(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? ar(h, r) : ir(d[t], f, e), n = h;
3049
3073
  }
3050
3074
  m = e;
3051
3075
  let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
@@ -3097,20 +3121,20 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3097
3121
  return;
3098
3122
  }
3099
3123
  if (i.time <= n.fedTime) return;
3100
- let a = e.slice(Yn(e, n.fedTime), t + 1);
3124
+ let a = e.slice(Zn(e, n.fedTime), t + 1);
3101
3125
  n.fedTime = i.time;
3102
- let o = Math.ceil(a.length / qn);
3103
- for (let e = 0; e < a.length; e += o) for (let [t, n] of Xn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3126
+ let o = Math.ceil(a.length / Yn);
3127
+ for (let e = 0; e < a.length; e += o) for (let [t, n] of Qn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3104
3128
  this.tradingManager.setCurrentPrice(i.close);
3105
3129
  }
3106
3130
  getReplayBarIndex() {
3107
3131
  if (!this.replaySession) return -1;
3108
3132
  let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
3109
- return t && this.replayCoarse ? er(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3133
+ return t && this.replayCoarse ? nr(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3110
3134
  }
3111
3135
  replaySeekToBar(e) {
3112
3136
  let t = this.replayStepsSeries;
3113
- this.replaySeek(t && this.replayCoarse ? tr(t, this.replayCoarse, e) : e);
3137
+ this.replaySeek(t && this.replayCoarse ? rr(t, this.replayCoarse, e) : e);
3114
3138
  }
3115
3139
  replayPause() {
3116
3140
  this.replayManager.pause();
@@ -3142,10 +3166,10 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3142
3166
  data: this.getDisplayData()
3143
3167
  }, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
3144
3168
  for (let e of t.anchors) {
3145
- let t = Ot(e.time, n), r = wt(e.price, n);
3169
+ let t = Mt(e.time, n), r = Et(e.price, n);
3146
3170
  i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
3147
3171
  }
3148
- return Bn.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Vn.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 ? {
3172
+ return Vn.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Hn.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 ? {
3149
3173
  x: i,
3150
3174
  y: o,
3151
3175
  width: a - i,
@@ -3186,14 +3210,14 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3186
3210
  });
3187
3211
  }
3188
3212
  restoreIndicators(e, t) {
3189
- let n = Un(e), r = /* @__PURE__ */ new Map();
3213
+ let n = Wn(e), r = /* @__PURE__ */ new Map();
3190
3214
  this.unrestoredIndicators = [];
3191
3215
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3192
3216
  if (t) {
3193
3217
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3194
3218
  for (let n of t) {
3195
3219
  let t = e.get(n.instanceId);
3196
- t && Wn(n, t) && o.add(n.instanceId);
3220
+ t && Gn(n, t) && o.add(n.instanceId);
3197
3221
  }
3198
3222
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3199
3223
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3201,8 +3225,8 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3201
3225
  let s = (e) => {
3202
3226
  let t = { ...e };
3203
3227
  for (let [e, n] of Object.entries(t)) {
3204
- let i = v(n), a = i && r.get(i.instanceId);
3205
- a && (t[e] = p(a, i.key));
3228
+ let i = y(n), a = i && r.get(i.instanceId);
3229
+ a && (t[e] = h(a, i.key));
3206
3230
  }
3207
3231
  return t;
3208
3232
  };
@@ -3253,7 +3277,9 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3253
3277
  let o = this.indicatorEngine.getIndicatorConfig(e);
3254
3278
  (t.visible ?? !0) !== (o?.visible ?? !0) && this.setIndicatorVisible(e, t.visible ?? !0);
3255
3279
  let s = t.levels ?? null;
3256
- JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s), this.setPaneStyleNow(e, t.paneStyle ? x(t.paneStyle) : null);
3280
+ JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s);
3281
+ let c = t.intervals ?? null;
3282
+ JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? re(t.paneStyle) : null);
3257
3283
  }
3258
3284
  restorePanes(e) {
3259
3285
  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, {
@@ -3280,6 +3306,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3280
3306
  levels: i?.levels?.slice(),
3281
3307
  pane: n.pane,
3282
3308
  scale: i?.scale,
3309
+ ...i?.intervals ? { intervals: this.indicatorEngine.getIntervals(n.instanceId) ?? void 0 } : {},
3283
3310
  ...r && this.paneStyles.has(n.instanceId) ? { paneStyle: { ...this.paneStyles.get(n.instanceId) } } : {},
3284
3311
  ...r ? {
3285
3312
  paneSize: r.size,
@@ -3322,6 +3349,29 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3322
3349
  });
3323
3350
  }
3324
3351
  }
3352
+ beginIndicatorEdit(e) {
3353
+ this.endIndicatorEdit(), this.features.drawingUndoRedo && (this.indicatorEdit = {
3354
+ subject: e,
3355
+ before: this.getIndicatorSetup()
3356
+ }, this.indicatorHistoryDepth++);
3357
+ }
3358
+ endIndicatorEdit() {
3359
+ let e = this.indicatorEdit;
3360
+ if (!e) return;
3361
+ this.indicatorEdit = null, this.indicatorHistoryDepth--;
3362
+ let t = this.getIndicatorSetup();
3363
+ JSON.stringify(t) !== JSON.stringify(e.before) && this.undoRedoManager.push({
3364
+ type: "indicators",
3365
+ before: null,
3366
+ after: null,
3367
+ indicators: {
3368
+ before: e.before,
3369
+ after: t,
3370
+ subject: e.subject,
3371
+ at: performance.now()
3372
+ }
3373
+ });
3374
+ }
3325
3375
  withoutIndicatorHistory(e) {
3326
3376
  this.indicatorHistoryDepth++;
3327
3377
  try {
@@ -3334,7 +3384,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3334
3384
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3335
3385
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3336
3386
  if (JSON.stringify(n) === JSON.stringify(i)) return r;
3337
- let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Ln && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3387
+ let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Rn && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3338
3388
  type: "indicators",
3339
3389
  before: null,
3340
3390
  after: null
@@ -3378,7 +3428,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3378
3428
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3379
3429
  return r ? r + e.slice(t) : e;
3380
3430
  }, r = t(e.channel), i = {
3381
- ...Et(e),
3431
+ ...Ot(e),
3382
3432
  ...e.target ? { target: t(e.target) } : {}
3383
3433
  };
3384
3434
  if (!e.expired) {
@@ -3410,10 +3460,10 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3410
3460
  this.loadState(C.serialize(e));
3411
3461
  }
3412
3462
  setLocale(e) {
3413
- ie(e), this.engine.requestRender();
3463
+ ae(e), this.engine.requestRender();
3414
3464
  }
3415
3465
  setNumberLocale(e) {
3416
- this.numberLocale = e, this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.timeAxis.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.sessionBreaks.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
3466
+ this.numberLocale = e, this.viewport.setNumberLocale(e), this.priceAxis.setLocale(e), this.leftPriceAxis.setLocale(e), this.crosshairHandler.setLocale(e), this.timeAxis.setLocale(e), this.chartLegend.setLocale(e), this.crosshairTooltip.setLocale(e), this.sessionBreaks.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
3417
3467
  }
3418
3468
  getNumberLocale() {
3419
3469
  return this.numberLocale;
@@ -3425,23 +3475,21 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3425
3475
  candleUp: e.colorScheme.up,
3426
3476
  candleDown: e.colorScheme.down,
3427
3477
  candleUpWick: e.colorScheme.up,
3428
- candleDownWick: e.colorScheme.down,
3429
- volumeUp: ce(e.colorScheme.up),
3430
- volumeDown: ce(e.colorScheme.down)
3478
+ candleDownWick: e.colorScheme.down
3431
3479
  };
3432
3480
  this.themeManager.setTheme(t);
3433
3481
  }
3434
3482
  e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
3435
3483
  }
3436
3484
  applyPricePrecision(e) {
3437
- this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? Fn), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3485
+ this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e), this.tradeZoneManager.setPricePrecision(e), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
3438
3486
  }
3439
3487
  getMarket() {
3440
3488
  return this.marketConfig;
3441
3489
  }
3442
3490
  getPriceLimits() {
3443
3491
  let e = this.marketConfig;
3444
- return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : u(e.priceLimits.referencePrice, e);
3492
+ return !e?.priceLimits?.enabled || !e.priceLimits.referencePrice ? null : d(e.priceLimits.referencePrice, e);
3445
3493
  }
3446
3494
  setPriceLimits(e) {
3447
3495
  this.marketConfig?.priceLimits && (this.marketConfig = {
@@ -3456,7 +3504,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3456
3504
  return this.features;
3457
3505
  }
3458
3506
  setFeatures(e) {
3459
- Object.assign(this.features, e), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), e.grid !== void 0 && this.engine.requestRender(r.Background), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.engine.requestRender(r.Main)), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
3507
+ Object.assign(this.features, e), (e.crosshair === !1 || e.crosshairTooltip === !1) && this.crosshairTooltip.hide(), e.grid !== void 0 && this.engine.requestRender(r.Background), e.volume !== void 0 && (this.volumeRenderer.setVisible(e.volume), this.updateViewportAndRender()), e.drawings === !1 && this.drawingManager.setActiveTool(null), e.trading === !1 && (this.tradingManager.setOrders([]), this.tradingManager.setPositions([])), e.keyboard !== void 0 && this.keyboardHandler?.setEnabled(e.keyboard), this.engine.requestRender();
3460
3508
  }
3461
3509
  resize() {
3462
3510
  let e = this.engine.dprManager.readContainerSize();
@@ -3471,8 +3519,8 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3471
3519
  this.disposed = !0, this.stopWatchingVisibility?.(), this.stopWatchingVisibility = null, this.waitForGpu(null), this.countdownInterval && clearInterval(this.countdownInterval), this.history.setLoader(null), this.disableAutoSave(), this.disconnectStream(), this.disconnectExecution(), this.onWindowKeyDown &&= (window.removeEventListener("keydown", this.onWindowKeyDown), null), this.keyboardHandler = null, this.a11y?.destroy(), this.a11y = null, this.interactionManager.detach(), this.tradingManager.destroy(), this.animator.dispose(), this.crosshairTooltip.destroy(), this.pinnedTooltip.destroy(), this.replayRestarting = !0, this.replayManager.dispose(), this.alertManager.dispose(), this.undoRedoManager.clear(), this.engine.destroy(), this.eventBus.destroy(), this.container.innerHTML = "";
3472
3520
  }
3473
3521
  createChartRenderer(e) {
3474
- let t = en(e, (e) => this.pluginManager.getChartType(e));
3475
- return t instanceof T && t.setPriceText((e) => this.formatPrice(e)), t;
3522
+ let t = rn(e, (e) => this.pluginManager.getChartType(e));
3523
+ return t instanceof Fe && t.setPriceText((e) => this.formatPrice(e)), t;
3476
3524
  }
3477
3525
  crosshairSeries() {
3478
3526
  return this.isTimeAligned() ? this.dataManager.getData() : this.getDisplayData();
@@ -3481,8 +3529,8 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3481
3529
  if (this.displayDataCache) return this.displayDataCache;
3482
3530
  let e = this.dataManager.getData();
3483
3531
  if (e.length === 0) return e;
3484
- let t = tn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3485
- return this.chartRenderer instanceof D && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(Qt(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3532
+ let t = an(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3533
+ return this.chartRenderer instanceof E && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(F(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3486
3534
  }
3487
3535
  recalcIndicatorsFrom(e, t) {
3488
3536
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3525,23 +3573,24 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3525
3573
  }
3526
3574
  applyDataToViewport(e = !1) {
3527
3575
  let t = this.getDisplayData(), n = this.options.autoScale !== !1;
3528
- this.viewport.updateData(t, n && !e), e && (this.viewport.scrollToEnd(), n && this.viewport.updateData(t, !0));
3576
+ this.viewport.updateData(t, !1), e && (this.viewport.scrollToEnd(), this.viewport.updateData(t, !1));
3529
3577
  let r = this.viewport.getState();
3530
3578
  if (t.length > 0) {
3531
3579
  let e = Math.max(0, Math.min(r.visibleRange.from, t.length - 1));
3532
3580
  this.viewport.setScaleBaseline(t[e]?.close);
3533
3581
  }
3534
- if (n) {
3535
- let e = Kn(this.indicatorEngine.getOverlayPriceRange(r.visibleRange.from, Math.min(r.visibleRange.to, t.length - 1)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(t, r) : null);
3536
- if (e) {
3537
- let t = r.priceRange, n = Math.min(t.min, e.min), i = Math.max(t.max, e.max);
3538
- if (n < t.min || i > t.max) {
3539
- let e = _(n, i, .02, this.viewport.isLogScale());
3540
- this.viewport.setPriceRange(e.min, e.max);
3541
- }
3542
- }
3543
- }
3544
- return t;
3582
+ return n && this.fitPriceScale(t, r), t;
3583
+ }
3584
+ fitPriceScale(e, t) {
3585
+ if (e.length === 0) return;
3586
+ let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i = Jn(Jn(f(e, n, r, 0), this.indicatorEngine.getOverlayPriceRange(n, r)), this.features.compareSymbols ? this.compareRenderer.getPriceRange(e, t) : null), a = this.features.volume && this.volumeRenderer.isVisible() && qn(e, n, r) ? this.volumeRenderer.getHeightRatio() + Ln : T;
3587
+ this.viewport.setScaleMargins(this.viewport.isInvertScale() ? {
3588
+ top: a,
3589
+ bottom: T
3590
+ } : {
3591
+ top: T,
3592
+ bottom: a
3593
+ }), this.viewport.fitToPrices(i.min, i.max);
3545
3594
  }
3546
3595
  updateViewportAndRender(e = !1) {
3547
3596
  this.resolvedLayoutCache = null, this.panelInfoCache = null, this.layoutManager.setLeftAxisWidth(this.isLeftPriceScaleShown() ? this.leftAxisWidth : 0);
@@ -3556,7 +3605,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3556
3605
  fitLeftAxisWidth() {
3557
3606
  let e = this.leftViewport;
3558
3607
  if (!e) return !1;
3559
- let t = this.themeManager.getTheme(), n = yn({
3608
+ let t = this.themeManager.getTheme(), n = bn({
3560
3609
  min: e.priceRange.min,
3561
3610
  max: e.priceRange.max,
3562
3611
  lastPrice: null,
@@ -3565,12 +3614,12 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3565
3614
  fontFamily: t.font.family,
3566
3615
  fontSizeSmall: t.font.sizeSmall,
3567
3616
  measure: (e, t) => this.measureText(e, t)
3568
- }), r = bn(this.leftAxisWidth, n);
3617
+ }), r = xn(this.leftAxisWidth, n);
3569
3618
  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);
3570
3619
  }
3571
3620
  fitPriceAxisWidth() {
3572
3621
  if (!this.features.priceAxis) return !1;
3573
- let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = yn({
3622
+ let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = bn({
3574
3623
  min: e.min,
3575
3624
  max: e.max,
3576
3625
  lastPrice: this.currentPriceLine.getPrice(),
@@ -3581,7 +3630,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3581
3630
  fontFamily: t.font.family,
3582
3631
  fontSizeSmall: t.font.sizeSmall,
3583
3632
  measure: (e, t) => this.measureText(e, t)
3584
- }), r = bn(this.priceAxisWidth, n);
3633
+ }), r = xn(this.priceAxisWidth, n);
3585
3634
  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);
3586
3635
  }
3587
3636
  measureText(e, t) {
@@ -3625,7 +3674,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3625
3674
  buildPanelRenderInfos() {
3626
3675
  if (this.panelInfoCache) return this.panelInfoCache;
3627
3676
  let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
3628
- 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) ?? { ...Mn }, o = {
3677
+ 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) ?? { ...Nn }, o = {
3629
3678
  x: e.rect.x,
3630
3679
  y: e.rect.y + 20,
3631
3680
  width: e.rect.width,
@@ -3707,7 +3756,7 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3707
3756
  });
3708
3757
  }
3709
3758
  drawOverlayPlugins(e, t) {
3710
- let n = Cn(this.pluginManager.getOverlays(), t);
3759
+ let n = wn(this.pluginManager.getOverlays(), t);
3711
3760
  if (n.length === 0) return;
3712
3761
  let r = {
3713
3762
  viewport: this.viewport.getState(),
@@ -3728,11 +3777,11 @@ var Fn = 2, In = .08, Ln = 800, Rn = 20, zn = 8, Bn = new Set(["horizontalLine",
3728
3777
  };
3729
3778
  }
3730
3779
  };
3731
- function Un(e) {
3780
+ function Wn(e) {
3732
3781
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3733
3782
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3734
3783
  i.add(e.instanceId);
3735
- let o = [e.pane, ...Object.values(e.params).map((e) => v(e)?.instanceId)];
3784
+ let o = [e.pane, ...Object.values(e.params).map((e) => y(e)?.instanceId)];
3736
3785
  for (let e of o) {
3737
3786
  let n = e ? t.get(e) : void 0;
3738
3787
  n && a(n);
@@ -3742,20 +3791,18 @@ function Un(e) {
3742
3791
  for (let t of e) a(t);
3743
3792
  return n;
3744
3793
  }
3745
- function Wn(e, t) {
3794
+ function Gn(e, t) {
3746
3795
  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);
3747
3796
  }
3748
- function Gn(e) {
3797
+ function Kn(e) {
3749
3798
  let t = e.tagRadius;
3750
3799
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3751
3800
  }
3752
- var W = new Set([
3753
- "compareSymbol",
3754
- "spread",
3755
- "correlation",
3756
- "correlationlog"
3757
- ]);
3758
- function Kn(e, t) {
3801
+ function qn(e, t, n) {
3802
+ for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
3803
+ return !1;
3804
+ }
3805
+ function Jn(e, t) {
3759
3806
  return e ? t ? {
3760
3807
  min: Math.min(e.min, t.min),
3761
3808
  max: Math.max(e.max, t.max)
@@ -3776,8 +3823,8 @@ function G(e) {
3776
3823
  bars: e.bars
3777
3824
  };
3778
3825
  }
3779
- var qn = 500;
3780
- function Jn(e, t) {
3826
+ var Yn = 500;
3827
+ function Xn(e, t) {
3781
3828
  let n = 0, r = e.length;
3782
3829
  for (; n < r;) {
3783
3830
  let i = n + r >> 1;
@@ -3785,7 +3832,7 @@ function Jn(e, t) {
3785
3832
  }
3786
3833
  return n;
3787
3834
  }
3788
- function Yn(e, t) {
3835
+ function Zn(e, t) {
3789
3836
  let n = 0, r = e.length;
3790
3837
  for (; n < r;) {
3791
3838
  let i = n + r >> 1;
@@ -3793,20 +3840,20 @@ function Yn(e, t) {
3793
3840
  }
3794
3841
  return n;
3795
3842
  }
3796
- function Xn(e) {
3843
+ function Qn(e) {
3797
3844
  let t = 0, n = 0;
3798
3845
  for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
3799
3846
  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];
3800
3847
  return [...a ? [r, i] : [i, r], [o.close, o.time]];
3801
3848
  }
3802
- function Zn(e) {
3849
+ function $n(e) {
3803
3850
  let t = 0;
3804
3851
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
3805
3852
  return t > 0 ? t : Infinity;
3806
3853
  }
3807
- function Qn(e, t) {
3854
+ function er(e, t) {
3808
3855
  if (t.length === 0) return null;
3809
- let n = t[t.length - 1].time + Zn(t), r = e.filter((e) => $n(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3856
+ let n = t[t.length - 1].time + $n(t), r = e.filter((e) => tr(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3810
3857
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
3811
3858
  if (i.length === 0) return null;
3812
3859
  let a = t.findIndex((e) => e.time >= i[0].time);
@@ -3814,7 +3861,7 @@ function Qn(e, t) {
3814
3861
  let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
3815
3862
  return [...o, ...s];
3816
3863
  }
3817
- function $n(e) {
3864
+ function tr(e) {
3818
3865
  return [
3819
3866
  e.time,
3820
3867
  e.open,
@@ -3823,7 +3870,7 @@ function $n(e) {
3823
3870
  e.close
3824
3871
  ].every(Number.isFinite);
3825
3872
  }
3826
- function er(e, t) {
3873
+ function nr(e, t) {
3827
3874
  let n = 0, r = e.length - 1;
3828
3875
  for (; n < r;) {
3829
3876
  let i = n + r + 1 >> 1;
@@ -3831,22 +3878,22 @@ function er(e, t) {
3831
3878
  }
3832
3879
  return n;
3833
3880
  }
3834
- function tr(e, t, n) {
3881
+ function rr(e, t, n) {
3835
3882
  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;
3836
3883
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
3837
3884
  return Math.max(0, a);
3838
3885
  }
3839
- function nr(e, t, n) {
3886
+ function ir(e, t, n) {
3840
3887
  let r = n;
3841
3888
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
3842
3889
  let i = {
3843
3890
  ...t[r],
3844
3891
  time: e.time
3845
3892
  };
3846
- for (let e = r + 1; e <= n; e++) i = rr(i, t[e]);
3893
+ for (let e = r + 1; e <= n; e++) i = ar(i, t[e]);
3847
3894
  return i;
3848
3895
  }
3849
- function rr(e, t) {
3896
+ function ar(e, t) {
3850
3897
  return {
3851
3898
  time: e.time,
3852
3899
  open: e.open,
@@ -3859,31 +3906,31 @@ function rr(e, t) {
3859
3906
  function K(e, t) {
3860
3907
  let n = e[e.length - 1];
3861
3908
  if (!n) return "append";
3862
- let r = g(t.time), i = g(n.time);
3909
+ let r = v(t.time), i = v(n.time);
3863
3910
  return r > i ? "append" : r === i ? "update" : "stale";
3864
3911
  }
3865
3912
  //#endregion
3866
3913
  //#region src/io/parseOHLCV.ts
3867
- var ir = [
3914
+ var or = [
3868
3915
  "time",
3869
3916
  "timestamp",
3870
3917
  "date",
3871
3918
  "datetime",
3872
3919
  "t"
3873
- ], ar = ["open", "o"], or = ["high", "h"], sr = ["low", "l"], cr = ["close", "c"], lr = [
3920
+ ], sr = ["open", "o"], cr = ["high", "h"], lr = ["low", "l"], ur = ["close", "c"], dr = [
3874
3921
  "volume",
3875
3922
  "vol",
3876
3923
  "v"
3877
3924
  ];
3878
- function ur(e) {
3925
+ function fr(e) {
3879
3926
  let t = e.trim();
3880
- return t ? t[0] === "[" || t[0] === "{" ? dr(t) : fr(t) : {
3927
+ return t ? t[0] === "[" || t[0] === "{" ? pr(t) : mr(t) : {
3881
3928
  data: [],
3882
3929
  rowCount: 0,
3883
3930
  skipped: 0
3884
3931
  };
3885
3932
  }
3886
- function dr(e) {
3933
+ function pr(e) {
3887
3934
  let t;
3888
3935
  try {
3889
3936
  t = JSON.parse(e);
@@ -3893,19 +3940,19 @@ function dr(e) {
3893
3940
  if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
3894
3941
  let n = [], r = 0;
3895
3942
  for (let e of t) {
3896
- let t = Array.isArray(e) ? gr(e) : hr(e);
3943
+ let t = Array.isArray(e) ? vr(e) : _r(e);
3897
3944
  t ? n.push(t) : r++;
3898
3945
  }
3899
- return _r(n, t.length, r);
3946
+ return yr(n, t.length, r);
3900
3947
  }
3901
- function fr(e) {
3948
+ function mr(e) {
3902
3949
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
3903
3950
  if (t.length === 0) return {
3904
3951
  data: [],
3905
3952
  rowCount: 0,
3906
3953
  skipped: 0
3907
3954
  };
3908
- let n = pr(t[0]), r = q(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? mr(r) : {
3955
+ let n = hr(t[0]), r = q(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? gr(r) : {
3909
3956
  time: 0,
3910
3957
  open: 1,
3911
3958
  high: 2,
@@ -3935,9 +3982,9 @@ function fr(e) {
3935
3982
  volume: Number.isFinite(f) ? f : 0
3936
3983
  });
3937
3984
  }
3938
- return _r(o, t.length - +!!i, s);
3985
+ return yr(o, t.length - +!!i, s);
3939
3986
  }
3940
- function pr(e) {
3987
+ function hr(e) {
3941
3988
  let t = {
3942
3989
  ",": 0,
3943
3990
  ";": 0,
@@ -3957,25 +4004,25 @@ function q(e, t) {
3957
4004
  }
3958
4005
  return n.push(r), n;
3959
4006
  }
3960
- function mr(e) {
4007
+ function gr(e) {
3961
4008
  let t = (t) => e.findIndex((e) => t.includes(e));
3962
4009
  return {
3963
- time: t(ir),
3964
- open: t(ar),
3965
- high: t(or),
3966
- low: t(sr),
3967
- close: t(cr),
3968
- volume: t(lr)
4010
+ time: t(or),
4011
+ open: t(sr),
4012
+ high: t(cr),
4013
+ low: t(lr),
4014
+ close: t(ur),
4015
+ volume: t(dr)
3969
4016
  };
3970
4017
  }
3971
- function hr(e) {
4018
+ function _r(e) {
3972
4019
  let t = (t) => {
3973
4020
  for (let n of t) {
3974
4021
  if (e[n] !== void 0) return e[n];
3975
4022
  let t = n.toUpperCase();
3976
4023
  if (e[t] !== void 0) return e[t];
3977
4024
  }
3978
- }, n = Y(String(t(ir) ?? "")), r = Number(t(ar)), i = Number(t(or)), a = Number(t(sr)), o = Number(t(cr)), s = Number(t(lr) ?? 0);
4025
+ }, n = Y(String(t(or) ?? "")), r = Number(t(sr)), i = Number(t(cr)), a = Number(t(lr)), o = Number(t(ur)), s = Number(t(dr) ?? 0);
3979
4026
  return n === null || ![
3980
4027
  r,
3981
4028
  i,
@@ -3990,7 +4037,7 @@ function hr(e) {
3990
4037
  volume: Number.isFinite(s) ? s : 0
3991
4038
  };
3992
4039
  }
3993
- function gr(e) {
4040
+ function vr(e) {
3994
4041
  if (e.length < 5) return null;
3995
4042
  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;
3996
4043
  return t === null || ![
@@ -4014,11 +4061,11 @@ function Y(e) {
4014
4061
  let t = e.trim();
4015
4062
  if (!t) return null;
4016
4063
  let n = Number(t);
4017
- if (Number.isFinite(n) && n > 0) return g(n);
4064
+ if (Number.isFinite(n) && n > 0) return v(n);
4018
4065
  let r = Date.parse(t);
4019
4066
  return Number.isFinite(r) ? r : null;
4020
4067
  }
4021
- function _r(e, t, n) {
4068
+ function yr(e, t, n) {
4022
4069
  e.sort((e, t) => e.time - t.time);
4023
4070
  let r = [];
4024
4071
  for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
@@ -4030,7 +4077,7 @@ function _r(e, t, n) {
4030
4077
  }
4031
4078
  //#endregion
4032
4079
  //#region src/io/DragDropImporter.ts
4033
- var vr = class {
4080
+ var br = class {
4034
4081
  host;
4035
4082
  overlay = null;
4036
4083
  callbacks;
@@ -4063,7 +4110,7 @@ var vr = class {
4063
4110
  e.preventDefault(), this.depth = 0, this.hideOverlay();
4064
4111
  let t = e.dataTransfer?.files?.[0];
4065
4112
  if (t) try {
4066
- let e = ur(await t.text());
4113
+ let e = fr(await t.text());
4067
4114
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
4068
4115
  this.callbacks.onData(e.data, e, t);
4069
4116
  } catch (e) {
@@ -4107,7 +4154,7 @@ function Z(e) {
4107
4154
  };
4108
4155
  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;
4109
4156
  }
4110
- var yr = (e, t) => t.updatedAt - e.updatedAt;
4157
+ var xr = (e, t) => t.updatedAt - e.updatedAt;
4111
4158
  function Q(e) {
4112
4159
  if (typeof e != "object" || !e) return null;
4113
4160
  let t = e;
@@ -4120,17 +4167,17 @@ function Q(e) {
4120
4167
  kind: typeof t.kind == "string" ? t.kind : void 0
4121
4168
  });
4122
4169
  }
4123
- function br(e) {
4170
+ function Sr(e) {
4124
4171
  let t = Q(e), n = t ? e.content : void 0;
4125
4172
  return t && typeof n == "string" ? {
4126
4173
  ...t,
4127
4174
  content: n
4128
4175
  } : null;
4129
4176
  }
4130
- function xr(e = []) {
4177
+ function Cr(e = []) {
4131
4178
  let t = new Map(e.map((e) => [e.id, { ...e }]));
4132
4179
  return {
4133
- list: () => [...t.values()].map(Z).sort(yr),
4180
+ list: () => [...t.values()].map(Z).sort(xr),
4134
4181
  load: (e) => {
4135
4182
  let n = t.get(e);
4136
4183
  return n ? { ...n } : null;
@@ -4143,7 +4190,7 @@ function xr(e = []) {
4143
4190
  }
4144
4191
  };
4145
4192
  }
4146
- function Sr(e = "tcw:layouts:") {
4193
+ function wr(e = "tcw:layouts:") {
4147
4194
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
4148
4195
  let e;
4149
4196
  try {
@@ -4154,7 +4201,7 @@ function Sr(e = "tcw:layouts:") {
4154
4201
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
4155
4202
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
4156
4203
  return {
4157
- list: () => r().sort(yr),
4204
+ list: () => r().sort(xr),
4158
4205
  load: (e) => {
4159
4206
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
4160
4207
  return t && i !== null ? {
@@ -4172,14 +4219,14 @@ function Sr(e = "tcw:layouts:") {
4172
4219
  }
4173
4220
  //#endregion
4174
4221
  //#region src/state/LayoutSession.ts
4175
- var Cr = 80;
4222
+ var Tr = 80;
4176
4223
  function $(e) {
4177
4224
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
4178
4225
  }
4179
- function wr() {
4226
+ function Er() {
4180
4227
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4181
4228
  }
4182
- function Tr(e) {
4229
+ function Dr(e) {
4183
4230
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
4184
4231
  return {
4185
4232
  id: t,
@@ -4190,7 +4237,7 @@ function Tr(e) {
4190
4237
  ...o === void 0 ? {} : { kind: o }
4191
4238
  };
4192
4239
  }
4193
- var Er = class {
4240
+ var Or = class {
4194
4241
  currentLayout = null;
4195
4242
  savedContent = null;
4196
4243
  dirty = !1;
@@ -4206,7 +4253,7 @@ var Er = class {
4206
4253
  now;
4207
4254
  newId;
4208
4255
  constructor(e, t, n = {}) {
4209
- 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 ?? wr;
4256
+ 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 ?? Er;
4210
4257
  }
4211
4258
  current() {
4212
4259
  return this.currentLayout;
@@ -4236,7 +4283,7 @@ var Er = class {
4236
4283
  }
4237
4284
  open(e) {
4238
4285
  return this.queue(async () => {
4239
- let t = br(await this.storage.load(e));
4286
+ let t = Sr(await this.storage.load(e));
4240
4287
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4241
4288
  this.cancelTimer(), this.applying++;
4242
4289
  try {
@@ -4246,13 +4293,13 @@ var Er = class {
4246
4293
  } finally {
4247
4294
  this.applying--;
4248
4295
  }
4249
- return this.cancelTimer(), this.currentLayout = Tr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4296
+ return this.cancelTimer(), this.currentLayout = Dr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4250
4297
  });
4251
4298
  }
4252
4299
  rename(e, t) {
4253
4300
  let n = $(t);
4254
4301
  return n ? this.queue(async () => {
4255
- let t = br(await this.storage.load(e));
4302
+ let t = Sr(await this.storage.load(e));
4256
4303
  !t || t.id !== e || (await this.storage.save({
4257
4304
  ...t,
4258
4305
  name: n
@@ -4330,7 +4377,7 @@ var Er = class {
4330
4377
  content: n.content
4331
4378
  };
4332
4379
  await this.storage.save(r);
4333
- let i = Tr(r);
4380
+ let i = Dr(r);
4334
4381
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4335
4382
  }
4336
4383
  forget() {
@@ -4351,6 +4398,6 @@ var Er = class {
4351
4398
  }
4352
4399
  };
4353
4400
  //#endregion
4354
- export { Jt as C, B as S, H as _, xr as a, sn as b, Hn as c, Dn as d, En as f, Cn as g, Sn as h, Sr as i, Nn as l, Tn as m, Cr as n, vr as o, wn as p, $ as r, ur as s, Er as t, On as u, mn as v, an as x, ln as y };
4401
+ export { $t as C, B as S, U as _, Cr as a, cn as b, Un as c, On as d, Dn as f, wn as g, Cn as h, wr as i, Pn as l, En as m, Tr as n, br as o, Tn as p, $ as r, fr as s, Or as t, kn as u, hn as v, V as x, un as y };
4355
4402
 
4356
- //# sourceMappingURL=LayoutSession-B8vZsDaL.js.map
4403
+ //# sourceMappingURL=LayoutSession-CbqemKK4.js.map