@tradecanvas/chart 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/Chart.d.ts +6 -0
  2. package/dist/Chart.d.ts.map +1 -1
  3. package/dist/{LayoutSession-CE8S2GCG.js → LayoutSession-D8TcwPy1.js} +10 -3
  4. package/dist/LayoutSession-D8TcwPy1.js.map +1 -0
  5. package/dist/LayoutSession-DDs1N5h2.cjs +2 -0
  6. package/dist/LayoutSession-DDs1N5h2.cjs.map +1 -0
  7. package/dist/{WidgetGoToDate-DJyCaP4H.js → WidgetGoToDate-DnQxxvf1.js} +2 -2
  8. package/dist/{WidgetGoToDate-DJyCaP4H.js.map → WidgetGoToDate-DnQxxvf1.js.map} +1 -1
  9. package/dist/{WidgetGoToDate-Vfaztduf.cjs → WidgetGoToDate-hNVxz-Zb.cjs} +2 -2
  10. package/dist/{WidgetGoToDate-Vfaztduf.cjs.map → WidgetGoToDate-hNVxz-Zb.cjs.map} +1 -1
  11. package/dist/{WidgetIndicatorPicker-Nc-1Rbm_.cjs → WidgetIndicatorPicker-DKxoB4Un.cjs} +2 -2
  12. package/dist/{WidgetIndicatorPicker-Nc-1Rbm_.cjs.map → WidgetIndicatorPicker-DKxoB4Un.cjs.map} +1 -1
  13. package/dist/{WidgetIndicatorPicker-Cw7pFl_l.js → WidgetIndicatorPicker-eK03W3LR.js} +2 -2
  14. package/dist/{WidgetIndicatorPicker-Cw7pFl_l.js.map → WidgetIndicatorPicker-eK03W3LR.js.map} +1 -1
  15. package/dist/{WidgetSymbolSearch-DVIRTJuT.cjs → WidgetSymbolSearch-C_yw9mLo.cjs} +2 -2
  16. package/dist/{WidgetSymbolSearch-DVIRTJuT.cjs.map → WidgetSymbolSearch-C_yw9mLo.cjs.map} +1 -1
  17. package/dist/{WidgetSymbolSearch-B8iDwVy8.js → WidgetSymbolSearch-Dnkh_y4h.js} +2 -2
  18. package/dist/{WidgetSymbolSearch-B8iDwVy8.js.map → WidgetSymbolSearch-Dnkh_y4h.js.map} +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/widget/ChartWidget.d.ts.map +1 -1
  22. package/dist/widget/WidgetDrawingEdit.d.ts +13 -0
  23. package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -1
  24. package/dist/widget/WidgetMenus.d.ts +2 -0
  25. package/dist/widget/WidgetMenus.d.ts.map +1 -1
  26. package/dist/widget/WidgetSelectionToolbar.d.ts +4 -0
  27. package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -1
  28. package/dist/widget/drawingMenu.d.ts +3 -1
  29. package/dist/widget/drawingMenu.d.ts.map +1 -1
  30. package/dist/widget/index.cjs +4 -3
  31. package/dist/widget/index.cjs.map +1 -1
  32. package/dist/widget/index.js +169 -111
  33. package/dist/widget/index.js.map +1 -1
  34. package/dist/widget/widgetFeatures.d.ts.map +1 -1
  35. package/dist/{widgetFeatures-B-el8UA3.cjs → widgetFeatures-DpBWfQ8D.cjs} +2 -2
  36. package/dist/widgetFeatures-DpBWfQ8D.cjs.map +1 -0
  37. package/dist/{widgetFeatures-DsbSG6Pq.js → widgetFeatures-sU-9JOSB.js} +2 -1
  38. package/dist/widgetFeatures-sU-9JOSB.js.map +1 -0
  39. package/package.json +3 -3
  40. package/dist/LayoutSession-C9bQsnH2.cjs +0 -2
  41. package/dist/LayoutSession-C9bQsnH2.cjs.map +0 -1
  42. package/dist/LayoutSession-CE8S2GCG.js.map +0 -1
  43. package/dist/widgetFeatures-B-el8UA3.cjs.map +0 -1
  44. package/dist/widgetFeatures-DsbSG6Pq.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-CE8S2GCG.js";
1
+ import { _ as e, a as t, c as n, d as r, f as i, h as a, i as o, l as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m, v as ee } from "../LayoutSession-D8TcwPy1.js";
2
2
  import { _ as h, b as g, g as te, h as _, l as v, m as ne, n as re, t as ie, v as ae, y as oe } from "../widgetLocales-BX7VRdl5.js";
3
3
  import { t as se } from "../monthView-N8yDaTqZ.js";
4
- import { a as ce, c as le, d as ue, f as de, i as fe, l as pe, n as me, o as y, r as he, s as ge, t as _e, u as ve } from "../widgetFeatures-DsbSG6Pq.js";
4
+ import { a as ce, c as le, d as ue, f as de, i as fe, l as pe, n as me, o as y, r as he, s as ge, t as _e, u as ve } from "../widgetFeatures-sU-9JOSB.js";
5
5
  import { a as b, c as ye, i as x, l as be, n as xe, o as Se, r as Ce, s as we } from "../focusTrap-Br9Zfje0.js";
6
6
  import { a as Te, d as S, i as Ee, l as De, n as Oe, o as ke, r as Ae, s as je, t as Me, u as Ne } from "../symbolCatalog-B_9kDAjE.js";
7
7
  import { a as Pe, c as Fe, f as C, u as Ie } from "../settingsControls-DIjzCFHI.js";
@@ -4875,6 +4875,7 @@ var Do = class {
4875
4875
  e.canAlert,
4876
4876
  e.canFill === !0,
4877
4877
  e.canText === !0,
4878
+ e.canType === !0,
4878
4879
  t.fillColor,
4879
4880
  t.textColor
4880
4881
  ].join("|");
@@ -4898,6 +4899,7 @@ var Do = class {
4898
4899
  c("lineStyle", t("drawingSettings.lineStyle"), Oo(i)),
4899
4900
  e.canFill ? c("fill", t("drawingSettings.fill"), `<span class="tcw-sel-color tcw-sel-fill" style="background:${S(wo(st(e.style) ?? n))}"></span>`) : "",
4900
4901
  e.canText ? c("textColor", t("drawingSettings.textColor"), `<span class="tcw-sel-text" style="--c:${S(wo(e.style.textColor ?? n))}">T</span>`) : "",
4902
+ e.canType ? s("text", t("drawingSettings.text"), x("textEdit", 15)) : "",
4901
4903
  "<span class=\"tcw-sel-sep\" aria-hidden=\"true\"></span>",
4902
4904
  e.canSettings ? s("settings", t("legend.settings"), x("settings", 15)) : "",
4903
4905
  e.canAlert ? s("alert", t("drawingSettings.addAlert"), x("bell", 15)) : "",
@@ -4938,6 +4940,7 @@ var Do = class {
4938
4940
  return;
4939
4941
  }
4940
4942
  if (this.closePop(), n === "settings") this.callbacks.onSettings();
4943
+ else if (n === "text") this.callbacks.onText();
4941
4944
  else if (n === "alert") this.callbacks.onAlert();
4942
4945
  else if (n === "lock") this.callbacks.onLock(!this.target?.locked);
4943
4946
  else if (n === "delete") this.callbacks.onDelete();
@@ -6387,11 +6390,11 @@ var Ys = class {
6387
6390
  settings: J(() => import("../WidgetSettings-DCGCymVY.js")),
6388
6391
  indicatorSettings: J(() => import("../WidgetIndicatorSettings-DR8Z9RfF.js")),
6389
6392
  drawingSettings: J(() => import("../WidgetDrawingSettings-ezbzlGqD.js")),
6390
- goToDate: J(() => import("../WidgetGoToDate-DJyCaP4H.js")),
6393
+ goToDate: J(() => import("../WidgetGoToDate-DnQxxvf1.js")),
6391
6394
  hotkeySheet: J(() => import("../WidgetHotkeySheet-1lRFSdvt.js")),
6392
- indicatorPicker: J(() => import("../WidgetIndicatorPicker-Cw7pFl_l.js")),
6395
+ indicatorPicker: J(() => import("../WidgetIndicatorPicker-eK03W3LR.js")),
6393
6396
  commandPalette: J(() => import("../WidgetCommandPalette-B1jLC9oE.js")),
6394
- symbolSearch: J(() => import("../WidgetSymbolSearch-B8iDwVy8.js"))
6397
+ symbolSearch: J(() => import("../WidgetSymbolSearch-Dnkh_y4h.js"))
6395
6398
  };
6396
6399
  async function Xs() {
6397
6400
  await Promise.all(Object.values(Y).map((e) => e.load().catch(() => null)));
@@ -8045,6 +8048,10 @@ function ll(e, t) {
8045
8048
  id: "settings",
8046
8049
  label: t("drawingMenu.settings"),
8047
8050
  icon: "settings"
8051
+ }), e.canText && r && o.push({
8052
+ id: "text",
8053
+ label: t("drawingSettings.text"),
8054
+ icon: "textEdit"
8048
8055
  }), e.canAlert && r && o.push({
8049
8056
  id: "alert",
8050
8057
  label: t("drawingSettings.addAlert"),
@@ -8118,7 +8125,8 @@ var ul = class {
8118
8125
  let a = ce(ll({
8119
8126
  selected: i,
8120
8127
  canConfigure: !0,
8121
- canAlert: this.host.chart.canAddDrawingAlert(e)
8128
+ canAlert: this.host.chart.canAddDrawingAlert(e),
8129
+ canText: this.host.canTypeDrawingText(e)
8122
8130
  }, this.host.t), me, this.host.featureState), o = i.map((e) => e.id), s = r.get(e), c = s ? this.host.options.drawingMenuItems?.({
8123
8131
  id: e,
8124
8132
  type: s.type,
@@ -8135,6 +8143,9 @@ var ul = class {
8135
8143
  case "settings":
8136
8144
  this.host.openDrawingSettings(e);
8137
8145
  return;
8146
+ case "text":
8147
+ this.host.editDrawingText(e);
8148
+ return;
8138
8149
  case "alert":
8139
8150
  this.host.alerting.addDrawingAlert(e);
8140
8151
  return;
@@ -9732,8 +9743,8 @@ var Zl = class {
9732
9743
  restoreSettings(e, t = null, n) {
9733
9744
  n !== void 0 && (this.host.comparing.compareScaleHeld = n && this.host.comparing.compares.length > 0), this.applySettings(e), t && t.theme === (this.host.chart.getTheme()?.name ?? "") && this.host.chart.applyOverrides(t.overrides, { layer: "user" }), this.host.settings?.refresh(this.shownSettings());
9734
9745
  }
9735
- }, eu = 13;
9736
- function tu(e) {
9746
+ }, eu = 13, tu = 8, nu = 6, ru = 1.3, iu = 120, au = 2, ou = 8, su = 20;
9747
+ function cu(e) {
9737
9748
  let t = e.filter((e) => e !== null);
9738
9749
  if (t.length === 0) return null;
9739
9750
  let n = Math.min(...t.map((e) => e.x)), r = Math.min(...t.map((e) => e.y)), i = Math.max(...t.map((e) => e.x + e.width)), a = Math.max(...t.map((e) => e.y + e.height));
@@ -9744,7 +9755,7 @@ function tu(e) {
9744
9755
  height: a - r
9745
9756
  };
9746
9757
  }
9747
- var nu = class {
9758
+ var lu = class {
9748
9759
  constructor(e) {
9749
9760
  this.host = e;
9750
9761
  }
@@ -9775,7 +9786,7 @@ var nu = class {
9775
9786
  e.hide();
9776
9787
  return;
9777
9788
  }
9778
- let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c = tu(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
9789
+ let i = this.host.chartOffset(), a = r[0], o = (a.paneId === void 0 ? void 0 : this.host.chart.getIndicatorPanes().find((e) => e.instanceId === a.paneId)?.rect) ?? this.host.chart.getPlotRect(), s = this.host.chart.getPlotRect(), c = cu(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
9779
9790
  x: o.x + o.width / 2,
9780
9791
  y: o.y,
9781
9792
  width: 0,
@@ -9800,44 +9811,85 @@ var nu = class {
9800
9811
  canSettings: this.host.featureState.drawingSettings && r.length === 1,
9801
9812
  canAlert: this.host.featureState.alerts && r.length === 1 && this.host.chart.canAddDrawingAlert(a.id),
9802
9813
  canFill: this.host.chart.getDrawingToolDescriptor(a.type)?.fill === !0,
9803
- canText: this.host.chart.getDrawingToolDescriptor(a.type)?.text === !0
9814
+ canText: this.host.chart.getDrawingToolDescriptor(a.type)?.text === !0,
9815
+ canType: r.length === 1 && this.canTypeText(a.id)
9804
9816
  });
9805
9817
  }
9818
+ canTypeText(e) {
9819
+ let t = this.host.chart.getDrawings().find((t) => t.id === e);
9820
+ return t !== void 0 && !t.locked && (K[t.type] !== void 0 || ko.has(t.type));
9821
+ }
9822
+ isOnDrawingText(e, t, n) {
9823
+ let r = this.host.chart.getDrawingTextRect(e);
9824
+ return r != null && t >= r.x - ou && t <= r.x + r.width + ou && n >= r.y - ou && n <= r.y + r.height + ou;
9825
+ }
9826
+ editDrawingText(e) {
9827
+ this.canTypeText(e) && (this.editTextInPlace(e, !1) || this.openDrawingSettings(e, { tab: "text" }));
9828
+ }
9829
+ placedTextRect(e, t, n) {
9830
+ let r = this.host.chart.getDrawingTextRect(e);
9831
+ if (r) {
9832
+ let t = (this.host.chart.getDrawings().find((t) => t.id === e)?.style.text ?? "").trim(), i = Math.min(su, t.split("\n").length) * n, a = r.height > i + au, o = a ? Math.hypot(r.width, r.height) : r.width, s = a ? i : r.height;
9833
+ return {
9834
+ x: r.x + (r.width - o) / 2 - tu,
9835
+ y: r.y + (r.height - s) / 2 - nu,
9836
+ width: o + tu * 2,
9837
+ height: s + nu * 2
9838
+ };
9839
+ }
9840
+ let i = this.host.chart.getDrawingRect(e);
9841
+ if (!i) return null;
9842
+ let a = n + nu * 2;
9843
+ return {
9844
+ x: i.x + (i.width - iu) / 2,
9845
+ y: t === "rectangle" ? i.y : i.y + i.height / 2 - a,
9846
+ width: iu,
9847
+ height: a
9848
+ };
9849
+ }
9806
9850
  editTextInPlace(e, t) {
9807
9851
  if (e === this.inlineTextId && this.inlineText?.isOpen()) return !0;
9808
- let n = this.host.chart.getDrawings().find((t) => t.id === e), r = this.inlineText;
9809
- if (!n || !r || n.locked || !t && !this.host.chart.beginDrawingEdit(e)) return !1;
9810
- let i = K[n.type], a = n.style, o = a.text ?? "", s = (n) => {
9852
+ let n = this.host.chart.getDrawings().find((t) => t.id === e), r = this.inlineText, i = n ? K[n.type] : void 0, a = n !== void 0 && !i && ko.has(n.type);
9853
+ if (!n || !r || n.locked || !i && !a || !t && !this.host.chart.beginDrawingEdit(e)) return !1;
9854
+ let o = n.style, s = (a ? this.host.chart.getDrawingTextSize(e) : null) || o.fontSize || i?.fontSize || eu, c = o.text ?? "", l = (n) => {
9811
9855
  this.inlineTextId = null, t ? n || this.host.chart.takeBackDrawing(e) : this.host.chart.endDrawingEdit(e, { cancel: !n }), this.host.docking.refreshObjects();
9812
9856
  };
9813
9857
  return r.open({
9814
9858
  rect: () => {
9815
- let t = this.host.chart.getDrawingTextRect(e);
9859
+ let t = a ? this.placedTextRect(e, n.type, s * ru) : this.host.chart.getDrawingTextRect(e);
9816
9860
  if (!t) return null;
9817
- let n = this.host.chartContainer.getBoundingClientRect();
9861
+ let r = this.host.chartContainer.getBoundingClientRect();
9818
9862
  return {
9819
- x: n.left + t.x,
9820
- y: n.top + t.y,
9863
+ x: r.left + t.x,
9864
+ y: r.top + t.y,
9821
9865
  width: t.width,
9822
9866
  height: t.height
9823
9867
  };
9824
9868
  },
9825
- text: o,
9869
+ text: c,
9826
9870
  font: {
9827
- size: a.fontSize || i?.fontSize || eu,
9828
- bold: a.bold === !0,
9829
- italic: a.italic === !0,
9871
+ size: s,
9872
+ bold: o.bold === !0,
9873
+ italic: o.italic === !0,
9830
9874
  family: this.host.chart.getFont?.()?.family ?? this.host.ui.font.family
9831
9875
  },
9832
- color: a.textColor ?? Ao[n.type] ?? a.color,
9876
+ color: o.textColor ?? Ao[n.type] ?? o.color,
9833
9877
  label: this.host.t("drawingSettings.text"),
9834
- placeholder: this.host.drawingToolName(n.type),
9878
+ placeholder: a ? this.host.t("drawingSettings.text") : this.host.drawingToolName(n.type),
9835
9879
  onInput: (n) => t ? this.host.chart.amendNewDrawing(e, { style: { text: n } }) : this.host.chart.updateDrawing(e, { style: { text: n } }),
9836
9880
  onCommit: (n) => {
9837
9881
  let r = n.replace(/\s+$/, "");
9838
- r && r !== n && (t ? this.host.chart.amendNewDrawing(e, { style: { text: r } }) : this.host.chart.updateDrawing(e, { style: { text: r } })), s(r.length > 0);
9882
+ if (a) {
9883
+ if (r === c) {
9884
+ l(!1);
9885
+ return;
9886
+ }
9887
+ r !== n && this.host.chart.updateDrawing(e, { style: { text: r } }), l(!0);
9888
+ return;
9889
+ }
9890
+ r && r !== n && (t ? this.host.chart.amendNewDrawing(e, { style: { text: r } }) : this.host.chart.updateDrawing(e, { style: { text: r } })), l(r.length > 0);
9839
9891
  },
9840
- onCancel: () => s(!1),
9892
+ onCancel: () => l(!1),
9841
9893
  returnFocus: () => this.host.chartContainer.querySelector("[tabindex]") ?? this.host.chartContainer
9842
9894
  }) ? (this.inlineTextId = e, this.inlineTextNew = t, !0) : (t || this.host.chart.endDrawingEdit(e, { cancel: !0 }), !1);
9843
9895
  }
@@ -9876,7 +9928,7 @@ var nu = class {
9876
9928
  }
9877
9929
  });
9878
9930
  }
9879
- }, ru = 200, iu = class {
9931
+ }, uu = 200, du = class {
9880
9932
  constructor(e) {
9881
9933
  this.host = e;
9882
9934
  }
@@ -9905,7 +9957,7 @@ var nu = class {
9905
9957
  for (; o > 0 && n[o - 1].time * r >= a;) o--;
9906
9958
  let s = this.host.displayTimezone();
9907
9959
  return kn({
9908
- dayShare: n.slice(-ru).some((e) => {
9960
+ dayShare: n.slice(-uu).some((e) => {
9909
9961
  let t = e.time * r, n = new Date(t + ot(s, t) * 6e4).getUTCDay();
9910
9962
  return n === 0 || n === 6;
9911
9963
  }) ? 1 : 5 / 7,
@@ -9950,7 +10002,7 @@ var nu = class {
9950
10002
  handleToggleTimeframeFavorite(e) {
9951
10003
  this.host.timeframeFavorites.toggle(e), this.host.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()), this.host.updateUI();
9952
10004
  }
9953
- }, au = 600, ou = 24, su = [
10005
+ }, fu = 600, pu = 24, mu = [
9954
10006
  "--tcw-toolbar-h",
9955
10007
  "--tcw-control-h",
9956
10008
  "--tcw-control-h-sm",
@@ -9968,33 +10020,33 @@ var nu = class {
9968
10020
  "--tcw-line-height",
9969
10021
  "--tcw-line-xs",
9970
10022
  "--tcw-label-size"
9971
- ], cu = 48, lu = 5e4, uu = 100;
9972
- function du() {
10023
+ ], hu = 48, gu = 5e4, _u = 100;
10024
+ function vu() {
9973
10025
  return new Promise((e) => {
9974
10026
  if (typeof requestAnimationFrame != "function" || document.hidden) {
9975
10027
  setTimeout(e, 0);
9976
10028
  return;
9977
10029
  }
9978
- let t = setTimeout(e, uu);
10030
+ let t = setTimeout(e, _u);
9979
10031
  requestAnimationFrame(() => setTimeout(() => {
9980
10032
  clearTimeout(t), e();
9981
10033
  }, 0));
9982
10034
  });
9983
10035
  }
9984
- var fu = 864e5, pu = 5e3, mu = 2e3, hu = 48, gu = "rgba(255,255,255,0.03)", _u = "rgba(0,0,0,0.03)", vu = 2;
9985
- function yu(e) {
10036
+ var yu = 864e5, bu = 5e3, xu = 2e3, Su = 48, Cu = "rgba(255,255,255,0.03)", wu = "rgba(0,0,0,0.03)", Tu = 2;
10037
+ function Eu(e) {
9986
10038
  if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph")) return null;
9987
10039
  if (/^[a-z]$/i.test(e.key)) return e.key;
9988
10040
  let t = /^Key([A-Z])$/.exec(e.code ?? "");
9989
10041
  return t && [...e.key].length === 1 && !/[\s\d]/.test(e.key) ? t[1].toLowerCase() : null;
9990
10042
  }
9991
- var bu = 1e3, xu = [
10043
+ var Du = 1e3, Ou = [
9992
10044
  ["barCountdown", "barCountdown"],
9993
10045
  ["logScale", "logScale"],
9994
10046
  ["legendVisible", "legend"],
9995
10047
  ["volumeVisible", "volume"]
9996
- ], Su = v.filter((e) => Ke[e] !== "color");
9997
- function Cu(e) {
10048
+ ], ku = v.filter((e) => Ke[e] !== "color");
10049
+ function Au(e) {
9998
10050
  if (!e.feed) return e;
9999
10051
  if (e.adapter) throw TypeError("A widget takes an adapter or a feed, not both");
10000
10052
  return {
@@ -10003,9 +10055,9 @@ function Cu(e) {
10003
10055
  feed: void 0
10004
10056
  };
10005
10057
  }
10006
- var wu = class {
10007
- intervals = new iu(this.intervalsHost());
10008
- drawingEdit = new nu(this.drawingEditHost());
10058
+ var ju = class {
10059
+ intervals = new du(this.intervalsHost());
10060
+ drawingEdit = new lu(this.drawingEditHost());
10009
10061
  chartSettings = new $l(this.chartSettingsHost());
10010
10062
  docking = new Wl(this.dockingHost());
10011
10063
  layouts = new Vl(this.layoutsHost());
@@ -10138,7 +10190,7 @@ var wu = class {
10138
10190
  priceAxisAddDefault = !1;
10139
10191
  marksDefault = !0;
10140
10192
  constructor(e, t = {}) {
10141
- let n = Cu(t);
10193
+ let n = Au(t);
10142
10194
  this.options = n;
10143
10195
  let { isDark: r, resolvedTheme: i, features: a, chartFeatures: o } = this.readOptions(n);
10144
10196
  this.buildRoot(e, n, r, i), this.buildToolbar(n, a);
@@ -10200,7 +10252,7 @@ var wu = class {
10200
10252
  priceAxisAddButton: this.priceAxisAddDefault && this.featureState["menu.priceAxisAdd"],
10201
10253
  marks: o.marks !== !1 && this.featureState.marks
10202
10254
  };
10203
- if (this.marksDefault = o.marks !== !1, this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(xu.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
10255
+ if (this.marksDefault = o.marks !== !1, this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(Ou.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
10204
10256
  ...this.chartSettings.settingsState,
10205
10257
  legendVisible: o.legend !== !1,
10206
10258
  volumeVisible: o.volume !== !1,
@@ -10235,7 +10287,7 @@ var wu = class {
10235
10287
  }
10236
10288
  buildRoot(e, t, n, r) {
10237
10289
  ln(), this.root = document.createElement("div"), this.root.className = "tcw-root";
10238
- let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : Nu(t.locale) ? "rtl" : "ltr";
10290
+ let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : Bu(t.locale) ? "rtl" : "ltr";
10239
10291
  this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new mc(this.root), this.portal.className = "tcw-root tcw-portal", this.look = tr({
10240
10292
  dark: n,
10241
10293
  theme: r
@@ -10329,8 +10381,8 @@ var wu = class {
10329
10381
  rail: this.t("dock.rail"),
10330
10382
  resize: this.t("dock.resize")
10331
10383
  },
10332
- savedWidth: () => ju(),
10333
- saveWidth: (e) => Mu(e),
10384
+ savedWidth: () => Ru(),
10385
+ saveWidth: (e) => zu(e),
10334
10386
  railShown: () => this.docking.railShown(),
10335
10387
  focusAfterClose: (e) => this.docking.panelFocusTarget(e),
10336
10388
  room: () => n.clientWidth
@@ -10433,7 +10485,7 @@ var wu = class {
10433
10485
  }
10434
10486
  }), this.clockTimer = setInterval(() => {
10435
10487
  !Yr() && this.featureState.statusBar && this.featureState["statusBar.clock"] && this.statusBar?.tick();
10436
- }, bu), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
10488
+ }, Du), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
10437
10489
  title: this.t("goTo.title"),
10438
10490
  date: this.t("range.date"),
10439
10491
  range: this.t("goTo.range"),
@@ -10593,8 +10645,8 @@ var wu = class {
10593
10645
  remove: (t, n) => e.remove(t, n)
10594
10646
  }
10595
10647
  }, this.t)), this.drawingEdit.inlineText = new Vo(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
10596
- let t = e.payload.id, n = this.chart.getDrawings().find((e) => e.id === t)?.type;
10597
- n && K[n] && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, n && K[n] ? { tab: "text" } : {});
10648
+ let { id: t, x: n, y: r } = e.payload, i = this.chart.getDrawings().find((e) => e.id === t)?.type;
10649
+ i && K[i] && this.drawingEdit.editTextInPlace(t, !1) || i && ko.has(i) && this.drawingEdit.isOnDrawingText(t, n, r) && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, i && K[i] ? { tab: "text" } : {});
10598
10650
  }), this.chart.on("drawingRemove", (e) => {
10599
10651
  let t = e.payload.id;
10600
10652
  t === this.drawingEdit.inlineTextId && (this.drawingEdit.inlineText?.close(), this.drawingEdit.inlineTextNew || this.chart.endDrawingEdit(t), this.drawingEdit.inlineTextId = null);
@@ -10610,7 +10662,7 @@ var wu = class {
10610
10662
  justDrawn: !0
10611
10663
  }));
10612
10664
  }, s = () => setTimeout(o, 0);
10613
- window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, au), this.drawingEdit.cancelTextPrompt = a;
10665
+ window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, fu), this.drawingEdit.cancelTextPrompt = a;
10614
10666
  }), this.drawingStyle = new _o(this.root, {
10615
10667
  onStyleChange: (e) => {
10616
10668
  this.chart.setDrawingStyle(e), this.chart.setSelectedDrawingStyle(e);
@@ -10637,6 +10689,10 @@ var wu = class {
10637
10689
  let e = this.chart.getSelectedDrawingIds()[0];
10638
10690
  e && this.drawingEdit.openDrawingSettings(e);
10639
10691
  },
10692
+ onText: () => {
10693
+ let e = this.chart.getSelectedDrawingIds()[0];
10694
+ e && this.drawingEdit.editDrawingText(e);
10695
+ },
10640
10696
  onAlert: () => {
10641
10697
  let e = this.chart.getSelectedDrawingIds()[0];
10642
10698
  e && this.alerting.addDrawingAlert(e);
@@ -10890,8 +10946,8 @@ var wu = class {
10890
10946
  onAction: (e) => this.commands.handleAction(e),
10891
10947
  onClose: () => {}
10892
10948
  }, this.overlayHost, this.t, {
10893
- list: () => Ou(),
10894
- add: (e) => ku([e, ...Ou().filter((t) => t !== e)])
10949
+ list: () => Fu(),
10950
+ add: (e) => Iu([e, ...Fu().filter((t) => t !== e)])
10895
10951
  })), this.boundGlobalKeydown = (e) => {
10896
10952
  if (this.handleHostHotkey(e) || this.featureState.hotkeys && this.replay.isOpen() && this.replay.handleReplayKey(e)) return;
10897
10953
  let t = L(this.root), n = (e) => this.featureState.hotkeys && this.featureState[e];
@@ -10912,11 +10968,11 @@ var wu = class {
10912
10968
  let t = document.activeElement;
10913
10969
  if (t && t !== document.body && !this.root.contains(t)) return;
10914
10970
  e.preventDefault(), this.intervals.intervalInput.open(e.key);
10915
- } else if (yu(e) !== null) {
10971
+ } else if (Eu(e) !== null) {
10916
10972
  if (e.defaultPrevented || !n("symbolTyping") || !this.featureState.symbolSearch || R() || Nr() || !L(this.root, !0)) return;
10917
10973
  let t = document.activeElement;
10918
10974
  if (t && t !== document.body && !this.root.contains(t)) return;
10919
- e.preventDefault(), this.openSymbolSearch(yu(e));
10975
+ e.preventDefault(), this.openSymbolSearch(Eu(e));
10920
10976
  } else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyI" || e.code === "KeyG" || e.code === "KeyR")) {
10921
10977
  if (R() || !t) return;
10922
10978
  if (e.code === "KeyI") {
@@ -10948,10 +11004,10 @@ var wu = class {
10948
11004
  this.destroyed || Xs();
10949
11005
  }, t = globalThis;
10950
11006
  if (t.requestIdleCallback && t.cancelIdleCallback) {
10951
- let n = t.requestIdleCallback(e, { timeout: pu }), r = t.cancelIdleCallback;
11007
+ let n = t.requestIdleCallback(e, { timeout: bu }), r = t.cancelIdleCallback;
10952
11008
  this.stopPreload = () => r(n);
10953
11009
  } else {
10954
- let t = setTimeout(e, mu);
11010
+ let t = setTimeout(e, xu);
10955
11011
  this.stopPreload = () => clearTimeout(t);
10956
11012
  }
10957
11013
  }
@@ -11113,7 +11169,7 @@ var wu = class {
11113
11169
  for (let t of [this.root, this.portal]) {
11114
11170
  if (Oa(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
11115
11171
  let n = Da(e);
11116
- for (let e of su) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
11172
+ for (let e of mu) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
11117
11173
  }
11118
11174
  }
11119
11175
  fitScale() {
@@ -11122,7 +11178,7 @@ var wu = class {
11122
11178
  if (e !== this.uiScale) {
11123
11179
  if (this.ui.scale === "auto") {
11124
11180
  let t = this.root.clientWidth;
11125
- if ((e > this.uiScale ? la(t - ou) : la(t + ou)) === this.uiScale) return;
11181
+ if ((e > this.uiScale ? la(t - pu) : la(t + pu)) === this.uiScale) return;
11126
11182
  }
11127
11183
  this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
11128
11184
  }
@@ -11297,13 +11353,13 @@ var wu = class {
11297
11353
  }
11298
11354
  paintWatermark() {
11299
11355
  this.chart.setWatermark(De(this.state.symbol).ticker.replace("USDT", " / USDT"), {
11300
- fontSize: hu,
11301
- color: this.state.isDark ? gu : _u
11356
+ fontSize: Su,
11357
+ color: this.state.isDark ? Cu : wu
11302
11358
  });
11303
11359
  }
11304
11360
  keepingLook(e) {
11305
11361
  this.chartSettings.settingsEdit && this.settings?.close();
11306
- let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(Su.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
11362
+ let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(ku.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
11307
11363
  e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
11308
11364
  }
11309
11365
  sheetKeyOn(e) {
@@ -11442,7 +11498,7 @@ var wu = class {
11442
11498
  from: i(o.from),
11443
11499
  to: i(o.to)
11444
11500
  },
11445
- withTime: !(k(this.state.timeframe) >= fu),
11501
+ withTime: !(k(this.state.timeframe) >= yu),
11446
11502
  max: s,
11447
11503
  today: s
11448
11504
  });
@@ -11507,9 +11563,9 @@ var wu = class {
11507
11563
  }
11508
11564
  async switchLocalTimeframe() {
11509
11565
  if (!this.baseSeries) return;
11510
- let e = ++this.localSeq, t = this.lastLocalSwitchMs >= cu || this.baseSeries.length >= lu;
11566
+ let e = ++this.localSeq, t = this.lastLocalSwitchMs >= hu || this.baseSeries.length >= gu;
11511
11567
  try {
11512
- if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await du(), e !== this.localSeq || this.destroyed)) return;
11568
+ if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await vu(), e !== this.localSeq || this.destroyed)) return;
11513
11569
  this.applyTimeframeData();
11514
11570
  } finally {
11515
11571
  e === this.localSeq && this.loading.end();
@@ -11623,7 +11679,7 @@ var wu = class {
11623
11679
  defaults: r.descriptor.defaultConfig,
11624
11680
  params: r.params,
11625
11681
  inputs: r.descriptor.inputs,
11626
- lineSources: Tu(t, n, this.t),
11682
+ lineSources: Mu(t, n, this.t),
11627
11683
  plots: r.descriptor.plots,
11628
11684
  colors: i?.colors,
11629
11685
  lineWidth: i?.lineWidths[0],
@@ -11642,7 +11698,7 @@ var wu = class {
11642
11698
  this.alerting.refreshAlerts(), this.trading.refreshAccountSoon(), this.dataWindow?.isOpen() && this.dataWindow.render(this.docking.buildDataWindowModel());
11643
11699
  }
11644
11700
  formatMoney(e) {
11645
- return this.formatNumber(e, Math.min(vt(this.chart.getPriceStep()), vu));
11701
+ return this.formatNumber(e, Math.min(vt(this.chart.getPriceStep()), Tu));
11646
11702
  }
11647
11703
  formatVolume(e) {
11648
11704
  return tt(e, this.chartSettings.settingsState.numberLocale || "en-US");
@@ -12173,6 +12229,8 @@ var wu = class {
12173
12229
  return e.objectTree;
12174
12230
  },
12175
12231
  openDrawingSettings: (...t) => e.drawingEdit.openDrawingSettings(...t),
12232
+ editDrawingText: (...t) => e.drawingEdit.editDrawingText(...t),
12233
+ canTypeDrawingText: (...t) => e.drawingEdit.canTypeText(...t),
12176
12234
  openSettings: (...t) => e.chartSettings.openSettings(...t),
12177
12235
  get options() {
12178
12236
  return e.options;
@@ -12559,7 +12617,7 @@ var wu = class {
12559
12617
  };
12560
12618
  }
12561
12619
  };
12562
- function Tu(e, t, n) {
12620
+ function Mu(e, t, n) {
12563
12621
  let r = (e) => {
12564
12622
  let t = Vt(e.descriptor);
12565
12623
  return t && ct(e.params[t])?.instanceId || null;
@@ -12582,66 +12640,66 @@ function Tu(e, t, n) {
12582
12640
  }
12583
12641
  return a;
12584
12642
  }
12585
- var Eu = "tcw:recentCommands", Du = 10;
12586
- function Ou() {
12643
+ var Nu = "tcw:recentCommands", Pu = 10;
12644
+ function Fu() {
12587
12645
  try {
12588
- let e = JSON.parse(Xr()?.getItem(Eu) ?? "[]");
12589
- return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, Du) : [];
12646
+ let e = JSON.parse(Xr()?.getItem(Nu) ?? "[]");
12647
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, Pu) : [];
12590
12648
  } catch {
12591
12649
  return [];
12592
12650
  }
12593
12651
  }
12594
- function ku(e) {
12652
+ function Iu(e) {
12595
12653
  try {
12596
- Xr()?.setItem(Eu, JSON.stringify(e.slice(0, Du)));
12654
+ Xr()?.setItem(Nu, JSON.stringify(e.slice(0, Pu)));
12597
12655
  } catch {}
12598
12656
  }
12599
- var Au = "tcw:dockWidth";
12600
- function ju() {
12657
+ var Lu = "tcw:dockWidth";
12658
+ function Ru() {
12601
12659
  try {
12602
- let e = Number(Xr()?.getItem(Au) ?? NaN);
12660
+ let e = Number(Xr()?.getItem(Lu) ?? NaN);
12603
12661
  return Number.isFinite(e) && e > 0 ? e : null;
12604
12662
  } catch {
12605
12663
  return null;
12606
12664
  }
12607
12665
  }
12608
- function Mu(e) {
12666
+ function zu(e) {
12609
12667
  try {
12610
- Xr()?.setItem(Au, String(e));
12668
+ Xr()?.setItem(Lu, String(e));
12611
12669
  } catch {}
12612
12670
  }
12613
- function Nu(e) {
12671
+ function Bu(e) {
12614
12672
  return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
12615
12673
  }
12616
12674
  //#endregion
12617
12675
  //#region src/widget/GridLayoutPicker.ts
12618
- var Pu = 2, Fu = 20, Iu = 2, Lu = 16, Ru = 2, zu = 4, Bu = {
12676
+ var Vu = 2, Hu = 20, Uu = 2, Wu = 16, Gu = 2, Ku = 4, qu = {
12619
12677
  left: "grid.layoutBigLeft",
12620
12678
  right: "grid.layoutBigRight",
12621
12679
  top: "grid.layoutBigTop",
12622
12680
  bottom: "grid.layoutBigBottom"
12623
12681
  };
12624
- function Vu(e, t, n) {
12625
- let r = (Fu - Iu * (n - 1)) / n;
12626
- return [Pu + e * (r + Iu), t * r + (t - 1) * Iu];
12682
+ function Ju(e, t, n) {
12683
+ let r = (Hu - Uu * (n - 1)) / n;
12684
+ return [Vu + e * (r + Uu), t * r + (t - 1) * Uu];
12627
12685
  }
12628
- function Hu(e, t = Lu) {
12686
+ function Yu(e, t = Wu) {
12629
12687
  return `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">${n(e).map(([t, n, r, i]) => {
12630
- let [a, o] = Vu(t, r, e.cols), [s, c] = Vu(n, i, e.rows);
12688
+ let [a, o] = Ju(t, r, e.cols), [s, c] = Ju(n, i, e.rows);
12631
12689
  return `<rect x="${a}" y="${s}" width="${o}" height="${c}" rx="1"/>`;
12632
12690
  }).join("")}</svg>`;
12633
12691
  }
12634
- function Uu(e, t) {
12692
+ function Xu(e, t) {
12635
12693
  let n = f[e], r = s(n);
12636
12694
  if (r === 1) return t("grid.single");
12637
12695
  let i = m(n);
12638
- return i ? w(t(Bu[i]), { count: r }) : w(t("grid.layoutOption"), {
12696
+ return i ? w(t(qu[i]), { count: r }) : w(t("grid.layoutOption"), {
12639
12697
  count: r,
12640
12698
  cols: n.cols,
12641
12699
  rows: n.rows
12642
12700
  });
12643
12701
  }
12644
- var Wu = class {
12702
+ var Zu = class {
12645
12703
  button;
12646
12704
  panel = null;
12647
12705
  choices;
@@ -12658,8 +12716,8 @@ var Wu = class {
12658
12716
  }), this.render();
12659
12717
  }
12660
12718
  render() {
12661
- let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${Uu(n, e)}`;
12662
- this.button.innerHTML = Hu(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
12719
+ let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${Xu(n, e)}`;
12720
+ this.button.innerHTML = Yu(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
12663
12721
  for (let e of this.items()) e.setAttribute("aria-checked", String(e.dataset.layout === n));
12664
12722
  }
12665
12723
  isOpen() {
@@ -12700,15 +12758,15 @@ var Wu = class {
12700
12758
  return a.className = "tcw-grid-picker-row", a.append(...t.map((e) => this.item(e))), r.append(i, a), r;
12701
12759
  }
12702
12760
  item(e) {
12703
- let t = Uu(e, this.options.t), n = document.createElement("button");
12704
- return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML = Hu(f[e]), n.addEventListener("click", () => this.pick(e)), n;
12761
+ let t = Xu(e, this.options.t), n = document.createElement("button");
12762
+ return n.type = "button", n.className = "tcw-btn-icon tcw-grid-picker-item", n.setAttribute("role", "menuitemradio"), n.setAttribute("aria-checked", "false"), n.tabIndex = -1, n.dataset.layout = e, n.title = t, n.setAttribute("aria-label", t), n.innerHTML = Yu(f[e]), n.addEventListener("click", () => this.pick(e)), n;
12705
12763
  }
12706
12764
  pick(e) {
12707
12765
  this.close(), this.options.onPick(e), this.render();
12708
12766
  }
12709
12767
  place(e) {
12710
- let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a - zu;
12711
- e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + Ru}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - Ru - zu)}px`;
12768
+ let { host: t } = this.options, n = this.button.getBoundingClientRect(), r = t.getBoundingClientRect(), i = t.closest("[dir]")?.getAttribute("dir") === "rtl", a = e.offsetWidth, o = i ? n.right - r.left - a : n.left - r.left, s = t.clientWidth - a - Ku;
12769
+ e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + Gu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - Gu - Ku)}px`;
12712
12770
  }
12713
12771
  items() {
12714
12772
  return this.panel ? [...this.panel.querySelectorAll("[role=\"menuitemradio\"]")] : [];
@@ -12739,32 +12797,32 @@ var Wu = class {
12739
12797
  let o = this.rows(), s = o.findIndex((e) => e.includes(n[r])), c = o[s].indexOf(n[r]), l = o[(s + (t === "ArrowDown" ? 1 : -1) + o.length) % o.length];
12740
12798
  return l[Math.min(c, l.length - 1)];
12741
12799
  }
12742
- }, Gu = {
12800
+ }, Qu = {
12743
12801
  symbol: !1,
12744
12802
  interval: !1,
12745
12803
  crosshair: !0,
12746
12804
  time: !1,
12747
12805
  drawings: !1,
12748
12806
  replay: !1
12749
- }, Ku = [
12807
+ }, $u = [
12750
12808
  "symbol",
12751
12809
  "interval",
12752
12810
  "crosshair",
12753
12811
  "time",
12754
12812
  "drawings",
12755
12813
  "replay"
12756
- ], qu = f;
12757
- function Ju(e) {
12814
+ ], ed = f;
12815
+ function td(e) {
12758
12816
  return JSON.parse(JSON.stringify(e));
12759
12817
  }
12760
- function Yu(e) {
12818
+ function nd(e) {
12761
12819
  if (typeof e != "object" || !e) return null;
12762
12820
  let t = e;
12763
12821
  if (t.v !== 1 || t.kind !== "grid" || !r(t.layout) || !Array.isArray(t.cells)) return null;
12764
12822
  let n = t.cells.map(Us);
12765
12823
  if (n.some((e) => e === null)) return null;
12766
- let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Gu };
12767
- for (let e of Ku) typeof i[e] == "boolean" && (a[e] = i[e]);
12824
+ let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Qu };
12825
+ for (let e of $u) typeof i[e] == "boolean" && (a[e] = i[e]);
12768
12826
  let o = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
12769
12827
  return {
12770
12828
  v: 1,
@@ -12775,7 +12833,7 @@ function Yu(e) {
12775
12833
  cells: n
12776
12834
  };
12777
12835
  }
12778
- var Xu = class {
12836
+ var rd = class {
12779
12837
  root;
12780
12838
  cellsEl;
12781
12839
  cells = [];
@@ -12805,7 +12863,7 @@ var Xu = class {
12805
12863
  };
12806
12864
  constructor(e, t = {}) {
12807
12865
  this.options = t, this.layout = r(t.layout) ? t.layout : "1x2", this.sync = {
12808
- ...Gu,
12866
+ ...Qu,
12809
12867
  ...t.sync
12810
12868
  }, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), ln(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", Oa(this.root, U(t.widget?.ui), { variables: t.widget?.ui !== void 0 }), t.bar !== !1 && this.root.appendChild(this.buildBar()), this.cellsEl = document.createElement("div"), this.cellsEl.className = "tcw-grid-cells", this.root.appendChild(this.cellsEl), e.appendChild(this.root), this.stopNarrow = Js(this.root), this.applyShape();
12811
12869
  for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
@@ -12933,7 +12991,7 @@ var Xu = class {
12933
12991
  return JSON.stringify(this.captureLayout());
12934
12992
  }
12935
12993
  async applyLayoutContent(e) {
12936
- let t = Yu(Ws(e));
12994
+ let t = nd(Ws(e));
12937
12995
  return t ? (await this.restoreLayout(t), !0) : !1;
12938
12996
  }
12939
12997
  destroy() {
@@ -12955,7 +13013,7 @@ var Xu = class {
12955
13013
  createCell(e) {
12956
13014
  let t = document.createElement("div");
12957
13015
  t.className = "tcw-grid-cell", t.setAttribute("role", "region"), t.setAttribute("aria-label", w(this.t("grid.chart"), { n: e + 1 })), i(t, n(f[this.layout])[e]), this.cellsEl.appendChild(t);
12958
- let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new wu(t, {
13016
+ let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new ju(t, {
12959
13017
  ...r,
12960
13018
  ...a,
12961
13019
  ...a.adapter ? { feed: void 0 } : {},
@@ -13012,7 +13070,7 @@ var Xu = class {
13012
13070
  t.replaySeekToTime(n);
13013
13071
  return;
13014
13072
  }
13015
- let r = Zu(t.getData(), n);
13073
+ let r = id(t.getData(), n);
13016
13074
  r >= 0 && t.replayStart({
13017
13075
  startIndex: r,
13018
13076
  paused: !0
@@ -13057,7 +13115,7 @@ var Xu = class {
13057
13115
  copyDrawings(e) {
13058
13116
  let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
13059
13117
  this.quietly(() => {
13060
- for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Ju(n));
13118
+ for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(td(n));
13061
13119
  });
13062
13120
  }
13063
13121
  mergeDrawings() {
@@ -13069,7 +13127,7 @@ var Xu = class {
13069
13127
  let e = /* @__PURE__ */ new Map();
13070
13128
  for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
13071
13129
  let n = [...e.values()];
13072
- for (let e of t) e.widget.getChart().setDrawings(Ju(n));
13130
+ for (let e of t) e.widget.getChart().setDrawings(td(n));
13073
13131
  }
13074
13132
  });
13075
13133
  }
@@ -13106,7 +13164,7 @@ var Xu = class {
13106
13164
  let t = document.createElement("div");
13107
13165
  t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
13108
13166
  let n = this.options.layoutChoices?.filter(r) ?? l;
13109
- n.length > 0 && (this.layoutPicker = new Wu({
13167
+ n.length > 0 && (this.layoutPicker = new Zu({
13110
13168
  host: this.root,
13111
13169
  t: this.t,
13112
13170
  choices: n,
@@ -13117,7 +13175,7 @@ var Xu = class {
13117
13175
  i.className = "tcw-grid-group", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.t("grid.sync"));
13118
13176
  let a = document.createElement("span");
13119
13177
  a.className = "tcw-grid-label", a.innerHTML = `${x("link", 13)}<span>${S(this.t("grid.sync"))}</span>`, i.appendChild(a);
13120
- for (let e of Ku) {
13178
+ for (let e of $u) {
13121
13179
  let t = document.createElement("button");
13122
13180
  t.type = "button", t.className = "tcw-btn tcw-grid-sync", t.textContent = this.t(`grid.sync.${e}`), t.title = this.t(`grid.sync.${e}.hint`), t.addEventListener("click", () => this.setSync({ [e]: !this.sync[e] })), this.syncButtons.set(e, t), i.appendChild(t);
13123
13181
  }
@@ -13175,12 +13233,12 @@ var Xu = class {
13175
13233
  this.cells[this.active]?.widget.toast(e, t);
13176
13234
  }
13177
13235
  };
13178
- function Zu(e, t) {
13236
+ function id(e, t) {
13179
13237
  let n = -1;
13180
13238
  for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
13181
13239
  return n;
13182
13240
  }
13183
13241
  //#endregion
13184
- export { Se as CHART_TYPE_ICONS, wu as ChartWidget, Xu as ChartWidgetGrid, Gu as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, qu as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, ba as WIDGET_UI_PRESETS, Oa as applyWidgetUI, d as cleanLayoutName, Ce as createChartTypeIcon, x as createIcon, b as createToolIcon, ze as findWidgetLocale, be as iconSvg, o as localStorageLayouts, t as memoryLayouts, Yu as readGridLayout, li as readWatchlists, Us as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, Da as widgetUIVariables };
13242
+ export { Se as CHART_TYPE_ICONS, ju as ChartWidget, rd as ChartWidgetGrid, Qu as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, ed as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, ba as WIDGET_UI_PRESETS, Oa as applyWidgetUI, d as cleanLayoutName, Ce as createChartTypeIcon, x as createIcon, b as createToolIcon, ze as findWidgetLocale, be as iconSvg, o as localStorageLayouts, t as memoryLayouts, nd as readGridLayout, li as readWatchlists, Us as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, Da as widgetUIVariables };
13185
13243
 
13186
13244
  //# sourceMappingURL=index.js.map