@tradecanvas/core 0.8.1 → 0.9.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 (34) hide show
  1. package/README.md +7 -6
  2. package/dist/axis/PriceAxis.d.ts.map +1 -1
  3. package/dist/axis/TimeAxis.d.ts.map +1 -1
  4. package/dist/charts/VolumeProfileRenderer.d.ts +36 -0
  5. package/dist/charts/VolumeProfileRenderer.d.ts.map +1 -0
  6. package/dist/charts/index.d.ts +1 -0
  7. package/dist/charts/index.d.ts.map +1 -1
  8. package/dist/engine/RenderEngine.d.ts +2 -0
  9. package/dist/engine/RenderEngine.d.ts.map +1 -1
  10. package/dist/features/MeasureOverlay.d.ts +27 -0
  11. package/dist/features/MeasureOverlay.d.ts.map +1 -0
  12. package/dist/features/ReplayManager.d.ts +5 -0
  13. package/dist/features/ReplayManager.d.ts.map +1 -1
  14. package/dist/features/index.d.ts +1 -0
  15. package/dist/features/index.d.ts.map +1 -1
  16. package/dist/index.cjs +8 -3
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.js +821 -389
  19. package/dist/index.js.map +1 -1
  20. package/dist/interaction/AxisDragHandler.d.ts +32 -0
  21. package/dist/interaction/AxisDragHandler.d.ts.map +1 -0
  22. package/dist/interaction/CrosshairHandler.d.ts +9 -0
  23. package/dist/interaction/CrosshairHandler.d.ts.map +1 -1
  24. package/dist/interaction/InteractionManager.d.ts +32 -1
  25. package/dist/interaction/InteractionManager.d.ts.map +1 -1
  26. package/dist/interaction/PinnedTooltip.d.ts +39 -0
  27. package/dist/interaction/PinnedTooltip.d.ts.map +1 -0
  28. package/dist/interaction/index.d.ts +2 -0
  29. package/dist/interaction/index.d.ts.map +1 -1
  30. package/dist/ui/SessionBreaks.d.ts +7 -2
  31. package/dist/ui/SessionBreaks.d.ts.map +1 -1
  32. package/dist/viewport/Viewport.d.ts +6 -0
  33. package/dist/viewport/Viewport.d.ts.map +1 -1
  34. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -216,7 +216,7 @@ var ee = class {
216
216
  if (e.has(l.Background) && this.bgLayer && (this.bgLayer.clear(), t.gridRenderer?.render(this.bgLayer.ctx, n, r), t.sessionBreaks?.render(this.bgLayer.ctx, n, r, i), t.watermark?.render(this.bgLayer.ctx, n, r)), e.has(l.Main) && this.mainLayer) {
217
217
  this.mainLayer.clear();
218
218
  let e = this.mainLayer.ctx;
219
- e.save(), e.beginPath(), e.rect(n.chartRect.x, n.chartRect.y, n.chartRect.width, n.chartRect.height), e.clip(), t.volumeRenderer?.render(e, i, n, r), t.chartRenderer?.render(e, i, n, r), t.compareRenderer?.render(e, i, n, r), t.indicatorEngine?.renderOverlays(e, n), e.restore();
219
+ e.save(), e.beginPath(), e.rect(n.chartRect.x, n.chartRect.y, n.chartRect.width, n.chartRect.height), e.clip(), t.volumeRenderer?.render(e, i, n, r), t.volumeProfile?.render(e, i, n, r), t.chartRenderer?.render(e, i, n, r), t.compareRenderer?.render(e, i, n, r), t.indicatorEngine?.renderOverlays(e, n), e.restore();
220
220
  let a = t.panels, o = t.indicatorEngine;
221
221
  if (o && a.length > 0) {
222
222
  let t = `10px ${r.font.family}`, n = o.getPanelIndicators(), i = /* @__PURE__ */ new Map();
@@ -232,7 +232,7 @@ var ee = class {
232
232
  if (e.has(l.Overlay) && this.overlayLayer) {
233
233
  this.overlayLayer.clear();
234
234
  let e = this.overlayLayer.ctx;
235
- t.priceLimits && this.renderPriceLimits(e, n, r, t.priceLimits), t.tradeZoneManager?.render(e, n, r), t.drawingRenderer?.render(e, n), t.tradingRenderer?.render(e, n, r), t.signalMarkerManager?.render(e, n, r), t.alertManager?.render(e, n, r), t.crosshairHandler?.render(e, n, r);
235
+ t.priceLimits && this.renderPriceLimits(e, n, r, t.priceLimits), t.tradeZoneManager?.render(e, n, r), t.drawingRenderer?.render(e, n), t.tradingRenderer?.render(e, n, r), t.signalMarkerManager?.render(e, n, r), t.alertManager?.render(e, n, r), t.measureOverlay?.render(e, n, r), t.crosshairHandler?.render(e, n, r);
236
236
  let i = t.crosshairHandler?.getPosition();
237
237
  if (i && t.panels.length > 0) for (let n of t.panels) {
238
238
  let a = n.rect;
@@ -246,7 +246,7 @@ var ee = class {
246
246
  if (e.has(l.UI) && this.uiLayer) {
247
247
  this.uiLayer.clear();
248
248
  let e = this.uiLayer.ctx;
249
- if (t.priceAxis?.render(e, n, r), t.tradingRenderer?.renderAxisBadges(e, n, r), t.currentPriceLine?.render(e, n, r), t.timeAxis?.render(e, n, r, i, t.timeAxisY), t.chartLegend?.render(e, n, r, i), t.barCountdown?.render(e, n, r, i), t.panels.length > 0) {
249
+ if (t.priceAxis?.render(e, n, r), t.tradingRenderer?.renderAxisBadges(e, n, r), t.currentPriceLine?.render(e, n, r), t.timeAxis?.render(e, n, r, i, t.timeAxisY), t.crosshairHandler?.renderAxisLabels(e, n, r, i, t.timeAxisY), t.chartLegend?.render(e, n, r, i), t.barCountdown?.render(e, n, r, i), t.panels.length > 0) {
250
250
  let n = t.crosshairHandler?.getPosition(), o = t.indicatorEngine, s = `${r.font.sizeSmall}px ${r.font.family}`, c;
251
251
  if (o) {
252
252
  let e = o.getPanelIndicators();
@@ -393,6 +393,14 @@ var ee = class {
393
393
  max: t
394
394
  };
395
395
  }
396
+ scalePriceRange(e) {
397
+ if (!Number.isFinite(e) || e <= 0) return;
398
+ let { min: t, max: n } = this.state.priceRange, r = (t + n) / 2, i = (n - t) / 2, a = Math.max(i * e, 1e-9);
399
+ this.state.priceRange = {
400
+ min: r - a,
401
+ max: r + a
402
+ };
403
+ }
396
404
  scrollBy(e) {
397
405
  this.state.offset += e, this.clampOffset(), this.updateVisibleRange();
398
406
  }
@@ -718,6 +726,56 @@ var he = class {
718
726
  e.globalAlpha = .35, e.fillStyle = r.candleUp, e.fill(h), e.fillStyle = r.candleDown, e.fill(g), e.globalAlpha = 1;
719
727
  }
720
728
  }, ye = class {
729
+ visible = !1;
730
+ buckets = 48;
731
+ widthRatio = .18;
732
+ opacity = .32;
733
+ highlightPoC = !0;
734
+ setVisible(e) {
735
+ this.visible = e;
736
+ }
737
+ isVisible() {
738
+ return this.visible;
739
+ }
740
+ setBuckets(e) {
741
+ this.buckets = Math.max(8, Math.min(200, Math.floor(e)));
742
+ }
743
+ setWidthRatio(e) {
744
+ this.widthRatio = Math.max(.05, Math.min(.5, e));
745
+ }
746
+ setOpacity(e) {
747
+ this.opacity = Math.max(.05, Math.min(1, e));
748
+ }
749
+ setHighlightPoC(e) {
750
+ this.highlightPoC = e;
751
+ }
752
+ render(e, t, n, r) {
753
+ if (!this.visible || t.length === 0) return;
754
+ let { from: i, to: a } = n.visibleRange, { chartRect: o, priceRange: s } = n, c = s.max - s.min;
755
+ if (c <= 0) return;
756
+ let l = new Float64Array(this.buckets), u = new Float64Array(this.buckets), d = new Float64Array(this.buckets);
757
+ for (let e = i; e <= a && e < t.length; e++) {
758
+ let n = t[e];
759
+ if (n.volume <= 0) continue;
760
+ let r = Math.max(n.low, s.min), i = Math.min(n.high, s.max);
761
+ if (i <= r) continue;
762
+ let a = (r - s.min) / c, o = (i - s.min) / c, f = Math.max(0, Math.floor(a * this.buckets)), p = Math.min(this.buckets - 1, Math.floor(o * this.buckets)), m = Math.max(1, p - f + 1), h = n.volume / m, g = n.close >= n.open;
763
+ for (let e = f; e <= p; e++) l[e] += h, g ? u[e] += h : d[e] += h;
764
+ }
765
+ let f = 0, p = -1;
766
+ for (let e = 0; e < l.length; e++) l[e] > f && (f = l[e], p = e);
767
+ if (f === 0) return;
768
+ let m = o.width * this.widthRatio, h = o.x + o.width, g = o.height / this.buckets, _ = 1 / f;
769
+ e.save(), e.globalAlpha = this.opacity;
770
+ for (let t = 0; t < this.buckets; t++) {
771
+ let n = l[t];
772
+ if (n === 0) continue;
773
+ let i = o.y + o.height - (t + 1) * g, a = n * _ * m, s = u[t] * _ * m, c = d[t] * _ * m;
774
+ s > 0 && (e.fillStyle = r.candleUp, e.fillRect(h - s, i + .5, s, g - 1)), c > 0 && (e.fillStyle = r.candleDown, e.fillRect(h - a, i + .5, c, g - 1)), this.highlightPoC && t === p && (e.globalAlpha = 1, e.strokeStyle = r.crosshair, e.lineWidth = 1, e.setLineDash([3, 2]), e.beginPath(), e.moveTo(o.x, i + g / 2 + .5), e.lineTo(h - a - 2, i + g / 2 + .5), e.stroke(), e.setLineDash([]), e.globalAlpha = this.opacity);
775
+ }
776
+ e.restore();
777
+ }
778
+ }, be = class {
721
779
  symbols = /* @__PURE__ */ new Map();
722
780
  mode = "percent";
723
781
  setMode(e) {
@@ -772,7 +830,7 @@ var he = class {
772
830
  };
773
831
  //#endregion
774
832
  //#region src/charts/transforms/heikinAshi.ts
775
- function be(e) {
833
+ function xe(e) {
776
834
  if (e.length === 0) return [];
777
835
  let t = [], n = e[0].open, r = (e[0].open + e[0].high + e[0].low + e[0].close) / 4;
778
836
  for (let i = 0; i < e.length; i++) {
@@ -790,10 +848,10 @@ function be(e) {
790
848
  }
791
849
  //#endregion
792
850
  //#region src/charts/transforms/renko.ts
793
- function xe(e, t) {
851
+ function Se(e, t) {
794
852
  if (e.length === 0) return [];
795
853
  let n = t.brickSize;
796
- t.useATR && e.length > (t.atrPeriod ?? 14) && (n = Se(e, t.atrPeriod ?? 14)), n <= 0 && (n = 1);
854
+ t.useATR && e.length > (t.atrPeriod ?? 14) && (n = Ce(e, t.atrPeriod ?? 14)), n <= 0 && (n = 1);
797
855
  let r = [], i = Math.round(e[0].close / n) * n, a = e[0].time;
798
856
  for (let t = 1; t < e.length; t++) {
799
857
  let o = e[t].close - i, s = Math.floor(Math.abs(o) / n);
@@ -814,7 +872,7 @@ function xe(e, t) {
814
872
  }
815
873
  return r;
816
874
  }
817
- function Se(e, t) {
875
+ function Ce(e, t) {
818
876
  let n = 0;
819
877
  for (let r = 1; r <= Math.min(t, e.length - 1); r++) {
820
878
  let t = Math.max(e[r].high - e[r].low, Math.abs(e[r].high - e[r - 1].close), Math.abs(e[r].low - e[r - 1].close));
@@ -824,7 +882,7 @@ function Se(e, t) {
824
882
  }
825
883
  //#endregion
826
884
  //#region src/charts/transforms/lineBreak.ts
827
- function Ce(e, t = 3) {
885
+ function we(e, t = 3) {
828
886
  if (e.length === 0) return [];
829
887
  let n = [], r = 0;
830
888
  n.push({
@@ -865,7 +923,7 @@ function Ce(e, t = 3) {
865
923
  }
866
924
  //#endregion
867
925
  //#region src/charts/transforms/kagi.ts
868
- function we(e, t = 4) {
926
+ function Te(e, t = 4) {
869
927
  if (e.length < 2) return e.slice();
870
928
  let n = [], r = e[1].close >= e[0].close ? 1 : -1, i = e[0].close, a = e[0].close, o = e[0].close, s = 0;
871
929
  for (let c = 1; c < e.length; c++) {
@@ -904,7 +962,7 @@ function we(e, t = 4) {
904
962
  }
905
963
  //#endregion
906
964
  //#region src/charts/transforms/pointAndFigure.ts
907
- function Te(e, t, n = 3) {
965
+ function Ee(e, t, n = 3) {
908
966
  if (e.length === 0 || t <= 0) return [];
909
967
  let r = [], i = 0, a = 0, o = 0, s = 0, c = Math.round(e[0].close / t) * t;
910
968
  a = c, o = c, i = 1;
@@ -937,7 +995,7 @@ function Te(e, t, n = 3) {
937
995
  }
938
996
  //#endregion
939
997
  //#region src/charts/transforms/rangeBars.ts
940
- function Ee(e, t) {
998
+ function De(e, t) {
941
999
  if (e.length === 0 || t.rangeSize <= 0) return [];
942
1000
  let n = [], r = e[0].time, i = e[0].open, a = i, o = i, s = 0, c = (e, c) => {
943
1001
  for (e > a && (a = e), e < o && (o = e), s += c; a - o >= t.rangeSize;) {
@@ -1003,7 +1061,7 @@ var M = class {
1003
1061
  }
1004
1062
  return i;
1005
1063
  }
1006
- }, De = 1, Oe = class {
1064
+ }, Oe = 1, ke = class {
1007
1065
  registry = /* @__PURE__ */ new Map();
1008
1066
  instances = /* @__PURE__ */ new Map();
1009
1067
  register(e) {
@@ -1015,7 +1073,7 @@ var M = class {
1015
1073
  addIndicator(e, t = {}, n) {
1016
1074
  let r = this.registry.get(e);
1017
1075
  if (!r) throw Error(`Unknown indicator: ${e}`);
1018
- let i = `tc_${e}_${De++}`, a = {
1076
+ let i = `tc_${e}_${Oe++}`, a = {
1019
1077
  id: e,
1020
1078
  instanceId: i,
1021
1079
  params: {
@@ -1125,7 +1183,7 @@ function P(e, t, n, r = 1) {
1125
1183
  }
1126
1184
  //#endregion
1127
1185
  //#region src/indicators/overlay/SMA.ts
1128
- var ke = class extends M {
1186
+ var Ae = class extends M {
1129
1187
  descriptor = {
1130
1188
  id: "sma",
1131
1189
  name: "Simple Moving Average",
@@ -1157,7 +1215,7 @@ var ke = class extends M {
1157
1215
  }
1158
1216
  e.stroke();
1159
1217
  }
1160
- }, Ae = class extends M {
1218
+ }, je = class extends M {
1161
1219
  descriptor = {
1162
1220
  id: "ema",
1163
1221
  name: "Exponential Moving Average",
@@ -1194,7 +1252,7 @@ var ke = class extends M {
1194
1252
  }
1195
1253
  e.stroke();
1196
1254
  }
1197
- }, je = class extends M {
1255
+ }, Me = class extends M {
1198
1256
  descriptor = {
1199
1257
  id: "bb",
1200
1258
  name: "Bollinger Bands",
@@ -1249,7 +1307,7 @@ var ke = class extends M {
1249
1307
  e.stroke();
1250
1308
  }
1251
1309
  }
1252
- }, Me = class extends M {
1310
+ }, Ne = class extends M {
1253
1311
  descriptor = {
1254
1312
  id: "vwap",
1255
1313
  name: "Volume Weighted Average Price",
@@ -1284,7 +1342,7 @@ var ke = class extends M {
1284
1342
  }
1285
1343
  e.stroke();
1286
1344
  }
1287
- }, Ne = class extends M {
1345
+ }, Pe = class extends M {
1288
1346
  descriptor = {
1289
1347
  id: "ichimoku",
1290
1348
  name: "Ichimoku Cloud",
@@ -1344,7 +1402,7 @@ var ke = class extends M {
1344
1402
  };
1345
1403
  x(c, l, u, r.colors[0], r.lineWidths[0]), x(d, f, p, r.colors[1] ?? "#FF9800", r.lineWidths[0]), x(m, h, g, r.colors[2] ?? "#26A69A", 1), x(_, v, b, r.colors[3] ?? "#EF5350", 1);
1346
1404
  }
1347
- }, Pe = class extends M {
1405
+ }, Fe = class extends M {
1348
1406
  descriptor = {
1349
1407
  id: "psar",
1350
1408
  name: "Parabolic SAR",
@@ -1390,7 +1448,7 @@ var ke = class extends M {
1390
1448
  e.beginPath(), e.arc(o, c, s, 0, Math.PI * 2), e.fillStyle = a.trend === 1 ? r.colors[0] : r.colors[1] ?? "#EF5350", e.fill();
1391
1449
  }
1392
1450
  }
1393
- }, Fe = class extends M {
1451
+ }, Ie = class extends M {
1394
1452
  descriptor = {
1395
1453
  id: "supertrend",
1396
1454
  name: "Supertrend",
@@ -1438,7 +1496,7 @@ var ke = class extends M {
1438
1496
  d !== 0 && (e.beginPath(), e.strokeStyle = p === 1 ? s : c, e.lineWidth = r.lineWidths[0] + .5, e.moveTo(l, u), e.lineTo(o, f), e.stroke()), l = o, u = f, d = p;
1439
1497
  }
1440
1498
  }
1441
- }, Ie = class extends M {
1499
+ }, Le = class extends M {
1442
1500
  descriptor = {
1443
1501
  id: "keltner",
1444
1502
  name: "Keltner Channel",
@@ -1495,7 +1553,7 @@ var ke = class extends M {
1495
1553
  }
1496
1554
  this.drawBand(e, s, l, y(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? r.colors[0], r.lineWidths[0]), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
1497
1555
  }
1498
- }, Le = class extends M {
1556
+ }, Re = class extends M {
1499
1557
  descriptor = {
1500
1558
  id: "donchian",
1501
1559
  name: "Donchian Channel",
@@ -1540,7 +1598,7 @@ var ke = class extends M {
1540
1598
  }
1541
1599
  this.drawBand(e, s, l, y(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? "#787B86", 1), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
1542
1600
  }
1543
- }, Re = [
1601
+ }, ze = [
1544
1602
  "s3",
1545
1603
  "s2",
1546
1604
  "s1",
@@ -1548,7 +1606,7 @@ var ke = class extends M {
1548
1606
  "r1",
1549
1607
  "r2",
1550
1608
  "r3"
1551
- ], ze = class extends M {
1609
+ ], Be = class extends M {
1552
1610
  descriptor = {
1553
1611
  id: "pivots",
1554
1612
  name: "Pivot Points (Classic)",
@@ -1584,7 +1642,7 @@ var ke = class extends M {
1584
1642
  let i = t.series;
1585
1643
  if (!i) return;
1586
1644
  let { from: a, to: o } = n.visibleRange, s = r.colors[0], c = r.colors[1] ?? "#EF5350", l = r.colors[2] ?? "#26A69A", u = r.lineWidths[0], d = (e) => e === "pp" ? s : e.startsWith("r") ? c : l;
1587
- for (let t of Re) {
1645
+ for (let t of ze) {
1588
1646
  e.beginPath(), e.strokeStyle = d(t), e.lineWidth = t === "pp" ? u : Math.max(1, u - 1), t !== "pp" && e.setLineDash([4, 3]);
1589
1647
  let r = !1;
1590
1648
  for (let s = a; s <= o && s < i.length; s++) {
@@ -1596,7 +1654,7 @@ var ke = class extends M {
1596
1654
  e.stroke(), e.setLineDash([]);
1597
1655
  }
1598
1656
  }
1599
- }, Be = class extends M {
1657
+ }, Ve = class extends M {
1600
1658
  descriptor = {
1601
1659
  id: "avwap",
1602
1660
  name: "Anchored VWAP",
@@ -1636,7 +1694,7 @@ var ke = class extends M {
1636
1694
  }
1637
1695
  e.stroke();
1638
1696
  }
1639
- }, Ve = class extends M {
1697
+ }, He = class extends M {
1640
1698
  descriptor = {
1641
1699
  id: "zigzag",
1642
1700
  name: "ZigZag",
@@ -1701,7 +1759,7 @@ var ke = class extends M {
1701
1759
  e.stroke();
1702
1760
  }
1703
1761
  }
1704
- }, He = class extends M {
1762
+ }, Ue = class extends M {
1705
1763
  descriptor = {
1706
1764
  id: "lrc",
1707
1765
  name: "Linear Regression Channel",
@@ -1764,7 +1822,7 @@ var ke = class extends M {
1764
1822
  }
1765
1823
  this.drawBand(e, s, l, y(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? r.colors[0], r.lineWidths[0]), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
1766
1824
  }
1767
- }, Ue = class extends M {
1825
+ }, We = class extends M {
1768
1826
  descriptor = {
1769
1827
  id: "hma",
1770
1828
  name: "Hull Moving Average",
@@ -1777,7 +1835,7 @@ var ke = class extends M {
1777
1835
  values: r,
1778
1836
  series: i
1779
1837
  };
1780
- let a = e.map((e) => e.close), o = Math.max(2, Math.floor(n / 2)), s = Math.max(2, Math.floor(Math.sqrt(n))), c = We(a, n), l = We(a, o), u = Ge(a.map((e, t) => c[t] === null || l[t] === null ? null : 2 * l[t] - c[t]), s);
1838
+ let a = e.map((e) => e.close), o = Math.max(2, Math.floor(n / 2)), s = Math.max(2, Math.floor(Math.sqrt(n))), c = Ge(a, n), l = Ge(a, o), u = Ke(a.map((e, t) => c[t] === null || l[t] === null ? null : 2 * l[t] - c[t]), s);
1781
1839
  for (let t = 0; t < e.length; t++) {
1782
1840
  if (u[t] === null) continue;
1783
1841
  let n = { value: u[t] };
@@ -1803,7 +1861,7 @@ var ke = class extends M {
1803
1861
  e.stroke();
1804
1862
  }
1805
1863
  };
1806
- function We(e, t) {
1864
+ function Ge(e, t) {
1807
1865
  let n = Array(e.length).fill(null);
1808
1866
  if (e.length < t) return n;
1809
1867
  let r = t * (t + 1) / 2;
@@ -1814,7 +1872,7 @@ function We(e, t) {
1814
1872
  }
1815
1873
  return n;
1816
1874
  }
1817
- function Ge(e, t) {
1875
+ function Ke(e, t) {
1818
1876
  let n = Array(e.length).fill(null), r = t * (t + 1) / 2;
1819
1877
  for (let i = t - 1; i < e.length; i++) {
1820
1878
  let a = 0, o = !0;
@@ -1832,7 +1890,7 @@ function Ge(e, t) {
1832
1890
  }
1833
1891
  //#endregion
1834
1892
  //#region src/indicators/panel/AwesomeOscillator.ts
1835
- var Ke = class extends M {
1893
+ var qe = class extends M {
1836
1894
  descriptor = {
1837
1895
  id: "ao",
1838
1896
  name: "Awesome Oscillator",
@@ -1880,7 +1938,7 @@ var Ke = class extends M {
1880
1938
  e.fillStyle = r.up ? m : h, e.fillRect(a - p, s, n.barWidth, c);
1881
1939
  }
1882
1940
  }
1883
- }, qe = class extends M {
1941
+ }, Je = class extends M {
1884
1942
  descriptor = {
1885
1943
  id: "chaikinOsc",
1886
1944
  name: "Chaikin Oscillator",
@@ -1929,7 +1987,7 @@ var Ke = class extends M {
1929
1987
  e.fillStyle = r.value >= 0 ? m : h, e.fillRect(a - p, s, n.barWidth, c);
1930
1988
  }
1931
1989
  }
1932
- }, Je = class extends M {
1990
+ }, Ye = class extends M {
1933
1991
  descriptor = {
1934
1992
  id: "rsi",
1935
1993
  name: "Relative Strength Index",
@@ -1980,7 +2038,7 @@ var Ke = class extends M {
1980
2038
  }
1981
2039
  e.stroke();
1982
2040
  }
1983
- }, Ye = class extends M {
2041
+ }, Xe = class extends M {
1984
2042
  descriptor = {
1985
2043
  id: "macd",
1986
2044
  name: "MACD",
@@ -2047,7 +2105,7 @@ var Ke = class extends M {
2047
2105
  }
2048
2106
  e.fillStyle = m, e.fill(v), e.fillStyle = h, e.fill(y), e.strokeStyle = g, e.lineWidth = r.lineWidths[0], e.lineJoin = "round", e.stroke(S), e.strokeStyle = _, e.stroke(C);
2049
2107
  }
2050
- }, F = class extends M {
2108
+ }, Ze = class extends M {
2051
2109
  descriptor = {
2052
2110
  id: "stochastic",
2053
2111
  name: "Stochastic Oscillator",
@@ -2122,7 +2180,7 @@ var Ke = class extends M {
2122
2180
  };
2123
2181
  l("k", r.colors[0]), l("d", r.colors[1] ?? "#FF9800");
2124
2182
  }
2125
- }, Xe = class extends M {
2183
+ }, Qe = class extends M {
2126
2184
  descriptor = {
2127
2185
  id: "atr",
2128
2186
  name: "Average True Range",
@@ -2176,7 +2234,7 @@ var Ke = class extends M {
2176
2234
  }
2177
2235
  e.stroke();
2178
2236
  }
2179
- }, Ze = class extends M {
2237
+ }, $e = class extends M {
2180
2238
  descriptor = {
2181
2239
  id: "adx",
2182
2240
  name: "Average Directional Index",
@@ -2249,7 +2307,7 @@ var Ke = class extends M {
2249
2307
  };
2250
2308
  l("adx", r.colors[0]), l("plusDI", r.colors[1] ?? "#26A69A"), l("minusDI", r.colors[2] ?? "#EF5350");
2251
2309
  }
2252
- }, Qe = class extends M {
2310
+ }, et = class extends M {
2253
2311
  descriptor = {
2254
2312
  id: "obv",
2255
2313
  name: "On Balance Volume",
@@ -2295,7 +2353,7 @@ var Ke = class extends M {
2295
2353
  }
2296
2354
  e.stroke();
2297
2355
  }
2298
- }, $e = class extends M {
2356
+ }, tt = class extends M {
2299
2357
  descriptor = {
2300
2358
  id: "williamsR",
2301
2359
  name: "Williams %R",
@@ -2335,7 +2393,7 @@ var Ke = class extends M {
2335
2393
  }
2336
2394
  e.stroke();
2337
2395
  }
2338
- }, et = class extends M {
2396
+ }, nt = class extends M {
2339
2397
  descriptor = {
2340
2398
  id: "cci",
2341
2399
  name: "Commodity Channel Index",
@@ -2390,7 +2448,7 @@ var Ke = class extends M {
2390
2448
  }
2391
2449
  e.stroke();
2392
2450
  }
2393
- }, tt = class extends M {
2451
+ }, rt = class extends M {
2394
2452
  descriptor = {
2395
2453
  id: "mfi",
2396
2454
  name: "Money Flow Index",
@@ -2435,7 +2493,7 @@ var Ke = class extends M {
2435
2493
  }
2436
2494
  e.stroke();
2437
2495
  }
2438
- }, nt = class extends M {
2496
+ }, it = class extends M {
2439
2497
  descriptor = {
2440
2498
  id: "aroon",
2441
2499
  name: "Aroon",
@@ -2477,7 +2535,7 @@ var Ke = class extends M {
2477
2535
  };
2478
2536
  l("up", r.colors[0]), l("down", r.colors[1] ?? "#EF5350");
2479
2537
  }
2480
- }, rt = class extends M {
2538
+ }, at = class extends M {
2481
2539
  descriptor = {
2482
2540
  id: "roc",
2483
2541
  name: "Rate of Change",
@@ -2521,7 +2579,7 @@ var Ke = class extends M {
2521
2579
  }
2522
2580
  e.stroke();
2523
2581
  }
2524
- }, it = class extends M {
2582
+ }, ot = class extends M {
2525
2583
  descriptor = {
2526
2584
  id: "tsi",
2527
2585
  name: "True Strength Index",
@@ -2590,7 +2648,7 @@ var Ke = class extends M {
2590
2648
  };
2591
2649
  h("tsi", r.colors[0]), h("signal", r.colors[1] ?? "#FF9800");
2592
2650
  }
2593
- }, at = class extends M {
2651
+ }, st = class extends M {
2594
2652
  descriptor = {
2595
2653
  id: "cmf",
2596
2654
  name: "Chaikin Money Flow",
@@ -2635,7 +2693,7 @@ var Ke = class extends M {
2635
2693
  }
2636
2694
  }
2637
2695
  }
2638
- }, ot = class extends M {
2696
+ }, ct = class extends M {
2639
2697
  descriptor = {
2640
2698
  id: "stddev",
2641
2699
  name: "Standard Deviation",
@@ -2681,7 +2739,7 @@ var Ke = class extends M {
2681
2739
  }
2682
2740
  e.stroke();
2683
2741
  }
2684
- }, st = class extends M {
2742
+ }, lt = class extends M {
2685
2743
  descriptor = {
2686
2744
  id: "volumeProfile",
2687
2745
  name: "Volume Profile",
@@ -2731,7 +2789,7 @@ var Ke = class extends M {
2731
2789
  e.fillStyle = l[t] > u * .7 ? r.colors[1] ?? "rgba(255, 152, 0, 0.5)" : r.colors[0] ?? "rgba(33, 150, 243, 0.3)", e.fillRect(i.x, s - d / 2, p, Math.max(d - 1, 1));
2732
2790
  }
2733
2791
  }
2734
- }, ct = class extends M {
2792
+ }, ut = class extends M {
2735
2793
  descriptor = {
2736
2794
  id: "ad",
2737
2795
  name: "Accumulation/Distribution",
@@ -2777,7 +2835,7 @@ var Ke = class extends M {
2777
2835
  }
2778
2836
  e.stroke();
2779
2837
  }
2780
- }, lt = class extends M {
2838
+ }, dt = class extends M {
2781
2839
  descriptor = {
2782
2840
  id: "vroc",
2783
2841
  name: "Volume Rate of Change",
@@ -2819,19 +2877,19 @@ var Ke = class extends M {
2819
2877
  };
2820
2878
  //#endregion
2821
2879
  //#region src/indicators/registry.ts
2822
- function ut(e) {
2823
- e.register(new ke()), e.register(new Ae()), e.register(new je()), e.register(new Me()), e.register(new Ne()), e.register(new Pe()), e.register(new Fe()), e.register(new Ie()), e.register(new Le()), e.register(new ze()), e.register(new Be()), e.register(new Ve()), e.register(new He()), e.register(new Ue()), e.register(new Je()), e.register(new Ye()), e.register(new F()), e.register(new Xe()), e.register(new Ze()), e.register(new Qe()), e.register(new $e()), e.register(new et()), e.register(new tt()), e.register(new nt()), e.register(new rt()), e.register(new it()), e.register(new at()), e.register(new ot()), e.register(new st()), e.register(new ct()), e.register(new lt()), e.register(new Ke()), e.register(new qe());
2880
+ function ft(e) {
2881
+ e.register(new Ae()), e.register(new je()), e.register(new Me()), e.register(new Ne()), e.register(new Pe()), e.register(new Fe()), e.register(new Ie()), e.register(new Le()), e.register(new Re()), e.register(new Be()), e.register(new Ve()), e.register(new He()), e.register(new Ue()), e.register(new We()), e.register(new Ye()), e.register(new Xe()), e.register(new Ze()), e.register(new Qe()), e.register(new $e()), e.register(new et()), e.register(new tt()), e.register(new nt()), e.register(new rt()), e.register(new it()), e.register(new at()), e.register(new ot()), e.register(new st()), e.register(new ct()), e.register(new lt()), e.register(new ut()), e.register(new dt()), e.register(new qe()), e.register(new Je());
2824
2882
  }
2825
2883
  //#endregion
2826
2884
  //#region src/indicators/worker/messages.ts
2827
- function dt(e) {
2885
+ function pt(e) {
2828
2886
  if (typeof e != "object" || !e) return !1;
2829
2887
  let t = e;
2830
2888
  return typeof t.requestId == "number" ? t.type === "result" || t.type === "pong" || t.type === "error" : !1;
2831
2889
  }
2832
2890
  //#endregion
2833
2891
  //#region src/indicators/worker/IndicatorWorkerHost.ts
2834
- var ft = class {
2892
+ var mt = class {
2835
2893
  worker;
2836
2894
  fallbackPlugins;
2837
2895
  timeoutMs;
@@ -2896,7 +2954,7 @@ var ft = class {
2896
2954
  handleMessage(e) {
2897
2955
  let t = e.data;
2898
2956
  if (t !== void 0) {
2899
- if (!dt(t)) return;
2957
+ if (!pt(t)) return;
2900
2958
  this.dispatchResponse(t);
2901
2959
  return;
2902
2960
  }
@@ -2917,7 +2975,7 @@ var ft = class {
2917
2975
  t.resolve(e.output);
2918
2976
  }
2919
2977
  }
2920
- }, pt = class {
2978
+ }, ht = class {
2921
2979
  visible = !0;
2922
2980
  setVisible(e) {
2923
2981
  this.visible = e;
@@ -2946,7 +3004,7 @@ var ft = class {
2946
3004
  }
2947
3005
  e.stroke();
2948
3006
  }
2949
- }, mt = class {
3007
+ }, gt = class {
2950
3008
  locale = "en-US";
2951
3009
  setLocale(e) {
2952
3010
  this.locale = e;
@@ -2955,41 +3013,48 @@ var ft = class {
2955
3013
  let { chartRect: r, priceRange: i } = t, a = r.x + r.width, o = i.max - i.min;
2956
3014
  if (o <= 0) return;
2957
3015
  let s = 1 / o;
2958
- e.strokeStyle = n.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(a + .5, r.y), e.lineTo(a + .5, r.y + r.height), e.stroke();
2959
- let c = m(i.min, i.max, 8), l = Math.ceil(i.min / c) * c, d = c < 1 ? Math.ceil(-Math.log10(c)) + 1 : 2, f = `${n.font.sizeSmall}px ${n.font.family}`, p = [];
3016
+ e.strokeStyle = n.axisLine, e.lineWidth = 1, e.globalAlpha = .65, e.beginPath(), e.moveTo(a + .5, r.y), e.lineTo(a + .5, r.y + r.height), e.stroke(), e.globalAlpha = 1;
3017
+ let c = m(i.min, i.max, 8), l = Math.ceil(i.min / c) * c, u = c < 1 ? Math.ceil(-Math.log10(c)) + 1 : 2, d = `500 ${n.font.sizeSmall}px ${n.font.family}`, f = [];
2960
3018
  for (let e = l; e <= i.max; e += c) {
2961
3019
  let t = r.y + r.height * (1 - (e - i.min) * s);
2962
- p.push({
3020
+ f.push({
2963
3021
  y: t,
2964
- text: h(e, d, this.locale)
3022
+ text: h(e, u, this.locale)
2965
3023
  });
2966
3024
  }
2967
- e.font = f, e.textBaseline = "middle", e.textAlign = "left", e.fillStyle = n.axisLabelBackground;
2968
- for (let { y: t } of p) e.fillRect(a + 1, t - 8, u - 2, 16);
2969
- e.fillStyle = n.axisLabel;
2970
- for (let { y: t, text: n } of p) e.fillText(n, a + 5, t);
3025
+ e.font = d, e.textBaseline = "middle", e.textAlign = "left", e.strokeStyle = n.axisLine, e.globalAlpha = .45, e.beginPath();
3026
+ for (let { y: t } of f) e.moveTo(a + 1, t + .5), e.lineTo(a + 4, t + .5);
3027
+ e.stroke(), e.globalAlpha = 1, e.fillStyle = n.axisLabel;
3028
+ for (let { y: t, text: n } of f) e.fillText(n, a + 8, t);
2971
3029
  }
2972
- }, I = /* @__PURE__ */ new Date(), ht = (e) => e < 10 ? "0" + e : "" + e, gt = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60, _t = `UTC${gt >= 0 ? "+" : ""}${gt}`, vt = class {
3030
+ }, F = /* @__PURE__ */ new Date(), _t = (e) => e < 10 ? "0" + e : "" + e, vt = -(/* @__PURE__ */ new Date()).getTimezoneOffset() / 60, yt = `UTC${vt >= 0 ? "+" : ""}${vt}`, bt = class {
2973
3031
  render(e, t, n, r, i) {
2974
3032
  let { chartRect: a } = t, o = i ?? a.y + a.height;
2975
- e.strokeStyle = n.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(a.x, o + .5), e.lineTo(a.x + a.width, o + .5), e.stroke();
3033
+ e.strokeStyle = n.axisLine, e.lineWidth = 1, e.globalAlpha = .65, e.beginPath(), e.moveTo(a.x, o + .5), e.lineTo(a.x + a.width, o + .5), e.stroke(), e.globalAlpha = 1;
2976
3034
  let s = t.barWidth + t.barSpacing, c = Math.max(1, Math.ceil(80 / s)), { from: l, to: u } = t.visibleRange, d = -t.offset + a.x + t.barWidth / 2;
2977
- e.font = `${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "top", e.textAlign = "center", e.fillStyle = n.axisLabel;
3035
+ e.font = `500 ${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "top", e.textAlign = "center", e.fillStyle = n.axisLabel;
2978
3036
  let f = -1;
2979
3037
  for (let t = l; t <= u && t < r.length; t++) {
2980
3038
  if (t % c !== 0) continue;
2981
3039
  let n = t * s + d, i = r[t].time, a = i > 0xe8d4a51000 ? i : i * 1e3;
2982
- I.setTime(a);
2983
- let l = I.getDate(), u = I.getMonth() + 1, p = I.getHours(), m = I.getMinutes(), h;
2984
- l === f ? h = `${ht(p)}:${ht(m)}` : (h = `${u}/${l}`, f = l), e.fillText(h, n, o + 5);
3040
+ F.setTime(a);
3041
+ let l = F.getDate(), u = F.getMonth() + 1, p = F.getHours(), m = F.getMinutes(), h;
3042
+ l === f ? h = `${_t(p)}:${_t(m)}` : (h = `${u}/${l}`, f = l), e.fillText(h, n, o + 7);
2985
3043
  }
2986
- let p = a.x + a.width - 4, m = o + 4;
2987
- e.font = `${n.font.sizeSmall - 1}px ${n.font.family}`, e.textAlign = "right", e.textBaseline = "top", e.fillStyle = n.textSecondary, e.fillText(_t, p, m);
3044
+ let p = a.x + a.width - 4, m = o + 7;
3045
+ e.font = `500 ${n.font.sizeSmall - 1}px ${n.font.family}`, e.textAlign = "right", e.textBaseline = "top", e.globalAlpha = .75, e.fillStyle = n.textSecondary, e.fillText(yt, p, m), e.globalAlpha = 1;
2988
3046
  }
2989
- }, yt = class {
3047
+ }, xt = class {
2990
3048
  panHandler = null;
2991
3049
  zoomHandler = null;
2992
3050
  crosshairHandler = null;
3051
+ axisDragHandler = null;
3052
+ axisViewportGetter = null;
3053
+ onAxisDoubleClick = null;
3054
+ measureHandlers = null;
3055
+ measuring = !1;
3056
+ onAltClick = null;
3057
+ onEscape = null;
2993
3058
  drawingManager = null;
2994
3059
  tradingManager = null;
2995
3060
  viewportGetter = null;
@@ -3017,6 +3082,18 @@ var ft = class {
3017
3082
  setCrosshairHandler(e) {
3018
3083
  this.crosshairHandler = e;
3019
3084
  }
3085
+ setAltClickHandler(e) {
3086
+ this.onAltClick = e;
3087
+ }
3088
+ setEscapeHandler(e) {
3089
+ this.onEscape = e;
3090
+ }
3091
+ setMeasureHandlers(e) {
3092
+ this.measureHandlers = e;
3093
+ }
3094
+ setAxisDragHandler(e, t, n) {
3095
+ this.axisDragHandler = e, this.axisViewportGetter = t, this.onAxisDoubleClick = n ?? null;
3096
+ }
3020
3097
  setDrawingManager(e, t) {
3021
3098
  this.drawingManager = e, this.viewportGetter = t;
3022
3099
  }
@@ -3024,40 +3101,77 @@ var ft = class {
3024
3101
  this.tradingManager = e, this.viewportGetter = t;
3025
3102
  }
3026
3103
  attach() {
3027
- let e = () => this.viewportGetter?.() ?? null, t = (t) => {
3104
+ let e = () => this.viewportGetter?.() ?? null, t = (e) => {
3105
+ let t = this.axisViewportGetter?.();
3106
+ if (!t) return null;
3107
+ let n = t.chartRect;
3108
+ return e.y > n.y + n.height ? "time" : e.x > n.x + n.width ? "price" : null;
3109
+ }, n = (n) => {
3028
3110
  this.invalidateRect();
3029
- let n = this.getMousePos(t), r = e();
3030
- this.tradingManager && r && this.tradingManager.onPointerDown(n, r) || this.drawingManager && r && this.drawingManager.onPointerDown(n, r) || this.panHandler?.onPointerDown(n);
3031
- }, n = (t) => {
3032
- let n = this.getMousePos(t), r = e();
3033
- if (this.tradingManager && r && this.tradingManager.onPointerMove(n, r)) {
3034
- this.crosshairHandler?.onPointerMove(n), this.onOverlayDirty?.();
3111
+ let r = this.getMousePos(n), i = e(), a = t(r);
3112
+ if (a && this.axisDragHandler) {
3113
+ this.axisDragHandler.begin(a, r);
3035
3114
  return;
3036
3115
  }
3037
- if (this.drawingManager && r && this.drawingManager.onPointerMove(n, r)) {
3038
- this.crosshairHandler?.onPointerMove(n), this.onOverlayDirty?.();
3116
+ if (n.shiftKey && this.measureHandlers) {
3117
+ this.measuring = !0, this.measureHandlers.begin(r), this.onOverlayDirty?.();
3039
3118
  return;
3040
3119
  }
3041
- this.panHandler?.onPointerMove(n), this.crosshairHandler?.onPointerMove(n), this.onOverlayDirty?.();
3042
- }, r = () => {
3043
- this.tradingManager?.onPointerUp() || this.drawingManager?.onPointerUp() || this.panHandler?.onPointerUp();
3120
+ if (n.altKey && this.onAltClick) {
3121
+ this.onAltClick(r);
3122
+ return;
3123
+ }
3124
+ this.tradingManager && i && this.tradingManager.onPointerDown(r, i) || this.drawingManager && i && this.drawingManager.onPointerDown(r, i) || this.panHandler?.onPointerDown(r);
3125
+ }, r = (n) => {
3126
+ let r = this.getMousePos(n), i = e();
3127
+ if (this.axisDragHandler?.isActive()) {
3128
+ this.axisDragHandler.move(r);
3129
+ return;
3130
+ }
3131
+ if (this.measuring && this.measureHandlers) {
3132
+ this.measureHandlers.move(r), this.onOverlayDirty?.();
3133
+ return;
3134
+ }
3135
+ let a = t(r);
3136
+ if (a === "price" ? this.element.style.cursor = "ns-resize" : a === "time" ? this.element.style.cursor = "ew-resize" : (this.element.style.cursor === "ns-resize" || this.element.style.cursor === "ew-resize") && (this.element.style.cursor = ""), this.tradingManager && i && this.tradingManager.onPointerMove(r, i)) {
3137
+ this.crosshairHandler?.onPointerMove(r), this.onOverlayDirty?.();
3138
+ return;
3139
+ }
3140
+ if (this.drawingManager && i && this.drawingManager.onPointerMove(r, i)) {
3141
+ this.crosshairHandler?.onPointerMove(r), this.onOverlayDirty?.();
3142
+ return;
3143
+ }
3144
+ this.panHandler?.onPointerMove(r), this.crosshairHandler?.onPointerMove(r), this.onOverlayDirty?.();
3044
3145
  }, i = () => {
3045
- this.panHandler?.onPointerUp(), this.drawingManager?.onPointerUp(), this.tradingManager?.onPointerUp(), this.crosshairHandler?.onPointerLeave(), this.onOverlayDirty?.();
3146
+ if (this.axisDragHandler?.isActive()) {
3147
+ this.axisDragHandler.end();
3148
+ return;
3149
+ }
3150
+ if (this.measuring && this.measureHandlers) {
3151
+ this.measuring = !1, this.measureHandlers.end(), this.onOverlayDirty?.();
3152
+ return;
3153
+ }
3154
+ this.tradingManager?.onPointerUp() || this.drawingManager?.onPointerUp() || this.panHandler?.onPointerUp();
3046
3155
  }, a = (e) => {
3156
+ let n = t(this.getMousePos(e));
3157
+ n && this.onAxisDoubleClick && this.onAxisDoubleClick(n);
3158
+ }, o = () => {
3159
+ this.panHandler?.onPointerUp(), this.drawingManager?.onPointerUp(), this.tradingManager?.onPointerUp(), this.crosshairHandler?.onPointerLeave(), this.onOverlayDirty?.();
3160
+ }, s = (e) => {
3047
3161
  e.preventDefault();
3048
3162
  let t = this.getMousePos(e);
3049
3163
  this.zoomHandler?.onWheel(e.deltaY, t);
3050
- }, o = (e) => {
3051
- this.drawingManager?.onKeyDown(e.key, e.ctrlKey || e.metaKey) && e.preventDefault();
3052
- }, s = (t) => {
3164
+ }, c = (e) => {
3165
+ e.key === "Escape" && this.onEscape && this.onEscape(), this.drawingManager?.onKeyDown(e.key, e.ctrlKey || e.metaKey) && e.preventDefault();
3166
+ }, l = (t) => {
3053
3167
  let n = e();
3054
3168
  !this.tradingManager || !n || this.tradingManager.onContextMenu(this.getMousePos(t), n) && t.preventDefault();
3055
- }, c = (e) => {
3169
+ }, u = (e) => {
3056
3170
  if (e.preventDefault(), this.invalidateRect(), e.touches.length === 1) {
3057
3171
  let t = this.getTouchPos(e.touches[0]);
3058
3172
  this.panHandler?.onPointerDown(t), this.crosshairHandler?.onPointerMove(t), this.touchActive = !0;
3059
3173
  } else e.touches.length === 2 && (this.panHandler?.onPointerUp(), this.lastTouchDist = this.getTouchDistance(e.touches[0], e.touches[1]), this.lastTouchMid = this.getTouchMidpoint(e.touches[0], e.touches[1]), this.touchActive = !0);
3060
- }, l = (e) => {
3174
+ }, d = (e) => {
3061
3175
  if (e.preventDefault(), e.touches.length === 1 && this.touchActive) {
3062
3176
  let t = this.getTouchPos(e.touches[0]);
3063
3177
  this.panHandler?.onPointerMove(t), this.crosshairHandler?.onPointerMove(t);
@@ -3071,14 +3185,14 @@ var ft = class {
3071
3185
  Math.abs(r) > 1 && (this.panHandler?.onPointerDown(this.lastTouchMid), this.panHandler?.onPointerMove(n)), this.lastTouchDist = t, this.lastTouchMid = n;
3072
3186
  }
3073
3187
  this.onOverlayDirty?.();
3074
- }, u = (e) => {
3188
+ }, f = (e) => {
3075
3189
  if (e.touches.length === 0) this.panHandler?.onPointerUp(), this.crosshairHandler?.onPointerLeave(), this.touchActive = !1, this.lastTouchDist = 0;
3076
3190
  else if (e.touches.length === 1) {
3077
3191
  let t = this.getTouchPos(e.touches[0]);
3078
3192
  this.panHandler?.onPointerDown(t);
3079
3193
  }
3080
- }, d = () => this.invalidateRect(), f = () => this.invalidateRect();
3081
- this.element.addEventListener("mousedown", t), this.element.addEventListener("mousemove", n), document.addEventListener("mouseup", r), this.element.addEventListener("mouseleave", i), this.element.addEventListener("wheel", a, { passive: !1 }), this.element.addEventListener("contextmenu", s), this.element.addEventListener("touchstart", c, { passive: !1 }), this.element.addEventListener("touchmove", l, { passive: !1 }), this.element.addEventListener("touchend", u), document.addEventListener("keydown", o), window.addEventListener("resize", d), this.element.addEventListener("scroll", f, { passive: !0 }), this.boundHandlers.push(() => this.element.removeEventListener("mousedown", t), () => this.element.removeEventListener("mousemove", n), () => document.removeEventListener("mouseup", r), () => this.element.removeEventListener("mouseleave", i), () => this.element.removeEventListener("wheel", a), () => this.element.removeEventListener("contextmenu", s), () => this.element.removeEventListener("touchstart", c), () => this.element.removeEventListener("touchmove", l), () => this.element.removeEventListener("touchend", u), () => document.removeEventListener("keydown", o), () => window.removeEventListener("resize", d), () => this.element.removeEventListener("scroll", f));
3194
+ }, p = () => this.invalidateRect(), m = () => this.invalidateRect();
3195
+ this.element.addEventListener("mousedown", n), this.element.addEventListener("mousemove", r), document.addEventListener("mouseup", i), this.element.addEventListener("mouseleave", o), this.element.addEventListener("dblclick", a), this.element.addEventListener("wheel", s, { passive: !1 }), this.element.addEventListener("contextmenu", l), this.element.addEventListener("touchstart", u, { passive: !1 }), this.element.addEventListener("touchmove", d, { passive: !1 }), this.element.addEventListener("touchend", f), document.addEventListener("keydown", c), window.addEventListener("resize", p), this.element.addEventListener("scroll", m, { passive: !0 }), this.boundHandlers.push(() => this.element.removeEventListener("mousedown", n), () => this.element.removeEventListener("mousemove", r), () => document.removeEventListener("mouseup", i), () => this.element.removeEventListener("mouseleave", o), () => this.element.removeEventListener("dblclick", a), () => this.element.removeEventListener("wheel", s), () => this.element.removeEventListener("contextmenu", l), () => this.element.removeEventListener("touchstart", u), () => this.element.removeEventListener("touchmove", d), () => this.element.removeEventListener("touchend", f), () => document.removeEventListener("keydown", c), () => window.removeEventListener("resize", p), () => this.element.removeEventListener("scroll", m));
3082
3196
  }
3083
3197
  detach() {
3084
3198
  for (let e of this.boundHandlers) e();
@@ -3114,7 +3228,7 @@ var ft = class {
3114
3228
  y: (e.clientY + t.clientY) / 2 - n.top
3115
3229
  };
3116
3230
  }
3117
- }, bt = class {
3231
+ }, St = class {
3118
3232
  dragging = !1;
3119
3233
  lastX = 0;
3120
3234
  lastTime = 0;
@@ -3150,7 +3264,7 @@ var ft = class {
3150
3264
  stopMomentum() {
3151
3265
  this.momentumId &&= (cancelAnimationFrame(this.momentumId), 0);
3152
3266
  }
3153
- }, xt = class {
3267
+ }, Ct = class {
3154
3268
  callback;
3155
3269
  sensitivity;
3156
3270
  pendingDelta = 0;
@@ -3169,7 +3283,47 @@ var ft = class {
3169
3283
  dispose() {
3170
3284
  this.rafId &&= (cancelAnimationFrame(this.rafId), 0);
3171
3285
  }
3172
- }, St = class {
3286
+ }, wt = class {
3287
+ dragging = !1;
3288
+ axis = null;
3289
+ startPos = {
3290
+ x: 0,
3291
+ y: 0
3292
+ };
3293
+ lastPos = {
3294
+ x: 0,
3295
+ y: 0
3296
+ };
3297
+ moved = !1;
3298
+ threshold = 3;
3299
+ sensitivity = .005;
3300
+ constructor(e, t) {
3301
+ this.onPriceScale = e, this.onTimeScale = t;
3302
+ }
3303
+ begin(e, t) {
3304
+ this.dragging = !0, this.axis = e, this.startPos = t, this.lastPos = t, this.moved = !1;
3305
+ }
3306
+ move(e) {
3307
+ if (!this.dragging || !this.axis) return !1;
3308
+ let t = e.x - this.startPos.x, n = e.y - this.startPos.y;
3309
+ if (!this.moved && Math.hypot(t, n) < this.threshold) return !1;
3310
+ if (this.moved = !0, this.axis === "price") {
3311
+ let t = e.y - this.lastPos.y, n = Math.exp(t * this.sensitivity);
3312
+ this.onPriceScale(n);
3313
+ } else {
3314
+ let t = e.x - this.lastPos.x, n = Math.exp(t * this.sensitivity);
3315
+ this.onTimeScale(n);
3316
+ }
3317
+ return this.lastPos = e, !0;
3318
+ }
3319
+ end() {
3320
+ let e = this.dragging && this.moved;
3321
+ return this.dragging = !1, this.axis = null, this.moved = !1, e;
3322
+ }
3323
+ isActive() {
3324
+ return this.dragging;
3325
+ }
3326
+ }, Tt = class {
3173
3327
  position = null;
3174
3328
  callback = null;
3175
3329
  data = [];
@@ -3216,12 +3370,42 @@ var ft = class {
3216
3370
  let { chartRect: r } = t, { x: i, y: a } = this.position;
3217
3371
  if (i < r.x || i > r.x + r.width || a < r.y || a > r.y + r.height) return;
3218
3372
  let o = E(i, t);
3219
- o = Math.max(0, Math.min(this.data.length - 1, o)), this.magnetMode && o >= 0 && o < this.data.length && (i = w(o, t)), o !== this.lastCallbackBarIndex && (this.pendingBarIndex = o, this.pendingPoint = {
3373
+ if (o = Math.max(0, Math.min(this.data.length - 1, o)), this.magnetMode && o >= 0 && o < this.data.length && (i = w(o, t)), o !== this.lastCallbackBarIndex && (this.pendingBarIndex = o, this.pendingPoint = {
3220
3374
  x: i,
3221
3375
  y: a
3222
- }, this.lastCallbackBarIndex = o, this.scheduleCallback()), e.setLineDash([4, 4]), e.strokeStyle = n.crosshair, e.lineWidth = 1, e.beginPath(), e.moveTo(Math.round(i) + .5, r.y), e.lineTo(Math.round(i) + .5, r.y + r.height), e.stroke(), e.beginPath(), e.moveTo(r.x, Math.round(a) + .5), e.lineTo(r.x + r.width, Math.round(a) + .5), e.stroke(), e.setLineDash([]);
3223
- let s = h(D(a, t), this.pricePrecision, this.locale), c = r.x + r.width + 1;
3224
- e.fillStyle = n.axisLabelBackground, e.fillRect(c, a - 10, u - 2, 20), e.fillStyle = n.axisLabel, e.font = `${n.font.sizeSmall}px ${n.font.family}`, e.textBaseline = "middle", e.textAlign = "left", e.fillText(s, c + 5, a);
3376
+ }, this.lastCallbackBarIndex = o, this.scheduleCallback()), this.magnetMode && o >= 0 && o < this.data.length) {
3377
+ let a = t.barWidth + t.barSpacing, o = a / 2;
3378
+ e.fillStyle = n.crosshair, e.globalAlpha = .08, e.fillRect(i - o, r.y, a, r.height), e.globalAlpha = 1;
3379
+ }
3380
+ e.setLineDash([4, 4]), e.strokeStyle = n.crosshair, e.lineWidth = 1, e.beginPath(), e.moveTo(Math.round(i) + .5, r.y), e.lineTo(Math.round(i) + .5, r.y + r.height), e.stroke(), e.beginPath(), e.moveTo(r.x, Math.round(a) + .5), e.lineTo(r.x + r.width, Math.round(a) + .5), e.stroke(), e.setLineDash([]);
3381
+ }
3382
+ renderAxisLabels(e, t, n, r, i) {
3383
+ if (!this.position || this.mode === "hidden") return;
3384
+ let { chartRect: a } = t, { x: o, y: s } = this.position;
3385
+ if (o < a.x || o > a.x + a.width || s < a.y || s > a.y + a.height) return;
3386
+ let c = E(o, t);
3387
+ c = Math.max(0, Math.min(r.length - 1, c)), this.magnetMode && c >= 0 && c < r.length && (o = w(c, t));
3388
+ let l = `600 ${n.font.sizeSmall}px ${n.font.family}`;
3389
+ if (Et(e, {
3390
+ text: h(D(s, t), this.pricePrecision, this.locale),
3391
+ anchorX: a.x + a.width,
3392
+ anchorY: s,
3393
+ orientation: "right",
3394
+ bg: n.text,
3395
+ fg: n.background,
3396
+ font: l
3397
+ }), c >= 0 && c < r.length) {
3398
+ let t = Dt(r[c].time), s = i ?? a.y + a.height;
3399
+ Et(e, {
3400
+ text: t,
3401
+ anchorX: o,
3402
+ anchorY: s,
3403
+ orientation: "bottom",
3404
+ bg: n.text,
3405
+ fg: n.background,
3406
+ font: l
3407
+ });
3408
+ }
3225
3409
  }
3226
3410
  scheduleCallback() {
3227
3411
  this.callbackScheduled || (this.callbackScheduled = !0, queueMicrotask(() => {
@@ -3231,7 +3415,26 @@ var ft = class {
3231
3415
  flushCallback(e, t) {
3232
3416
  this.callback?.(e, t);
3233
3417
  }
3234
- }, Ct = class {
3418
+ };
3419
+ function Et(e, t) {
3420
+ e.save(), e.font = t.font;
3421
+ let n = Math.ceil(e.measureText(t.text).width) + 16;
3422
+ if (t.orientation === "right") {
3423
+ let r = t.anchorX + 5, i = t.anchorY - 20 / 2;
3424
+ e.beginPath(), e.moveTo(t.anchorX, t.anchorY), e.lineTo(r, t.anchorY - 5), e.lineTo(r, i), e.lineTo(r + n, i), e.lineTo(r + n, i + 20), e.lineTo(r, i + 20), e.lineTo(r, t.anchorY + 5), e.closePath(), e.fillStyle = t.bg, e.fill(), e.fillStyle = t.fg, e.textBaseline = "middle", e.textAlign = "left", e.fillText(t.text, r + 8, t.anchorY);
3425
+ } else {
3426
+ let r = t.anchorX - n / 2, i = t.anchorY + 5;
3427
+ e.beginPath(), e.moveTo(t.anchorX, t.anchorY), e.lineTo(t.anchorX + 5, i), e.lineTo(r + n, i), e.lineTo(r + n, i + 20), e.lineTo(r, i + 20), e.lineTo(r, i), e.lineTo(t.anchorX - 5, i), e.closePath(), e.fillStyle = t.bg, e.fill(), e.fillStyle = t.fg, e.textBaseline = "middle", e.textAlign = "center", e.fillText(t.text, t.anchorX, i + 20 / 2);
3428
+ }
3429
+ e.restore();
3430
+ }
3431
+ function Dt(e) {
3432
+ let t = e > 0xe8d4a51000 ? e : e * 1e3, n = new Date(t), r = n.getMonth() + 1, i = n.getDate(), a = n.getHours(), o = n.getMinutes();
3433
+ return `${r}/${i} ${a < 10 ? "0" + a : a}:${o < 10 ? "0" + o : o}`;
3434
+ }
3435
+ //#endregion
3436
+ //#region src/interaction/KeyboardHandler.ts
3437
+ var Ot = class {
3235
3438
  callbacks;
3236
3439
  enabled = !0;
3237
3440
  constructor(e) {
@@ -3257,7 +3460,7 @@ var ft = class {
3257
3460
  default: return !1;
3258
3461
  }
3259
3462
  }
3260
- }, wt = class {
3463
+ }, kt = class {
3261
3464
  el = null;
3262
3465
  visible = !1;
3263
3466
  timeEl;
@@ -3296,8 +3499,8 @@ var ft = class {
3296
3499
  this.changeEl.textContent = `${l}${a(s)} (${l}${c.toFixed(2)}%)`, this.changeEl.style.color = i;
3297
3500
  let u = t.volume;
3298
3501
  this.volEl.textContent = `Vol ${u >= 1e6 ? (u / 1e6).toFixed(1) + "M" : u >= 1e3 ? (u / 1e3).toFixed(1) + "K" : u.toFixed(0)}`, this.volEl.style.color = n.textSecondary;
3299
- let d = Tt(n.background);
3300
- this.el.style.background = d ? Et(n.background, .95) : Et(n.background, .97), this.el.style.border = `1px solid ${n.axisLine}`, this.el.style.boxShadow = d ? "0 4px 12px rgba(0,0,0,0.5)" : "0 4px 12px rgba(0,0,0,0.15)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", !this.measured && this.visible && (this.measuredWidth = this.el.offsetWidth, this.measuredHeight = this.el.offsetHeight, this.measured = !0);
3502
+ let d = At(n.background);
3503
+ this.el.style.background = d ? jt(n.background, .95) : jt(n.background, .97), this.el.style.border = `1px solid ${n.axisLine}`, this.el.style.boxShadow = d ? "0 4px 12px rgba(0,0,0,0.5)" : "0 4px 12px rgba(0,0,0,0.15)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", !this.measured && this.visible && (this.measuredWidth = this.el.offsetWidth, this.measuredHeight = this.el.offsetHeight, this.measured = !0);
3301
3504
  let f = e.x + 16, p = e.y - 40;
3302
3505
  f + this.measuredWidth > r.width - 80 && (f = e.x - this.measuredWidth - 16), p < 4 && (p = 4), p + this.measuredHeight > r.height && (p = r.height - this.measuredHeight - 4), this.el.style.transform = `translate(${Math.round(f)}px, ${Math.round(p)}px)`, this.el.style.left = "0", this.el.style.top = "0", this.visible ||= (this.el.style.display = "block", !0);
3303
3506
  }
@@ -3322,7 +3525,7 @@ var ft = class {
3322
3525
  return document.createElement("span");
3323
3526
  }
3324
3527
  };
3325
- function Tt(e) {
3528
+ function At(e) {
3326
3529
  if (e.startsWith("#")) {
3327
3530
  let t = e.slice(1), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t.slice(0, 6), r = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), a = parseInt(n.slice(4, 6), 16);
3328
3531
  return (.299 * r + .587 * i + .114 * a) / 255 < .5;
@@ -3334,7 +3537,91 @@ function Tt(e) {
3334
3537
  }
3335
3538
  return !0;
3336
3539
  }
3337
- function Et(e, t) {
3540
+ function jt(e, t) {
3541
+ if (e.startsWith("#")) {
3542
+ let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
3543
+ return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
3544
+ }
3545
+ return e;
3546
+ }
3547
+ //#endregion
3548
+ //#region src/interaction/PinnedTooltip.ts
3549
+ var Mt = class {
3550
+ el = null;
3551
+ deltaEl = null;
3552
+ timeEl = null;
3553
+ ohlcEl = null;
3554
+ pinnedBar = null;
3555
+ pinnedIndex = -1;
3556
+ create(e) {
3557
+ if (this.el) return;
3558
+ this.el = document.createElement("div"), Object.assign(this.el.style, {
3559
+ position: "absolute",
3560
+ display: "none",
3561
+ padding: "6px 10px",
3562
+ borderRadius: "4px",
3563
+ fontSize: "11px",
3564
+ fontFamily: "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif",
3565
+ lineHeight: "1.5",
3566
+ pointerEvents: "auto",
3567
+ cursor: "pointer",
3568
+ zIndex: "99",
3569
+ whiteSpace: "nowrap",
3570
+ willChange: "transform"
3571
+ }), this.timeEl = document.createElement("div"), this.ohlcEl = document.createElement("div"), this.deltaEl = document.createElement("div"), this.deltaEl.style.marginTop = "4px", this.deltaEl.style.paddingTop = "4px", this.deltaEl.style.borderTop = "1px solid currentColor", this.deltaEl.style.opacity = "0.85", this.deltaEl.style.fontVariantNumeric = "tabular-nums", this.el.appendChild(this.timeEl), this.el.appendChild(this.ohlcEl), this.el.appendChild(this.deltaEl);
3572
+ let t = document.createElement("div");
3573
+ t.textContent = "📌 pinned", t.style.fontSize = "9px", t.style.opacity = "0.6", t.style.marginBottom = "2px", t.style.letterSpacing = "0.04em", t.style.textTransform = "uppercase", this.el.insertBefore(t, this.timeEl), e.appendChild(this.el);
3574
+ }
3575
+ pin(e, t, n) {
3576
+ if (!this.el || !this.timeEl || !this.ohlcEl) return;
3577
+ this.pinnedBar = e, this.pinnedIndex = t;
3578
+ let r = e.close >= e.open ? n.candleUp : n.candleDown, i = new Date(e.time > 0xe8d4a51000 ? e.time : e.time * 1e3);
3579
+ this.timeEl.textContent = `${i.getMonth() + 1}/${i.getDate()} ${Nt(i.getHours())}:${Nt(i.getMinutes())}`, this.timeEl.style.color = n.textSecondary, this.ohlcEl.innerHTML = `
3580
+ <span style="opacity:.6">O </span><span style="color:${r}">${I(e.open)}</span>
3581
+ <span style="opacity:.6"> H </span><span style="color:${r}">${I(e.high)}</span>
3582
+ <span style="opacity:.6"> L </span><span style="color:${r}">${I(e.low)}</span>
3583
+ <span style="opacity:.6"> C </span><span style="color:${r}">${I(e.close)}</span>
3584
+ `;
3585
+ let a = Pt(n.background);
3586
+ this.el.style.background = Ft(n.background, a ? .96 : .97), this.el.style.border = `1px solid ${r}`, this.el.style.boxShadow = a ? "0 4px 12px rgba(0,0,0,0.55)" : "0 4px 12px rgba(0,0,0,0.18)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", this.el.style.display = "block";
3587
+ }
3588
+ unpin() {
3589
+ this.pinnedBar = null, this.pinnedIndex = -1, this.el && (this.el.style.display = "none");
3590
+ }
3591
+ isPinned() {
3592
+ return this.pinnedBar !== null;
3593
+ }
3594
+ getPinnedIndex() {
3595
+ return this.pinnedIndex;
3596
+ }
3597
+ reposition(e, t, n, r) {
3598
+ if (!this.el || !this.pinnedBar) return;
3599
+ let i = w(this.pinnedIndex, e), a = T(this.pinnedBar.close, e), o = e.chartRect, s = i >= o.x - 4 && i <= o.x + o.width + 4;
3600
+ this.el.style.opacity = s ? "1" : "0.35";
3601
+ let c = Math.max(o.x, Math.min(o.x + o.width - 180, i + 8)), l = Math.max(o.y, Math.min(o.y + o.height - 90, a - 64));
3602
+ if (this.el.style.transform = `translate(${Math.round(c)}px, ${Math.round(l)}px)`, this.el.style.left = "0", this.el.style.top = "0", this.deltaEl) if (t && n !== null && n !== this.pinnedIndex) {
3603
+ let e = t.close - this.pinnedBar.close, i = this.pinnedBar.close === 0 ? 0 : e / this.pinnedBar.close * 100, a = e > 0 ? "+" : e < 0 ? "−" : "", o = n - this.pinnedIndex, s = e >= 0 ? r.candleUp : r.candleDown;
3604
+ this.deltaEl.style.color = s, this.deltaEl.innerHTML = `Δ ${a}${I(Math.abs(e))} <span style="opacity:.7">(${a}${Math.abs(i).toFixed(2)}%)</span> · ${o > 0 ? "+" : ""}${o} bars`, this.deltaEl.style.display = "block";
3605
+ } else this.deltaEl.style.display = "none";
3606
+ }
3607
+ destroy() {
3608
+ this.el?.remove(), this.el = null, this.deltaEl = null, this.timeEl = null, this.ohlcEl = null, this.pinnedBar = null, this.pinnedIndex = -1;
3609
+ }
3610
+ };
3611
+ function I(e) {
3612
+ return e.toFixed(2);
3613
+ }
3614
+ function Nt(e) {
3615
+ return e < 10 ? "0" + e : "" + e;
3616
+ }
3617
+ function Pt(e) {
3618
+ if (e.startsWith("#")) {
3619
+ let t = e.slice(1), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t.slice(0, 6), r = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), a = parseInt(n.slice(4, 6), 16);
3620
+ return (.299 * r + .587 * i + .114 * a) / 255 < .5;
3621
+ }
3622
+ return !0;
3623
+ }
3624
+ function Ft(e, t) {
3338
3625
  if (e.startsWith("#")) {
3339
3626
  let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
3340
3627
  return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
@@ -3343,7 +3630,7 @@ function Et(e, t) {
3343
3630
  }
3344
3631
  //#endregion
3345
3632
  //#region src/events/EventBus.ts
3346
- var Dt = class {
3633
+ var It = class {
3347
3634
  listeners = /* @__PURE__ */ new Map();
3348
3635
  tauriBridge = null;
3349
3636
  on(e, t) {
@@ -3429,7 +3716,7 @@ var Dt = class {
3429
3716
  let r = n.x - t.x, i = n.y - t.y, a = Math.hypot(r, i);
3430
3717
  return a === 0 ? Math.hypot(e.x - t.x, e.y - t.y) : Math.abs(r * (t.y - e.y) - i * (t.x - e.x)) / a;
3431
3718
  }
3432
- }, Ot = 1;
3719
+ }, Lt = 1;
3433
3720
  function R(e) {
3434
3721
  return {
3435
3722
  ...e,
@@ -3438,7 +3725,7 @@ function R(e) {
3438
3725
  meta: e.meta ? { ...e.meta } : void 0
3439
3726
  };
3440
3727
  }
3441
- var kt = class {
3728
+ var Rt = class {
3442
3729
  registry = /* @__PURE__ */ new Map();
3443
3730
  drawings = [];
3444
3731
  state = "idle";
@@ -3657,7 +3944,7 @@ var kt = class {
3657
3944
  let t = this.drawings.find((t) => t.id === e);
3658
3945
  if (!t) return null;
3659
3946
  let n = structuredClone(t);
3660
- n.id = `tc_drawing_${Ot++}`;
3947
+ n.id = `tc_drawing_${Lt++}`;
3661
3948
  let r = this.computeBarOffsetTime(3);
3662
3949
  return n.anchors = n.anchors.map((e) => ({
3663
3950
  ...e,
@@ -3708,7 +3995,7 @@ var kt = class {
3708
3995
  if (!n) return !1;
3709
3996
  let r = j(e.x, t), i = D(e.y, t), a = this.snapToOHLC(r, i, t);
3710
3997
  return this.creatingDrawing ? (this.creatingDrawing.anchors.push(a), this.committedAnchors++, this.previewAnchor = null, this.committedAnchors >= n.descriptor.requiredAnchors && this.finalizeCreation(), this.requestRender?.(), !0) : (this.creatingDrawing = {
3711
- id: `tc_drawing_${Ot++}`,
3998
+ id: `tc_drawing_${Lt++}`,
3712
3999
  type: this.activeTool,
3713
4000
  anchors: [a],
3714
4001
  style: { ...this.activeStyle },
@@ -3759,14 +4046,14 @@ var kt = class {
3759
4046
  price: D(e.y, t)
3760
4047
  }, this.requestRender?.(), !0);
3761
4048
  }
3762
- }, At = class {
4049
+ }, zt = class {
3763
4050
  constructor(e) {
3764
4051
  this.manager = e;
3765
4052
  }
3766
4053
  render(e, t) {
3767
4054
  this.manager.render(e, t);
3768
4055
  }
3769
- }, jt = class extends L {
4056
+ }, Bt = class extends L {
3770
4057
  descriptor = {
3771
4058
  type: "trendLine",
3772
4059
  name: "Trend Line",
@@ -3782,7 +4069,7 @@ var kt = class {
3782
4069
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
3783
4070
  return this.distanceToLine(e, i, a) <= r;
3784
4071
  }
3785
- }, Mt = class extends L {
4072
+ }, Vt = class extends L {
3786
4073
  descriptor = {
3787
4074
  type: "horizontalLine",
3788
4075
  name: "Horizontal Line",
@@ -3798,7 +4085,7 @@ var kt = class {
3798
4085
  let i = T(t.anchors[0].price, n);
3799
4086
  return Math.abs(e.y - i) <= r && e.x >= n.chartRect.x && e.x <= n.chartRect.x + n.chartRect.width;
3800
4087
  }
3801
- }, Nt = class extends L {
4088
+ }, Ht = class extends L {
3802
4089
  descriptor = {
3803
4090
  type: "verticalLine",
3804
4091
  name: "Vertical Line",
@@ -3814,7 +4101,7 @@ var kt = class {
3814
4101
  let i = this.anchorToPixel(t.anchors[0], n), { chartRect: a } = n;
3815
4102
  return Math.abs(e.x - i.x) <= r && e.y >= a.y && e.y <= a.y + a.height;
3816
4103
  }
3817
- }, Pt = class extends L {
4104
+ }, Ut = class extends L {
3818
4105
  descriptor = {
3819
4106
  type: "ray",
3820
4107
  name: "Ray",
@@ -3832,7 +4119,7 @@ var kt = class {
3832
4119
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = a.x - i.x, s = a.y - i.y;
3833
4120
  return ((e.x - i.x) * o + (e.y - i.y) * s) / (o * o + s * s) < 0 ? !1 : this.distanceToInfiniteLine(e, i, a) <= r;
3834
4121
  }
3835
- }, Ft = class extends L {
4122
+ }, Wt = class extends L {
3836
4123
  descriptor = {
3837
4124
  type: "extendedLine",
3838
4125
  name: "Extended Line",
@@ -3850,7 +4137,7 @@ var kt = class {
3850
4137
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
3851
4138
  return this.distanceToInfiniteLine(e, i, a) <= r;
3852
4139
  }
3853
- }, It = class extends L {
4140
+ }, Gt = class extends L {
3854
4141
  descriptor = {
3855
4142
  type: "parallelChannel",
3856
4143
  name: "Parallel Channel",
@@ -3887,7 +4174,7 @@ var kt = class {
3887
4174
  }
3888
4175
  return !1;
3889
4176
  }
3890
- }, Lt = class extends L {
4177
+ }, Kt = class extends L {
3891
4178
  descriptor = {
3892
4179
  type: "regressionChannel",
3893
4180
  name: "Regression Channel",
@@ -3918,7 +4205,7 @@ var kt = class {
3918
4205
  .618,
3919
4206
  .786,
3920
4207
  1
3921
- ], Rt = class extends L {
4208
+ ], qt = class extends L {
3922
4209
  descriptor = {
3923
4210
  type: "fibRetracement",
3924
4211
  name: "Fibonacci Retracement",
@@ -3952,7 +4239,7 @@ var kt = class {
3952
4239
  }
3953
4240
  return !1;
3954
4241
  }
3955
- }, zt = [
4242
+ }, Jt = [
3956
4243
  0,
3957
4244
  .618,
3958
4245
  1,
@@ -3961,7 +4248,7 @@ var kt = class {
3961
4248
  2.618,
3962
4249
  3.618,
3963
4250
  4.236
3964
- ], Bt = class extends L {
4251
+ ], Yt = class extends L {
3965
4252
  descriptor = {
3966
4253
  type: "fibExtension",
3967
4254
  name: "Fibonacci Extension",
@@ -3977,7 +4264,7 @@ var kt = class {
3977
4264
  }
3978
4265
  let { chartRect: i } = n, a = t.anchors[0].price, o = t.anchors[1].price, s = t.anchors[2].price, c = a - o;
3979
4266
  e.font = "11px sans-serif", e.textBaseline = "middle", e.textAlign = "left";
3980
- for (let r of zt) {
4267
+ for (let r of Jt) {
3981
4268
  let a = T(s + c * r, n);
3982
4269
  this.applyLineStyle(e, t.style), e.globalAlpha = r === 0 || r === 1 ? 1 : .6, e.beginPath(), e.moveTo(i.x, a), e.lineTo(i.x + i.width, a), e.stroke(), e.fillStyle = t.style.color, e.fillText(`${(r * 100).toFixed(1)}%`, i.x + 4, a - 2);
3983
4270
  }
@@ -3988,13 +4275,13 @@ var kt = class {
3988
4275
  let { chartRect: i } = n;
3989
4276
  if (e.x < i.x - r || e.x > i.x + i.width + r) return !1;
3990
4277
  let a = t.anchors[0].price - t.anchors[1].price;
3991
- for (let i of zt) {
4278
+ for (let i of Jt) {
3992
4279
  let o = T(t.anchors[2].price + a * i, n);
3993
4280
  if (Math.abs(e.y - o) <= r) return !0;
3994
4281
  }
3995
4282
  return !1;
3996
4283
  }
3997
- }, Vt = class extends L {
4284
+ }, Xt = class extends L {
3998
4285
  descriptor = {
3999
4286
  type: "rectangle",
4000
4287
  name: "Rectangle",
@@ -4012,7 +4299,7 @@ var kt = class {
4012
4299
  let u = Math.min(i.x, a.x) + r, d = Math.min(i.y, a.y) + r, f = Math.max(i.x, a.x) - r, p = Math.max(i.y, a.y) - r;
4013
4300
  return !(e.x > u && e.x < f && e.y > d && e.y < p) || !!t.style.fillColor;
4014
4301
  }
4015
- }, Ht = class extends L {
4302
+ }, Zt = class extends L {
4016
4303
  descriptor = {
4017
4304
  type: "ellipse",
4018
4305
  name: "Ellipse",
@@ -4028,7 +4315,7 @@ var kt = class {
4028
4315
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = (i.x + a.x) / 2, s = (i.y + a.y) / 2, c = Math.max(Math.abs(a.x - i.x) / 2, 1), l = Math.max(Math.abs(a.y - i.y) / 2, 1), u = (e.x - o) / c, d = (e.y - s) / l, f = Math.sqrt(u * u + d * d), p = r / Math.max(Math.min(c, l), 4);
4029
4316
  return t.style.fillColor ? f <= 1 + p : Math.abs(f - 1) <= p;
4030
4317
  }
4031
- }, Ut = class extends L {
4318
+ }, Qt = class extends L {
4032
4319
  descriptor = {
4033
4320
  type: "triangle",
4034
4321
  name: "Triangle",
@@ -4054,7 +4341,7 @@ var kt = class {
4054
4341
  }
4055
4342
  return !1;
4056
4343
  }
4057
- }, Wt = class extends L {
4344
+ }, $t = class extends L {
4058
4345
  descriptor = {
4059
4346
  type: "pitchfork",
4060
4347
  name: "Andrews' Pitchfork",
@@ -4090,7 +4377,7 @@ var kt = class {
4090
4377
  };
4091
4378
  return this.distanceToInfiniteLine(e, a, u) <= r || this.distanceToInfiniteLine(e, o, d) <= r;
4092
4379
  }
4093
- }, Gt = [
4380
+ }, en = [
4094
4381
  "1",
4095
4382
  "2",
4096
4383
  "3",
@@ -4099,7 +4386,7 @@ var kt = class {
4099
4386
  "A",
4100
4387
  "B",
4101
4388
  "C"
4102
- ], Kt = class extends L {
4389
+ ], tn = class extends L {
4103
4390
  descriptor = {
4104
4391
  type: "elliottWave",
4105
4392
  name: "Elliott Wave",
@@ -4111,9 +4398,9 @@ var kt = class {
4111
4398
  this.applyLineStyle(e, t.style), e.beginPath(), e.moveTo(i[0].x, i[0].y);
4112
4399
  for (let t = 1; t < i.length; t++) e.lineTo(i[t].x, i[t].y);
4113
4400
  e.stroke(), this.resetLineStyle(e), e.font = "bold 12px sans-serif", e.fillStyle = t.style.color, e.textAlign = "center";
4114
- for (let t = 0; t < i.length && t < Gt.length; t++) {
4401
+ for (let t = 0; t < i.length && t < en.length; t++) {
4115
4402
  let n = t % 2 == 0 ? -12 : 12;
4116
- e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(Gt[t], i[t].x, i[t].y + n);
4403
+ e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(en[t], i[t].x, i[t].y + n);
4117
4404
  }
4118
4405
  r && this.renderAnchorHandles(e, t, n);
4119
4406
  }
@@ -4123,7 +4410,7 @@ var kt = class {
4123
4410
  for (let t = 0; t < i.length - 1; t++) if (this.distanceToLine(e, i[t], i[t + 1]) <= r) return !0;
4124
4411
  return !1;
4125
4412
  }
4126
- }, qt = class extends L {
4413
+ }, nn = class extends L {
4127
4414
  descriptor = {
4128
4415
  type: "priceRange",
4129
4416
  name: "Price Range",
@@ -4141,7 +4428,7 @@ var kt = class {
4141
4428
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y);
4142
4429
  return e.x >= o - r && e.x <= s + r && e.y >= c - r && e.y <= l + r;
4143
4430
  }
4144
- }, Jt = class extends L {
4431
+ }, rn = class extends L {
4145
4432
  descriptor = {
4146
4433
  type: "dateRange",
4147
4434
  name: "Date Range",
@@ -4159,7 +4446,7 @@ var kt = class {
4159
4446
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), { chartRect: o } = n, s = Math.min(i.x, a.x), c = Math.max(i.x, a.x);
4160
4447
  return e.x >= s - r && e.x <= c + r && e.y >= o.y && e.y <= o.y + o.height;
4161
4448
  }
4162
- }, Yt = class extends L {
4449
+ }, an = class extends L {
4163
4450
  descriptor = {
4164
4451
  type: "measure",
4165
4452
  name: "Measure",
@@ -4184,12 +4471,12 @@ var kt = class {
4184
4471
  };
4185
4472
  //#endregion
4186
4473
  //#region src/drawings/tools/TextAnnotation.ts
4187
- function Xt(e, t = "Text") {
4474
+ function on(e, t = "Text") {
4188
4475
  if (typeof e.style.text == "string" && e.style.text.length > 0) return e.style.text;
4189
4476
  let n = e.meta?.text;
4190
4477
  return typeof n == "string" && n.length > 0 ? n : t;
4191
4478
  }
4192
- var Zt = class extends L {
4479
+ var sn = class extends L {
4193
4480
  descriptor = {
4194
4481
  type: "text",
4195
4482
  name: "Text",
@@ -4197,7 +4484,7 @@ var Zt = class extends L {
4197
4484
  };
4198
4485
  render(e, t, n, r) {
4199
4486
  if (t.anchors.length < 1) return;
4200
- let i = this.anchorToPixel(t.anchors[0], n), a = Xt(t), o = t.style.fontSize || 14;
4487
+ let i = this.anchorToPixel(t.anchors[0], n), a = on(t), o = t.style.fontSize || 14;
4201
4488
  if (e.font = `${o}px sans-serif`, e.fillStyle = t.style.color, e.textAlign = "left", e.textBaseline = "top", r) {
4202
4489
  let n = e.measureText(a);
4203
4490
  e.strokeStyle = t.style.color, e.lineWidth = 1, e.setLineDash([3, 3]), e.strokeRect(i.x - 2, i.y - 2, n.width + 4, o + 4), e.setLineDash([]);
@@ -4209,7 +4496,7 @@ var Zt = class extends L {
4209
4496
  let i = this.anchorToPixel(t.anchors[0], n), a = t.style.fontSize || 14;
4210
4497
  return e.x >= i.x - r && e.x <= i.x + 80 + r && e.y >= i.y - r && e.y <= i.y + a + r;
4211
4498
  }
4212
- }, Qt = class extends L {
4499
+ }, cn = class extends L {
4213
4500
  descriptor = {
4214
4501
  type: "arrow",
4215
4502
  name: "Arrow",
@@ -4227,7 +4514,7 @@ var Zt = class extends L {
4227
4514
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
4228
4515
  return this.distanceToLine(e, i, a) <= r;
4229
4516
  }
4230
- }, $t = [
4517
+ }, B = [
4231
4518
  {
4232
4519
  label: "8x1",
4233
4520
  ratio: 8
@@ -4264,7 +4551,7 @@ var Zt = class extends L {
4264
4551
  label: "1x8",
4265
4552
  ratio: .125
4266
4553
  }
4267
- ], en = class extends L {
4554
+ ], ln = class extends L {
4268
4555
  descriptor = {
4269
4556
  type: "gannFan",
4270
4557
  name: "Gann Fan",
@@ -4276,7 +4563,7 @@ var Zt = class extends L {
4276
4563
  if (Math.abs(o) < 1) return;
4277
4564
  let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
4278
4565
  this.applyLineStyle(e, t.style);
4279
- for (let { label: n, ratio: r } of $t) {
4566
+ for (let { label: n, ratio: r } of B) {
4280
4567
  let a = c * r, o = d, s = i.y + a * (o - i.x);
4281
4568
  e.globalAlpha = r === 1 ? 1 : .5, e.lineWidth = r === 1 ? t.style.lineWidth : Math.max(.5, t.style.lineWidth * .7), e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(o, s), e.stroke();
4282
4569
  let f = o - l * 4, p = s;
@@ -4289,7 +4576,7 @@ var Zt = class extends L {
4289
4576
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = a.x - i.x, s = a.y - i.y;
4290
4577
  if (Math.abs(o) < 1) return !1;
4291
4578
  let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
4292
- for (let { ratio: t } of $t) {
4579
+ for (let { ratio: t } of B) {
4293
4580
  let n = c * t, a = d, o = i.y + n * (a - i.x);
4294
4581
  if (this.distanceToLine(e, i, {
4295
4582
  x: a,
@@ -4298,7 +4585,7 @@ var Zt = class extends L {
4298
4585
  }
4299
4586
  return !1;
4300
4587
  }
4301
- }, B = [
4588
+ }, V = [
4302
4589
  0,
4303
4590
  .25,
4304
4591
  .333,
@@ -4306,7 +4593,7 @@ var Zt = class extends L {
4306
4593
  .667,
4307
4594
  .75,
4308
4595
  1
4309
- ], tn = class extends L {
4596
+ ], un = class extends L {
4310
4597
  descriptor = {
4311
4598
  type: "gannBox",
4312
4599
  name: "Gann Box",
@@ -4317,18 +4604,18 @@ var Zt = class extends L {
4317
4604
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y), u = s - o, d = l - c;
4318
4605
  if (!(u < 2 || d < 2)) {
4319
4606
  this.applyLineStyle(e, t.style), e.strokeRect(o, c, u, d), e.save(), e.globalAlpha = .35;
4320
- for (let t of B) {
4607
+ for (let t of V) {
4321
4608
  if (t === 0 || t === 1) continue;
4322
4609
  let n = c + d * t;
4323
4610
  e.beginPath(), e.moveTo(o, n), e.lineTo(s, n), e.stroke();
4324
4611
  }
4325
- for (let t of B) {
4612
+ for (let t of V) {
4326
4613
  if (t === 0 || t === 1) continue;
4327
4614
  let n = o + u * t;
4328
4615
  e.beginPath(), e.moveTo(n, c), e.lineTo(n, l), e.stroke();
4329
4616
  }
4330
4617
  e.globalAlpha = .5, e.setLineDash([4, 3]), e.beginPath(), e.moveTo(o, c), e.lineTo(s, l), e.stroke(), e.beginPath(), e.moveTo(s, c), e.lineTo(o, l), e.stroke(), e.restore(), this.resetLineStyle(e), e.fillStyle = t.style.color, e.font = "8px sans-serif", e.globalAlpha = .6, e.textBaseline = "bottom", e.textAlign = "right";
4331
- for (let t of B) {
4618
+ for (let t of V) {
4332
4619
  if (t === 0 || t === 1) continue;
4333
4620
  let n = c + d * t;
4334
4621
  e.fillText(`${(t * 100).toFixed(0)}%`, o - 3, n);
@@ -4353,7 +4640,7 @@ var Zt = class extends L {
4353
4640
  y: l
4354
4641
  }) <= r;
4355
4642
  }
4356
- }, nn = class extends L {
4643
+ }, dn = class extends L {
4357
4644
  descriptor = {
4358
4645
  type: "anchoredVWAP",
4359
4646
  name: "Anchored VWAP",
@@ -4425,7 +4712,7 @@ var Zt = class extends L {
4425
4712
  }
4426
4713
  return !1;
4427
4714
  }
4428
- }, rn = class extends L {
4715
+ }, fn = class extends L {
4429
4716
  descriptor = {
4430
4717
  type: "volumeProfileRange",
4431
4718
  name: "Volume Profile (Range)",
@@ -4467,7 +4754,7 @@ var Zt = class extends L {
4467
4754
  let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x) - r, s = Math.max(i.x, a.x) + 100 + r, c = Math.min(i.y, a.y) - r, l = Math.max(i.y, a.y) + r;
4468
4755
  return e.x >= o && e.x <= s && e.y >= c && e.y <= l;
4469
4756
  }
4470
- }, an = [
4757
+ }, pn = [
4471
4758
  1,
4472
4759
  2,
4473
4760
  3,
@@ -4477,7 +4764,7 @@ var Zt = class extends L {
4477
4764
  21,
4478
4765
  34,
4479
4766
  55
4480
- ], on = class extends L {
4767
+ ], mn = class extends L {
4481
4768
  descriptor = {
4482
4769
  type: "fibTimeZones",
4483
4770
  name: "Fibonacci Time Zones",
@@ -4489,7 +4776,7 @@ var Zt = class extends L {
4489
4776
  if (a === 0) return;
4490
4777
  let { chartRect: o } = n;
4491
4778
  e.font = "11px sans-serif", e.textBaseline = "top", e.textAlign = "center", this.applyLineStyle(e, t.style);
4492
- for (let r of an) {
4779
+ for (let r of pn) {
4493
4780
  let s = A(i.time + a * r, n);
4494
4781
  s < o.x || s > o.x + o.width || (e.globalAlpha = r === 1 ? 1 : .55, e.beginPath(), e.moveTo(s, o.y), e.lineTo(s, o.y + o.height), e.stroke(), e.fillStyle = t.style.color, e.fillText(String(r), s, o.y + 2));
4495
4782
  }
@@ -4501,7 +4788,7 @@ var Zt = class extends L {
4501
4788
  if (a === 0) return !1;
4502
4789
  let { chartRect: o } = n;
4503
4790
  if (e.y < o.y || e.y > o.y + o.height) return !1;
4504
- for (let t of an) {
4791
+ for (let t of pn) {
4505
4792
  let o = A(i.time + a * t, n);
4506
4793
  if (Math.abs(e.x - o) <= r) return !0;
4507
4794
  }
@@ -4510,12 +4797,12 @@ var Zt = class extends L {
4510
4797
  };
4511
4798
  //#endregion
4512
4799
  //#region src/drawings/tools/index.ts
4513
- function sn(e) {
4514
- e.register(new jt()), e.register(new Mt()), e.register(new Nt()), e.register(new Pt()), e.register(new Ft()), e.register(new It()), e.register(new Lt()), e.register(new Rt()), e.register(new Bt()), e.register(new Vt()), e.register(new Ht()), e.register(new Ut()), e.register(new Wt()), e.register(new Kt()), e.register(new qt()), e.register(new Jt()), e.register(new Yt()), e.register(new Zt()), e.register(new Qt()), e.register(new en()), e.register(new tn()), e.register(new nn()), e.register(new rn()), e.register(new on());
4800
+ function hn(e) {
4801
+ e.register(new Bt()), e.register(new Vt()), e.register(new Ht()), e.register(new Ut()), e.register(new Wt()), e.register(new Gt()), e.register(new Kt()), e.register(new qt()), e.register(new Yt()), e.register(new Xt()), e.register(new Zt()), e.register(new Qt()), e.register(new $t()), e.register(new tn()), e.register(new nn()), e.register(new rn()), e.register(new an()), e.register(new sn()), e.register(new cn()), e.register(new ln()), e.register(new un()), e.register(new dn()), e.register(new fn()), e.register(new mn());
4515
4802
  }
4516
4803
  //#endregion
4517
4804
  //#region src/trading/OrderRenderer.ts
4518
- var cn = class {
4805
+ var gn = class {
4519
4806
  render(e, t, n, r, i, a) {
4520
4807
  let o = i.orderColors?.buy ?? "#26A69A", s = i.orderColors?.sell ?? "#EF5350", { chartRect: c } = n;
4521
4808
  for (let i of t) {
@@ -4556,7 +4843,7 @@ var cn = class {
4556
4843
  };
4557
4844
  //#endregion
4558
4845
  //#region src/trading/positionFormat.ts
4559
- function ln(e, t, n) {
4846
+ function _n(e, t, n) {
4560
4847
  let r = Math.min(Math.max(e.closedQuantity ?? 0, 0), e.quantity), i = e.quantity - r, a = e.side === "buy" ? 1 : -1, o = (t - e.entryPrice) * i * a, s = e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * a;
4561
4848
  return {
4562
4849
  side: e.side,
@@ -4570,9 +4857,9 @@ function ln(e, t, n) {
4570
4857
  precision: n
4571
4858
  };
4572
4859
  }
4573
- var un = /\{(side|qty|closedQty|openQty|entry|price|pnl|pnlPct|pnlSign)\}/g;
4574
- function dn(e, t) {
4575
- return e.replace(un, (e, n) => {
4860
+ var vn = /\{(side|qty|closedQty|openQty|entry|price|pnl|pnlPct|pnlSign)\}/g;
4861
+ function yn(e, t) {
4862
+ return e.replace(vn, (e, n) => {
4576
4863
  switch (n) {
4577
4864
  case "side": return t.side.toUpperCase();
4578
4865
  case "qty": return String(t.quantity);
@@ -4587,10 +4874,10 @@ function dn(e, t) {
4587
4874
  }
4588
4875
  });
4589
4876
  }
4590
- function fn(e, t) {
4591
- return typeof e == "function" ? e(t) : dn(e ?? "{side} {qty} | P&L: {pnlSign}{pnl}", t);
4877
+ function bn(e, t) {
4878
+ return typeof e == "function" ? e(t) : yn(e ?? "{side} {qty} | P&L: {pnlSign}{pnl}", t);
4592
4879
  }
4593
- function pn(e, t, n) {
4880
+ function xn(e, t, n) {
4594
4881
  if (!t || t.length === 0) return n;
4595
4882
  let r = [...t].sort((e, t) => e.pnl - t.pnl), i;
4596
4883
  for (let t of r) if (e >= t.pnl) i = t.color;
@@ -4599,20 +4886,20 @@ function pn(e, t, n) {
4599
4886
  }
4600
4887
  //#endregion
4601
4888
  //#region src/trading/PositionRenderer.ts
4602
- var mn = class {
4889
+ var Sn = class {
4603
4890
  render(e, t, n, r, i, a) {
4604
4891
  let { chartRect: o } = r, s = a.positionColors?.profit ?? "#26A69A", c = a.positionColors?.loss ?? "#EF5350", l = a.positionColors?.entry ?? "#2196F3", u = a.pricePrecision ?? 2;
4605
4892
  for (let d of t) {
4606
4893
  let t = T(d.entryPrice, r);
4607
4894
  if (e.strokeStyle = l, e.lineWidth = 1.5, e.setLineDash([]), e.beginPath(), e.moveTo(o.x, Math.round(t) + .5), e.lineTo(o.x + o.width, Math.round(t) + .5), e.stroke(), n !== null) {
4608
- let f = T(n, r), p = ln(d, n, u), m = p.pnl, h = m >= 0 ? s : c, g = pn(m, a.pnlThresholds, h);
4895
+ let f = T(n, r), p = _n(d, n, u), m = p.pnl, h = m >= 0 ? s : c, g = xn(m, a.pnlThresholds, h);
4609
4896
  e.fillStyle = g, e.globalAlpha = .08;
4610
4897
  let _ = Math.min(t, f), v = Math.abs(f - t);
4611
4898
  if (e.fillRect(o.x, _, o.width, v), e.globalAlpha = 1, p.closedQuantity > 0 && d.quantity > 0) {
4612
4899
  let t = p.closedQuantity / d.quantity;
4613
4900
  e.fillStyle = l, e.globalAlpha = .25, e.fillRect(o.x, _, Math.max(2, o.width * t * .04) + 2, v), e.globalAlpha = 1;
4614
4901
  }
4615
- let y = fn(a.positionLabel, p);
4902
+ let y = bn(a.positionLabel, p);
4616
4903
  e.font = `bold 11px ${i.font.family}`;
4617
4904
  let b = e.measureText(y).width + 12, x = o.x + 8;
4618
4905
  e.fillStyle = g, e.globalAlpha = .9, e.fillRect(x, t - 10, b, 20), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.textAlign = "left", e.fillText(y, x + 6, t);
@@ -4635,7 +4922,7 @@ var mn = class {
4635
4922
  e.fillStyle = o, e.fillRect(c, t - 9, u - 2, 18), e.fillStyle = "#FFFFFF", e.font = `11px ${r.font.family}`, e.textAlign = "left", e.textBaseline = "middle", e.fillText(i.entryPrice.toFixed(s), c + 5, t);
4636
4923
  }
4637
4924
  }
4638
- }, hn = class {
4925
+ }, Cn = class {
4639
4926
  render(e, t, n, r) {
4640
4927
  if (!r.depthOverlay?.enabled) return;
4641
4928
  let { chartRect: i } = n, a = r.depthOverlay.bidColor ?? "rgba(38,166,154,0.15)", o = r.depthOverlay.askColor ?? "rgba(239,83,80,0.15)", s = r.depthOverlay.maxWidth ?? 100, c = 0, l = [], u = 0;
@@ -4666,7 +4953,7 @@ var mn = class {
4666
4953
  e.fillRect(p - o, a - f / 2, o, f);
4667
4954
  }
4668
4955
  }
4669
- }, gn = class {
4956
+ }, wn = class {
4670
4957
  dragState = null;
4671
4958
  startY = 0;
4672
4959
  dragging = !1;
@@ -4730,7 +5017,7 @@ var mn = class {
4730
5017
  isActive() {
4731
5018
  return this.dragState !== null;
4732
5019
  }
4733
- }, _n = class {
5020
+ }, Tn = class {
4734
5021
  menuElement = null;
4735
5022
  removeHandler = null;
4736
5023
  onItemSelect = null;
@@ -4814,17 +5101,17 @@ var mn = class {
4814
5101
  destroy() {
4815
5102
  this.hide(), this.onItemSelect = null;
4816
5103
  }
4817
- }, vn = class {
5104
+ }, En = class {
4818
5105
  orders = [];
4819
5106
  positions = [];
4820
5107
  depthData = null;
4821
5108
  currentPrice = null;
4822
5109
  config;
4823
- orderRenderer = new cn();
4824
- positionRenderer = new mn();
4825
- depthOverlay = new hn();
5110
+ orderRenderer = new gn();
5111
+ positionRenderer = new Sn();
5112
+ depthOverlay = new Cn();
4826
5113
  dragHandler;
4827
- contextMenu = new _n();
5114
+ contextMenu = new Tn();
4828
5115
  requestRender = null;
4829
5116
  eventCallback = null;
4830
5117
  container = null;
@@ -4832,7 +5119,7 @@ var mn = class {
4832
5119
  this.config = {
4833
5120
  ...s,
4834
5121
  ...e
4835
- }, this.dragHandler = new gn(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
5122
+ }, this.dragHandler = new wn(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
4836
5123
  this.eventCallback?.("orderPlace", e);
4837
5124
  };
4838
5125
  }
@@ -4893,7 +5180,7 @@ var mn = class {
4893
5180
  destroy() {
4894
5181
  this.contextMenu.destroy();
4895
5182
  }
4896
- }, yn = class {
5183
+ }, Dn = class {
4897
5184
  constructor(e) {
4898
5185
  this.manager = e;
4899
5186
  }
@@ -4903,7 +5190,7 @@ var mn = class {
4903
5190
  renderAxisBadges(e, t, n) {
4904
5191
  this.manager.renderAxisBadges(e, t, n);
4905
5192
  }
4906
- }, V = class {
5193
+ }, H = class {
4907
5194
  listeners = /* @__PURE__ */ new Map();
4908
5195
  on(e, t) {
4909
5196
  let n = this.listeners.get(e);
@@ -4925,7 +5212,7 @@ var mn = class {
4925
5212
  removeAllListeners() {
4926
5213
  this.listeners.clear();
4927
5214
  }
4928
- }, bn = class extends V {
5215
+ }, On = class extends H {
4929
5216
  currentBar = null;
4930
5217
  timeframeMs;
4931
5218
  tickRing;
@@ -4987,7 +5274,7 @@ var mn = class {
4987
5274
  alignToTimeframe(e) {
4988
5275
  return Math.floor(e / this.timeframeMs) * this.timeframeMs;
4989
5276
  }
4990
- }, H = class extends V {
5277
+ }, U = class extends H {
4991
5278
  config;
4992
5279
  attempt = 0;
4993
5280
  timer = null;
@@ -5034,7 +5321,7 @@ var mn = class {
5034
5321
  let e = this.config.baseDelay, t = this.config.backoffMultiplier ** (this.attempt - 1), n = Math.min(e * t, this.config.maxDelay), r = n * .25 * (Math.random() * 2 - 1);
5035
5322
  return Math.max(0, Math.round(n + r));
5036
5323
  }
5037
- }, xn = class {
5324
+ }, kn = class {
5038
5325
  price = null;
5039
5326
  previousClose = null;
5040
5327
  visible = !0;
@@ -5065,12 +5352,12 @@ var mn = class {
5065
5352
  let f = s - 5;
5066
5353
  e.beginPath(), e.moveTo(f, r), e.lineTo(f + 5, r - 5), e.lineTo(f + 5, r + 5), e.closePath(), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.textAlign = "left", e.fillText(c, s + 5, r);
5067
5354
  }
5068
- }, Sn = class extends V {
5355
+ }, An = class extends H {
5069
5356
  config = null;
5070
5357
  adapter = null;
5071
5358
  aggregator = null;
5072
5359
  reconnector;
5073
- priceLine = new xn();
5360
+ priceLine = new kn();
5074
5361
  state = "disconnected";
5075
5362
  lastPrice = null;
5076
5363
  previousClose = null;
@@ -5078,13 +5365,13 @@ var mn = class {
5078
5365
  heartbeatTimer = null;
5079
5366
  lastMessageTime = 0;
5080
5367
  constructor() {
5081
- super(), this.reconnector = new H(), this.wireReconnector();
5368
+ super(), this.reconnector = new U(), this.wireReconnector();
5082
5369
  }
5083
5370
  async connect(e) {
5084
5371
  this.disconnect(), this.config = {
5085
5372
  ...a,
5086
5373
  ...e
5087
- }, this.adapter = e.adapter, this.aggregator = new bn(e.timeframe), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new H(e.reconnect ?? r), this.wireReconnector(), this.aggregator.on("bar", (e) => {
5374
+ }, this.adapter = e.adapter, this.aggregator = new On(e.timeframe), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new U(e.reconnect ?? r), this.wireReconnector(), this.aggregator.on("bar", (e) => {
5088
5375
  this.emit("barUpdate", e), this.updatePrice(e.close);
5089
5376
  }), this.aggregator.on("barClose", (e) => {
5090
5377
  this.previousClose = e.close, this.emit("barClose", e);
@@ -5194,7 +5481,7 @@ var mn = class {
5194
5481
  dispose() {
5195
5482
  this.disconnect(), this.removeAllListeners();
5196
5483
  }
5197
- }, Cn = class extends V {
5484
+ }, jn = class extends H {
5198
5485
  data;
5199
5486
  speed;
5200
5487
  index;
@@ -5281,11 +5568,11 @@ var mn = class {
5281
5568
  };
5282
5569
  //#endregion
5283
5570
  //#region src/realtime/adapters/binanceTypes.ts
5284
- function wn(e) {
5571
+ function Mn(e) {
5285
5572
  if (!Array.isArray(e) || e.length < 6) return null;
5286
5573
  let t = e[0];
5287
5574
  if (typeof t != "number" || !Number.isFinite(t)) return null;
5288
- let n = U(e[1]), r = U(e[2]), i = U(e[3]), a = U(e[4]), o = U(e[5]);
5575
+ let n = W(e[1]), r = W(e[2]), i = W(e[3]), a = W(e[4]), o = W(e[5]);
5289
5576
  return n === null || r === null || i === null || a === null || o === null ? null : {
5290
5577
  time: t,
5291
5578
  open: n,
@@ -5295,11 +5582,11 @@ function wn(e) {
5295
5582
  volume: o
5296
5583
  };
5297
5584
  }
5298
- function Tn(e) {
5299
- if (!En(e)) return null;
5585
+ function Nn(e) {
5586
+ if (!Pn(e)) return null;
5300
5587
  let t = e.t;
5301
5588
  if (typeof t != "number" || !Number.isFinite(t)) return null;
5302
- let n = U(e.o), r = U(e.h), i = U(e.l), a = U(e.c), o = U(e.v);
5589
+ let n = W(e.o), r = W(e.h), i = W(e.l), a = W(e.c), o = W(e.v);
5303
5590
  if (n === null || r === null || i === null || a === null || o === null) return null;
5304
5591
  let s = typeof e.x == "boolean" ? e.x : !1;
5305
5592
  return {
@@ -5314,7 +5601,7 @@ function Tn(e) {
5314
5601
  closed: s
5315
5602
  };
5316
5603
  }
5317
- function U(e) {
5604
+ function W(e) {
5318
5605
  if (typeof e == "number") return Number.isFinite(e) ? e : null;
5319
5606
  if (typeof e == "string") {
5320
5607
  let t = parseFloat(e);
@@ -5322,12 +5609,12 @@ function U(e) {
5322
5609
  }
5323
5610
  return null;
5324
5611
  }
5325
- function En(e) {
5612
+ function Pn(e) {
5326
5613
  return typeof e == "object" && !!e;
5327
5614
  }
5328
5615
  //#endregion
5329
5616
  //#region src/realtime/adapters/BinanceAdapter.ts
5330
- var Dn = {
5617
+ var Fn = {
5331
5618
  "1s": "1s",
5332
5619
  "1m": "1m",
5333
5620
  "3m": "3m",
@@ -5344,7 +5631,7 @@ var Dn = {
5344
5631
  "3d": "3d",
5345
5632
  "1w": "1w",
5346
5633
  "1M": "1M"
5347
- }, On = class {
5634
+ }, In = class {
5348
5635
  name = "binance";
5349
5636
  ws = null;
5350
5637
  state = "disconnected";
@@ -5365,13 +5652,13 @@ var Dn = {
5365
5652
  return this.state;
5366
5653
  }
5367
5654
  async fetchHistory(e, t, n = 500) {
5368
- let r = Dn[t] ?? "15m", i = `${this.restBase}/klines?symbol=${e}&interval=${r}&limit=${n}`, a = await fetch(i);
5655
+ let r = Fn[t] ?? "15m", i = `${this.restBase}/klines?symbol=${e}&interval=${r}&limit=${n}`, a = await fetch(i);
5369
5656
  if (!a.ok) throw Error(`Binance REST error: ${a.status}`);
5370
5657
  let o = await a.json();
5371
5658
  if (!Array.isArray(o)) return [];
5372
5659
  let s = [];
5373
5660
  for (let e of o) {
5374
- let t = wn(e);
5661
+ let t = Mn(e);
5375
5662
  t && s.push(t);
5376
5663
  }
5377
5664
  return s;
@@ -5388,7 +5675,7 @@ var Dn = {
5388
5675
  }
5389
5676
  connectWs() {
5390
5677
  if (!this.config) return;
5391
- let e = `${this.config.symbol.toLowerCase()}@kline_${Dn[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
5678
+ let e = `${this.config.symbol.toLowerCase()}@kline_${Fn[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
5392
5679
  this.setState("connecting");
5393
5680
  try {
5394
5681
  this.ws = new WebSocket(t);
@@ -5413,7 +5700,7 @@ var Dn = {
5413
5700
  };
5414
5701
  }
5415
5702
  handleKline(e) {
5416
- let t = Tn(e);
5703
+ let t = Nn(e);
5417
5704
  if (!t) return;
5418
5705
  let { bar: n, closed: r } = t;
5419
5706
  this.emitEvent("bar", {
@@ -5439,7 +5726,7 @@ var Dn = {
5439
5726
  for (let e of n) e(r);
5440
5727
  }
5441
5728
  }
5442
- }, kn = class {
5729
+ }, Ln = class {
5443
5730
  name = "mock";
5444
5731
  state = "disconnected";
5445
5732
  listeners = /* @__PURE__ */ new Map();
@@ -5534,7 +5821,7 @@ var Dn = {
5534
5821
  for (let e of n) e(r);
5535
5822
  }
5536
5823
  }
5537
- }, An = {
5824
+ }, Rn = {
5538
5825
  visible: !0,
5539
5826
  showSymbol: !0,
5540
5827
  showOHLC: !0,
@@ -5542,8 +5829,8 @@ var Dn = {
5542
5829
  showVolume: !0,
5543
5830
  position: "top-left",
5544
5831
  fontSize: 12
5545
- }, jn = class {
5546
- config = { ...An };
5832
+ }, zn = class {
5833
+ config = { ...Rn };
5547
5834
  symbol = "";
5548
5835
  timeframe = "";
5549
5836
  hoverBar = null;
@@ -5634,7 +5921,7 @@ var Dn = {
5634
5921
  }
5635
5922
  }
5636
5923
  }
5637
- }, Mn = class {
5924
+ }, Bn = class {
5638
5925
  static toDataURL(e, t) {
5639
5926
  let n = e.querySelectorAll("canvas");
5640
5927
  if (n.length === 0) return "";
@@ -5656,7 +5943,7 @@ var Dn = {
5656
5943
  let i = document.createElement("a");
5657
5944
  i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i);
5658
5945
  }
5659
- }, Nn = class {
5946
+ }, Vn = class {
5660
5947
  config = null;
5661
5948
  setConfig(e) {
5662
5949
  this.config = e;
@@ -5666,7 +5953,7 @@ var Dn = {
5666
5953
  let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = this.config.color ?? n.textSecondary;
5667
5954
  e.save(), e.globalAlpha = .07, e.font = `bold ${i}px ${n.font.family}`, e.fillStyle = a, e.textAlign = "center", e.textBaseline = "middle", e.fillText(this.config.text, r.x + r.width / 2, r.y + r.height / 2), e.restore();
5668
5955
  }
5669
- }, Pn = class {
5956
+ }, Hn = class {
5670
5957
  visible = !0;
5671
5958
  timeframeMs = 0;
5672
5959
  setVisible(e) {
@@ -5689,9 +5976,10 @@ var Dn = {
5689
5976
  let t = Math.ceil(e / 1e3), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
5690
5977
  return n > 0 ? `${n}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}` : `${r}:${String(i).padStart(2, "0")}`;
5691
5978
  }
5692
- }, Fn = class {
5979
+ }, Un = class {
5693
5980
  config = { visible: !1 };
5694
5981
  cachedBreaks = [];
5982
+ cachedBreaksTyped = [];
5695
5983
  lastDataLength = 0;
5696
5984
  setConfig(e) {
5697
5985
  Object.assign(this.config, e);
@@ -5702,15 +5990,39 @@ var Dn = {
5702
5990
  setVisible(e) {
5703
5991
  this.config.visible = e;
5704
5992
  }
5705
- computeBreaks(e) {
5993
+ computeBreaksTyped(e) {
5706
5994
  if (e.length < 2) return [];
5707
- if (e.length === this.lastDataLength && this.cachedBreaks.length > 0) return this.cachedBreaks;
5708
- let t = [], n = this.getDayKey(e[0].time);
5995
+ if (e.length === this.lastDataLength && this.cachedBreaksTyped.length > 0) return this.cachedBreaksTyped;
5996
+ let t = [], n = new Date(this.toMs(e[0].time));
5709
5997
  for (let r = 1; r < e.length; r++) {
5710
- let i = this.getDayKey(e[r].time);
5711
- i !== n && (t.push(r), n = i);
5998
+ let i = new Date(this.toMs(e[r].time));
5999
+ if (i.getFullYear() !== n.getFullYear()) t.push({
6000
+ idx: r,
6001
+ kind: "year",
6002
+ date: i
6003
+ });
6004
+ else if (i.getMonth() !== n.getMonth()) t.push({
6005
+ idx: r,
6006
+ kind: "month",
6007
+ date: i
6008
+ });
6009
+ else if (i.getDate() !== n.getDate()) {
6010
+ let e = i.getDay() === 1;
6011
+ t.push({
6012
+ idx: r,
6013
+ kind: e ? "week" : "day",
6014
+ date: i
6015
+ });
6016
+ }
6017
+ n = i;
5712
6018
  }
5713
- return this.lastDataLength = e.length, this.cachedBreaks = t, t;
6019
+ return this.lastDataLength = e.length, this.cachedBreaksTyped = t, this.cachedBreaks = t.map((e) => e.idx), t;
6020
+ }
6021
+ toMs(e) {
6022
+ return e > 0xe8d4a51000 ? e : e * 1e3;
6023
+ }
6024
+ computeBreaks(e) {
6025
+ return this.computeBreaksTyped(e).map((e) => e.idx);
5714
6026
  }
5715
6027
  getDayKey(e) {
5716
6028
  let t = e > 0xe8d4a51000 ? e : e * 1e3, n = new Date(t);
@@ -5718,22 +6030,53 @@ var Dn = {
5718
6030
  }
5719
6031
  render(e, t, n, r) {
5720
6032
  if (!this.config.visible || r.length < 2) return;
5721
- let i = this.computeBreaks(r);
5722
- if (i.length === 0) return;
6033
+ let i = this.computeBreaksTyped(r);
6034
+ if (i.length === 0 || qn(r) >= 1380 * 60 * 1e3) return;
5723
6035
  let { chartRect: a } = t, o = this.config.color ?? n.axisLine, s = this.config.lineWidth ?? 1, c = this.config.lineStyle ?? "dashed";
5724
- e.save(), e.strokeStyle = o, e.lineWidth = s, e.globalAlpha = .4, c === "dashed" ? e.setLineDash([6, 4]) : c === "dotted" && e.setLineDash([2, 3]), e.beginPath();
5725
- for (let n of i) {
5726
- let r = w(n, t) - (t.barWidth + t.barSpacing) / 2;
5727
- if (r < a.x - 1 || r > a.x + a.width + 1) continue;
5728
- let i = Math.round(r) + .5;
5729
- e.moveTo(i, a.y), e.lineTo(i, a.y + a.height);
6036
+ e.save(), c === "dashed" ? e.setLineDash([6, 4]) : c === "dotted" && e.setLineDash([2, 3]), e.font = `600 11px ${n.font.family}`, e.textBaseline = "top", e.textAlign = "left";
6037
+ for (let r of i) {
6038
+ let i = w(r.idx, t) - (t.barWidth + t.barSpacing) / 2;
6039
+ if (i < a.x - 1 || i > a.x + a.width + 1) continue;
6040
+ let c = Math.round(i) + .5, l = .25, u = s, d = null;
6041
+ r.kind === "day" ? l = .22 : r.kind === "week" ? (l = .34, d = Gn(r.date)) : r.kind === "month" ? (l = .5, u = s + .5, d = Kn(r.date)) : (l = .7, u = s + 1, d = String(r.date.getFullYear())), e.globalAlpha = l, e.strokeStyle = o, e.lineWidth = u, e.beginPath(), e.moveTo(c, a.y), e.lineTo(c, a.y + a.height), e.stroke(), d && (e.globalAlpha = Math.min(1, l + .35), e.fillStyle = n.textSecondary, e.fillText(d, c + 4, a.y + 4));
5730
6042
  }
5731
- e.stroke(), e.restore();
6043
+ e.restore();
5732
6044
  }
5733
6045
  invalidateCache() {
5734
- this.lastDataLength = 0, this.cachedBreaks = [];
5735
- }
5736
- }, In = 1, Ln = class extends V {
6046
+ this.lastDataLength = 0, this.cachedBreaks = [], this.cachedBreaksTyped = [];
6047
+ }
6048
+ }, Wn = [
6049
+ "Jan",
6050
+ "Feb",
6051
+ "Mar",
6052
+ "Apr",
6053
+ "May",
6054
+ "Jun",
6055
+ "Jul",
6056
+ "Aug",
6057
+ "Sep",
6058
+ "Oct",
6059
+ "Nov",
6060
+ "Dec"
6061
+ ];
6062
+ function Gn(e) {
6063
+ return `${Wn[e.getMonth()]} ${e.getDate()}`;
6064
+ }
6065
+ function Kn(e) {
6066
+ return `${Wn[e.getMonth()]} ${String(e.getFullYear()).slice(-2)}`;
6067
+ }
6068
+ function qn(e) {
6069
+ if (e.length < 2) return 0;
6070
+ let t = Math.min(50, e.length - 1), n = [];
6071
+ for (let r = 1; r <= t; r++) {
6072
+ let t = e[r - 1].time, i = e[r].time, a = t > 0xe8d4a51000 ? t : t * 1e3, o = i > 0xe8d4a51000 ? i : i * 1e3;
6073
+ n.push(o - a);
6074
+ }
6075
+ return n.sort((e, t) => e - t), n[Math.floor(n.length / 2)];
6076
+ }
6077
+ //#endregion
6078
+ //#region src/features/AlertManager.ts
6079
+ var Jn = 1, Yn = class extends H {
5737
6080
  alerts = [];
5738
6081
  lastPrice = null;
5739
6082
  requestRender = null;
@@ -5745,7 +6088,7 @@ var Dn = {
5745
6088
  this.pricePrecision = e;
5746
6089
  }
5747
6090
  addAlert(e, t = "crossing", n, r = !1) {
5748
- let i = `tc_alert_${In++}`, a = {
6091
+ let i = `tc_alert_${Jn++}`, a = {
5749
6092
  id: i,
5750
6093
  price: e,
5751
6094
  condition: t,
@@ -5825,7 +6168,7 @@ var Dn = {
5825
6168
  e.fillText(s, r.x + r.width - 4, a - 2);
5826
6169
  }
5827
6170
  }
5828
- }, Rn = class extends V {
6171
+ }, Xn = class extends H {
5829
6172
  data = [];
5830
6173
  currentIndex = 0;
5831
6174
  timer = null;
@@ -5861,7 +6204,15 @@ var Dn = {
5861
6204
  this.timer &&= (clearInterval(this.timer), null), this.state = "stopped", this.currentIndex = 0, this.emit("stateChange", "stopped");
5862
6205
  }
5863
6206
  seekTo(e) {
5864
- this.currentIndex = Math.max(0, Math.min(e, this.data.length - 1));
6207
+ if (this.data.length === 0) return;
6208
+ let t = Math.max(0, Math.min(e, this.data.length - 1));
6209
+ this.currentIndex = t;
6210
+ let n = this.data[t];
6211
+ this.emit("bar", {
6212
+ bar: n,
6213
+ index: t,
6214
+ total: this.data.length
6215
+ });
5865
6216
  }
5866
6217
  setSpeed(e) {
5867
6218
  this.config.speed = e, this.state === "playing" && (this.pause(), this.play());
@@ -5879,24 +6230,24 @@ var Dn = {
5879
6230
  dispose() {
5880
6231
  this.stop(), this.removeAllListeners(), this.data = [];
5881
6232
  }
5882
- }, W = 1;
5883
- function G(e) {
6233
+ }, G = 1;
6234
+ function K(e) {
5884
6235
  return typeof e == "object" && !!e && !Array.isArray(e);
5885
6236
  }
5886
- function K(e) {
6237
+ function q(e) {
5887
6238
  return Array.isArray(e) ? e : [];
5888
6239
  }
5889
- function zn(e, t) {
6240
+ function Zn(e, t) {
5890
6241
  return typeof e == "string" ? e : t;
5891
6242
  }
5892
- function q(e, t) {
6243
+ function J(e, t) {
5893
6244
  return typeof e == "number" && Number.isFinite(e) ? e : t;
5894
6245
  }
5895
- function Bn(e) {
5896
- if (!G(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || !G(e.style)) return null;
6246
+ function Qn(e) {
6247
+ if (!K(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || !K(e.style)) return null;
5897
6248
  let t = [];
5898
6249
  for (let n of e.anchors) {
5899
- if (!G(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
6250
+ if (!K(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
5900
6251
  t.push({
5901
6252
  time: n.time,
5902
6253
  price: n.price
@@ -5910,52 +6261,52 @@ function Bn(e) {
5910
6261
  style: n,
5911
6262
  visible: typeof e.visible == "boolean" ? e.visible : !0,
5912
6263
  locked: typeof e.locked == "boolean" ? e.locked : !1,
5913
- meta: G(e.meta) ? e.meta : void 0
6264
+ meta: K(e.meta) ? e.meta : void 0
5914
6265
  };
5915
6266
  }
5916
- function Vn(e) {
5917
- return !G(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
6267
+ function $n(e) {
6268
+ return !K(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
5918
6269
  }
5919
- function Hn(e) {
5920
- return !G(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
6270
+ function er(e) {
6271
+ return !K(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
5921
6272
  }
5922
- function Un(e) {
5923
- if (!G(e)) return Wn();
5924
- typeof e.version == "number" && e.version !== W && console.warn(`Chart state version mismatch: ${e.version} vs ${W}`);
5925
- let t = G(e.viewport) ? e.viewport : {}, n = [];
5926
- for (let t of K(e.indicators)) G(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || G(t.params) && n.push({
6273
+ function tr(e) {
6274
+ if (!K(e)) return nr();
6275
+ typeof e.version == "number" && e.version !== G && console.warn(`Chart state version mismatch: ${e.version} vs ${G}`);
6276
+ let t = K(e.viewport) ? e.viewport : {}, n = [];
6277
+ for (let t of q(e.indicators)) K(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || K(t.params) && n.push({
5927
6278
  id: t.id,
5928
6279
  instanceId: t.instanceId,
5929
6280
  params: t.params,
5930
6281
  position: typeof t.position == "string" ? t.position : void 0
5931
6282
  }));
5932
6283
  let r = [];
5933
- for (let t of K(e.drawings)) {
5934
- let e = Bn(t);
6284
+ for (let t of q(e.drawings)) {
6285
+ let e = Qn(t);
5935
6286
  e && r.push(e);
5936
6287
  }
5937
6288
  let i = [];
5938
- for (let t of K(e.orders)) {
5939
- let e = Vn(t);
6289
+ for (let t of q(e.orders)) {
6290
+ let e = $n(t);
5940
6291
  e && i.push(e);
5941
6292
  }
5942
6293
  let a = [];
5943
- for (let t of K(e.positions)) {
5944
- let e = Hn(t);
6294
+ for (let t of q(e.positions)) {
6295
+ let e = er(t);
5945
6296
  e && a.push(e);
5946
6297
  }
5947
6298
  let o = [];
5948
- for (let t of K(e.alerts)) G(t) && typeof t.id == "string" && o.push(t);
6299
+ for (let t of q(e.alerts)) K(t) && typeof t.id == "string" && o.push(t);
5949
6300
  return {
5950
- version: typeof e.version == "number" ? e.version : W,
5951
- timestamp: q(e.timestamp, Date.now()),
6301
+ version: typeof e.version == "number" ? e.version : G,
6302
+ timestamp: J(e.timestamp, Date.now()),
5952
6303
  symbol: typeof e.symbol == "string" ? e.symbol : void 0,
5953
6304
  timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
5954
- chartType: zn(e.chartType, "candlestick"),
6305
+ chartType: Zn(e.chartType, "candlestick"),
5955
6306
  viewport: {
5956
- barWidth: q(t.barWidth, 8),
5957
- barSpacing: q(t.barSpacing, 2),
5958
- offset: q(t.offset, 0)
6307
+ barWidth: J(t.barWidth, 8),
6308
+ barSpacing: J(t.barSpacing, 2),
6309
+ offset: J(t.offset, 0)
5959
6310
  },
5960
6311
  theme: typeof e.theme == "string" ? e.theme : void 0,
5961
6312
  locale: typeof e.locale == "string" ? e.locale : void 0,
@@ -5966,9 +6317,9 @@ function Un(e) {
5966
6317
  alerts: o
5967
6318
  };
5968
6319
  }
5969
- function Wn() {
6320
+ function nr() {
5970
6321
  return {
5971
- version: W,
6322
+ version: G,
5972
6323
  timestamp: Date.now(),
5973
6324
  chartType: "candlestick",
5974
6325
  viewport: {
@@ -5983,10 +6334,10 @@ function Wn() {
5983
6334
  alerts: []
5984
6335
  };
5985
6336
  }
5986
- var Gn = class {
6337
+ var rr = class {
5987
6338
  static capture(e, t) {
5988
6339
  return {
5989
- version: W,
6340
+ version: G,
5990
6341
  timestamp: Date.now(),
5991
6342
  chartType: t?.chartType ?? "candlestick",
5992
6343
  symbol: t?.symbol,
@@ -6008,7 +6359,7 @@ var Gn = class {
6008
6359
  return JSON.stringify(e);
6009
6360
  }
6010
6361
  static deserialize(e) {
6011
- return Un(JSON.parse(e));
6362
+ return tr(JSON.parse(e));
6012
6363
  }
6013
6364
  static saveToStorage(e, t) {
6014
6365
  localStorage.setItem(e, this.serialize(t));
@@ -6035,7 +6386,7 @@ var Gn = class {
6035
6386
  }, n.click();
6036
6387
  });
6037
6388
  }
6038
- }, Kn = class {
6389
+ }, ir = class {
6039
6390
  undoStack = [];
6040
6391
  redoStack = [];
6041
6392
  maxHistory = 50;
@@ -6071,7 +6422,7 @@ var Gn = class {
6071
6422
  redoCount: this.redoStack.length
6072
6423
  };
6073
6424
  }
6074
- }, qn = class {
6425
+ }, ar = class {
6075
6426
  static toCSV(e) {
6076
6427
  return ["Time,Open,High,Low,Close,Volume", ...e.map((e) => `${new Date(e.time).toISOString()},${e.open},${e.high},${e.low},${e.close},${e.volume}`)].join("\n");
6077
6428
  }
@@ -6089,7 +6440,7 @@ var Gn = class {
6089
6440
  let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
6090
6441
  a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
6091
6442
  }
6092
- }, Jn = 1, Yn = class extends V {
6443
+ }, or = 1, sr = class extends H {
6093
6444
  markers = [];
6094
6445
  style = { ...i };
6095
6446
  requestRender = null;
@@ -6110,7 +6461,7 @@ var Gn = class {
6110
6461
  return { ...this.style };
6111
6462
  }
6112
6463
  addMarker(e) {
6113
- let t = e.id ?? `tc_signal_${Jn++}`, n = {
6464
+ let t = e.id ?? `tc_signal_${or++}`, n = {
6114
6465
  ...e,
6115
6466
  id: t
6116
6467
  };
@@ -6164,7 +6515,7 @@ var Gn = class {
6164
6515
  renderArrow(e, t, n, r, i, a) {
6165
6516
  e.fillStyle = a, e.beginPath(), r === "long" ? (e.moveTo(t, n - i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n + i * .4), e.lineTo(t + i * .2, n + i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : r === "short" ? (e.moveTo(t, n + i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n - i * .4), e.lineTo(t + i * .2, n - i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : e.arc(t, n, i * .4, 0, Math.PI * 2), e.closePath(), e.fill();
6166
6517
  }
6167
- }, Xn = 1, Zn = class extends V {
6518
+ }, cr = 1, lr = class extends H {
6168
6519
  zones = [];
6169
6520
  style = { ...o };
6170
6521
  requestRender = null;
@@ -6189,7 +6540,7 @@ var Gn = class {
6189
6540
  return { ...this.style };
6190
6541
  }
6191
6542
  addZone(e) {
6192
- let t = e.id ?? `tc_zone_${Xn++}`, n = {
6543
+ let t = e.id ?? `tc_zone_${cr++}`, n = {
6193
6544
  ...e,
6194
6545
  id: t
6195
6546
  };
@@ -6240,7 +6591,88 @@ var Gn = class {
6240
6591
  }
6241
6592
  a.showLabel && t.label && (e.font = `9px ${i.font.family}`, e.fillStyle = b, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, f + 4, m + 3), e.globalAlpha = 1);
6242
6593
  }
6243
- }, Qn = {
6594
+ }, ur = class {
6595
+ active = !1;
6596
+ startBar = 0;
6597
+ startPrice = 0;
6598
+ endBar = 0;
6599
+ endPrice = 0;
6600
+ startTime = null;
6601
+ endTime = null;
6602
+ isActive() {
6603
+ return this.active;
6604
+ }
6605
+ begin(e, t, n) {
6606
+ let r = Math.round(E(e.x, t)), i = D(e.y, t);
6607
+ this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = dr(r, n), this.endTime = this.startTime, this.active = !0;
6608
+ }
6609
+ update(e, t, n) {
6610
+ if (!this.active) return;
6611
+ let r = Math.round(E(e.x, t));
6612
+ this.endBar = r, this.endPrice = D(e.y, t), this.endTime = dr(r, n);
6613
+ }
6614
+ end() {
6615
+ this.active = !1;
6616
+ }
6617
+ render(e, t, n) {
6618
+ if (!this.active) return;
6619
+ let r = w(this.startBar, t), i = w(this.endBar, t), a = T(this.startPrice, t), o = T(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m = _r(p, .14);
6620
+ e.save(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), mr(e, r, a, p), mr(e, i, o, p);
6621
+ let h = Math.abs(this.endBar - this.startBar), g = this.endPrice - this.startPrice, _ = this.startPrice === 0 ? 0 : g / this.startPrice * 100, v = this.startTime !== null && this.endTime !== null ? pr(Math.abs(this.endTime - this.startTime)) : null, y = [], b = g > 0 ? "+" : g < 0 ? "−" : "", x = Math.abs(g);
6622
+ y.push(`${b}${fr(x)} (${b}${Math.abs(_).toFixed(2)}%)`), y.push(`${h} bars${v ? " · " + v : ""}`), hr(e, i, o, y, p, n), e.restore();
6623
+ }
6624
+ };
6625
+ function dr(e, t) {
6626
+ if (e < 0 || e >= t.length) return null;
6627
+ let n = t[e].time;
6628
+ return n > 0xe8d4a51000 ? n : n * 1e3;
6629
+ }
6630
+ function fr(e) {
6631
+ return e >= 1e3 ? e.toFixed(2) : e >= 1 ? e.toFixed(4) : e.toPrecision(4);
6632
+ }
6633
+ function pr(e) {
6634
+ let t = e / 1e3;
6635
+ if (t < 60) return `${t.toFixed(0)}s`;
6636
+ let n = t / 60;
6637
+ if (n < 60) return `${n.toFixed(1)}m`;
6638
+ let r = n / 60;
6639
+ if (r < 24) return `${r.toFixed(1)}h`;
6640
+ let i = r / 24;
6641
+ if (i < 30) return `${i.toFixed(1)}d`;
6642
+ let a = i / 30;
6643
+ return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
6644
+ }
6645
+ function mr(e, t, n, r) {
6646
+ e.fillStyle = r, e.beginPath(), e.arc(t, n, 3.5, 0, Math.PI * 2), e.fill(), e.fillStyle = "#fff", e.beginPath(), e.arc(t, n, 1.5, 0, Math.PI * 2), e.fill();
6647
+ }
6648
+ function hr(e, t, n, r, i, a) {
6649
+ e.font = `600 11px ${a.font.family}`;
6650
+ let o = 0;
6651
+ for (let t of r) {
6652
+ let n = e.measureText(t).width;
6653
+ n > o && (o = n);
6654
+ }
6655
+ let s = Math.ceil(o) + 16, c = r.length * 14 + 12, l = t + 8, u = n + 8, d = e.canvas.clientWidth || e.canvas.width;
6656
+ l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, gr(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, gr(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
6657
+ for (let t = 0; t < r.length; t++) e.fillStyle = t === 0 ? i : a.textSecondary, e.fillText(r[t], l + 8, u + 6 + t * 14);
6658
+ }
6659
+ function gr(e, t, n, r, i, a) {
6660
+ e.beginPath(), e.moveTo(t + a, n), e.arcTo(t + r, n, t + r, n + i, a), e.arcTo(t + r, n + i, t, n + i, a), e.arcTo(t, n + i, t, n, a), e.arcTo(t, n, t + r, n, a), e.closePath();
6661
+ }
6662
+ function _r(e, t) {
6663
+ if (e.startsWith("#")) {
6664
+ let n = 0, r = 0, i = 0;
6665
+ return e.length === 4 ? (n = parseInt(e[1] + e[1], 16), r = parseInt(e[2] + e[2], 16), i = parseInt(e[3] + e[3], 16)) : e.length >= 7 && (n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16)), `rgba(${n},${r},${i},${t})`;
6666
+ }
6667
+ if (e.startsWith("rgb")) {
6668
+ let n = e.match(/[\d.]+/g);
6669
+ if (n && n.length >= 3) return `rgba(${n[0]},${n[1]},${n[2]},${t})`;
6670
+ }
6671
+ return e;
6672
+ }
6673
+ //#endregion
6674
+ //#region src/animation/Animator.ts
6675
+ var vr = {
6244
6676
  linear: (e) => e,
6245
6677
  easeOutCubic: (e) => 1 - (1 - e) ** 3,
6246
6678
  easeOutQuart: (e) => 1 - (1 - e) ** 4,
@@ -6248,7 +6680,7 @@ var Gn = class {
6248
6680
  easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
6249
6681
  easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
6250
6682
  spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
6251
- }, $n = class {
6683
+ }, yr = class {
6252
6684
  animations = /* @__PURE__ */ new Map();
6253
6685
  frameId = 0;
6254
6686
  running = !1;
@@ -6256,7 +6688,7 @@ var Gn = class {
6256
6688
  this.animations.set(e, {
6257
6689
  startTime: -1,
6258
6690
  duration: t.duration,
6259
- easing: t.easing ?? Qn.easeOutCubic,
6691
+ easing: t.easing ?? vr.easeOutCubic,
6260
6692
  onUpdate: t.onUpdate,
6261
6693
  onComplete: t.onComplete
6262
6694
  }), this.running || (this.running = !0, this.tick());
@@ -6291,10 +6723,10 @@ var Gn = class {
6291
6723
  };
6292
6724
  //#endregion
6293
6725
  //#region src/finance/BaseFinanceChart.ts
6294
- function er(t) {
6726
+ function br(t) {
6295
6727
  return !t || t === "dark" ? e : t === "light" ? c : t;
6296
6728
  }
6297
- var tr = class {
6729
+ var xr = class {
6298
6730
  canvas;
6299
6731
  ctx;
6300
6732
  container;
@@ -6305,7 +6737,7 @@ var tr = class {
6305
6737
  frameId = null;
6306
6738
  resizeObserver;
6307
6739
  constructor(e, t) {
6308
- this.container = e, this.theme = er(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
6740
+ this.container = e, this.theme = br(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
6309
6741
  this.updateSize(), this.requestRender();
6310
6742
  }), this.resizeObserver.observe(e);
6311
6743
  }
@@ -6320,12 +6752,12 @@ var tr = class {
6320
6752
  }));
6321
6753
  }
6322
6754
  setTheme(e) {
6323
- this.theme = er(e), this.requestRender();
6755
+ this.theme = br(e), this.requestRender();
6324
6756
  }
6325
6757
  destroy() {
6326
6758
  this.frameId !== null && cancelAnimationFrame(this.frameId), this.resizeObserver.disconnect(), this.canvas.remove();
6327
6759
  }
6328
- }, nr = class {
6760
+ }, Sr = class {
6329
6761
  pos = null;
6330
6762
  canvas;
6331
6763
  onUpdate;
@@ -6357,7 +6789,7 @@ var tr = class {
6357
6789
  };
6358
6790
  //#endregion
6359
6791
  //#region src/finance/SparklineRenderer.ts
6360
- function rr(e, t, n, r, i) {
6792
+ function Cr(e, t, n, r, i) {
6361
6793
  let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
6362
6794
  if (a.length < 2 || t <= 0 || n <= 0) return;
6363
6795
  let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
@@ -6382,8 +6814,8 @@ function rr(e, t, n, r, i) {
6382
6814
  }
6383
6815
  //#endregion
6384
6816
  //#region src/finance/DepthChartRenderer.ts
6385
- var ir = 50, ar = 60, J = 20, or = .2;
6386
- function sr(e) {
6817
+ var wr = 50, Tr = 60, Y = 20, Er = .2;
6818
+ function Dr(e) {
6387
6819
  let t = [...e].sort((e, t) => t.price - e.price), n = [], r = 0;
6388
6820
  for (let e of t) r += e.volume, n.push({
6389
6821
  price: e.price,
@@ -6391,7 +6823,7 @@ function sr(e) {
6391
6823
  });
6392
6824
  return n;
6393
6825
  }
6394
- function cr(e) {
6826
+ function Or(e) {
6395
6827
  let t = [...e].sort((e, t) => e.price - t.price), n = [], r = 0;
6396
6828
  for (let e of t) r += e.volume, n.push({
6397
6829
  price: e.price,
@@ -6399,20 +6831,20 @@ function cr(e) {
6399
6831
  });
6400
6832
  return n;
6401
6833
  }
6402
- function lr(e, t) {
6834
+ function kr(e, t) {
6403
6835
  return {
6404
- left: ir,
6405
- right: e - ar,
6406
- top: J,
6407
- bottom: t - J,
6408
- plotWidth: e - ir - ar,
6409
- plotHeight: t - J * 2
6836
+ left: wr,
6837
+ right: e - Tr,
6838
+ top: Y,
6839
+ bottom: t - Y,
6840
+ plotWidth: e - wr - Tr,
6841
+ plotHeight: t - Y * 2
6410
6842
  };
6411
6843
  }
6412
- function ur(e, t, n, r) {
6844
+ function Ar(e, t, n, r) {
6413
6845
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6414
6846
  }
6415
- function dr(e, t, n, r, i, a, o, s) {
6847
+ function jr(e, t, n, r, i, a, o, s) {
6416
6848
  let { left: c, right: l, top: u, bottom: d, plotWidth: f, plotHeight: p } = t;
6417
6849
  e.save(), e.strokeStyle = a.grid, e.lineWidth = .5, e.fillStyle = a.axisLabel, e.font = `${a.font.sizeSmall}px ${a.font.family}`;
6418
6850
  let h = m(0, i, 5);
@@ -6427,7 +6859,7 @@ function dr(e, t, n, r, i, a, o, s) {
6427
6859
  }
6428
6860
  e.restore();
6429
6861
  }
6430
- function fr(e, t, n, r, i, a, o, s, c) {
6862
+ function Mr(e, t, n, r, i, a, o, s, c) {
6431
6863
  if (t.length === 0) return;
6432
6864
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - e / a * f;
6433
6865
  if (e.beginPath(), c === "bid") {
@@ -6460,14 +6892,14 @@ function fr(e, t, n, r, i, a, o, s, c) {
6460
6892
  }
6461
6893
  e.strokeStyle = s, e.lineWidth = 1.5, e.stroke();
6462
6894
  }
6463
- function pr(e, t, n, r, i, a, o, s, c) {
6895
+ function Nr(e, t, n, r, i, a, o, s, c) {
6464
6896
  let { left: l, top: u, bottom: d, plotWidth: f } = r, p = l + (t - i) / a * f;
6465
6897
  if (e.save(), e.strokeStyle = o.textSecondary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(p, u), e.lineTo(p, d), e.stroke(), e.restore(), s) {
6466
6898
  let t = `Spread: ${c(n)}`;
6467
6899
  e.save(), e.font = `${o.font.sizeSmall}px ${o.font.family}`, e.fillStyle = o.textSecondary, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t, p, u - 2), e.restore();
6468
6900
  }
6469
6901
  }
6470
- function mr(e, t, n, r, i, a, o, s, c, l, u) {
6902
+ function Pr(e, t, n, r, i, a, o, s, c, l, u) {
6471
6903
  let { left: d, top: f, bottom: p, plotWidth: m, plotHeight: h } = i, g = t.x;
6472
6904
  if (g < d || g > i.right) return;
6473
6905
  let _ = a + (g - d) / m * o, v = 0, y = "";
@@ -6493,47 +6925,47 @@ function mr(e, t, n, r, i, a, o, s, c, l, u) {
6493
6925
  for (let t = 0; t < b.length; t++) e.fillText(b[t], C + 8, w + 6 + t * (c.font.sizeSmall + 4));
6494
6926
  e.restore();
6495
6927
  }
6496
- function hr(e) {
6928
+ function Fr(e) {
6497
6929
  return e.toFixed(2);
6498
6930
  }
6499
- function gr(e) {
6931
+ function Ir(e) {
6500
6932
  return e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(0);
6501
6933
  }
6502
- function _r(e, t, n, r, i, a) {
6934
+ function Lr(e, t, n, r, i, a) {
6503
6935
  let { data: o } = r;
6504
6936
  if (o.bids.length === 0 && o.asks.length === 0 || t <= 0 || n <= 0) return;
6505
- let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ?? hr, m = r.volumeFormat ?? gr, h = sr(o.bids), g = cr(o.asks), _ = h.length > 0 ? h[0].price : 0, v = g.length > 0 ? g[0].price : 0, y = h.length > 0 && g.length > 0 ? (_ + v) / 2 : _ || v, b = g.length > 0 && h.length > 0 ? v - _ : 0, x = h.length > 0 ? h[h.length - 1].price : y, S = g.length > 0 ? g[g.length - 1].price : y, C = Math.max(y - x, S - y) * (1 + or), w = y - C, T = y + C, E = T - w, D = h.length > 0 ? h[h.length - 1].cumulativeVolume : 0, O = g.length > 0 ? g[g.length - 1].cumulativeVolume : 0, k = Math.max(D, O) || 1, A = lr(t, n);
6506
- ur(e, t, n, i.background), dr(e, A, w, T, k, i, p, m), fr(e, h, A, w, E, k, l, s, "bid"), fr(e, g, A, w, E, k, u, c, "ask"), d && pr(e, y, b, A, w, E, i, f, p), a && mr(e, a, h, g, A, w, E, k, i, p, m);
6937
+ let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ?? Fr, m = r.volumeFormat ?? Ir, h = Dr(o.bids), g = Or(o.asks), _ = h.length > 0 ? h[0].price : 0, v = g.length > 0 ? g[0].price : 0, y = h.length > 0 && g.length > 0 ? (_ + v) / 2 : _ || v, b = g.length > 0 && h.length > 0 ? v - _ : 0, x = h.length > 0 ? h[h.length - 1].price : y, S = g.length > 0 ? g[g.length - 1].price : y, C = Math.max(y - x, S - y) * (1 + Er), w = y - C, T = y + C, E = T - w, D = h.length > 0 ? h[h.length - 1].cumulativeVolume : 0, O = g.length > 0 ? g[g.length - 1].cumulativeVolume : 0, k = Math.max(D, O) || 1, A = kr(t, n);
6938
+ Ar(e, t, n, i.background), jr(e, A, w, T, k, i, p, m), Mr(e, h, A, w, E, k, l, s, "bid"), Mr(e, g, A, w, E, k, u, c, "ask"), d && Nr(e, y, b, A, w, E, i, f, p), a && Pr(e, a, h, g, A, w, E, k, i, p, m);
6507
6939
  }
6508
6940
  //#endregion
6509
6941
  //#region src/finance/EquityCurveRenderer.ts
6510
- var vr = 70, yr = 30, br = 20, xr = 20, Sr = .05;
6511
- function Cr(e, t) {
6942
+ var Rr = 70, zr = 30, Br = 20, Vr = 20, Hr = .05;
6943
+ function Ur(e, t) {
6512
6944
  return {
6513
- left: vr,
6514
- right: e - br,
6515
- top: xr,
6516
- bottom: t - yr,
6517
- plotWidth: e - vr - br,
6518
- plotHeight: t - xr - yr
6945
+ left: Rr,
6946
+ right: e - Br,
6947
+ top: Vr,
6948
+ bottom: t - zr,
6949
+ plotWidth: e - Rr - Br,
6950
+ plotHeight: t - Vr - zr
6519
6951
  };
6520
6952
  }
6521
- function wr(e, t) {
6953
+ function Wr(e, t) {
6522
6954
  let n = Infinity, r = -Infinity;
6523
6955
  for (let t of e) t.value < n && (n = t.value), t.value > r && (r = t.value);
6524
6956
  if (t) for (let e of t) e.value < n && (n = e.value), e.value > r && (r = e.value);
6525
- let i = (r - n) * Sr;
6957
+ let i = (r - n) * Hr;
6526
6958
  return {
6527
6959
  valMin: n - i,
6528
6960
  valMax: r + i
6529
6961
  };
6530
6962
  }
6531
- function Tr(e) {
6963
+ function Gr(e) {
6532
6964
  let t = [], n = -Infinity;
6533
6965
  for (let r of e) r.value > n && (n = r.value), t.push(n);
6534
6966
  return t;
6535
6967
  }
6536
- function Er(e) {
6968
+ function Kr(e) {
6537
6969
  let t = 864e5;
6538
6970
  if (365.25 * t, e < 7 * t) {
6539
6971
  let e = new Intl.DateTimeFormat(void 0, {
@@ -6555,13 +6987,13 @@ function Er(e) {
6555
6987
  });
6556
6988
  return (e) => n.format(new Date(e));
6557
6989
  }
6558
- function Dr(e) {
6990
+ function qr(e) {
6559
6991
  return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
6560
6992
  }
6561
- function Or(e, t, n, r) {
6993
+ function Jr(e, t, n, r) {
6562
6994
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6563
6995
  }
6564
- function kr(e, t, n, r, i, a, o, s, c) {
6996
+ function Yr(e, t, n, r, i, a, o, s, c) {
6565
6997
  let { left: l, right: u, top: d, bottom: f, plotWidth: p, plotHeight: h } = t;
6566
6998
  e.save(), e.strokeStyle = o.grid, e.lineWidth = .5, e.fillStyle = o.axisLabel, e.font = `${o.font.sizeSmall}px ${o.font.family}`;
6567
6999
  let g = m(n, r, 6), _ = Math.ceil(n / g) * g;
@@ -6576,21 +7008,21 @@ function kr(e, t, n, r, i, a, o, s, c) {
6576
7008
  }
6577
7009
  e.restore();
6578
7010
  }
6579
- function Ar(e, t, n, r, i, a, o, s, c) {
7011
+ function Xr(e, t, n, r, i, a, o, s, c) {
6580
7012
  if (t.length < 2) return;
6581
7013
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - (e - a) / o * f;
6582
7014
  e.save(), e.beginPath(), e.moveTo(p(t[0].time), m(t[0].value));
6583
7015
  for (let n = 1; n < t.length; n++) e.lineTo(p(t[n].time), m(t[n].value));
6584
7016
  e.strokeStyle = s, e.lineWidth = c, e.lineJoin = "round", e.stroke(), e.restore();
6585
7017
  }
6586
- function jr(e, t, n, r, i, a, o, s) {
7018
+ function Zr(e, t, n, r, i, a, o, s) {
6587
7019
  if (t.length < 2) return;
6588
7020
  let { left: c, bottom: l, plotWidth: u, plotHeight: d } = n, f = (e) => c + (e - r) / i * u, p = (e) => l - (e - a) / o * d, m = e.createLinearGradient(0, n.top, 0, l);
6589
7021
  m.addColorStop(0, s + "40"), m.addColorStop(1, "transparent"), e.save(), e.beginPath(), e.moveTo(f(t[0].time), p(t[0].value));
6590
7022
  for (let n = 1; n < t.length; n++) e.lineTo(f(t[n].time), p(t[n].value));
6591
7023
  e.lineTo(f(t[t.length - 1].time), l), e.lineTo(f(t[0].time), l), e.closePath(), e.fillStyle = m, e.fill(), e.restore();
6592
7024
  }
6593
- function Mr(e, t, n, r, i, a, o, s, c) {
7025
+ function Qr(e, t, n, r, i, a, o, s, c) {
6594
7026
  if (t.length < 2) return;
6595
7027
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = r, p = (e) => l + (e - i) / a * d, m = (e) => u - (e - o) / s * f;
6596
7028
  e.save(), e.fillStyle = c, e.beginPath(), e.moveTo(p(t[0].time), m(n[0]));
@@ -6598,12 +7030,12 @@ function Mr(e, t, n, r, i, a, o, s, c) {
6598
7030
  for (let n = t.length - 1; n >= 0; n--) e.lineTo(p(t[n].time), m(t[n].value));
6599
7031
  e.closePath(), e.fill(), e.restore();
6600
7032
  }
6601
- function Nr(e, t, n, r, i, a, o, s, c, l) {
7033
+ function $r(e, t, n, r, i, a, o, s, c, l) {
6602
7034
  if (t.length === 0) return;
6603
7035
  let { left: u, bottom: d, plotWidth: f, plotHeight: p } = n, m = t[t.length - 1], h = u + (m.time - r) / i * f, g = d - (m.value - a) / o * p;
6604
7036
  e.save(), e.font = `${l.font.sizeSmall}px ${l.font.family}`, e.fillStyle = c, e.textAlign = "left", e.textBaseline = "middle", e.fillText(s, h + 4, g), e.restore();
6605
7037
  }
6606
- function Pr(e, t, n, r, i, a, o, s, c, l, u, d) {
7038
+ function ei(e, t, n, r, i, a, o, s, c, l, u, d) {
6607
7039
  let { left: f, top: p, bottom: m, plotWidth: h, plotHeight: g } = i, _ = t.x;
6608
7040
  if (_ < f || _ > i.right) return;
6609
7041
  e.save(), e.strokeStyle = l.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(_, p), e.lineTo(_, m), e.stroke(), e.restore();
@@ -6621,15 +7053,15 @@ function Pr(e, t, n, r, i, a, o, s, c, l, u, d) {
6621
7053
  for (let t = 0; t < S.length; t++) e.fillText(S[t], D + 8, O + 6 + t * (l.font.sizeSmall + 4));
6622
7054
  e.restore();
6623
7055
  }
6624
- function Fr(e, t, n, r, i, a) {
7056
+ function ti(e, t, n, r, i, a) {
6625
7057
  let { data: o } = r;
6626
7058
  if (o.length < 2 || t <= 0 || n <= 0) return;
6627
- let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ?? Dr, { valMin: g, valMax: _ } = wr(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? Er(x), C = Cr(t, n);
6628
- Or(e, t, n, i.background), kr(e, C, g, _, y, b, i, h, S), l && Mr(e, o, Tr(o), C, y, x, g, v, u), d && jr(e, o, C, y, x, g, v, s), Ar(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (Ar(e, f, C, y, x, g, v, p, 1), Nr(e, f, C, y, x, g, v, m, p, i)), a && Pr(e, a, o, f, C, y, x, g, v, i, S, h);
7059
+ let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ?? qr, { valMin: g, valMax: _ } = Wr(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? Kr(x), C = Ur(t, n);
7060
+ Jr(e, t, n, i.background), Yr(e, C, g, _, y, b, i, h, S), l && Qr(e, o, Gr(o), C, y, x, g, v, u), d && Zr(e, o, C, y, x, g, v, s), Xr(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (Xr(e, f, C, y, x, g, v, p, 1), $r(e, f, C, y, x, g, v, m, p, i)), a && ei(e, a, o, f, C, y, x, g, v, i, S, h);
6629
7061
  }
6630
7062
  //#endregion
6631
7063
  //#region src/finance/HeatmapLayout.ts
6632
- function Ir(e, t, n) {
7064
+ function ni(e, t, n) {
6633
7065
  if (e.length === 0) return [];
6634
7066
  let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
6635
7067
  for (let a = 0; a < r; a++) {
@@ -6646,7 +7078,7 @@ function Ir(e, t, n) {
6646
7078
  }
6647
7079
  return c;
6648
7080
  }
6649
- function Y(e, t) {
7081
+ function ri(e, t) {
6650
7082
  let n = e.reduce((e, t) => e + t, 0);
6651
7083
  if (n === 0 || t === 0) return Infinity;
6652
7084
  let r = 0;
@@ -6676,7 +7108,7 @@ function X(e, t, n, r, i, a) {
6676
7108
  }), l += s;
6677
7109
  }
6678
7110
  }
6679
- function Lr(e, t, n, r, i) {
7111
+ function ii(e, t, n, r, i) {
6680
7112
  if (e.length === 0) return;
6681
7113
  let a = n.width >= n.height, o = a ? n.height : n.width;
6682
7114
  if (e.length === 1) {
@@ -6686,7 +7118,7 @@ function Lr(e, t, n, r, i) {
6686
7118
  let s = [], c = [], l = 0;
6687
7119
  for (; l < e.length;) {
6688
7120
  let u = [...s, e[l]];
6689
- if (s.length === 0 || Y(u, o) <= Y(s, o)) s.push(e[l]), c.push(t[l]), l++;
7121
+ if (s.length === 0 || ri(u, o) <= ri(s, o)) s.push(e[l]), c.push(t[l]), l++;
6690
7122
  else {
6691
7123
  X(s, c, n, a, r, i);
6692
7124
  let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
@@ -6700,28 +7132,28 @@ function Lr(e, t, n, r, i) {
6700
7132
  y: n.y + d,
6701
7133
  width: n.width,
6702
7134
  height: n.height - d
6703
- }, Lr(e.slice(l), t.slice(l), n, r, i);
7135
+ }, ii(e.slice(l), t.slice(l), n, r, i);
6704
7136
  return;
6705
7137
  }
6706
7138
  }
6707
7139
  s.length > 0 && X(s, c, n, a, r, i);
6708
7140
  }
6709
- function Rr(e, t, n) {
7141
+ function ai(e, t, n) {
6710
7142
  if (e.length === 0) return [];
6711
7143
  let r = [...e].sort((e, t) => t.weight - e.weight), i = r.reduce((e, t) => e + Math.max(0, t.weight), 0);
6712
7144
  if (i === 0) return [];
6713
7145
  let a = t.width * t.height, o = r.map((e) => Math.max(0, e.weight) / i * a), s = r.map((e) => e.id), c = [];
6714
- return Lr(o, s, { ...t }, n, c), c;
7146
+ return ii(o, s, { ...t }, n, c), c;
6715
7147
  }
6716
7148
  //#endregion
6717
7149
  //#region src/finance/HeatmapRenderer.ts
6718
- function zr(e) {
7150
+ function oi(e) {
6719
7151
  return (e >= 0 ? "+" : "") + e.toFixed(2) + "%";
6720
7152
  }
6721
- function Br(e) {
7153
+ function si(e) {
6722
7154
  return e.label;
6723
7155
  }
6724
- function Vr(e, t) {
7156
+ function ci(e, t) {
6725
7157
  let n = t.min ?? -5, r = t.max ?? 5;
6726
7158
  if (e <= n) return t.negative;
6727
7159
  if (e >= r) return t.positive;
@@ -6736,7 +7168,7 @@ function Z(e, t, n, r, i, a) {
6736
7168
  let o = Math.min(a, r / 2, i / 2);
6737
7169
  e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.arcTo(t + r, n, t + r, n + o, o), e.lineTo(t + r, n + i - o), e.arcTo(t + r, n + i, t + r - o, n + i, o), e.lineTo(t + o, n + i), e.arcTo(t, n + i, t, n + i - o, o), e.lineTo(t, n + o), e.arcTo(t, n, t + o, n, o), e.closePath();
6738
7170
  }
6739
- function Hr(e, t, n, r, i, a, o, s, c, l, u) {
7171
+ function li(e, t, n, r, i, a, o, s, c, l, u) {
6740
7172
  if (i < 40 || a < 30) return;
6741
7173
  let d = n + i / 2, f = r + a / 2;
6742
7174
  if (e.save(), e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 2, e.fillStyle = "#FFFFFF", e.textAlign = "center", s) {
@@ -6749,7 +7181,7 @@ function Hr(e, t, n, r, i, a, o, s, c, l, u) {
6749
7181
  }
6750
7182
  e.restore();
6751
7183
  }
6752
- function Ur(e, t, n, r, i, a, o, s) {
7184
+ function ui(e, t, n, r, i, a, o, s) {
6753
7185
  let c = [o(t), s(t.value)];
6754
7186
  if (t.meta) for (let [e, n] of Object.entries(t.meta)) c.push(e + ": " + String(n));
6755
7187
  e.save(), e.font = a.font.sizeSmall + "px " + a.font.family;
@@ -6758,13 +7190,13 @@ function Ur(e, t, n, r, i, a, o, s) {
6758
7190
  for (let t = 0; t < c.length; t++) e.fillText(c[t], f + 8, p + 6 + t * u);
6759
7191
  e.restore();
6760
7192
  }
6761
- function Wr(e, t, n, r, i, a, o, s) {
7193
+ function di(e, t, n, r, i, a, o, s) {
6762
7194
  if (r.length === 0 || i.length === 0 || t <= 0 || n <= 0) return null;
6763
7195
  let c = a.colorScale ?? {
6764
7196
  negative: "#EF5350",
6765
7197
  zero: "#424242",
6766
7198
  positive: "#26A69A"
6767
- }, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ?? zr, p = a.labelFormat ?? Br, m = /* @__PURE__ */ new Map();
7199
+ }, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ?? oi, p = a.labelFormat ?? si, m = /* @__PURE__ */ new Map();
6768
7200
  for (let e of r) m.set(e.id, e);
6769
7201
  let h = null, g = null;
6770
7202
  if (s) for (let e of i) {
@@ -6785,37 +7217,37 @@ function Wr(e, t, n, r, i, a, o, s) {
6785
7217
  if (!n) continue;
6786
7218
  let { x: r, y: i, width: a, height: s } = t.rect;
6787
7219
  if (a <= 0 || s <= 0) continue;
6788
- let g = Vr(n.value, c);
6789
- Z(e, r, i, a, s, l), e.fillStyle = g, e.fill(), Hr(e, n, r, i, a, s, o, u, d, p, f), t.id === h && (Z(e, r, i, a, s, l), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
7220
+ let g = ci(n.value, c);
7221
+ Z(e, r, i, a, s, l), e.fillStyle = g, e.fill(), li(e, n, r, i, a, s, o, u, d, p, f), t.id === h && (Z(e, r, i, a, s, l), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
6790
7222
  }
6791
- return g && s && Ur(e, g.cell, s, t, n, o, p, f), g;
7223
+ return g && s && ui(e, g.cell, s, t, n, o, p, f), g;
6792
7224
  }
6793
7225
  //#endregion
6794
7226
  //#region src/finance/WaterfallRenderer.ts
6795
- var Gr = 60, Kr = 12, qr = 24, Jr = 40, Yr = .7, Xr = 1;
6796
- function Zr(e) {
7227
+ var fi = 60, pi = 12, mi = 24, hi = 40, gi = .7, _i = 1;
7228
+ function vi(e) {
6797
7229
  return e.type ? e.type : e.value > 0 ? "positive" : e.value < 0 ? "negative" : "subtotal";
6798
7230
  }
6799
- function Qr(e) {
7231
+ function yi(e) {
6800
7232
  let t = Math.abs(e);
6801
7233
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
6802
7234
  }
6803
- function $r(e, t) {
7235
+ function bi(e, t) {
6804
7236
  return {
6805
- left: Gr,
6806
- right: e - Kr,
6807
- top: qr,
6808
- bottom: t - Jr,
6809
- plotWidth: e - Gr - Kr,
6810
- plotHeight: t - qr - Jr
7237
+ left: fi,
7238
+ right: e - pi,
7239
+ top: mi,
7240
+ bottom: t - hi,
7241
+ plotWidth: e - fi - pi,
7242
+ plotHeight: t - mi - hi
6811
7243
  };
6812
7244
  }
6813
- function ei(e, t, n, r, i) {
7245
+ function xi(e, t, n, r, i) {
6814
7246
  let a = Array(e.length), o = Array(e.length), s = t.plotWidth / e.length, c = s * n, l = (s - c) / 2, { left: u, bottom: d, plotHeight: f } = t, p = 0;
6815
7247
  for (let t = 0; t < e.length; t++) {
6816
- let n = e[t], m = Zr(n), h, g;
7248
+ let n = e[t], m = vi(n), h, g;
6817
7249
  m === "total" || m === "subtotal" ? (h = 0, g = n.value, p = n.value) : (h = p, g = p + n.value, p = g);
6818
- let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y), Xr), C = u + t * s, w = C + l;
7250
+ let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y), _i), C = u + t * s, w = C + l;
6819
7251
  a[t] = {
6820
7252
  label: n.label,
6821
7253
  value: n.value,
@@ -6835,14 +7267,14 @@ function ei(e, t, n, r, i) {
6835
7267
  cumulatives: o
6836
7268
  };
6837
7269
  }
6838
- function ti(e) {
7270
+ function Si(e) {
6839
7271
  if (e.length === 0) return {
6840
7272
  valMin: 0,
6841
7273
  valMax: 1
6842
7274
  };
6843
7275
  let t = 0, n = 0, r = 0;
6844
7276
  for (let i = 0; i < e.length; i++) {
6845
- let a = e[i], o = Zr(a), s, c;
7277
+ let a = e[i], o = vi(a), s, c;
6846
7278
  o === "total" || o === "subtotal" ? (s = 0, c = a.value, r = a.value) : (s = r, c = r + a.value, r = c), s < t && (t = s), c < t && (t = c), s > n && (n = s), c > n && (n = c);
6847
7279
  }
6848
7280
  let i = (n - t || 1) * .1;
@@ -6851,10 +7283,10 @@ function ti(e) {
6851
7283
  valMax: n + i
6852
7284
  };
6853
7285
  }
6854
- function ni(e, t, n, r) {
7286
+ function Ci(e, t, n, r) {
6855
7287
  e.fillStyle = r, e.fillRect(0, 0, t, n);
6856
7288
  }
6857
- function ri(e, t, n, r, i, a) {
7289
+ function wi(e, t, n, r, i, a) {
6858
7290
  let { left: o, right: s, top: c, bottom: l, plotHeight: u } = t, d = r - n || 1;
6859
7291
  e.strokeStyle = i.grid, e.lineWidth = .5, e.fillStyle = i.axisLabel, e.font = `${i.font.sizeSmall}px ${i.font.family}`, e.textAlign = "right", e.textBaseline = "middle";
6860
7292
  let f = m(n, r, 5), p = Math.ceil(n / f) * f;
@@ -6873,7 +7305,7 @@ function ri(e, t, n, r, i, a) {
6873
7305
  e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(o, t), e.lineTo(s, t), e.stroke();
6874
7306
  }
6875
7307
  }
6876
- function ii(e, t, n) {
7308
+ function Ti(e, t, n) {
6877
7309
  let r = [
6878
7310
  "positive",
6879
7311
  "negative",
@@ -6892,7 +7324,7 @@ function ii(e, t, n) {
6892
7324
  s && (e.fillStyle = o, e.fill());
6893
7325
  }
6894
7326
  }
6895
- function ai(e, t, n, r, i, a, o) {
7327
+ function Ei(e, t, n, r, i, a, o) {
6896
7328
  if (o === "none" || t.length < 2) return;
6897
7329
  let { bottom: s, plotHeight: c } = n;
6898
7330
  e.strokeStyle = a, e.lineWidth = 1, o === "dashed" ? e.setLineDash([4, 4]) : e.setLineDash([]), e.beginPath();
@@ -6902,7 +7334,7 @@ function ai(e, t, n, r, i, a, o) {
6902
7334
  }
6903
7335
  e.stroke(), e.setLineDash([]);
6904
7336
  }
6905
- function oi(e, t, n, r, i, a) {
7337
+ function Di(e, t, n, r, i, a) {
6906
7338
  e.fillStyle = r.text, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center";
6907
7339
  for (let r = 0; r < t.length; r++) {
6908
7340
  let o = t[r], s;
@@ -6911,7 +7343,7 @@ function oi(e, t, n, r, i, a) {
6911
7343
  o.end < o.start ? (e.textBaseline = "top", e.fillText(s, c, o.rectY + o.rectH + 4)) : (e.textBaseline = "bottom", e.fillText(s, c, o.rectY - 4));
6912
7344
  }
6913
7345
  }
6914
- function si(e, t, n, r, i) {
7346
+ function Oi(e, t, n, r, i) {
6915
7347
  e.fillStyle = r.axisLabel, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "top";
6916
7348
  let a = n.bottom + 6, o = t.length > 0 ? t[0].slotW - 4 : 0, s = !1;
6917
7349
  for (let n = 0; n < t.length; n++) if (e.measureText(i(t[n].label)).width > o) {
@@ -6932,7 +7364,7 @@ function si(e, t, n, r, i) {
6932
7364
  }
6933
7365
  e.setTransform(1, 0, 0, 1, 0, 0), e.restore();
6934
7366
  }
6935
- function ci(e, t, n) {
7367
+ function ki(e, t, n) {
6936
7368
  if (t < n.left || t > n.right) return null;
6937
7369
  for (let n = 0; n < e.length; n++) {
6938
7370
  let r = e[n];
@@ -6940,7 +7372,7 @@ function ci(e, t, n) {
6940
7372
  }
6941
7373
  return null;
6942
7374
  }
6943
- function li(e, t, n, r, i, a, o, s) {
7375
+ function Ai(e, t, n, r, i, a, o, s) {
6944
7376
  let c = t[r], l = n[r], u = Math.round(c.slotX + c.slotW / 2) + .5;
6945
7377
  e.strokeStyle = o.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(u, a.top), e.lineTo(u, a.bottom), e.stroke(), e.setLineDash([]);
6946
7378
  let d = [
@@ -6959,31 +7391,31 @@ function li(e, t, n, r, i, a, o, s) {
6959
7391
  let _ = o.font.sizeSmall + 4;
6960
7392
  for (let t = 0; t < d.length; t++) e.fillText(d[t], h + 8, g + 6 + t * _);
6961
7393
  }
6962
- function ui(e, t, n, r, i, a) {
7394
+ function ji(e, t, n, r, i, a) {
6963
7395
  let { data: o } = r;
6964
7396
  if (!o || o.length === 0 || t <= 0 || n <= 0) return { hitBar: null };
6965
- let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ?? Yr, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? Qr, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = ti(o), b = y - v || 1, x = $r(t, n), { bars: S, cumulatives: C } = ei(o, x, p, v, b);
6966
- ni(e, t, n, i.background), ri(e, x, v, y, i, g), ai(e, S, x, v, b, d, f), ii(e, S, {
7397
+ let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ?? gi, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? yi, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = Si(o), b = y - v || 1, x = bi(t, n), { bars: S, cumulatives: C } = xi(o, x, p, v, b);
7398
+ Ci(e, t, n, i.background), wi(e, x, v, y, i, g), Ei(e, S, x, v, b, d, f), Ti(e, S, {
6967
7399
  positive: s,
6968
7400
  negative: c,
6969
7401
  total: l,
6970
7402
  subtotal: u
6971
- }), m && oi(e, S, C, i, g, h), si(e, S, x, i, _);
6972
- let w = a ? ci(S, a.x, x) : null;
6973
- return a && w !== null && li(e, S, C, w, a, x, i, g), { hitBar: w };
7403
+ }), m && Di(e, S, C, i, g, h), Oi(e, S, x, i, _);
7404
+ let w = a ? ki(S, a.x, x) : null;
7405
+ return a && w !== null && Ai(e, S, C, w, a, x, i, g), { hitBar: w };
6974
7406
  }
6975
7407
  //#endregion
6976
7408
  //#region src/finance/GaugeRenderer.ts
6977
- var di = Math.PI / 180, fi = 135, pi = 405, mi = .25;
6978
- function hi(e) {
7409
+ var Mi = Math.PI / 180, Ni = 135, Pi = 405, Fi = .25;
7410
+ function Ii(e) {
6979
7411
  let t = Math.abs(e);
6980
7412
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
6981
7413
  }
6982
7414
  function Q(e, t, n) {
6983
7415
  return e < t ? t : e > n ? n : e;
6984
7416
  }
6985
- function gi(e, t, n) {
6986
- let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ?? fi) * di, s = (n.endAngle ?? pi) * di, c = n.thickness ?? mi, l = e / 2, u = t / 2 + t * .05, d = Math.max(10, Math.min(e, t) / 2 - 24);
7417
+ function Li(e, t, n) {
7418
+ let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ?? Ni) * Mi, s = (n.endAngle ?? Pi) * Mi, c = n.thickness ?? Fi, l = e / 2, u = t / 2 + t * .05, d = Math.max(10, Math.min(e, t) / 2 - 24);
6987
7419
  return {
6988
7420
  cx: l,
6989
7421
  cy: u,
@@ -7001,38 +7433,38 @@ function $(e, t) {
7001
7433
  let n = Q((e - t.min) / t.range, 0, 1);
7002
7434
  return t.startAngle + t.angleRange * n;
7003
7435
  }
7004
- function _i(e, t, n, r) {
7436
+ function Ri(e, t, n, r) {
7005
7437
  e.fillStyle = r, e.fillRect(0, 0, t, n);
7006
7438
  }
7007
- function vi(e, t, n) {
7439
+ function zi(e, t, n) {
7008
7440
  e.beginPath(), e.arc(t.cx, t.cy, t.radius, t.startAngle, t.endAngle, !1), e.arc(t.cx, t.cy, t.innerRadius, t.endAngle, t.startAngle, !0), e.closePath(), e.fillStyle = n, e.fill();
7009
7441
  }
7010
- function yi(e, t, n) {
7442
+ function Bi(e, t, n) {
7011
7443
  let r = Q(n.from, t.min, t.max), i = Q(n.to, t.min, t.max);
7012
7444
  if (i <= r) return;
7013
7445
  let a = $(r, t), o = $(i, t);
7014
7446
  e.beginPath(), e.arc(t.cx, t.cy, t.radius, a, o, !1), e.arc(t.cx, t.cy, t.innerRadius, o, a, !0), e.closePath(), e.fillStyle = n.color, e.fill();
7015
7447
  }
7016
- function bi(e, t, n, r, i) {
7448
+ function Vi(e, t, n, r, i) {
7017
7449
  let a = $(n, t);
7018
7450
  a <= t.startAngle || (e.globalAlpha = i, e.beginPath(), e.arc(t.cx, t.cy, t.radius, t.startAngle, a, !1), e.arc(t.cx, t.cy, t.innerRadius, a, t.startAngle, !0), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1);
7019
7451
  }
7020
- function xi(e, t, n, r) {
7452
+ function Hi(e, t, n, r) {
7021
7453
  let i = $(n, t), a = Math.cos(i), o = Math.sin(i), s = t.radius - 2, c = t.innerRadius * .25, l = -o, u = a, d = t.cx + a * s, f = t.cy + o * s, p = t.cx + l * 4 - a * c, m = t.cy + u * 4 - o * c, h = t.cx - l * 4 - a * c, g = t.cy - u * 4 - o * c;
7022
7454
  e.beginPath(), e.moveTo(d, f), e.lineTo(p, m), e.lineTo(h, g), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.innerRadius * .12), 0, Math.PI * 2), e.fill();
7023
7455
  }
7024
- function Si(e, t, n, r, i) {
7456
+ function Ui(e, t, n, r, i) {
7025
7457
  let a = Math.round(t.innerRadius * .55), o = Math.round(i.font.sizeMedium);
7026
7458
  e.fillStyle = i.text, e.textAlign = "center", e.textBaseline = "middle", e.font = `600 ${a}px ${i.font.family}`;
7027
7459
  let s = !!r, c = s ? t.cy - o * .6 : t.cy - a * .1;
7028
7460
  e.fillText(n, t.cx, c), s && (e.fillStyle = i.textSecondary, e.font = `${o}px ${i.font.family}`, e.fillText(r, t.cx, t.cy + a * .55));
7029
7461
  }
7030
- function Ci(e, t, n, r) {
7462
+ function Wi(e, t, n, r) {
7031
7463
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`;
7032
7464
  let i = t.radius + 10, a = Math.cos(t.startAngle), o = Math.sin(t.startAngle), s = Math.cos(t.endAngle), c = Math.sin(t.endAngle), l = t.cx + a * i, u = t.cy + o * i, d = t.cx + s * i, f = t.cy + c * i;
7033
7465
  e.textBaseline = "middle", e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(n(t.min), l, u), e.textAlign = s < -.2 ? "right" : s > .2 ? "left" : "center", e.fillText(n(t.max), d, f);
7034
7466
  }
7035
- function wi(e, t, n, r) {
7467
+ function Gi(e, t, n, r) {
7036
7468
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "middle";
7037
7469
  let i = (t.radius + t.innerRadius) / 2;
7038
7470
  for (let r = 0; r < n.length; r++) {
@@ -7042,15 +7474,15 @@ function wi(e, t, n, r) {
7042
7474
  e.fillText(a.label, s, c);
7043
7475
  }
7044
7476
  }
7045
- function Ti(e, t, n, r, i, a) {
7477
+ function Ki(e, t, n, r, i, a) {
7046
7478
  if (t <= 0 || n <= 0) return;
7047
- let o = gi(t, n, r), s = r.trackColor ?? i.grid, c = r.needleColor ?? i.text, l = r.showValue !== !1, u = r.showZoneLabels === !0, d = r.valueFormat ?? hi, f = Q(a, o.min, o.max);
7048
- _i(e, t, n, i.background), vi(e, o, s);
7479
+ let o = Li(t, n, r), s = r.trackColor ?? i.grid, c = r.needleColor ?? i.text, l = r.showValue !== !1, u = r.showZoneLabels === !0, d = r.valueFormat ?? Ii, f = Q(a, o.min, o.max);
7480
+ Ri(e, t, n, i.background), zi(e, o, s);
7049
7481
  let p = r.zones;
7050
- if (p && p.length > 0) for (let t = 0; t < p.length; t++) yi(e, o, p[t]);
7051
- bi(e, o, f, c, .12), xi(e, o, f, c), l && Si(e, o, d(f), r.label, i), Ci(e, o, d, i), u && p && p.length > 0 && wi(e, o, p, i);
7482
+ if (p && p.length > 0) for (let t = 0; t < p.length; t++) Bi(e, o, p[t]);
7483
+ Vi(e, o, f, c, .12), Hi(e, o, f, c), l && Ui(e, o, d(f), r.label, i), Wi(e, o, d, i), u && p && p.length > 0 && Gi(e, o, p, i);
7052
7484
  }
7053
7485
  //#endregion
7054
- export { Ze as ADXIndicator, Xe as ATRIndicator, ct as AccumulationDistributionIndicator, Ln as AlertManager, Be as AnchoredVWAPIndicator, nn as AnchoredVWAPTool, $n as Animator, ae as AreaRenderer, nt as AroonIndicator, Qt as ArrowTool, Ke as AwesomeOscillatorIndicator, Pn as BarCountdown, oe as BarRenderer, tr as BaseFinanceChart, ce as BaselineRenderer, On as BinanceAdapter, je as BollingerBandsIndicator, et as CCIIndicator, at as CMFIndicator, re as CandlestickRenderer, b as CanvasLayer, qe as ChaikinOscillatorIndicator, jn as ChartLegend, Gn as ChartStateManager, ye as CompareRenderer, St as CrosshairHandler, wt as CrosshairTooltip, xn as CurrentPriceLine, An as DEFAULT_LEGEND_CONFIG, C as DPRManager, qn as DataExporter, Jt as DateRangeTool, hn as DepthOverlay, Le as DonchianChannelIndicator, L as DrawingBase, kt as DrawingManager, At as DrawingRenderer, Ae as EMAIndicator, Qn as Easing, Kt as ElliottWaveTool, Ht as EllipseTool, V as Emitter, pe as EquivolumeRenderer, Dt as EventBus, Ft as ExtendedLineTool, Bt as FibExtensionTool, Rt as FibRetracementTool, on as FibTimeZonesTool, nr as FinanceCrosshair, tn as GannBoxTool, en as GannFanTool, pt as GridRenderer, he as HLCAreaRenderer, se as HollowCandleRenderer, Mt as HorizontalLineTool, Ue as HullMAIndicator, Ne as IchimokuIndicator, M as IndicatorBase, Oe as IndicatorEngine, ft as IndicatorWorkerHost, yt as InteractionManager, ue as KagiRenderer, Ie as KeltnerChannelIndicator, Ct as KeyboardHandler, x as LayerManager, ie as LineRenderer, _e as LineWithMarkersRenderer, He as LinearRegressionChannelIndicator, Ye as MACDIndicator, tt as MFIIndicator, Yt as MeasureTool, kn as MockAdapter, Qe as OBVIndicator, cn as OrderRenderer, bt as PanHandler, Pe as ParabolicSARIndicator, It as ParallelChannelTool, Wt as PitchforkTool, ze as PivotPointsIndicator, de as PointAndFigureRenderer, mn as PositionRenderer, mt as PriceAxis, qt as PriceRangeTool, rt as ROCIndicator, Je as RSIIndicator, Pt as RayTool, H as ReconnectManager, Vt as RectangleTool, Lt as RegressionChannelTool, ee as RenderEngine, S as RenderLoop, le as RenkoRenderer, Cn as ReplayController, Rn as ReplayManager, ke as SMAIndicator, Mn as Screenshot, Fn as SessionBreaks, Yn as SignalMarkerManager, ot as StdDevIndicator, ge as StepLineRenderer, F as StochasticIndicator, Sn as StreamManager, Fe as SupertrendIndicator, it as TSIIndicator, Zt as TextAnnotationTool, bn as TickAggregator, vt as TimeAxis, Zn as TradeZoneManager, _n as TradingContextMenu, gn as TradingDragHandler, vn as TradingManager, yn as TradingRenderer, jt as TrendLineTool, Ut as TriangleTool, Kn as UndoRedoManager, lt as VROCIndicator, Me as VWAPIndicator, Nt as VerticalLineTool, te as Viewport, fe as VolumeCandleRenderer, st as VolumeProfileIndicator, rn as VolumeProfileRangeTool, ve as VolumeRenderer, Nn as Watermark, $e as WilliamsRIndicator, Ve as ZigZagIndicator, xt as ZoomHandler, w as barIndexToX, P as getIntParam, N as getNumberParam, ne as getVisibleData, dt as isWorkerResponse, Rr as layoutSquarifiedTreemap, Ir as layoutUniformGrid, T as priceToY, sn as registerBuiltInDrawingTools, ut as registerBuiltInIndicators, _r as renderDepthChart, Fr as renderEquityCurve, Ti as renderGauge, Wr as renderHeatmap, rr as renderSparkline, ui as renderWaterfall, k as resolveBarIndex, A as timeToX, O as timestampToBarIndex, be as toHeikinAshi, we as toKagi, Ce as toLineBreak, Te as toPointAndFigure, Ee as toRangeBars, xe as toRenko, E as xToBarIndex, j as xToTime, D as yToPrice };
7486
+ export { $e as ADXIndicator, Qe as ATRIndicator, ut as AccumulationDistributionIndicator, Yn as AlertManager, Ve as AnchoredVWAPIndicator, dn as AnchoredVWAPTool, yr as Animator, ae as AreaRenderer, it as AroonIndicator, cn as ArrowTool, qe as AwesomeOscillatorIndicator, wt as AxisDragHandler, Hn as BarCountdown, oe as BarRenderer, xr as BaseFinanceChart, ce as BaselineRenderer, In as BinanceAdapter, Me as BollingerBandsIndicator, nt as CCIIndicator, st as CMFIndicator, re as CandlestickRenderer, b as CanvasLayer, Je as ChaikinOscillatorIndicator, zn as ChartLegend, rr as ChartStateManager, be as CompareRenderer, Tt as CrosshairHandler, kt as CrosshairTooltip, kn as CurrentPriceLine, Rn as DEFAULT_LEGEND_CONFIG, C as DPRManager, ar as DataExporter, rn as DateRangeTool, Cn as DepthOverlay, Re as DonchianChannelIndicator, L as DrawingBase, Rt as DrawingManager, zt as DrawingRenderer, je as EMAIndicator, vr as Easing, tn as ElliottWaveTool, Zt as EllipseTool, H as Emitter, pe as EquivolumeRenderer, It as EventBus, Wt as ExtendedLineTool, Yt as FibExtensionTool, qt as FibRetracementTool, mn as FibTimeZonesTool, Sr as FinanceCrosshair, un as GannBoxTool, ln as GannFanTool, ht as GridRenderer, he as HLCAreaRenderer, se as HollowCandleRenderer, Vt as HorizontalLineTool, We as HullMAIndicator, Pe as IchimokuIndicator, M as IndicatorBase, ke as IndicatorEngine, mt as IndicatorWorkerHost, xt as InteractionManager, ue as KagiRenderer, Le as KeltnerChannelIndicator, Ot as KeyboardHandler, x as LayerManager, ie as LineRenderer, _e as LineWithMarkersRenderer, Ue as LinearRegressionChannelIndicator, Xe as MACDIndicator, rt as MFIIndicator, ur as MeasureOverlay, an as MeasureTool, Ln as MockAdapter, et as OBVIndicator, gn as OrderRenderer, St as PanHandler, Fe as ParabolicSARIndicator, Gt as ParallelChannelTool, Mt as PinnedTooltip, $t as PitchforkTool, Be as PivotPointsIndicator, de as PointAndFigureRenderer, Sn as PositionRenderer, gt as PriceAxis, nn as PriceRangeTool, at as ROCIndicator, Ye as RSIIndicator, Ut as RayTool, U as ReconnectManager, Xt as RectangleTool, Kt as RegressionChannelTool, ee as RenderEngine, S as RenderLoop, le as RenkoRenderer, jn as ReplayController, Xn as ReplayManager, Ae as SMAIndicator, Bn as Screenshot, Un as SessionBreaks, sr as SignalMarkerManager, ct as StdDevIndicator, ge as StepLineRenderer, Ze as StochasticIndicator, An as StreamManager, Ie as SupertrendIndicator, ot as TSIIndicator, sn as TextAnnotationTool, On as TickAggregator, bt as TimeAxis, lr as TradeZoneManager, Tn as TradingContextMenu, wn as TradingDragHandler, En as TradingManager, Dn as TradingRenderer, Bt as TrendLineTool, Qt as TriangleTool, ir as UndoRedoManager, dt as VROCIndicator, Ne as VWAPIndicator, Ht as VerticalLineTool, te as Viewport, fe as VolumeCandleRenderer, lt as VolumeProfileIndicator, fn as VolumeProfileRangeTool, ye as VolumeProfileRenderer, ve as VolumeRenderer, Vn as Watermark, tt as WilliamsRIndicator, He as ZigZagIndicator, Ct as ZoomHandler, w as barIndexToX, P as getIntParam, N as getNumberParam, ne as getVisibleData, pt as isWorkerResponse, ai as layoutSquarifiedTreemap, ni as layoutUniformGrid, T as priceToY, hn as registerBuiltInDrawingTools, ft as registerBuiltInIndicators, Lr as renderDepthChart, ti as renderEquityCurve, Ki as renderGauge, di as renderHeatmap, Cr as renderSparkline, ji as renderWaterfall, k as resolveBarIndex, A as timeToX, O as timestampToBarIndex, xe as toHeikinAshi, Te as toKagi, we as toLineBreak, Ee as toPointAndFigure, De as toRangeBars, Se as toRenko, E as xToBarIndex, j as xToTime, D as yToPrice };
7055
7487
 
7056
7488
  //# sourceMappingURL=index.js.map