@tradecanvas/core 1.23.0 → 1.24.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.
package/dist/index.js CHANGED
@@ -18401,7 +18401,8 @@ var Wm = {
18401
18401
  showChange: !0,
18402
18402
  showVolume: !0,
18403
18403
  position: "top-left",
18404
- fontSize: 12
18404
+ fontSize: 12,
18405
+ fontFamily: null
18405
18406
  }, Gm = class {
18406
18407
  config = { ...Wm };
18407
18408
  symbol = "";
@@ -18443,68 +18444,80 @@ var Wm = {
18443
18444
  }
18444
18445
  render(e, t, n, r) {
18445
18446
  if (!this.config.visible || r.length === 0) return;
18446
- let i = this.hoverBar ?? r[r.length - 1], a = r.length > 1 ? r[r.length - 2] : i, { chartRect: o } = t, s = this.config.fontSize, c = n.style?.legend.text ?? n.text, l = n.style?.legend.label ?? n.textSecondary, u = this.config.position === "top-left", d = u ? o.x + 8 : o.x + o.width - 8, f = o.y + 6;
18447
- if (e.textAlign = u ? "left" : "right", e.textBaseline = "top", this.config.showSymbol) {
18448
- e.font = `bold ${s + 2}px ${n.font.family}`, e.fillStyle = c;
18449
- let t = [this.symbol, this.timeframe].filter(Boolean).join(" · "), r = this.statusText ? `${t} ${this.statusText}` : t;
18450
- e.fillText(r, d, f), f += s + 6;
18451
- } else this.statusText && (e.font = `${s}px ${n.font.family}`, e.fillStyle = l, e.fillText(this.statusText, d, f), f += s + 4);
18447
+ let i = this.hoverBar ?? r[r.length - 1], a = r.length > 1 ? r[r.length - 2] : i, { chartRect: o } = t, s = this.config.fontSize, c = this.config.fontFamily ?? n.font.family, l = n.style?.legend.text ?? n.text, u = n.style?.legend.label ?? n.textSecondary, d = this.config.position === "top-left", f = d ? o.x + 8 : o.x + o.width - 8, p = o.y + 6;
18448
+ if (e.textAlign = d ? "left" : "right", e.textBaseline = "top", this.config.showSymbol) {
18449
+ e.font = `bold ${s + 2}px ${c}`, e.fillStyle = l;
18450
+ let t = [this.symbol, this.timeframe].filter(Boolean).join(" · "), n = this.statusText ? `${t} ${this.statusText}` : t;
18451
+ e.fillText(n, f, p), p += s + 6;
18452
+ } else this.statusText && (e.font = `${s}px ${c}`, e.fillStyle = u, e.fillText(this.statusText, f, p), p += s + 4);
18452
18453
  if (this.config.showOHLC) {
18453
- e.font = `${s}px ${n.font.family}`;
18454
- let r = i.close >= i.open, o = this.pricePrecision ?? fe(t.priceRange.min, t.priceRange.max), p = (e) => t.formatPrice?.(e) ?? A(e, o, this.locale), m = [
18454
+ e.font = `${s}px ${c}`;
18455
+ let r = i.close >= i.open, o = this.pricePrecision ?? fe(t.priceRange.min, t.priceRange.max), m = (e) => t.formatPrice?.(e) ?? A(e, o, this.locale), h = [
18455
18456
  {
18456
18457
  label: "O",
18457
- value: p(i.open),
18458
- color: c
18458
+ value: m(i.open),
18459
+ color: l
18459
18460
  },
18460
18461
  {
18461
18462
  label: "H",
18462
- value: p(i.high),
18463
- color: c
18463
+ value: m(i.high),
18464
+ color: l
18464
18465
  },
18465
18466
  {
18466
18467
  label: "L",
18467
- value: p(i.low),
18468
- color: c
18468
+ value: m(i.low),
18469
+ color: l
18469
18470
  },
18470
18471
  {
18471
18472
  label: "C",
18472
- value: p(i.close),
18473
+ value: m(i.close),
18473
18474
  color: r ? n.candleUp : n.candleDown
18474
18475
  }
18475
18476
  ];
18476
18477
  if (this.config.showChange) {
18477
18478
  let e = i.close - a.close, t = a.close === 0 ? 0 : e / a.close * 100, r = e >= 0 ? "+" : "", o = A(t, 2, this.locale);
18478
- m.push({
18479
+ h.push({
18479
18480
  label: "",
18480
- value: `${r}${p(e)} (${r}${o}%)`,
18481
+ value: `${r}${m(e)} (${r}${o}%)`,
18481
18482
  color: e >= 0 ? n.candleUp : n.candleDown
18482
18483
  });
18483
18484
  }
18484
- let h = d;
18485
- if (u) for (let t of m) t.label && (e.fillStyle = l, e.fillText(t.label, h, f), h += e.measureText(t.label + " ").width), e.fillStyle = t.color, e.fillText(t.value, h, f), h += e.measureText(t.value + " ").width;
18486
- else {
18487
- let t = m.map((e) => `${e.label} ${e.value}`).join(" ");
18488
- e.fillStyle = c, e.fillText(t, d, f);
18489
- }
18490
- f += s + 3;
18485
+ let g = e.measureText(" ").width, _ = h.map((t) => ({
18486
+ ...t,
18487
+ labelWidth: t.label ? e.measureText(t.label + " ").width : 0,
18488
+ width: Km(e, t.value)
18489
+ })), v = _.reduce((e, t) => e + t.labelWidth + t.width + g, -g), y = d ? f : f - v;
18490
+ e.textAlign = "left";
18491
+ for (let t of _) t.label && (e.fillStyle = u, e.fillText(t.label, y, p), y += t.labelWidth), e.fillStyle = t.color, e.fillText(t.value, y, p), y += t.width + g;
18492
+ e.textAlign = d ? "left" : "right", p += s + 3;
18491
18493
  }
18492
18494
  if (this.config.showVolume) {
18493
- e.font = `${s - 1}px ${n.font.family}`, e.fillStyle = l;
18495
+ e.font = `${s}px ${c}`, e.fillStyle = u;
18494
18496
  let t = i.volume >= 1e6 ? `${(i.volume / 1e6).toFixed(2)}M` : i.volume >= 1e3 ? `${(i.volume / 1e3).toFixed(2)}K` : i.volume.toFixed(0);
18495
- e.fillText(`Vol ${t}`, d, f), f += s + 2;
18497
+ e.fillText(`Vol ${t}`, f, p), p += s + 2;
18496
18498
  }
18497
18499
  if (this.indicators.length > 0) {
18498
- e.font = `${s - 1}px ${n.font.family}`;
18499
- let t = d;
18500
- for (let n of this.indicators) {
18501
- e.fillStyle = n.color;
18502
- let r = `${n.name} ${n.value}`;
18503
- e.fillText(r, t, f), t += e.measureText(r + " ").width;
18504
- }
18500
+ e.font = `${s}px ${c}`;
18501
+ let t = e.measureText(" ").width, n = this.indicators.map((t) => {
18502
+ let n = `${t.name} ${t.value}`;
18503
+ return {
18504
+ entry: n,
18505
+ color: t.color,
18506
+ width: Km(e, n)
18507
+ };
18508
+ }), r = n.reduce((e, n) => e + n.width + t, -t), i = d ? f : f - r;
18509
+ e.textAlign = "left";
18510
+ for (let { entry: r, color: a, width: o } of n) e.fillStyle = a, e.fillText(r, i, p), i += o + t;
18505
18511
  }
18506
18512
  }
18507
- }, Km = class {
18513
+ };
18514
+ function Km(e, t) {
18515
+ let n = t.replace(/\d/g, "0");
18516
+ return Math.max(e.measureText(t).width, e.measureText(n.replace(/[-−]/g, "+")).width, e.measureText(n.replace(/\+/g, "-")).width);
18517
+ }
18518
+ //#endregion
18519
+ //#region src/ui/Screenshot.ts
18520
+ var qm = class {
18508
18521
  static toDataURL(e, t) {
18509
18522
  let n = e.querySelectorAll("canvas");
18510
18523
  if (n.length === 0) return "";
@@ -18526,7 +18539,7 @@ var Wm = {
18526
18539
  let i = document.createElement("a");
18527
18540
  i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i);
18528
18541
  }
18529
- }, qm = class {
18542
+ }, Jm = class {
18530
18543
  config = null;
18531
18544
  setConfig(e) {
18532
18545
  this.config = e;
@@ -18539,7 +18552,7 @@ var Wm = {
18539
18552
  let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = n.style?.watermark.color ?? this.config.color ?? n.textSecondary;
18540
18553
  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();
18541
18554
  }
18542
- }, Jm = class {
18555
+ }, Ym = class {
18543
18556
  visible = !0;
18544
18557
  timeframeMs = 0;
18545
18558
  setVisible(e) {
@@ -18562,11 +18575,11 @@ var Wm = {
18562
18575
  let t = Math.ceil(e / 1e3), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
18563
18576
  return n > 0 ? `${n}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}` : `${r}:${String(i).padStart(2, "0")}`;
18564
18577
  }
18565
- }, Ym = {
18578
+ }, Xm = {
18566
18579
  solid: null,
18567
18580
  dashed: [6, 4],
18568
18581
  dotted: [2, 3]
18569
- }, Xm = class {
18582
+ }, Zm = class {
18570
18583
  config = { visible: !1 };
18571
18584
  cachedBreaksTyped = [];
18572
18585
  cachedMedianStep = 0;
@@ -18618,7 +18631,7 @@ var Wm = {
18618
18631
  }
18619
18632
  n = a;
18620
18633
  }
18621
- return this.lastDataLength = e.length, this.cachedBreaksTyped = t, this.cachedMedianStep = $m(e), this.cacheValid = !0, t;
18634
+ return this.lastDataLength = e.length, this.cachedBreaksTyped = t, this.cachedMedianStep = eh(e), this.cacheValid = !0, t;
18622
18635
  }
18623
18636
  toMs(e) {
18624
18637
  return e > 0xe8d4a51000 ? e : e * 1e3;
@@ -18629,7 +18642,7 @@ var Wm = {
18629
18642
  renderLines(e, t, n, r) {
18630
18643
  let i = this.marks(t, r, n);
18631
18644
  if (i.length === 0) return;
18632
- let { chartRect: a } = t, o = this.look(n), s = Ym[o.style];
18645
+ let { chartRect: a } = t, o = this.look(n), s = Xm[o.style];
18633
18646
  e.save(), s && e.setLineDash(s), e.strokeStyle = o.color;
18634
18647
  for (let t of i) e.globalAlpha = t.alpha, e.lineWidth = t.width, e.beginPath(), e.moveTo(t.px, a.y), e.lineTo(t.px, a.y + a.height), e.stroke();
18635
18648
  e.restore();
@@ -18645,7 +18658,7 @@ var Wm = {
18645
18658
  lineRects(e, t, n) {
18646
18659
  let r = this.marks(e, n, t);
18647
18660
  if (r.length === 0) return [];
18648
- let { color: i, style: a } = this.look(t), o = Ym[a] ?? void 0, { y: s, height: c } = e.chartRect;
18661
+ let { color: i, style: a } = this.look(t), o = Xm[a] ?? void 0, { y: s, height: c } = e.chartRect;
18649
18662
  return r.map((e) => ({
18650
18663
  x: e.px - e.width / 2,
18651
18664
  y: s,
@@ -18673,7 +18686,7 @@ var Wm = {
18673
18686
  let n = l(t.idx, e) - (e.barWidth + e.barSpacing) / 2;
18674
18687
  if (n < i.x - 1 || n > i.x + i.width + 1) continue;
18675
18688
  let r = Math.round(n) + .5, s = .25, c = a, u = null;
18676
- t.kind === "day" ? s = .22 : t.kind === "week" ? (s = .34, u = Je(this.locale, Zm, this.tz)(t.time)) : t.kind === "month" ? (s = .5, c = a + .5, u = Je(this.locale, Qm, this.tz)(t.time)) : (s = .7, c = a + 1, u = String(t.year)), o.push({
18689
+ t.kind === "day" ? s = .22 : t.kind === "week" ? (s = .34, u = Je(this.locale, Qm, this.tz)(t.time)) : t.kind === "month" ? (s = .5, c = a + .5, u = Je(this.locale, $m, this.tz)(t.time)) : (s = .7, c = a + 1, u = String(t.year)), o.push({
18677
18690
  px: r,
18678
18691
  width: c,
18679
18692
  alpha: s,
@@ -18685,14 +18698,14 @@ var Wm = {
18685
18698
  invalidateCache() {
18686
18699
  this.lastDataLength = 0, this.cachedBreaksTyped = [], this.cachedMedianStep = 0, this.cacheValid = !1;
18687
18700
  }
18688
- }, Zm = {
18701
+ }, Qm = {
18689
18702
  month: "short",
18690
18703
  day: "numeric"
18691
- }, Qm = {
18704
+ }, $m = {
18692
18705
  month: "short",
18693
18706
  year: "numeric"
18694
18707
  };
18695
- function $m(e) {
18708
+ function eh(e) {
18696
18709
  if (e.length < 2) return 0;
18697
18710
  let t = Math.min(50, e.length - 1), n = [];
18698
18711
  for (let r = 1; r <= t; r++) {
@@ -18703,35 +18716,35 @@ function $m(e) {
18703
18716
  }
18704
18717
  //#endregion
18705
18718
  //#region src/ui/sessionHours.ts
18706
- var eh = 864e5;
18707
- function th(e, t) {
18719
+ var th = 864e5;
18720
+ function nh(e, t) {
18708
18721
  let n = {
18709
18722
  ...e,
18710
18723
  ...t
18711
18724
  };
18712
18725
  return t.tzOffsetMinutes !== void 0 && t.timeZone === void 0 && delete n.timeZone, n.windows ? n.windows = n.windows.map((e) => ({ ...e })) : delete n.windows, n;
18713
18726
  }
18714
- function nh(e, t) {
18715
- let n = ((e + t * 6e4) % eh + eh) % eh;
18727
+ function rh(e, t) {
18728
+ let n = ((e + t * 6e4) % th + th) % th;
18716
18729
  return Math.floor(n / 6e4);
18717
18730
  }
18718
- function rh(e, t, n) {
18731
+ function ih(e, t, n) {
18719
18732
  return t === n ? !0 : t < n ? e >= t && e < n : e >= t || e < n;
18720
18733
  }
18721
- function ih(e, t) {
18722
- let n = nh(e, t.timeZone ? qe(t.timeZone, e) : t.tzOffsetMinutes ?? 0);
18723
- return t.windows && t.windows.length > 0 ? t.windows.some((e) => rh(n, e.startMinute, e.endMinute)) : rh(n, t.startMinute, t.endMinute);
18734
+ function ah(e, t) {
18735
+ let n = rh(e, t.timeZone ? qe(t.timeZone, e) : t.tzOffsetMinutes ?? 0);
18736
+ return t.windows && t.windows.length > 0 ? t.windows.some((e) => ih(n, e.startMinute, e.endMinute)) : ih(n, t.startMinute, t.endMinute);
18724
18737
  }
18725
18738
  //#endregion
18726
18739
  //#region src/ui/SessionShading.ts
18727
- var ah = {
18740
+ var oh = {
18728
18741
  startMinute: 570,
18729
18742
  endMinute: 960,
18730
18743
  tzOffsetMinutes: -300,
18731
18744
  timeZone: "America/New_York"
18732
- }, oh = class {
18745
+ }, sh = class {
18733
18746
  visible = !1;
18734
- config = { ...ah };
18747
+ config = { ...oh };
18735
18748
  setVisible(e) {
18736
18749
  this.visible = e;
18737
18750
  }
@@ -18739,10 +18752,10 @@ var ah = {
18739
18752
  return this.visible;
18740
18753
  }
18741
18754
  setConfig(e) {
18742
- this.config = th(this.config, e);
18755
+ this.config = nh(this.config, e);
18743
18756
  }
18744
18757
  replaceConfig(e) {
18745
- this.config = th(e, {});
18758
+ this.config = nh(e, {});
18746
18759
  }
18747
18760
  getConfig() {
18748
18761
  return {
@@ -18774,12 +18787,12 @@ var ah = {
18774
18787
  });
18775
18788
  };
18776
18789
  for (let t = o; t <= s; t++) {
18777
- let n = !ih(e[t].time, this.config);
18790
+ let n = !ah(e[t].time, this.config);
18778
18791
  n && f === -1 ? f = t : !n && f !== -1 && (p(f, t - 1), f = -1);
18779
18792
  }
18780
18793
  return f !== -1 && p(f, s), d;
18781
18794
  }
18782
- }, sh = [2, 3], ch = 16, lh = class {
18795
+ }, ch = [2, 3], lh = 16, uh = class {
18783
18796
  highLow = !1;
18784
18797
  quote = null;
18785
18798
  quoteShown = !0;
@@ -18826,10 +18839,10 @@ var ah = {
18826
18839
  }
18827
18840
  render(e, t, n, r) {
18828
18841
  let { chartRect: i } = t;
18829
- e.save(), e.setLineDash(sh), e.lineWidth = 1;
18842
+ e.save(), e.setLineDash(ch), e.lineWidth = 1;
18830
18843
  for (let a of this.levels(r, t)) {
18831
18844
  let r = Math.round(T(a.price, t)) + .5;
18832
- r < i.y || r > i.y + i.height || (e.strokeStyle = uh(a.kind, n), e.beginPath(), e.moveTo(i.x, r), e.lineTo(i.x + i.width, r), e.stroke());
18845
+ r < i.y || r > i.y + i.height || (e.strokeStyle = dh(a.kind, n), e.beginPath(), e.moveTo(i.x, r), e.lineTo(i.x + i.width, r), e.stroke());
18833
18846
  }
18834
18847
  e.restore();
18835
18848
  }
@@ -18839,14 +18852,14 @@ var ah = {
18839
18852
  for (let c of this.levels(r, t)) {
18840
18853
  let r = T(c.price, t);
18841
18854
  if (r < i.y || r > i.y + i.height) continue;
18842
- e.fillStyle = uh(c.kind, n), M(e, a, r - ch / 2, o, ch, n), e.fillStyle = n.background;
18855
+ e.fillStyle = dh(c.kind, n), M(e, a, r - lh / 2, o, lh, n), e.fillStyle = n.background;
18843
18856
  let l = t.formatPrice?.(c.price) ?? this.priceText?.(c.price) ?? A(c.price, s);
18844
18857
  e.fillText(l, a + 5, r);
18845
18858
  }
18846
18859
  e.restore();
18847
18860
  }
18848
18861
  };
18849
- function uh(e, t) {
18862
+ function dh(e, t) {
18850
18863
  switch (e) {
18851
18864
  case "bid": return t.candleUp;
18852
18865
  case "ask": return t.candleDown;
@@ -18855,11 +18868,11 @@ function uh(e, t) {
18855
18868
  }
18856
18869
  //#endregion
18857
18870
  //#region src/features/AlertManager.ts
18858
- var dh = 500, fh = 2, ph = ["movesUp", "movesDown"];
18859
- function mh(e) {
18860
- return e.channel === "price" && !e.drawingId && !e.target && !ph.includes(e.condition);
18871
+ var fh = 500, ph = 2, mh = ["movesUp", "movesDown"];
18872
+ function hh(e) {
18873
+ return e.channel === "price" && !e.drawingId && !e.target && !mh.includes(e.condition);
18861
18874
  }
18862
- function hh(e, t, n, r) {
18875
+ function gh(e, t, n, r) {
18863
18876
  switch (r) {
18864
18877
  case "crossingUp": return e !== void 0 && e < n && t >= n;
18865
18878
  case "crossingDown": return e !== void 0 && e > n && t <= n;
@@ -18869,16 +18882,16 @@ function hh(e, t, n, r) {
18869
18882
  default: return !1;
18870
18883
  }
18871
18884
  }
18872
- var gh = [
18885
+ var _h = [
18873
18886
  "crossing",
18874
18887
  "crossingUp",
18875
18888
  "crossingDown"
18876
18889
  ];
18877
- function _h(e, t, n) {
18890
+ function vh(e, t, n) {
18878
18891
  let r = e < 0 && t >= 0, i = e > 0 && t <= 0;
18879
18892
  return n === "crossingUp" ? r : n === "crossingDown" ? i : r || i;
18880
18893
  }
18881
- var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
18894
+ var yh = 1, bh = 2 ** 31 - 1, xh = class extends Mp {
18882
18895
  alerts = [];
18883
18896
  lastValues = /* @__PURE__ */ new Map();
18884
18897
  drawingSides = /* @__PURE__ */ new Map();
@@ -18899,7 +18912,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
18899
18912
  this.pricePrecision = e;
18900
18913
  }
18901
18914
  addAlert(e, t = "crossing", n, r = !1, i = "price", a, o = {}) {
18902
- let s = xh(t, i, o), c = `tc_alert_${vh++}`, l = {
18915
+ let s = Sh(t, i, o), c = `tc_alert_${yh++}`, l = {
18903
18916
  id: c,
18904
18917
  price: e,
18905
18918
  condition: t,
@@ -18916,8 +18929,8 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
18916
18929
  this.drawingLevels = e;
18917
18930
  }
18918
18931
  addDrawingAlert(e, t = "crossing", n, r = !1, i) {
18919
- if (!gh.includes(t)) throw RangeError(`An alert on a drawing takes a crossing condition, not "${t}"`);
18920
- let a = `tc_alert_${vh++}`, o = {
18932
+ if (!_h.includes(t)) throw RangeError(`An alert on a drawing takes a crossing condition, not "${t}"`);
18933
+ let a = `tc_alert_${yh++}`, o = {
18921
18934
  id: a,
18922
18935
  price: this.drawingLevels?.(e)?.[0] ?? NaN,
18923
18936
  condition: t,
@@ -18964,7 +18977,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
18964
18977
  if (e.y < r.y || e.y > r.y + r.height) return null;
18965
18978
  let i = null, a = n;
18966
18979
  for (let n of this.alerts) {
18967
- if (!mh(n)) continue;
18980
+ if (!hh(n)) continue;
18968
18981
  let r = Math.abs(T(n.price, t) - e.y);
18969
18982
  r <= a && (a = r, i = n);
18970
18983
  }
@@ -18998,7 +19011,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
18998
19011
  this.expiryTimer && clearTimeout(this.expiryTimer), this.expiryTimer = null;
18999
19012
  let e = Math.min(...this.alerts.filter((e) => !e.expired && e.expiresAt !== void 0 && !(e.triggered && !e.repeating)).map((e) => e.expiresAt));
19000
19013
  if (!Number.isFinite(e)) return;
19001
- let t = Math.min(Math.max(0, e - Date.now()), yh);
19014
+ let t = Math.min(Math.max(0, e - Date.now()), bh);
19002
19015
  this.expiryTimer = setTimeout(() => {
19003
19016
  this.expiryTimer = null, this.expire(), this.expiryTimer || this.scheduleExpiry();
19004
19017
  }, t);
@@ -19016,7 +19029,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19016
19029
  }
19017
19030
  t.price = n[0];
19018
19031
  let r = n.map((t) => Math.sign(e - t)), i = this.drawingSides.get(t.id);
19019
- this.drawingSides.set(t.id, r), !(!i || i.length !== r.length) && (r.some((e, n) => _h(i[n], e, t.condition)) ? t.triggered || (t.triggered = !0, this.emit("triggered", { ...t })) : t.repeating && (t.triggered = !1));
19032
+ this.drawingSides.set(t.id, r), !(!i || i.length !== r.length) && (r.some((e, n) => vh(i[n], e, t.condition)) ? t.triggered || (t.triggered = !0, this.emit("triggered", { ...t })) : t.repeating && (t.triggered = !1));
19020
19033
  }
19021
19034
  }
19022
19035
  checkChannel(e, t) {
@@ -19042,13 +19055,13 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19042
19055
  if (!t) continue;
19043
19056
  o = this.closedBarMet(e, t);
19044
19057
  } else if (e.target) o = this.targetMet(e);
19045
- else if (ph.includes(e.condition)) {
19058
+ else if (mh.includes(e.condition)) {
19046
19059
  if (!n) continue;
19047
19060
  o = this.moveMet(e, this.history.get(e.channel) ?? []);
19048
19061
  } else {
19049
19062
  let t = r.get(e.channel);
19050
19063
  if (!n || t === void 0) continue;
19051
- o = hh(t, this.lastValues.get(e.channel), e.price, e.condition);
19064
+ o = gh(t, this.lastValues.get(e.channel), e.price, e.condition);
19052
19065
  }
19053
19066
  this.settle(e, o);
19054
19067
  }
@@ -19060,7 +19073,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19060
19073
  let t = this.lastValues.get(e.channel), n = e.target ? this.lastValues.get(e.target) : void 0;
19061
19074
  if (t === void 0 || n === void 0) return !1;
19062
19075
  let r = t - n, i = this.lastDiffs.get(e.id);
19063
- return this.lastDiffs.set(e.id, r), e.price = n, hh(i, r, 0, e.condition);
19076
+ return this.lastDiffs.set(e.id, r), e.price = n, gh(i, r, 0, e.condition);
19064
19077
  }
19065
19078
  moveMet(e, t, n = t.length) {
19066
19079
  let r = e.bars ?? 1, i = t.slice(Math.max(0, n - r), n);
@@ -19076,7 +19089,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19076
19089
  closedBarMet(e, t) {
19077
19090
  let n = this.history.get(e.channel) ?? [], r = n.findIndex((e) => e.time === t.time);
19078
19091
  if (r < 0) return !1;
19079
- if (ph.includes(e.condition)) return this.moveMet(e, n, r + 1);
19092
+ if (mh.includes(e.condition)) return this.moveMet(e, n, r + 1);
19080
19093
  let i = (e, t) => {
19081
19094
  let r = this.history.get(e) ?? [], i = n[t]?.time;
19082
19095
  return i === void 0 ? void 0 : r.find((e) => e.time === i)?.value;
@@ -19086,7 +19099,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19086
19099
  if (t === void 0) return !1;
19087
19100
  a -= t, o = o !== void 0 && n !== void 0 ? o - n : void 0, s = 0, e.price = t;
19088
19101
  }
19089
- return hh(o, a, s, e.condition);
19102
+ return gh(o, a, s, e.condition);
19090
19103
  }
19091
19104
  recordBar(e, t) {
19092
19105
  let n = this.barTime;
@@ -19143,11 +19156,11 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19143
19156
  if (!Array.isArray(n)) return;
19144
19157
  for (let e of n) {
19145
19158
  if (typeof e.drawingId == "string" && e.condition && !e.triggered) {
19146
- gh.includes(e.condition) && this.addDrawingAlert(e.drawingId, e.condition, e.message, e.repeating ?? !1, e.label);
19159
+ _h.includes(e.condition) && this.addDrawingAlert(e.drawingId, e.condition, e.message, e.repeating ?? !1, e.label);
19147
19160
  continue;
19148
19161
  }
19149
19162
  if (!e.condition || e.triggered || e.expired) continue;
19150
- let t = Sh(e), n = !t.target && !ph.includes(e.condition), r = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : NaN;
19163
+ let t = Ch(e), n = !t.target && !mh.includes(e.condition), r = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : NaN;
19151
19164
  if (!(n && Number.isNaN(r))) try {
19152
19165
  this.addAlert(r, e.condition, e.message, e.repeating ?? !1, e.channel ?? "price", e.label, t);
19153
19166
  } catch {}
@@ -19157,7 +19170,7 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19157
19170
  render(e, t, n) {
19158
19171
  let { chartRect: r } = t;
19159
19172
  for (let i of this.alerts) {
19160
- if (!mh(i)) continue;
19173
+ if (!hh(i)) continue;
19161
19174
  let a = T(i.price, t);
19162
19175
  if (a < r.y || a > r.y + r.height) continue;
19163
19176
  let o = i.expired ? "#8a93a3" : i.triggered ? "#f2a93b" : "#4c8dff";
@@ -19167,8 +19180,8 @@ var vh = 1, yh = 2 ** 31 - 1, bh = class extends Mp {
19167
19180
  }
19168
19181
  }
19169
19182
  };
19170
- function xh(e, t, n) {
19171
- let r = {}, i = ph.includes(e);
19183
+ function Sh(e, t, n) {
19184
+ let r = {}, i = mh.includes(e);
19172
19185
  if (n.target !== void 0) {
19173
19186
  if (i) throw RangeError("An alert on a move takes no other line");
19174
19187
  if (n.target === t) throw RangeError("An alert can’t compare a line with itself");
@@ -19182,20 +19195,20 @@ function xh(e, t, n) {
19182
19195
  }
19183
19196
  return n.onBarClose && (r.onBarClose = !0), n.expiresAt !== void 0 && Number.isFinite(n.expiresAt) && (r.expiresAt = n.expiresAt), r;
19184
19197
  }
19185
- function Sh(e) {
19198
+ function Ch(e) {
19186
19199
  let t = {};
19187
19200
  return typeof e.target == "string" && e.target && (t.target = e.target), typeof e.percent == "number" && Number.isFinite(e.percent) && (t.percent = e.percent), typeof e.bars == "number" && Number.isInteger(e.bars) && (t.bars = e.bars), e.onBarClose === !0 && (t.onBarClose = !0), typeof e.expiresAt == "number" && Number.isFinite(e.expiresAt) && (t.expiresAt = e.expiresAt), t;
19188
19201
  }
19189
19202
  //#endregion
19190
19203
  //#region src/features/ReplayManager.ts
19191
- var Ch = 16, wh = () => typeof requestAnimationFrame == "function" && !(typeof document < "u" && document.hidden), Th = {
19204
+ var wh = 16, Th = () => typeof requestAnimationFrame == "function" && !(typeof document < "u" && document.hidden), Eh = {
19192
19205
  now: () => typeof performance < "u" ? performance.now() : Date.now(),
19193
- frame: (e) => wh() ? { raf: requestAnimationFrame(e) } : { timeout: setTimeout(e, Ch) },
19206
+ frame: (e) => Th() ? { raf: requestAnimationFrame(e) } : { timeout: setTimeout(e, wh) },
19194
19207
  cancel: (e) => {
19195
19208
  let t = e;
19196
19209
  t.raf !== void 0 && cancelAnimationFrame(t.raf), t.timeout !== void 0 && clearTimeout(t.timeout);
19197
19210
  }
19198
- }, Eh = class extends Mp {
19211
+ }, Dh = class extends Mp {
19199
19212
  data = [];
19200
19213
  cursor = -1;
19201
19214
  timer = null;
@@ -19207,7 +19220,7 @@ var Ch = 16, wh = () => typeof requestAnimationFrame == "function" && !(typeof d
19207
19220
  interval: 500
19208
19221
  };
19209
19222
  paceMs = null;
19210
- constructor(e = Th) {
19223
+ constructor(e = Eh) {
19211
19224
  super(), this.clock = e;
19212
19225
  }
19213
19226
  load(e) {
@@ -19238,7 +19251,7 @@ var Ch = 16, wh = () => typeof requestAnimationFrame == "function" && !(typeof d
19238
19251
  this.setState("paused");
19239
19252
  return;
19240
19253
  }
19241
- this.setState("playing"), t < Ch || this.paceMs !== null ? this.runFrames(t) : this.timer = setInterval(() => this.advance(1), t);
19254
+ this.setState("playing"), t < wh || this.paceMs !== null ? this.runFrames(t) : this.timer = setInterval(() => this.advance(1), t);
19242
19255
  }
19243
19256
  pause() {
19244
19257
  this.clearTimer(), this.setState("paused");
@@ -19320,21 +19333,21 @@ var Ch = 16, wh = () => typeof requestAnimationFrame == "function" && !(typeof d
19320
19333
  setState(e) {
19321
19334
  this.state !== e && (this.state = e, this.emit("stateChange", e));
19322
19335
  }
19323
- }, Dh = 64, Oh = 3, kh = 3;
19336
+ }, Oh = 64, kh = 3, Ah = 3;
19324
19337
  function X(e) {
19325
19338
  return typeof e == "object" && !!e && !Array.isArray(e);
19326
19339
  }
19327
- function Ah(e) {
19340
+ function jh(e) {
19328
19341
  return Array.isArray(e) ? e : [];
19329
19342
  }
19330
- function jh(e, t) {
19343
+ function Mh(e, t) {
19331
19344
  return typeof e == "string" ? e : t;
19332
19345
  }
19333
- function Mh(e, t) {
19346
+ function Nh(e, t) {
19334
19347
  return typeof e == "number" && Number.isFinite(e) ? e : t;
19335
19348
  }
19336
- function Nh(e) {
19337
- if (!X(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length > Ph || !X(e.style)) return null;
19349
+ function Ph(e) {
19350
+ if (!X(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length > Fh || !X(e.style)) return null;
19338
19351
  let t = [];
19339
19352
  for (let n of e.anchors) {
19340
19353
  if (!X(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
@@ -19357,30 +19370,30 @@ function Nh(e) {
19357
19370
  visible: typeof e.visible == "boolean" ? e.visible : !0,
19358
19371
  locked: typeof e.locked == "boolean" ? e.locked : !1,
19359
19372
  options: X(e.options) ? e.options : void 0,
19360
- group: Lh(e.group),
19373
+ group: Rh(e.group),
19361
19374
  meta: X(e.meta) ? e.meta : void 0
19362
19375
  };
19363
19376
  }
19364
- var Ph = 5e3, Fh = 64, Ih = 80;
19365
- function Lh(e) {
19366
- if (!(!X(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length > Fh)) return {
19377
+ var Fh = 5e3, Ih = 64, Lh = 80;
19378
+ function Rh(e) {
19379
+ if (!(!X(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length > Ih)) return {
19367
19380
  id: e.id,
19368
- name: e.name.slice(0, Ih)
19381
+ name: e.name.slice(0, Lh)
19369
19382
  };
19370
19383
  }
19371
- function Rh(e) {
19384
+ function zh(e) {
19372
19385
  return !X(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
19373
19386
  }
19374
- function zh(e) {
19387
+ function Bh(e) {
19375
19388
  if (!X(e)) return;
19376
- let t = {}, n = Ah(e.colors).filter((e) => typeof e == "string");
19389
+ let t = {}, n = jh(e.colors).filter((e) => typeof e == "string");
19377
19390
  n.length > 0 && (t.colors = n);
19378
- let r = Ah(e.lineWidths).filter((e) => typeof e == "number" && Number.isFinite(e) && e > 0);
19391
+ let r = jh(e.lineWidths).filter((e) => typeof e == "number" && Number.isFinite(e) && e > 0);
19379
19392
  r.length > 0 && (t.lineWidths = r), typeof e.opacity == "number" && Number.isFinite(e.opacity) && (t.opacity = Math.min(1, Math.max(0, e.opacity)));
19380
19393
  let i = Ae(e.plots);
19381
19394
  return i && (t.plots = i), Object.keys(t).length > 0 ? t : void 0;
19382
19395
  }
19383
- var Bh = [
19396
+ var Vh = [
19384
19397
  "crossingUp",
19385
19398
  "crossingDown",
19386
19399
  "crossing",
@@ -19389,9 +19402,9 @@ var Bh = [
19389
19402
  "movesUp",
19390
19403
  "movesDown"
19391
19404
  ];
19392
- function Vh(e) {
19405
+ function Hh(e) {
19393
19406
  if (!X(e) || typeof e.id != "string") return null;
19394
- let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r = Bh.find((t) => t === e.condition) ?? "crossing", i = Sh(e), a = i.target !== void 0 || r === "movesUp" || r === "movesDown";
19407
+ let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r = Vh.find((t) => t === e.condition) ?? "crossing", i = Ch(e), a = i.target !== void 0 || r === "movesUp" || r === "movesDown";
19395
19408
  return n === null && !t && !a ? null : {
19396
19409
  id: e.id,
19397
19410
  price: n ?? NaN,
@@ -19400,43 +19413,43 @@ function Vh(e) {
19400
19413
  message: typeof e.message == "string" ? e.message : void 0,
19401
19414
  triggered: e.triggered === !0,
19402
19415
  repeating: e.repeating === !0,
19403
- channel: jh(e.channel, "price"),
19416
+ channel: Mh(e.channel, "price"),
19404
19417
  label: typeof e.label == "string" ? e.label : void 0,
19405
19418
  ...i,
19406
19419
  ...e.expired === !0 ? { expired: !0 } : {}
19407
19420
  };
19408
19421
  }
19409
- function Hh(e) {
19422
+ function Uh(e) {
19410
19423
  return !X(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
19411
19424
  }
19412
- var Uh = 4e3;
19413
- function Wh(e) {
19425
+ var Wh = 4e3;
19426
+ function Gh(e) {
19414
19427
  if (!X(e)) return;
19415
19428
  let t = {}, n = [];
19416
19429
  for (let [r, i] of Object.entries(e)) {
19417
19430
  let e = Oe(i);
19418
19431
  n.push(...e.rejected);
19419
19432
  let a = Object.fromEntries(Object.entries(e.overrides).filter(([, e]) => e !== null));
19420
- Object.keys(a).length > 0 && (t[r.slice(0, Dh)] = a);
19433
+ Object.keys(a).length > 0 && (t[r.slice(0, Oh)] = a);
19421
19434
  }
19422
19435
  return n.length > 0 && console.warn(`Saved style overrides left out: ${[...new Set(n)].join(", ")}`), t;
19423
19436
  }
19424
- function Gh(e) {
19425
- if (!X(e)) return Kh();
19426
- typeof e.version == "number" && e.version > kh && console.warn(`Chart state from a newer version (${e.version}); loading what this version understands.`);
19437
+ function Kh(e) {
19438
+ if (!X(e)) return qh();
19439
+ typeof e.version == "number" && e.version > Ah && console.warn(`Chart state from a newer version (${e.version}); loading what this version understands.`);
19427
19440
  let t = X(e.viewport) ? e.viewport : {}, n = [];
19428
- for (let t of Ah(e.indicators)) X(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || X(t.params) && n.push({
19441
+ for (let t of jh(e.indicators)) X(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || X(t.params) && n.push({
19429
19442
  id: t.id,
19430
19443
  instanceId: t.instanceId,
19431
19444
  params: t.params,
19432
19445
  position: typeof t.position == "string" ? t.position : void 0,
19433
- style: zh(t.style),
19446
+ style: Bh(t.style),
19434
19447
  visible: typeof t.visible == "boolean" ? t.visible : void 0,
19435
19448
  levels: Array.isArray(t.levels) ? t.levels.filter((e) => typeof e == "number" && Number.isFinite(e)) : void 0,
19436
19449
  pane: typeof t.pane == "string" ? t.pane : void 0,
19437
19450
  scale: t.scale === "left" ? "left" : void 0,
19438
19451
  paneStyle: je(t.paneStyle) ?? void 0,
19439
- paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize, Uh) : void 0,
19452
+ paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize, Wh) : void 0,
19440
19453
  paneOrder: typeof t.paneOrder == "number" && Number.isInteger(t.paneOrder) && t.paneOrder >= 0 ? t.paneOrder : void 0,
19441
19454
  paneCollapsed: t.paneCollapsed === !0 ? !0 : void 0,
19442
19455
  paneMaximized: t.paneMaximized === !0 ? !0 : void 0,
@@ -19445,37 +19458,37 @@ function Gh(e) {
19445
19458
  panePercent: t.panePercent === !0 ? !0 : void 0
19446
19459
  }));
19447
19460
  let r = [];
19448
- for (let t of Ah(e.drawings)) {
19449
- let e = Nh(t);
19461
+ for (let t of jh(e.drawings)) {
19462
+ let e = Ph(t);
19450
19463
  e && r.push(e);
19451
19464
  }
19452
19465
  let i = [];
19453
- for (let t of Ah(e.orders)) {
19454
- let e = Rh(t);
19466
+ for (let t of jh(e.orders)) {
19467
+ let e = zh(t);
19455
19468
  e && i.push(e);
19456
19469
  }
19457
19470
  let a = [];
19458
- for (let t of Ah(e.positions)) {
19459
- let e = Hh(t);
19471
+ for (let t of jh(e.positions)) {
19472
+ let e = Uh(t);
19460
19473
  e && a.push(e);
19461
19474
  }
19462
19475
  let o = [];
19463
- for (let t of Ah(e.alerts)) {
19464
- let e = Vh(t);
19476
+ for (let t of jh(e.alerts)) {
19477
+ let e = Hh(t);
19465
19478
  e && o.push(e);
19466
19479
  }
19467
- let s = Wh(e.overrides);
19480
+ let s = Gh(e.overrides);
19468
19481
  return {
19469
19482
  version: typeof e.version == "number" && Array.isArray(e.indicators) ? e.version : 1,
19470
- timestamp: Mh(e.timestamp, Date.now()),
19483
+ timestamp: Nh(e.timestamp, Date.now()),
19471
19484
  symbol: typeof e.symbol == "string" ? e.symbol : void 0,
19472
19485
  timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
19473
- chartType: jh(e.chartType, "candlestick"),
19486
+ chartType: Mh(e.chartType, "candlestick"),
19474
19487
  ...e.chartTypeOptions === void 0 ? {} : { chartTypeOptions: ke(e.chartTypeOptions) },
19475
19488
  viewport: {
19476
- barWidth: Mh(t.barWidth, 8),
19477
- barSpacing: Mh(t.barSpacing, 2),
19478
- offset: Mh(t.offset, 0)
19489
+ barWidth: Nh(t.barWidth, 8),
19490
+ barSpacing: Nh(t.barSpacing, 2),
19491
+ offset: Nh(t.offset, 0)
19479
19492
  },
19480
19493
  theme: typeof e.theme == "string" ? e.theme : void 0,
19481
19494
  ...s ? { overrides: s } : {},
@@ -19487,7 +19500,7 @@ function Gh(e) {
19487
19500
  alerts: o
19488
19501
  };
19489
19502
  }
19490
- function Kh() {
19503
+ function qh() {
19491
19504
  return {
19492
19505
  version: 1,
19493
19506
  timestamp: Date.now(),
@@ -19504,10 +19517,10 @@ function Kh() {
19504
19517
  alerts: []
19505
19518
  };
19506
19519
  }
19507
- var qh = class {
19520
+ var Jh = class {
19508
19521
  static capture(e, t) {
19509
19522
  return {
19510
- version: e.getIndicators ? kh : 1,
19523
+ version: e.getIndicators ? Ah : 1,
19511
19524
  timestamp: Date.now(),
19512
19525
  chartType: t?.chartType ?? "candlestick",
19513
19526
  ...t?.chartTypeOptions && Object.keys(t.chartTypeOptions).length > 0 ? { chartTypeOptions: t.chartTypeOptions } : {},
@@ -19531,7 +19544,7 @@ var qh = class {
19531
19544
  return JSON.stringify(e);
19532
19545
  }
19533
19546
  static deserialize(e) {
19534
- return Gh(JSON.parse(e));
19547
+ return Kh(JSON.parse(e));
19535
19548
  }
19536
19549
  static saveToStorage(e, t) {
19537
19550
  localStorage.setItem(e, this.serialize(t));
@@ -19558,7 +19571,7 @@ var qh = class {
19558
19571
  }, n.click();
19559
19572
  });
19560
19573
  }
19561
- }, Jh = class {
19574
+ }, Yh = class {
19562
19575
  undoStack = [];
19563
19576
  redoStack = [];
19564
19577
  maxHistory = 50;
@@ -19607,7 +19620,7 @@ var qh = class {
19607
19620
  redoCount: this.redoStack.length
19608
19621
  };
19609
19622
  }
19610
- }, Yh = [
19623
+ }, Xh = [
19611
19624
  "Time",
19612
19625
  "Open",
19613
19626
  "High",
@@ -19615,29 +19628,29 @@ var qh = class {
19615
19628
  "Close",
19616
19629
  "Volume"
19617
19630
  ];
19618
- function Xh(e) {
19631
+ function Zh(e) {
19619
19632
  return new Date(Se(e)).toISOString();
19620
19633
  }
19621
- function Zh(e) {
19634
+ function Qh(e) {
19622
19635
  let t = /^[=+\-@\t\r]/.test(e) && !/^-?\d/.test(e) ? `'${e}` : e;
19623
19636
  return /[",\r\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
19624
19637
  }
19625
- var Qh = (e) => e == null || !Number.isFinite(e) ? "" : String(e), $h = class {
19638
+ var $h = (e) => e == null || !Number.isFinite(e) ? "" : String(e), eg = class {
19626
19639
  static toCSV(e, t = []) {
19627
- return [[...Yh, ...t.map((e) => Zh(e.name))].join(","), ...e.map((e, n) => [
19628
- Xh(e.time),
19640
+ return [[...Xh, ...t.map((e) => Qh(e.name))].join(","), ...e.map((e, n) => [
19641
+ Zh(e.time),
19629
19642
  e.open,
19630
19643
  e.high,
19631
19644
  e.low,
19632
19645
  e.close,
19633
19646
  e.volume,
19634
- ...t.map((e) => Qh(e.values[n]))
19647
+ ...t.map((e) => $h(e.values[n]))
19635
19648
  ].join(","))].join("\n");
19636
19649
  }
19637
19650
  static toJSON(e, t = []) {
19638
19651
  return JSON.stringify(e.map((e, n) => {
19639
19652
  let r = {
19640
- time: Xh(e.time),
19653
+ time: Zh(e.time),
19641
19654
  open: e.open,
19642
19655
  high: e.high,
19643
19656
  low: e.low,
@@ -19658,10 +19671,10 @@ var Qh = (e) => e == null || !Number.isFinite(e) ? "" : String(e), $h = class {
19658
19671
  };
19659
19672
  //#endregion
19660
19673
  //#region src/features/replayReveal.ts
19661
- function eg(e, t, n = -Infinity) {
19674
+ function tg(e, t, n = -Infinity) {
19662
19675
  return t === null ? e : e.filter((e) => e.time >= n && e.time < t);
19663
19676
  }
19664
- function tg(e, t, n = -Infinity) {
19677
+ function ng(e, t, n = -Infinity) {
19665
19678
  return t === null ? e : e.filter((e) => e.entryTime >= n && e.entryTime < t).map((e) => {
19666
19679
  if (e.exitTime === void 0 || e.exitTime < t) return e;
19667
19680
  let { exitTime: n, exitPrice: r, pnl: i, pnlPercent: a, ...o } = e;
@@ -19670,7 +19683,7 @@ function tg(e, t, n = -Infinity) {
19670
19683
  }
19671
19684
  //#endregion
19672
19685
  //#region src/features/SignalMarkerManager.ts
19673
- var ng = 1, rg = 3, ig = class extends Mp {
19686
+ var rg = 1, ig = 3, ag = class extends Mp {
19674
19687
  markers = [];
19675
19688
  style = { ...re };
19676
19689
  requestRender = null;
@@ -19693,7 +19706,7 @@ var ng = 1, rg = 3, ig = class extends Mp {
19693
19706
  return { ...this.style };
19694
19707
  }
19695
19708
  addMarker(e) {
19696
- let t = e.id ?? `tc_signal_${ng++}`, n = {
19709
+ let t = e.id ?? `tc_signal_${rg++}`, n = {
19697
19710
  ...e,
19698
19711
  id: t
19699
19712
  };
@@ -19715,22 +19728,22 @@ var ng = 1, rg = 3, ig = class extends Mp {
19715
19728
  e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
19716
19729
  }
19717
19730
  shownMarkers() {
19718
- return [...eg(this.markers, this.revealUntil, this.revealFrom)];
19731
+ return [...tg(this.markers, this.revealUntil, this.revealFrom)];
19719
19732
  }
19720
19733
  markerAt(e, t) {
19721
19734
  let n = this.dataGetter?.();
19722
19735
  if (!n || n.length === 0) return null;
19723
19736
  let { chartRect: r } = t;
19724
19737
  if (e.x < r.x || e.x > r.x + r.width || e.y < r.y || e.y > r.y + r.height) return null;
19725
- let a = this.style.arrowSize ?? 12, o = eg(this.markers, this.revealUntil, this.revealFrom);
19738
+ let a = this.style.arrowSize ?? 12, o = tg(this.markers, this.revealUntil, this.revealFrom);
19726
19739
  for (let r = o.length - 1; r >= 0; r--) {
19727
19740
  let s = o[r], c = l(i(s.time, n), t), u = T(s.price, t), d = a * Math.max(.6, Math.min(1, s.confidence)), f = s.direction === "long" ? u - d : (s.direction, u - d * .4), p = s.direction === "long" ? u + d * .4 : s.direction === "short" ? u + d : u + d * .4;
19728
- if (Math.abs(e.x - c) <= d * .6 + rg && e.y >= f - rg && e.y <= p + rg) return s;
19741
+ if (Math.abs(e.x - c) <= d * .6 + ig && e.y >= f - ig && e.y <= p + ig) return s;
19729
19742
  }
19730
19743
  return null;
19731
19744
  }
19732
19745
  render(e, t, n) {
19733
- let r = this.dataGetter?.(), a = eg(this.markers, this.revealUntil, this.revealFrom);
19746
+ let r = this.dataGetter?.(), a = tg(this.markers, this.revealUntil, this.revealFrom);
19734
19747
  if (!r || r.length === 0 || a.length === 0) return;
19735
19748
  let { chartRect: o } = t, s = yc(this.style, n), c = s.arrowSize ?? 12;
19736
19749
  e.save(), e.beginPath(), e.rect(o.x, o.y, o.width, o.height), e.clip();
@@ -19763,7 +19776,7 @@ var ng = 1, rg = 3, ig = class extends Mp {
19763
19776
  renderArrow(e, t, n, r, i, a) {
19764
19777
  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();
19765
19778
  }
19766
- }, ag = 1, og = class extends Mp {
19779
+ }, og = 1, sg = class extends Mp {
19767
19780
  zones = [];
19768
19781
  style = { ...ae };
19769
19782
  requestRender = null;
@@ -19790,7 +19803,7 @@ var ng = 1, rg = 3, ig = class extends Mp {
19790
19803
  return { ...this.style };
19791
19804
  }
19792
19805
  addZone(e) {
19793
- let t = e.id ?? `tc_zone_${ag++}`, n = {
19806
+ let t = e.id ?? `tc_zone_${og++}`, n = {
19794
19807
  ...e,
19795
19808
  id: t
19796
19809
  };
@@ -19819,10 +19832,10 @@ var ng = 1, rg = 3, ig = class extends Mp {
19819
19832
  e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
19820
19833
  }
19821
19834
  shownZones() {
19822
- return [...tg(this.zones, this.revealUntil, this.revealFrom)];
19835
+ return [...ng(this.zones, this.revealUntil, this.revealFrom)];
19823
19836
  }
19824
19837
  render(e, t, n) {
19825
- let r = this.dataGetter?.(), i = tg(this.zones, this.revealUntil, this.revealFrom);
19838
+ let r = this.dataGetter?.(), i = ng(this.zones, this.revealUntil, this.revealFrom);
19826
19839
  if (!r || r.length === 0 || i.length === 0) return;
19827
19840
  let { chartRect: a } = t, o = bc(this.style, n);
19828
19841
  e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
@@ -19845,7 +19858,7 @@ var ng = 1, rg = 3, ig = class extends Mp {
19845
19858
  }
19846
19859
  o.showLabel && t.label && (e.font = `9px ${a.font.family}`, e.fillStyle = x, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, p + 4, h + 3), e.globalAlpha = 1);
19847
19860
  }
19848
- }, sg = class {
19861
+ }, cg = class {
19849
19862
  active = !1;
19850
19863
  startBar = 0;
19851
19864
  startPrice = 0;
@@ -19858,35 +19871,35 @@ var ng = 1, rg = 3, ig = class extends Mp {
19858
19871
  }
19859
19872
  begin(e, t, n) {
19860
19873
  let r = Math.round(g(e.x, t)), i = h(e.y, t);
19861
- this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = cg(r, n), this.endTime = this.startTime, this.active = !0;
19874
+ this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = lg(r, n), this.endTime = this.startTime, this.active = !0;
19862
19875
  }
19863
19876
  update(e, t, n) {
19864
19877
  if (!this.active) return;
19865
19878
  let r = Math.round(g(e.x, t));
19866
- this.endBar = r, this.endPrice = h(e.y, t), this.endTime = cg(r, n);
19879
+ this.endBar = r, this.endPrice = h(e.y, t), this.endTime = lg(r, n);
19867
19880
  }
19868
19881
  end() {
19869
19882
  this.active = !1;
19870
19883
  }
19871
19884
  render(e, t, n) {
19872
19885
  if (!this.active) return;
19873
- let r = l(this.startBar, t), i = l(this.endBar, t), a = T(this.startPrice, t), o = T(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), u = Math.min(a, o), d = Math.max(a, o), f = c - s, p = d - u, m = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, h = mg(m, .14);
19886
+ let r = l(this.startBar, t), i = l(this.endBar, t), a = T(this.startPrice, t), o = T(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), u = Math.min(a, o), d = Math.max(a, o), f = c - s, p = d - u, m = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, h = hg(m, .14);
19874
19887
  e.save();
19875
19888
  let { chartRect: g } = t;
19876
- e.beginPath(), e.rect(g.x, g.y, g.width, g.height), e.clip(), e.fillStyle = h, e.fillRect(s, u, f, p), e.strokeStyle = m, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, u + .5, f, p), e.setLineDash([]), e.strokeStyle = m, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), dg(e, r, a, m), dg(e, i, o, m), e.restore();
19877
- let _ = Math.abs(this.endBar - this.startBar), v = this.endPrice - this.startPrice, y = this.startPrice === 0 ? 0 : v / this.startPrice * 100, b = this.startTime !== null && this.endTime !== null ? ug(Math.abs(this.endTime - this.startTime)) : null, x = [], S = v > 0 ? "+" : v < 0 ? "−" : "", C = Math.abs(v);
19878
- x.push(`${S}${t.formatPrice?.(C) ?? lg(C)} (${S}${Math.abs(y).toFixed(2)}%)`), x.push(`${_} bars${b ? " · " + b : ""}`), e.save(), fg(e, i, o, x, m, n), e.restore();
19889
+ e.beginPath(), e.rect(g.x, g.y, g.width, g.height), e.clip(), e.fillStyle = h, e.fillRect(s, u, f, p), e.strokeStyle = m, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, u + .5, f, p), e.setLineDash([]), e.strokeStyle = m, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), fg(e, r, a, m), fg(e, i, o, m), e.restore();
19890
+ let _ = Math.abs(this.endBar - this.startBar), v = this.endPrice - this.startPrice, y = this.startPrice === 0 ? 0 : v / this.startPrice * 100, b = this.startTime !== null && this.endTime !== null ? dg(Math.abs(this.endTime - this.startTime)) : null, x = [], S = v > 0 ? "+" : v < 0 ? "−" : "", C = Math.abs(v);
19891
+ x.push(`${S}${t.formatPrice?.(C) ?? ug(C)} (${S}${Math.abs(y).toFixed(2)}%)`), x.push(`${_} bars${b ? " · " + b : ""}`), e.save(), pg(e, i, o, x, m, n), e.restore();
19879
19892
  }
19880
19893
  };
19881
- function cg(e, t) {
19894
+ function lg(e, t) {
19882
19895
  if (e < 0 || e >= t.length) return null;
19883
19896
  let n = t[e].time;
19884
19897
  return n > 0xe8d4a51000 ? n : n * 1e3;
19885
19898
  }
19886
- function lg(e) {
19899
+ function ug(e) {
19887
19900
  return e >= 1e3 ? e.toFixed(2) : e >= 1 ? e.toFixed(4) : e.toPrecision(4);
19888
19901
  }
19889
- function ug(e) {
19902
+ function dg(e) {
19890
19903
  let t = e / 1e3;
19891
19904
  if (t < 60) return `${t.toFixed(0)}s`;
19892
19905
  let n = t / 60;
@@ -19898,10 +19911,10 @@ function ug(e) {
19898
19911
  let a = i / 30;
19899
19912
  return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
19900
19913
  }
19901
- function dg(e, t, n, r) {
19914
+ function fg(e, t, n, r) {
19902
19915
  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();
19903
19916
  }
19904
- function fg(e, t, n, r, i, a) {
19917
+ function pg(e, t, n, r, i, a) {
19905
19918
  e.font = `600 11px ${a.font.family}`;
19906
19919
  let o = 0;
19907
19920
  for (let t of r) {
@@ -19909,13 +19922,13 @@ function fg(e, t, n, r, i, a) {
19909
19922
  n > o && (o = n);
19910
19923
  }
19911
19924
  let s = Math.ceil(o) + 16, c = r.length * 14 + 12, l = t + 8, u = n + 8, d = e.canvas.clientWidth || e.canvas.width;
19912
- l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, pg(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, pg(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
19925
+ l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, mg(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, mg(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
19913
19926
  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);
19914
19927
  }
19915
- function pg(e, t, n, r, i, a) {
19928
+ function mg(e, t, n, r, i, a) {
19916
19929
  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();
19917
19930
  }
19918
- function mg(e, t) {
19931
+ function hg(e, t) {
19919
19932
  if (e.startsWith("#")) {
19920
19933
  let n = 0, r = 0, i = 0;
19921
19934
  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})`;
@@ -19928,7 +19941,7 @@ function mg(e, t) {
19928
19941
  }
19929
19942
  //#endregion
19930
19943
  //#region src/features/SelectionBoxOverlay.ts
19931
- var hg = 6, gg = class {
19944
+ var gg = 6, _g = class {
19932
19945
  start = null;
19933
19946
  current = null;
19934
19947
  isActive() {
@@ -19960,7 +19973,7 @@ var hg = 6, gg = class {
19960
19973
  let { chartRect: r } = t, i = (e) => Math.max(r.x, Math.min(r.x + r.width, e)), a = (e) => Math.max(r.y, Math.min(r.y + r.height, e)), o = i(Math.min(this.start.x, this.current.x)), s = i(Math.max(this.start.x, this.current.x)), c = a(Math.min(this.start.y, this.current.y)), l = a(Math.max(this.start.y, this.current.y));
19961
19974
  e.save(), e.fillStyle = n.crosshair, e.globalAlpha = .1, e.fillRect(o, c, s - o, l - c), e.globalAlpha = .8, e.strokeStyle = n.crosshair, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(Math.round(o) + .5, Math.round(c) + .5, Math.round(s - o), Math.round(l - c)), e.restore();
19962
19975
  }
19963
- }, _g = {
19976
+ }, vg = {
19964
19977
  linear: (e) => e,
19965
19978
  easeOutCubic: (e) => 1 - (1 - e) ** 3,
19966
19979
  easeOutQuart: (e) => 1 - (1 - e) ** 4,
@@ -19968,7 +19981,7 @@ var hg = 6, gg = class {
19968
19981
  easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
19969
19982
  easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
19970
19983
  spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
19971
- }, vg = class {
19984
+ }, yg = class {
19972
19985
  animations = /* @__PURE__ */ new Map();
19973
19986
  frameId = 0;
19974
19987
  running = !1;
@@ -19976,7 +19989,7 @@ var hg = 6, gg = class {
19976
19989
  this.animations.set(e, {
19977
19990
  startTime: -1,
19978
19991
  duration: t.duration,
19979
- easing: t.easing ?? _g.easeOutCubic,
19992
+ easing: t.easing ?? vg.easeOutCubic,
19980
19993
  onUpdate: t.onUpdate,
19981
19994
  onComplete: t.onComplete
19982
19995
  }), this.running || (this.running = !0, this.tick());
@@ -20011,10 +20024,10 @@ var hg = 6, gg = class {
20011
20024
  };
20012
20025
  //#endregion
20013
20026
  //#region src/finance/BaseFinanceChart.ts
20014
- function yg(e) {
20027
+ function bg(e) {
20015
20028
  return !e || e === "dark" ? O : e === "light" ? se : e;
20016
20029
  }
20017
- var bg = class {
20030
+ var xg = class {
20018
20031
  canvas;
20019
20032
  ctx;
20020
20033
  container;
@@ -20025,7 +20038,7 @@ var bg = class {
20025
20038
  frameId = null;
20026
20039
  resizeObserver;
20027
20040
  constructor(e, t) {
20028
- this.container = e, this.theme = yg(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", this.canvas.setAttribute("role", "img"), e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
20041
+ this.container = e, this.theme = bg(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", this.canvas.setAttribute("role", "img"), e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
20029
20042
  this.updateSize(), this.requestRender();
20030
20043
  }), this.resizeObserver.observe(e);
20031
20044
  }
@@ -20043,12 +20056,12 @@ var bg = class {
20043
20056
  this.canvas.setAttribute("aria-label", e);
20044
20057
  }
20045
20058
  setTheme(e) {
20046
- this.theme = yg(e), this.requestRender();
20059
+ this.theme = bg(e), this.requestRender();
20047
20060
  }
20048
20061
  destroy() {
20049
20062
  this.frameId !== null && cancelAnimationFrame(this.frameId), this.resizeObserver.disconnect(), this.canvas.remove();
20050
20063
  }
20051
- }, xg = class {
20064
+ }, Sg = class {
20052
20065
  pos = null;
20053
20066
  canvas;
20054
20067
  onUpdate;
@@ -20080,7 +20093,7 @@ var bg = class {
20080
20093
  };
20081
20094
  //#endregion
20082
20095
  //#region src/finance/SparklineRenderer.ts
20083
- function Sg(e, t, n, r, i) {
20096
+ function Cg(e, t, n, r, i) {
20084
20097
  let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
20085
20098
  if (a.length < 2 || t <= 0 || n <= 0) return;
20086
20099
  let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
@@ -20105,8 +20118,8 @@ function Sg(e, t, n, r, i) {
20105
20118
  }
20106
20119
  //#endregion
20107
20120
  //#region src/finance/DepthChartRenderer.ts
20108
- var Cg = 50, wg = 60, Tg = 20, Eg = .2;
20109
- function Dg(e) {
20121
+ var wg = 50, Tg = 60, Eg = 20, Dg = .2;
20122
+ function Og(e) {
20110
20123
  let t = [...e].sort((e, t) => t.price - e.price), n = [], r = 0;
20111
20124
  for (let e of t) r += e.volume, n.push({
20112
20125
  price: e.price,
@@ -20114,7 +20127,7 @@ function Dg(e) {
20114
20127
  });
20115
20128
  return n;
20116
20129
  }
20117
- function Og(e) {
20130
+ function kg(e) {
20118
20131
  let t = [...e].sort((e, t) => e.price - t.price), n = [], r = 0;
20119
20132
  for (let e of t) r += e.volume, n.push({
20120
20133
  price: e.price,
@@ -20122,20 +20135,20 @@ function Og(e) {
20122
20135
  });
20123
20136
  return n;
20124
20137
  }
20125
- function kg(e, t) {
20138
+ function Ag(e, t) {
20126
20139
  return {
20127
- left: Cg,
20128
- right: e - wg,
20129
- top: Tg,
20130
- bottom: t - Tg,
20131
- plotWidth: e - Cg - wg,
20132
- plotHeight: t - Tg * 2
20140
+ left: wg,
20141
+ right: e - Tg,
20142
+ top: Eg,
20143
+ bottom: t - Eg,
20144
+ plotWidth: e - wg - Tg,
20145
+ plotHeight: t - Eg * 2
20133
20146
  };
20134
20147
  }
20135
- function Ag(e, t, n, r) {
20148
+ function jg(e, t, n, r) {
20136
20149
  e.fillStyle = r, e.fillRect(0, 0, t, n);
20137
20150
  }
20138
- function jg(e, t, n, r, i, a, o, s) {
20151
+ function Mg(e, t, n, r, i, a, o, s) {
20139
20152
  let { left: c, right: l, top: u, bottom: d, plotWidth: f, plotHeight: p } = t;
20140
20153
  e.save(), e.strokeStyle = a.grid, e.lineWidth = .5, e.fillStyle = a.axisLabel, e.font = `${a.font.sizeSmall}px ${a.font.family}`;
20141
20154
  let m = ge(0, i, 5);
@@ -20150,7 +20163,7 @@ function jg(e, t, n, r, i, a, o, s) {
20150
20163
  }
20151
20164
  e.restore();
20152
20165
  }
20153
- function Mg(e, t, n, r, i, a, o, s, c) {
20166
+ function Ng(e, t, n, r, i, a, o, s, c) {
20154
20167
  if (t.length === 0) return;
20155
20168
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - e / a * f;
20156
20169
  if (e.beginPath(), c === "bid") {
@@ -20183,14 +20196,14 @@ function Mg(e, t, n, r, i, a, o, s, c) {
20183
20196
  }
20184
20197
  e.strokeStyle = s, e.lineWidth = 1.5, e.stroke();
20185
20198
  }
20186
- function Ng(e, t, n, r, i, a, o, s, c) {
20199
+ function Pg(e, t, n, r, i, a, o, s, c) {
20187
20200
  let { left: l, top: u, bottom: d, plotWidth: f } = r, p = l + (t - i) / a * f;
20188
20201
  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) {
20189
20202
  let t = `Spread: ${c(n)}`;
20190
20203
  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();
20191
20204
  }
20192
20205
  }
20193
- function Pg(e, t, n, r, i, a, o, s, c, l, u) {
20206
+ function Fg(e, t, n, r, i, a, o, s, c, l, u) {
20194
20207
  let { left: d, top: f, bottom: p, plotWidth: m, plotHeight: h } = i, g = t.x;
20195
20208
  if (g < d || g > i.right) return;
20196
20209
  let _ = a + (g - d) / m * o, v = 0, y = "";
@@ -20216,47 +20229,47 @@ function Pg(e, t, n, r, i, a, o, s, c, l, u) {
20216
20229
  for (let t = 0; t < b.length; t++) e.fillText(b[t], C + 8, w + 6 + t * (c.font.sizeSmall + 4));
20217
20230
  e.restore();
20218
20231
  }
20219
- function Fg(e) {
20232
+ function Ig(e) {
20220
20233
  return e.toFixed(2);
20221
20234
  }
20222
- function Ig(e) {
20235
+ function Lg(e) {
20223
20236
  return e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(0);
20224
20237
  }
20225
- function Lg(e, t, n, r, i, a) {
20238
+ function Rg(e, t, n, r, i, a) {
20226
20239
  let { data: o } = r;
20227
20240
  if (o.bids.length === 0 && o.asks.length === 0 || t <= 0 || n <= 0) return;
20228
- 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 ?? Fg, m = r.volumeFormat ?? Ig, h = Dg(o.bids), g = Og(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 + Eg), 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, ee = kg(t, n);
20229
- Ag(e, t, n, i.background), jg(e, ee, w, T, k, i, p, m), Mg(e, h, ee, w, E, k, l, s, "bid"), Mg(e, g, ee, w, E, k, u, c, "ask"), d && Ng(e, y, b, ee, w, E, i, f, p), a && Pg(e, a, h, g, ee, w, E, k, i, p, m);
20241
+ 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 ?? Ig, m = r.volumeFormat ?? Lg, h = Og(o.bids), g = kg(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 + Dg), 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, ee = Ag(t, n);
20242
+ jg(e, t, n, i.background), Mg(e, ee, w, T, k, i, p, m), Ng(e, h, ee, w, E, k, l, s, "bid"), Ng(e, g, ee, w, E, k, u, c, "ask"), d && Pg(e, y, b, ee, w, E, i, f, p), a && Fg(e, a, h, g, ee, w, E, k, i, p, m);
20230
20243
  }
20231
20244
  //#endregion
20232
20245
  //#region src/finance/EquityCurveRenderer.ts
20233
- var Rg = 70, zg = 30, Bg = 20, Vg = 20, Hg = .05;
20234
- function Ug(e, t) {
20246
+ var zg = 70, Bg = 30, Vg = 20, Hg = 20, Ug = .05;
20247
+ function Wg(e, t) {
20235
20248
  return {
20236
- left: Rg,
20237
- right: e - Bg,
20238
- top: Vg,
20239
- bottom: t - zg,
20240
- plotWidth: e - Rg - Bg,
20241
- plotHeight: t - Vg - zg
20249
+ left: zg,
20250
+ right: e - Vg,
20251
+ top: Hg,
20252
+ bottom: t - Bg,
20253
+ plotWidth: e - zg - Vg,
20254
+ plotHeight: t - Hg - Bg
20242
20255
  };
20243
20256
  }
20244
- function Wg(e, t) {
20257
+ function Gg(e, t) {
20245
20258
  let n = Infinity, r = -Infinity;
20246
20259
  for (let t of e) t.value < n && (n = t.value), t.value > r && (r = t.value);
20247
20260
  if (t) for (let e of t) e.value < n && (n = e.value), e.value > r && (r = e.value);
20248
- let i = (r - n) * Hg;
20261
+ let i = (r - n) * Ug;
20249
20262
  return {
20250
20263
  valMin: n - i,
20251
20264
  valMax: r + i
20252
20265
  };
20253
20266
  }
20254
- function Gg(e) {
20267
+ function Kg(e) {
20255
20268
  let t = [], n = -Infinity;
20256
20269
  for (let r of e) r.value > n && (n = r.value), t.push(n);
20257
20270
  return t;
20258
20271
  }
20259
- function Kg(e) {
20272
+ function qg(e) {
20260
20273
  let t = 864e5;
20261
20274
  if (365.25 * t, e < 7 * t) {
20262
20275
  let e = new Intl.DateTimeFormat(void 0, {
@@ -20278,13 +20291,13 @@ function Kg(e) {
20278
20291
  });
20279
20292
  return (e) => n.format(new Date(e));
20280
20293
  }
20281
- function qg(e) {
20294
+ function Jg(e) {
20282
20295
  return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
20283
20296
  }
20284
- function Jg(e, t, n, r) {
20297
+ function Yg(e, t, n, r) {
20285
20298
  e.fillStyle = r, e.fillRect(0, 0, t, n);
20286
20299
  }
20287
- function Yg(e, t, n, r, i, a, o, s, c) {
20300
+ function Xg(e, t, n, r, i, a, o, s, c) {
20288
20301
  let { left: l, right: u, top: d, bottom: f, plotWidth: p, plotHeight: m } = t;
20289
20302
  e.save(), e.strokeStyle = o.grid, e.lineWidth = .5, e.fillStyle = o.axisLabel, e.font = `${o.font.sizeSmall}px ${o.font.family}`;
20290
20303
  let h = ge(n, r, 6), g = Math.ceil(n / h) * h;
@@ -20299,21 +20312,21 @@ function Yg(e, t, n, r, i, a, o, s, c) {
20299
20312
  }
20300
20313
  e.restore();
20301
20314
  }
20302
- function Xg(e, t, n, r, i, a, o, s, c) {
20315
+ function Zg(e, t, n, r, i, a, o, s, c) {
20303
20316
  if (t.length < 2) return;
20304
20317
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - (e - a) / o * f;
20305
20318
  e.save(), e.beginPath(), e.moveTo(p(t[0].time), m(t[0].value));
20306
20319
  for (let n = 1; n < t.length; n++) e.lineTo(p(t[n].time), m(t[n].value));
20307
20320
  e.strokeStyle = s, e.lineWidth = c, e.lineJoin = "round", e.stroke(), e.restore();
20308
20321
  }
20309
- function Zg(e, t, n, r, i, a, o, s) {
20322
+ function Qg(e, t, n, r, i, a, o, s) {
20310
20323
  if (t.length < 2) return;
20311
20324
  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);
20312
20325
  m.addColorStop(0, s + "40"), m.addColorStop(1, "transparent"), e.save(), e.beginPath(), e.moveTo(f(t[0].time), p(t[0].value));
20313
20326
  for (let n = 1; n < t.length; n++) e.lineTo(f(t[n].time), p(t[n].value));
20314
20327
  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();
20315
20328
  }
20316
- function Qg(e, t, n, r, i, a, o, s, c) {
20329
+ function $g(e, t, n, r, i, a, o, s, c) {
20317
20330
  if (t.length < 2) return;
20318
20331
  let { left: l, bottom: u, plotWidth: d, plotHeight: f } = r, p = (e) => l + (e - i) / a * d, m = (e) => u - (e - o) / s * f;
20319
20332
  e.save(), e.fillStyle = c, e.beginPath(), e.moveTo(p(t[0].time), m(n[0]));
@@ -20321,12 +20334,12 @@ function Qg(e, t, n, r, i, a, o, s, c) {
20321
20334
  for (let n = t.length - 1; n >= 0; n--) e.lineTo(p(t[n].time), m(t[n].value));
20322
20335
  e.closePath(), e.fill(), e.restore();
20323
20336
  }
20324
- function $g(e, t, n, r, i, a, o, s, c, l) {
20337
+ function e_(e, t, n, r, i, a, o, s, c, l) {
20325
20338
  if (t.length === 0) return;
20326
20339
  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;
20327
20340
  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();
20328
20341
  }
20329
- function e_(e, t, n, r, i, a, o, s, c, l, u, d) {
20342
+ function t_(e, t, n, r, i, a, o, s, c, l, u, d) {
20330
20343
  let { left: f, top: p, bottom: m, plotWidth: h, plotHeight: g } = i, _ = t.x;
20331
20344
  if (_ < f || _ > i.right) return;
20332
20345
  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();
@@ -20344,15 +20357,15 @@ function e_(e, t, n, r, i, a, o, s, c, l, u, d) {
20344
20357
  for (let t = 0; t < S.length; t++) e.fillText(S[t], D + 8, O + 6 + t * (l.font.sizeSmall + 4));
20345
20358
  e.restore();
20346
20359
  }
20347
- function t_(e, t, n, r, i, a) {
20360
+ function n_(e, t, n, r, i, a) {
20348
20361
  let { data: o } = r;
20349
20362
  if (o.length < 2 || t <= 0 || n <= 0) return;
20350
- 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 ?? qg, { valMin: g, valMax: _ } = Wg(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? Kg(x), C = Ug(t, n);
20351
- Jg(e, t, n, i.background), Yg(e, C, g, _, y, b, i, h, S), l && Qg(e, o, Gg(o), C, y, x, g, v, u), d && Zg(e, o, C, y, x, g, v, s), Xg(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (Xg(e, f, C, y, x, g, v, p, 1), $g(e, f, C, y, x, g, v, m, p, i)), a && e_(e, a, o, f, C, y, x, g, v, i, S, h);
20363
+ 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 ?? Jg, { valMin: g, valMax: _ } = Gg(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? qg(x), C = Wg(t, n);
20364
+ Yg(e, t, n, i.background), Xg(e, C, g, _, y, b, i, h, S), l && $g(e, o, Kg(o), C, y, x, g, v, u), d && Qg(e, o, C, y, x, g, v, s), Zg(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (Zg(e, f, C, y, x, g, v, p, 1), e_(e, f, C, y, x, g, v, m, p, i)), a && t_(e, a, o, f, C, y, x, g, v, i, S, h);
20352
20365
  }
20353
20366
  //#endregion
20354
20367
  //#region src/finance/HeatmapLayout.ts
20355
- function n_(e, t, n) {
20368
+ function r_(e, t, n) {
20356
20369
  if (e.length === 0) return [];
20357
20370
  let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
20358
20371
  for (let a = 0; a < r; a++) {
@@ -20369,7 +20382,7 @@ function n_(e, t, n) {
20369
20382
  }
20370
20383
  return c;
20371
20384
  }
20372
- function r_(e, t) {
20385
+ function i_(e, t) {
20373
20386
  let n = e.reduce((e, t) => e + t, 0);
20374
20387
  if (n === 0 || t === 0) return Infinity;
20375
20388
  let r = 0;
@@ -20379,7 +20392,7 @@ function r_(e, t) {
20379
20392
  }
20380
20393
  return r;
20381
20394
  }
20382
- function i_(e, t, n, r, i, a) {
20395
+ function a_(e, t, n, r, i, a) {
20383
20396
  let o = r ? n.height : n.width, s = e.reduce((e, t) => e + t, 0), c = o > 0 ? s / o : 0, l = 0;
20384
20397
  for (let o = 0; o < e.length; o++) {
20385
20398
  let s = c > 0 ? e[o] / c : 0, u;
@@ -20399,19 +20412,19 @@ function i_(e, t, n, r, i, a) {
20399
20412
  }), l += s;
20400
20413
  }
20401
20414
  }
20402
- function a_(e, t, n, r, i) {
20415
+ function o_(e, t, n, r, i) {
20403
20416
  if (e.length === 0) return;
20404
20417
  let a = n.width >= n.height, o = a ? n.height : n.width;
20405
20418
  if (e.length === 1) {
20406
- i_(e, t, n, a, r, i);
20419
+ a_(e, t, n, a, r, i);
20407
20420
  return;
20408
20421
  }
20409
20422
  let s = [], c = [], l = 0;
20410
20423
  for (; l < e.length;) {
20411
20424
  let u = [...s, e[l]];
20412
- if (s.length === 0 || r_(u, o) <= r_(s, o)) s.push(e[l]), c.push(t[l]), l++;
20425
+ if (s.length === 0 || i_(u, o) <= i_(s, o)) s.push(e[l]), c.push(t[l]), l++;
20413
20426
  else {
20414
- i_(s, c, n, a, r, i);
20427
+ a_(s, c, n, a, r, i);
20415
20428
  let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
20416
20429
  n = a ? {
20417
20430
  x: n.x + d,
@@ -20423,37 +20436,37 @@ function a_(e, t, n, r, i) {
20423
20436
  y: n.y + d,
20424
20437
  width: n.width,
20425
20438
  height: n.height - d
20426
- }, a_(e.slice(l), t.slice(l), n, r, i);
20439
+ }, o_(e.slice(l), t.slice(l), n, r, i);
20427
20440
  return;
20428
20441
  }
20429
20442
  }
20430
- s.length > 0 && i_(s, c, n, a, r, i);
20443
+ s.length > 0 && a_(s, c, n, a, r, i);
20431
20444
  }
20432
- function o_(e, t, n) {
20445
+ function s_(e, t, n) {
20433
20446
  if (e.length === 0) return [];
20434
20447
  let r = [...e].sort((e, t) => t.weight - e.weight), i = r.reduce((e, t) => e + Math.max(0, t.weight), 0);
20435
20448
  if (i === 0) return [];
20436
20449
  let a = t.width * t.height, o = r.map((e) => Math.max(0, e.weight) / i * a), s = r.map((e) => e.id), c = [];
20437
- return a_(o, s, { ...t }, n, c), c;
20450
+ return o_(o, s, { ...t }, n, c), c;
20438
20451
  }
20439
- var s_ = 2, c_ = 18;
20440
- function l_(e, t, n, r = 18) {
20452
+ var c_ = 2, l_ = 18;
20453
+ function u_(e, t, n, r = 18) {
20441
20454
  let i = /* @__PURE__ */ new Map();
20442
20455
  for (let t of e) {
20443
20456
  if (!(t.weight > 0)) continue;
20444
20457
  let e = t.group ?? "", n = i.get(e);
20445
20458
  n ? n.push(t) : i.set(e, [t]);
20446
20459
  }
20447
- let a = [...i.keys()], o = o_(a.map((e, t) => ({
20460
+ let a = [...i.keys()], o = s_(a.map((e, t) => ({
20448
20461
  id: String(t),
20449
20462
  weight: i.get(e).reduce((e, t) => e + t.weight, 0)
20450
20463
  })), t, 0), s = [], c = [];
20451
20464
  for (let e of o) {
20452
20465
  let t = a[Number(e.id)], o = i.get(t), l = o.reduce((e, t) => e + t.weight, 0), u = o.reduce((e, t) => e + (Number.isFinite(t.value) ? t.value * t.weight : 0), 0), d = e.rect, f = t !== "" && d.height >= r * 2.5 && d.width >= 40 ? r : 0, p = {
20453
- x: d.x + s_ / 2,
20454
- y: d.y + s_ / 2 + f,
20455
- width: Math.max(0, d.width - s_),
20456
- height: Math.max(0, d.height - s_ - f)
20466
+ x: d.x + c_ / 2,
20467
+ y: d.y + c_ / 2 + f,
20468
+ width: Math.max(0, d.width - c_),
20469
+ height: Math.max(0, d.height - c_ - f)
20457
20470
  };
20458
20471
  s.push({
20459
20472
  name: t,
@@ -20461,14 +20474,14 @@ function l_(e, t, n, r = 18) {
20461
20474
  header: f,
20462
20475
  value: l > 0 ? u / l : 0,
20463
20476
  count: o.length
20464
- }), c.push(...o_(o, p, n));
20477
+ }), c.push(...s_(o, p, n));
20465
20478
  }
20466
20479
  return {
20467
20480
  groups: s,
20468
20481
  cells: c
20469
20482
  };
20470
20483
  }
20471
- var u_ = 10, d_ = 6, f_ = 16, p_ = 18, m_ = 8, h_ = 16, g_ = 15, __ = {
20484
+ var d_ = 10, f_ = 6, p_ = 16, m_ = 18, h_ = 8, g_ = 16, __ = 15, v_ = {
20472
20485
  min: 0,
20473
20486
  max: 1,
20474
20487
  step: .2,
@@ -20481,33 +20494,33 @@ var u_ = 10, d_ = 6, f_ = 16, p_ = 18, m_ = 8, h_ = 16, g_ = 15, __ = {
20481
20494
  1
20482
20495
  ]
20483
20496
  };
20484
- function v_(e) {
20485
- for (let t = 0; t <= g_; t++) {
20497
+ function y_(e) {
20498
+ for (let t = 0; t <= __; t++) {
20486
20499
  let n = e * 10 ** t, r = Math.round(n);
20487
20500
  if (r !== 0 && Math.abs(r - n) < 1e-9 * Math.abs(n)) return t;
20488
20501
  }
20489
- return g_;
20502
+ return __;
20490
20503
  }
20491
- var y_ = (e, t) => {
20504
+ var b_ = (e, t) => {
20492
20505
  let n = Number(e.toFixed(t));
20493
20506
  return n === 0 ? 0 : n;
20494
20507
  };
20495
- function b_(e, t, n = 5) {
20508
+ function x_(e, t, n = 5) {
20496
20509
  let r = Math.min(e, t), i = Math.max(e, t);
20497
20510
  if ((!Number.isFinite(r) || !Number.isFinite(i)) && (r = 0, i = 1), r === i) {
20498
20511
  let e = Math.abs(r) || 1;
20499
20512
  r -= e / 2, i += e / 2;
20500
20513
  }
20501
20514
  let a = (i / 2 - r / 2) / Math.max(1, n) * 2;
20502
- if (!Number.isFinite(a) || a <= 0) return __;
20515
+ if (!Number.isFinite(a) || a <= 0) return v_;
20503
20516
  let o = 10 ** Math.floor(Math.log10(a)), s = a / o, c = (s <= 1 ? 1 : s <= 2 ? 2 : s <= 2.5 ? 2.5 : s <= 5 ? 5 : 10) * o;
20504
- if (!Number.isFinite(c) || c <= 0) return __;
20505
- let l = v_(c), u = Math.floor(r / c + 1e-9), d = Math.ceil(i / c - 1e-9), f = [];
20506
- for (let e = u; e <= d; e++) f.push(y_(e * c, l));
20507
- return f.length < 2 || !f.every(Number.isFinite) ? __ : {
20517
+ if (!Number.isFinite(c) || c <= 0) return v_;
20518
+ let l = y_(c), u = Math.floor(r / c + 1e-9), d = Math.ceil(i / c - 1e-9), f = [];
20519
+ for (let e = u; e <= d; e++) f.push(b_(e * c, l));
20520
+ return f.length < 2 || !f.every(Number.isFinite) ? v_ : {
20508
20521
  min: f[0],
20509
20522
  max: f[f.length - 1],
20510
- step: y_(c, l),
20523
+ step: b_(c, l),
20511
20524
  ticks: f
20512
20525
  };
20513
20526
  }
@@ -20515,15 +20528,15 @@ function Z(e, t, n, r, i = !1) {
20515
20528
  let a = e.max === e.min ? .5 : (t - e.min) / (e.max - e.min);
20516
20529
  return i ? n + r * (1 - a) : n + r * a;
20517
20530
  }
20518
- var x_ = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), S_ = new Intl.NumberFormat(void 0, {
20531
+ var S_ = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), C_ = new Intl.NumberFormat(void 0, {
20519
20532
  notation: "compact",
20520
20533
  maximumFractionDigits: 1
20521
20534
  });
20522
- function C_(e) {
20523
- return Math.abs(e) >= 1e4 ? S_.format(e) : x_.format(e);
20535
+ function w_(e) {
20536
+ return Math.abs(e) >= 1e4 ? C_.format(e) : S_.format(e);
20524
20537
  }
20525
20538
  function Q(e) {
20526
- let t = v_(e.step), n = new Intl.NumberFormat(void 0, {
20539
+ let t = y_(e.step), n = new Intl.NumberFormat(void 0, {
20527
20540
  minimumFractionDigits: t,
20528
20541
  maximumFractionDigits: t
20529
20542
  });
@@ -20536,52 +20549,52 @@ function Q(e) {
20536
20549
  }
20537
20550
  return (e) => n.format(e);
20538
20551
  }
20539
- function w_(e, t) {
20552
+ function T_(e, t) {
20540
20553
  return t ?? ue[e % ue.length];
20541
20554
  }
20542
20555
  function $(e, t, n = "") {
20543
20556
  return `${n ? `${n} ` : ""}${t}px ${e.font.family}`;
20544
20557
  }
20545
- function T_(e, t) {
20558
+ function E_(e, t) {
20546
20559
  return (n, r = 11) => (e.font = $(t, r), e.measureText(n).width);
20547
20560
  }
20548
- function E_(e, t, n, r = !1) {
20561
+ function D_(e, t, n, r = !1) {
20549
20562
  let i = [], a = 0, o = 0;
20550
20563
  for (let s of e) {
20551
- let e = u_ + d_ + n(s.label, 11);
20564
+ let e = d_ + f_ + n(s.label, 11);
20552
20565
  a > 0 && (r || a + e > t) && (o++, a = 0), i.push({
20553
20566
  ...s,
20554
20567
  x: a,
20555
- y: o * p_
20556
- }), a += e + f_;
20568
+ y: o * m_
20569
+ }), a += e + p_;
20557
20570
  }
20558
20571
  let s = e.length === 0 ? 0 : o + 1;
20559
20572
  return {
20560
20573
  items: i,
20561
20574
  rows: s,
20562
- height: s * p_
20575
+ height: s * m_
20563
20576
  };
20564
20577
  }
20565
- function D_(e, t, n, r, i) {
20578
+ function O_(e, t, n, r, i) {
20566
20579
  e.save(), e.font = $(i, 11), e.textBaseline = "middle", e.textAlign = "left";
20567
20580
  for (let a of t.items) {
20568
- let t = r + a.y + p_ / 2;
20569
- e.fillStyle = a.color, e.fillRect(n + a.x, t - u_ / 2, u_, u_), e.fillStyle = i.textSecondary, e.fillText(a.label, n + a.x + u_ + d_, t);
20581
+ let t = r + a.y + m_ / 2;
20582
+ e.fillStyle = a.color, e.fillRect(n + a.x, t - d_ / 2, d_, d_), e.fillStyle = i.textSecondary, e.fillText(a.label, n + a.x + d_ + f_, t);
20570
20583
  }
20571
20584
  e.restore();
20572
20585
  }
20573
- function O_(e, t, n, r, i) {
20586
+ function k_(e, t, n, r, i) {
20574
20587
  if (t.length === 0) return;
20575
20588
  e.save();
20576
- let a = t.some((e) => e.color) ? u_ + d_ : 0, o = 0;
20589
+ let a = t.some((e) => e.color) ? d_ + f_ : 0, o = 0;
20577
20590
  for (let n of t) e.font = $(i, 11, n.bold ? "600" : ""), o = Math.max(o, e.measureText(n.text).width);
20578
- let s = o + a + m_ * 2, c = t.length * h_ + m_ * 2 - 4, l = n.x + 14, u = n.y + 14;
20591
+ let s = o + a + h_ * 2, c = t.length * g_ + h_ * 2 - 4, l = n.x + 14, u = n.y + 14;
20579
20592
  l + s > r.x + r.width && (l = n.x - 14 - s), u + c > r.y + r.height && (u = n.y - 14 - c), l = Math.max(r.x, l), u = Math.max(r.y, u), e.fillStyle = j(i.axisLabelBackground, .94), e.strokeStyle = i.grid, e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(l, u, s, c, 6) : e.rect(l, u, s, c), e.fill(), e.stroke(), e.textBaseline = "middle", e.textAlign = "left", t.forEach((t, n) => {
20580
- let r = u + m_ + n * h_ + h_ / 2 - 2;
20581
- t.color && (e.fillStyle = t.color, e.fillRect(l + m_, r - 4, 8, 8)), e.font = $(i, 11, t.bold ? "600" : ""), e.fillStyle = t.bold ? i.text : i.textSecondary, e.fillText(t.text, l + m_ + a, r);
20593
+ let r = u + h_ + n * g_ + g_ / 2 - 2;
20594
+ t.color && (e.fillStyle = t.color, e.fillRect(l + h_, r - 4, 8, 8)), e.font = $(i, 11, t.bold ? "600" : ""), e.fillStyle = t.bold ? i.text : i.textSecondary, e.fillText(t.text, l + h_ + a, r);
20582
20595
  }), e.restore();
20583
20596
  }
20584
- function k_(e, t, n, r, i, a) {
20597
+ function A_(e, t, n, r, i, a) {
20585
20598
  e.save(), e.font = $(i, 11), e.fillStyle = i.axisLabel, e.strokeStyle = i.grid, e.lineWidth = 1;
20586
20599
  for (let i of n.ticks) if (r === "vertical") {
20587
20600
  let r = Math.round(Z(n, i, t.y, t.height, !0)) + .5;
@@ -20592,7 +20605,7 @@ function k_(e, t, n, r, i, a) {
20592
20605
  }
20593
20606
  e.restore();
20594
20607
  }
20595
- function A_(e, t, n, r = 11) {
20608
+ function j_(e, t, n, r = 11) {
20596
20609
  if (n(e, r) <= t) return e;
20597
20610
  let i = e;
20598
20611
  for (; i.length > 1 && n(`${i}…`, r) > t;) i = i.slice(0, -1);
@@ -20600,13 +20613,13 @@ function A_(e, t, n, r = 11) {
20600
20613
  }
20601
20614
  //#endregion
20602
20615
  //#region src/finance/HeatmapRenderer.ts
20603
- function j_(e) {
20616
+ function M_(e) {
20604
20617
  return (e >= 0 ? "+" : "") + e.toFixed(2) + "%";
20605
20618
  }
20606
- function M_(e) {
20619
+ function N_(e) {
20607
20620
  return e.label;
20608
20621
  }
20609
- function N_(e, t) {
20622
+ function P_(e, t) {
20610
20623
  let n = t.min ?? -5, r = t.max ?? 5;
20611
20624
  if (e <= n) return t.negative;
20612
20625
  if (e >= r) return t.positive;
@@ -20617,11 +20630,11 @@ function N_(e, t) {
20617
20630
  let i = e / r;
20618
20631
  return be(t.zero, t.positive, i);
20619
20632
  }
20620
- function P_(e, t, n, r, i, a) {
20633
+ function F_(e, t, n, r, i, a) {
20621
20634
  let o = Math.min(a, r / 2, i / 2);
20622
20635
  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();
20623
20636
  }
20624
- function F_(e, t, n, r, i, a, o, s, c, l, u) {
20637
+ function I_(e, t, n, r, i, a, o, s, c, l, u) {
20625
20638
  if (i < 40 || a < 30) return;
20626
20639
  let d = n + i / 2, f = r + a / 2;
20627
20640
  if (e.save(), e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 2, e.fillStyle = "#FFFFFF", e.textAlign = "center", s) {
@@ -20634,16 +20647,16 @@ function F_(e, t, n, r, i, a, o, s, c, l, u) {
20634
20647
  }
20635
20648
  e.restore();
20636
20649
  }
20637
- function I_(e, t, n, r, i, a, o, s) {
20650
+ function L_(e, t, n, r, i, a, o, s) {
20638
20651
  let c = [o(t), s(t.value)];
20639
20652
  if (t.meta) for (let [e, n] of Object.entries(t.meta)) c.push(e + ": " + String(n));
20640
20653
  e.save(), e.font = a.font.sizeSmall + "px " + a.font.family;
20641
20654
  let l = Math.max(...c.map((t) => e.measureText(t).width)) + 16, u = a.font.sizeSmall + 4, d = c.length * u + 12, f = n.x + 14, p = n.y - d / 2;
20642
- f + l > r && (f = n.x - l - 14), p < 0 && (p = 0), p + d > i && (p = i - d), e.fillStyle = a.axisLabelBackground, e.globalAlpha = .92, P_(e, f, p, l, d, 4), e.fill(), e.globalAlpha = 1, e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
20655
+ f + l > r && (f = n.x - l - 14), p < 0 && (p = 0), p + d > i && (p = i - d), e.fillStyle = a.axisLabelBackground, e.globalAlpha = .92, F_(e, f, p, l, d, 4), e.fill(), e.globalAlpha = 1, e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
20643
20656
  for (let t = 0; t < c.length; t++) e.fillText(c[t], f + 8, p + 6 + t * u);
20644
20657
  e.restore();
20645
20658
  }
20646
- function L_(e, t, n, r, i, a, o, s, c = []) {
20659
+ function R_(e, t, n, r, i, a, o, s, c = []) {
20647
20660
  if (r.length === 0 || i.length === 0 || t <= 0 || n <= 0) return null;
20648
20661
  let l = a.colorScale, u = {
20649
20662
  negative: l?.negative ?? "#e8505b",
@@ -20651,7 +20664,7 @@ function L_(e, t, n, r, i, a, o, s, c = []) {
20651
20664
  positive: l?.positive ?? "#1fa874",
20652
20665
  min: l?.min,
20653
20666
  max: l?.max
20654
- }, d = a.cellRadius ?? 4, f = a.showLabels !== !1, p = a.showValues !== !1, m = a.valueFormat ?? j_, h = a.labelFormat ?? M_, g = /* @__PURE__ */ new Map();
20667
+ }, d = a.cellRadius ?? 4, f = a.showLabels !== !1, p = a.showValues !== !1, m = a.valueFormat ?? M_, h = a.labelFormat ?? N_, g = /* @__PURE__ */ new Map();
20655
20668
  for (let e of r) g.set(e.id, e);
20656
20669
  let _ = null, v = null;
20657
20670
  if (s) for (let e of i) {
@@ -20672,21 +20685,21 @@ function L_(e, t, n, r, i, a, o, s, c = []) {
20672
20685
  if (!n) continue;
20673
20686
  let { x: r, y: i, width: a, height: s } = t.rect;
20674
20687
  if (a <= 0 || s <= 0) continue;
20675
- let c = N_(n.value, u);
20676
- P_(e, r, i, a, s, d), e.fillStyle = c, e.fill(), F_(e, n, r, i, a, s, o, f, p, h, m), t.id === _ && (P_(e, r, i, a, s, d), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
20688
+ let c = P_(n.value, u);
20689
+ F_(e, r, i, a, s, d), e.fillStyle = c, e.fill(), I_(e, n, r, i, a, s, o, f, p, h, m), t.id === _ && (F_(e, r, i, a, s, d), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
20677
20690
  }
20678
- let y = s && !v ? c.find((e) => e.header > 0 && R_(e, s)) : void 0;
20679
- return z_(e, c, o, m, y), v && s ? I_(e, v.cell, s, t, n, o, h, m) : y && s && I_(e, {
20691
+ let y = s && !v ? c.find((e) => e.header > 0 && z_(e, s)) : void 0;
20692
+ return B_(e, c, o, m, y), v && s ? L_(e, v.cell, s, t, n, o, h, m) : y && s && L_(e, {
20680
20693
  id: "",
20681
20694
  label: y.name,
20682
20695
  value: y.value
20683
20696
  }, s, t, n, o, (e) => e.label, m), v;
20684
20697
  }
20685
- function R_(e, t) {
20698
+ function z_(e, t) {
20686
20699
  let n = e.rect;
20687
20700
  return t.x >= n.x && t.x <= n.x + n.width && t.y >= n.y && t.y <= n.y + e.header;
20688
20701
  }
20689
- function z_(e, t, n, r, i) {
20702
+ function B_(e, t, n, r, i) {
20690
20703
  if (t.length === 0) return;
20691
20704
  e.save(), e.textBaseline = "middle";
20692
20705
  let a = n.font.sizeSmall, o = (t) => e.measureText(t).width;
@@ -20696,37 +20709,37 @@ function z_(e, t, n, r, i) {
20696
20709
  e.font = a + "px " + n.font.family;
20697
20710
  let d = r(s.value), f = o(d), p = l >= f * 2 + 24;
20698
20711
  p && (e.textAlign = "right", e.fillStyle = s.value < 0 ? n.candleDown : s.value > 0 ? n.candleUp : n.textSecondary, e.fillText(d, t + l - 5, u)), e.font = "600 " + a + "px " + n.font.family, e.textAlign = "left", e.fillStyle = s === i ? n.text : n.textSecondary;
20699
- let m = l - 10 - (p ? f + 8 : 0), h = A_(s.name, m, (e) => o(e), a);
20712
+ let m = l - 10 - (p ? f + 8 : 0), h = j_(s.name, m, (e) => o(e), a);
20700
20713
  h && e.fillText(h, t + 5, u);
20701
20714
  }
20702
20715
  e.restore();
20703
20716
  }
20704
20717
  //#endregion
20705
20718
  //#region src/finance/WaterfallRenderer.ts
20706
- var B_ = 60, V_ = 12, H_ = 24, U_ = 40, W_ = .7, G_ = 1;
20707
- function K_(e) {
20719
+ var V_ = 60, H_ = 12, U_ = 24, W_ = 40, G_ = .7, K_ = 1;
20720
+ function q_(e) {
20708
20721
  return e.type ? e.type : e.value > 0 ? "positive" : e.value < 0 ? "negative" : "subtotal";
20709
20722
  }
20710
- function q_(e) {
20723
+ function J_(e) {
20711
20724
  let t = Math.abs(e);
20712
20725
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
20713
20726
  }
20714
- function J_(e, t) {
20727
+ function Y_(e, t) {
20715
20728
  return {
20716
- left: B_,
20717
- right: e - V_,
20718
- top: H_,
20719
- bottom: t - U_,
20720
- plotWidth: e - B_ - V_,
20721
- plotHeight: t - H_ - U_
20729
+ left: V_,
20730
+ right: e - H_,
20731
+ top: U_,
20732
+ bottom: t - W_,
20733
+ plotWidth: e - V_ - H_,
20734
+ plotHeight: t - U_ - W_
20722
20735
  };
20723
20736
  }
20724
- function Y_(e, t, n, r, i) {
20737
+ function X_(e, t, n, r, i) {
20725
20738
  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;
20726
20739
  for (let t = 0; t < e.length; t++) {
20727
- let n = e[t], m = K_(n), h, g;
20740
+ let n = e[t], m = q_(n), h, g;
20728
20741
  m === "total" || m === "subtotal" ? (h = 0, g = n.value, p = n.value) : (h = p, g = p + n.value, p = g);
20729
- 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), G_), C = u + t * s, w = C + l;
20742
+ 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), K_), C = u + t * s, w = C + l;
20730
20743
  a[t] = {
20731
20744
  label: n.label,
20732
20745
  value: n.value,
@@ -20746,14 +20759,14 @@ function Y_(e, t, n, r, i) {
20746
20759
  cumulatives: o
20747
20760
  };
20748
20761
  }
20749
- function X_(e) {
20762
+ function Z_(e) {
20750
20763
  if (e.length === 0) return {
20751
20764
  valMin: 0,
20752
20765
  valMax: 1
20753
20766
  };
20754
20767
  let t = 0, n = 0, r = 0;
20755
20768
  for (let i = 0; i < e.length; i++) {
20756
- let a = e[i], o = K_(a), s, c;
20769
+ let a = e[i], o = q_(a), s, c;
20757
20770
  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);
20758
20771
  }
20759
20772
  let i = (n - t || 1) * .1;
@@ -20762,10 +20775,10 @@ function X_(e) {
20762
20775
  valMax: n + i
20763
20776
  };
20764
20777
  }
20765
- function Z_(e, t, n, r) {
20778
+ function Q_(e, t, n, r) {
20766
20779
  e.fillStyle = r, e.fillRect(0, 0, t, n);
20767
20780
  }
20768
- function Q_(e, t, n, r, i, a) {
20781
+ function $_(e, t, n, r, i, a) {
20769
20782
  let { left: o, right: s, top: c, bottom: l, plotHeight: u } = t, d = r - n || 1;
20770
20783
  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";
20771
20784
  let f = ge(n, r, 5), p = Math.ceil(n / f) * f;
@@ -20784,7 +20797,7 @@ function Q_(e, t, n, r, i, a) {
20784
20797
  e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(o, t), e.lineTo(s, t), e.stroke();
20785
20798
  }
20786
20799
  }
20787
- function $_(e, t, n) {
20800
+ function ev(e, t, n) {
20788
20801
  let r = [
20789
20802
  "positive",
20790
20803
  "negative",
@@ -20803,7 +20816,7 @@ function $_(e, t, n) {
20803
20816
  s && (e.fillStyle = o, e.fill());
20804
20817
  }
20805
20818
  }
20806
- function ev(e, t, n, r, i, a, o) {
20819
+ function tv(e, t, n, r, i, a, o) {
20807
20820
  if (o === "none" || t.length < 2) return;
20808
20821
  let { bottom: s, plotHeight: c } = n;
20809
20822
  e.strokeStyle = a, e.lineWidth = 1, o === "dashed" ? e.setLineDash([4, 4]) : e.setLineDash([]), e.beginPath();
@@ -20813,7 +20826,7 @@ function ev(e, t, n, r, i, a, o) {
20813
20826
  }
20814
20827
  e.stroke(), e.setLineDash([]);
20815
20828
  }
20816
- function tv(e, t, n, r, i, a) {
20829
+ function nv(e, t, n, r, i, a) {
20817
20830
  e.fillStyle = r.text, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center";
20818
20831
  for (let r = 0; r < t.length; r++) {
20819
20832
  let o = t[r], s;
@@ -20822,7 +20835,7 @@ function tv(e, t, n, r, i, a) {
20822
20835
  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));
20823
20836
  }
20824
20837
  }
20825
- function nv(e, t, n, r, i) {
20838
+ function rv(e, t, n, r, i) {
20826
20839
  e.fillStyle = r.axisLabel, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "top";
20827
20840
  let a = n.bottom + 6, o = t.length > 0 ? t[0].slotW - 4 : 0, s = !1;
20828
20841
  for (let n = 0; n < t.length; n++) if (e.measureText(i(t[n].label)).width > o) {
@@ -20843,7 +20856,7 @@ function nv(e, t, n, r, i) {
20843
20856
  }
20844
20857
  e.setTransform(1, 0, 0, 1, 0, 0), e.restore();
20845
20858
  }
20846
- function rv(e, t, n) {
20859
+ function iv(e, t, n) {
20847
20860
  if (t < n.left || t > n.right) return null;
20848
20861
  for (let n = 0; n < e.length; n++) {
20849
20862
  let r = e[n];
@@ -20851,7 +20864,7 @@ function rv(e, t, n) {
20851
20864
  }
20852
20865
  return null;
20853
20866
  }
20854
- function iv(e, t, n, r, i, a, o, s) {
20867
+ function av(e, t, n, r, i, a, o, s) {
20855
20868
  let c = t[r], l = n[r], u = Math.round(c.slotX + c.slotW / 2) + .5;
20856
20869
  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([]);
20857
20870
  let d = [
@@ -20870,37 +20883,37 @@ function iv(e, t, n, r, i, a, o, s) {
20870
20883
  let _ = o.font.sizeSmall + 4;
20871
20884
  for (let t = 0; t < d.length; t++) e.fillText(d[t], h + 8, g + 6 + t * _);
20872
20885
  }
20873
- function av(e, t, n, r, i, a) {
20886
+ function ov(e, t, n, r, i, a) {
20874
20887
  let { data: o } = r;
20875
20888
  if (!o || o.length === 0 || t <= 0 || n <= 0) return { hitBar: null };
20876
- 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 ?? W_, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? q_, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = X_(o), b = y - v || 1, x = J_(t, n), { bars: S, cumulatives: C } = Y_(o, x, p, v, b);
20877
- Z_(e, t, n, i.background), Q_(e, x, v, y, i, g), ev(e, S, x, v, b, d, f), $_(e, S, {
20889
+ 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 ?? G_, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? J_, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = Z_(o), b = y - v || 1, x = Y_(t, n), { bars: S, cumulatives: C } = X_(o, x, p, v, b);
20890
+ Q_(e, t, n, i.background), $_(e, x, v, y, i, g), tv(e, S, x, v, b, d, f), ev(e, S, {
20878
20891
  positive: s,
20879
20892
  negative: c,
20880
20893
  total: l,
20881
20894
  subtotal: u
20882
- }), m && tv(e, S, C, i, g, h), nv(e, S, x, i, _);
20883
- let w = a ? rv(S, a.x, x) : null;
20884
- return a && w !== null && iv(e, S, C, w, a, x, i, g), { hitBar: w };
20895
+ }), m && nv(e, S, C, i, g, h), rv(e, S, x, i, _);
20896
+ let w = a ? iv(S, a.x, x) : null;
20897
+ return a && w !== null && av(e, S, C, w, a, x, i, g), { hitBar: w };
20885
20898
  }
20886
20899
  //#endregion
20887
20900
  //#region src/finance/GaugeRenderer.ts
20888
- var ov = Math.PI / 180, sv = 150, cv = 240, lv = 90, uv = .14, dv = 1.6 * ov, fv = .22, pv = 8, mv = 18, hv = 16, gv = 6.5, _v = 20, vv = 5, yv = 28;
20889
- function bv(e, t, n) {
20901
+ var sv = Math.PI / 180, cv = 150, lv = 240, uv = 90, dv = .14, fv = 1.6 * sv, pv = .22, mv = 8, hv = 18, gv = 16, _v = 6.5, vv = 20, yv = 5, bv = 28;
20902
+ function xv(e, t, n) {
20890
20903
  return e < t ? t : e > n ? n : e;
20891
20904
  }
20892
- function xv(e) {
20905
+ function Sv(e) {
20893
20906
  let t = Math.abs(e);
20894
20907
  return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
20895
20908
  }
20896
- function Sv(e) {
20897
- let t = Number.isFinite(e.startAngle) ? e.startAngle : sv, n = (Number.isFinite(e.endAngle) ? e.endAngle : t + cv) - t;
20898
- return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n = bv(n, lv, 360), {
20899
- start: (t % 360 + 360) % 360 * ov,
20900
- sweep: n * ov
20909
+ function Cv(e) {
20910
+ let t = Number.isFinite(e.startAngle) ? e.startAngle : cv, n = (Number.isFinite(e.endAngle) ? e.endAngle : t + lv) - t;
20911
+ return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n = xv(n, uv, 360), {
20912
+ start: (t % 360 + 360) % 360 * sv,
20913
+ sweep: n * sv
20901
20914
  };
20902
20915
  }
20903
- function Cv(e, t) {
20916
+ function wv(e, t) {
20904
20917
  let n = Math.min(Math.cos(e), Math.cos(t)), r = Math.max(Math.cos(e), Math.cos(t)), i = Math.min(Math.sin(e), Math.sin(t)), a = Math.max(Math.sin(e), Math.sin(t));
20905
20918
  for (let o = Math.ceil(e / (Math.PI / 2)); Math.PI / 2 * o <= t; o++) {
20906
20919
  let e = Math.PI / 2 * o;
@@ -20913,15 +20926,15 @@ function Cv(e, t) {
20913
20926
  maxY: a
20914
20927
  };
20915
20928
  }
20916
- function wv(e) {
20929
+ function Tv(e) {
20917
20930
  if (e.showZoneLabels !== !0 || !e.zones) return 0;
20918
20931
  let t = e.zones.reduce((e, t) => Math.max(e, t.label?.length ?? 0), 0);
20919
- return t > 0 ? t * gv + 12 : 0;
20932
+ return t > 0 ? t * _v + 12 : 0;
20920
20933
  }
20921
- function Tv(e, t, n) {
20934
+ function Ev(e, t, n) {
20922
20935
  let r = Number.isFinite(n.min) ? n.min : 0, i = Number.isFinite(n.max) ? n.max : 100;
20923
20936
  i - r > Math.abs(r) * 1e-9 || (i = r + Math.max(1, Math.abs(r) * 1e-6));
20924
- let { start: a, sweep: o } = Sv(n), s = a, c = a + o, l = bv(n.thickness ?? uv, .04, .5), u = Cv(s, c), d = Math.max(u.maxY, .18), f = wv(n), p = f > 0 ? hv : 0, m = Math.max(1, e - 2 * pv - 2 * f), h = Math.max(1, t - 2 * pv - mv - p), g = 1 + l / 2, _ = Math.max(8, Math.min(m / ((u.maxX - u.minX) * g), h / ((d - u.minY) * g))), v = _ * l, y = (d - u.minY) * _ * g + mv + p, b = e / 2 - (u.maxX + u.minX) / 2 * _, x = (t - y) / 2 + p - u.minY * _ * g, S = _ - v / 2, C = Math.max(11, Math.round(S * .46)), w = u.maxY > .3 ? x - C * .12 : x - C * .55, T = Math.max(Math.sin(s), Math.sin(c)), E = T > .2 ? x + T * _ + v / 2 + 2 : Infinity, D = Math.min(t - pv, E);
20937
+ let { start: a, sweep: o } = Cv(n), s = a, c = a + o, l = xv(n.thickness ?? dv, .04, .5), u = wv(s, c), d = Math.max(u.maxY, .18), f = Tv(n), p = f > 0 ? gv : 0, m = Math.max(1, e - 2 * mv - 2 * f), h = Math.max(1, t - 2 * mv - hv - p), g = 1 + l / 2, _ = Math.max(8, Math.min(m / ((u.maxX - u.minX) * g), h / ((d - u.minY) * g))), v = _ * l, y = (d - u.minY) * _ * g + hv + p, b = e / 2 - (u.maxX + u.minX) / 2 * _, x = (t - y) / 2 + p - u.minY * _ * g, S = _ - v / 2, C = Math.max(11, Math.round(S * .46)), w = u.maxY > .3 ? x - C * .12 : x - C * .55, T = Math.max(Math.sin(s), Math.sin(c)), E = T > .2 ? x + T * _ + v / 2 + 2 : Infinity, D = Math.min(t - mv, E);
20925
20938
  return {
20926
20939
  cx: b,
20927
20940
  cy: x,
@@ -20936,20 +20949,20 @@ function Tv(e, t, n) {
20936
20949
  textBottom: D
20937
20950
  };
20938
20951
  }
20939
- function Ev(e, t) {
20940
- let n = Number.isFinite(e) ? bv((e - t.min) / (t.max - t.min), 0, 1) : 0;
20952
+ function Dv(e, t) {
20953
+ let n = Number.isFinite(e) ? xv((e - t.min) / (t.max - t.min), 0, 1) : 0;
20941
20954
  return t.startAngle + (t.endAngle - t.startAngle) * n;
20942
20955
  }
20943
- function Dv(e, t) {
20956
+ function Ov(e, t) {
20944
20957
  if (!t || !Number.isFinite(e)) return;
20945
20958
  let n;
20946
20959
  for (let r of t) e >= r.from && e <= r.to && (n = r);
20947
20960
  return n;
20948
20961
  }
20949
- function Ov(e, t, n) {
20962
+ function kv(e, t, n) {
20950
20963
  let r = (t ?? []).map((t) => ({
20951
- a0: Ev(t.from, e),
20952
- a1: Ev(t.to, e),
20964
+ a0: Dv(t.from, e),
20965
+ a1: Dv(t.to, e),
20953
20966
  color: t.color,
20954
20967
  track: !1
20955
20968
  })).filter((e) => e.a1 > e.a0).sort((e, t) => e.a0 - t.a0), i = [], a = e.startAngle;
@@ -20969,70 +20982,70 @@ function Ov(e, t, n) {
20969
20982
  track: !0
20970
20983
  }), i;
20971
20984
  }
20972
- function kv(e, t, n, r, i) {
20985
+ function Av(e, t, n, r, i) {
20973
20986
  r <= n || (e.beginPath(), e.arc(t.cx, t.cy, t.radius, n, r, !1), e.lineWidth = t.thickness, e.lineCap = "butt", e.strokeStyle = i, e.stroke());
20974
20987
  }
20975
- function Av(e, t, n, r, i, a) {
20988
+ function jv(e, t, n, r, i, a) {
20976
20989
  let o = t.cx + Math.cos(n) * t.radius, s = t.cy + Math.sin(n) * t.radius, c = a === "start" ? n - Math.PI : n;
20977
20990
  e.globalAlpha = i, e.beginPath(), e.arc(o, s, t.thickness / 2, c, c + (i >= 1 ? Math.PI * 2 : Math.PI), !1), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1;
20978
20991
  }
20979
- function jv(e, t, n, r, i, a) {
20980
- let o = Ov(t, n, i), s = o.some((e) => !e.track);
20992
+ function Mv(e, t, n, r, i, a) {
20993
+ let o = kv(t, n, i), s = o.some((e) => !e.track);
20981
20994
  o.forEach((n, i) => {
20982
- let a = i > 0 && !n.track && !o[i - 1].track ? dv / 2 : 0, s = i < o.length - 1 && !n.track && !o[i + 1].track ? dv / 2 : 0, c = n.a0 + a, l = n.a1 - s;
20995
+ let a = i > 0 && !n.track && !o[i - 1].track ? fv / 2 : 0, s = i < o.length - 1 && !n.track && !o[i + 1].track ? fv / 2 : 0, c = n.a0 + a, l = n.a1 - s;
20983
20996
  if (n.track) {
20984
- kv(e, t, c, l, n.color);
20997
+ Av(e, t, c, l, n.color);
20985
20998
  return;
20986
20999
  }
20987
- e.globalAlpha = fv, kv(e, t, c, l, n.color), e.globalAlpha = 1, kv(e, t, c, Math.min(l, r), n.color);
20988
- }), s || kv(e, t, t.startAngle, r, a);
20989
- let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 : fv], [d, f] = u(o[0], c), [p, m] = u(o[o.length - 1], l);
20990
- Av(e, t, t.startAngle, d, f, "start"), Av(e, t, t.endAngle, p, m, "end");
21000
+ e.globalAlpha = pv, Av(e, t, c, l, n.color), e.globalAlpha = 1, Av(e, t, c, Math.min(l, r), n.color);
21001
+ }), s || Av(e, t, t.startAngle, r, a);
21002
+ let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 : pv], [d, f] = u(o[0], c), [p, m] = u(o[o.length - 1], l);
21003
+ jv(e, t, t.startAngle, d, f, "start"), jv(e, t, t.endAngle, p, m, "end");
20991
21004
  }
20992
- function Mv(e, t, n) {
21005
+ function Nv(e, t, n) {
20993
21006
  let r = t.radius - t.thickness / 2;
20994
- if (r < yv) return;
21007
+ if (r < bv) return;
20995
21008
  let i = Math.max(4, t.thickness * .45);
20996
21009
  e.strokeStyle = n, e.lineCap = "butt";
20997
- for (let n = 0; n <= _v; n++) {
20998
- let a = n % vv === 0, o = t.startAngle + (t.endAngle - t.startAngle) * n / _v, s = r - i, c = s - (a ? Math.max(6, t.thickness * .55) : Math.max(3, t.thickness * .3));
21010
+ for (let n = 0; n <= vv; n++) {
21011
+ let a = n % yv === 0, o = t.startAngle + (t.endAngle - t.startAngle) * n / vv, s = r - i, c = s - (a ? Math.max(6, t.thickness * .55) : Math.max(3, t.thickness * .3));
20999
21012
  e.globalAlpha = a ? .55 : .3, e.lineWidth = a ? 1.5 : 1, e.beginPath(), e.moveTo(t.cx + Math.cos(o) * s, t.cy + Math.sin(o) * s), e.lineTo(t.cx + Math.cos(o) * c, t.cy + Math.sin(o) * c), e.stroke();
21000
21013
  }
21001
21014
  e.globalAlpha = 1;
21002
21015
  }
21003
- function Nv(e, t, n, r, i) {
21016
+ function Pv(e, t, n, r, i) {
21004
21017
  let a = t.cx + Math.cos(n) * t.radius, o = t.cy + Math.sin(n) * t.radius;
21005
21018
  e.beginPath(), e.arc(a, o, t.thickness * .78, 0, Math.PI * 2), e.fillStyle = r, e.fill(), e.lineWidth = Math.max(2, t.thickness * .32), e.strokeStyle = i, e.stroke();
21006
21019
  }
21007
- function Pv(e, t, n, r, i) {
21020
+ function Fv(e, t, n, r, i) {
21008
21021
  let a = Math.cos(n), o = Math.sin(n), s = t.radius - t.thickness * .9, c = Math.max(6, t.thickness * .6), l = Math.max(1.5, t.thickness * .14);
21009
21022
  e.beginPath(), e.moveTo(t.cx + a * s, t.cy + o * s), e.lineTo(t.cx - o * l - a * c, t.cy + a * l - o * c), e.lineTo(t.cx + o * l - a * c, t.cy - a * l - o * c), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.thickness * .42), 0, Math.PI * 2), e.fill(), e.lineWidth = 2, e.strokeStyle = i, e.stroke();
21010
21023
  }
21011
- function Fv(e, t, n, r, i, a, o) {
21024
+ function Iv(e, t, n, r, i, a, o) {
21012
21025
  e.font = `${n} ${r}px ${i}`;
21013
21026
  let s = e.measureText(t).width;
21014
21027
  if (s <= a) return r;
21015
21028
  let c = Math.floor(r * a / s);
21016
21029
  return c < o ? 0 : (e.font = `${n} ${c}px ${i}`, c);
21017
21030
  }
21018
- function Iv(e, t, n, r, i, a, o) {
21031
+ function Lv(e, t, n, r, i, a, o) {
21019
21032
  let s = a.font.family, c = (t.radius - t.thickness / 2) * 1.3, l = a.font.sizeSmall;
21020
21033
  e.textAlign = "center", e.textBaseline = "middle";
21021
- let u = Fv(e, n, "600", t.valueSize, s, c, l);
21034
+ let u = Iv(e, n, "600", t.valueSize, s, c, l);
21022
21035
  if (u === 0) return;
21023
21036
  let d = o ? Math.min(t.cy + u * .8, t.textBottom - u / 2) : t.valueY;
21024
21037
  e.fillStyle = a.text, e.fillText(n, t.cx, d);
21025
21038
  let f = Math.max(l, Math.round(u * .26));
21026
21039
  if (i?.label && !o) {
21027
21040
  let n = i.label.toUpperCase();
21028
- Fv(e, n, "600", f, s, c * .9, l) > 0 && (e.fillStyle = i.color, e.fillText(n, t.cx, d - u * .78));
21041
+ Iv(e, n, "600", f, s, c * .9, l) > 0 && (e.fillStyle = i.color, e.fillText(n, t.cx, d - u * .78));
21029
21042
  }
21030
21043
  if (r) {
21031
21044
  let n = d + u * .72;
21032
- n + f / 2 <= t.textBottom && Fv(e, r, "400", f, s, c, l) > 0 && (e.fillStyle = a.textSecondary, e.fillText(r, t.cx, n));
21045
+ n + f / 2 <= t.textBottom && Iv(e, r, "400", f, s, c, l) > 0 && (e.fillStyle = a.textSecondary, e.fillText(r, t.cx, n));
21033
21046
  }
21034
21047
  }
21035
- function Lv(e, t, n, r) {
21048
+ function Rv(e, t, n, r) {
21036
21049
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall + 1}px ${r.font.family}`;
21037
21050
  let i = t.thickness / 2 + 6;
21038
21051
  for (let [r, a] of [[t.startAngle, t.min], [t.endAngle, t.max]]) {
@@ -21040,24 +21053,24 @@ function Lv(e, t, n, r) {
21040
21053
  s > .2 ? (e.textAlign = "center", e.textBaseline = "top", e.fillText(n(a), c, l + i)) : (e.textAlign = o < -.2 ? "right" : o > .2 ? "left" : "center", e.textBaseline = s < -.2 ? "bottom" : "middle", e.fillText(n(a), c + o * i, l + s * i));
21041
21054
  }
21042
21055
  }
21043
- function Rv(e, t, n, r) {
21056
+ function zv(e, t, n, r) {
21044
21057
  e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textBaseline = "middle";
21045
21058
  let i = t.radius + t.thickness / 2 + 8;
21046
21059
  for (let r of n) {
21047
21060
  if (!r.label) continue;
21048
- let n = Ev((bv(r.from, t.min, t.max) + bv(r.to, t.min, t.max)) / 2, t), a = Math.cos(n);
21061
+ let n = Dv((xv(r.from, t.min, t.max) + xv(r.to, t.min, t.max)) / 2, t), a = Math.cos(n);
21049
21062
  e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(r.label, t.cx + a * i, t.cy + Math.sin(n) * i);
21050
21063
  }
21051
21064
  }
21052
- function zv(e, t, n, r, i, a) {
21065
+ function Bv(e, t, n, r, i, a) {
21053
21066
  if (t <= 0 || n <= 0) return;
21054
- let o = Tv(t, n, r), s = Number.isFinite(a), c = s ? bv(a, o.min, o.max) : o.min, l = Ev(c, o), u = s ? Dv(c, r.zones) : void 0, d = r.pointer === "needle", f = r.valueFormat ?? xv, p = u?.color ?? r.needleColor ?? i.lineColor;
21055
- e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), jv(e, o, r.zones, l, r.trackColor ?? i.grid, p), Mv(e, o, i.textSecondary), s && (d ? Pv(e, o, l, r.needleColor ?? i.text, i.background) : Nv(e, o, l, p, i.background)), r.showValue !== !1 && Iv(e, o, s ? f(c) : "—", r.label, u, i, d), Lv(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && Rv(e, o, r.zones, i), e.restore();
21067
+ let o = Ev(t, n, r), s = Number.isFinite(a), c = s ? xv(a, o.min, o.max) : o.min, l = Dv(c, o), u = s ? Ov(c, r.zones) : void 0, d = r.pointer === "needle", f = r.valueFormat ?? Sv, p = u?.color ?? r.needleColor ?? i.lineColor;
21068
+ e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), Mv(e, o, r.zones, l, r.trackColor ?? i.grid, p), Nv(e, o, i.textSecondary), s && (d ? Fv(e, o, l, r.needleColor ?? i.text, i.background) : Pv(e, o, l, p, i.background)), r.showValue !== !1 && Lv(e, o, s ? f(c) : "—", r.label, u, i, d), Rv(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && zv(e, o, r.zones, i), e.restore();
21056
21069
  }
21057
21070
  //#endregion
21058
21071
  //#region src/finance/BarChartRenderer.ts
21059
- var Bv = 12, Vv = .72, Hv = 20, Uv = .35;
21060
- function Wv(e) {
21072
+ var Vv = 12, Hv = .72, Uv = 20, Wv = .35;
21073
+ function Gv(e) {
21061
21074
  let t = 0, n = 0, r = e.mode === "stacked";
21062
21075
  return e.categories.forEach((i, a) => {
21063
21076
  let o = 0, s = 0;
@@ -21068,43 +21081,43 @@ function Wv(e) {
21068
21081
  n = Math.max(n, o), t = Math.min(t, s);
21069
21082
  }), [t, n];
21070
21083
  }
21071
- function Gv(e, t) {
21084
+ function Kv(e, t) {
21072
21085
  let n = e.colorBySign;
21073
21086
  return n ? n === !0 ? {
21074
21087
  positive: t.candleUp,
21075
21088
  negative: t.candleDown
21076
21089
  } : n : null;
21077
21090
  }
21078
- function Kv(e, t, n, r, i) {
21079
- let a = e.orientation === "horizontal", o = e.legend ?? e.series.length > 1 ? E_(e.series.map((e, t) => ({
21091
+ function qv(e, t, n, r, i) {
21092
+ let a = e.orientation === "horizontal", o = e.legend ?? e.series.length > 1 ? D_(e.series.map((e, t) => ({
21080
21093
  label: e.name,
21081
- color: w_(t, e.color)
21082
- })), t - Bv * 2, i) : null, s = Bv + (o ? o.height + 6 : 0), [c, l] = Wv(e), u = b_(c, l, a ? Math.max(2, Math.floor(t / 110)) : 5), d = e.valueFormat ?? Q(u), f = Math.max(0, ...u.ticks.map((e) => i(d(e), 11))), p;
21094
+ color: T_(t, e.color)
21095
+ })), t - Vv * 2, i) : null, s = Vv + (o ? o.height + 6 : 0), [c, l] = Gv(e), u = x_(c, l, a ? Math.max(2, Math.floor(t / 110)) : 5), d = e.valueFormat ?? Q(u), f = Math.max(0, ...u.ticks.map((e) => i(d(e), 11))), p;
21083
21096
  if (a) {
21084
- let r = Bv + Math.min(t * Uv, Math.max(0, ...e.categories.map((e) => i(e, 11)))) + 8;
21097
+ let r = Vv + Math.min(t * Wv, Math.max(0, ...e.categories.map((e) => i(e, 11)))) + 8;
21085
21098
  p = {
21086
21099
  x: r,
21087
21100
  y: s,
21088
- width: Math.max(1, t - r - Bv - f / 2),
21089
- height: Math.max(1, n - s - Bv - Hv)
21101
+ width: Math.max(1, t - r - Vv - f / 2),
21102
+ height: Math.max(1, n - s - Vv - Uv)
21090
21103
  };
21091
21104
  } else {
21092
- let e = Bv + f + 8;
21105
+ let e = Vv + f + 8;
21093
21106
  p = {
21094
21107
  x: e,
21095
21108
  y: s,
21096
- width: Math.max(1, t - e - Bv),
21097
- height: Math.max(1, n - s - Bv - Hv)
21109
+ width: Math.max(1, t - e - Vv),
21110
+ height: Math.max(1, n - s - Vv - Uv)
21098
21111
  };
21099
21112
  }
21100
- let m = Math.max(1, e.categories.length), h = a ? p.y : p.x, g = (a ? p.height : p.width) / m, _ = g * Vv, v = e.mode === "stacked", y = v ? _ : _ / Math.max(1, e.series.length), b = (e) => a ? Z(u, e, p.x, p.width) : Z(u, e, p.y, p.height, !0), x = b(0), S = Gv(e, r), C = Array(m).fill(0), w = Array(m).fill(0), T = [];
21113
+ let m = Math.max(1, e.categories.length), h = a ? p.y : p.x, g = (a ? p.height : p.width) / m, _ = g * Hv, v = e.mode === "stacked", y = v ? _ : _ / Math.max(1, e.series.length), b = (e) => a ? Z(u, e, p.x, p.width) : Z(u, e, p.y, p.height, !0), x = b(0), S = Kv(e, r), C = Array(m).fill(0), w = Array(m).fill(0), T = [];
21101
21114
  return e.series.forEach((t, n) => {
21102
21115
  e.categories.forEach((e, r) => {
21103
21116
  let i = t.values[r];
21104
21117
  if (!Number.isFinite(i)) return;
21105
21118
  let o = 0;
21106
21119
  v && (o = i >= 0 ? C[r] : w[r], i >= 0 ? C[r] += i : w[r] += i);
21107
- let s = b(o), c = b(o + i), l = h + r * g + (g - _) / 2 + (v ? 0 : n * y), u = S ? i >= 0 ? S.positive : S.negative : w_(n, t.color), d = Math.min(s, c), f = Math.abs(c - s);
21120
+ let s = b(o), c = b(o + i), l = h + r * g + (g - _) / 2 + (v ? 0 : n * y), u = S ? i >= 0 ? S.positive : S.negative : T_(n, t.color), d = Math.min(s, c), f = Math.abs(c - s);
21108
21121
  T.push(a ? {
21109
21122
  x: d,
21110
21123
  y: l,
@@ -21136,23 +21149,23 @@ function Kv(e, t, n, r, i) {
21136
21149
  bandStart: h,
21137
21150
  band: g,
21138
21151
  legend: o,
21139
- legendY: Bv
21152
+ legendY: Vv
21140
21153
  };
21141
21154
  }
21142
- function qv(e, t, n) {
21155
+ function Jv(e, t, n) {
21143
21156
  for (let r of e.bars) if (t >= r.x - 2 && t <= r.x + r.width + 2 && n >= r.y - 2 && n <= r.y + r.height + 2) return r;
21144
21157
  return null;
21145
21158
  }
21146
- function Jv(e, t, n, r) {
21159
+ function Yv(e, t, n, r) {
21147
21160
  let { plot: i } = e;
21148
21161
  if (t < i.x || t > i.x + i.width || n < i.y || n > i.y + i.height) return -1;
21149
21162
  let a = e.orientation === "horizontal" ? n : t, o = Math.floor((a - e.bandStart) / e.band);
21150
21163
  return o >= 0 && o < r ? o : -1;
21151
21164
  }
21152
- function Yv(e, t, n, r, i, a, o = Kv(r, t, n, i, T_(e, i))) {
21153
- let s = T_(e, i), c = r.valueFormat ?? C_, { plot: l, orientation: u } = o, d = u === "horizontal";
21154
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && D_(e, o.legend, Bv, o.legendY, i), k_(e, l, o.scale, d ? "horizontal" : "vertical", i, r.valueFormat ?? Q(o.scale));
21155
- let f = a && r.crosshair !== !1 ? Jv(o, a.x, a.y, r.categories.length) : -1;
21165
+ function Xv(e, t, n, r, i, a, o = qv(r, t, n, i, E_(e, i))) {
21166
+ let s = E_(e, i), c = r.valueFormat ?? w_, { plot: l, orientation: u } = o, d = u === "horizontal";
21167
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && O_(e, o.legend, Vv, o.legendY, i), A_(e, l, o.scale, d ? "horizontal" : "vertical", i, r.valueFormat ?? Q(o.scale));
21168
+ let f = a && r.crosshair !== !1 ? Yv(o, a.x, a.y, r.categories.length) : -1;
21156
21169
  if (f >= 0) {
21157
21170
  e.fillStyle = j(i.crosshair, .08);
21158
21171
  let t = o.bandStart + f * o.band;
@@ -21161,7 +21174,7 @@ function Yv(e, t, n, r, i, a, o = Kv(r, t, n, i, T_(e, i))) {
21161
21174
  for (let t of o.bars) e.fillStyle = t.color, e.fillRect(t.x, t.y, Math.max(t.width, +!!d), Math.max(t.height, +!d));
21162
21175
  e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath();
21163
21176
  let p = Math.round(o.zero) + .5;
21164
- if (d ? (e.moveTo(p, l.y), e.lineTo(p, l.y + l.height)) : (e.moveTo(l.x, p), e.lineTo(l.x + l.width, p)), e.stroke(), Xv(e, r.categories, o, i, s), r.showValues && Zv(e, o, i, c, r.mode === "stacked"), f >= 0 && a) {
21177
+ if (d ? (e.moveTo(p, l.y), e.lineTo(p, l.y + l.height)) : (e.moveTo(l.x, p), e.lineTo(l.x + l.width, p)), e.stroke(), Zv(e, r.categories, o, i, s), r.showValues && Qv(e, o, i, c, r.mode === "stacked"), f >= 0 && a) {
21165
21178
  let s = [{
21166
21179
  text: r.categories[f],
21167
21180
  bold: !0
@@ -21170,7 +21183,7 @@ function Yv(e, t, n, r, i, a, o = Kv(r, t, n, i, T_(e, i))) {
21170
21183
  text: `${e.series}: ${c(e.value)}`,
21171
21184
  color: e.color
21172
21185
  });
21173
- O_(e, s, a, {
21186
+ k_(e, s, a, {
21174
21187
  x: 0,
21175
21188
  y: 0,
21176
21189
  width: t,
@@ -21179,17 +21192,17 @@ function Yv(e, t, n, r, i, a, o = Kv(r, t, n, i, T_(e, i))) {
21179
21192
  }
21180
21193
  return o;
21181
21194
  }
21182
- function Xv(e, t, n, r, i) {
21195
+ function Zv(e, t, n, r, i) {
21183
21196
  let { plot: a } = n;
21184
21197
  e.save(), e.font = $(r, 11), e.fillStyle = r.axisLabel;
21185
21198
  let o = Math.max(0, ...t.map((e) => i(e, 11))), s = n.orientation === "vertical" ? Math.max(1, Math.ceil((o + 8) / Math.max(1, n.band))) : 1;
21186
21199
  t.forEach((t, r) => {
21187
21200
  if (r % s !== 0) return;
21188
21201
  let o = n.bandStart + (r + .5) * n.band;
21189
- n.orientation === "horizontal" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(A_(t, a.x - Bv - 8, i), a.x - 8, o)) : (e.textAlign = "center", e.textBaseline = "top", e.fillText(A_(t, n.band * s - 4, i), o, a.y + a.height + 6));
21202
+ n.orientation === "horizontal" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(j_(t, a.x - Vv - 8, i), a.x - 8, o)) : (e.textAlign = "center", e.textBaseline = "top", e.fillText(j_(t, n.band * s - 4, i), o, a.y + a.height + 6));
21190
21203
  }), e.restore();
21191
21204
  }
21192
- function Zv(e, t, n, r, i) {
21205
+ function Qv(e, t, n, r, i) {
21193
21206
  e.save(), e.font = $(n, 10), e.fillStyle = n.textSecondary;
21194
21207
  for (let n of t.bars) {
21195
21208
  let a = r(n.value);
@@ -21207,23 +21220,23 @@ function Zv(e, t, n, r, i) {
21207
21220
  }
21208
21221
  //#endregion
21209
21222
  //#region src/finance/DonutRenderer.ts
21210
- var Qv = 12, $v = -Math.PI / 2, ey = Math.PI * 2, ty = 5, ny = 1.4, ry = 18, iy = new Intl.NumberFormat(void 0, {
21223
+ var $v = 12, ey = -Math.PI / 2, ty = Math.PI * 2, ny = 5, ry = 1.4, iy = 18, ay = new Intl.NumberFormat(void 0, {
21211
21224
  style: "percent",
21212
21225
  maximumFractionDigits: 1
21213
21226
  });
21214
- function ay(e, t, n, r, i) {
21227
+ function oy(e, t, n, r, i) {
21215
21228
  let a = e.data.filter((e) => Number.isFinite(e.value) && e.value > 0), o = a.reduce((e, t) => e + t.value, 0), s = a.map((e, t) => ({
21216
- label: `${e.label} ${iy.format(e.value / o)}`,
21217
- color: w_(t, e.color)
21218
- })), c = e.legend !== !1 && a.length > 0, l = c && t >= n * ny && a.length * ry <= n - Qv * 2, u = l ? Math.min(t * .4, Math.max(...s.map((e) => i(e.label, 11))) + 16) : t - Qv * 2, d = c ? E_(s, u, i, l) : null, f = l ? t - u - Qv * 3 : t - Qv * 2, p = l ? n - Qv * 2 : n - Qv * 3 - (d?.height ?? 0), m = Math.max(0, Math.min(f, p) / 2 - ty), h = Qv + f / 2, g = Qv + p / 2, _ = e.innerRadius, v = Math.min(.95, Math.max(0, _ !== void 0 && Number.isFinite(_) ? _ : .6)), y = $v, b = a.map((e, t) => {
21229
+ label: `${e.label} ${ay.format(e.value / o)}`,
21230
+ color: T_(t, e.color)
21231
+ })), c = e.legend !== !1 && a.length > 0, l = c && t >= n * ry && a.length * iy <= n - $v * 2, u = l ? Math.min(t * .4, Math.max(...s.map((e) => i(e.label, 11))) + 16) : t - $v * 2, d = c ? D_(s, u, i, l) : null, f = l ? t - u - $v * 3 : t - $v * 2, p = l ? n - $v * 2 : n - $v * 3 - (d?.height ?? 0), m = Math.max(0, Math.min(f, p) / 2 - ny), h = $v + f / 2, g = $v + p / 2, _ = e.innerRadius, v = Math.min(.95, Math.max(0, _ !== void 0 && Number.isFinite(_) ? _ : .6)), y = ey, b = a.map((e, t) => {
21219
21232
  let n = e.value / o, r = y;
21220
- return y += n * ey, {
21233
+ return y += n * ty, {
21221
21234
  label: e.label,
21222
21235
  value: e.value,
21223
21236
  share: n,
21224
21237
  start: r,
21225
21238
  end: y,
21226
- color: w_(t, e.color),
21239
+ color: T_(t, e.color),
21227
21240
  slice: e
21228
21241
  };
21229
21242
  });
@@ -21235,80 +21248,80 @@ function ay(e, t, n, r, i) {
21235
21248
  total: o,
21236
21249
  slices: b,
21237
21250
  legend: d,
21238
- legendX: l ? t - u - Qv : Qv,
21239
- legendY: l ? Math.max(Qv, g - (d?.height ?? 0) / 2) : Qv * 2 + p
21251
+ legendX: l ? t - u - $v : $v,
21252
+ legendY: l ? Math.max($v, g - (d?.height ?? 0) / 2) : $v * 2 + p
21240
21253
  };
21241
21254
  }
21242
- function oy(e, t, n) {
21255
+ function sy(e, t, n) {
21243
21256
  let r = t - e.cx, i = n - e.cy, a = Math.hypot(r, i);
21244
- if (a < e.inner || a > e.radius + ty) return null;
21257
+ if (a < e.inner || a > e.radius + ny) return null;
21245
21258
  let o = Math.atan2(i, r);
21246
- for (; o < $v;) o += ey;
21259
+ for (; o < ey;) o += ty;
21247
21260
  return e.slices.find((e) => o >= e.start && o < e.end) ?? null;
21248
21261
  }
21249
- function sy(e, t, n, r, i, a, o = ay(r, t, n, i, T_(e, i))) {
21250
- let s = T_(e, i), c = r.valueFormat ?? C_;
21262
+ function cy(e, t, n, r, i, a, o = oy(r, t, n, i, E_(e, i))) {
21263
+ let s = E_(e, i), c = r.valueFormat ?? w_;
21251
21264
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
21252
- let l = a && r.crosshair !== !1 ? oy(o, a.x, a.y) : null, { cx: u, cy: d, radius: f, inner: p } = o;
21265
+ let l = a && r.crosshair !== !1 ? sy(o, a.x, a.y) : null, { cx: u, cy: d, radius: f, inner: p } = o;
21253
21266
  for (let t of o.slices) {
21254
- let n = (t.start + t.end) / 2, r = t === l ? ty : 0, a = u + Math.cos(n) * r, s = d + Math.sin(n) * r;
21267
+ let n = (t.start + t.end) / 2, r = t === l ? ny : 0, a = u + Math.cos(n) * r, s = d + Math.sin(n) * r;
21255
21268
  e.beginPath(), e.arc(a, s, f, t.start, t.end), p > 0 ? e.arc(a, s, p, t.end, t.start, !0) : e.lineTo(a, s), e.closePath(), e.fillStyle = t.color, e.fill(), o.slices.length > 1 && (e.strokeStyle = i.background, e.lineWidth = 1.5, e.stroke());
21256
21269
  }
21257
- return r.showLabels !== !1 && cy(e, o, i), ly(e, o, r, i, s), o.legend && D_(e, o.legend, o.legendX, o.legendY, i), l && a && O_(e, [{
21270
+ return r.showLabels !== !1 && ly(e, o, i), uy(e, o, r, i, s), o.legend && O_(e, o.legend, o.legendX, o.legendY, i), l && a && k_(e, [{
21258
21271
  text: l.label,
21259
21272
  bold: !0,
21260
21273
  color: l.color
21261
- }, { text: `${c(l.value)} · ${iy.format(l.share)}` }], a, {
21274
+ }, { text: `${c(l.value)} · ${ay.format(l.share)}` }], a, {
21262
21275
  x: 0,
21263
21276
  y: 0,
21264
21277
  width: t,
21265
21278
  height: n
21266
21279
  }, i), o;
21267
21280
  }
21268
- function cy(e, t, n) {
21281
+ function ly(e, t, n) {
21269
21282
  let { cx: r, cy: i, radius: a, inner: o } = t, s = o > 0 ? (a + o) / 2 : a * .62;
21270
21283
  e.save(), e.font = $(n, 11, "600"), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = "#fff";
21271
21284
  for (let n of t.slices) {
21272
- let t = iy.format(n.share);
21285
+ let t = ay.format(n.share);
21273
21286
  if ((n.end - n.start) * s < e.measureText(t).width + 8 || o > 0 && a - o < 15) continue;
21274
21287
  let c = (n.start + n.end) / 2;
21275
21288
  e.fillText(t, r + Math.cos(c) * s, i + Math.sin(c) * s);
21276
21289
  }
21277
21290
  e.restore();
21278
21291
  }
21279
- function ly(e, t, n, r, i) {
21292
+ function uy(e, t, n, r, i) {
21280
21293
  if (t.inner <= 0 || !n.centerLabel && !n.centerValue) return;
21281
21294
  let a = t.inner * 1.6;
21282
21295
  if (e.save(), e.textAlign = "center", e.textBaseline = "middle", n.centerValue) {
21283
21296
  let o = Math.max(12, Math.min(28, t.inner * .42));
21284
- e.font = $(r, o, "600"), e.fillStyle = r.text, e.fillText(A_(n.centerValue, a, i, o), t.cx, t.cy + (n.centerLabel ? o * .35 : 0));
21297
+ e.font = $(r, o, "600"), e.fillStyle = r.text, e.fillText(j_(n.centerValue, a, i, o), t.cx, t.cy + (n.centerLabel ? o * .35 : 0));
21285
21298
  }
21286
- n.centerLabel && (e.font = $(r, 11), e.fillStyle = r.textSecondary, e.fillText(A_(n.centerLabel, a, i), t.cx, t.cy - (n.centerValue ? 11 * 1.1 : 0))), e.restore();
21299
+ n.centerLabel && (e.font = $(r, 11), e.fillStyle = r.textSecondary, e.fillText(j_(n.centerLabel, a, i), t.cx, t.cy - (n.centerValue ? 11 * 1.1 : 0))), e.restore();
21287
21300
  }
21288
21301
  //#endregion
21289
21302
  //#region src/finance/ScatterRenderer.ts
21290
- var uy = 12, dy = 5, fy = 3, py = 18, my = 20, hy = 6;
21291
- function gy(e, t, n, r, i) {
21303
+ var dy = 12, fy = 5, py = 3, my = 18, hy = 20, gy = 6;
21304
+ function _y(e, t, n, r, i) {
21292
21305
  let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
21293
21306
  for (let t of e.series) for (let e of t.points) !Number.isFinite(e.x) || !Number.isFinite(e.y) || (e.x < a && (a = e.x), e.x > o && (o = e.x), e.y < s && (s = e.y), e.y > c && (c = e.y), e.size !== void 0 && Number.isFinite(e.size) && e.size > l && (l = e.size));
21294
- let u = e.maxRadius ?? 24, d = u + hy, f = (e, t, n) => {
21307
+ let u = e.maxRadius ?? 24, d = u + gy, f = (e, t, n) => {
21295
21308
  if (e > t) return [0, 1];
21296
21309
  let r = (t - e) * d / Math.max(1, n - d * 2);
21297
21310
  return [e >= 0 ? Math.max(0, e - r) : e - r, t <= 0 ? Math.min(0, t + r) : t + r];
21298
- }, p = b_(...f(a, o, t * .8), Math.max(2, Math.floor(t / 110))), m = b_(...f(s, c, n * .7), 5), h = e.xFormat ?? Q(p), g = e.yFormat ?? Q(m), _ = e.legend ?? e.series.length > 1 ? E_(e.series.map((e, t) => ({
21311
+ }, p = x_(...f(a, o, t * .8), Math.max(2, Math.floor(t / 110))), m = x_(...f(s, c, n * .7), 5), h = e.xFormat ?? Q(p), g = e.yFormat ?? Q(m), _ = e.legend ?? e.series.length > 1 ? D_(e.series.map((e, t) => ({
21299
21312
  label: e.name,
21300
- color: w_(t, e.color)
21301
- })), t - uy * 2, i) : null, v = uy + (_ ? _.height + 6 : 0), y = Math.max(0, ...m.ticks.map((e) => i(g(e), 11))), b = uy + (e.yLabel ? py : 0) + y + 8, x = uy + my + (e.xLabel ? py : 0), S = i(h(p.max), 11) / 2, C = {
21313
+ color: T_(t, e.color)
21314
+ })), t - dy * 2, i) : null, v = dy + (_ ? _.height + 6 : 0), y = Math.max(0, ...m.ticks.map((e) => i(g(e), 11))), b = dy + (e.yLabel ? my : 0) + y + 8, x = dy + hy + (e.xLabel ? my : 0), S = i(h(p.max), 11) / 2, C = {
21302
21315
  x: b,
21303
21316
  y: v,
21304
- width: Math.max(1, t - b - uy - S),
21317
+ width: Math.max(1, t - b - dy - S),
21305
21318
  height: Math.max(1, n - v - x)
21306
21319
  }, w = [];
21307
21320
  return e.series.forEach((e, t) => {
21308
- let n = w_(t, e.color), r = j(n, .55), i = j(n, .85);
21321
+ let n = T_(t, e.color), r = j(n, .55), i = j(n, .85);
21309
21322
  for (let t of e.points) {
21310
21323
  if (!Number.isFinite(t.x) || !Number.isFinite(t.y)) continue;
21311
- let a = t.size !== void 0 && Number.isFinite(t.size) && t.size > 0 && l > 0 ? Math.max(fy, u * Math.sqrt(t.size / l)) : dy;
21324
+ let a = t.size !== void 0 && Number.isFinite(t.size) && t.size > 0 && l > 0 ? Math.max(py, u * Math.sqrt(t.size / l)) : fy;
21312
21325
  w.push({
21313
21326
  px: Z(p, t.x, C.x, C.width),
21314
21327
  py: Z(m, t.y, C.y, C.height, !0),
@@ -21330,18 +21343,18 @@ function gy(e, t, n, r, i) {
21330
21343
  legend: _
21331
21344
  };
21332
21345
  }
21333
- function _y(e, t, n) {
21346
+ function vy(e, t, n) {
21334
21347
  let r = null, i = Infinity;
21335
21348
  for (let a of e.points) {
21336
21349
  let e = Math.hypot(a.px - t, a.py - n);
21337
- e <= a.r + hy && e < i && (r = a, i = e);
21350
+ e <= a.r + gy && e < i && (r = a, i = e);
21338
21351
  }
21339
21352
  return r;
21340
21353
  }
21341
- function vy(e, t, n, r, i, a, o = gy(r, t, n, i, T_(e, i))) {
21354
+ function yy(e, t, n, r, i, a, o = _y(r, t, n, i, E_(e, i))) {
21342
21355
  let { plot: s, xScale: c, yScale: l } = o, u = r.xFormat ?? Q(c), d = r.yFormat ?? Q(l);
21343
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && D_(e, o.legend, uy, uy, i), k_(e, s, l, "vertical", i, d), k_(e, s, c, "horizontal", i, u), r.zeroLines !== !1 && yy(e, o, i), by(e, o, r, i);
21344
- let f = a && r.crosshair !== !1 ? _y(o, a.x, a.y) : null;
21356
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && O_(e, o.legend, dy, dy, i), A_(e, s, l, "vertical", i, d), A_(e, s, c, "horizontal", i, u), r.zeroLines !== !1 && by(e, o, i), xy(e, o, r, i);
21357
+ let f = a && r.crosshair !== !1 ? vy(o, a.x, a.y) : null;
21345
21358
  e.save(), e.beginPath(), e.rect(s.x, s.y, s.width, s.height), e.clip();
21346
21359
  for (let t of o.drawOrder) {
21347
21360
  let n = o.points[t];
@@ -21358,7 +21371,7 @@ function vy(e, t, n, r, i, a, o = gy(r, t, n, i, T_(e, i))) {
21358
21371
  bold: !0,
21359
21372
  color: f.color
21360
21373
  }];
21361
- f.label && r.series.length > 1 && o.push({ text: f.series }), o.push({ text: `${r.xLabel ?? "x"}: ${(r.xFormat ?? C_)(f.point.x)}` }), o.push({ text: `${r.yLabel ?? "y"}: ${(r.yFormat ?? C_)(f.point.y)}` }), f.point.size !== void 0 && o.push({ text: C_(f.point.size) }), O_(e, o, a, {
21374
+ f.label && r.series.length > 1 && o.push({ text: f.series }), o.push({ text: `${r.xLabel ?? "x"}: ${(r.xFormat ?? w_)(f.point.x)}` }), o.push({ text: `${r.yLabel ?? "y"}: ${(r.yFormat ?? w_)(f.point.y)}` }), f.point.size !== void 0 && o.push({ text: w_(f.point.size) }), k_(e, o, a, {
21362
21375
  x: 0,
21363
21376
  y: 0,
21364
21377
  width: t,
@@ -21367,7 +21380,7 @@ function vy(e, t, n, r, i, a, o = gy(r, t, n, i, T_(e, i))) {
21367
21380
  }
21368
21381
  return o;
21369
21382
  }
21370
- function yy(e, t, n) {
21383
+ function by(e, t, n) {
21371
21384
  let { plot: r, xScale: i, yScale: a } = t;
21372
21385
  if (e.save(), e.strokeStyle = n.axisLine, e.lineWidth = 1, e.beginPath(), i.min < 0 && i.max > 0) {
21373
21386
  let t = Math.round(Z(i, 0, r.x, r.width)) + .5;
@@ -21379,17 +21392,17 @@ function yy(e, t, n) {
21379
21392
  }
21380
21393
  e.stroke(), e.restore();
21381
21394
  }
21382
- function by(e, t, n, r) {
21395
+ function xy(e, t, n, r) {
21383
21396
  let { plot: i } = t;
21384
- e.save(), e.font = $(r, 11, "600"), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, i.x + i.width / 2, i.y + i.height + my + py)), n.yLabel && (e.translate(uy + 11 / 2, i.y + i.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
21397
+ e.save(), e.font = $(r, 11, "600"), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, i.x + i.width / 2, i.y + i.height + hy + my)), n.yLabel && (e.translate(dy + 11 / 2, i.y + i.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
21385
21398
  }
21386
21399
  //#endregion
21387
21400
  //#region src/finance/HistogramRenderer.ts
21388
- var xy = 1e-9, Sy = 1e3, Cy = (e) => {
21401
+ var Sy = 1e-9, Cy = 1e3, wy = (e) => {
21389
21402
  let t = Number(e.toPrecision(12));
21390
21403
  return t === 0 ? 0 : t;
21391
21404
  };
21392
- function wy(e, t = {}) {
21405
+ function Ty(e, t = {}) {
21393
21406
  let n = e.filter((e) => Number.isFinite(e));
21394
21407
  if (n.length === 0) return [];
21395
21408
  let r = Infinity, i = -Infinity;
@@ -21401,40 +21414,40 @@ function wy(e, t = {}) {
21401
21414
  }];
21402
21415
  let a = t.binWidth;
21403
21416
  if (a !== void 0 && a > 0 && Number.isFinite(a)) {
21404
- let e = Math.floor(r / a + xy), t = Math.max(e, Math.ceil(i / a - xy) - 1) - e + 1;
21417
+ let e = Math.floor(r / a + Sy), t = Math.max(e, Math.ceil(i / a - Sy) - 1) - e + 1;
21405
21418
  if (t <= 1e3) {
21406
21419
  let r = Array.from({ length: t }, (t, n) => ({
21407
- from: Cy((e + n) * a),
21408
- to: Cy((e + n + 1) * a),
21420
+ from: wy((e + n) * a),
21421
+ to: wy((e + n + 1) * a),
21409
21422
  count: 0
21410
21423
  }));
21411
- for (let i of n) r[Math.min(t - 1, Math.floor(i / a + xy) - e)].count++;
21424
+ for (let i of n) r[Math.min(t - 1, Math.floor(i / a + Sy) - e)].count++;
21412
21425
  return r;
21413
21426
  }
21414
21427
  }
21415
- let o = t.bins, s = typeof o == "number" && Number.isFinite(o) && o >= 1 ? Math.min(Sy, Math.floor(o)) : Math.min(Sy, Math.ceil(Math.log2(n.length)) + 1), c = (i - r) / s, l = Array.from({ length: s }, (e, t) => ({
21416
- from: Cy(r + t * c),
21417
- to: Cy(t === s - 1 ? i : r + (t + 1) * c),
21428
+ let o = t.bins, s = typeof o == "number" && Number.isFinite(o) && o >= 1 ? Math.min(Cy, Math.floor(o)) : Math.min(Cy, Math.ceil(Math.log2(n.length)) + 1), c = (i - r) / s, l = Array.from({ length: s }, (e, t) => ({
21429
+ from: wy(r + t * c),
21430
+ to: wy(t === s - 1 ? i : r + (t + 1) * c),
21418
21431
  count: 0
21419
21432
  }));
21420
- for (let e of n) l[Math.min(s - 1, Math.floor((e - r) / c + xy))].count++;
21433
+ for (let e of n) l[Math.min(s - 1, Math.floor((e - r) / c + Sy))].count++;
21421
21434
  return l;
21422
21435
  }
21423
- var Ty = 12, Ey = 20, Dy = 16;
21424
- function Oy(e, t, n) {
21436
+ var Ey = 12, Dy = 20, Oy = 16;
21437
+ function ky(e, t, n) {
21425
21438
  return t.colorBySign ? (e.from + e.to) / 2 < 0 ? n.candleDown : n.candleUp : t.color ?? ue[0];
21426
21439
  }
21427
- function ky(e, t, n, r, i) {
21428
- let a = wy(e.values, {
21440
+ function Ay(e, t, n, r, i) {
21441
+ let a = Ty(e.values, {
21429
21442
  bins: e.bins,
21430
21443
  binWidth: e.binWidth
21431
- }), o = a.length > 0 ? a[0].from : 0, s = a.length > 0 ? a[a.length - 1].to : 1, c = (e.markers ?? []).map((e) => e.value).filter((e) => Number.isFinite(e)), l = b_(Math.min(o, ...c), Math.max(s, ...c), Math.max(2, Math.floor(t / 110))), u = 0;
21444
+ }), o = a.length > 0 ? a[0].from : 0, s = a.length > 0 ? a[a.length - 1].to : 1, c = (e.markers ?? []).map((e) => e.value).filter((e) => Number.isFinite(e)), l = x_(Math.min(o, ...c), Math.max(s, ...c), Math.max(2, Math.floor(t / 110))), u = 0;
21432
21445
  for (let e of a) e.count > u && (u = e.count);
21433
- let d = b_(0, Math.max(4, u), 4), f = e.valueFormat ?? Q(l), p = Math.max(0, ...d.ticks.map((e) => i(Q(d)(e), 11))), m = Ty + (c.length > 0 ? Dy : 0), h = Ty + p + 8, g = Ty + i(f(l.max), 11) / 2, _ = {
21446
+ let d = x_(0, Math.max(4, u), 4), f = e.valueFormat ?? Q(l), p = Math.max(0, ...d.ticks.map((e) => i(Q(d)(e), 11))), m = Ey + (c.length > 0 ? Oy : 0), h = Ey + p + 8, g = Ey + i(f(l.max), 11) / 2, _ = {
21434
21447
  x: h,
21435
21448
  y: m,
21436
21449
  width: Math.max(1, t - h - g),
21437
- height: Math.max(1, n - m - Ty - Ey)
21450
+ height: Math.max(1, n - m - Ey - Dy)
21438
21451
  };
21439
21452
  return {
21440
21453
  plot: _,
@@ -21448,32 +21461,32 @@ function ky(e, t, n, r, i) {
21448
21461
  width: Math.max(1, i - n),
21449
21462
  height: _.y + _.height - a,
21450
21463
  bin: t,
21451
- color: Oy(t, e, r)
21464
+ color: ky(t, e, r)
21452
21465
  };
21453
21466
  }),
21454
21467
  total: a.reduce((e, t) => e + t.count, 0)
21455
21468
  };
21456
21469
  }
21457
- function Ay(e, t, n) {
21470
+ function jy(e, t, n) {
21458
21471
  let { plot: r } = e;
21459
21472
  return n < r.y || n > r.y + r.height ? null : e.bars.find((e) => t >= e.x && t < e.x + e.width) ?? null;
21460
21473
  }
21461
- var jy = new Intl.NumberFormat(void 0, {
21474
+ var My = new Intl.NumberFormat(void 0, {
21462
21475
  style: "percent",
21463
21476
  maximumFractionDigits: 1
21464
21477
  });
21465
- function My(e, t, n, r, i, a, o = ky(r, t, n, i, T_(e, i))) {
21466
- let s = r.valueFormat ?? C_, { plot: c } = o;
21467
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), k_(e, c, o.yScale, "vertical", i, Q(o.yScale)), k_(e, c, o.xScale, "horizontal", i, r.valueFormat ?? Q(o.xScale));
21468
- let l = a && r.crosshair !== !1 ? Ay(o, a.x, a.y) : null;
21478
+ function Ny(e, t, n, r, i, a, o = Ay(r, t, n, i, E_(e, i))) {
21479
+ let s = r.valueFormat ?? w_, { plot: c } = o;
21480
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), A_(e, c, o.yScale, "vertical", i, Q(o.yScale)), A_(e, c, o.xScale, "horizontal", i, r.valueFormat ?? Q(o.xScale));
21481
+ let l = a && r.crosshair !== !1 ? jy(o, a.x, a.y) : null;
21469
21482
  for (let t of o.bars) e.fillStyle = t === l ? t.color : j(t.color, .75), e.fillRect(t.x + (t.width > 3 ? .5 : 0), t.y, Math.max(1, t.width - +(t.width > 3)), t.height);
21470
- if (Ny(e, o, r, i, s), l && a) {
21483
+ if (Py(e, o, r, i, s), l && a) {
21471
21484
  let { bin: r } = l;
21472
- O_(e, [{
21485
+ k_(e, [{
21473
21486
  text: r.to > r.from ? `${s(r.from)} – ${s(r.to)}` : s(r.from),
21474
21487
  bold: !0,
21475
21488
  color: l.color
21476
- }, { text: `${C_(r.count)} · ${jy.format(o.total > 0 ? r.count / o.total : 0)}` }], a, {
21489
+ }, { text: `${w_(r.count)} · ${My.format(o.total > 0 ? r.count / o.total : 0)}` }], a, {
21477
21490
  x: 0,
21478
21491
  y: 0,
21479
21492
  width: t,
@@ -21482,7 +21495,7 @@ function My(e, t, n, r, i, a, o = ky(r, t, n, i, T_(e, i))) {
21482
21495
  }
21483
21496
  return o;
21484
21497
  }
21485
- function Ny(e, t, n, r, i) {
21498
+ function Py(e, t, n, r, i) {
21486
21499
  let { plot: a } = t;
21487
21500
  e.save(), e.font = $(r, 10), e.textAlign = "center", e.textBaseline = "bottom";
21488
21501
  let o = [];
@@ -21502,12 +21515,12 @@ function Ny(e, t, n, r, i) {
21502
21515
  }
21503
21516
  //#endregion
21504
21517
  //#region src/finance/colorScale.ts
21505
- var Py = 8, Fy = 32, Iy = /* @__PURE__ */ new Map();
21506
- function Ly(e) {
21507
- let t = Iy.get(e);
21508
- return t === void 0 && (t = Ry(e), Iy.size > 512 && Iy.clear(), Iy.set(e, t)), t;
21509
- }
21518
+ var Fy = 8, Iy = 32, Ly = /* @__PURE__ */ new Map();
21510
21519
  function Ry(e) {
21520
+ let t = Ly.get(e);
21521
+ return t === void 0 && (t = zy(e), Ly.size > 512 && Ly.clear(), Ly.set(e, t)), t;
21522
+ }
21523
+ function zy(e) {
21511
21524
  let t = e.trim(), n = t.match(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
21512
21525
  if (n) {
21513
21526
  let e = n[1];
@@ -21524,13 +21537,13 @@ function Ry(e) {
21524
21537
  Number(r[3])
21525
21538
  ] : null;
21526
21539
  }
21527
- function zy(e, t, n) {
21528
- let r = Ly(e), i = Ly(t);
21540
+ function By(e, t, n) {
21541
+ let r = Ry(e), i = Ry(t);
21529
21542
  if (!r || !i) return n < .5 ? e : t;
21530
21543
  let a = (e) => Math.round(r[e] + (i[e] - r[e]) * n);
21531
21544
  return `rgb(${a(0)},${a(1)},${a(2)})`;
21532
21545
  }
21533
- function By(e, t, n) {
21546
+ function Vy(e, t, n) {
21534
21547
  let r = Infinity, i = -Infinity;
21535
21548
  for (let t of e) Number.isFinite(t) && (t < r && (r = t), t > i && (i = t));
21536
21549
  let a = 0, o = 1;
@@ -21540,44 +21553,44 @@ function By(e, t, n) {
21540
21553
  }
21541
21554
  return {
21542
21555
  negative: n?.negative ?? t.candleDown,
21543
- zero: n?.zero ?? zy(t.background, t.text, .14),
21556
+ zero: n?.zero ?? By(t.background, t.text, .14),
21544
21557
  positive: n?.positive ?? t.candleUp,
21545
21558
  min: n?.min !== void 0 && Number.isFinite(n.min) ? n.min : a,
21546
21559
  max: n?.max !== void 0 && Number.isFinite(n.max) ? n.max : o
21547
21560
  };
21548
21561
  }
21549
- function Vy(e, t) {
21550
- return !Number.isFinite(e) || e === 0 ? zy(t.zero, t.zero, 0) : e < 0 ? zy(t.zero, t.negative, t.min < 0 ? Math.min(1, e / t.min) : 1) : zy(t.zero, t.positive, t.max > 0 ? Math.min(1, e / t.max) : 1);
21562
+ function Hy(e, t) {
21563
+ return !Number.isFinite(e) || e === 0 ? By(t.zero, t.zero, 0) : e < 0 ? By(t.zero, t.negative, t.min < 0 ? Math.min(1, e / t.min) : 1) : By(t.zero, t.positive, t.max > 0 ? Math.min(1, e / t.max) : 1);
21551
21564
  }
21552
- var Hy = "#11151b", Uy = .0076;
21553
- function Wy(e) {
21554
- let t = Ly(e);
21565
+ var Uy = "#11151b", Wy = .0076;
21566
+ function Gy(e) {
21567
+ let t = Ry(e);
21555
21568
  if (!t) return "#ffffff";
21556
21569
  let [n, r, i] = t.map((e) => {
21557
21570
  let t = e / 255;
21558
21571
  return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
21559
21572
  }), a = .2126 * n + .7152 * r + .0722 * i;
21560
- return (a + .05) / (Uy + .05) > 1.05 / (a + .05) ? Hy : "#ffffff";
21573
+ return (a + .05) / (Wy + .05) > 1.05 / (a + .05) ? Uy : "#ffffff";
21561
21574
  }
21562
- function Gy(e, t, n, r, i) {
21575
+ function Ky(e, t, n, r, i) {
21563
21576
  let a = Math.min(180, t.width);
21564
21577
  if (a < 40 || !(n.max > n.min)) return;
21565
21578
  let { x: o, y: s } = t, c = n.max - n.min;
21566
21579
  e.save();
21567
- for (let t = 0; t < Fy; t++) {
21568
- let r = (t + .5) / Fy;
21569
- e.fillStyle = Vy(n.min + c * r, n), e.fillRect(o + a * t / Fy, s, a / Fy + .5, Py);
21580
+ for (let t = 0; t < Iy; t++) {
21581
+ let r = (t + .5) / Iy;
21582
+ e.fillStyle = Hy(n.min + c * r, n), e.fillRect(o + a * t / Iy, s, a / Iy + .5, Fy);
21570
21583
  }
21571
21584
  e.font = $(i, 10), e.fillStyle = i.textSecondary, e.textBaseline = "top";
21572
- let l = s + Py + 4;
21585
+ let l = s + Fy + 4;
21573
21586
  e.textAlign = "left", e.fillText(r(n.min), o, l), e.textAlign = "right", e.fillText(r(n.max), o + a, l);
21574
21587
  let u = o + a * -n.min / c;
21575
21588
  n.min < 0 && n.max > 0 && u - o > 28 && o + a - u > 28 && (e.textAlign = "center", e.fillText(r(0), u, l)), e.restore();
21576
21589
  }
21577
21590
  //#endregion
21578
21591
  //#region src/finance/CalendarRenderer.ts
21579
- var Ky = 864e5, qy = 3, Jy = 12, Yy = 16, Xy = 10, Zy = 28, Qy = 6;
21580
- function $y(e) {
21592
+ var qy = 864e5, Jy = 3, Yy = 12, Xy = 16, Zy = 10, Qy = 28, $y = 6;
21593
+ function eb(e) {
21581
21594
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
21582
21595
  if (!t) return null;
21583
21596
  let [n, r, i] = [
@@ -21585,27 +21598,27 @@ function $y(e) {
21585
21598
  Number(t[2]),
21586
21599
  Number(t[3])
21587
21600
  ], a = Date.UTC(n, r - 1, i), o = new Date(a);
21588
- return o.getUTCFullYear() !== n || o.getUTCMonth() !== r - 1 || o.getUTCDate() !== i ? null : Math.round(a / Ky);
21601
+ return o.getUTCFullYear() !== n || o.getUTCMonth() !== r - 1 || o.getUTCDate() !== i ? null : Math.round(a / qy);
21589
21602
  }
21590
- function eb(e) {
21591
- return new Date(e * Ky).toISOString().slice(0, 10);
21603
+ function tb(e) {
21604
+ return new Date(e * qy).toISOString().slice(0, 10);
21592
21605
  }
21593
- var tb = (e) => ((e + 4) % 7 + 7) % 7;
21594
- function nb(e, t) {
21595
- let n = e.from === void 0 ? null : $y(e.from), r = e.to === void 0 ? null : $y(e.to);
21606
+ var nb = (e) => ((e + 4) % 7 + 7) % 7;
21607
+ function rb(e, t) {
21608
+ let n = e.from === void 0 ? null : eb(e.from), r = e.to === void 0 ? null : eb(e.to);
21596
21609
  if (n === null || r === null) {
21597
21610
  let e = Infinity, i = -Infinity;
21598
21611
  for (let n of t.keys()) n < e && (e = n), n > i && (i = n);
21599
21612
  n ??= Number.isFinite(e) ? e : null, r ??= Number.isFinite(i) ? i : null;
21600
21613
  }
21601
21614
  if (n === null || r === null || n > r) return null;
21602
- let i = new Date(r * Ky).getUTCFullYear() - 10 + 1;
21603
- return [Math.max(n, Math.round(Date.UTC(i, 0, 1) / Ky)), r];
21615
+ let i = new Date(r * qy).getUTCFullYear() - 10 + 1;
21616
+ return [Math.max(n, Math.round(Date.UTC(i, 0, 1) / qy)), r];
21604
21617
  }
21605
- function rb(e, t, n) {
21618
+ function ib(e, t, n) {
21606
21619
  let r = [], i = e;
21607
21620
  for (; i <= t;) {
21608
- let e = new Date(i * Ky).getUTCFullYear(), a = Math.min(t, Math.round(Date.UTC(e, 11, 31) / Ky)), o = i - n(i);
21621
+ let e = new Date(i * qy).getUTCFullYear(), a = Math.min(t, Math.round(Date.UTC(e, 11, 31) / qy)), o = i - n(i);
21609
21622
  r.push({
21610
21623
  year: e,
21611
21624
  first: i,
@@ -21616,9 +21629,9 @@ function rb(e, t, n) {
21616
21629
  }
21617
21630
  return r;
21618
21631
  }
21619
- var ib = /* @__PURE__ */ new Map();
21620
- function ab(e) {
21621
- let t = e ?? "", n = ib.get(t);
21632
+ var ab = /* @__PURE__ */ new Map();
21633
+ function ob(e) {
21634
+ let t = e ?? "", n = ab.get(t);
21622
21635
  if (!n) {
21623
21636
  try {
21624
21637
  n = {
@@ -21636,23 +21649,23 @@ function ab(e) {
21636
21649
  })
21637
21650
  };
21638
21651
  } catch {
21639
- n = ab(void 0);
21652
+ n = ob(void 0);
21640
21653
  }
21641
- ib.set(t, n);
21654
+ ab.set(t, n);
21642
21655
  }
21643
21656
  return n;
21644
21657
  }
21645
- function ob(e, t, n, r, i) {
21658
+ function sb(e, t, n, r, i) {
21646
21659
  let a = /* @__PURE__ */ new Map();
21647
21660
  for (let t of e.data) {
21648
- let e = $y(t.date);
21661
+ let e = eb(t.date);
21649
21662
  e !== null && Number.isFinite(t.value) && a.set(e, t);
21650
21663
  }
21651
- let o = ab(e.locale), s = e.dateFormat ?? ((e) => o.long.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`))), c = e.weekdays === 5, l = (e) => !c || tb(e) >= 1 && tb(e) <= 5, u = nb(e, a), d = t - Jy * 2, f = e.legend === !1 ? 0 : 28, p = c ? 5 : 7, m = c ? 1 : e.weekStart ?? 1, h = (e) => (tb(e) - m + 7) % 7, g = u ? rb(u[0], u[1], h) : [], _ = (e) => n - Jy * 2 - f - e * Yy - (e - 1) * Xy;
21652
- for (; g.length > 1 && _(g.length) / (g.length * p) < qy;) g = g.slice(1);
21664
+ let o = ob(e.locale), s = e.dateFormat ?? ((e) => o.long.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`))), c = e.weekdays === 5, l = (e) => !c || nb(e) >= 1 && nb(e) <= 5, u = rb(e, a), d = t - Yy * 2, f = e.legend === !1 ? 0 : 28, p = c ? 5 : 7, m = c ? 1 : e.weekStart ?? 1, h = (e) => (nb(e) - m + 7) % 7, g = u ? ib(u[0], u[1], h) : [], _ = (e) => n - Yy * 2 - f - e * Xy - (e - 1) * Zy;
21665
+ for (; g.length > 1 && _(g.length) / (g.length * p) < Jy;) g = g.slice(1);
21653
21666
  let v = [];
21654
21667
  for (let [e, t] of a) g.length > 0 && e >= g[0].first && e <= g[g.length - 1].last && l(e) && v.push(t.value);
21655
- let y = By(v, r, e.colorScale), b = {
21668
+ let y = Vy(v, r, e.colorScale), b = {
21656
21669
  cells: [],
21657
21670
  months: [],
21658
21671
  weekdays: [],
@@ -21663,17 +21676,17 @@ function ob(e, t, n, r, i) {
21663
21676
  formatDate: s
21664
21677
  };
21665
21678
  if (g.length === 0 || d <= 0 || _(g.length) <= 0) return b;
21666
- let x = g.length > 1, S = g.map((e) => String(e.year)), C = Array.from({ length: p }, (e, t) => o.weekday.format(new Date((3 + m + t) * Ky))), w = Jy + Math.max(...C.map((e) => i(e, 10)), ...x ? S.map((e) => i(e, 11)) : [0]) + Qy, T = Math.max(...g.map((e) => e.weeks)), E = Math.min(Zy, (t - w - Jy) / T, _(g.length) / (g.length * p));
21679
+ let x = g.length > 1, S = g.map((e) => String(e.year)), C = Array.from({ length: p }, (e, t) => o.weekday.format(new Date((3 + m + t) * qy))), w = Yy + Math.max(...C.map((e) => i(e, 10)), ...x ? S.map((e) => i(e, 11)) : [0]) + $y, T = Math.max(...g.map((e) => e.weeks)), E = Math.min(Qy, (t - w - Yy) / T, _(g.length) / (g.length * p));
21667
21680
  if (!(E > 0)) return b;
21668
- let D = E - (E >= 6 ? Math.max(1, Math.round(E * .12)) : 0), O = T * E, k = w + Math.max(0, (t - w - Jy - O) / 2), ee = {
21681
+ let D = E - (E >= 6 ? Math.max(1, Math.round(E * .12)) : 0), O = T * E, k = w + Math.max(0, (t - w - Yy - O) / 2), ee = {
21669
21682
  ...b,
21670
21683
  pitch: E
21671
- }, te = Jy;
21684
+ }, te = Yy;
21672
21685
  for (let [e, n] of g.entries()) {
21673
- let r = te + Yy;
21686
+ let r = te + Xy;
21674
21687
  x && ee.years.push({
21675
21688
  label: S[e],
21676
- x: k - Qy,
21689
+ x: k - $y,
21677
21690
  y: te
21678
21691
  });
21679
21692
  let s = -1, c = -Infinity;
@@ -21684,14 +21697,14 @@ function ob(e, t, n, r, i) {
21684
21697
  x: u,
21685
21698
  y: d,
21686
21699
  size: D,
21687
- date: eb(e),
21700
+ date: tb(e),
21688
21701
  day: f,
21689
- color: f && Number.isFinite(f.value) ? Vy(f.value, y) : null
21702
+ color: f && Number.isFinite(f.value) ? Hy(f.value, y) : null
21690
21703
  });
21691
- let p = new Date(e * Ky).getUTCMonth();
21704
+ let p = new Date(e * qy).getUTCMonth();
21692
21705
  if (p !== s) {
21693
21706
  s = p;
21694
- let n = o.month.format(new Date(e * Ky)), r = u + i(n, 10);
21707
+ let n = o.month.format(new Date(e * qy)), r = u + i(n, 10);
21695
21708
  u >= c && r <= t && (ee.months.push({
21696
21709
  label: n,
21697
21710
  x: u,
@@ -21703,27 +21716,27 @@ function ob(e, t, n, r, i) {
21703
21716
  let e = E >= 13 ? 1 : 2;
21704
21717
  for (let t = 0; t < p; t += e) ee.weekdays.push({
21705
21718
  label: C[t],
21706
- x: k - Qy,
21719
+ x: k - $y,
21707
21720
  y: r + t * E + D / 2
21708
21721
  });
21709
21722
  }
21710
- te = r + p * E + Xy;
21723
+ te = r + p * E + Zy;
21711
21724
  }
21712
21725
  return f > 0 && (ee.bar = {
21713
21726
  x: k,
21714
- y: te - Xy + 8,
21715
- width: Math.min(O, t - k - Jy),
21727
+ y: te - Zy + 8,
21728
+ width: Math.min(O, t - k - Yy),
21716
21729
  height: f - 8
21717
21730
  }), ee;
21718
21731
  }
21719
- function sb(e, t, n) {
21732
+ function cb(e, t, n) {
21720
21733
  for (let r of e.cells) if (t >= r.x && t < r.x + e.pitch && n >= r.y && n < r.y + e.pitch) return r;
21721
21734
  return null;
21722
21735
  }
21723
- function cb(e, t, n, r, i, a, o = ob(r, t, n, i, T_(e, i))) {
21724
- let s = r.valueFormat ?? C_;
21736
+ function lb(e, t, n, r, i, a, o = sb(r, t, n, i, E_(e, i))) {
21737
+ let s = r.valueFormat ?? w_;
21725
21738
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
21726
- let c = a && r.crosshair !== !1 ? sb(o, a.x, a.y) : null, l = j(i.textSecondary, .12), u = o.pitch >= 10 ? 2 : 0;
21739
+ let c = a && r.crosshair !== !1 ? cb(o, a.x, a.y) : null, l = j(i.textSecondary, .12), u = o.pitch >= 10 ? 2 : 0;
21727
21740
  e.save();
21728
21741
  for (let t of o.cells) e.fillStyle = t.color ?? l, e.beginPath(), u > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.size, t.size, u) : e.rect(t.x, t.y, t.size, t.size), e.fill();
21729
21742
  c && (e.strokeStyle = i.text, e.lineWidth = 1.5, e.strokeRect(c.x - .75, c.y - .75, c.size + 1.5, c.size + 1.5)), e.fillStyle = i.textSecondary, e.font = $(i, 10), e.textAlign = "left", e.textBaseline = "top";
@@ -21732,7 +21745,7 @@ function cb(e, t, n, r, i, a, o = ob(r, t, n, i, T_(e, i))) {
21732
21745
  for (let t of o.weekdays) e.fillText(t.label, t.x, t.y);
21733
21746
  e.font = $(i, 11, "600"), e.fillStyle = i.text, e.textBaseline = "top";
21734
21747
  for (let t of o.years) e.fillText(t.label, t.x, t.y);
21735
- if (e.restore(), o.bar && Gy(e, o.bar, o.scale, s, i), c && a) {
21748
+ if (e.restore(), o.bar && Ky(e, o.bar, o.scale, s, i), c && a) {
21736
21749
  let r = [{
21737
21750
  text: o.formatDate(c.date),
21738
21751
  bold: !0,
@@ -21742,7 +21755,7 @@ function cb(e, t, n, r, i, a, o = ob(r, t, n, i, T_(e, i))) {
21742
21755
  r.push({ text: s(c.day.value) });
21743
21756
  for (let [e, t] of Object.entries(c.day.meta ?? {})) r.push({ text: `${e}: ${String(t)}` });
21744
21757
  } else r.push({ text: "–" });
21745
- O_(e, r, a, {
21758
+ k_(e, r, a, {
21746
21759
  x: 0,
21747
21760
  y: 0,
21748
21761
  width: t,
@@ -21751,16 +21764,16 @@ function cb(e, t, n, r, i, a, o = ob(r, t, n, i, T_(e, i))) {
21751
21764
  }
21752
21765
  return o;
21753
21766
  }
21754
- var lb = 12, ub = 6, db = 72, fb = Math.PI / 4, pb = Math.sin(fb);
21755
- function mb(e) {
21767
+ var ub = 12, db = 6, fb = 72, pb = Math.PI / 4, mb = Math.sin(pb);
21768
+ function hb(e) {
21756
21769
  let t = e.length, n = Array.from({ length: t }, () => Array(t).fill(NaN));
21757
21770
  for (let r = 0; r < t; r++) for (let i = r; i < t; i++) {
21758
- let t = hb(e[r], e[i], r === i);
21771
+ let t = gb(e[r], e[i], r === i);
21759
21772
  n[r][i] = t, n[i][r] = t;
21760
21773
  }
21761
21774
  return n;
21762
21775
  }
21763
- function hb(e, t, n) {
21776
+ function gb(e, t, n) {
21764
21777
  let r = Math.min(e.length, t.length), i = 0, a = 0, o = 0;
21765
21778
  for (let n = 0; n < r; n++) Number.isFinite(e[n]) && Number.isFinite(t[n]) && (i++, a += e[n], o += t[n]);
21766
21779
  if (i < 3) return NaN;
@@ -21772,17 +21785,17 @@ function hb(e, t, n) {
21772
21785
  }
21773
21786
  return u === 0 || d === 0 ? NaN : n ? 1 : Math.max(-1, Math.min(1, l / Math.sqrt(u * d)));
21774
21787
  }
21775
- var gb = (e) => e.toFixed(2);
21776
- function _b(e, t, n, r) {
21788
+ var _b = (e) => e.toFixed(2);
21789
+ function vb(e, t, n, r) {
21777
21790
  return !t || !e ? !0 : e === "lower" ? r <= n : r >= n;
21778
21791
  }
21779
- function vb(e, t, n, r, i) {
21792
+ function yb(e, t, n, r, i) {
21780
21793
  let a = e.rows.slice(0, 200), o = (e.columns ?? e.rows).slice(0, 200), s = e.columns === void 0 || e.columns.length === e.rows.length && e.columns.every((t, n) => t === e.rows[n]), c = [];
21781
21794
  for (let t = 0; t < a.length; t++) for (let n = 0; n < o.length; n++) {
21782
21795
  let r = e.values[t]?.[n];
21783
- Number.isFinite(r) && _b(e.triangle, s, t, n) && c.push(r);
21796
+ Number.isFinite(r) && vb(e.triangle, s, t, n) && c.push(r);
21784
21797
  }
21785
- let l = By(c, r, e.colorScale), u = {
21798
+ let l = Vy(c, r, e.colorScale), u = {
21786
21799
  cells: [],
21787
21800
  rowLabels: [],
21788
21801
  columnLabels: [],
@@ -21798,22 +21811,22 @@ function vb(e, t, n, r, i) {
21798
21811
  at: []
21799
21812
  };
21800
21813
  if (a.length === 0 || o.length === 0 || t <= 0 || n <= 0) return u;
21801
- let d = Math.min(t * .3, Math.max(...a.map((e) => i(e, 11)))), f = Math.max(...o.map((e) => i(e, 11))), p = e.legend === !1 ? 0 : 28, m = lb + d + ub, h = t - m - lb, g = (e) => Math.min(db, h / o.length, (n - e - lb - p) / a.length), _ = lb + 11 + ub, v = g(_), y = f > v - 4, b = f;
21802
- if (y && (b = Math.min(f, n * .33 / pb), _ = lb + b * pb + 11, v = g(_)), !(v > 0)) return u;
21814
+ let d = Math.min(t * .3, Math.max(...a.map((e) => i(e, 11)))), f = Math.max(...o.map((e) => i(e, 11))), p = e.legend === !1 ? 0 : 28, m = ub + d + db, h = t - m - ub, g = (e) => Math.min(fb, h / o.length, (n - e - ub - p) / a.length), _ = ub + 11 + db, v = g(_), y = f > v - 4, b = f;
21815
+ if (y && (b = Math.min(f, n * .33 / mb), _ = ub + b * mb + 11, v = g(_)), !(v > 0)) return u;
21803
21816
  let x = v - +(v >= 8), S = m + Math.max(0, (h - o.length * v) / 2);
21804
- y && (b = Math.max(0, Math.min(b, (S + x / 2 - 2 - 11 * pb / 2) / pb))), u.grid = {
21817
+ y && (b = Math.max(0, Math.min(b, (S + x / 2 - 2 - 11 * mb / 2) / mb))), u.grid = {
21805
21818
  x: S,
21806
21819
  y: _,
21807
21820
  width: o.length * v,
21808
21821
  height: a.length * v
21809
21822
  }, u.pitch = v;
21810
- let C = e.valueFormat ?? gb, w = e.showValues !== !1, T = Math.max(8, Math.min(11, v / 3));
21823
+ let C = e.valueFormat ?? _b, w = e.showValues !== !1, T = Math.max(8, Math.min(11, v / 3));
21811
21824
  for (let t = 0; t < a.length; t++) {
21812
21825
  u.at.push([]);
21813
21826
  for (let n = 0; n < o.length; n++) {
21814
21827
  let r = e.values[t]?.[n];
21815
- if (!Number.isFinite(r) || !_b(e.triangle, s, t, n)) continue;
21816
- let c = Vy(r, l), d = w ? C(r) : "", f = w && v >= 18 && i(d, T) <= v - 4, p = {
21828
+ if (!Number.isFinite(r) || !vb(e.triangle, s, t, n)) continue;
21829
+ let c = Hy(r, l), d = w ? C(r) : "", f = w && v >= 18 && i(d, T) <= v - 4, p = {
21817
21830
  x: S + n * v,
21818
21831
  y: _ + t * v,
21819
21832
  size: x,
@@ -21826,50 +21839,50 @@ function vb(e, t, n, r, i) {
21826
21839
  },
21827
21840
  color: c,
21828
21841
  text: f ? d : null,
21829
- textColor: Wy(c)
21842
+ textColor: Gy(c)
21830
21843
  };
21831
21844
  u.cells.push(p), u.at[t][n] = p;
21832
21845
  }
21833
21846
  }
21834
- let E = Math.max(1, Math.ceil(11 / v)), D = Math.max(1, Math.ceil(11 / (y ? v * pb : v)));
21847
+ let E = Math.max(1, Math.ceil(11 / v)), D = Math.max(1, Math.ceil(11 / (y ? v * mb : v)));
21835
21848
  for (let e = 0; e < a.length; e += E) u.rowLabels.push({
21836
- text: A_(a[e], d, i),
21849
+ text: j_(a[e], d, i),
21837
21850
  index: e,
21838
- x: S - ub,
21851
+ x: S - db,
21839
21852
  y: _ + e * v + x / 2
21840
21853
  });
21841
21854
  for (let e = 0; e < o.length; e += D) u.columnLabels.push({
21842
- text: A_(o[e], b, i),
21855
+ text: j_(o[e], b, i),
21843
21856
  index: e,
21844
21857
  x: S + e * v + x / 2,
21845
- y: _ - ub,
21858
+ y: _ - db,
21846
21859
  rotated: y
21847
21860
  });
21848
21861
  return p > 0 && (u.bar = {
21849
21862
  x: S,
21850
21863
  y: _ + a.length * v + 8,
21851
- width: Math.min(u.grid.width, t - S - lb),
21864
+ width: Math.min(u.grid.width, t - S - ub),
21852
21865
  height: p - 8
21853
21866
  }), u;
21854
21867
  }
21855
- function yb(e, t, n) {
21868
+ function bb(e, t, n) {
21856
21869
  let { grid: r, pitch: i } = e;
21857
21870
  return i <= 0 || t < r.x || n < r.y || t >= r.x + r.width || n >= r.y + r.height ? null : e.at[Math.floor((n - r.y) / i)]?.[Math.floor((t - r.x) / i)] ?? null;
21858
21871
  }
21859
- function bb(e, t, n, r, i, a, o = vb(r, t, n, i, T_(e, i))) {
21860
- let s = r.valueFormat ?? gb;
21872
+ function xb(e, t, n, r, i, a, o = yb(r, t, n, i, E_(e, i))) {
21873
+ let s = r.valueFormat ?? _b;
21861
21874
  e.fillStyle = i.background, e.fillRect(0, 0, t, n);
21862
- let c = a && r.crosshair !== !1 ? yb(o, a.x, a.y) : null;
21875
+ let c = a && r.crosshair !== !1 ? bb(o, a.x, a.y) : null;
21863
21876
  e.save();
21864
21877
  let l = Math.max(8, Math.min(11, o.pitch / 3));
21865
21878
  e.textAlign = "center", e.textBaseline = "middle", e.font = $(i, l);
21866
21879
  for (let t of o.cells) e.fillStyle = t.color, e.fillRect(t.x, t.y, t.size, t.size), t.text && (e.fillStyle = t.textColor, e.fillText(t.text, t.x + t.size / 2, t.y + t.size / 2));
21867
21880
  c && (e.strokeStyle = i.text, e.lineWidth = 1.5, e.strokeRect(c.x + .75, c.y + .75, c.size - 1.5, c.size - 1.5)), e.font = $(i, 11), e.fillStyle = i.textSecondary, e.textAlign = "right";
21868
21881
  for (let t of o.rowLabels) e.fillStyle = c && c.cell.rowIndex === t.index ? i.text : i.textSecondary, e.fillText(t.text, t.x, t.y);
21869
- for (let t of o.columnLabels) e.fillStyle = c && c.cell.columnIndex === t.index ? i.text : i.textSecondary, t.rotated ? (e.save(), e.translate(t.x, t.y), e.rotate(fb), e.textAlign = "right", e.fillText(t.text, 0, 0), e.restore()) : (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t.text, t.x, t.y), e.textBaseline = "middle");
21870
- if (e.restore(), o.bar && Gy(e, o.bar, o.scale, s, i), c && a) {
21882
+ for (let t of o.columnLabels) e.fillStyle = c && c.cell.columnIndex === t.index ? i.text : i.textSecondary, t.rotated ? (e.save(), e.translate(t.x, t.y), e.rotate(pb), e.textAlign = "right", e.fillText(t.text, 0, 0), e.restore()) : (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t.text, t.x, t.y), e.textBaseline = "middle");
21883
+ if (e.restore(), o.bar && Ky(e, o.bar, o.scale, s, i), c && a) {
21871
21884
  let { cell: r } = c;
21872
- O_(e, [{
21885
+ k_(e, [{
21873
21886
  text: `${r.row} × ${r.column}`,
21874
21887
  bold: !0,
21875
21888
  color: c.color
@@ -21884,8 +21897,8 @@ function bb(e, t, n, r, i, a, o = vb(r, t, n, i, T_(e, i))) {
21884
21897
  }
21885
21898
  //#endregion
21886
21899
  //#region src/finance/CounterClockRenderer.ts
21887
- var xb = 12, Sb = 18, Cb = 20, wb = 10, Tb = .2, Eb = 2e3, Db = 1e-9;
21888
- function Ob(e, t, n = Infinity) {
21900
+ var Sb = 12, Cb = 18, wb = 20, Tb = 10, Eb = .2, Db = 2e3, Ob = 1e-9;
21901
+ function kb(e, t, n = Infinity) {
21889
21902
  let r = Number.isFinite(t) ? Math.max(1, Math.floor(t)) : 25, i = [], a = Math.max(r - 1, e.length - (Number.isFinite(n) ? Math.max(1, Math.floor(n)) : e.length));
21890
21903
  for (let t = a; t < e.length; t++) {
21891
21904
  let n = 0, a = 0;
@@ -21898,21 +21911,21 @@ function Ob(e, t, n = Infinity) {
21898
21911
  }
21899
21912
  return i;
21900
21913
  }
21901
- var kb = (e, t) => t - e > Db * Math.max(Math.abs(e), Math.abs(t));
21902
- function Ab(e) {
21914
+ var Ab = (e, t) => t - e > Ob * Math.max(Math.abs(e), Math.abs(t));
21915
+ function jb(e) {
21903
21916
  if (e.length < 2) return null;
21904
21917
  let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
21905
21918
  for (let a of e) t = Math.min(t, a.volume), n = Math.max(n, a.volume), r = Math.min(r, a.price), i = Math.max(i, a.price);
21906
- let a = e[e.length - 2], o = e[e.length - 1], s = kb(t, n) ? (o.volume - a.volume) / (n - t) : 0, c = kb(r, i) ? (o.price - a.price) / (i - r) : 0;
21919
+ let a = e[e.length - 2], o = e[e.length - 1], s = Ab(t, n) ? (o.volume - a.volume) / (n - t) : 0, c = Ab(r, i) ? (o.price - a.price) / (i - r) : 0;
21907
21920
  if (Math.abs(s) < 1e-6 && Math.abs(c) < 1e-6) return null;
21908
21921
  let l = (Math.atan2(c, s) + 2 * Math.PI) % (2 * Math.PI);
21909
21922
  return Math.round(l / (Math.PI / 4)) % 8 + 1;
21910
21923
  }
21911
- function jb(e, t, n, r, i) {
21912
- let a = Ob(e.data, e.period ?? 25, Mb(e)), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
21924
+ function Mb(e, t, n, r, i) {
21925
+ let a = kb(e.data, e.period ?? 25, Nb(e)), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
21913
21926
  for (let e of a) o = Math.min(o, e.volume), s = Math.max(s, e.volume), c = Math.min(c, e.price), l = Math.max(l, e.price);
21914
- a.length > 0 && !kb(o, s) && (s = o), a.length > 0 && !kb(c, l) && (l = c);
21915
- let u = b_(a.length > 0 ? o : 0, a.length > 0 ? s : 1, Math.max(2, Math.floor(t / 110))), d = b_(a.length > 0 ? c : 0, a.length > 0 ? l : 1, Math.max(2, Math.floor(n / 60))), f = e.priceFormat ?? Q(d), p = e.volumeFormat ?? Q(u), m = xb + Math.max(0, ...d.ticks.map((e) => i(f(e), 11))) + 8 + (e.yLabel ? Sb : 0), h = xb + i(p(u.max), 11) / 2, g = xb, _ = xb + Cb + (e.xLabel ? Sb : 0), v = {
21927
+ a.length > 0 && !Ab(o, s) && (s = o), a.length > 0 && !Ab(c, l) && (l = c);
21928
+ let u = x_(a.length > 0 ? o : 0, a.length > 0 ? s : 1, Math.max(2, Math.floor(t / 110))), d = x_(a.length > 0 ? c : 0, a.length > 0 ? l : 1, Math.max(2, Math.floor(n / 60))), f = e.priceFormat ?? Q(d), p = e.volumeFormat ?? Q(u), m = Sb + Math.max(0, ...d.ticks.map((e) => i(f(e), 11))) + 8 + (e.yLabel ? Cb : 0), h = Sb + i(p(u.max), 11) / 2, g = Sb, _ = Sb + wb + (e.xLabel ? Cb : 0), v = {
21916
21929
  x: m,
21917
21930
  y: g,
21918
21931
  width: Math.max(1, t - m - h),
@@ -21925,39 +21938,39 @@ function jb(e, t, n, r, i) {
21925
21938
  points: a.map((e, t) => ({
21926
21939
  px: Z(u, e.volume, v.x, v.width),
21927
21940
  py: Z(d, e.price, v.y, v.height, !0),
21928
- alpha: Tb + (1 - Tb) * t / y,
21941
+ alpha: Eb + (1 - Eb) * t / y,
21929
21942
  point: e
21930
21943
  })),
21931
- phase: Ab(a),
21944
+ phase: jb(a),
21932
21945
  color: e.color ?? ue[0]
21933
21946
  };
21934
21947
  }
21935
- function Mb(e) {
21948
+ function Nb(e) {
21936
21949
  let t = e.points ?? 60;
21937
- return Number.isFinite(t) ? Math.min(Eb, Math.max(2, Math.floor(t))) : 60;
21950
+ return Number.isFinite(t) ? Math.min(Db, Math.max(2, Math.floor(t))) : 60;
21938
21951
  }
21939
- function Nb(e, t, n) {
21940
- let r = null, i = wb * wb;
21952
+ function Pb(e, t, n) {
21953
+ let r = null, i = Tb * Tb;
21941
21954
  for (let a = e.points.length - 1; a >= 0; a--) {
21942
21955
  let o = e.points[a], s = (o.px - t) ** 2 + (o.py - n) ** 2;
21943
21956
  s < i && (r = o, i = s);
21944
21957
  }
21945
21958
  return r;
21946
21959
  }
21947
- var Pb = new Intl.DateTimeFormat(void 0, {
21960
+ var Fb = new Intl.DateTimeFormat(void 0, {
21948
21961
  year: "numeric",
21949
21962
  month: "short",
21950
21963
  day: "numeric"
21951
21964
  });
21952
- function Fb(e, t, n, r, i, a, o = jb(r, t, n, i, T_(e, i))) {
21953
- let { plot: s, points: c, color: l } = o, u = r.timeFormat ?? ((e) => Pb.format(new Date(e))), d = r.priceFormat ?? C_, f = r.volumeFormat ?? C_;
21954
- e.fillStyle = i.background, e.fillRect(0, 0, t, n), k_(e, s, o.yScale, "vertical", i, r.priceFormat ?? Q(o.yScale)), k_(e, s, o.xScale, "horizontal", i, r.volumeFormat ?? Q(o.xScale)), Ib(e, s, r, i), e.save(), e.lineWidth = 1.5, e.lineJoin = "round";
21965
+ function Ib(e, t, n, r, i, a, o = Mb(r, t, n, i, E_(e, i))) {
21966
+ let { plot: s, points: c, color: l } = o, u = r.timeFormat ?? ((e) => Fb.format(new Date(e))), d = r.priceFormat ?? w_, f = r.volumeFormat ?? w_;
21967
+ e.fillStyle = i.background, e.fillRect(0, 0, t, n), A_(e, s, o.yScale, "vertical", i, r.priceFormat ?? Q(o.yScale)), A_(e, s, o.xScale, "horizontal", i, r.volumeFormat ?? Q(o.xScale)), Lb(e, s, r, i), e.save(), e.lineWidth = 1.5, e.lineJoin = "round";
21955
21968
  for (let t = 1; t < c.length; t++) e.strokeStyle = j(l, c[t].alpha), e.beginPath(), e.moveTo(c[t - 1].px, c[t - 1].py), e.lineTo(c[t].px, c[t].py), e.stroke();
21956
21969
  for (let t of c) e.fillStyle = j(l, t.alpha), e.beginPath(), e.arc(t.px, t.py, 2, 0, Math.PI * 2), e.fill();
21957
21970
  let p = c[c.length - 1];
21958
21971
  p && (e.fillStyle = l, e.strokeStyle = i.background, e.lineWidth = 2, e.beginPath(), e.arc(p.px, p.py, 5, 0, Math.PI * 2), e.fill(), e.stroke()), e.restore();
21959
- let m = a && r.crosshair !== !1 ? Nb(o, a.x, a.y) : null;
21960
- return m && a && (e.save(), e.strokeStyle = i.text, e.lineWidth = 1.5, e.beginPath(), e.arc(m.px, m.py, 5, 0, Math.PI * 2), e.stroke(), e.restore(), O_(e, [
21972
+ let m = a && r.crosshair !== !1 ? Pb(o, a.x, a.y) : null;
21973
+ return m && a && (e.save(), e.strokeStyle = i.text, e.lineWidth = 1.5, e.beginPath(), e.arc(m.px, m.py, 5, 0, Math.PI * 2), e.stroke(), e.restore(), k_(e, [
21961
21974
  {
21962
21975
  text: u(m.point.time),
21963
21976
  bold: !0,
@@ -21972,10 +21985,10 @@ function Fb(e, t, n, r, i, a, o = jb(r, t, n, i, T_(e, i))) {
21972
21985
  height: n
21973
21986
  }, i)), o;
21974
21987
  }
21975
- function Ib(e, t, n, r) {
21976
- e.save(), e.font = $(r, 11), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, t.x + t.width / 2, t.y + t.height + Cb + Sb)), n.yLabel && (e.translate(xb + 4, t.y + t.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
21988
+ function Lb(e, t, n, r) {
21989
+ e.save(), e.font = $(r, 11), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, t.x + t.width / 2, t.y + t.height + wb + Cb)), n.yLabel && (e.translate(Sb + 4, t.y + t.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
21977
21990
  }
21978
21991
  //#endregion
21979
- export { Xu as ABCDPatternTool, Gr as ADXIndicator, aa as ALMAIndicator, Wr as ATRIndicator, st as AXIS_LABEL_HEIGHT, Ni as AcceleratorOscillatorIndicator, Vi as AccumulationDistributionIndicator, Zo as AccumulativeSwingIndexIndicator, $o as AdvanceDeclineIndicator, zs as AlertDragHandler, bh as AlertManager, Ar as AlligatorIndicator, xr as AnchoredVWAPIndicator, Cu as AnchoredVWAPTool, vg as Animator, pf as ArcTool, Rt as AreaRenderer, Xr as AroonIndicator, qd as ArrowMarkTool, vu as ArrowTool, ja as AverageDayRangeIndicator, za as AveragePriceIndicator, zr as AwesomeOscillatorIndicator, Rs as AxisDragHandler, vi as BalanceOfPowerIndicator, Jm as BarCountdown, zt as BarRenderer, Vf as BarsPatternTool, bg as BaseFinanceChart, Ht as BaselineRenderer, vm as BinanceAdapter, va as BollingerBandWidthIndicator, ur as BollingerBandsIndicator, _a as BollingerPercentBIndicator, fp as BracketTool, of as BrushTool, Mm as BybitAdapter, Do as CANDLE_PATTERNS, Jr as CCIIndicator, $r as CMFIndicator, zd as CalloutTool, gt as CandlestickRenderer, Ye as CanvasLayer, Br as ChaikinOscillatorIndicator, Ei as ChaikinVolatilityIndicator, ma as ChandeKrollStopIndicator, bi as ChandeMomentumIndicator, kr as ChandelierExitIndicator, Gm as ChartLegend, qh as ChartStateManager, rs as ChopZoneIndicator, ni as ChoppinessIndexIndicator, ed as CircleTool, Em as CoinbaseAdapter, wn as CompareRenderer, hs as CompareSymbolIndicator, oi as ConnorsRSIIndicator, ci as CoppockIndicator, bs as CorrelationCoefficientIndicator, xs as CorrelationLogIndicator, Nu as CrossLineTool, Hs as CrosshairHandler, ic as CrosshairTooltip, Fp as CurrentPriceLine, ff as CurveTool, ud as CyclicLinesTool, $u as CypherPatternTool, Wm as DEFAULT_LEGEND_CONFIG, S as DEFAULT_MAX_WEBGL_CHARTS, ah as DEFAULT_SESSION_HOURS, ra as DEMAIndicator, C as DENSE_BAR_WIDTH, Qe as DPRManager, $h as DataExporter, od as DateAndPriceRangeTool, mu as DateRangeTool, bn as DepthHeatmapBuffer, xn as DepthHeatmapRenderer, op as DepthOverlay, _i as DetrendedPriceOscillatorIndicator, Ii as DisparityIndexIndicator, gr as DonchianChannelIndicator, K as DrawingBase, Dl as DrawingManager, kl as DrawingRenderer, lr as EMAIndicator, Ci as EaseOfMovementIndicator, _g as Easing, fi as ElderRayIndicator, lu as ElliottCorrectionTool, du as ElliottDoubleComboTool, cu as ElliottImpulseTool, uu as ElliottTriangleTool, fu as ElliottTripleComboTool, su as ElliottWaveTool, Ql as EllipseTool, Mp as Emitter, Pr as EnvelopeIndicator, qt as EquivolumeRenderer, mc as EventBus, Vl as ExtendedLineTool, Tf as FibArcsTool, Uu as FibChannelTool, wf as FibCirclesTool, Xl as FibExtensionTool, Jl as FibRetracementTool, qu as FibSpeedResistanceFanTool, Of as FibSpiralTool, Eu as FibTimeZonesTool, Ef as FibWedgeTool, xg as FinanceCrosshair, gi as FisherTransformIndicator, Wd as FlagTool, ai as ForceIndexIndicator, zf as ForecastTool, c_ as GROUP_HEADER, Su as GannBoxTool, bu as GannFanTool, kf as GannSquareTool, v as GridRenderer, Ia as GuppyMMAIndicator, Yt as HLCAreaRenderer, Wo as HammingMAIndicator, Zu as HeadAndShouldersTool, en as HiLoRenderer, sf as HighlighterTool, ba as HistoricalVolatilityIndicator, Bt as HollowCandleRenderer, Ll as HorizontalLineTool, Rl as HorizontalRayTool, wr as HullMAIndicator, Jd as ICON_GLYPHS, fr as IchimokuIndicator, Xd as IconTool, I as IndicatorBase, nr as IndicatorEngine, L as IndicatorValueMap, ps as IndicatorWorkerHost, zu as InfoLineTool, Ds as InteractionManager, oa as KAMAIndicator, li as KSTIndicator, Wt as KagiRenderer, hr as KeltnerChannelIndicator, Js as KeyboardHandler, hi as KlingerIndicator, zm as KrakenAdapter, sa as LSMAIndicator, Xe as LayerManager, Lt as LineRenderer, Zt as LineWithMarkersRenderer, Cr as LinearRegressionChannelIndicator, ka as LinearRegressionSlopeIndicator, Hr as MACDIndicator, Bo as MAChannelIndicator, da as MACrossIndicator, Jo as MADoubleIndicator, La as MARibbonIndicator, Yo as MATripleIndicator, dh as MAX_ALERT_BARS, Rp as MAX_BASE_RATIO, Lp as MAX_BASE_REQUESTS, Yr as MFIIndicator, fh as MIN_ALERT_BARS, Tt as MIN_BAR_UNIT, Dr as MTFMovingAverageIndicator, es as MajorityRuleIndicator, ln as MarketProfileRenderer, yi as MassIndexIndicator, ca as McGinleyDynamicIndicator, sg as MeasureOverlay, hu as MeasureTool, Ba as MedianPriceIndicator, ym as MockAdapter, nu as ModifiedSchiffPitchforkTool, ya as MomentumIndicator, Ma as NetVolumeIndicator, Rd as NoteTool, Kr as OBVIndicator, vp as OrderDraftTool, Xf as OrderRenderer, Is as PanHandler, Bs as PaneResizeHandler, kp as PaperExecutionAdapter, pr as ParabolicSARIndicator, Hl as ParallelChannelTool, cf as PathTool, ji as PercentagePriceOscillatorIndicator, mn as PeriodLevelsRenderer, lc as PinnedTooltip, Df as PitchfanTool, eu as PitchforkTool, vn as PivotMarkersRenderer, yr as PivotPointsIndicator, Gt as PointAndFigureRenderer, Sm as PollingAdapter, lf as PolylineTool, ap as PositionRenderer, Ri as PrettyGoodOscillatorIndicator, at as PriceAxis, As as PriceAxisAddButton, hd as PriceLabelTool, lh as PriceLines, os as PriceOscillatorIndicator, pu as PriceRangeTool, wi as PriceVolumeTrendIndicator, Bf as ProjectionTool, Li as QstickIndicator, Ot as RANGE_PRESETS, Zr as ROCIndicator, Vr as RSIIndicator, Bl as RayTool, Pp as ReconnectManager, Zl as RectangleTool, Ul as RegressionChannelTool, Fi as RelativeMomentumIndexIndicator, Di as RelativeVigorIndicator, Da as RelativeVolatilityIndexIndicator, St as RenderEngine, Ze as RenderLoop, Ut as RenkoRenderer, rm as ReplayController, Eh as ReplayManager, Kp as ResamplingAdapter, Mu as RiskRewardTool, hg as SELECTION_BOX_MIN_SIZE, cr as SMAIndicator, as as SMIErgodicIndicator, ia as SMMAIndicator, Oh as SNAPSHOT_VERSION, pi as SchaffTrendCycleIndicator, tu as SchiffPitchforkTool, Km as Screenshot, gg as SelectionBoxOverlay, Xm as SessionBreaks, oh as SessionShading, Or as SessionVWAPIndicator, ig as SignalMarkerManager, Pf as SineLineTool, gs as SpreadIndicator, Na as StandardErrorBandsIndicator, Aa as StandardErrorIndicator, zi as StdDevIndicator, Xt as StepLineRenderer, Ur as StochasticIndicator, Ea as StochasticMomentumIndexIndicator, Oi as StochasticRSIIndicator, nm as StreamManager, mr as SupertrendIndicator, Cn as SymbolSeriesStore, Rr as TEMAIndicator, xi as TRIXIndicator, Qr as TSIIndicator, _u as TextAnnotationTool, Qu as ThreeDrivesTool, Np as TickAggregator, Zp as TickBarAdapter, Xp as TickBarBuilder, Cs as TimeAxis, Nf as TimeCyclesTool, og as TradeZoneManager, cp as TradingContextMenu, sp as TradingDragHandler, Dp as TradingManager, Op as TradingRenderer, Lu as TrendAngleTool, Il as TrendLineTool, Oa as TrendStrengthIndexIndicator, $l as TriangleTool, Va as TypicalPriceIndicator, Ca as UlcerIndexIndicator, ri as UltimateOscillatorIndicator, Jh as UndoRedoManager, Hi as VROCIndicator, dr as VWAPIndicator, Mr as VWMAIndicator, zl as VerticalLineTool, Et as Viewport, Xo as VolatilityIndexIndicator, ls as VolatilityOHLCIndicator, us as VolatilityZeroTrendIndicator, Kt as VolumeCandleRenderer, ei as VolumeDeltaIndicator, xa as VolumeOscillatorIndicator, Bi as VolumeProfileIndicator, wu as VolumeProfileRangeTool, nn as VolumeProfileRenderer, tn as VolumeRenderer, ti as VortexIndicator, Nr as WMAIndicator, qm as Watermark, xm as WebSocketAdapter, Ti as WilliamsADIndicator, pa as WilliamsFractalsIndicator, qr as WilliamsRIndicator, Yu as XABCDPatternTool, Sr as ZigZagIndicator, Ls as ZoomHandler, $n as alignOutput, df as arcPoints, sn as assignSessionLetters, Q as axisFormat, D as barIndexToTime, l as barIndexToX, E as barTimeStep, a as barTimeStepMs, up as bracketRiskReward, T_ as canvasMeasure, _ as claimGpuContext, gn as classifyPivots, Kv as computeBarLayout, lp as computeBracketDefaults, ob as computeCalendarLayout, jb as computeCounterClockLayout, ay as computeDonutLayout, ky as computeHistogramLayout, an as computeMarketProfile, vb as computeMatrixLayout, pn as computePeriodLevels, gy as computeScatterLayout, cn as computeSessionProfiles, mb as correlationMatrix, Ab as counterClockPhase, Ob as counterClockPoints, uf as curvePoints, eb as dayToIso, C_ as defaultFormat, jo as detectCandlePatterns, ft as drawAxisValueLabels, Fn as drawnKeys, M as fillTag, Al as findDominantSwing, _n as findPivots, u as forEachPixelColumn, Rf as forecastOutcome, nc as formatTooltipTime, z as getIntParam, R as getNumberParam, Dt as getVisibleData, b as gpuContextsLeft, Un as hasHistogram, em as hasTrades, wy as histogramBins, qv as hitBar, Jv as hitCategory, sb as hitDay, Ay as hitHistogramBar, yb as hitMatrixCell, oy as hitSlice, ot as indicatorValuePrecision, gp as inferOrderType, Xn as inputSource, d as isDense, rh as isInWindow, mh as isPriceLevelAlert, ih as isRegularSession, In as isUpTone, fs as isWorkerResponse, lt as labelTextColor, dt as layoutAxisValueLabels, l_ as layoutGroupedTreemap, E_ as layoutLegend, o_ as layoutSquarifiedTreemap, n_ as layoutUniformGrid, Qn as lineSourceBars, Xc as lineSpace, Ct as loadWebGL, wt as loadWebGLRenderer, Pt as lttbDownsample, It as lttbVisibleIndices, th as mergeSessionHours, nh as minuteOfDay, Nb as nearestCounterClockPoint, _y as nearestPoint, b_ as niceScale, Vn as paneLogRange, Bn as paneValueRange, $y as parseDay, zn as plotColor, F as plotLook, Ln as plotShown, t as priceBucketRow, $e as priceScaleText, Zn as priceSourceBars, T as priceToY, o as priceToYMapper, Nt as rangePresetStart, Sh as readAlertOptions, Wy as readableText, Hf as registerBuiltInDrawingTools, ds as registerBuiltInIndicators, pt as renderAxisValueLabels, Yv as renderBarChart, cb as renderCalendar, Fb as renderCounterClock, y as renderDenseBars, Lg as renderDepthChart, sy as renderDonut, t_ as renderEquityCurve, zv as renderGauge, L_ as renderHeatmap, My as renderHistogram, bb as renderMatrix, Wn as renderPlots, vy as renderScatter, Sg as renderSparkline, av as renderWaterfall, r as resolveBarIndex, By as resolveColorScale, Vy as scaleColor, Up as servesTimeframe, m as setMaxWebGLCharts, Mb as shownCount, Yn as sourceParam, ct as spreadLabels, n as timeToX, i as timestampToBarIndex, Tn as toHeikinAshi, kn as toKagi, On as toLineBreak, An as toPointAndFigure, jn as toRangeBars, En as toRenko, on as tpoLetter, iu as waveLabel, c as whenGpuContextFree, Vp as withResampling, $p as withTickBars, g as xToBarIndex, e as xToTime, h as yToPrice };
21992
+ export { Xu as ABCDPatternTool, Gr as ADXIndicator, aa as ALMAIndicator, Wr as ATRIndicator, st as AXIS_LABEL_HEIGHT, Ni as AcceleratorOscillatorIndicator, Vi as AccumulationDistributionIndicator, Zo as AccumulativeSwingIndexIndicator, $o as AdvanceDeclineIndicator, zs as AlertDragHandler, xh as AlertManager, Ar as AlligatorIndicator, xr as AnchoredVWAPIndicator, Cu as AnchoredVWAPTool, yg as Animator, pf as ArcTool, Rt as AreaRenderer, Xr as AroonIndicator, qd as ArrowMarkTool, vu as ArrowTool, ja as AverageDayRangeIndicator, za as AveragePriceIndicator, zr as AwesomeOscillatorIndicator, Rs as AxisDragHandler, vi as BalanceOfPowerIndicator, Ym as BarCountdown, zt as BarRenderer, Vf as BarsPatternTool, xg as BaseFinanceChart, Ht as BaselineRenderer, vm as BinanceAdapter, va as BollingerBandWidthIndicator, ur as BollingerBandsIndicator, _a as BollingerPercentBIndicator, fp as BracketTool, of as BrushTool, Mm as BybitAdapter, Do as CANDLE_PATTERNS, Jr as CCIIndicator, $r as CMFIndicator, zd as CalloutTool, gt as CandlestickRenderer, Ye as CanvasLayer, Br as ChaikinOscillatorIndicator, Ei as ChaikinVolatilityIndicator, ma as ChandeKrollStopIndicator, bi as ChandeMomentumIndicator, kr as ChandelierExitIndicator, Gm as ChartLegend, Jh as ChartStateManager, rs as ChopZoneIndicator, ni as ChoppinessIndexIndicator, ed as CircleTool, Em as CoinbaseAdapter, wn as CompareRenderer, hs as CompareSymbolIndicator, oi as ConnorsRSIIndicator, ci as CoppockIndicator, bs as CorrelationCoefficientIndicator, xs as CorrelationLogIndicator, Nu as CrossLineTool, Hs as CrosshairHandler, ic as CrosshairTooltip, Fp as CurrentPriceLine, ff as CurveTool, ud as CyclicLinesTool, $u as CypherPatternTool, Wm as DEFAULT_LEGEND_CONFIG, S as DEFAULT_MAX_WEBGL_CHARTS, oh as DEFAULT_SESSION_HOURS, ra as DEMAIndicator, C as DENSE_BAR_WIDTH, Qe as DPRManager, eg as DataExporter, od as DateAndPriceRangeTool, mu as DateRangeTool, bn as DepthHeatmapBuffer, xn as DepthHeatmapRenderer, op as DepthOverlay, _i as DetrendedPriceOscillatorIndicator, Ii as DisparityIndexIndicator, gr as DonchianChannelIndicator, K as DrawingBase, Dl as DrawingManager, kl as DrawingRenderer, lr as EMAIndicator, Ci as EaseOfMovementIndicator, vg as Easing, fi as ElderRayIndicator, lu as ElliottCorrectionTool, du as ElliottDoubleComboTool, cu as ElliottImpulseTool, uu as ElliottTriangleTool, fu as ElliottTripleComboTool, su as ElliottWaveTool, Ql as EllipseTool, Mp as Emitter, Pr as EnvelopeIndicator, qt as EquivolumeRenderer, mc as EventBus, Vl as ExtendedLineTool, Tf as FibArcsTool, Uu as FibChannelTool, wf as FibCirclesTool, Xl as FibExtensionTool, Jl as FibRetracementTool, qu as FibSpeedResistanceFanTool, Of as FibSpiralTool, Eu as FibTimeZonesTool, Ef as FibWedgeTool, Sg as FinanceCrosshair, gi as FisherTransformIndicator, Wd as FlagTool, ai as ForceIndexIndicator, zf as ForecastTool, l_ as GROUP_HEADER, Su as GannBoxTool, bu as GannFanTool, kf as GannSquareTool, v as GridRenderer, Ia as GuppyMMAIndicator, Yt as HLCAreaRenderer, Wo as HammingMAIndicator, Zu as HeadAndShouldersTool, en as HiLoRenderer, sf as HighlighterTool, ba as HistoricalVolatilityIndicator, Bt as HollowCandleRenderer, Ll as HorizontalLineTool, Rl as HorizontalRayTool, wr as HullMAIndicator, Jd as ICON_GLYPHS, fr as IchimokuIndicator, Xd as IconTool, I as IndicatorBase, nr as IndicatorEngine, L as IndicatorValueMap, ps as IndicatorWorkerHost, zu as InfoLineTool, Ds as InteractionManager, oa as KAMAIndicator, li as KSTIndicator, Wt as KagiRenderer, hr as KeltnerChannelIndicator, Js as KeyboardHandler, hi as KlingerIndicator, zm as KrakenAdapter, sa as LSMAIndicator, Xe as LayerManager, Lt as LineRenderer, Zt as LineWithMarkersRenderer, Cr as LinearRegressionChannelIndicator, ka as LinearRegressionSlopeIndicator, Hr as MACDIndicator, Bo as MAChannelIndicator, da as MACrossIndicator, Jo as MADoubleIndicator, La as MARibbonIndicator, Yo as MATripleIndicator, fh as MAX_ALERT_BARS, Rp as MAX_BASE_RATIO, Lp as MAX_BASE_REQUESTS, Yr as MFIIndicator, ph as MIN_ALERT_BARS, Tt as MIN_BAR_UNIT, Dr as MTFMovingAverageIndicator, es as MajorityRuleIndicator, ln as MarketProfileRenderer, yi as MassIndexIndicator, ca as McGinleyDynamicIndicator, cg as MeasureOverlay, hu as MeasureTool, Ba as MedianPriceIndicator, ym as MockAdapter, nu as ModifiedSchiffPitchforkTool, ya as MomentumIndicator, Ma as NetVolumeIndicator, Rd as NoteTool, Kr as OBVIndicator, vp as OrderDraftTool, Xf as OrderRenderer, Is as PanHandler, Bs as PaneResizeHandler, kp as PaperExecutionAdapter, pr as ParabolicSARIndicator, Hl as ParallelChannelTool, cf as PathTool, ji as PercentagePriceOscillatorIndicator, mn as PeriodLevelsRenderer, lc as PinnedTooltip, Df as PitchfanTool, eu as PitchforkTool, vn as PivotMarkersRenderer, yr as PivotPointsIndicator, Gt as PointAndFigureRenderer, Sm as PollingAdapter, lf as PolylineTool, ap as PositionRenderer, Ri as PrettyGoodOscillatorIndicator, at as PriceAxis, As as PriceAxisAddButton, hd as PriceLabelTool, uh as PriceLines, os as PriceOscillatorIndicator, pu as PriceRangeTool, wi as PriceVolumeTrendIndicator, Bf as ProjectionTool, Li as QstickIndicator, Ot as RANGE_PRESETS, Zr as ROCIndicator, Vr as RSIIndicator, Bl as RayTool, Pp as ReconnectManager, Zl as RectangleTool, Ul as RegressionChannelTool, Fi as RelativeMomentumIndexIndicator, Di as RelativeVigorIndicator, Da as RelativeVolatilityIndexIndicator, St as RenderEngine, Ze as RenderLoop, Ut as RenkoRenderer, rm as ReplayController, Dh as ReplayManager, Kp as ResamplingAdapter, Mu as RiskRewardTool, gg as SELECTION_BOX_MIN_SIZE, cr as SMAIndicator, as as SMIErgodicIndicator, ia as SMMAIndicator, kh as SNAPSHOT_VERSION, pi as SchaffTrendCycleIndicator, tu as SchiffPitchforkTool, qm as Screenshot, _g as SelectionBoxOverlay, Zm as SessionBreaks, sh as SessionShading, Or as SessionVWAPIndicator, ag as SignalMarkerManager, Pf as SineLineTool, gs as SpreadIndicator, Na as StandardErrorBandsIndicator, Aa as StandardErrorIndicator, zi as StdDevIndicator, Xt as StepLineRenderer, Ur as StochasticIndicator, Ea as StochasticMomentumIndexIndicator, Oi as StochasticRSIIndicator, nm as StreamManager, mr as SupertrendIndicator, Cn as SymbolSeriesStore, Rr as TEMAIndicator, xi as TRIXIndicator, Qr as TSIIndicator, _u as TextAnnotationTool, Qu as ThreeDrivesTool, Np as TickAggregator, Zp as TickBarAdapter, Xp as TickBarBuilder, Cs as TimeAxis, Nf as TimeCyclesTool, sg as TradeZoneManager, cp as TradingContextMenu, sp as TradingDragHandler, Dp as TradingManager, Op as TradingRenderer, Lu as TrendAngleTool, Il as TrendLineTool, Oa as TrendStrengthIndexIndicator, $l as TriangleTool, Va as TypicalPriceIndicator, Ca as UlcerIndexIndicator, ri as UltimateOscillatorIndicator, Yh as UndoRedoManager, Hi as VROCIndicator, dr as VWAPIndicator, Mr as VWMAIndicator, zl as VerticalLineTool, Et as Viewport, Xo as VolatilityIndexIndicator, ls as VolatilityOHLCIndicator, us as VolatilityZeroTrendIndicator, Kt as VolumeCandleRenderer, ei as VolumeDeltaIndicator, xa as VolumeOscillatorIndicator, Bi as VolumeProfileIndicator, wu as VolumeProfileRangeTool, nn as VolumeProfileRenderer, tn as VolumeRenderer, ti as VortexIndicator, Nr as WMAIndicator, Jm as Watermark, xm as WebSocketAdapter, Ti as WilliamsADIndicator, pa as WilliamsFractalsIndicator, qr as WilliamsRIndicator, Yu as XABCDPatternTool, Sr as ZigZagIndicator, Ls as ZoomHandler, $n as alignOutput, df as arcPoints, sn as assignSessionLetters, Q as axisFormat, D as barIndexToTime, l as barIndexToX, E as barTimeStep, a as barTimeStepMs, up as bracketRiskReward, E_ as canvasMeasure, _ as claimGpuContext, gn as classifyPivots, qv as computeBarLayout, lp as computeBracketDefaults, sb as computeCalendarLayout, Mb as computeCounterClockLayout, oy as computeDonutLayout, Ay as computeHistogramLayout, an as computeMarketProfile, yb as computeMatrixLayout, pn as computePeriodLevels, _y as computeScatterLayout, cn as computeSessionProfiles, hb as correlationMatrix, jb as counterClockPhase, kb as counterClockPoints, uf as curvePoints, tb as dayToIso, w_ as defaultFormat, jo as detectCandlePatterns, ft as drawAxisValueLabels, Fn as drawnKeys, M as fillTag, Al as findDominantSwing, _n as findPivots, u as forEachPixelColumn, Rf as forecastOutcome, nc as formatTooltipTime, z as getIntParam, R as getNumberParam, Dt as getVisibleData, b as gpuContextsLeft, Un as hasHistogram, em as hasTrades, Ty as histogramBins, Jv as hitBar, Yv as hitCategory, cb as hitDay, jy as hitHistogramBar, bb as hitMatrixCell, sy as hitSlice, ot as indicatorValuePrecision, gp as inferOrderType, Xn as inputSource, d as isDense, ih as isInWindow, hh as isPriceLevelAlert, ah as isRegularSession, In as isUpTone, fs as isWorkerResponse, lt as labelTextColor, dt as layoutAxisValueLabels, u_ as layoutGroupedTreemap, D_ as layoutLegend, s_ as layoutSquarifiedTreemap, r_ as layoutUniformGrid, Qn as lineSourceBars, Xc as lineSpace, Ct as loadWebGL, wt as loadWebGLRenderer, Pt as lttbDownsample, It as lttbVisibleIndices, nh as mergeSessionHours, rh as minuteOfDay, Pb as nearestCounterClockPoint, vy as nearestPoint, x_ as niceScale, Vn as paneLogRange, Bn as paneValueRange, eb as parseDay, zn as plotColor, F as plotLook, Ln as plotShown, t as priceBucketRow, $e as priceScaleText, Zn as priceSourceBars, T as priceToY, o as priceToYMapper, Nt as rangePresetStart, Ch as readAlertOptions, Gy as readableText, Hf as registerBuiltInDrawingTools, ds as registerBuiltInIndicators, pt as renderAxisValueLabels, Xv as renderBarChart, lb as renderCalendar, Ib as renderCounterClock, y as renderDenseBars, Rg as renderDepthChart, cy as renderDonut, n_ as renderEquityCurve, Bv as renderGauge, R_ as renderHeatmap, Ny as renderHistogram, xb as renderMatrix, Wn as renderPlots, yy as renderScatter, Cg as renderSparkline, ov as renderWaterfall, r as resolveBarIndex, Vy as resolveColorScale, Hy as scaleColor, Up as servesTimeframe, m as setMaxWebGLCharts, Nb as shownCount, Yn as sourceParam, ct as spreadLabels, n as timeToX, i as timestampToBarIndex, Tn as toHeikinAshi, kn as toKagi, On as toLineBreak, An as toPointAndFigure, jn as toRangeBars, En as toRenko, on as tpoLetter, iu as waveLabel, c as whenGpuContextFree, Vp as withResampling, $p as withTickBars, g as xToBarIndex, e as xToTime, h as yToPrice };
21980
21993
 
21981
21994
  //# sourceMappingURL=index.js.map