@tradecanvas/chart 1.60.0 → 1.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/Chart.d.ts +31 -0
  2. package/dist/Chart.d.ts.map +1 -1
  3. package/dist/{LayoutSession-CXCLFIvS.js → LayoutSession-BQvEMVYA.js} +320 -254
  4. package/dist/LayoutSession-BQvEMVYA.js.map +1 -0
  5. package/dist/LayoutSession-CbcTJnyw.cjs +2 -0
  6. package/dist/LayoutSession-CbcTJnyw.cjs.map +1 -0
  7. package/dist/i18n-BWqZTNzQ.cjs +2 -0
  8. package/dist/i18n-BWqZTNzQ.cjs.map +1 -0
  9. package/dist/{i18n-BaJ3lo-i.js → i18n-DJ4XwjQ1.js} +7 -1
  10. package/dist/i18n-DJ4XwjQ1.js.map +1 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/widget/ChartWidget.d.ts +10 -0
  16. package/dist/widget/ChartWidget.d.ts.map +1 -1
  17. package/dist/widget/WidgetContextMenu.d.ts +9 -1
  18. package/dist/widget/WidgetContextMenu.d.ts.map +1 -1
  19. package/dist/widget/WidgetDrawingSidebar.d.ts.map +1 -1
  20. package/dist/widget/index.cjs +5 -5
  21. package/dist/widget/index.cjs.map +1 -1
  22. package/dist/widget/index.js +181 -134
  23. package/dist/widget/index.js.map +1 -1
  24. package/dist/widget/locales/ar.d.ts.map +1 -1
  25. package/dist/widget/locales/cs.d.ts.map +1 -1
  26. package/dist/widget/locales/da.d.ts.map +1 -1
  27. package/dist/widget/locales/de.d.ts.map +1 -1
  28. package/dist/widget/locales/el.d.ts.map +1 -1
  29. package/dist/widget/locales/en.d.ts +3 -0
  30. package/dist/widget/locales/en.d.ts.map +1 -1
  31. package/dist/widget/locales/es.d.ts.map +1 -1
  32. package/dist/widget/locales/et.d.ts.map +1 -1
  33. package/dist/widget/locales/fa.d.ts.map +1 -1
  34. package/dist/widget/locales/fr.d.ts.map +1 -1
  35. package/dist/widget/locales/he.d.ts.map +1 -1
  36. package/dist/widget/locales/hu.d.ts.map +1 -1
  37. package/dist/widget/locales/id.d.ts.map +1 -1
  38. package/dist/widget/locales/index.cjs +1 -1
  39. package/dist/widget/locales/index.cjs.map +1 -1
  40. package/dist/widget/locales/index.js +85 -1
  41. package/dist/widget/locales/index.js.map +1 -1
  42. package/dist/widget/locales/it.d.ts.map +1 -1
  43. package/dist/widget/locales/ja.d.ts.map +1 -1
  44. package/dist/widget/locales/ko.d.ts.map +1 -1
  45. package/dist/widget/locales/ms.d.ts.map +1 -1
  46. package/dist/widget/locales/nb.d.ts.map +1 -1
  47. package/dist/widget/locales/nl.d.ts.map +1 -1
  48. package/dist/widget/locales/pl.d.ts.map +1 -1
  49. package/dist/widget/locales/pt.d.ts.map +1 -1
  50. package/dist/widget/locales/ro.d.ts.map +1 -1
  51. package/dist/widget/locales/ru.d.ts.map +1 -1
  52. package/dist/widget/locales/sk.d.ts.map +1 -1
  53. package/dist/widget/locales/sv.d.ts.map +1 -1
  54. package/dist/widget/locales/th.d.ts.map +1 -1
  55. package/dist/widget/locales/tr.d.ts.map +1 -1
  56. package/dist/widget/locales/vi.d.ts.map +1 -1
  57. package/dist/widget/locales/zh.d.ts.map +1 -1
  58. package/dist/widget/locales/zhHant.d.ts.map +1 -1
  59. package/dist/widget/types.d.ts +2 -1
  60. package/dist/widget/types.d.ts.map +1 -1
  61. package/package.json +3 -3
  62. package/dist/LayoutSession-C5qP7hiA.cjs +0 -2
  63. package/dist/LayoutSession-C5qP7hiA.cjs.map +0 -1
  64. package/dist/LayoutSession-CXCLFIvS.js.map +0 -1
  65. package/dist/i18n-BaJ3lo-i.js.map +0 -1
  66. package/dist/i18n-SIiP0kRx.cjs +0 -2
  67. package/dist/i18n-SIiP0kRx.cjs.map +0 -1
@@ -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, barDateZone as l, barTimeUnit as u, barsAreDaily as d, chartStyleValue as f, computePriceLimits as p, computePriceRange as m, createMarketTheme as h, formatPrice as g, fractionTick as _, indicatorSource as v, isValidTimeZone as y, mergeBar as ee, niceNumber as te, normalizeBarTime as b, parseIndicatorSource as x, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as ae, readIndicatorPlotStyles as oe, readPaneStyle as se, resolveChartTheme as ce, sessionMinute as S, setLocale as le, stepDecimals as ue, symbolTimeZone as C, tickBarCount as de, timeframeToMs as w, zonedDateFormatter as fe } from "@tradecanvas/commons";
2
- import { AlertDragHandler as pe, AlertManager as me, Animator as he, AreaRenderer as ge, AxisDragHandler as _e, BarCountdown as ve, BarRenderer as ye, BaselineRenderer as be, CandlestickRenderer as xe, ChartLegend as Se, ChartStateManager as T, CompareRenderer as Ce, CompareSymbolIndicator as we, CompareSymbolPaneIndicator as Te, CorrelationCoefficientIndicator as Ee, CorrelationLogIndicator as De, CrosshairHandler as Oe, CrosshairTooltip as ke, CurrentPriceLine as Ae, DEFAULT_SESSION_HOURS as je, DataExporter as E, DepthHeatmapRenderer as Me, DrawingManager as Ne, DrawingRenderer as Pe, EquivolumeRenderer as Fe, EventBus as Ie, GridRenderer as Le, HLCAreaRenderer as Re, HiLoRenderer as ze, HollowCandleRenderer as Be, IndicatorEngine as Ve, InteractionManager as He, KagiRenderer as Ue, KeyboardHandler as We, LineRenderer as Ge, LineWithMarkersRenderer as Ke, MarketProfileRenderer as qe, MeasureOverlay as Je, PRICE_AXIS_ADD_STRIP as Ye, PRICE_SCALE_MARGIN as D, PanHandler as Xe, PaneResizeHandler as Ze, PeriodLevelsRenderer as Qe, PinnedTooltip as $e, PivotMarkersRenderer as et, PointAndFigureRenderer as tt, PriceAxis as nt, PriceAxisAddButton as rt, PriceLines as it, RenderEngine as at, RenkoRenderer as ot, ReplayManager as st, ResamplingAdapter as ct, ReshapeMemo as lt, SYMBOL_INDICATOR_IDS as O, SYMBOL_ZONE_WAIT_MS as ut, Screenshot as k, SelectionBoxOverlay as dt, SessionBreaks as ft, SessionShading as pt, SignalMarkerManager as mt, SpreadIndicator as ht, StepLineRenderer as gt, StreamManager as _t, SymbolSeriesStore as vt, TimeAxis as yt, TradeZoneManager as bt, TradingManager as xt, TradingRenderer as St, UndoRedoManager as Ct, Viewport as wt, VolumeCandleRenderer as Tt, VolumeProfileRenderer as Et, VolumeRenderer as Dt, Watermark as Ot, ZoomHandler as kt, axisTimes as A, barTimeStepMs as At, findDominantSwing as jt, gpuContextsLeft as Mt, isPriceLevelAlert as Nt, isRegularSession as Pt, loadWebGL as Ft, mergeSessionHours as It, pointAndFigureColumns as Lt, priceToY as Rt, rangePresetStart as zt, readAlertOptions as Bt, registerBuiltInDrawingTools as Vt, registerBuiltInIndicators as Ht, servesTimeframe as j, sourceParam as M, timeToX as Ut, timestampToBarIndex as N, toHeikinAshi as Wt, toKagi as Gt, toLineBreak as Kt, toRangeBars as qt, toRenko as Jt, whenGpuContextFree as Yt, withResampling as P, xToBarIndex as Xt, xToTime as F, yToPrice as Zt } from "@tradecanvas/core";
1
+ import { DARK_THEME as e, DEFAULT_PANEL_HEIGHT as t, LIGHT_THEME as n, LayerType as r, MIN_PANEL_HEIGHT as i, PHI as a, PRICE_AXIS_WIDTH as o, TIME_AXIS_HEIGHT as s, autoPricePrecision as c, barDateZone as l, barTimeUnit as u, barsAreDaily as d, chartStyleValue as f, computePriceLimits as p, computePriceRange as m, createMarketTheme as h, formatPrice as g, fractionTick as _, indicatorSource as v, isValidTimeZone as y, mergeBar as ee, niceNumber as te, normalizeBarTime as b, parseIndicatorSource as x, priceFormatterFor as ne, priceStepAt as re, readChartStyleOverrides as ie, readChartTypeOptions as S, readIndicatorPlotStyles as ae, readPaneStyle as oe, resolveChartTheme as se, sessionMinute as C, setLocale as ce, stepDecimals as le, symbolTimeZone as w, tickBarCount as ue, timeframeToMs as T, zonedDateFormatter as de } from "@tradecanvas/commons";
2
+ import { AlertDragHandler as fe, AlertManager as pe, Animator as me, AreaRenderer as he, AxisDragHandler as ge, BarCountdown as _e, BarRenderer as ve, BaselineRenderer as ye, CandlestickRenderer as be, ChartLegend as xe, ChartStateManager as E, CompareRenderer as Se, CompareSymbolIndicator as Ce, CompareSymbolPaneIndicator as we, CorrelationCoefficientIndicator as Te, CorrelationLogIndicator as Ee, CrosshairHandler as De, CrosshairTooltip as Oe, CurrentPriceLine as ke, DEFAULT_SESSION_HOURS as Ae, DataExporter as D, DepthHeatmapRenderer as je, DrawingManager as Me, DrawingRenderer as Ne, EquivolumeRenderer as Pe, EventBus as Fe, GridRenderer as Ie, HLCAreaRenderer as Le, HiLoRenderer as Re, HollowCandleRenderer as ze, IndicatorEngine as Be, InteractionManager as Ve, KagiRenderer as He, KeyboardHandler as Ue, LineRenderer as We, LineWithMarkersRenderer as Ge, MarketProfileRenderer as Ke, MeasureOverlay as qe, PRICE_AXIS_ADD_STRIP as Je, PRICE_SCALE_MARGIN as O, PanHandler as Ye, PaneResizeHandler as Xe, PeriodLevelsRenderer as Ze, PinnedTooltip as Qe, PivotMarkersRenderer as $e, PointAndFigureRenderer as et, PriceAxis as tt, PriceAxisAddButton as nt, PriceLines as rt, RenderEngine as it, RenkoRenderer as at, ReplayManager as ot, ResamplingAdapter as st, ReshapeMemo as ct, SYMBOL_INDICATOR_IDS as k, SYMBOL_ZONE_WAIT_MS as lt, Screenshot as A, SelectionBoxOverlay as ut, SessionBreaks as dt, SessionShading as ft, SignalMarkerManager as pt, SpreadIndicator as mt, StepLineRenderer as ht, StreamManager as gt, SymbolSeriesStore as _t, TimeAxis as vt, TradeZoneManager as yt, TradingManager as bt, TradingRenderer as xt, UndoRedoManager as St, Viewport as Ct, VolumeCandleRenderer as wt, VolumeProfileRenderer as Tt, VolumeRenderer as Et, Watermark as Dt, ZoomHandler as Ot, axisTimes as kt, barTimeStepMs as At, findDominantSwing as jt, gpuContextsLeft as Mt, isPriceLevelAlert as Nt, isRegularSession as Pt, loadWebGL as Ft, mergeSessionHours as It, pointAndFigureColumns as Lt, priceToY as Rt, rangePresetStart as zt, readAlertOptions as Bt, registerBuiltInDrawingTools as Vt, registerBuiltInIndicators as Ht, servesTimeframe as j, sourceParam as M, timeToX as Ut, timestampToBarIndex as N, toHeikinAshi as Wt, toKagi as Gt, toLineBreak as Kt, toRangeBars as qt, toRenko as Jt, whenGpuContextFree as Yt, withResampling as P, xToBarIndex as Xt, xToTime as F, yToPrice as Zt } from "@tradecanvas/core";
3
3
  //#region src/regularHours.ts
4
4
  var Qt = 864e5, $t = 10;
5
5
  function en(e, t) {
6
- let n = C(e);
6
+ let n = w(e);
7
7
  if (!n || !y(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
@@ -178,22 +178,22 @@ function fn(e) {
178
178
  case "candlestick":
179
179
  case "heikinAshi":
180
180
  case "lineBreak":
181
- case "rangeBars": return new xe();
182
- case "line": return new Ge();
183
- case "area": return new ge();
184
- case "bar": return new ye();
185
- case "hollowCandle": return new Be();
186
- case "baseline": return new be();
187
- case "renko": return new ot();
188
- case "kagi": return new Ue();
189
- case "pointAndFigure": return new tt();
190
- case "volumeCandles": return new Tt();
191
- case "equivolume": return new Fe();
192
- case "hlcArea": return new Re();
193
- case "stepLine": return new gt();
194
- case "lineWithMarkers": return new Ke();
195
- case "hiLo": return new ze();
196
- default: return new xe();
181
+ case "rangeBars": return new be();
182
+ case "line": return new We();
183
+ case "area": return new he();
184
+ case "bar": return new ve();
185
+ case "hollowCandle": return new ze();
186
+ case "baseline": return new ye();
187
+ case "renko": return new at();
188
+ case "kagi": return new He();
189
+ case "pointAndFigure": return new et();
190
+ case "volumeCandles": return new wt();
191
+ case "equivolume": return new Pe();
192
+ case "hlcArea": return new Le();
193
+ case "stepLine": return new ht();
194
+ case "lineWithMarkers": return new Ge();
195
+ case "hiLo": return new Re();
196
+ default: return new be();
197
197
  }
198
198
  }
199
199
  function pn(e, t, n = {}, r, i) {
@@ -787,7 +787,7 @@ var qn = class t {
787
787
  return i;
788
788
  }
789
789
  getTheme() {
790
- return this.effective ??= ce(this.base, this.chartType, this.merged()), this.effective;
790
+ return this.effective ??= se(this.base, this.chartType, this.merged()), this.effective;
791
791
  }
792
792
  getBaseTheme() {
793
793
  return this.base;
@@ -1481,17 +1481,17 @@ var Nr = [
1481
1481
  "1d"
1482
1482
  ];
1483
1483
  function Pr(e, t) {
1484
- let n = w(e);
1484
+ let n = T(e);
1485
1485
  return n > 0 ? Nr.filter((e) => {
1486
- let r = w(e);
1486
+ let r = T(e);
1487
1487
  return r < n && n % r === 0 && t(e);
1488
1488
  }) : [];
1489
1489
  }
1490
1490
  function Fr(e, t, n) {
1491
1491
  let r = Pr(t, n);
1492
1492
  if (e !== "auto") return r.includes(e) ? e : null;
1493
- let i = w(t);
1494
- return r.find((e) => i / w(e) <= 60) ?? null;
1493
+ let i = T(t);
1494
+ return r.find((e) => i / T(e) <= 60) ?? null;
1495
1495
  }
1496
1496
  //#endregion
1497
1497
  //#region src/Chart.ts
@@ -1504,15 +1504,19 @@ function zr(e) {
1504
1504
  if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
1505
1505
  }
1506
1506
  function Br(e, t) {
1507
- let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : C(e);
1507
+ let { timeZone: n, timezone: r } = e, i = n !== void 0 && r !== void 0 && n !== r && n === t ? r : w(e);
1508
1508
  return i === void 0 ? e : {
1509
1509
  ...e,
1510
1510
  timeZone: i,
1511
1511
  timezone: i
1512
1512
  };
1513
1513
  }
1514
- var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontalLine", "crossLine"]), qr = new Set(["verticalLine", "crossLine"]), Jr = class {
1515
- static version = "1.60.0";
1514
+ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 24;
1515
+ function Gr(e) {
1516
+ return e.length > 0 ? { renames: e } : {};
1517
+ }
1518
+ var Kr = 20, qr = 8, Jr = new Set(["horizontalLine", "crossLine"]), Yr = new Set(["verticalLine", "crossLine"]), Xr = class {
1519
+ static version = "1.61.0";
1516
1520
  engine;
1517
1521
  viewport;
1518
1522
  series = new Bn((e) => this.sessionKeep(e), (e) => this.followLiveChange(e));
@@ -1531,7 +1535,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1531
1535
  autoScrollOnNewBar = !0;
1532
1536
  displayDataCache = null;
1533
1537
  indicatorsOnDrawn = null;
1534
- reshapeMemo = new lt();
1538
+ reshapeMemo = new ct();
1535
1539
  displayDataStep;
1536
1540
  indicatorUpdateFrom = null;
1537
1541
  resolvedLayoutCache = null;
@@ -1557,7 +1561,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1557
1561
  indicatorEdit = null;
1558
1562
  removedDrawingAlerts = /* @__PURE__ */ new Map();
1559
1563
  zoomAreaMode = !1;
1560
- priceAxisAddButton = new rt();
1564
+ priceAxisAddButton = new nt();
1561
1565
  displayTz = null;
1562
1566
  timeZoneSetting = null;
1563
1567
  symbolInfo = null;
@@ -1568,7 +1572,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1568
1572
  studyZoneReleaseQueued = !1;
1569
1573
  sessionBreaks;
1570
1574
  sessionShading;
1571
- hostSessionHours = { ...je };
1575
+ hostSessionHours = { ...Ae };
1572
1576
  compareRenderer;
1573
1577
  countdownInterval = null;
1574
1578
  pausedFor = {
@@ -1587,7 +1591,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1587
1591
  signalMarkerManager;
1588
1592
  tradeZoneManager;
1589
1593
  measureOverlay;
1590
- selectionBoxOverlay = new dt();
1594
+ selectionBoxOverlay = new ut();
1591
1595
  replayManager;
1592
1596
  replayBarUnsub = null;
1593
1597
  replaySeeking = !1;
@@ -1614,14 +1618,14 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1614
1618
  disposed = !1;
1615
1619
  chartTypeOptions = {};
1616
1620
  mainSeriesVisible = !0;
1617
- priceLines = new it();
1618
- symbolSeries = new vt();
1621
+ priceLines = new rt();
1622
+ symbolSeries = new _t();
1619
1623
  extendedHours = !0;
1620
1624
  replayRestarting = !1;
1621
1625
  requestedSymbols = /* @__PURE__ */ new Set();
1622
1626
  gridRenderer;
1623
1627
  priceAxis;
1624
- leftPriceAxis = new nt();
1628
+ leftPriceAxis = new tt();
1625
1629
  leftScaleRequested = !1;
1626
1630
  leftAxisWidth = o;
1627
1631
  leftViewport = null;
@@ -1697,11 +1701,11 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1697
1701
  oldestTime: () => (this.replaySession ? this.series.liveBars() : this.series.bars())[0]?.time ?? null,
1698
1702
  prepend: (e) => this.prependBars(e),
1699
1703
  emit: (e) => this.eventBus.emit("historyLoad", e)
1700
- }), this.themeManager = new qn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(Yn(t), "host", !1), this.layoutManager = new Qn(), this.indicatorEngine = new Ve(), this.pluginManager = new mr(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Ie(), Ht(this.indicatorEngine), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new ht(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.indicatorEngine.register(new De(this.symbolSeries)), this.drawingManager = new Ne(), Vt(this.drawingManager), this.drawingRenderer = new Pe(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingManager.setRequestRender(() => {
1704
+ }), this.themeManager = new qn(t.theme), this.themeManager.setChartType(this.options.chartType ?? "candlestick"), this.applyStyle(Yn(t), "host", !1), this.layoutManager = new Qn(), this.indicatorEngine = new Be(), this.pluginManager = new mr(this.indicatorEngine, { plugins: t.plugins }), this.eventBus = new Fe(), Ht(this.indicatorEngine), this.indicatorEngine.register(new Ce(this.symbolSeries)), this.indicatorEngine.register(new we(this.symbolSeries)), this.indicatorEngine.register(new mt(this.symbolSeries)), this.indicatorEngine.register(new Te(this.symbolSeries)), this.indicatorEngine.register(new Ee(this.symbolSeries)), this.drawingManager = new Me(), Vt(this.drawingManager), this.drawingRenderer = new Ne(this.drawingManager), this.drawingRenderer.setKeepOut(() => this.legendKeepOut()), this.drawingManager.setRequestRender(() => {
1701
1705
  this.syncRenderContext(), this.engine.requestRender(r.Overlay), this.scheduleAutoSave();
1702
1706
  }), this.drawingManager.setEventCallback((e, t) => {
1703
1707
  this.followDrawingAlerts(e, t?.id), this.eventBus.emit(e, t), (e === "drawingCreate" || e === "drawingUpdate" || e === "drawingRemove") && this.announceStateChange();
1704
- }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new Ct();
1708
+ }), this.drawingManager.setToolFilter((e) => this.features.drawings && (this.features.drawingTools.length === 0 || this.features.drawingTools.includes(e))), this.undoRedoManager = new St();
1705
1709
  let i = "";
1706
1710
  this.undoRedoManager.setOnChange(() => {
1707
1711
  let { canUndo: e, canRedo: t } = this.undoRedoManager.getState(), n = `${e}|${t}`;
@@ -1714,23 +1718,23 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1714
1718
  primary: e[0] ?? null
1715
1719
  })), this.drawingManager.setForeignHistory((e, t) => {
1716
1720
  e.type === "custom" ? e.custom?.[t]() : this.applyIndicatorStep(e, t);
1717
- }), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new xt({
1721
+ }), this.drawingManager.setDataGetter(() => this.series.bars(), () => this.series.revision()), this.drawingManager.setDisplayDataGetter(() => this.getDisplayData()), t.crosshair?.mode === "magnet" && this.features.drawingMagnet && this.drawingManager.setMagnetMode("magnet"), this.tradingManager = new bt({
1718
1722
  enabled: this.features.trading,
1719
1723
  contextMenu: { enabled: this.features.tradingContextMenu }
1720
- }), this.tradingRenderer = new St(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1724
+ }), this.tradingRenderer = new xt(this.tradingManager), this.tradingManager.setContainer(e), this.tradingManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradingManager.setEventCallback((e, t) => {
1721
1725
  this.eventBus.emit(e, t);
1722
- }), this.engine = new at(e, t.maxPixelRatio);
1726
+ }), this.engine = new it(e, t.maxPixelRatio);
1723
1727
  let a = this.engine.dprManager.getContainerSize();
1724
- if (this.viewport = new wt(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), t.barLayout && this.viewport.setBarLayout(t.barLayout), this.viewport.setPanLimits({
1728
+ if (this.viewport = new Ct(a.width, a.height, t.minBarSpacing ?? 2, t.maxBarSpacing ?? 30, t.rightMargin ?? 5), t.barLayout && this.viewport.setBarLayout(t.barLayout), this.viewport.setPanLimits({
1725
1729
  freePan: t.freePan ?? !0,
1726
1730
  minVisibleBars: t.panLimits?.minVisibleBars ?? 3
1727
1731
  }), t.minBarUnit !== void 0 && this.viewport.setMinBarUnit(t.minBarUnit), this.layoutManager.resize(a.width, a.height), this.engine.onContainerResize = (e) => {
1728
1732
  if (e.width <= 0 || e.height <= 0) return;
1729
1733
  let t = this.viewport.isAtEnd();
1730
1734
  this.viewport.resize(e.width, e.height), this.layoutManager.resize(e.width, e.height), this.updateViewportAndRender(t), this.eventBus.emit("resize", e);
1731
- }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Le(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new nt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new yt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new Oe(), 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) => {
1735
+ }, this.chartRenderer = this.createChartRenderer(this.options.chartType), this.gridRenderer = new Ie(), t.grid?.visible === !1 && this.gridRenderer.setVisible(!1), this.priceAxis = new tt(), this.priceAxis.setLocale(this.numberLocale), this.leftPriceAxis.setLocale(this.numberLocale), this.viewport.setNumberLocale(this.numberLocale), this.timeAxis = new vt(), this.timeAxis.setLocale(this.numberLocale), this.crosshairHandler = new De(), 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) => {
1732
1736
  if (e !== null && t) {
1733
- let n = this.crosshairSeries(), i = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = A(n), s = i ? o[e]?.time ?? i.time : void 0;
1737
+ let n = this.crosshairSeries(), i = e >= 0 && e < n.length ? n[e] : void 0, a = e > 0 ? n[e - 1]?.close : void 0, o = kt(n), s = i ? o[e]?.time ?? i.time : void 0;
1734
1738
  this.chartLegend.setHoverBar(i ?? null, e > 0 ? n[e - 1] ?? null : null), this.features.legend && this.engine.requestRender(r.Hover);
1735
1739
  let c = this.viewport.getState(), l = t.y >= c.chartRect.y && t.y <= c.chartRect.y + c.chartRect.height;
1736
1740
  if (i && l && this.features.crosshairTooltip) {
@@ -1758,14 +1762,14 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1758
1762
  let e = this.crosshairHandler.getSyncedSlot();
1759
1763
  e !== null && this.showSyncedBar(e);
1760
1764
  }
1761
- }), this.chartLegend = new Se(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setResizeListener(() => {
1765
+ }), this.chartLegend = new xe(), this.chartLegend.setChartType(this.options.chartType), this.chartLegend.setLocale(this.numberLocale), this.chartLegend.setResizeListener(() => {
1762
1766
  this.eventBus.emit("legendResize", { bottom: this.getLegendBottom() }), this.engine.requestRender();
1763
- }), this.watermark = new Ot(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new Dt(), this.volumeProfile = new Et(), this.marketProfile = new qe(), this.depthHeatmap = new Me(), this.periodLevels = new Qe(), this.pivotMarkers = new et(), this.barCountdown = new ve(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new ft(), this.sessionShading = new pt(), this.compareRenderer = new Ce(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1767
+ }), this.watermark = new Dt(), t.watermark && this.watermark.setConfig(t.watermark), this.volumeRenderer = new Et(), this.volumeProfile = new Tt(), this.marketProfile = new Ke(), this.depthHeatmap = new je(), this.periodLevels = new Ze(), this.pivotMarkers = new $e(), this.barCountdown = new _e(), this.barCountdown.setVisible(this.features.barCountdown), this.sessionBreaks = new dt(), this.sessionShading = new ft(), this.compareRenderer = new Se(), t.sessionBreaks ? this.sessionBreaks.setConfig({
1764
1768
  visible: t.sessionBreaks.visible ?? !0,
1765
1769
  color: t.sessionBreaks.color,
1766
1770
  lineStyle: t.sessionBreaks.lineStyle,
1767
1771
  lineWidth: t.sessionBreaks.lineWidth
1768
- }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new he(), this.crosshairTooltip = new ke(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new $e(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = ae(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(ei(t.shapes)), t.font && this.themeManager.setFont($r(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new We({
1772
+ }) : t.features?.sessionBreaks !== !1 && this.sessionBreaks.setVisible(!0), t.logScale && this.features.logScale && this.viewport.setLogScale(!0), this.animator = new me(), this.crosshairTooltip = new Oe(), this.crosshairTooltip.create(e), this.crosshairTooltip.setLocale(this.numberLocale), this.pinnedTooltip = new Qe(), this.pinnedTooltip.create(e), this.pinnedTooltip.setLocale(this.numberLocale), t.priceFormat && this.applyPriceFormat(t.priceFormat), t.chartTypeOptions && (this.chartTypeOptions = S(t.chartTypeOptions)), t.highLowLines && this.priceLines.setHighLow(!0), t.shapes && this.themeManager.setShape(ni(t.shapes)), t.font && this.themeManager.setFont(ti(t.font)), this.priceLines.setPriceText((e) => this.formatPrice(e)), t.extendedHours === !1 && (this.extendedHours = !1), t.timeFormatter && this.applyTimeFormatter(t.timeFormatter), this.keyboardHandler = new Ue({
1769
1773
  scrollBars: (e) => {
1770
1774
  let t = this.viewport.getState().barWidth + this.viewport.getState().barSpacing;
1771
1775
  this.viewport.scrollBy(e * t), this.updateViewportAndRender();
@@ -1809,7 +1813,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1809
1813
  }
1810
1814
  this.keyboardHandler.handleKey(e) && (e.preventDefault(), this.a11y?.viewMoved());
1811
1815
  }
1812
- }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new Ae(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new me(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(Nt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
1816
+ }, window.addEventListener("keydown", this.onWindowKeyDown), this.currentPriceLine = new ke(), this.currentPriceLine.setLocale(this.numberLocale), this.priceAxis.setReservedPriceProvider(() => this.currentPriceLine.isVisible() ? this.currentPriceLine.getPrice() : null), this.alertManager = new pe(), this.alertManager.setDrawingLevels((e) => this.drawingLevelsNow(e)), this.alertManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.compareRenderer.setReservedLevels(() => this.alertManager.getAlerts().filter(Nt).map((e) => e.price)), this.alertManager.on("triggered", (e) => {
1813
1817
  this.eventBus.emit("alertTriggered", J(e)), this.eventBus.emit("dataUpdate", {
1814
1818
  kind: "alert",
1815
1819
  alert: "triggered",
@@ -1825,7 +1829,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1825
1829
  this.eventBus.emit("alertExpired", J(e));
1826
1830
  }), this.alertManager.on("updated", (e) => {
1827
1831
  this.eventBus.emit("alertUpdate", J(e));
1828
- }), this.signalMarkerManager = new mt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
1832
+ }), this.signalMarkerManager = new pt(), this.signalMarkerManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.signalMarkerManager.setDataGetter(() => this.series.bars()), this.signalMarkerManager.on("added", (e) => {
1829
1833
  this.eventBus.emit("signalMarkerAdd", {
1830
1834
  id: e.id,
1831
1835
  source: e.source,
@@ -1833,14 +1837,14 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1833
1837
  });
1834
1838
  }), this.signalMarkerManager.on("removed", (e) => {
1835
1839
  this.eventBus.emit("signalMarkerRemove", { id: e });
1836
- }), this.tradeZoneManager = new bt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
1840
+ }), this.tradeZoneManager = new yt(), this.tradeZoneManager.setRequestRender(() => this.engine.requestRender(r.Overlay)), this.tradeZoneManager.setDataGetter(() => this.series.bars()), this.tradeZoneManager.on("added", (e) => {
1837
1841
  this.eventBus.emit("tradeZoneAdd", {
1838
1842
  id: e.id,
1839
1843
  direction: e.direction
1840
1844
  });
1841
1845
  }), this.tradeZoneManager.on("removed", (e) => {
1842
1846
  this.eventBus.emit("tradeZoneRemove", { id: e });
1843
- }), this.replayManager = new st(), this.replayManager.on("complete", () => {
1847
+ }), this.replayManager = new ot(), this.replayManager.on("complete", () => {
1844
1848
  let e = this.getReplayBarIndex(), t = this.replayCoarse?.[e];
1845
1849
  t && this.eventBus.emit("replayComplete", {
1846
1850
  barIndex: e,
@@ -1848,9 +1852,9 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1848
1852
  });
1849
1853
  }), this.replayManager.on("stateChange", (e) => {
1850
1854
  this.replayRestarting || this.eventBus.emit("replayState", { state: e });
1851
- }), this.measureOverlay = new Je(), this.interactionManager = new He(e), this.features.panning) {
1855
+ }), this.measureOverlay = new qe(), this.interactionManager = new Ve(e), this.features.panning) {
1852
1856
  let e = new sr();
1853
- this.interactionManager.setPanHandler(new Xe((t, n) => {
1857
+ this.interactionManager.setPanHandler(new Ye((t, n) => {
1854
1858
  t && this.viewport.scrollBy(t), e.step(t, n, this.options.autoScale !== !1) && n && (this.holdPriceScale(), this.viewport.panPriceRange(n)), this.updateViewportAndRender();
1855
1859
  }, () => e.reset()));
1856
1860
  }
@@ -1862,10 +1866,10 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1862
1866
  scales: !this.indicatorEngine.hasLeftScaleOverlays()
1863
1867
  }
1864
1868
  })), this.features.zooming) {
1865
- this.interactionManager.setZoomHandler(new kt((e, t) => {
1869
+ this.interactionManager.setZoomHandler(new Ot((e, t) => {
1866
1870
  this.viewport.zoom(e, t - this.viewport.getState().chartRect.x), this.updateViewportAndRender();
1867
1871
  }));
1868
- let e = new _e((e) => {
1872
+ let e = new ge((e) => {
1869
1873
  this.holdPriceScale(), this.viewport.scalePriceRange(e), this.syncRenderContext(), this.engine.requestRender(), this.emitViewportEvents();
1870
1874
  }, (e) => {
1871
1875
  let t = this.viewport.getState().chartRect.width;
@@ -1878,7 +1882,12 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1878
1882
  if (this.features.crosshair && this.interactionManager.setCrosshairHandler(this.crosshairHandler), this.features.drawings && (this.interactionManager.setDrawingManager(this.drawingManager, () => ({
1879
1883
  ...this.viewport.getState(),
1880
1884
  data: this.getDisplayData()
1881
- })), this.interactionManager.setDrawingDoubleClick((e) => this.eventBus.emit("drawingDoubleClick", { id: e })), this.interactionManager.setDrawingContextMenu((e, t) => {
1885
+ })), this.drawingManager.setPanes({
1886
+ paneAt: (e) => this.drawingPaneAt(e),
1887
+ viewportOf: (e) => this.drawingPaneViewport(e),
1888
+ hasPane: (e) => this.layoutManager.getPanels().some((t) => t.id === e),
1889
+ valuesAt: (e, t) => this.indicatorEngine.getPaneValuesAt(e, t)
1890
+ }), this.interactionManager.setDrawingDoubleClick((e) => this.eventBus.emit("drawingDoubleClick", { id: e })), this.interactionManager.setDrawingContextMenu((e, t) => {
1882
1891
  this.drawingManager.select(e) && this.eventBus.emit("drawingContextMenu", {
1883
1892
  id: e,
1884
1893
  x: t.x,
@@ -1895,10 +1904,10 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1895
1904
  ...this.viewport.getState(),
1896
1905
  data: this.getDisplayData()
1897
1906
  })), this.features.alerts) {
1898
- let e = new pe(this.alertManager, () => this.viewport.getState());
1907
+ let e = new fe(this.alertManager, () => this.viewport.getState());
1899
1908
  this.interactionManager.setAlertDragHandler(e);
1900
1909
  }
1901
- let o = new Ze();
1910
+ let o = new Xe();
1902
1911
  o.configure(() => this.getResolvedLayout(), (e, t) => this.setPanelSize(e, t)), this.interactionManager.setPaneResizeHandler(o), this.interactionManager.setAltClickHandler((e) => {
1903
1912
  let t = this.getDisplayData();
1904
1913
  if (t.length === 0) return;
@@ -1952,20 +1961,22 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1952
1961
  this.measureOverlay.end();
1953
1962
  }
1954
1963
  });
1955
- let s = (e) => {
1956
- let t = this.viewport.getState().chartRect;
1964
+ let s, c = (e) => {
1965
+ let t = s ? this.drawingPaneViewport(s) : null, n = t ? t.chartRect : this.viewport.getState().chartRect;
1957
1966
  return {
1958
- x: Math.max(t.x, Math.min(t.x + t.width, e.x)),
1959
- y: Math.max(t.y, Math.min(t.y + t.height, e.y))
1967
+ x: Math.max(n.x, Math.min(n.x + n.width, e.x)),
1968
+ y: Math.max(n.y, Math.min(n.y + n.height, e.y))
1960
1969
  };
1961
1970
  };
1962
1971
  this.interactionManager.setBoxSelectHandlers({
1963
- begin: (e) => this.selectionBoxOverlay.begin(s(e)),
1964
- move: (e) => this.selectionBoxOverlay.update(s(e)),
1972
+ begin: (e) => {
1973
+ s = this.zoomAreaMode ? void 0 : this.drawingPaneAt(e), this.selectionBoxOverlay.begin(c(e));
1974
+ },
1975
+ move: (e) => this.selectionBoxOverlay.update(c(e)),
1965
1976
  end: () => {
1966
1977
  let e = this.selectionBoxOverlay.end();
1967
1978
  if (e && this.zoomAreaMode) {
1968
- if (e.x1 - e.x0 < Gr) return;
1979
+ if (e.x1 - e.x0 < qr) return;
1969
1980
  this.zoomToBox(e), this.setZoomAreaMode(!1);
1970
1981
  return;
1971
1982
  }
@@ -1974,10 +1985,10 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
1974
1985
  ...this.viewport.getState(),
1975
1986
  data: this.getDisplayData()
1976
1987
  };
1977
- e.isClick ? this.drawingManager.toggleSelectionAt({
1988
+ s !== null && (e.isClick ? this.drawingManager.toggleSelectionAt({
1978
1989
  x: e.x1,
1979
1990
  y: e.y1
1980
- }, t) : this.drawingManager.selectInRect(e, t), this.engine.requestRender(r.Overlay);
1991
+ }, t) : this.drawingManager.selectInRect(e, t, s), this.engine.requestRender(r.Overlay));
1981
1992
  },
1982
1993
  cancel: () => {
1983
1994
  this.selectionBoxOverlay.cancel(), this.setZoomAreaMode(!1);
@@ -2049,13 +2060,13 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2049
2060
  let { visibleRange: e, chartRect: t } = this.viewport.getState();
2050
2061
  if (t.width <= 0) return;
2051
2062
  let { from: n, to: r } = e;
2052
- this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Wr, r - n));
2063
+ this.history.maybeLoad(Math.max(0, Math.floor(n)), Math.max(Kr, r - n));
2053
2064
  }));
2054
2065
  }
2055
2066
  useStreamHistory(e, t, n = !0) {
2056
2067
  if (this.hostHistoryLoader) return;
2057
2068
  let r = P(e), i = r.fetchHistoryBefore, a = this.streamTimeframe;
2058
- if (!i || a === null || de(a) !== null) {
2069
+ if (!i || a === null || ue(a) !== null) {
2059
2070
  this.historyFromStream && this.history.setLoader(null), this.historyFromStream = !1;
2060
2071
  return;
2061
2072
  }
@@ -2152,11 +2163,11 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2152
2163
  setChartTypeOptions(e) {
2153
2164
  this.chartTypeOptions = {
2154
2165
  ...this.chartTypeOptions,
2155
- ...ae(e)
2166
+ ...S(e)
2156
2167
  }, this.displayDataCache = null, this.updateViewportAndRender(!0), this.fitFewColumns(), this.a11y?.refresh(!0), this.markStateChanged();
2157
2168
  }
2158
2169
  getChartTypeOptions() {
2159
- return ae(this.chartTypeOptions);
2170
+ return S(this.chartTypeOptions);
2160
2171
  }
2161
2172
  setExtendedHours(e) {
2162
2173
  e !== this.extendedHours && (this.extendedHours = e, this.reapplyExtendedHours(), this.markStateChanged());
@@ -2176,7 +2187,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2176
2187
  return this.priceLines.setQuoteShown(this.replaySession === null), this.priceLines;
2177
2188
  }
2178
2189
  setShapes(e) {
2179
- let t = ei(e);
2190
+ let t = ni(e);
2180
2191
  t.tagRadius !== void 0 && (this.themeManager.setShape({
2181
2192
  ...this.themeManager.getTheme().shape,
2182
2193
  ...t
@@ -2188,7 +2199,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2188
2199
  setFont(e) {
2189
2200
  if (e === null) this.themeManager.setFont(null);
2190
2201
  else {
2191
- let t = $r(e);
2202
+ let t = ti(e);
2192
2203
  if (Object.keys(t).length === 0) return;
2193
2204
  this.themeManager.setFont(t);
2194
2205
  }
@@ -2239,7 +2250,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2239
2250
  setSymbolSeries(e, t) {
2240
2251
  e = e.trim(), this.symbolSeries.set(e, t), this.requestedSymbols.delete(e);
2241
2252
  let n = this.indicatorBars(), r = !1;
2242
- 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);
2253
+ for (let t of this.indicatorEngine.getActiveIndicators()) !k.has(t.id) || String(t.params.symbol ?? "").trim() !== e.trim() || (this.indicatorEngine.updateIndicator(t.instanceId, {}, n), r = !0);
2243
2254
  r && (this.announceIndicatorUpdate(0), this.updateViewportAndRender());
2244
2255
  }
2245
2256
  forgetUnreadSymbols() {
@@ -2253,13 +2264,13 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2253
2264
  let e = /* @__PURE__ */ new Set();
2254
2265
  for (let t of this.indicatorEngine.getActiveIndicators()) {
2255
2266
  let n = t.params.symbol;
2256
- O.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
2267
+ k.has(t.id) && typeof n == "string" && n.trim() && e.add(n.trim());
2257
2268
  }
2258
2269
  return [...e];
2259
2270
  }
2260
2271
  requestMissingSymbols(e) {
2261
2272
  this.forgetUnreadSymbols();
2262
- let t = this.indicatorEngine.getIndicatorConfig(e), n = t && O.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
2273
+ let t = this.indicatorEngine.getIndicatorConfig(e), n = t && k.has(t.id) && typeof t.params.symbol == "string" ? t.params.symbol.trim() : "";
2263
2274
  !n || this.symbolSeries.has(n) || this.requestedSymbols.has(n) || (this.requestedSymbols.add(n), this.eventBus.emit("symbolSeriesRequest", { symbol: n }));
2264
2275
  }
2265
2276
  updateIndicator(e, t) {
@@ -2369,7 +2380,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2369
2380
  let t = this.layoutManager.getPanels().find((t) => t.id === e), n = this.indicatorEngine.getPaneMembers(e), r = t ? n.find((e) => this.indicatorEngine.getIndicatorDescriptor(e)?.placement === "panel") ?? null : null;
2370
2381
  this.indicatorEngine.removeIndicator(e);
2371
2382
  let i = this.paneStyles.get(e);
2372
- this.paneStyles.delete(e), r ? (this.indicatorEngine.setPane(r, null), this.layoutManager.renamePanel(e, r), i && this.paneStyles.set(r, i)) : this.layoutManager.removePanel(e);
2383
+ this.paneStyles.delete(e), r ? (this.indicatorEngine.setPane(r, null), this.renamePane(e, r), i && this.paneStyles.set(r, i)) : this.layoutManager.removePanel(e);
2373
2384
  for (let e of n) e !== r && this.indicatorEngine.setPane(e, r), this.eventBus.emit("indicatorChange", {
2374
2385
  instanceId: e,
2375
2386
  change: "pane"
@@ -2384,7 +2395,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2384
2395
  this.indicatorEngine.setStyleDefaults(e, null);
2385
2396
  return;
2386
2397
  }
2387
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : oe(n);
2398
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ae(n);
2388
2399
  this.indicatorEngine.setStyleDefaults(e, {
2389
2400
  ...r,
2390
2401
  ...i ? { plots: i } : {}
@@ -2392,7 +2403,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2392
2403
  }
2393
2404
  setPaneStyle(e, t) {
2394
2405
  let n = this.paneOf(e);
2395
- this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? se(t) : null));
2406
+ this.layoutManager.getPanels().some((e) => e.id === n) && this.recordIndicators(n, () => this.setPaneStyleNow(n, t ? oe(t) : null));
2396
2407
  }
2397
2408
  setPaneStyleNow(e, t) {
2398
2409
  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());
@@ -2411,7 +2422,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2411
2422
  return this.pluginManager;
2412
2423
  }
2413
2424
  static indicators() {
2414
- let e = new Ve();
2425
+ let e = new Be();
2415
2426
  return Ht(e), e.getAvailableIndicators();
2416
2427
  }
2417
2428
  setPanelPosition(e, t) {
@@ -2452,7 +2463,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2452
2463
  if (a) {
2453
2464
  let t = this.indicatorEngine.getPaneMembers(e), r = new Set(this.indicatorEngine.getDependents(e)), i = t.filter((e) => !r.has(e)), a = i.find((e) => this.indicatorEngine.getIndicatorDescriptor(e)?.placement === "panel") ?? null, s = this.paneStyles.get(e);
2454
2465
  if (this.paneStyles.delete(e), a) {
2455
- this.indicatorEngine.setPane(a, null), this.layoutManager.renamePanel(e, a), s && this.paneStyles.set(a, s);
2466
+ this.indicatorEngine.setPane(a, null), this.renamePane(e, a), s && this.paneStyles.set(a, s);
2456
2467
  for (let e of i) e !== a && this.indicatorEngine.setPane(e, a);
2457
2468
  } else {
2458
2469
  this.layoutManager.removePanel(e);
@@ -2576,7 +2587,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2576
2587
  roundPrice(e) {
2577
2588
  if (!Number.isFinite(e)) return e;
2578
2589
  let t = this.stepAt(e);
2579
- if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(ue(t)));
2590
+ if (t !== void 0) return Number((Math.round(e / t) * t).toFixed(le(t)));
2580
2591
  let { min: n, max: r } = this.viewport.getState().priceRange;
2581
2592
  return Number(e.toFixed(this.marketPricePrecision ?? c(n, r)));
2582
2593
  }
@@ -2654,7 +2665,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2654
2665
  this.drawingManager.setDrawings(e), this.dropOrphanDrawingAlerts(), this.announceStateChange();
2655
2666
  }
2656
2667
  addDrawing(e) {
2657
- if (!this.features.drawings) return null;
2668
+ if (!this.features.drawings || e.paneId !== void 0 && !this.takesDrawing(e.paneId, e.type)) return null;
2658
2669
  let t = this.drawingManager.addDrawing(e);
2659
2670
  return this.markStateChanged(), t;
2660
2671
  }
@@ -2672,6 +2683,15 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2672
2683
  removeDrawings(e) {
2673
2684
  return this.drawingManager.removeDrawings(e);
2674
2685
  }
2686
+ removeAll(e = "all") {
2687
+ return this.undoRedoManager.group(() => {
2688
+ let t = e === "indicators" ? 0 : this.removeDrawings(this.getDrawings().map((e) => e.id)), n = e === "drawings" ? [] : this.getActiveIndicators().map((e) => e.instanceId);
2689
+ return n.length > 0 && this.removeIndicators(n), {
2690
+ drawings: t,
2691
+ indicators: n.length
2692
+ };
2693
+ });
2694
+ }
2675
2695
  getDrawingToolDescriptor(e) {
2676
2696
  let t = this.drawingManager.getDescriptor(e);
2677
2697
  return t ? structuredClone(t) : null;
@@ -2793,7 +2813,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2793
2813
  }
2794
2814
  applyPriceAxisAdd() {
2795
2815
  let e = this.features.priceAxisAddButton && this.features.crosshair;
2796
- this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Ye : 0);
2816
+ this.priceAxisAddButton.setEnabled(e), this.tradingManager.setTagInset(e ? Je : 0);
2797
2817
  }
2798
2818
  setPriceAxisAddButton(e) {
2799
2819
  this.features.priceAxisAddButton = e, this.applyPriceAxisAdd(), this.engine.requestRender(r.Overlay);
@@ -2884,11 +2904,11 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2884
2904
  }
2885
2905
  getExportText(e = "csv", t = {}) {
2886
2906
  let { bars: n, columns: r } = this.getExportData(t);
2887
- return e === "json" ? E.toJSON(n, r) : E.toCSV(n, r);
2907
+ return e === "json" ? D.toJSON(n, r) : D.toCSV(n, r);
2888
2908
  }
2889
2909
  download(e, t, n) {
2890
2910
  let r = this.getExportText(e, n);
2891
- e === "json" ? E.download(r, t ?? "chart-data.json", "application/json") : E.download(r, t ?? "chart-data.csv", "text/csv");
2911
+ e === "json" ? D.download(r, t ?? "chart-data.json", "application/json") : D.download(r, t ?? "chart-data.csv", "text/csv");
2892
2912
  }
2893
2913
  setAutoSave(e, t = 5e3) {
2894
2914
  this.autoSaveScheduler.enable(e, t);
@@ -2950,7 +2970,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
2950
2970
  this.recordIndicators(e, () => this.updateIndicatorStyleNow(e, t));
2951
2971
  }
2952
2972
  updateIndicatorStyleNow(e, t) {
2953
- let { plots: n, ...r } = t, i = n === void 0 ? void 0 : oe(n);
2973
+ let { plots: n, ...r } = t, i = n === void 0 ? void 0 : ae(n);
2954
2974
  this.indicatorEngine.updateIndicatorStyle(e, {
2955
2975
  ...r,
2956
2976
  ...i ? { plots: i } : {}
@@ -3071,7 +3091,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3071
3091
  }
3072
3092
  async connect(e) {
3073
3093
  if (!j(e.adapter, e.timeframe)) throw RangeError(`${e.adapter.name} cannot serve the ${e.timeframe} timeframe`);
3074
- this.snapshotKey = null, this.holdReplayFor(e.symbol), this.disconnectStream(), this.streamManager = new _t(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (t) => {
3094
+ this.snapshotKey = null, this.holdReplayFor(e.symbol), this.disconnectStream(), this.streamManager = new gt(), this.streamManager.setTimeZone(this.studyZoneHeld ? this.studyZone : this.getExchangeTimeZone()), this.streamManager.on("snapshot", (t) => {
3075
3095
  let n = this.streamSeriesKey(e.adapter);
3076
3096
  n === this.snapshotKey && this.replaySession ? this.series.mergeSnapshot(t) : n === this.snapshotKey && this.series.length() > 0 ? this.mergeSnapshot(t) : (this.replaySession && this.useStreamHistory(e.adapter, e.historyPageSize, !1), this.setData(t)), this.snapshotKey = n, this.useStreamHistory(e.adapter, e.historyPageSize);
3077
3097
  }), this.streamManager.on("barClose", (e) => {
@@ -3127,18 +3147,18 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3127
3147
  }), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
3128
3148
  let t = this.streamManager;
3129
3149
  if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
3130
- let n = w(e.timeframe);
3150
+ let n = T(e.timeframe);
3131
3151
  this.barCountdown.setTimeframeMs(n), this.countdownInterval && clearInterval(this.countdownInterval), this.countdownInterval = setInterval(() => {
3132
3152
  this.barCountdown.isVisible() && this.engine.requestRender(r.Hover);
3133
3153
  }, 1e3);
3134
3154
  }
3135
3155
  streamSeriesKey(e) {
3136
- let t = P(e), n = this.streamTimeframe, r = t instanceof ct && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
3156
+ let t = P(e), n = this.streamTimeframe, r = t instanceof st && n !== null ? t.bucketFor(this.currentSymbol, n) : null;
3137
3157
  return `${this.currentSymbol}|${n}|${r?.timeZone ?? ""}`;
3138
3158
  }
3139
3159
  setStreamTarget(e, t) {
3140
3160
  let n = this.announcedSymbol;
3141
- this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = de(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
3161
+ this.currentSymbol = e, this.streamTimeframe = t, this.tickStream = ue(t) !== null, this.applyTimeSpacing(), e !== n && this.chartLegend.setSymbol(e), e !== n && (this.announcedSymbol = e, this.eventBus.emit("symbolChange", {
3142
3162
  symbol: e,
3143
3163
  previous: n
3144
3164
  })), this.useTimeframe(t);
@@ -3157,7 +3177,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3157
3177
  if (!this.streamManager) return;
3158
3178
  let n = this.streamAdapter;
3159
3179
  if (n && !j(n, t)) throw RangeError(`${n.name} cannot serve the ${t} timeframe`);
3160
- this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(w(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
3180
+ this.holdReplayFor(e), this.setStreamTarget(e, t), this.historyFromStream && this.history.setLoader(null), this.barCountdown.setTimeframeMs(T(t)), n && this.resolveStreamSymbol(n, e), await this.streamManager.switchTo(e, t);
3161
3181
  }
3162
3182
  isIndicatorAllowed(e) {
3163
3183
  let t = this.features.indicatorIds;
@@ -3513,7 +3533,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3513
3533
  }
3514
3534
  let t = this.crosshairSeries(), n = e >= 0 && e < t.length ? t[e] : void 0, r = n && e > 0 ? t[e - 1] : void 0;
3515
3535
  this.crosshairHandler.getPosition() || this.chartLegend.setHoverBar(n ?? null, r ?? null);
3516
- let i = n ? A(t)[e]?.time ?? n.time : void 0;
3536
+ let i = n ? kt(t)[e]?.time ?? n.time : void 0;
3517
3537
  this.eventBus.emit("crosshairSync", {
3518
3538
  barIndex: e,
3519
3539
  ...n ? { bar: n } : {},
@@ -3601,7 +3621,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3601
3621
  return this.displayTz;
3602
3622
  }
3603
3623
  getExchangeTimeZone() {
3604
- return [C(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && y(e)) ?? null;
3624
+ return [w(this.symbolInfo), this.marketConfig?.timeZone].find((e) => e && y(e)) ?? null;
3605
3625
  }
3606
3626
  setTimezone(e) {
3607
3627
  this.setTimeZone(e);
@@ -3628,7 +3648,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3628
3648
  this.indicatorEngine.setExchangeTimeZone(e, t.length > 0 ? t : void 0) && t.length > 0 && this.announceIndicatorUpdate(0);
3629
3649
  }
3630
3650
  holdStudyZone() {
3631
- this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), ut);
3651
+ this.endStudyZoneWait(), this.studyZoneHeld = !0, this.studyZoneTimer = setTimeout(() => this.releaseStudyZone(), lt);
3632
3652
  }
3633
3653
  endStudyZoneWait() {
3634
3654
  this.studyZoneReleaseQueued = !1, this.studyZoneTimer !== null && (clearTimeout(this.studyZoneTimer), this.studyZoneTimer = null);
@@ -3643,7 +3663,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3643
3663
  }
3644
3664
  spokenBarTime(e) {
3645
3665
  let t = this.getDisplayData(), n = e * u(t), r = this.numberLocale || "en-US";
3646
- return d(t) === !0 ? fe(r, { dateStyle: "medium" }, l(n, this.displayTz, this.getExchangeTimeZone()))(n) : fe(r, {
3666
+ return d(t) === !0 ? de(r, { dateStyle: "medium" }, l(n, this.displayTz, this.getExchangeTimeZone()))(n) : de(r, {
3647
3667
  dateStyle: "medium",
3648
3668
  timeStyle: "short"
3649
3669
  }, this.displayTz)(n);
@@ -3656,18 +3676,18 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3656
3676
  this.studyZoneHeld = !1, this.endStudyZoneWait(), this.useSymbolInfo(e);
3657
3677
  }
3658
3678
  useSymbolInfo(e) {
3659
- let t = e && this.symbolInfo?.symbol === e.symbol ? C(this.symbolInfo) : void 0;
3679
+ let t = e && this.symbolInfo?.symbol === e.symbol ? w(this.symbolInfo) : void 0;
3660
3680
  this.symbolInfo = e ? Br({
3661
3681
  ...e,
3662
3682
  sessions: e.sessions?.map((e) => ({ ...e }))
3663
3683
  }, 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);
3664
3684
  let n = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
3665
- let t = S(e.start), n = S(e.end);
3685
+ let t = C(e.start), n = C(e.end);
3666
3686
  return t === null || n === null ? [] : [{
3667
3687
  startMinute: t,
3668
3688
  endMinute: n
3669
3689
  }];
3670
- }), i = C(this.symbolInfo);
3690
+ }), i = w(this.symbolInfo);
3671
3691
  this.sessionShading.replaceConfig(n.length > 0 && i && y(i) ? {
3672
3692
  timeZone: i,
3673
3693
  windows: n,
@@ -3686,7 +3706,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3686
3706
  ...r,
3687
3707
  ...e,
3688
3708
  symbol: e.symbol || r?.symbol || t
3689
- }, C(r));
3709
+ }, w(r));
3690
3710
  r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
3691
3711
  }
3692
3712
  resolveStreamSymbol(e, t) {
@@ -3769,7 +3789,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3769
3789
  this.engine.getGpu() && this.engine.renderNow();
3770
3790
  }
3771
3791
  screenshot(e) {
3772
- this.features.screenshot && (this.freshFrame(), k.download(this.container, e, this.themeManager.getTheme().background));
3792
+ this.features.screenshot && (this.freshFrame(), A.download(this.container, e, this.themeManager.getTheme().background));
3773
3793
  }
3774
3794
  async copyScreenshot() {
3775
3795
  if (!this.features.screenshot) return !1;
@@ -3777,7 +3797,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3777
3797
  if (!t?.write || !e) return !1;
3778
3798
  try {
3779
3799
  this.freshFrame();
3780
- let n = k.toBlob(this.container, this.themeManager.getTheme().background).then((e) => {
3800
+ let n = A.toBlob(this.container, this.themeManager.getTheme().background).then((e) => {
3781
3801
  if (!e) throw Error("No chart image to copy");
3782
3802
  return e;
3783
3803
  });
@@ -3795,10 +3815,10 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3795
3815
  }
3796
3816
  }
3797
3817
  screenshotDataURL() {
3798
- return this.features.screenshot ? (this.freshFrame(), k.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
3818
+ return this.features.screenshot ? (this.freshFrame(), A.toDataURL(this.container, this.themeManager.getTheme().background)) : null;
3799
3819
  }
3800
3820
  async screenshotBlob() {
3801
- return this.features.screenshot ? (this.freshFrame(), k.toBlob(this.container, this.themeManager.getTheme().background)) : null;
3821
+ return this.features.screenshot ? (this.freshFrame(), A.toBlob(this.container, this.themeManager.getTheme().background)) : null;
3802
3822
  }
3803
3823
  addAlert(e, t = "crossing", n, r = "price", i, a = {}) {
3804
3824
  if (!this.features.alerts) return null;
@@ -3841,6 +3861,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3841
3861
  return this.features.alerts && this.drawingLevelsNow(e) !== null;
3842
3862
  }
3843
3863
  drawingLevelsNow(e) {
3864
+ if (this.drawingManager.getDrawings().find((t) => t.id === e)?.paneId !== void 0) return null;
3844
3865
  let t = this.replaySession ? this.series.liveBars() : this.getDisplayData();
3845
3866
  if (t.length === 0) return null;
3846
3867
  let n = {
@@ -3925,7 +3946,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3925
3946
  let t = this.replaySession ? this.replayOffset : 0;
3926
3947
  if (!this.replaySession) {
3927
3948
  if (this.series.length() === 0) return;
3928
- this.series.beginReplay(), this.replaySession = ci(this.currentSymbol);
3949
+ this.series.beginReplay(), this.replaySession = ui(this.currentSymbol);
3929
3950
  }
3930
3951
  let n = this.replaySession, { steps: r, startTime: i, hideHistory: a, revealMarks: o, step: s, ...c } = e ?? {};
3931
3952
  c.animate = c.animate === !0;
@@ -3936,13 +3957,13 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3936
3957
  let m = r ? this.replayStepsOver(n, p, !0) : null;
3937
3958
  this.options.autoScale = !0, this.buildReplay(p, m, f);
3938
3959
  let h = this.replayStepsSeries;
3939
- h && c.startIndex !== void 0 && (c.startIndex = _i(h, p, c.startIndex));
3960
+ h && c.startIndex !== void 0 && (c.startIndex = yi(h, p, c.startIndex));
3940
3961
  let g = h ?? p, _ = g[Math.max(0, Math.min(Math.floor(Number(c.startIndex ?? 0)) || 0, g.length - 1))];
3941
3962
  this.revealReplayMarks(this.replayRevealMarks ? _?.time ?? null : null), n.held && (n.held.state = c.paused ? "paused" : "playing", c.paused = !0), !c.paused && c.startIndex !== void 0 && c.startIndex >= 1 && this.replaySeek(c.startIndex - 1), this.replayManager.play(c);
3942
3963
  }
3943
3964
  buildReplay(e, t, n) {
3944
3965
  let r = this.replaySession?.animate === !0, i = r ? null : t;
3945
- this.replayPieces = r && t ? bi(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
3966
+ this.replayPieces = r && t ? Si(t, e) : null, this.replayForming = null, this.replayOffset = n, this.replayStepsSeries = i, this.replayCoarse = e;
3946
3967
  let a = this.replayRestarting;
3947
3968
  this.replayRestarting = !0;
3948
3969
  try {
@@ -3956,7 +3977,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3956
3977
  let n = t, a = e[t];
3957
3978
  if (i) {
3958
3979
  let r = i[t];
3959
- n = Q(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? Si(c, r) : vi(e[n], i, t), a = yi(i, e, t, n) ? e[n] : c;
3980
+ n = Q(e, r.time), c = c !== null && s === t - 1 && n === o - 1 && c ? wi(c, r) : bi(e[n], i, t), a = xi(i, e, t, n) ? e[n] : c;
3960
3981
  }
3961
3982
  let u = this.replayForming;
3962
3983
  this.replayForming = null, s = t;
@@ -3980,7 +4001,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3980
4001
  });
3981
4002
  }), r && (this.replayPhaseUnsub = this.replayManager.on("phase", ({ index: t, fraction: n }) => {
3982
4003
  if (!e[t] || this.series.length() !== o || o !== t && o !== t + 1) return;
3983
- let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = xi() ? Mr(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = jr(r, i);
4004
+ let r = this.replayForming?.index === t ? this.replayForming.path : this.replayPathOf(e, t), i = Ci() ? Mr(r, n) : n, a = o === t, s = a && this.autoScrollOnNewBar && this.viewport.isAtEnd(), c = jr(r, i);
3984
4005
  a ? this.series.appendReplayed(c) : this.series.updateReplayed(c), o = t + 1, this.replayForming = {
3985
4006
  index: t,
3986
4007
  path: r
@@ -3990,7 +4011,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
3990
4011
  drawFormingBar(e, t, n, r) {
3991
4012
  this.currentPriceLine.setPrice(e.close, t);
3992
4013
  let i = this.series.bars();
3993
- if (this.recalcIndicatorsFrom(i, i.length - 1), (n || !ii.has(this.options.chartType)) && (this.displayDataCache = null), !n) {
4014
+ if (this.recalcIndicatorsFrom(i, i.length - 1), (n || !oi.has(this.options.chartType)) && (this.displayDataCache = null), !n) {
3994
4015
  this.scheduleRender();
3995
4016
  return;
3996
4017
  }
@@ -4005,15 +4026,15 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4005
4026
  if (!n) return;
4006
4027
  n.evictBefore(e[t].time);
4007
4028
  let r = this.replayManager.getStepMs();
4008
- n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(ri / r) : 1);
4029
+ n.ensure(e, t, Number.isFinite(r) && r > 0 ? Math.ceil(ai / r) : 1);
4009
4030
  }
4010
4031
  useReplayLoader(e, t) {
4011
4032
  let n = this.streamAdapter, r = this.streamTimeframe, i = e.step && n && r !== null ? Fr(e.step, r, (e) => j(n, e)) : null, a = `${this.currentSymbol}|${r}|${i}`;
4012
4033
  if (!t && this.replayLoader?.key === a || (this.replayLoader?.loader.dispose(), this.replayLoader = null, !i || !n || r === null)) return;
4013
- let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = w(r), u = new yr({
4034
+ let o = P(n), s = o.fetchHistoryBefore, c = this.currentSymbol, l = T(r), u = new yr({
4014
4035
  source: s ? (e, t) => s.call(o, c, i, e, t) : null,
4015
4036
  step: i,
4016
- ratio: Math.max(1, Math.round(l / w(i))),
4037
+ ratio: Math.max(1, Math.round(l / T(i))),
4017
4038
  barMs: l,
4018
4039
  keep: (e) => this.series.inHoursShown(e),
4019
4040
  report: (e) => this.eventBus.emit("replayStepsLoad", e)
@@ -4036,8 +4057,8 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4036
4057
  if (o.time > s) {
4037
4058
  let a = Y(e, s);
4038
4059
  e[a]?.time === s && i.fedFraction < 1 && c.push(...q(this.replayPathOf(e, a), i.fedFraction, 1));
4039
- let o = e.slice(X(e, s), t), l = Math.ceil(o.length / mi);
4040
- for (let e = 0; e < o.length; e += l) c.push(...hi(o.slice(e, e + l)));
4060
+ let o = e.slice(X(e, s), t), l = Math.ceil(o.length / gi);
4061
+ for (let e = 0; e < o.length; e += l) c.push(..._i(o.slice(e, e + l)));
4041
4062
  c.push(...q(n, -1, r));
4042
4063
  } else c.push(...q(n, i.fedFraction, r));
4043
4064
  i.fedTime = o.time, i.fedFraction = r;
@@ -4056,7 +4077,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4056
4077
  if (n.length === 0) return;
4057
4078
  let r = t.windowTime === null ? 0 : Math.min(Y(n, t.windowTime), n.length - 1), i = r > 0 ? n.slice(r) : n;
4058
4079
  this.useReplayLoader(t, !1);
4059
- let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : di(o ?? i, t.until);
4080
+ let a = this.replayStepsOver(t, i), o = t.animate ? null : a, s = t.until === null ? 0 : pi(o ?? i, t.until);
4060
4081
  if (s < 0 && this.canPageBackForReplay(t)) {
4061
4082
  this.holdReplay(), t.held && t.held.pagesBack++, queueMicrotask(() => void this.pageBackForReplay(t));
4062
4083
  return;
@@ -4064,7 +4085,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4064
4085
  let c = this.getReplayState(), l = t.held !== null && (e === "hours" || e === "bar"), u = t.held?.state ?? c;
4065
4086
  l || (t.held = null), t.symbol = this.currentSymbol;
4066
4087
  let d = this.replayManager.remainingMs();
4067
- this.clearBarHolders(), t.animate && ui(t, this.replayCoarse, i);
4088
+ this.clearBarHolders(), t.animate && fi(t, this.replayCoarse, i);
4068
4089
  let f = this.replayRestarting;
4069
4090
  this.replayRestarting = !0, this.replayCause = e === "older" ? "older" : "series";
4070
4091
  try {
@@ -4087,14 +4108,14 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4087
4108
  }
4088
4109
  replayStepsOver(e, t, n = !1) {
4089
4110
  if (!e.steps || e.stepsSymbol !== this.currentSymbol) return null;
4090
- let r = gi(this.series.inHoursShown(e.steps), t);
4091
- return r && (n || pi(r, t)) ? r : null;
4111
+ let r = vi(this.series.inHoursShown(e.steps), t);
4112
+ return r && (n || hi(r, t)) ? r : null;
4092
4113
  }
4093
4114
  canPageBackForReplay(e) {
4094
- return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < ai;
4115
+ return this.history.hasLoader() && this.history.hasMore() && (e.held?.pagesBack ?? 0) < si;
4095
4116
  }
4096
4117
  async pageBackForReplay(e) {
4097
- this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = ai, this.rebaseReplay("older"));
4118
+ this.replaySession !== e || !e.held || await this.history.loadMore() > 0 || this.replaySession !== e || !e.held || (e.held.pagesBack = si, this.rebaseReplay("older"));
4098
4119
  }
4099
4120
  holdReplay() {
4100
4121
  let e = this.replaySession;
@@ -4127,7 +4148,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4127
4148
  this.signalMarkerManager.setRevealUntil(e, t), this.tradeZoneManager.setRevealUntil(e, t);
4128
4149
  }
4129
4150
  replaySeekToTime(e) {
4130
- !this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, di(this.replayStepsSeries ?? this.replayCoarse, e)));
4151
+ !this.replaySession || !this.replayCoarse || this.replaySeek(Math.max(0, pi(this.replayStepsSeries ?? this.replayCoarse, e)));
4131
4152
  }
4132
4153
  feedReplayPrice(e, t) {
4133
4154
  let n = this.executionAdapter;
@@ -4149,8 +4170,8 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4149
4170
  if (i.time <= n.fedTime) return;
4150
4171
  let a = e.slice(X(e, n.fedTime), t + 1);
4151
4172
  n.fedTime = i.time;
4152
- let o = Math.ceil(a.length / mi);
4153
- for (let e = 0; e < a.length; e += o) for (let [t, n] of hi(a.slice(e, e + o))) r.setMarkPrice(t, n);
4173
+ let o = Math.ceil(a.length / gi);
4174
+ for (let e = 0; e < a.length; e += o) for (let [t, n] of _i(a.slice(e, e + o))) r.setMarkPrice(t, n);
4154
4175
  this.tradingManager.setCurrentPrice(i.close);
4155
4176
  }
4156
4177
  getReplayBarIndex() {
@@ -4161,7 +4182,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4161
4182
  }
4162
4183
  replaySeekToBar(e) {
4163
4184
  let t = this.replayStepsSeries;
4164
- this.replaySeek(t && this.replayCoarse ? _i(t, this.replayCoarse, e) : e);
4185
+ this.replaySeek(t && this.replayCoarse ? yi(t, this.replayCoarse, e) : e);
4165
4186
  }
4166
4187
  replayPause() {
4167
4188
  this.setHeldState("paused") || this.replayManager.pause();
@@ -4192,15 +4213,17 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4192
4213
  getDrawingRect(e) {
4193
4214
  let t = this.drawingManager.getDrawings().find((t) => t.id === e);
4194
4215
  if (!t || !this.drawingManager.isShown(e) || t.anchors.length === 0) return null;
4195
- let n = {
4216
+ let n = t.paneId === void 0 ? {
4196
4217
  ...this.viewport.getState(),
4197
4218
  data: this.getDisplayData()
4198
- }, r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
4219
+ } : this.drawingPaneViewport(t.paneId);
4220
+ if (!n) return null;
4221
+ let r = n.chartRect, i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
4199
4222
  for (let e of t.anchors) {
4200
4223
  let t = Ut(e.time, n), r = Rt(e.price, n);
4201
4224
  i = Math.min(i, t), a = Math.max(a, t), o = Math.min(o, r), s = Math.max(s, r);
4202
4225
  }
4203
- return Kr.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), qr.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 ? {
4226
+ return Jr.has(t.type) ? [i, a] = [r.x, r.x + r.width] : t.type === "horizontalRay" && (a = r.x + r.width), Yr.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 ? {
4204
4227
  x: i,
4205
4228
  y: o,
4206
4229
  width: a - i,
@@ -4236,8 +4259,8 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4236
4259
  };
4237
4260
  }
4238
4261
  captureSnapshot() {
4239
- return T.capture({
4240
- getDrawings: () => this.getDrawings(),
4262
+ return E.capture({
4263
+ getDrawings: () => [...this.getDrawings().filter((e) => e.paneId === void 0 || this.layoutManager.getPanels().some((t) => t.id === e.paneId)), ...this.keptPaneDrawings],
4241
4264
  getTheme: () => this.themeManager.getBaseTheme(),
4242
4265
  getAlerts: () => this.getAlerts(),
4243
4266
  getIndicators: () => this.getIndicatorSetup(),
@@ -4249,14 +4272,14 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4249
4272
  });
4250
4273
  }
4251
4274
  restoreIndicators(e, t) {
4252
- let n = Yr(e), r = /* @__PURE__ */ new Map();
4275
+ let n = Zr(e), r = /* @__PURE__ */ new Map();
4253
4276
  this.unrestoredIndicators = [];
4254
4277
  let i = new Set(this.indicatorEngine.getAvailableIndicators().map((e) => e.id)), a = [], o = /* @__PURE__ */ new Set();
4255
4278
  if (t) {
4256
4279
  let e = new Map(n.map((e) => [e.instanceId, e])), t = this.getIndicatorSetup();
4257
4280
  for (let n of t) {
4258
4281
  let t = e.get(n.instanceId);
4259
- t && Xr(n, t) && o.add(n.instanceId);
4282
+ t && Qr(n, t) && o.add(n.instanceId);
4260
4283
  }
4261
4284
  for (let e of t) o.has(e.instanceId) || this.removeIndicator(e.instanceId);
4262
4285
  for (let e of [...o]) this.indicatorEngine.getIndicatorConfig(e) || o.delete(e);
@@ -4318,7 +4341,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4318
4341
  let s = t.levels ?? null;
4319
4342
  JSON.stringify(s) !== JSON.stringify(o?.levels ?? null) && this.setIndicatorLevels(e, s);
4320
4343
  let c = t.intervals ?? null;
4321
- JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? se(t.paneStyle) : null);
4344
+ JSON.stringify(c) !== JSON.stringify(o?.intervals ?? null) && this.setIndicatorIntervalsNow(e, c), this.setPaneStyleNow(e, t.paneStyle ? oe(t.paneStyle) : null);
4322
4345
  }
4323
4346
  restorePanes(e) {
4324
4347
  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, {
@@ -4421,45 +4444,88 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4421
4444
  }
4422
4445
  recordIndicators(e, t) {
4423
4446
  if (this.indicatorHistoryDepth > 0 || !this.features.drawingUndoRedo) return t();
4424
- let n = this.getIndicatorSetup(), r = this.withoutIndicatorHistory(t), i = this.getIndicatorSetup();
4425
- if (JSON.stringify(n) === JSON.stringify(i)) return r;
4426
- let a = performance.now(), o = this.undoRedoManager.last(), s = e !== void 0 && o?.type === "indicators" && o.indicators?.subject === e && a - (o.indicators.at ?? 0) < Ur && JSON.stringify(o.indicators.after) === JSON.stringify(n), c = {
4447
+ let n = this.getIndicatorSetup(), r = [], i = this.paneRenames;
4448
+ this.paneRenames = r;
4449
+ let a;
4450
+ try {
4451
+ a = this.withoutIndicatorHistory(t);
4452
+ } finally {
4453
+ this.paneRenames = i;
4454
+ }
4455
+ let o = this.getIndicatorSetup();
4456
+ if (JSON.stringify(n) === JSON.stringify(o)) return a;
4457
+ let s = performance.now(), c = this.undoRedoManager.last(), l = e !== void 0 && c?.type === "indicators" && c.indicators?.subject === e && s - (c.indicators.at ?? 0) < Ur && JSON.stringify(c.indicators.after) === JSON.stringify(n), u = {
4427
4458
  type: "indicators",
4428
4459
  before: null,
4429
4460
  after: null
4430
4461
  };
4431
- return s && o?.indicators ? JSON.stringify(o.indicators.before) === JSON.stringify(i) ? this.undoRedoManager.dropLast() : this.undoRedoManager.replaceLast({
4432
- ...c,
4462
+ return l && c?.indicators ? JSON.stringify(c.indicators.before) === JSON.stringify(o) ? this.undoRedoManager.dropLast() : this.undoRedoManager.replaceLast({
4463
+ ...u,
4433
4464
  indicators: {
4434
- ...o.indicators,
4435
- after: i,
4436
- at: a
4465
+ ...c.indicators,
4466
+ after: o,
4467
+ at: s,
4468
+ ...Gr([...c.indicators.renames ?? [], ...r])
4437
4469
  }
4438
4470
  }) : this.undoRedoManager.push({
4439
- ...c,
4471
+ ...u,
4440
4472
  indicators: {
4441
4473
  before: n,
4442
- after: i,
4474
+ after: o,
4443
4475
  subject: e,
4444
- at: a
4476
+ at: s,
4477
+ ...Gr(r)
4445
4478
  }
4446
- }), r;
4479
+ }), a;
4447
4480
  }
4448
4481
  applyIndicatorStep(e, t) {
4449
4482
  let n = e.indicators;
4450
- n && (this.withoutIndicatorHistory(() => this.restoreIndicators(t === "undo" ? n.before : n.after, !0)), this.markStateChanged());
4483
+ if (!n) return;
4484
+ this.withoutIndicatorHistory(() => this.restoreIndicators(t === "undo" ? n.before : n.after, !0));
4485
+ let r = n.renames ?? [], i = t === "undo" ? [...r].reverse().map(([e, t]) => [t, e]) : r;
4486
+ for (let [e, t] of i) this.drawingManager.renamePanes(new Map([[e, t]]));
4487
+ this.markStateChanged();
4488
+ }
4489
+ keptPaneDrawings = [];
4490
+ takesDrawing(e, t) {
4491
+ return this.layoutManager.getPanels().some((t) => t.id === e) ? !this.drawingManager.getDescriptor(t)?.priceOnly : !1;
4492
+ }
4493
+ paneRenames = null;
4494
+ renamePane(e, t) {
4495
+ this.layoutManager.renamePanel(e, t), this.drawingManager.renamePanes(new Map([[e, t]])), this.paneRenames?.push([e, t]);
4496
+ }
4497
+ drawingPaneAt(e) {
4498
+ let t = (t) => e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
4499
+ if (!t(this.viewport.getState().chartRect)) {
4500
+ for (let e of this.layoutManager.getPanels()) {
4501
+ let n = this.drawingPaneViewport(e.id);
4502
+ if (n && t(n.chartRect)) return e.id;
4503
+ }
4504
+ return null;
4505
+ }
4506
+ }
4507
+ drawingPaneViewport(e) {
4508
+ let t = this.layoutManager.getPanels().find((t) => t.id === e);
4509
+ if (!t || t.position !== "top" && t.position !== "bottom" || this.layoutManager.isPanelShownCollapsed(e)) return null;
4510
+ let n = this.buildPanelRenderInfos().find((t) => t.instanceId === e);
4511
+ return !n || n.viewport.chartRect.height < Wr ? null : {
4512
+ ...n.viewport,
4513
+ data: this.getDisplayData()
4514
+ };
4451
4515
  }
4452
4516
  saveState(e) {
4453
4517
  if (!this.features.saveLoad) return null;
4454
- let t = this.captureSnapshot(), n = T.serialize(t);
4455
- return e && T.saveToStorage(e, t), n;
4518
+ let t = this.captureSnapshot(), n = E.serialize(t);
4519
+ return e && E.saveToStorage(e, t), n;
4456
4520
  }
4457
4521
  loadState(e) {
4458
4522
  if (!this.features.saveLoad) return;
4459
- let t = T.deserialize(e);
4523
+ let t = E.deserialize(e);
4460
4524
  this.chartTypeOptions = t.chartTypeOptions ?? {}, this.displayDataCache = null, this.reshapeMemo.clear(), 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");
4461
4525
  let n = t.version >= 2 && this.features.indicators ? this.withoutIndicatorHistory(() => this.restoreIndicators(t.indicators, !1)) : /* @__PURE__ */ new Map();
4462
- if (this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
4526
+ this.drawingManager.renamePanes(n);
4527
+ let r = new Set(this.unrestoredIndicators.map((e) => e.instanceId)), i = this.drawingManager.getDrawings(), a = i.filter((e) => e.paneId === void 0 || this.takesDrawing(e.paneId, e.type));
4528
+ if (this.keptPaneDrawings = i.filter((e) => e.paneId !== void 0 && r.has(e.paneId)), a.length !== i.length && this.drawingManager.setDrawings(a), this.undoRedoManager.clear(), t.alerts && this.features.alerts) {
4463
4529
  this.alertManager.clearAlerts();
4464
4530
  for (let e of t.alerts) {
4465
4531
  if (e.triggered && !e.repeating) continue;
@@ -4487,19 +4553,19 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4487
4553
  }
4488
4554
  loadStateFromStorage(e) {
4489
4555
  if (!this.features.saveLoad) return !1;
4490
- let t = T.loadFromStorage(e);
4491
- return t ? (this.loadState(T.serialize(t)), !0) : !1;
4556
+ let t = E.loadFromStorage(e);
4557
+ return t ? (this.loadState(E.serialize(t)), !0) : !1;
4492
4558
  }
4493
4559
  downloadState(e) {
4494
- this.features.saveLoad && T.downloadFile(this.captureSnapshot(), e);
4560
+ this.features.saveLoad && E.downloadFile(this.captureSnapshot(), e);
4495
4561
  }
4496
4562
  async loadStateFromFile() {
4497
4563
  if (!this.features.saveLoad) return;
4498
- let e = await T.loadFromFile();
4499
- this.loadState(T.serialize(e));
4564
+ let e = await E.loadFromFile();
4565
+ this.loadState(E.serialize(e));
4500
4566
  }
4501
4567
  setLocale(e) {
4502
- le(e), this.engine.requestRender();
4568
+ ce(e), this.engine.requestRender();
4503
4569
  }
4504
4570
  setNumberLocale(e) {
4505
4571
  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.pinnedTooltip.setLocale(e), this.currentPriceLine.setLocale(e), this.updateViewportAndRender();
@@ -4550,7 +4616,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4550
4616
  }
4551
4617
  createChartRenderer(e) {
4552
4618
  let t = jn(e, (e) => this.pluginManager.getChartType(e));
4553
- return t instanceof ze && t.setPriceText((e) => this.formatPrice(e)), t;
4619
+ return t instanceof Re && t.setPriceText((e) => this.formatPrice(e)), t;
4554
4620
  }
4555
4621
  crosshairSeries() {
4556
4622
  return this.isTimeAligned() ? this.series.bars() : this.getDisplayData();
@@ -4566,7 +4632,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4566
4632
  let n = this.options.chartType, r = (e) => this.pluginManager.getChartType(e);
4567
4633
  if (n !== "pointAndFigure" || r(n)) return Mn(n, e, r, this.chartTypeOptions, t, this.reshapeMemo);
4568
4634
  let { columns: i, boxSize: a } = hn(e, this.chartTypeOptions, this.reshapeMemo);
4569
- return this.chartRenderer instanceof tt && this.chartRenderer.setBoxSize(a), i;
4635
+ return this.chartRenderer instanceof et && this.chartRenderer.setBoxSize(a), i;
4570
4636
  }
4571
4637
  recalcIndicatorsFrom(e, t) {
4572
4638
  if (!this.isTimeAligned()) return this.recalcIndicators(e);
@@ -4578,7 +4644,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4578
4644
  }
4579
4645
  exportBars() {
4580
4646
  if (this.isTimeAligned()) return this.series.bars();
4581
- let e = this.getDisplayData(), t = A(e);
4647
+ let e = this.getDisplayData(), t = kt(e);
4582
4648
  return e.map((e, n) => ({
4583
4649
  ...e,
4584
4650
  time: t[n]?.time ?? e.time
@@ -4637,12 +4703,12 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4637
4703
  }
4638
4704
  fitPriceScale(e, t) {
4639
4705
  if (e.length === 0) return;
4640
- let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i = ni(ni(m(e, n, r, 0), this.indicatorEngine.getOverlayPriceRange(n, r)), this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null), a = this.features.volume && this.volumeRenderer.isVisible() && ti(e, n, r) ? this.volumeRenderer.getHeightRatio() + Hr : D;
4706
+ let n = Math.max(0, t.visibleRange.from), r = Math.min(t.visibleRange.to, e.length - 1), i = ii(ii(m(e, n, r, 0), this.indicatorEngine.getOverlayPriceRange(n, r)), this.features.compareSymbols && this.comparesDrawn() ? this.compareRenderer.getPriceRange(e, t) : null), a = this.features.volume && this.volumeRenderer.isVisible() && ri(e, n, r) ? this.volumeRenderer.getHeightRatio() + Hr : O;
4641
4707
  this.viewport.setScaleMargins(this.viewport.isInvertScale() ? {
4642
4708
  top: a,
4643
- bottom: D
4709
+ bottom: O
4644
4710
  } : {
4645
- top: D,
4711
+ top: O,
4646
4712
  bottom: a
4647
4713
  }), this.viewport.fitToPrices(i.min, i.max);
4648
4714
  }
@@ -4694,9 +4760,9 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4694
4760
  }
4695
4761
  measureText(e, t) {
4696
4762
  let n = this.engine.layerManager.getLayer(r.Main)?.ctx;
4697
- if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => Zr(n, e, t));
4763
+ if (n?.canvas.isConnected) return this.labelWidths.get(e, t, () => $r(n, e, t));
4698
4764
  let i = n ?? this.detachedMeasureContext();
4699
- return i ? Zr(i, e, t) : e.length * 7;
4765
+ return i ? $r(i, e, t) : e.length * 7;
4700
4766
  }
4701
4767
  detachedMeasureContext() {
4702
4768
  return this.measureCtx === void 0 && (this.measureCtx = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null), this.measureCtx;
@@ -4843,7 +4909,7 @@ var Vr = .08, Hr = a ** -7, Ur = 800, Wr = 20, Gr = 8, Kr = new Set(["horizontal
4843
4909
  };
4844
4910
  }
4845
4911
  };
4846
- function Yr(e) {
4912
+ function Zr(e) {
4847
4913
  let t = new Map(e.map((e) => [e.instanceId, e])), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = (e) => {
4848
4914
  if (r.has(e.instanceId) || i.has(e.instanceId)) return;
4849
4915
  i.add(e.instanceId);
@@ -4857,19 +4923,19 @@ function Yr(e) {
4857
4923
  for (let t of e) a(t);
4858
4924
  return n;
4859
4925
  }
4860
- function Xr(e, t) {
4926
+ function Qr(e, t) {
4861
4927
  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);
4862
4928
  }
4863
- function Zr(e, t, n) {
4929
+ function $r(e, t, n) {
4864
4930
  let r = e.font;
4865
4931
  e.font = n;
4866
4932
  let i = e.measureText(t).width;
4867
4933
  return e.font = r, i;
4868
4934
  }
4869
- var Qr = 300;
4870
- function $r(e) {
4935
+ var ei = 300;
4936
+ function ti(e) {
4871
4937
  let t = {}, n = e.family;
4872
- typeof n == "string" && n.trim() !== "" && n.length <= Qr && !/[;{}<>\\]|\/\*/.test(n) && (t.family = n);
4938
+ typeof n == "string" && n.trim() !== "" && n.length <= ei && !/[;{}<>\\]|\/\*/.test(n) && (t.family = n);
4873
4939
  for (let n of [
4874
4940
  "sizeSmall",
4875
4941
  "sizeMedium",
@@ -4880,15 +4946,15 @@ function $r(e) {
4880
4946
  }
4881
4947
  return t;
4882
4948
  }
4883
- function ei(e) {
4949
+ function ni(e) {
4884
4950
  let t = e.tagRadius;
4885
4951
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? { tagRadius: Math.min(t, 999) } : {};
4886
4952
  }
4887
- function ti(e, t, n) {
4953
+ function ri(e, t, n) {
4888
4954
  for (let r = t; r <= n; r++) if (e[r].volume > 0) return !0;
4889
4955
  return !1;
4890
4956
  }
4891
- function ni(e, t) {
4957
+ function ii(e, t) {
4892
4958
  return e ? t ? {
4893
4959
  min: Math.min(e.min, t.min),
4894
4960
  max: Math.max(e.max, t.max)
@@ -4909,14 +4975,14 @@ function J(e) {
4909
4975
  bars: e.bars
4910
4976
  };
4911
4977
  }
4912
- var ri = 8e3, ii = new Set([
4978
+ var ai = 8e3, oi = new Set([
4913
4979
  "candlestick",
4914
4980
  "line",
4915
4981
  "area",
4916
4982
  "bar",
4917
4983
  "hollowCandle"
4918
- ]), ai = 10, oi = 50, si = .001;
4919
- function ci(e) {
4984
+ ]), si = 10, ci = 50, li = .001;
4985
+ function ui(e) {
4920
4986
  return {
4921
4987
  price: null,
4922
4988
  fedTime: null,
@@ -4931,41 +4997,41 @@ function ci(e) {
4931
4997
  held: null
4932
4998
  };
4933
4999
  }
4934
- function li(e, t) {
5000
+ function di(e, t) {
4935
5001
  let n = e[t + 1];
4936
5002
  return n ? n.time - e[t].time : Z(e);
4937
5003
  }
4938
- function ui(e, t, n) {
5004
+ function fi(e, t, n) {
4939
5005
  let r = e.fedTime;
4940
5006
  if (r === null || !t || t.length === 0 || n.length === 0) return;
4941
- let i = li(t, Q(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Q(n, a), s = n[o].time;
5007
+ let i = di(t, Q(t, r)), a = r + (Number.isFinite(i) ? e.fedFraction * i : 0), o = Q(n, a), s = n[o].time;
4942
5008
  if (s > a) return;
4943
- let c = li(n, o);
5009
+ let c = di(n, o);
4944
5010
  if (a === s && o > 0) {
4945
5011
  e.fedTime = n[o - 1].time, e.fedFraction = 1;
4946
5012
  return;
4947
5013
  }
4948
5014
  e.fedTime = s, e.fedFraction = Number.isFinite(c) && c > 0 ? Math.min(1, (a - s) / c) : 0;
4949
5015
  }
4950
- function di(e, t) {
5016
+ function pi(e, t) {
4951
5017
  let n = X(e, t), r = e.length - 1;
4952
5018
  return n > r && r >= 0 && e[r].time + Z(e) <= t ? r : Math.max(-1, n - 2);
4953
5019
  }
4954
- function fi(e) {
5020
+ function mi(e) {
4955
5021
  let t = Infinity;
4956
5022
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.min(t, e[n].time - e[n - 1].time);
4957
5023
  return t;
4958
5024
  }
4959
- function pi(e, t) {
4960
- if (!(fi(e) < fi(t))) return !1;
4961
- let n = Math.max(0, e.length - oi);
5025
+ function hi(e, t) {
5026
+ if (!(mi(e) < mi(t))) return !1;
5027
+ let n = Math.max(0, e.length - ci);
4962
5028
  for (let r = n; r < e.length; r++) {
4963
- let n = t[Q(t, e[r].time)], i = (n.high - n.low) * si + 2 ** -52;
5029
+ let n = t[Q(t, e[r].time)], i = (n.high - n.low) * li + 2 ** -52;
4964
5030
  if (e[r].close > n.high + i || e[r].close < n.low - i) return !1;
4965
5031
  }
4966
5032
  return !0;
4967
5033
  }
4968
- var mi = 500;
5034
+ var gi = 500;
4969
5035
  function Y(e, t) {
4970
5036
  let n = 0, r = e.length;
4971
5037
  for (; n < r;) {
@@ -4982,7 +5048,7 @@ function X(e, t) {
4982
5048
  }
4983
5049
  return n;
4984
5050
  }
4985
- function hi(e) {
5051
+ function _i(e) {
4986
5052
  let t = 0, n = 0;
4987
5053
  for (let r = 1; r < e.length; r++) e[r].low < e[t].low && (t = r), e[r].high > e[n].high && (n = r);
4988
5054
  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];
@@ -4993,7 +5059,7 @@ function Z(e) {
4993
5059
  for (let n = Math.max(1, e.length - 10); n < e.length; n++) t = Math.max(t, e[n].time - e[n - 1].time);
4994
5060
  return t > 0 ? t : Infinity;
4995
5061
  }
4996
- function gi(e, t) {
5062
+ function vi(e, t) {
4997
5063
  if (t.length === 0) return null;
4998
5064
  let n = t[t.length - 1].time + Z(t), r = e.filter((e) => zn(e) && e.time >= t[0].time && e.time < n).sort((e, t) => e.time - t.time), i = [];
4999
5065
  for (let e of r) (i.length === 0 || i[i.length - 1].time !== e.time) && i.push(e);
@@ -5011,26 +5077,26 @@ function Q(e, t) {
5011
5077
  }
5012
5078
  return n;
5013
5079
  }
5014
- function _i(e, t, n) {
5080
+ function yi(e, t, n) {
5015
5081
  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;
5016
5082
  for (let t = 0; t < e.length && e[t].time < i; t++) a = t;
5017
5083
  return Math.max(0, a);
5018
5084
  }
5019
- function vi(e, t, n) {
5085
+ function bi(e, t, n) {
5020
5086
  let r = n;
5021
5087
  for (; r > 0 && t[r - 1].time >= e.time;) r--;
5022
5088
  let i = {
5023
5089
  ...t[r],
5024
5090
  time: e.time
5025
5091
  };
5026
- for (let e = r + 1; e <= n; e++) i = Si(i, t[e]);
5092
+ for (let e = r + 1; e <= n; e++) i = wi(i, t[e]);
5027
5093
  return i;
5028
5094
  }
5029
- function yi(e, t, n, r) {
5095
+ function xi(e, t, n, r) {
5030
5096
  let i = e[n + 1], a = t[r + 1];
5031
5097
  return i !== void 0 && a !== void 0 && i.time >= a.time;
5032
5098
  }
5033
- function bi(e, t) {
5099
+ function Si(e, t) {
5034
5100
  let n = /* @__PURE__ */ new Map();
5035
5101
  for (let r of e) {
5036
5102
  let e = t[Q(t, r.time)].time, i = n.get(e);
@@ -5038,10 +5104,10 @@ function bi(e, t) {
5038
5104
  }
5039
5105
  return n;
5040
5106
  }
5041
- function xi() {
5107
+ function Ci() {
5042
5108
  return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
5043
5109
  }
5044
- function Si(e, t) {
5110
+ function wi(e, t) {
5045
5111
  return {
5046
5112
  time: e.time,
5047
5113
  open: e.open,
@@ -5053,26 +5119,26 @@ function Si(e, t) {
5053
5119
  }
5054
5120
  //#endregion
5055
5121
  //#region src/io/parseOHLCV.ts
5056
- var Ci = [
5122
+ var Ti = [
5057
5123
  "time",
5058
5124
  "timestamp",
5059
5125
  "date",
5060
5126
  "datetime",
5061
5127
  "t"
5062
- ], wi = ["open", "o"], Ti = ["high", "h"], Ei = ["low", "l"], Di = ["close", "c"], Oi = [
5128
+ ], Ei = ["open", "o"], Di = ["high", "h"], Oi = ["low", "l"], ki = ["close", "c"], Ai = [
5063
5129
  "volume",
5064
5130
  "vol",
5065
5131
  "v"
5066
5132
  ];
5067
- function ki(e) {
5133
+ function ji(e) {
5068
5134
  let t = e.trim();
5069
- return t ? t[0] === "[" || t[0] === "{" ? Ai(t) : ji(t) : {
5135
+ return t ? t[0] === "[" || t[0] === "{" ? Mi(t) : Ni(t) : {
5070
5136
  data: [],
5071
5137
  rowCount: 0,
5072
5138
  skipped: 0
5073
5139
  };
5074
5140
  }
5075
- function Ai(e) {
5141
+ function Mi(e) {
5076
5142
  let t;
5077
5143
  try {
5078
5144
  t = JSON.parse(e);
@@ -5082,19 +5148,19 @@ function Ai(e) {
5082
5148
  if (!Array.isArray(t)) throw Error("Expected a JSON array of OHLCV rows");
5083
5149
  let n = [], r = 0;
5084
5150
  for (let e of t) {
5085
- let t = Array.isArray(e) ? Ii(e) : Fi(e);
5151
+ let t = Array.isArray(e) ? Ri(e) : Li(e);
5086
5152
  t ? n.push(t) : r++;
5087
5153
  }
5088
- return Ri(n, t.length, r);
5154
+ return Bi(n, t.length, r);
5089
5155
  }
5090
- function ji(e) {
5156
+ function Ni(e) {
5091
5157
  let t = e.split(/\r?\n/).filter((e) => e.trim().length > 0);
5092
5158
  if (t.length === 0) return {
5093
5159
  data: [],
5094
5160
  rowCount: 0,
5095
5161
  skipped: 0
5096
5162
  };
5097
- let n = Mi(t[0]), r = Ni(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? Pi(r) : {
5163
+ let n = Pi(t[0]), r = Fi(t[0], n).map((e) => e.trim().toLowerCase()), i = r.some((e) => isNaN(Number(e)) && e.length > 0), a = i ? Ii(r) : {
5098
5164
  time: 0,
5099
5165
  open: 1,
5100
5166
  high: 2,
@@ -5105,7 +5171,7 @@ function ji(e) {
5105
5171
  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");
5106
5172
  let o = [], s = 0;
5107
5173
  for (let e = +!!i; e < t.length; e++) {
5108
- let r = Ni(t[e], n), i = Li(r[a.time]), c = $(r[a.open]), l = $(r[a.high]), u = $(r[a.low]), d = $(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
5174
+ let r = Fi(t[e], n), i = zi(r[a.time]), c = $(r[a.open]), l = $(r[a.high]), u = $(r[a.low]), d = $(r[a.close]), f = a.volume >= 0 ? Number(r[a.volume]) : 0;
5109
5175
  if (i === null || ![
5110
5176
  c,
5111
5177
  l,
@@ -5124,9 +5190,9 @@ function ji(e) {
5124
5190
  volume: Number.isFinite(f) ? f : 0
5125
5191
  });
5126
5192
  }
5127
- return Ri(o, t.length - +!!i, s);
5193
+ return Bi(o, t.length - +!!i, s);
5128
5194
  }
5129
- function Mi(e) {
5195
+ function Pi(e) {
5130
5196
  let t = {
5131
5197
  ",": 0,
5132
5198
  ";": 0,
@@ -5138,7 +5204,7 @@ function Mi(e) {
5138
5204
  for (let [e, i] of Object.entries(t)) i > r && (n = e, r = i);
5139
5205
  return n;
5140
5206
  }
5141
- function Ni(e, t) {
5207
+ function Fi(e, t) {
5142
5208
  let n = [], r = "", i = !1;
5143
5209
  for (let a = 0; a < e.length; a++) {
5144
5210
  let o = e[a];
@@ -5146,25 +5212,25 @@ function Ni(e, t) {
5146
5212
  }
5147
5213
  return n.push(r), n;
5148
5214
  }
5149
- function Pi(e) {
5215
+ function Ii(e) {
5150
5216
  let t = (t) => e.findIndex((e) => t.includes(e));
5151
5217
  return {
5152
- time: t(Ci),
5153
- open: t(wi),
5154
- high: t(Ti),
5155
- low: t(Ei),
5156
- close: t(Di),
5157
- volume: t(Oi)
5218
+ time: t(Ti),
5219
+ open: t(Ei),
5220
+ high: t(Di),
5221
+ low: t(Oi),
5222
+ close: t(ki),
5223
+ volume: t(Ai)
5158
5224
  };
5159
5225
  }
5160
- function Fi(e) {
5226
+ function Li(e) {
5161
5227
  let t = (t) => {
5162
5228
  for (let n of t) {
5163
5229
  if (e[n] !== void 0) return e[n];
5164
5230
  let t = n.toUpperCase();
5165
5231
  if (e[t] !== void 0) return e[t];
5166
5232
  }
5167
- }, n = Li(String(t(Ci) ?? "")), r = Number(t(wi)), i = Number(t(Ti)), a = Number(t(Ei)), o = Number(t(Di)), s = Number(t(Oi) ?? 0);
5233
+ }, n = zi(String(t(Ti) ?? "")), r = Number(t(Ei)), i = Number(t(Di)), a = Number(t(Oi)), o = Number(t(ki)), s = Number(t(Ai) ?? 0);
5168
5234
  return n === null || ![
5169
5235
  r,
5170
5236
  i,
@@ -5179,9 +5245,9 @@ function Fi(e) {
5179
5245
  volume: Number.isFinite(s) ? s : 0
5180
5246
  };
5181
5247
  }
5182
- function Ii(e) {
5248
+ function Ri(e) {
5183
5249
  if (e.length < 5) return null;
5184
- let t = Li(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;
5250
+ let t = zi(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;
5185
5251
  return t === null || ![
5186
5252
  n,
5187
5253
  r,
@@ -5199,7 +5265,7 @@ function Ii(e) {
5199
5265
  function $(e) {
5200
5266
  return e === void 0 || e.trim() === "" ? NaN : Number(e);
5201
5267
  }
5202
- function Li(e) {
5268
+ function zi(e) {
5203
5269
  let t = e.trim();
5204
5270
  if (!t) return null;
5205
5271
  let n = Number(t);
@@ -5207,7 +5273,7 @@ function Li(e) {
5207
5273
  let r = Date.parse(t);
5208
5274
  return Number.isFinite(r) ? r : null;
5209
5275
  }
5210
- function Ri(e, t, n) {
5276
+ function Bi(e, t, n) {
5211
5277
  e.sort((e, t) => e.time - t.time);
5212
5278
  let r = [];
5213
5279
  for (let t of e) r.length > 0 && r[r.length - 1].time === t.time ? r[r.length - 1] = t : r.push(t);
@@ -5219,7 +5285,7 @@ function Ri(e, t, n) {
5219
5285
  }
5220
5286
  //#endregion
5221
5287
  //#region src/io/DragDropImporter.ts
5222
- var zi = class {
5288
+ var Vi = class {
5223
5289
  host;
5224
5290
  overlay = null;
5225
5291
  callbacks;
@@ -5240,19 +5306,19 @@ var zi = class {
5240
5306
  this.host.removeEventListener("dragenter", this.bound.dragenter), this.host.removeEventListener("dragover", this.bound.dragover), this.host.removeEventListener("dragleave", this.bound.dragleave), this.host.removeEventListener("drop", this.bound.drop), this.hideOverlay();
5241
5307
  }
5242
5308
  onDragEnter(e) {
5243
- Bi(e) && (e.preventDefault(), this.depth++, this.showOverlay());
5309
+ Hi(e) && (e.preventDefault(), this.depth++, this.showOverlay());
5244
5310
  }
5245
5311
  onDragOver(e) {
5246
- Bi(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
5312
+ Hi(e) && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy"));
5247
5313
  }
5248
5314
  onDragLeave(e) {
5249
- Bi(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
5315
+ Hi(e) && (this.depth = Math.max(0, this.depth - 1), this.depth === 0 && this.hideOverlay());
5250
5316
  }
5251
5317
  async onDrop(e) {
5252
5318
  e.preventDefault(), this.depth = 0, this.hideOverlay();
5253
5319
  let t = e.dataTransfer?.files?.[0];
5254
5320
  if (t) try {
5255
- let e = ki(await t.text());
5321
+ let e = ji(await t.text());
5256
5322
  if (e.data.length === 0) throw Error(`No valid OHLCV rows found in "${t.name}"`);
5257
5323
  this.callbacks.onData(e.data, e, t);
5258
5324
  } catch (e) {
@@ -5283,12 +5349,12 @@ var zi = class {
5283
5349
  this.overlay?.remove(), this.overlay = null;
5284
5350
  }
5285
5351
  };
5286
- function Bi(e) {
5352
+ function Hi(e) {
5287
5353
  return e.dataTransfer?.types?.includes("Files") ?? !1;
5288
5354
  }
5289
5355
  //#endregion
5290
5356
  //#region src/state/layoutStorage.ts
5291
- function Vi(e) {
5357
+ function Ui(e) {
5292
5358
  let t = {
5293
5359
  id: e.id,
5294
5360
  name: e.name,
@@ -5296,11 +5362,11 @@ function Vi(e) {
5296
5362
  };
5297
5363
  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;
5298
5364
  }
5299
- var Hi = (e, t) => t.updatedAt - e.updatedAt;
5300
- function Ui(e) {
5365
+ var Wi = (e, t) => t.updatedAt - e.updatedAt;
5366
+ function Gi(e) {
5301
5367
  if (typeof e != "object" || !e) return null;
5302
5368
  let t = e;
5303
- return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Vi({
5369
+ return typeof t.id != "string" || !t.id || typeof t.name != "string" || typeof t.updatedAt != "number" || !Number.isFinite(t.updatedAt) ? null : Ui({
5304
5370
  id: t.id,
5305
5371
  name: t.name,
5306
5372
  updatedAt: t.updatedAt,
@@ -5309,17 +5375,17 @@ function Ui(e) {
5309
5375
  kind: typeof t.kind == "string" ? t.kind : void 0
5310
5376
  });
5311
5377
  }
5312
- function Wi(e) {
5313
- let t = Ui(e), n = t ? e.content : void 0;
5378
+ function Ki(e) {
5379
+ let t = Gi(e), n = t ? e.content : void 0;
5314
5380
  return t && typeof n == "string" ? {
5315
5381
  ...t,
5316
5382
  content: n
5317
5383
  } : null;
5318
5384
  }
5319
- function Gi(e = []) {
5385
+ function qi(e = []) {
5320
5386
  let t = new Map(e.map((e) => [e.id, { ...e }]));
5321
5387
  return {
5322
- list: () => [...t.values()].map(Vi).sort(Hi),
5388
+ list: () => [...t.values()].map(Ui).sort(Wi),
5323
5389
  load: (e) => {
5324
5390
  let n = t.get(e);
5325
5391
  return n ? { ...n } : null;
@@ -5332,7 +5398,7 @@ function Gi(e = []) {
5332
5398
  }
5333
5399
  };
5334
5400
  }
5335
- function Ki(e = "tcw:layouts:") {
5401
+ function Ji(e = "tcw:layouts:") {
5336
5402
  let t = `${e}index`, n = (t) => `${e}item:${t}`, r = () => {
5337
5403
  let e;
5338
5404
  try {
@@ -5340,10 +5406,10 @@ function Ki(e = "tcw:layouts:") {
5340
5406
  } catch {
5341
5407
  return [];
5342
5408
  }
5343
- return Array.isArray(e) ? e.map(Ui).filter((e) => e !== null) : [];
5409
+ return Array.isArray(e) ? e.map(Gi).filter((e) => e !== null) : [];
5344
5410
  }, i = (e) => localStorage.setItem(t, JSON.stringify(e));
5345
5411
  return {
5346
- list: () => r().sort(Hi),
5412
+ list: () => r().sort(Wi),
5347
5413
  load: (e) => {
5348
5414
  let t = r().find((t) => t.id === e), i = t ? localStorage.getItem(n(e)) : null;
5349
5415
  return t && i !== null ? {
@@ -5352,7 +5418,7 @@ function Ki(e = "tcw:layouts:") {
5352
5418
  } : null;
5353
5419
  },
5354
5420
  save: (e) => {
5355
- localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Vi(e)]);
5421
+ localStorage.setItem(n(e.id), e.content), i([...r().filter((t) => t.id !== e.id), Ui(e)]);
5356
5422
  },
5357
5423
  remove: (e) => {
5358
5424
  i(r().filter((t) => t.id !== e)), localStorage.removeItem(n(e));
@@ -5361,14 +5427,14 @@ function Ki(e = "tcw:layouts:") {
5361
5427
  }
5362
5428
  //#endregion
5363
5429
  //#region src/state/LayoutSession.ts
5364
- var qi = 80;
5365
- function Ji(e) {
5430
+ var Yi = 80;
5431
+ function Xi(e) {
5366
5432
  return e.replace(/\s+/g, " ").trim().slice(0, 80).trim() || null;
5367
5433
  }
5368
- function Yi() {
5434
+ function Zi() {
5369
5435
  return globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
5370
5436
  }
5371
- function Xi(e) {
5437
+ function Qi(e) {
5372
5438
  let { id: t, name: n, symbol: r, timeframe: i, updatedAt: a, kind: o } = e;
5373
5439
  return {
5374
5440
  id: t,
@@ -5379,7 +5445,7 @@ function Xi(e) {
5379
5445
  ...o === void 0 ? {} : { kind: o }
5380
5446
  };
5381
5447
  }
5382
- var Zi = class {
5448
+ var $i = class {
5383
5449
  currentLayout = null;
5384
5450
  savedContent = null;
5385
5451
  dirty = !1;
@@ -5395,7 +5461,7 @@ var Zi = class {
5395
5461
  now;
5396
5462
  newId;
5397
5463
  constructor(e, t, n = {}) {
5398
- 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 ?? Yi;
5464
+ 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 ?? Zi;
5399
5465
  }
5400
5466
  current() {
5401
5467
  return this.currentLayout;
@@ -5411,7 +5477,7 @@ var Zi = class {
5411
5477
  }
5412
5478
  async list() {
5413
5479
  let e = await this.storage.list();
5414
- return Array.isArray(e) ? e.map(Ui).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
5480
+ return Array.isArray(e) ? e.map(Gi).filter((e) => e !== null && (e.kind ?? "chart") === this.kind).sort((e, t) => t.updatedAt - e.updatedAt) : [];
5415
5481
  }
5416
5482
  save() {
5417
5483
  return this.queue(() => {
@@ -5420,12 +5486,12 @@ var Zi = class {
5420
5486
  });
5421
5487
  }
5422
5488
  saveAs(e) {
5423
- let t = Ji(e);
5489
+ let t = Xi(e);
5424
5490
  return t ? this.queue(() => this.write(this.newId(), t)) : Promise.reject(/* @__PURE__ */ Error("A layout needs a name"));
5425
5491
  }
5426
5492
  open(e) {
5427
5493
  return this.queue(async () => {
5428
- let t = Wi(await this.storage.load(e));
5494
+ let t = Ki(await this.storage.load(e));
5429
5495
  if (!t || t.id !== e || (t.kind ?? "chart") !== this.kind || this.destroyed) return !1;
5430
5496
  this.cancelTimer(), this.applying++;
5431
5497
  try {
@@ -5435,13 +5501,13 @@ var Zi = class {
5435
5501
  } finally {
5436
5502
  this.applying--;
5437
5503
  }
5438
- return this.cancelTimer(), this.currentLayout = Xi(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
5504
+ return this.cancelTimer(), this.currentLayout = Qi(t), this.savedContent = this.host.capture().content, this.dirty = !1, this.notify(), !0;
5439
5505
  });
5440
5506
  }
5441
5507
  rename(e, t) {
5442
- let n = Ji(t);
5508
+ let n = Xi(t);
5443
5509
  return n ? this.queue(async () => {
5444
- let t = Wi(await this.storage.load(e));
5510
+ let t = Ki(await this.storage.load(e));
5445
5511
  !t || t.id !== e || (await this.storage.save({
5446
5512
  ...t,
5447
5513
  name: n
@@ -5519,7 +5585,7 @@ var Zi = class {
5519
5585
  content: n.content
5520
5586
  };
5521
5587
  await this.storage.save(r);
5522
- let i = Xi(r);
5588
+ let i = Qi(r);
5523
5589
  return this.currentLayout = i, this.savedContent = n.content, this.dirty = !1, this.notify(), i;
5524
5590
  }
5525
5591
  forget() {
@@ -5540,6 +5606,6 @@ var Zi = class {
5540
5606
  }
5541
5607
  };
5542
5608
  //#endregion
5543
- export { Wn as C, B as D, R as E, dn as O, qn as S, V as T, dr as _, Gi as a, G as b, Jr as c, Pr as d, Fr as f, ur as g, fr as h, Ki as i, Rr as l, pr as m, qi as n, zi as o, mr as p, Ji as r, ki as s, Zi as t, Lr as u, cr as v, Hn as w, Qn as x, lr as y };
5609
+ export { Wn as C, B as D, R as E, dn as O, qn as S, V as T, dr as _, qi as a, G as b, Xr as c, Pr as d, Fr as f, ur as g, fr as h, Ji as i, Rr as l, pr as m, Yi as n, Vi as o, mr as p, Xi as r, ji as s, $i as t, Lr as u, cr as v, Hn as w, Qn as x, lr as y };
5544
5610
 
5545
- //# sourceMappingURL=LayoutSession-CXCLFIvS.js.map
5611
+ //# sourceMappingURL=LayoutSession-BQvEMVYA.js.map