@tradecanvas/chart 1.46.0 → 1.47.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.
@@ -1,12 +1,12 @@
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";
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 ne, readChartTypeOptions as b, readIndicatorPlotStyles as x, readPaneStyle as S, resolveChartTheme as re, sessionMinute as C, setLocale as ie, stepDecimals as ae, symbolTimeZone as w, tickBarCount as oe, timeframeToMs as se, zonedDateFormatter as ce } from "@tradecanvas/commons";
2
+ import { AlertDragHandler as le, AlertManager as ue, Animator as de, AreaRenderer as fe, AxisDragHandler as pe, BarCountdown as me, BarRenderer as he, BaselineRenderer as ge, CandlestickRenderer as _e, ChartLegend as ve, ChartStateManager as T, CompareRenderer as ye, CompareSymbolIndicator as be, CorrelationCoefficientIndicator as xe, CorrelationLogIndicator as Se, CrosshairHandler as Ce, CrosshairTooltip as we, CurrentPriceLine as Te, DEFAULT_SESSION_HOURS as Ee, DataExporter as E, DepthHeatmapRenderer as De, DrawingManager as Oe, DrawingRenderer as ke, EquivolumeRenderer as Ae, EventBus as je, GridRenderer as Me, HLCAreaRenderer as Ne, HiLoRenderer as D, HollowCandleRenderer as Pe, IndicatorEngine as O, InteractionManager as Fe, KagiRenderer as Ie, KeyboardHandler as Le, LineRenderer as Re, LineWithMarkersRenderer as ze, MarketProfileRenderer as Be, MeasureOverlay as Ve, PRICE_SCALE_MARGIN as k, PanHandler as He, PaneResizeHandler as Ue, PeriodLevelsRenderer as We, PinnedTooltip as Ge, PivotMarkersRenderer as Ke, PointAndFigureRenderer as A, PriceAxis as j, PriceAxisAddButton as qe, PriceLines as Je, RenderEngine as Ye, RenkoRenderer as Xe, ReplayManager as Ze, SYMBOL_INDICATOR_IDS as M, Screenshot as N, SelectionBoxOverlay as Qe, SessionBreaks as $e, SessionShading as et, SignalMarkerManager as tt, SpreadIndicator as nt, StepLineRenderer as rt, StreamManager as it, SymbolSeriesStore as at, TimeAxis as ot, TradeZoneManager as st, TradingManager as ct, TradingRenderer as lt, UndoRedoManager as ut, Viewport as dt, VolumeCandleRenderer as ft, VolumeProfileRenderer as pt, VolumeRenderer as mt, Watermark as ht, ZoomHandler as gt, barTimeStepMs as _t, findDominantSwing as vt, gpuContextsLeft as yt, isRegularSession as bt, loadWebGL as xt, mergeSessionHours as St, priceToY as Ct, rangePresetStart as wt, readAlertOptions as Tt, registerBuiltInDrawingTools as Et, registerBuiltInIndicators as Dt, servesTimeframe as Ot, sourceParam as P, timeToX as kt, timestampToBarIndex as F, toHeikinAshi as At, toKagi as jt, toLineBreak as Mt, toPointAndFigure as Nt, toRangeBars as Pt, toRenko as Ft, whenGpuContextFree as It, withResampling as Lt, xToBarIndex as Rt, xToTime as I, yToPrice as zt } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
- var Ut = 864e5, Wt = 10;
5
- function Gt(e, t) {
6
- let n = e?.timezone;
4
+ var Bt = 864e5, Vt = 10;
5
+ function Ht(e, t) {
6
+ let n = w(e);
7
7
  if (!n || !g(n) || t.length < 2) return null;
8
8
  let r = (e?.sessions ?? []).flatMap((e) => {
9
- let t = S(e.start), n = S(e.end);
9
+ let t = C(e.start), n = C(e.end);
10
10
  return t === null || n === null ? [] : [{
11
11
  startMinute: t,
12
12
  endMinute: n
@@ -14,34 +14,34 @@ function Gt(e, t) {
14
14
  });
15
15
  if (r.length === 0) return null;
16
16
  let i = l(t), a = Infinity;
17
- for (let e = Math.max(1, t.length - Wt); e < t.length; e++) {
17
+ for (let e = Math.max(1, t.length - Vt); 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 < Ut)) return null;
21
+ if (!(a < Bt)) 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) => Ct(e * i, o);
28
+ return (e) => bt(e * i, o);
29
29
  }
30
30
  //#endregion
31
31
  //#region src/chartA11y.ts
32
- var Kt = {
32
+ var Ut = {
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
- }, N = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), qt = [
39
+ }, L = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e), Wt = [
40
40
  "role",
41
41
  "aria-roledescription",
42
42
  "aria-label",
43
43
  "aria-describedby"
44
- ], Jt = 400, Yt = 1e3, Xt = class {
44
+ ], Gt = 400, Kt = 1e3, qt = class {
45
45
  live;
46
46
  help;
47
47
  labels;
@@ -55,20 +55,20 @@ var Kt = {
55
55
  };
56
56
  constructor(e, t, n = {}) {
57
57
  this.container = e, this.source = t, this.labels = {
58
- ...Kt,
58
+ ...Ut,
59
59
  ...n
60
60
  };
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();
61
+ for (let t of Wt) this.before.set(t, e.getAttribute(t));
62
+ e.setAttribute("role", "application"), this.help = Jt("div", "tc-sr-only"), this.help.id = `tc-chart-keys-${Math.random().toString(36).slice(2, 10)}`, e.setAttribute("aria-describedby", this.help.id), this.live = Jt("div", "tc-sr-only tc-sr-live"), this.live.setAttribute("aria-live", "polite"), this.live.setAttribute("aria-atomic", "true"), e.append(this.help, this.live), e.addEventListener("blur", this.onBlur), this.applyLabels();
63
63
  }
64
64
  setLabels(e) {
65
65
  this.labels = {
66
- ...Kt,
66
+ ...Ut,
67
67
  ...e
68
68
  }, this.applyLabels();
69
69
  }
70
70
  refresh(e = !1) {
71
- let t = Yt - (Date.now() - this.summaryAt);
71
+ let t = Kt - (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 Kt = {
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
- }, Jt);
83
+ }, Gt);
84
84
  }
85
85
  readBar(e) {
86
86
  let t = this.source.bars();
@@ -93,13 +93,13 @@ var Kt = {
93
93
  let i = t[this.cursor];
94
94
  this.source.showBar(i.time);
95
95
  let a = this.source.formatPrice;
96
- this.say(N(this.labels.bar, {
96
+ this.say(L(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: Yt(i.volume ?? 0)
103
103
  }));
104
104
  }
105
105
  destroy() {
@@ -118,7 +118,7 @@ var Kt = {
118
118
  this.labels.typeName ? this.labels.typeName(t) : t,
119
119
  this.source.timeframe()
120
120
  ].filter(Boolean).join(", ");
121
- return N(this.labels.summary, {
121
+ return L(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 Kt = {
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 N(this.labels.view, {
131
+ return L(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 Kt = {
140
140
  this.live.textContent = e;
141
141
  }
142
142
  };
143
- function Zt(e, t) {
143
+ function Jt(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 Zt(e, t) {
154
154
  border: "0"
155
155
  }), n;
156
156
  }
157
- function Qt(e) {
157
+ function Yt(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 $t(e, t, n, r) {
162
+ function Xt(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 $t(e, t, n, r) {
169
169
  }
170
170
  //#endregion
171
171
  //#region src/charts/ChartTypeStrategy.ts
172
- function en(e) {
172
+ function Zt(e) {
173
173
  switch (e) {
174
174
  case "candlestick":
175
175
  case "heikinAshi":
176
176
  case "lineBreak":
177
- case "rangeBars": return new ve();
178
- case "line": return new Ve();
179
- case "area": return new pe();
180
- case "bar": return new ge();
181
- case "hollowCandle": return new Ie();
182
- case "baseline": return new _e();
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
- case "equivolume": return new je();
188
- case "hlcArea": return new Pe();
189
- case "stepLine": return new ot();
190
- case "lineWithMarkers": return new He();
191
- case "hiLo": return new Fe();
192
- default: return new ve();
177
+ case "rangeBars": return new _e();
178
+ case "line": return new Re();
179
+ case "area": return new fe();
180
+ case "bar": return new he();
181
+ case "hollowCandle": return new Pe();
182
+ case "baseline": return new ge();
183
+ case "renko": return new Xe();
184
+ case "kagi": return new Ie();
185
+ case "pointAndFigure": return new A();
186
+ case "volumeCandles": return new ft();
187
+ case "equivolume": return new Ae();
188
+ case "hlcArea": return new Ne();
189
+ case "stepLine": return new rt();
190
+ case "lineWithMarkers": return new ze();
191
+ case "hiLo": return new D();
192
+ default: return new _e();
193
193
  }
194
194
  }
195
- function tn(e, t, n = {}) {
195
+ function Qt(e, t, n = {}) {
196
196
  if (t.length === 0) return t;
197
197
  switch (e) {
198
- case "heikinAshi": return Nt(t);
198
+ case "heikinAshi": return At(t);
199
199
  case "renko": {
200
200
  let e = n.renko?.boxSize;
201
- return typeof e == "number" ? Rt(t, { brickSize: e }) : Rt(t, {
201
+ return typeof e == "number" ? Ft(t, { brickSize: e }) : Ft(t, {
202
202
  brickSize: 0,
203
203
  useATR: !0,
204
204
  atrPeriod: n.renko?.atrPeriod ?? 14
205
205
  });
206
206
  }
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);
207
+ case "lineBreak": return Mt(t, n.lineBreak?.lines ?? 3);
208
+ case "kagi": return jt(t, n.kagi?.reversal ?? 4, n.kagi?.reversalType ?? "percent");
209
+ case "pointAndFigure": return Nt(t, en(t, n), n.pointAndFigure?.reversal ?? 3);
210
210
  case "rangeBars": {
211
211
  let e = n.rangeBars?.range;
212
- return Lt(t, { rangeSize: typeof e == "number" ? e : I(t) * .005 });
212
+ return Pt(t, { rangeSize: typeof e == "number" ? e : tn(t) * .005 });
213
213
  }
214
214
  default: return t;
215
215
  }
216
216
  }
217
- function nn(e) {
217
+ function $t(e) {
218
218
  switch (e) {
219
219
  case "heikinAshi":
220
220
  case "renko":
@@ -225,30 +225,30 @@ function nn(e) {
225
225
  default: return !1;
226
226
  }
227
227
  }
228
- function P(e) {
229
- return e !== "heikinAshi" && nn(e);
228
+ function R(e) {
229
+ return e !== "heikinAshi" && $t(e);
230
230
  }
231
- function F(e, t = {}) {
231
+ function en(e, t = {}) {
232
232
  let n = t.pointAndFigure?.boxSize;
233
- return typeof n == "number" ? n : I(e) * .01;
233
+ return typeof n == "number" ? n : tn(e) * .01;
234
234
  }
235
- function I(e) {
235
+ function tn(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 rn(e, t) {
240
+ function nn(e, t) {
241
241
  let n = t?.(e);
242
- return n ? n.createRenderer() : en(e);
242
+ return n ? n.createRenderer() : Zt(e);
243
243
  }
244
- function an(e, t, n, r) {
244
+ function rn(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) : tn(e, t, r);
247
+ return i?.transform ? i.transform(t) : Qt(e, t, r);
248
248
  }
249
249
  //#endregion
250
250
  //#region src/state/AutoSaveScheduler.ts
251
- var on = class {
251
+ var an = class {
252
252
  timer = null;
253
253
  delayMs = 0;
254
254
  key = null;
@@ -278,15 +278,15 @@ var on = class {
278
278
  };
279
279
  //#endregion
280
280
  //#region src/DataManager.ts
281
- function L(e) {
281
+ function z(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 R(e) {
286
+ function on(e) {
287
287
  return e.volume !== void 0 && e.high >= e.open && e.high >= e.close && e.low <= e.open && e.low <= e.close;
288
288
  }
289
- function z(e) {
289
+ function B(e) {
290
290
  return {
291
291
  ...e,
292
292
  high: Math.max(e.open, e.high, e.low, e.close),
@@ -294,7 +294,7 @@ function z(e) {
294
294
  volume: e.volume === void 0 ? 0 : Math.max(0, e.volume)
295
295
  };
296
296
  }
297
- var B = class {
297
+ var V = class {
298
298
  data = [];
299
299
  inSeriesUnit(e) {
300
300
  if (this.data.length === 0) return e;
@@ -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
- L(r) && t.push(R(r) ? r : z(r));
318
+ z(r) && t.push(on(r) ? r : B(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 (!L(e[r])) continue;
325
+ if (!z(e[r])) continue;
326
326
  let i = this.withSeriesTime(e[r]);
327
- i.time >= t || n.push(R(i) ? i : z(i));
327
+ i.time >= t || n.push(on(i) ? i : B(i));
328
328
  }
329
329
  if (n.length === 0) return 0;
330
330
  n.sort((e, t) => e.time - t.time);
@@ -333,11 +333,11 @@ var B = class {
333
333
  return n.length = r, this.data = n.concat(this.data), r;
334
334
  }
335
335
  appendBar(e) {
336
- L(e) && this.data.push(z(this.withSeriesTime(e)));
336
+ z(e) && this.data.push(B(this.withSeriesTime(e)));
337
337
  }
338
338
  updateLastBar(e) {
339
- if (!L(e)) return;
340
- let t = z(this.withSeriesTime(e));
339
+ if (!z(e)) return;
340
+ let t = B(this.withSeriesTime(e));
341
341
  if (this.data.length === 0) {
342
342
  this.data.push(t);
343
343
  return;
@@ -353,7 +353,7 @@ var B = class {
353
353
  clear() {
354
354
  this.data = [];
355
355
  }
356
- }, V = 5e3, sn = 6e4, cn = 500, ln = class {
356
+ }, sn = 5e3, cn = 6e4, ln = 500, un = 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(sn, V * 2 ** (this.failures - 1)), this.emit({
397
+ return n === this.seq ? (this.loading = !1, this.failures++, this.retryAt = this.now() + Math.min(cn, sn * 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
- }, un = class t {
427
+ }, dn = 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 ??= ie(this.base, this.chartType, this.merged()), this.effective;
444
+ return this.effective ??= re(this.base, this.chartType, this.merged()), this.effective;
445
445
  }
446
446
  getBaseTheme() {
447
447
  return this.base;
@@ -510,7 +510,7 @@ var B = class {
510
510
  };
511
511
  //#endregion
512
512
  //#region src/style/styleOptions.ts
513
- function dn(e, t) {
513
+ function fn(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,22 +518,22 @@ function dn(e, t) {
518
518
  ...t.width === void 0 ? {} : { [`crosshair.${e}.width`]: t.width }
519
519
  } : {};
520
520
  }
521
- function fn(e) {
521
+ function pn(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
- ...dn("horizontal", n?.hLine),
529
- ...dn("vertical", n?.vLine),
528
+ ...fn("horizontal", n?.hLine),
529
+ ...fn("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 pn = 200, mn = 80, H = (e) => e.position === "top" || e.position === "bottom", hn = class {
536
+ var mn = 200, hn = 80, H = (e) => e.position === "top" || e.position === "bottom", gn = class {
537
537
  panels = [];
538
538
  containerWidth = 0;
539
539
  containerHeight = 0;
@@ -549,8 +549,8 @@ var pn = 200, mn = 80, H = (e) => e.position === "top" || e.position === "bottom
549
549
  this.panels.push({
550
550
  id: e,
551
551
  position: n,
552
- size: r ?? (a ? pn : t),
553
- minSize: a ? mn : i,
552
+ size: r ?? (a ? mn : t),
553
+ minSize: a ? hn : i,
554
554
  content: {
555
555
  type: "indicator",
556
556
  indicatorInstanceId: e
@@ -619,7 +619,7 @@ var pn = 200, mn = 80, H = (e) => e.position === "top" || e.position === "bottom
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 ? pn : t, r.minSize = o ? mn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
622
+ r.position = n, a !== o && (r.size = o ? mn : t, r.minSize = o ? hn : i), o && (r.collapsed = void 0, this.maximized === e && (this.maximized = null));
623
623
  }
624
624
  }
625
625
  setPanelSize(e, t) {
@@ -735,8 +735,8 @@ var pn = 200, mn = 80, H = (e) => e.position === "top" || e.position === "bottom
735
735
  getMainChartRect() {
736
736
  return this.resolve().mainChartRect;
737
737
  }
738
- }, gn = 14, _n = 14, vn = 22, yn = 4;
739
- function bn(e) {
738
+ }, _n = 14, vn = 14, yn = 22, bn = 4;
739
+ function xn(e) {
740
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,
@@ -745,14 +745,14 @@ function bn(e) {
745
745
  for (let t of f) {
746
746
  if (!Number.isFinite(t)) continue;
747
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);
748
+ m = Math.max(m, l(n, `500 ${s}px ${a}`) + _n, l(r, `bold 11px ${a}`) + vn, l(r, `600 ${s}px ${a}`) + yn);
749
749
  }
750
- return m <= o ? o : Math.ceil(m / yn) * yn;
750
+ return m <= o ? o : Math.ceil(m / bn) * bn;
751
751
  }
752
- function xn(e, t) {
752
+ function Sn(e, t) {
753
753
  return t > e || t <= e - 12 ? t : e;
754
754
  }
755
- var Sn = class {
755
+ var Cn = class {
756
756
  netY = 0;
757
757
  travelX = 0;
758
758
  engaged = !1;
@@ -768,8 +768,8 @@ var Sn = class {
768
768
  }
769
769
  return this.engaged;
770
770
  }
771
- }, Cn = 1;
772
- function wn(e, t) {
771
+ }, wn = 1;
772
+ function Tn(e, t) {
773
773
  return e.filter((e) => e.enabled !== !1 && (e.descriptor.layer ?? "overlay") === t);
774
774
  }
775
775
  function U(e) {
@@ -783,24 +783,24 @@ function U(e) {
783
783
  //#endregion
784
784
  //#region src/plugins/registry.ts
785
785
  var W = /* @__PURE__ */ new Map();
786
- function Tn(e) {
786
+ function En(e) {
787
787
  W.set(U(e), e);
788
788
  }
789
- function En(e) {
789
+ function Dn(e) {
790
790
  return W.delete(e);
791
791
  }
792
- function Dn() {
792
+ function On() {
793
793
  return [...W.values()];
794
794
  }
795
- function On() {
795
+ function kn() {
796
796
  W.clear();
797
797
  }
798
798
  //#endregion
799
799
  //#region src/plugins/PluginManager.ts
800
- var kn = class {
800
+ var An = class {
801
801
  plugins = /* @__PURE__ */ new Map();
802
802
  constructor(e, t = {}) {
803
- if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of Dn()) this.add(e);
803
+ if (this.indicatorEngine = e, t.inheritGlobal !== !1) for (let e of On()) this.add(e);
804
804
  for (let e of t.plugins ?? []) this.add(e);
805
805
  }
806
806
  register(e) {
@@ -830,15 +830,15 @@ var kn = class {
830
830
  add(e) {
831
831
  this.plugins.set(U(e), e), e.kind === "indicator" && this.indicatorEngine.register(e.plugin);
832
832
  }
833
- }, An = {
833
+ }, jn = {
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) => jn(e, t, n)
839
+ positionReverse: (e, t, n) => Mn(e, t, n)
840
840
  };
841
- async function jn(e, t, n) {
841
+ async function Mn(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 jn(e, t, n) {
867
867
  }
868
868
  }
869
869
  }
870
- function Mn(e, t) {
870
+ function Nn(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 Mn(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(An)) {
881
- let a = An[r], o = t.onIntent(r, (n) => {
880
+ for (let r of Object.keys(jn)) {
881
+ let a = jn[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,24 @@ function Mn(e, t) {
892
892
  }
893
893
  //#endregion
894
894
  //#region src/Chart.ts
895
- var Nn = {
895
+ var Pn = {
896
896
  min: 0,
897
897
  max: 100
898
- }, Pn = "exchange";
899
- function Fn(e) {
898
+ }, Fn = "exchange", In = Fn;
899
+ function Ln(e) {
900
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 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.46.0";
903
+ function Rn(e, t) {
904
+ let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : w(e);
905
+ return i === void 0 ? e : {
906
+ ...e,
907
+ timeZone: i,
908
+ timezone: i
909
+ };
910
+ }
911
+ var zn = .08, Bn = a ** -7, Vn = 800, Hn = 20, Un = 8, Wn = new Set(["horizontalLine", "crossLine"]), Gn = new Set(["verticalLine", "crossLine"]), Kn = class {
912
+ static version = "1.47.0";
905
913
  engine;
906
914
  viewport;
907
915
  dataManager;
@@ -941,14 +949,14 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
941
949
  indicatorEdit = null;
942
950
  removedDrawingAlerts = /* @__PURE__ */ new Map();
943
951
  zoomAreaMode = !1;
944
- priceAxisAddButton = new Xe();
952
+ priceAxisAddButton = new qe();
945
953
  displayTz = null;
946
- timezoneSetting = null;
954
+ timeZoneSetting = null;
947
955
  symbolInfo = null;
948
956
  symbolInfoSeq = 0;
949
957
  sessionBreaks;
950
958
  sessionShading;
951
- hostSessionHours = { ...De };
959
+ hostSessionHours = { ...Ee };
952
960
  compareRenderer;
953
961
  countdownInterval = null;
954
962
  pausedFor = {
@@ -967,7 +975,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
967
975
  signalMarkerManager;
968
976
  tradeZoneManager;
969
977
  measureOverlay;
970
- selectionBoxOverlay = new tt();
978
+ selectionBoxOverlay = new Qe();
971
979
  replayManager;
972
980
  replayBarUnsub = null;
973
981
  replaySeeking = !1;
@@ -977,7 +985,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
977
985
  replayRevealMarks = !0;
978
986
  replayOffset = 0;
979
987
  undoRedoManager;
980
- autoSaveScheduler = new on((e) => this.saveState(e));
988
+ autoSaveScheduler = new an((e) => this.saveState(e));
981
989
  animator;
982
990
  crosshairTooltip;
983
991
  pinnedTooltip;
@@ -989,15 +997,15 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
989
997
  disposed = !1;
990
998
  chartTypeOptions = {};
991
999
  mainSeriesVisible = !0;
992
- priceLines = new Ze();
993
- symbolSeries = new ct();
1000
+ priceLines = new Je();
1001
+ symbolSeries = new at();
994
1002
  extendedHours = !0;
995
1003
  replayRestarting = !1;
996
1004
  fullSeries = null;
997
1005
  requestedSymbols = /* @__PURE__ */ new Set();
998
1006
  gridRenderer;
999
1007
  priceAxis;
1000
- leftPriceAxis = new D();
1008
+ leftPriceAxis = new j();
1001
1009
  leftScaleRequested = !1;
1002
1010
  leftAxisWidth = o;
1003
1011
  leftViewport = null;
@@ -1028,7 +1036,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1028
1036
  snapshotKey = null;
1029
1037
  historyCheckQueued = !1;
1030
1038
  constructor(e, t) {
1031
- t.timeZone != null && Fn(t.timeZone), this.container = e, this.options = {
1039
+ t.timeZone != null && Ln(t.timeZone), this.container = e, this.options = {
1032
1040
  ...t,
1033
1041
  chartType: t.chartType ?? "candlestick"
1034
1042
  }, this.numberLocale = t.numberLocale ?? "en-US", this.defaultAutoScale = t.autoScale !== !1;
@@ -1066,15 +1074,15 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1066
1074
  logScale: n.logScale ?? !0,
1067
1075
  timeframes: n.timeframes ?? [],
1068
1076
  defaultTimeframeFavorites: n.defaultTimeframeFavorites ?? []
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({
1077
+ }, 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 V(), this.history = new un({
1070
1078
  oldestTime: () => this.dataManager.getData()[0]?.time ?? null,
1071
1079
  prepend: (e) => this.prependBars(e),
1072
1080
  emit: (e) => this.eventBus.emit("historyLoad", e)
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(() => {
1081
+ }), this.themeManager = new dn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(pn(t), "host", !1), this.layoutManager = new gn(), this.indicatorEngine = new O(), this.pluginManager = new An(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new je(), Dt(this.indicatorEngine), this.indicatorEngine.register(new be(this.symbolSeries)), this.indicatorEngine.register(new nt(this.symbolSeries)), this.indicatorEngine.register(new xe(this.symbolSeries)), this.indicatorEngine.register(new Se(this.symbolSeries)), this.drawingManager = new Oe(), Et(this.drawingManager), this.drawingRenderer = new ke(this.drawingManager), this.drawingManager.setRequestRender(() => {
1074
1082
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1075
1083
  }), this.drawingManager.setEventCallback((e, t) => {
1076
1084
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1077
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new pt();
1085
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new ut();
1078
1086
  let i = "";
1079
1087
  this.undoRedoManager.setOnChange(() => {
1080
1088
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1087,21 +1095,21 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1087
1095
  primary: e[0] ?? null
1088
1096
  })), this.drawingManager.setForeignHistory((e, t) => {
1089
1097
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
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({
1098
+ }), 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 ct({
1091
1099
  enabled: this.features.trading,
1092
1100
  contextMenu: { enabled: this.features.tradingContextMenu }
1093
- }), this.tradingRenderer = new ft(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1101
+ }), this.tradingRenderer = new lt(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1094
1102
  this.eventBus.emit(e, t);
1095
- }), this.engine = new Qe(e, t.maxPixelRatio);
1103
+ }), this.engine = new Ye(e, t.maxPixelRatio);
1096
1104
  let a = this.engine.dprManager.getContainerSize();
1097
- if (this.viewport = new mt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1105
+ if (this.viewport = new dt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), this.viewport.setPanLimits({
1098
1106
  freePan: t.freePan ?? !0,
1099
1107
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1100
1108
  }), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1101
1109
  if (e.width <= 0 || e.height <= 0) return;
1102
1110
  let t = this.viewport.isAtEnd();
1103
1111
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(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) => {
1112
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Me(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new j(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new ot(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Ce(), 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) => {
1105
1113
  if (e !== null && t) {
1106
1114
  let n = this.crosshairSeries(), r = e >= 0 && e < n.length ? n[e] : void 0;
1107
1115
  this.chartLegend.setHoverBar(r ?? null, e > 0 ? n[e - 1] ?? null : null);
@@ -1110,7 +1118,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1110
1118
  prevClose: e > 0 ? n[e - 1]?.close : void 0,
1111
1119
  priceRange: i.priceRange,
1112
1120
  plot: i.chartRect,
1113
- barStepMs: bt(n),
1121
+ barStepMs: _t(n),
1114
1122
  timeUnit: l(n)
1115
1123
  }) : this.crosshairTooltip.hide(), this.pinnedTooltip.isPinned() && this.pinnedTooltip.reposition(this.viewport.getState(), r ?? null, e, this.themeManager.getTheme()), this.eventBus.emit("crosshairMove", {
1116
1124
  point: t,
@@ -1118,12 +1126,12 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1118
1126
  barIndex: e
1119
1127
  });
1120
1128
  } else this.crosshairTooltip.hide(), this.chartLegend.setHoverBar(null), this.eventBus.emit("crosshairLeave", {});
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({
1129
+ }), this.chartLegend = new ve(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.watermark = new ht(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new mt(), this.volumeProfile = new pt(), this.marketProfile = new Be(), this.depthHeatmap = new De(), this.periodLevels = new We(), this.pivotMarkers = new Ke(), this.barCountdown = new me(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new $e(), this.sessionBreaks.setLocale(this.numberLocale), this.sessionShading = new et(), this.compareRenderer = new ye(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1122
1130
  visible: t.sessionBreaks.visible ?? !0,
1123
1131
  color: t.sessionBreaks.color,
1124
1132
  lineStyle: t.sessionBreaks.lineStyle,
1125
1133
  lineWidth: t.sessionBreaks.lineWidth
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({
1134
+ }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new de(), this.crosshairTooltip = new we(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Ge(), this.pinnedTooltip.create(e), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = b(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(Yn(t.shapes)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Le({
1127
1135
  scrollBars: (e) => {
1128
1136
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1129
1137
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1140,14 +1148,14 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1140
1148
  },
1141
1149
  fitContent: () => this.fitContent()
1142
1150
  }), this.keyboardHandler.setEnabled(this.features.keyboard), t.a11y !== !1) {
1143
- this.a11y = new Xt(e, {
1151
+ this.a11y = new qt(e, {
1144
1152
  symbol: () => this.currentSymbol || this.symbolInfo?.symbol || "",
1145
1153
  timeframe: () => this.streamTimeframe ?? "",
1146
1154
  chartType: () => this.options.chartType ?? "candlestick",
1147
1155
  bars: () => this.getDisplayData(),
1148
1156
  visibleRange: () => this.viewport.getState().visibleRange,
1149
1157
  formatPrice: (e) => this.formatPrice(e),
1150
- formatTime: (e) => le(this.numberLocale || "en-US", {
1158
+ formatTime: (e) => ce(this.numberLocale || "en-US", {
1151
1159
  dateStyle: "medium",
1152
1160
  timeStyle: "short"
1153
1161
  }, this.displayTz)(e * l(this.getDisplayData())),
@@ -1170,7 +1178,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1170
1178
  }
1171
1179
  this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
1172
1180
  }
1173
- }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ee(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new de(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1181
+ }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Te(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new ue(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.alertManager.on("triggered", (e) => {
1174
1182
  this.eventBus.emit("alertTriggered", G(e)), this.eventBus.emit("dataUpdate", {
1175
1183
  kind: "alert",
1176
1184
  alert: "triggered",
@@ -1186,7 +1194,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1186
1194
  this.eventBus.emit("alertExpired", G(e));
1187
1195
  }), this.alertManager.on("updated", (e) => {
1188
1196
  this.eventBus.emit("alertUpdate", G(e));
1189
- }), this.signalMarkerManager = new it(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1197
+ }), this.signalMarkerManager = new tt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.dataManager.getData()), this.signalMarkerManager.on("added", (e) => {
1190
1198
  this.eventBus.emit("signalMarkerAdd", {
1191
1199
  id: e.id,
1192
1200
  source: e.source,
@@ -1194,14 +1202,14 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1194
1202
  });
1195
1203
  }), this.signalMarkerManager.on("removed", (e) => {
1196
1204
  this.eventBus.emit("signalMarkerRemove", { id: e });
1197
- }), this.tradeZoneManager = new ut(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1205
+ }), this.tradeZoneManager = new st(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.dataManager.getData()), this.tradeZoneManager.on("added", (e) => {
1198
1206
  this.eventBus.emit("tradeZoneAdd", {
1199
1207
  id: e.id,
1200
1208
  direction: e.direction
1201
1209
  });
1202
1210
  }), this.tradeZoneManager.on("removed", (e) => {
1203
1211
  this.eventBus.emit("tradeZoneRemove", { id: e });
1204
- }), this.replayManager = new et(), this.replayManager.on("complete", () => {
1212
+ }), this.replayManager = new Ze(), this.replayManager.on("complete", () => {
1205
1213
  let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1206
1214
  t && this.eventBus.emit("replayComplete", {
1207
1215
  barIndex: e,
@@ -1209,9 +1217,9 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1209
1217
  });
1210
1218
  }), this.replayManager.on("stateChange", (e) => {
1211
1219
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1212
- }), this.measureOverlay = new We(), this.interactionManager = new Re(e), this.features.panning) {
1213
- let e = new Sn();
1214
- this.interactionManager.setPanHandler(new Ge((t, n) => {
1220
+ }), this.measureOverlay = new Ve(), this.interactionManager = new Fe(e), this.features.panning) {
1221
+ let e = new Cn();
1222
+ this.interactionManager.setPanHandler(new He((t, n) => {
1215
1223
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.options.autoScale = !1, this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1216
1224
  }, () => e.reset()));
1217
1225
  }
@@ -1223,10 +1231,10 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1223
1231
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1224
1232
  }
1225
1233
  })), this.features.zooming) {
1226
- this.interactionManager.setZoomHandler(new yt((e, t) => {
1234
+ this.interactionManager.setZoomHandler(new gt((e, t) => {
1227
1235
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1228
1236
  }));
1229
- let e = new me((e) => {
1237
+ let e = new pe((e) => {
1230
1238
  this.options.autoScale = !1, this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
1231
1239
  }, (e) => {
1232
1240
  let t = this.viewport.getState().chartRect.width;
@@ -1246,7 +1254,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1246
1254
  y: t.y
1247
1255
  });
1248
1256
  })), 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) => {
1249
- let t = Ht(e.y, this.viewport.getState());
1257
+ let t = zt(e.y, this.viewport.getState());
1250
1258
  Number.isFinite(t) && this.eventBus.emit("priceAxisAdd", {
1251
1259
  price: t,
1252
1260
  x: e.x,
@@ -1256,10 +1264,10 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1256
1264
  ...this.viewport.getState(),
1257
1265
  data: this.getDisplayData()
1258
1266
  })), this.features.alerts) {
1259
- let e = new ue(this.alertManager, () => this.viewport.getState());
1267
+ let e = new le(this.alertManager, () => this.viewport.getState());
1260
1268
  this.interactionManager.setAlertDragHandler(e);
1261
1269
  }
1262
- let o = new Ke();
1270
+ let o = new Ue();
1263
1271
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1264
1272
  let t = this.getDisplayData();
1265
1273
  if (t.length === 0) return;
@@ -1283,7 +1291,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1283
1291
  x: e.x,
1284
1292
  y: e.y
1285
1293
  }), t.length === 0) return;
1286
- let r = Vt(e.x, this.viewport.getState());
1294
+ let r = Rt(e.x, this.viewport.getState());
1287
1295
  r < 0 || r >= t.length || this.eventBus.emit("barClick", {
1288
1296
  bar: t[r],
1289
1297
  barIndex: r,
@@ -1326,7 +1334,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1326
1334
  end: () => {
1327
1335
  let e = this.selectionBoxOverlay.end();
1328
1336
  if (e && this.zoomAreaMode) {
1329
- if (e.x1 - e.x0 < Bn) return;
1337
+ if (e.x1 - e.x0 < Un) return;
1330
1338
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1331
1339
  return;
1332
1340
  }
@@ -1345,7 +1353,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1345
1353
  }
1346
1354
  }), this.interactionManager.setOverlayDirtyCallback((e) => {
1347
1355
  this.engine.requestRender(e ? r.Hover : r.Overlay);
1348
- }), this.interactionManager.setPageScroll(t.pageScroll ?? !1), this.interactionManager.attach(), t.timeZone !== void 0 && t.timeZone !== null && this.setTimezone(t.timeZone), t.leftPriceScale && (this.leftScaleRequested = !0), this.syncRenderContext(), this.engine.start(), this.watchVisibility(e, t.pauseWhenHidden !== !1), this.engine.onGpuLost = () => this.eventBus.emit("rendererChange", {
1356
+ }), this.interactionManager.setPageScroll(t.pageScroll ?? !1), this.interactionManager.attach(), t.timeZone !== void 0 && t.timeZone !== null && this.setTimeZone(t.timeZone), t.leftPriceScale && (this.leftScaleRequested = !0), this.syncRenderContext(), this.engine.start(), this.watchVisibility(e, t.pauseWhenHidden !== !1), this.engine.onGpuLost = () => this.eventBus.emit("rendererChange", {
1349
1357
  renderer: "canvas",
1350
1358
  reason: "contextLost"
1351
1359
  }), this.engine.onGpuRestored = () => this.eventBus.emit("rendererChange", {
@@ -1365,7 +1373,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1365
1373
  if (this.replaySession) return 0;
1366
1374
  let t = null;
1367
1375
  if (this.fullSeries) {
1368
- 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);
1376
+ let n = this.fullSeries[0]?.time, r = /* @__PURE__ */ new Set(), i = e.filter((e) => ir(e) && (n === void 0 || e.time < n) && !r.has(e.time) && r.add(e.time)).sort((e, t) => e.time - t.time);
1369
1377
  this.fullSeries = [...i, ...this.fullSeries];
1370
1378
  let a = this.sessionKeep(this.fullSeries);
1371
1379
  t = i.length, e = a ? i.filter((e) => a(e.time)) : i;
@@ -1374,7 +1382,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1374
1382
  if (a === 0) return t ?? 0;
1375
1383
  let o = this.dataManager.getData();
1376
1384
  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) {
1377
- let e = Math.round(j(i, this.getDisplayData()));
1385
+ let e = Math.round(F(i, this.getDisplayData()));
1378
1386
  this.viewport.prependBars(e - r);
1379
1387
  }
1380
1388
  return this.updateViewportAndRender(), t ?? a;
@@ -1405,17 +1413,17 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1405
1413
  }
1406
1414
  checkHistory() {
1407
1415
  this.historyCheckQueued || !this.history.hasLoader() || (this.historyCheckQueued = !0, queueMicrotask(() => {
1408
- if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || P(this.options.chartType)) return;
1416
+ if (this.historyCheckQueued = !1, this.replaySession || !this.history.hasLoader() || R(this.options.chartType)) return;
1409
1417
  let { visibleRange: e, chartRect: t } = this.viewport.getState();
1410
1418
  if (t.width <= 0) return;
1411
1419
  let { from: n, to: r } = e;
1412
- this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(zn, r - n));
1420
+ this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Hn, r - n));
1413
1421
  }));
1414
1422
  }
1415
1423
  useStreamHistory(e, t) {
1416
1424
  if (this.hostHistoryLoader) return;
1417
- let n = Bt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1418
- if (!r || i === null || se(i) !== null) {
1425
+ let n = Lt(e), r = n.fetchHistoryBefore, i = this.streamTimeframe;
1426
+ if (!r || i === null || oe(i) !== null) {
1419
1427
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
1420
1428
  return;
1421
1429
  }
@@ -1423,7 +1431,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1423
1431
  this.history.setLoader((e, t) => r.call(n, a, i, e, t), t), this.historyFromStream = !0, this.checkHistory();
1424
1432
  }
1425
1433
  appendBar(e) {
1426
- if (!L(e)) return;
1434
+ if (!z(e)) return;
1427
1435
  if (this.replaySession) {
1428
1436
  this.replaySession.live.appendBar(e), this.takeLivePrice(e.close);
1429
1437
  return;
@@ -1438,7 +1446,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1438
1446
  this.crosshairHandler.setData(r), this.displayDataCache = null, this.recalcIndicatorsFrom(r, r.length - 2), this.currentPriceLine.setPrice(e.close), this.updateViewportAndRender(t), r.length !== n && this.emitBars(r.length), this.followLivePrice(e.close);
1439
1447
  }
1440
1448
  appendBars(e) {
1441
- if (e = e.filter(L), e.length === 0) return;
1449
+ if (e = e.filter(z), e.length === 0) return;
1442
1450
  let t = e[e.length - 1].close;
1443
1451
  if (this.replaySession) {
1444
1452
  for (let t of e) this.replaySession.live.appendBar(t);
@@ -1457,7 +1465,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1457
1465
  this.recalcIndicatorsFrom(a, i - 1), this.crosshairHandler.setData(a), this.currentPriceLine.setPrice(t), this.updateViewportAndRender(r), a.length !== i && this.emitBars(a.length), this.followLivePrice(t);
1458
1466
  }
1459
1467
  updateLastBar(e) {
1460
- if (!L(e)) return;
1468
+ if (!z(e)) return;
1461
1469
  if (this.replaySession) {
1462
1470
  this.replaySession.live.updateLastBar(e), this.takeLivePrice(e.close);
1463
1471
  return;
@@ -1498,17 +1506,17 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1498
1506
  });
1499
1507
  }
1500
1508
  applyTimeSpacing() {
1501
- let e = !this.tickStream && !P(this.options.chartType);
1509
+ let e = !this.tickStream && !R(this.options.chartType);
1502
1510
  this.timeAxis.setTimesPastData(e), this.crosshairHandler.setTimesPastData(e);
1503
1511
  }
1504
1512
  setChartTypeOptions(e) {
1505
1513
  this.chartTypeOptions = {
1506
1514
  ...this.chartTypeOptions,
1507
- ...x(e)
1515
+ ...b(e)
1508
1516
  }, this.displayDataCache = null, this.updateViewportAndRender(!0), this.markStateChanged();
1509
1517
  }
1510
1518
  getChartTypeOptions() {
1511
- return x(this.chartTypeOptions);
1519
+ return b(this.chartTypeOptions);
1512
1520
  }
1513
1521
  setExtendedHours(e) {
1514
1522
  e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
@@ -1517,7 +1525,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1517
1525
  return this.extendedHours;
1518
1526
  }
1519
1527
  sessionKeep(e) {
1520
- return this.extendedHours ? null : Gt(this.symbolInfo, e);
1528
+ return this.extendedHours ? null : Ht(this.symbolInfo, e);
1521
1529
  }
1522
1530
  shownBars(e) {
1523
1531
  let t = this.sessionKeep(e);
@@ -1558,7 +1566,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1558
1566
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
1559
1567
  }
1560
1568
  setShapes(e) {
1561
- let t = Kn(e);
1569
+ let t = Yn(e);
1562
1570
  t.tagRadius !== void 0 && (this.themeManager.setShape({
1563
1571
  ...this.themeManager.getTheme().shape,
1564
1572
  ...t
@@ -1603,7 +1611,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1603
1611
  setSymbolSeries(e, t) {
1604
1612
  e = e.trim(), this.symbolSeries.set(e, t), this.requestedSymbols.delete(e);
1605
1613
  let n = this.dataManager.getData(), r = !1;
1606
- 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);
1614
+ for (let t of this.indicatorEngine.getActiveIndicators()) !M.has(t.id) || String(t.params.symbol ?? "").trim() !== e.trim() || (this.indicatorEngine.updateIndicator(t.instanceId, {}, n), r = !0);
1607
1615
  r && (this.announceIndicatorUpdate(0), this.updateViewportAndRender());
1608
1616
  }
1609
1617
  forgetUnreadSymbols() {
@@ -1617,20 +1625,20 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1617
1625
  let e = /* @__PURE__ */ new Set();
1618
1626
  for (let t of this.indicatorEngine.getActiveIndicators()) {
1619
1627
  let n = t.params.symbol;
1620
- O.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1628
+ M.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
1621
1629
  }
1622
1630
  return [...e];
1623
1631
  }
1624
1632
  requestMissingSymbols(e) {
1625
1633
  this.forgetUnreadSymbols();
1626
- let t = this.indicatorEngine.getIndicatorConfig(e), n = t && O.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1634
+ let t = this.indicatorEngine.getIndicatorConfig(e), n = t && M.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
1627
1635
  !n || this.symbolSeries.has(n) || this.requestedSymbols.has(n) || (this.requestedSymbols.add(n), this.eventBus.emit("symbolSeriesRequest", { symbol: n }));
1628
1636
  }
1629
1637
  updateIndicator(e, t) {
1630
1638
  this.recordIndicators(e, () => this.updateIndicatorNow(e, t));
1631
1639
  }
1632
1640
  updateIndicatorNow(e, t) {
1633
- let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? A(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1641
+ let n = this.indicatorEngine.getIndicatorDescriptor(e), r = n ? P(n) : null, i = r ? this.indicatorEngine.getIndicatorConfig(e)?.params[r] : void 0;
1634
1642
  this.indicatorEngine.updateIndicator(e, t, this.dataManager.getData()), this.announceIndicatorUpdate(0), this.markStateChanged(), this.eventBus.emit("indicatorChange", {
1635
1643
  instanceId: e,
1636
1644
  change: "params"
@@ -1648,7 +1656,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1648
1656
  paneFor(e, t, n, r) {
1649
1657
  if (n) return this.paneHostOf(n, r);
1650
1658
  if (e.placement !== "overlay") return null;
1651
- let i = A(e), a = i ? y(t[i]) : null;
1659
+ let i = P(e), a = i ? y(t[i]) : null;
1652
1660
  return a ? this.paneHostOf(a.instanceId, r) : null;
1653
1661
  }
1654
1662
  paneHostOf(e, t) {
@@ -1691,8 +1699,8 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1691
1699
  return {
1692
1700
  ...e,
1693
1701
  priceRange: {
1694
- min: t.min - n * In,
1695
- max: t.max + n * In
1702
+ min: t.min - n * zn,
1703
+ max: t.max + n * zn
1696
1704
  },
1697
1705
  logScale: !1,
1698
1706
  scaleMode: "regular",
@@ -1744,7 +1752,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1744
1752
  this.indicatorEngine.setStyleDefaults(e, null);
1745
1753
  return;
1746
1754
  }
1747
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ne(n);
1755
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : x(n);
1748
1756
  this.indicatorEngine.setStyleDefaults(e, {
1749
1757
  ...r,
1750
1758
  ...i ? { plots: i } : {}
@@ -1752,7 +1760,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1752
1760
  }
1753
1761
  setPaneStyle(e, t) {
1754
1762
  let n = this.paneOf(e);
1755
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? re(t) : null));
1763
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? S(t) : null));
1756
1764
  }
1757
1765
  setPaneStyleNow(e, t) {
1758
1766
  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());
@@ -1771,8 +1779,8 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1771
1779
  return this.pluginManager;
1772
1780
  }
1773
1781
  static indicators() {
1774
- let e = new Le();
1775
- return At(e), e.getAvailableIndicators();
1782
+ let e = new O();
1783
+ return Dt(e), e.getAvailableIndicators();
1776
1784
  }
1777
1785
  setPanelPosition(e, t) {
1778
1786
  this.layoutManager.setPanelPosition(e, t), this.updateViewportAndRender(), this.eventBus.emit("indicatorChange", {
@@ -1795,7 +1803,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1795
1803
  paneMoveHost(e, t) {
1796
1804
  let n = this.indicatorEngine.getIndicatorConfig(e), r = this.indicatorEngine.getIndicatorDescriptor(e);
1797
1805
  if (!n || !r) return;
1798
- let i = A(r);
1806
+ let i = P(r);
1799
1807
  if (r.placement === "overlay" && i && y(n.params[i])) return;
1800
1808
  if (t === "price") return r.placement === "overlay" && n.pane ? null : void 0;
1801
1809
  if (t === "new") {
@@ -1902,12 +1910,12 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1902
1910
  return this.features.legend ? e + this.chartLegend.getHeight() : e;
1903
1911
  }
1904
1912
  isTimeAligned() {
1905
- return P(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1913
+ return R(this.options.chartType) ? !1 : this.getDisplayData().length === this.dataManager.getLength();
1906
1914
  }
1907
1915
  roundPrice(e) {
1908
1916
  if (!Number.isFinite(e)) return e;
1909
1917
  let t = this.stepAt(e);
1910
- if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(oe(t)));
1918
+ if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ae(t)));
1911
1919
  let { min: n, max: r } = this.viewport.getState().priceRange;
1912
1920
  return Number(e.toFixed(this.marketPricePrecision ?? c(n, r)));
1913
1921
  }
@@ -1991,7 +1999,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
1991
1999
  }
1992
2000
  autoFib() {
1993
2001
  if (!this.features.drawings) return null;
1994
- let e = this.getDisplayData(), t = this.viewport.getState(), n = xt(e, t.visibleRange.from, t.visibleRange.to);
2002
+ let e = this.getDisplayData(), t = this.viewport.getState(), n = vt(e, t.visibleRange.from, t.visibleRange.to);
1995
2003
  return n ? this.addDrawing({
1996
2004
  type: "fibRetracement",
1997
2005
  anchors: [n[0], n[1]]
@@ -2069,7 +2077,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2069
2077
  recordUndo(e) {
2070
2078
  if (!this.features.drawingUndoRedo || typeof e?.undo != "function" || typeof e.redo != "function") return;
2071
2079
  let t = performance.now(), n = this.undoRedoManager.last();
2072
- if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Rn) {
2080
+ if (e.subject !== void 0 && n?.type === "custom" && n.custom?.subject === e.subject && t - n.custom.at < Vn) {
2073
2081
  this.undoRedoManager.replaceLast({
2074
2082
  ...n,
2075
2083
  custom: {
@@ -2116,7 +2124,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2116
2124
  x: t.x,
2117
2125
  y: t.y
2118
2126
  };
2119
- 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") {
2127
+ if ((e === "plot" || e === "priceAxis") && (r.price = zt(t.y, n)), (e === "plot" || e === "timeAxis") && n.data.length > 0 && (r.time = I(t.x, n)), e === "pane") {
2120
2128
  let e = this.getIndicatorPanes().find((e) => t.y >= e.rect.y && t.y <= e.rect.y + e.rect.height);
2121
2129
  e && (r.pane = e.instanceId);
2122
2130
  }
@@ -2142,7 +2150,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2142
2150
  ...this.viewport.getState(),
2143
2151
  data: this.getDisplayData()
2144
2152
  };
2145
- this.setVisibleRange(M(e.x0, t), M(e.x1, t));
2153
+ this.setVisibleRange(I(e.x0, t), I(e.x1, t));
2146
2154
  }
2147
2155
  lockAllDrawings() {
2148
2156
  this.drawingManager.lockAllDrawings();
@@ -2187,7 +2195,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2187
2195
  for (let e of this.indicatorEngine.getActiveIndicators()) {
2188
2196
  let t = this.indicatorEngine.getOutput(e.instanceId)?.series;
2189
2197
  if (!t) continue;
2190
- 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) => ({
2198
+ let r = Xt(e.id, e.params, e.descriptor.defaultConfig, e.descriptor.shortName), o = e.descriptor.plots ?? Object.keys(t.find((e) => e) ?? {}).map((e) => ({
2191
2199
  key: e,
2192
2200
  title: e
2193
2201
  }));
@@ -2211,11 +2219,11 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2211
2219
  }
2212
2220
  getExportText(e = "csv", t = {}) {
2213
2221
  let { bars: n, columns: r } = this.getExportData(t);
2214
- return e === "json" ? w.toJSON(n, r) : w.toCSV(n, r);
2222
+ return e === "json" ? E.toJSON(n, r) : E.toCSV(n, r);
2215
2223
  }
2216
2224
  download(e, t, n) {
2217
2225
  let r = this.getExportText(e, n);
2218
- e === "json" ? w.download(r, t ?? "chart-data.json", "application/json") : w.download(r, t ?? "chart-data.csv", "text/csv");
2226
+ e === "json" ? E.download(r, t ?? "chart-data.json", "application/json") : E.download(r, t ?? "chart-data.csv", "text/csv");
2219
2227
  }
2220
2228
  setAutoSave(e, t = 5e3) {
2221
2229
  this.autoSaveScheduler.enable(e, t);
@@ -2277,7 +2285,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2277
2285
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2278
2286
  }
2279
2287
  updateIndicatorStyleNow(e, t) {
2280
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ne(n);
2288
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : x(n);
2281
2289
  this.indicatorEngine.updateIndicatorStyle(e, {
2282
2290
  ...r,
2283
2291
  ...i ? { plots: i } : {}
@@ -2396,12 +2404,12 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2396
2404
  this.features.trading && this.tradingManager.setConfig(e);
2397
2405
  }
2398
2406
  async connect(e) {
2399
- if (!jt(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2400
- this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new st(), this.streamManager.on("snapshot", (t) => {
2407
+ if (!Ot(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
2408
+ this.snapshotKey = null, this.replayStop(), this.disconnectStream(), this.streamManager = new it(), this.streamManager.on("snapshot", (t) => {
2401
2409
  let n = `${this.currentSymbol}|${this.streamTimeframe}`;
2402
2410
  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);
2403
2411
  }), this.streamManager.on("barClose", (e) => {
2404
- if (!L(e)) return;
2412
+ if (!z(e)) return;
2405
2413
  if (this.replaySession) {
2406
2414
  this.replaySession.live.appendBar(e), this.followLivePrice(e.close);
2407
2415
  return;
@@ -2413,7 +2421,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2413
2421
  let i = this.dataManager.getData();
2414
2422
  this.crosshairHandler.setData(i), this.displayDataCache = null, this.recalcIndicatorsFrom(i, i.length - 2), this.updateViewportAndRender(n), i.length !== r && this.emitBars(i.length), this.followLivePrice(e.close);
2415
2423
  }), this.streamManager.on("barUpdate", (e) => {
2416
- if (!L(e)) return;
2424
+ if (!z(e)) return;
2417
2425
  if (this.replaySession) {
2418
2426
  this.replaySession.live.updateLastBar(e);
2419
2427
  return;
@@ -2456,14 +2464,14 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2456
2464
  }), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
2457
2465
  let t = this.streamManager;
2458
2466
  if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
2459
- let n = ce(e.timeframe);
2467
+ let n = se(e.timeframe);
2460
2468
  this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
2461
2469
  this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
2462
2470
  }, 1e3);
2463
2471
  }
2464
2472
  setStreamTarget(e, t) {
2465
2473
  let n = this.announcedSymbol;
2466
- 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", {
2474
+ this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = oe(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
2467
2475
  symbol: e,
2468
2476
  previous: n
2469
2477
  })), this.useTimeframe(t);
@@ -2481,8 +2489,8 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2481
2489
  async switchStream(e, t) {
2482
2490
  if (!this.streamManager) return;
2483
2491
  let n = this.streamAdapter;
2484
- if (n && !jt(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2485
- 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);
2492
+ if (n && !Ot(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
2493
+ 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);
2486
2494
  }
2487
2495
  isIndicatorAllowed(e) {
2488
2496
  let t = this.features.indicatorIds;
@@ -2501,7 +2509,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2501
2509
  }
2502
2510
  connectExecution(e, t = {}) {
2503
2511
  if (!this.features.trading) throw Error("connectExecution requires features.trading to be enabled");
2504
- this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Mn(e, {
2512
+ this.disconnectExecution(), this.executionAdapter = e, this.execTeardown = Nn(e, {
2505
2513
  onIntent: (e, t) => {
2506
2514
  let n = (e) => t(e.payload);
2507
2515
  return this.eventBus.on(e, n), () => this.eventBus.off(e, n);
@@ -2592,18 +2600,18 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2592
2600
  goToTime(e) {
2593
2601
  let t = this.getDisplayData();
2594
2602
  if (t.length === 0 || !Number.isFinite(e)) return -1;
2595
- 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;
2603
+ let n = Math.max(0, Math.min(t.length - 1, Math.floor(F(e, t)))), r = this.viewport.getState(), i = n * (r.barWidth + r.barSpacing) + r.barWidth / 2 - r.chartRect.width / 2;
2596
2604
  return this.viewport.scrollBy(i - r.offset), this.updateViewportAndRender(), n;
2597
2605
  }
2598
2606
  setVisibleRangePreset(e) {
2599
2607
  let t = this.getDisplayData();
2600
2608
  if (t.length === 0) return;
2601
- let n = t.length - 1, r = l(t), i = Dt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2609
+ let n = t.length - 1, r = l(t), i = wt(e, t[n].time * r, this.displayTz), a = i === null ? null : i / r;
2602
2610
  if (a === null || a < t[0].time) {
2603
2611
  this.fitContent();
2604
2612
  return;
2605
2613
  }
2606
- let o = j(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2614
+ let o = F(a, t), s = Math.min(n, e === "YTD" ? Math.ceil(o) : Math.floor(o) + 1);
2607
2615
  this.viewport.zoomToBarRange(s, n + this.viewport.getRightMargin()), this.viewport.scrollToEnd(), this.updateViewportAndRender();
2608
2616
  }
2609
2617
  scrollToEnd() {
@@ -2628,7 +2636,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2628
2636
  setVisibleRange(e, t) {
2629
2637
  let n = this.getDisplayData();
2630
2638
  if (n.length === 0) return;
2631
- let r = j(Math.min(e, t), n), i = j(Math.max(e, t), n);
2639
+ let r = F(Math.min(e, t), n), i = F(Math.max(e, t), n);
2632
2640
  this.viewport.zoomToBarRange(r, i), this.updateViewportAndRender();
2633
2641
  }
2634
2642
  suspend() {
@@ -2734,7 +2742,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2734
2742
  this.applyStyle(e, t.layer ?? "host", !0);
2735
2743
  }
2736
2744
  setOverrides(e, t = {}) {
2737
- let n = t.layer ?? "host", { overrides: r, rejected: i } = b(e);
2745
+ let n = t.layer ?? "host", { overrides: r, rejected: i } = ne(e);
2738
2746
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`);
2739
2747
  let a = Object.fromEntries(Object.entries(r).filter(([, e]) => e !== null));
2740
2748
  this.themeManager.setOverrides(a, n) && this.styleChanged(n);
@@ -2753,7 +2761,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2753
2761
  return this.themeManager.getStyleValue(e);
2754
2762
  }
2755
2763
  applyStyle(e, t, n) {
2756
- let { overrides: r, rejected: i } = b(e);
2764
+ let { overrides: r, rejected: i } = ne(e);
2757
2765
  i.length > 0 && console.warn(`Style overrides left out (unknown key or value): ${i.join(", ")}`), this.themeManager.applyOverrides(r, t) && n && this.styleChanged(t);
2758
2766
  }
2759
2767
  styleChanged(e) {
@@ -2783,7 +2791,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2783
2791
  e ? this.crosshairHandler.onPointerMove(e) : this.crosshairHandler.onPointerLeave(), this.engine.requestRender(r.Hover);
2784
2792
  }
2785
2793
  setCrosshairTime(e) {
2786
- let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(j(e, t));
2794
+ let t = this.getDisplayData(), n = e === null || t.length === 0 ? null : Math.floor(F(e, t));
2787
2795
  n !== this.crosshairHandler.getSyncedSlot() && (this.crosshairHandler.setSyncedSlot(n), this.engine.requestRender(r.Hover));
2788
2796
  }
2789
2797
  getData() {
@@ -2844,40 +2852,56 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2844
2852
  setPeriodLevelsPeriod(e) {
2845
2853
  this.periodLevels.setPeriod(e), this.engine.requestRender(r.Main);
2846
2854
  }
2855
+ setTimeZone(e) {
2856
+ Ln(e), this.timeZoneSetting = e, this.applyTimeZone();
2857
+ }
2858
+ getTimeZone() {
2859
+ return this.timeZoneSetting;
2860
+ }
2861
+ getEffectiveTimeZone() {
2862
+ return this.displayTz;
2863
+ }
2864
+ getExchangeTimeZone() {
2865
+ return [w(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && g(e)) ?? null;
2866
+ }
2847
2867
  setTimezone(e) {
2848
- Fn(e), this.timezoneSetting = e, this.applyTimezone();
2868
+ this.setTimeZone(e);
2849
2869
  }
2850
2870
  getTimezone() {
2851
- return this.timezoneSetting;
2871
+ return this.getTimeZone();
2852
2872
  }
2853
2873
  getEffectiveTimezone() {
2854
- return this.displayTz;
2874
+ return this.getEffectiveTimeZone();
2855
2875
  }
2856
2876
  getExchangeTimezone() {
2857
- return [this.symbolInfo?.timezone, this.marketConfig?.timeZone].find((e) => e && g(e)) ?? null;
2877
+ return this.getExchangeTimeZone();
2858
2878
  }
2859
- applyTimezone() {
2860
- let e = this.timezoneSetting === "exchange" ? this.getExchangeTimezone() ?? "UTC" : this.timezoneSetting;
2879
+ setTimezoneOffset(e) {
2880
+ this.setTimeZone(e);
2881
+ }
2882
+ applyTimeZone() {
2883
+ let e = this.timeZoneSetting === "exchange" ? this.getExchangeTimeZone() ?? "UTC" : this.timeZoneSetting;
2861
2884
  this.displayTz = e, this.timeAxis.setTimezoneOffset(e), this.crosshairHandler.setTimezoneOffset(e), this.crosshairTooltip.setTimezoneOffset(e), this.pinnedTooltip.setTimezone(e), this.sessionBreaks.setTimezone(e), this.engine.requestRender();
2862
2885
  }
2863
2886
  setSymbolInfo(e) {
2864
- this.symbolInfo = e ? {
2887
+ let t = e && this.symbolInfo?.symbol === e.symbol ? w(this.symbolInfo) : void 0;
2888
+ this.symbolInfo = e ? Rn({
2865
2889
  ...e,
2866
2890
  sessions: e.sessions?.map((e) => ({ ...e }))
2867
- } : 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);
2868
- let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
2869
- let t = S(e.start), n = S(e.end);
2891
+ }, t) : 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);
2892
+ let n = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
2893
+ let t = C(e.start), n = C(e.end);
2870
2894
  return t === null || n === null ? [] : [{
2871
2895
  startMinute: t,
2872
2896
  endMinute: n
2873
2897
  }];
2874
- }), n = this.symbolInfo?.timezone;
2875
- this.sessionShading.replaceConfig(t.length > 0 && n && g(n) ? {
2876
- timeZone: n,
2877
- windows: t,
2878
- startMinute: t[0].startMinute,
2879
- endMinute: t[t.length - 1].endMinute
2880
- } : this.hostSessionHours), this.timezoneSetting === "exchange" && this.applyTimezone(), this.reapplyExtendedHours(), this.updateViewportAndRender(), this.eventBus.emit("symbolInfoChange", { info: this.symbolInfo });
2898
+ }), i = w(this.symbolInfo);
2899
+ this.sessionShading.replaceConfig(n.length > 0 && i && g(i) ? {
2900
+ timeZone: i,
2901
+ windows: n,
2902
+ startMinute: n[0].startMinute,
2903
+ endMinute: n[n.length - 1].endMinute
2904
+ } : this.hostSessionHours), this.timeZoneSetting === "exchange" && this.applyTimeZone(), this.reapplyExtendedHours(), this.updateViewportAndRender(), this.eventBus.emit("symbolInfoChange", { info: this.symbolInfo });
2881
2905
  }
2882
2906
  getSymbolInfo() {
2883
2907
  return this.symbolInfo;
@@ -2886,11 +2910,11 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2886
2910
  if (!e || typeof e != "object") return;
2887
2911
  let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
2888
2912
  if (!n(e.symbol)) return;
2889
- let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = {
2913
+ let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = Rn({
2890
2914
  ...r,
2891
2915
  ...e,
2892
2916
  symbol: e.symbol || r?.symbol || t
2893
- };
2917
+ }, w(r));
2894
2918
  r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
2895
2919
  }
2896
2920
  resolveStreamSymbol(e, t) {
@@ -2904,9 +2928,6 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2904
2928
  r === this.symbolInfoSeq && console.warn(`No symbol info for "${t}":`, e);
2905
2929
  });
2906
2930
  }
2907
- setTimezoneOffset(e) {
2908
- this.setTimezone(e);
2909
- }
2910
2931
  setPivotMarkersVisible(e) {
2911
2932
  this.pivotMarkers.setVisible(e), this.engine.requestRender(r.Overlay);
2912
2933
  }
@@ -2923,7 +2944,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2923
2944
  return this.sessionShading.isVisible();
2924
2945
  }
2925
2946
  setSessionShadingConfig(e) {
2926
- this.hostSessionHours = Tt(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2947
+ this.hostSessionHours = St(this.hostSessionHours, e), this.sessionShading.replaceConfig(this.hostSessionHours), this.engine.requestRender(r.Background);
2927
2948
  }
2928
2949
  setTooltipVisible(e) {
2929
2950
  e || this.crosshairTooltip.hide();
@@ -2942,11 +2963,11 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2942
2963
  return this.waitForGpu(null), e === "canvas" ? (this.applyRenderer(null), "canvas") : this.engine.getGpu() ? "webgl" : this.takeGpu(e, t, !0);
2943
2964
  }
2944
2965
  async takeGpu(e, t, n) {
2945
- let { gpu: r, reason: i } = await wt(e);
2946
- 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());
2966
+ let { gpu: r, reason: i } = await xt(e);
2967
+ return t !== this.rendererToken || this.disposed ? (r?.destroy(), this.getRenderer()) : i === "limit" ? yt() > 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());
2947
2968
  }
2948
2969
  waitForGpu(e) {
2949
- this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? zt(e) : null;
2970
+ this.stopWaitingForGpu?.(), this.stopWaitingForGpu = e ? It(e) : null;
2950
2971
  }
2951
2972
  getRenderer() {
2952
2973
  return this.engine.getGpu() ? "webgl" : "canvas";
@@ -2968,23 +2989,23 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
2968
2989
  this.engine.getGpu() && this.engine.renderNow();
2969
2990
  }
2970
2991
  screenshot(e) {
2971
- this.features.screenshot && (this.freshFrame(), k.download(this.container, e, this.themeManager.getTheme().background));
2992
+ this.features.screenshot && (this.freshFrame(), N.download(this.container, e, this.themeManager.getTheme().background));
2972
2993
  }
2973
2994
  async copyScreenshot() {
2974
2995
  if (!this.features.screenshot) return !1;
2975
2996
  try {
2976
2997
  this.freshFrame();
2977
- let e = await k.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2998
+ let e = await N.toBlob(this.container, this.themeManager.getTheme().background), t = globalThis.ClipboardItem;
2978
2999
  return !e || !navigator.clipboard?.write || !t ? !1 : (await navigator.clipboard.write([new t({ "image/png": e })]), !0);
2979
3000
  } catch {
2980
3001
  return !1;
2981
3002
  }
2982
3003
  }
2983
3004
  screenshotDataURL() {
2984
- return this.features.screenshot ? (this.freshFrame(), k.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
3005
+ return this.features.screenshot ? (this.freshFrame(), N.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
2985
3006
  }
2986
3007
  async screenshotBlob() {
2987
- return this.features.screenshot ? (this.freshFrame(), k.toBlob(this.container, this.themeManager.getTheme().background)) : null;
3008
+ return this.features.screenshot ? (this.freshFrame(), N.toBlob(this.container, this.themeManager.getTheme().background)) : null;
2988
3009
  }
2989
3010
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
2990
3011
  if (!this.features.alerts) return null;
@@ -3112,7 +3133,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3112
3133
  let t = this.replaySession ? this.replayOffset : 0;
3113
3134
  if (!this.replaySession) {
3114
3135
  if (this.dataManager.getLength() === 0) return;
3115
- let e = new B();
3136
+ let e = new V();
3116
3137
  e.setData(this.fullSeries ?? this.dataManager.getData()), this.replaySession = {
3117
3138
  live: e,
3118
3139
  price: null,
@@ -3120,23 +3141,23 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3120
3141
  };
3121
3142
  }
3122
3143
  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;
3123
- r !== void 0 && l === void 0 ? l = Xn(s, r) : c && l !== void 0 && (l += t);
3144
+ r !== void 0 && l === void 0 ? l = $n(s, r) : c && l !== void 0 && (l += t);
3124
3145
  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;
3125
3146
  l !== void 0 && (o.startIndex = l - u), this.replayOffset = u, this.replayRevealMarks = a !== !1;
3126
- let f = n ? er(n, d) : null;
3147
+ let f = n ? rr(n, d) : null;
3127
3148
  this.replayStepsSeries = f, this.replayCoarse = d, this.options.autoScale = !0, this.replayRestarting = !0;
3128
3149
  try {
3129
3150
  this.replayManager.load(f ?? d);
3130
3151
  } finally {
3131
3152
  this.replayRestarting = !1;
3132
3153
  }
3133
- f && o.startIndex !== void 0 && (o.startIndex = rr(f, d, o.startIndex)), this.replayBarUnsub?.();
3154
+ f && o.startIndex !== void 0 && (o.startIndex = or(f, d, o.startIndex)), this.replayBarUnsub?.();
3134
3155
  let p = -1, m = -1, h = null, g = f ?? d;
3135
3156
  this.replayBarUnsub = this.replayManager.on("bar", ({ index: e }) => {
3136
3157
  let t = e, n = d[e];
3137
3158
  if (f) {
3138
3159
  let r = f[e];
3139
- 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;
3160
+ t = ar(d, r.time), h = h !== null && m === e - 1 && t === p - 1 && h ? cr(h, r) : sr(d[t], f, e), n = h;
3140
3161
  }
3141
3162
  m = e;
3142
3163
  let r = t + 1, i = p > 0 && r >= p && this.dataManager.getLength() === p, a = !(i && !this.replaySeeking) || this.autoScrollOnNewBar && this.viewport.isAtEnd();
@@ -3188,20 +3209,20 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3188
3209
  return;
3189
3210
  }
3190
3211
  if (i.time <= n.fedTime) return;
3191
- let a = e.slice(Zn(e, n.fedTime), t + 1);
3212
+ let a = e.slice(er(e, n.fedTime), t + 1);
3192
3213
  n.fedTime = i.time;
3193
- let o = Math.ceil(a.length / Yn);
3194
- for (let e = 0; e < a.length; e += o) for (let [t, n] of Qn(a.slice(e, e + o))) r.setMarkPrice(t, n);
3214
+ let o = Math.ceil(a.length / Qn);
3215
+ for (let e = 0; e < a.length; e += o) for (let [t, n] of tr(a.slice(e, e + o))) r.setMarkPrice(t, n);
3195
3216
  this.tradingManager.setCurrentPrice(i.close);
3196
3217
  }
3197
3218
  getReplayBarIndex() {
3198
3219
  if (!this.replaySession) return -1;
3199
3220
  let { current: e } = this.replayManager.getProgress(), t = this.replayStepsSeries;
3200
- return t && this.replayCoarse ? nr(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3221
+ return t && this.replayCoarse ? ar(this.replayCoarse, t[e]?.time ?? -Infinity) : e;
3201
3222
  }
3202
3223
  replaySeekToBar(e) {
3203
3224
  let t = this.replayStepsSeries;
3204
- this.replaySeek(t && this.replayCoarse ? rr(t, this.replayCoarse, e) : e);
3225
+ this.replaySeek(t && this.replayCoarse ? or(t, this.replayCoarse, e) : e);
3205
3226
  }
3206
3227
  replayPause() {
3207
3228
  this.replayManager.pause();
@@ -3233,10 +3254,10 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3233
3254
  data: this.getDisplayData()
3234
3255
  }, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
3235
3256
  for (let e of t.anchors) {
3236
- let t = Mt(e.time, n), r = Et(e.price, n);
3257
+ let t = kt(e.time, n), r = Ct(e.price, n);
3237
3258
  i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
3238
3259
  }
3239
- 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 ? {
3260
+ return Wn.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Gn.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 ? {
3240
3261
  x: i,
3241
3262
  y: o,
3242
3263
  width: a - i,
@@ -3264,7 +3285,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3264
3285
  return this.replayManager.getProgress();
3265
3286
  }
3266
3287
  captureSnapshot() {
3267
- return C.capture({
3288
+ return T.capture({
3268
3289
  getDrawings: () => this.getDrawings(),
3269
3290
  getTheme: () => this.themeManager.getBaseTheme(),
3270
3291
  getAlerts: () => this.getAlerts(),
@@ -3277,14 +3298,14 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3277
3298
  });
3278
3299
  }
3279
3300
  restoreIndicators(e, t) {
3280
- let n = Wn(e), r = /* @__PURE__ */ new Map();
3301
+ let n = qn(e), r = /* @__PURE__ */ new Map();
3281
3302
  this.unrestoredIndicators = [];
3282
3303
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
3283
3304
  if (t) {
3284
3305
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
3285
3306
  for (let n of t) {
3286
3307
  let t = e.get(n.instanceId);
3287
- t && Gn(n, t) && o.add(n.instanceId);
3308
+ t && Jn(n, t) && o.add(n.instanceId);
3288
3309
  }
3289
3310
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
3290
3311
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -3346,7 +3367,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3346
3367
  let s = t.levels ?? null;
3347
3368
  JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s);
3348
3369
  let c = t.intervals ?? null;
3349
- JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? re(t.paneStyle) : null);
3370
+ JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? S(t.paneStyle) : null);
3350
3371
  }
3351
3372
  restorePanes(e) {
3352
3373
  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, {
@@ -3451,7 +3472,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3451
3472
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
3452
3473
  let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
3453
3474
  if (JSON.stringify(n) === JSON.stringify(i)) return r;
3454
- 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 = {
3475
+ let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Vn && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
3455
3476
  type: "indicators",
3456
3477
  before: null,
3457
3478
  after: null
@@ -3479,12 +3500,12 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3479
3500
  }
3480
3501
  saveState(e) {
3481
3502
  if (!this.features.saveLoad) return null;
3482
- let t = this.captureSnapshot(), n = C.serialize(t);
3483
- return e && C.saveToStorage(e, t), n;
3503
+ let t = this.captureSnapshot(), n = T.serialize(t);
3504
+ return e && T.saveToStorage(e, t), n;
3484
3505
  }
3485
3506
  loadState(e) {
3486
3507
  if (!this.features.saveLoad) return;
3487
- let t = C.deserialize(e);
3508
+ let t = T.deserialize(e);
3488
3509
  this.chartTypeOptions = t.chartTypeOptions ?? {}, this.displayDataCache = null, t.chartType && this.setChartType(t.chartType), t.drawings && this.setDrawings(t.drawings), (t.theme === "dark" || t.theme === "light") && this.setTheme(t.theme), t.version >= 3 && this.themeManager.setUserOverrides(t.overrides ?? {}) && this.styleChanged("user");
3489
3510
  let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
3490
3511
  if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
@@ -3495,7 +3516,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3495
3516
  let t = e.indexOf(":"), r = t > 0 ? n.get(e.slice(0, t)) : void 0;
3496
3517
  return r ? r + e.slice(t) : e;
3497
3518
  }, r = t(e.channel), i = {
3498
- ...Ot(e),
3519
+ ...Tt(e),
3499
3520
  ...e.target ? { target: t(e.target) } : {}
3500
3521
  };
3501
3522
  if (!e.expired) {
@@ -3515,19 +3536,19 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3515
3536
  }
3516
3537
  loadStateFromStorage(e) {
3517
3538
  if (!this.features.saveLoad) return !1;
3518
- let t = C.loadFromStorage(e);
3519
- return t ? (this.loadState(C.serialize(t)), !0) : !1;
3539
+ let t = T.loadFromStorage(e);
3540
+ return t ? (this.loadState(T.serialize(t)), !0) : !1;
3520
3541
  }
3521
3542
  downloadState(e) {
3522
- this.features.saveLoad && C.downloadFile(this.captureSnapshot(), e);
3543
+ this.features.saveLoad && T.downloadFile(this.captureSnapshot(), e);
3523
3544
  }
3524
3545
  async loadStateFromFile() {
3525
3546
  if (!this.features.saveLoad) return;
3526
- let e = await C.loadFromFile();
3527
- this.loadState(C.serialize(e));
3547
+ let e = await T.loadFromFile();
3548
+ this.loadState(T.serialize(e));
3528
3549
  }
3529
3550
  setLocale(e) {
3530
- ae(e), this.engine.requestRender();
3551
+ ie(e), this.engine.requestRender();
3531
3552
  }
3532
3553
  setNumberLocale(e) {
3533
3554
  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();
@@ -3536,7 +3557,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3536
3557
  return this.numberLocale;
3537
3558
  }
3538
3559
  setMarket(e) {
3539
- if (this.marketConfig = e, this.timezoneSetting === "exchange" && this.applyTimezone(), e.colorScheme) {
3560
+ if (this.marketConfig = e, this.timeZoneSetting === "exchange" && this.applyTimeZone(), e.colorScheme) {
3540
3561
  let t = {
3541
3562
  ...this.themeManager.getBaseTheme(),
3542
3563
  candleUp: e.colorScheme.up,
@@ -3586,8 +3607,8 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3586
3607
  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 = "";
3587
3608
  }
3588
3609
  createChartRenderer(e) {
3589
- let t = rn(e, (e) => this.pluginManager.getChartType(e));
3590
- return t instanceof Fe && t.setPriceText((e) => this.formatPrice(e)), t;
3610
+ let t = nn(e, (e) => this.pluginManager.getChartType(e));
3611
+ return t instanceof D && t.setPriceText((e) => this.formatPrice(e)), t;
3591
3612
  }
3592
3613
  crosshairSeries() {
3593
3614
  return this.isTimeAligned() ? this.dataManager.getData() : this.getDisplayData();
@@ -3596,8 +3617,8 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3596
3617
  if (this.displayDataCache) return this.displayDataCache;
3597
3618
  let e = this.dataManager.getData();
3598
3619
  if (e.length === 0) return e;
3599
- let t = an(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3600
- return this.chartRenderer instanceof E && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(F(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3620
+ let t = rn(this.options.chartType, e, (e) => this.pluginManager.getChartType(e), this.chartTypeOptions);
3621
+ return this.chartRenderer instanceof A && !this.pluginManager.getChartType(this.options.chartType) && this.chartRenderer.setBoxSize(en(e, this.chartTypeOptions)), this.displayDataCache = t, t;
3601
3622
  }
3602
3623
  recalcIndicatorsFrom(e, t) {
3603
3624
  this.indicatorEngine.recalculateFrom(e, t), this.announceIndicatorUpdate(t);
@@ -3650,12 +3671,12 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3650
3671
  }
3651
3672
  fitPriceScale(e, t) {
3652
3673
  if (e.length === 0) return;
3653
- 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;
3674
+ let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i = Zn(Zn(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() && Xn(e, n, r) ? this.volumeRenderer.getHeightRatio() + Bn : k;
3654
3675
  this.viewport.setScaleMargins(this.viewport.isInvertScale() ? {
3655
3676
  top: a,
3656
- bottom: T
3677
+ bottom: k
3657
3678
  } : {
3658
- top: T,
3679
+ top: k,
3659
3680
  bottom: a
3660
3681
  }), this.viewport.fitToPrices(i.min, i.max);
3661
3682
  }
@@ -3672,7 +3693,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3672
3693
  fitLeftAxisWidth() {
3673
3694
  let e = this.leftViewport;
3674
3695
  if (!e) return !1;
3675
- let t = this.themeManager.getTheme(), n = bn({
3696
+ let t = this.themeManager.getTheme(), n = xn({
3676
3697
  min: e.priceRange.min,
3677
3698
  max: e.priceRange.max,
3678
3699
  lastPrice: null,
@@ -3681,12 +3702,12 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3681
3702
  fontFamily: t.font.family,
3682
3703
  fontSizeSmall: t.font.sizeSmall,
3683
3704
  measure: (e, t) => this.measureText(e, t)
3684
- }), r = xn(this.leftAxisWidth, n);
3705
+ }), r = Sn(this.leftAxisWidth, n);
3685
3706
  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);
3686
3707
  }
3687
3708
  fitPriceAxisWidth() {
3688
3709
  if (!this.features.priceAxis) return !1;
3689
- let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = bn({
3710
+ let { priceRange: e } = this.viewport.getState(), t = this.themeManager.getTheme(), n = xn({
3690
3711
  min: e.min,
3691
3712
  max: e.max,
3692
3713
  lastPrice: this.currentPriceLine.getPrice(),
@@ -3697,7 +3718,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3697
3718
  fontFamily: t.font.family,
3698
3719
  fontSizeSmall: t.font.sizeSmall,
3699
3720
  measure: (e, t) => this.measureText(e, t)
3700
- }), r = xn(this.priceAxisWidth, n);
3721
+ }), r = Sn(this.priceAxisWidth, n);
3701
3722
  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);
3702
3723
  }
3703
3724
  measureText(e, t) {
@@ -3741,7 +3762,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3741
3762
  buildPanelRenderInfos() {
3742
3763
  if (this.panelInfoCache) return this.panelInfoCache;
3743
3764
  let e = this.getResolvedLayout(), t = this.viewport.getState(), { from: n, to: r } = t.visibleRange, i = e.panels.map((e) => {
3744
- 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 = {
3765
+ 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) ?? { ...Pn }, o = {
3745
3766
  x: e.rect.x,
3746
3767
  y: e.rect.y + 20,
3747
3768
  width: e.rect.width,
@@ -3823,7 +3844,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3823
3844
  });
3824
3845
  }
3825
3846
  drawOverlayPlugins(e, t) {
3826
- let n = wn(this.pluginManager.getOverlays(), t);
3847
+ let n = Tn(this.pluginManager.getOverlays(), t);
3827
3848
  if (n.length === 0) return;
3828
3849
  let r = {
3829
3850
  viewport: this.viewport.getState(),
@@ -3844,7 +3865,7 @@ var In = .08, Ln = a ** -7, Rn = 800, zn = 20, Bn = 8, Vn = new Set(["horizontal
3844
3865
  };
3845
3866
  }
3846
3867
  };
3847
- function Wn(e) {
3868
+ function qn(e) {
3848
3869
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
3849
3870
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
3850
3871
  i.add(e.instanceId);
@@ -3858,18 +3879,18 @@ function Wn(e) {
3858
3879
  for (let t of e) a(t);
3859
3880
  return n;
3860
3881
  }
3861
- function Gn(e, t) {
3882
+ function Jn(e, t) {
3862
3883
  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);
3863
3884
  }
3864
- function Kn(e) {
3885
+ function Yn(e) {
3865
3886
  let t = e.tagRadius;
3866
3887
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
3867
3888
  }
3868
- function qn(e, t, n) {
3889
+ function Xn(e, t, n) {
3869
3890
  for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
3870
3891
  return !1;
3871
3892
  }
3872
- function Jn(e, t) {
3893
+ function Zn(e, t) {
3873
3894
  return e ? t ? {
3874
3895
  min: Math.min(e.min, t.min),
3875
3896
  max: Math.max(e.max, t.max)
@@ -3890,8 +3911,8 @@ function G(e) {
3890
3911
  bars: e.bars
3891
3912
  };
3892
3913
  }
3893
- var Yn = 500;
3894
- function Xn(e, t) {
3914
+ var Qn = 500;
3915
+ function $n(e, t) {
3895
3916
  let n = 0, r = e.length;
3896
3917
  for (; n < r;) {
3897
3918
  let i = n + r >> 1;
@@ -3899,7 +3920,7 @@ function Xn(e, t) {
3899
3920
  }
3900
3921
  return n;
3901
3922
  }
3902
- function Zn(e, t) {
3923
+ function er(e, t) {
3903
3924
  let n = 0, r = e.length;
3904
3925
  for (; n < r;) {
3905
3926
  let i = n + r >> 1;
@@ -3907,20 +3928,20 @@ function Zn(e, t) {
3907
3928
  }
3908
3929
  return n;
3909
3930
  }
3910
- function Qn(e) {
3931
+ function tr(e) {
3911
3932
  let t = 0, n = 0;
3912
3933
  for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
3913
3934
  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];
3914
3935
  return [...a ? [r, i] : [i, r], [o.close, o.time]];
3915
3936
  }
3916
- function $n(e) {
3937
+ function nr(e) {
3917
3938
  let t = 0;
3918
3939
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
3919
3940
  return t > 0 ? t : Infinity;
3920
3941
  }
3921
- function er(e, t) {
3942
+ function rr(e, t) {
3922
3943
  if (t.length === 0) return null;
3923
- 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 = [];
3944
+ let n = t[t.length - 1].time + nr(t), r = e.filter((e) => ir(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
3924
3945
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
3925
3946
  if (i.length === 0) return null;
3926
3947
  let a = t.findIndex((e) => e.time >= i[0].time);
@@ -3928,7 +3949,7 @@ function er(e, t) {
3928
3949
  let o = t.slice(0, a), s = i.filter((e) => e.time >= t[a].time);
3929
3950
  return [...o, ...s];
3930
3951
  }
3931
- function tr(e) {
3952
+ function ir(e) {
3932
3953
  return [
3933
3954
  e.time,
3934
3955
  e.open,
@@ -3937,7 +3958,7 @@ function tr(e) {
3937
3958
  e.close
3938
3959
  ].every(Number.isFinite);
3939
3960
  }
3940
- function nr(e, t) {
3961
+ function ar(e, t) {
3941
3962
  let n = 0, r = e.length - 1;
3942
3963
  for (; n < r;) {
3943
3964
  let i = n + r + 1 >> 1;
@@ -3945,22 +3966,22 @@ function nr(e, t) {
3945
3966
  }
3946
3967
  return n;
3947
3968
  }
3948
- function rr(e, t, n) {
3969
+ function or(e, t, n) {
3949
3970
  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;
3950
3971
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
3951
3972
  return Math.max(0, a);
3952
3973
  }
3953
- function ir(e, t, n) {
3974
+ function sr(e, t, n) {
3954
3975
  let r = n;
3955
3976
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
3956
3977
  let i = {
3957
3978
  ...t[r],
3958
3979
  time: e.time
3959
3980
  };
3960
- for (let e = r + 1; e <= n; e++) i = ar(i, t[e]);
3981
+ for (let e = r + 1; e <= n; e++) i = cr(i, t[e]);
3961
3982
  return i;
3962
3983
  }
3963
- function ar(e, t) {
3984
+ function cr(e, t) {
3964
3985
  return {
3965
3986
  time: e.time,
3966
3987
  open: e.open,
@@ -3978,26 +3999,26 @@ function K(e, t) {
3978
3999
  }
3979
4000
  //#endregion
3980
4001
  //#region src/io/parseOHLCV.ts
3981
- var or = [
4002
+ var lr = [
3982
4003
  "time",
3983
4004
  "timestamp",
3984
4005
  "date",
3985
4006
  "datetime",
3986
4007
  "t"
3987
- ], sr = ["open", "o"], cr = ["high", "h"], lr = ["low", "l"], ur = ["close", "c"], dr = [
4008
+ ], ur = ["open", "o"], dr = ["high", "h"], fr = ["low", "l"], pr = ["close", "c"], q = [
3988
4009
  "volume",
3989
4010
  "vol",
3990
4011
  "v"
3991
4012
  ];
3992
- function fr(e) {
4013
+ function mr(e) {
3993
4014
  let t = e.trim();
3994
- return t ? t[0] === "[" || t[0] === "{" ? pr(t) : mr(t) : {
4015
+ return t ? t[0] === "[" || t[0] === "{" ? hr(t) : gr(t) : {
3995
4016
  data: [],
3996
4017
  rowCount: 0,
3997
4018
  skipped: 0
3998
4019
  };
3999
4020
  }
4000
- function pr(e) {
4021
+ function hr(e) {
4001
4022
  let t;
4002
4023
  try {
4003
4024
  t = JSON.parse(e);
@@ -4007,19 +4028,19 @@ function pr(e) {
4007
4028
  if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
4008
4029
  let n = [], r = 0;
4009
4030
  for (let e of t) {
4010
- let t = Array.isArray(e) ? vr(e) : _r(e);
4031
+ let t = Array.isArray(e) ? xr(e) : br(e);
4011
4032
  t ? n.push(t) : r++;
4012
4033
  }
4013
- return yr(n, t.length, r);
4034
+ return Sr(n, t.length, r);
4014
4035
  }
4015
- function mr(e) {
4036
+ function gr(e) {
4016
4037
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
4017
4038
  if (t.length === 0) return {
4018
4039
  data: [],
4019
4040
  rowCount: 0,
4020
4041
  skipped: 0
4021
4042
  };
4022
- 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) : {
4043
+ let n = _r(t[0]), r = vr(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? yr(r) : {
4023
4044
  time: 0,
4024
4045
  open: 1,
4025
4046
  high: 2,
@@ -4030,7 +4051,7 @@ function mr(e) {
4030
4051
  if (a.time < 0 || a.open < 0 || a.high < 0 || a.low < 0 || a.close < 0) throw Error("CSV is missing required column(s): time, open, high, low, close");
4031
4052
  let o = [], s = 0;
4032
4053
  for (let e = +!!i; e < t.length; e++) {
4033
- let r = q(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
4054
+ let r = vr(t[e], n), i = Y(r[a.time]), c = J(r[a.open]), l = J(r[a.high]), u = J(r[a.low]), d = J(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
4034
4055
  if (i === null || ![
4035
4056
  c,
4036
4057
  l,
@@ -4049,9 +4070,9 @@ function mr(e) {
4049
4070
  volume: Number.isFinite(f) ? f : 0
4050
4071
  });
4051
4072
  }
4052
- return yr(o, t.length - +!!i, s);
4073
+ return Sr(o, t.length - +!!i, s);
4053
4074
  }
4054
- function hr(e) {
4075
+ function _r(e) {
4055
4076
  let t = {
4056
4077
  ",": 0,
4057
4078
  ";": 0,
@@ -4063,7 +4084,7 @@ function hr(e) {
4063
4084
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
4064
4085
  return n;
4065
4086
  }
4066
- function q(e, t) {
4087
+ function vr(e, t) {
4067
4088
  let n = [], r = "", i = !1;
4068
4089
  for (let a = 0; a < e.length; a++) {
4069
4090
  let o = e[a];
@@ -4071,25 +4092,25 @@ function q(e, t) {
4071
4092
  }
4072
4093
  return n.push(r), n;
4073
4094
  }
4074
- function gr(e) {
4095
+ function yr(e) {
4075
4096
  let t = (t) => e.findIndex((e) => t.includes(e));
4076
4097
  return {
4077
- time: t(or),
4078
- open: t(sr),
4079
- high: t(cr),
4080
- low: t(lr),
4081
- close: t(ur),
4082
- volume: t(dr)
4098
+ time: t(lr),
4099
+ open: t(ur),
4100
+ high: t(dr),
4101
+ low: t(fr),
4102
+ close: t(pr),
4103
+ volume: t(q)
4083
4104
  };
4084
4105
  }
4085
- function _r(e) {
4106
+ function br(e) {
4086
4107
  let t = (t) => {
4087
4108
  for (let n of t) {
4088
4109
  if (e[n] !== void 0) return e[n];
4089
4110
  let t = n.toUpperCase();
4090
4111
  if (e[t] !== void 0) return e[t];
4091
4112
  }
4092
- }, 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);
4113
+ }, n = Y(String(t(lr) ?? "")), r = Number(t(ur)), i = Number(t(dr)), a = Number(t(fr)), o = Number(t(pr)), s = Number(t(q) ?? 0);
4093
4114
  return n === null || ![
4094
4115
  r,
4095
4116
  i,
@@ -4104,7 +4125,7 @@ function _r(e) {
4104
4125
  volume: Number.isFinite(s) ? s : 0
4105
4126
  };
4106
4127
  }
4107
- function vr(e) {
4128
+ function xr(e) {
4108
4129
  if (e.length < 5) return null;
4109
4130
  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;
4110
4131
  return t === null || ![
@@ -4132,7 +4153,7 @@ function Y(e) {
4132
4153
  let r = Date.parse(t);
4133
4154
  return Number.isFinite(r) ? r : null;
4134
4155
  }
4135
- function yr(e, t, n) {
4156
+ function Sr(e, t, n) {
4136
4157
  e.sort((e, t) => e.time - t.time);
4137
4158
  let r = [];
4138
4159
  for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
@@ -4144,7 +4165,7 @@ function yr(e, t, n) {
4144
4165
  }
4145
4166
  //#endregion
4146
4167
  //#region src/io/DragDropImporter.ts
4147
- var br = class {
4168
+ var Cr = class {
4148
4169
  host;
4149
4170
  overlay = null;
4150
4171
  callbacks;
@@ -4177,7 +4198,7 @@ var br = class {
4177
4198
  e.preventDefault(), this.depth = 0, this.hideOverlay();
4178
4199
  let t = e.dataTransfer?.files?.[0];
4179
4200
  if (t) try {
4180
- let e = fr(await t.text());
4201
+ let e = mr(await t.text());
4181
4202
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
4182
4203
  this.callbacks.onData(e.data, e, t);
4183
4204
  } catch (e) {
@@ -4221,7 +4242,7 @@ function Z(e) {
4221
4242
  };
4222
4243
  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;
4223
4244
  }
4224
- var xr = (e, t) => t.updatedAt - e.updatedAt;
4245
+ var wr = (e, t) => t.updatedAt - e.updatedAt;
4225
4246
  function Q(e) {
4226
4247
  if (typeof e != "object" || !e) return null;
4227
4248
  let t = e;
@@ -4234,17 +4255,17 @@ function Q(e) {
4234
4255
  kind: typeof t.kind == "string" ? t.kind : void 0
4235
4256
  });
4236
4257
  }
4237
- function Sr(e) {
4258
+ function Tr(e) {
4238
4259
  let t = Q(e), n = t ? e.content : void 0;
4239
4260
  return t && typeof n == "string" ? {
4240
4261
  ...t,
4241
4262
  content: n
4242
4263
  } : null;
4243
4264
  }
4244
- function Cr(e = []) {
4265
+ function Er(e = []) {
4245
4266
  let t = new Map(e.map((e) => [e.id, { ...e }]));
4246
4267
  return {
4247
- list: () => [...t.values()].map(Z).sort(xr),
4268
+ list: () => [...t.values()].map(Z).sort(wr),
4248
4269
  load: (e) => {
4249
4270
  let n = t.get(e);
4250
4271
  return n ? { ...n } : null;
@@ -4257,7 +4278,7 @@ function Cr(e = []) {
4257
4278
  }
4258
4279
  };
4259
4280
  }
4260
- function wr(e = "tcw:layouts:") {
4281
+ function Dr(e = "tcw:layouts:") {
4261
4282
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
4262
4283
  let e;
4263
4284
  try {
@@ -4268,7 +4289,7 @@ function wr(e = "tcw:layouts:") {
4268
4289
  return Array.isArray(e) ? e.map(Q).filter((e) => e !== null) : [];
4269
4290
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
4270
4291
  return {
4271
- list: () => r().sort(xr),
4292
+ list: () => r().sort(wr),
4272
4293
  load: (e) => {
4273
4294
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
4274
4295
  return t && i !== null ? {
@@ -4286,14 +4307,14 @@ function wr(e = "tcw:layouts:") {
4286
4307
  }
4287
4308
  //#endregion
4288
4309
  //#region src/state/LayoutSession.ts
4289
- var Tr = 80;
4310
+ var Or = 80;
4290
4311
  function $(e) {
4291
4312
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
4292
4313
  }
4293
- function Er() {
4314
+ function kr() {
4294
4315
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
4295
4316
  }
4296
- function Dr(e) {
4317
+ function Ar(e) {
4297
4318
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
4298
4319
  return {
4299
4320
  id: t,
@@ -4304,7 +4325,7 @@ function Dr(e) {
4304
4325
  ...o === void 0 ? {} : { kind: o }
4305
4326
  };
4306
4327
  }
4307
- var Or = class {
4328
+ var jr = class {
4308
4329
  currentLayout = null;
4309
4330
  savedContent = null;
4310
4331
  dirty = !1;
@@ -4320,7 +4341,7 @@ var Or = class {
4320
4341
  now;
4321
4342
  newId;
4322
4343
  constructor(e, t, n = {}) {
4323
- 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;
4344
+ 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 ?? kr;
4324
4345
  }
4325
4346
  current() {
4326
4347
  return this.currentLayout;
@@ -4350,7 +4371,7 @@ var Or = class {
4350
4371
  }
4351
4372
  open(e) {
4352
4373
  return this.queue(async () => {
4353
- let t = Sr(await this.storage.load(e));
4374
+ let t = Tr(await this.storage.load(e));
4354
4375
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
4355
4376
  this.cancelTimer(), this.applying++;
4356
4377
  try {
@@ -4360,13 +4381,13 @@ var Or = class {
4360
4381
  } finally {
4361
4382
  this.applying--;
4362
4383
  }
4363
- return this.cancelTimer(), this.currentLayout = Dr(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4384
+ return this.cancelTimer(), this.currentLayout = Ar(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
4364
4385
  });
4365
4386
  }
4366
4387
  rename(e, t) {
4367
4388
  let n = $(t);
4368
4389
  return n ? this.queue(async () => {
4369
- let t = Sr(await this.storage.load(e));
4390
+ let t = Tr(await this.storage.load(e));
4370
4391
  !t || t.id !== e || (await this.storage.save({
4371
4392
  ...t,
4372
4393
  name: n
@@ -4444,7 +4465,7 @@ var Or = class {
4444
4465
  content: n.content
4445
4466
  };
4446
4467
  await this.storage.save(r);
4447
- let i = Dr(r);
4468
+ let i = Ar(r);
4448
4469
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
4449
4470
  }
4450
4471
  forget() {
@@ -4465,6 +4486,6 @@ var Or = class {
4465
4486
  }
4466
4487
  };
4467
4488
  //#endregion
4468
- 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 };
4489
+ export { V as C, sn as S, Tn as _, Er as a, dn as b, Kn as c, An as d, kn as f, wn as g, Dn as h, Dr as i, In as l, En as m, Or as n, Cr as o, On as p, $ as r, mr as s, jr as t, Fn as u, U as v, Xt as w, ln as x, gn as y };
4469
4490
 
4470
- //# sourceMappingURL=LayoutSession-B-avgafz.js.map
4491
+ //# sourceMappingURL=LayoutSession-Ccv3vSuZ.js.map