@tradecanvas/chart 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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-DECsVW1x.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-CLBBqfer.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
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-BM6u0u74.js";
@@ -1166,6 +1166,7 @@ var hr = "--tcw-fab-plot-left", gr = class {
1166
1166
  flyoutIdx = -1;
1167
1167
  flyoutHideTimer = null;
1168
1168
  flyoutSwitchTimer = null;
1169
+ flyoutSwitchOpen = null;
1169
1170
  flyoutByKey = !1;
1170
1171
  hostEl = null;
1171
1172
  favoritesEl = null;
@@ -1369,12 +1370,12 @@ var hr = "--tcw-fab-plot-left", gr = class {
1369
1370
  t();
1370
1371
  return;
1371
1372
  }
1372
- this.flyoutSwitchTimer = setTimeout(() => {
1373
- this.flyoutSwitchTimer = null, t();
1373
+ this.flyoutSwitchOpen = t, this.flyoutSwitchTimer = setTimeout(() => {
1374
+ this.flyoutSwitchTimer = null, this.flyoutSwitchOpen = null, t();
1374
1375
  }, ur);
1375
1376
  }
1376
1377
  cancelFlyoutSwitch() {
1377
- this.flyoutSwitchTimer !== null && (clearTimeout(this.flyoutSwitchTimer), this.flyoutSwitchTimer = null);
1378
+ this.flyoutSwitchTimer !== null && (clearTimeout(this.flyoutSwitchTimer), this.flyoutSwitchTimer = null, this.flyoutSwitchOpen = null);
1378
1379
  }
1379
1380
  openFlyout(e, t) {
1380
1381
  e.addEventListener("mouseenter", () => {
@@ -1473,7 +1474,9 @@ var hr = "--tcw-fab-plot-left", gr = class {
1473
1474
  }
1474
1475
  scheduleHideFlyout() {
1475
1476
  this.cancelHideFlyout(), this.flyoutHideTimer = setTimeout(() => {
1476
- this.flyoutHideTimer = null, this.hideFlyout();
1477
+ this.flyoutHideTimer = null;
1478
+ let e = this.flyoutSwitchOpen;
1479
+ this.hideFlyout(), e?.();
1477
1480
  }, lr);
1478
1481
  }
1479
1482
  cancelHideFlyout() {
@@ -4931,7 +4934,7 @@ var K = {
4931
4934
  "horizontalRay",
4932
4935
  "verticalLine",
4933
4936
  "rectangle"
4934
- ]), So = { priceLabel: "#ffffff" }, Co = 8, wo = 6, To = 1.3, Eo = 120, Do = 229, Oo = 500, ko = 8, Ao = 400, jo = class {
4937
+ ]), So = { priceLabel: "#ffffff" }, Co = 8, wo = 6, To = 1.3, Eo = 120, Do = 1, Oo = 4, ko = 229, Ao = 500, jo = 8, Mo = 400, No = class {
4935
4938
  wrap = null;
4936
4939
  area = null;
4937
4940
  target = null;
@@ -4941,7 +4944,7 @@ var K = {
4941
4944
  offSince = 0;
4942
4945
  onPressAway = (e) => {
4943
4946
  if (!(!this.area || e.target === this.area)) {
4944
- if (this.area.value === this.target?.text && performance.now() - this.openedAt < Oo) {
4947
+ if (this.area.value === this.target?.text && performance.now() - this.openedAt < Ao) {
4945
4948
  e.preventDefault(), e.stopPropagation();
4946
4949
  return;
4947
4950
  }
@@ -4962,7 +4965,7 @@ var K = {
4962
4965
  let n = document.createElement("div");
4963
4966
  n.className = "tcw-inline-text";
4964
4967
  let r = document.createElement("textarea");
4965
- r.className = "tcw-inline-text-input", r.value = e.text, r.rows = 1, r.spellcheck = !1, r.setAttribute("aria-label", e.label);
4968
+ r.className = "tcw-inline-text-input", r.value = e.text, r.rows = 1, r.spellcheck = !1, r.setAttribute("aria-label", e.label), e.placeholder && (r.placeholder = e.placeholder);
4966
4969
  let { size: i, bold: a, italic: o, family: s } = e.font;
4967
4970
  return Object.assign(r.style, {
4968
4971
  fontSize: `${i}px`,
@@ -4975,9 +4978,9 @@ var K = {
4975
4978
  }), r.addEventListener("input", () => {
4976
4979
  this.fit(), this.target?.onInput(r.value);
4977
4980
  let e = this.target?.rect();
4978
- e && this.place(e);
4981
+ e && this.place(e), this.fit(), e && this.place(e);
4979
4982
  }), r.addEventListener("keydown", (e) => {
4980
- e.stopPropagation(), !(e.isComposing || e.keyCode === Do) && (e.key === "Escape" ? (e.preventDefault(), this.finish(!1, !0)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this.finish(!0, !0)));
4983
+ e.stopPropagation(), !(e.isComposing || e.keyCode === ko) && (e.key === "Escape" ? (e.preventDefault(), this.finish(!1, !0)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), this.finish(!0, !0)));
4981
4984
  }), r.addEventListener("blur", () => this.finish(!0, !1)), n.appendChild(r), this.layer().appendChild(n), this.wrap = n, this.area = r, this.place(t), this.fit(), r.focus(), r.select(), this.openedAt = performance.now(), this.offSince = 0, document.addEventListener("pointerdown", this.onPressAway, !0), document.addEventListener("mousedown", this.onPressAway, !0), this.follow(), !0;
4982
4985
  }
4983
4986
  commit() {
@@ -4998,10 +5001,12 @@ var K = {
4998
5001
  place(e) {
4999
5002
  let t = this.area;
5000
5003
  if (!t) return;
5001
- let n = Math.max(Eo, window.innerWidth - ko * 2);
5002
- t.style.maxWidth = `${n}px`, t.style.width = `${Math.min(n, Math.max(Eo, e.width))}px`, t.style.minHeight = `${e.height}px`;
5003
- let r = t.offsetWidth || Math.max(Eo, e.width), i = t.offsetHeight || e.height;
5004
- t.style.left = `${Math.max(ko, Math.min(e.x, window.innerWidth - ko - r))}px`, t.style.top = `${Math.max(ko, Math.min(e.y, window.innerHeight - ko - i))}px`;
5004
+ let n = Math.max(Eo, window.innerWidth - jo * 2);
5005
+ t.style.maxWidth = `${n}px`;
5006
+ let r = Math.max(Eo, e.width + Do * 2 + Oo);
5007
+ t.style.width = `${Math.min(n, r)}px`, t.style.minHeight = `${e.height + Do * 2}px`;
5008
+ let i = t.offsetWidth || r, a = t.offsetHeight || e.height + Do * 2;
5009
+ t.style.left = `${Math.max(jo, Math.min(e.x - Do, window.innerWidth - jo - i))}px`, t.style.top = `${Math.max(jo, Math.min(e.y - Do, window.innerHeight - jo - a))}px`;
5005
5010
  }
5006
5011
  offWindow(e) {
5007
5012
  return e.x > window.innerWidth || e.x + e.width < 0 || e.y > window.innerHeight || e.y + e.height < 0;
@@ -5014,14 +5019,14 @@ var K = {
5014
5019
  this.frame = requestAnimationFrame(() => {
5015
5020
  if (!this.target || this.done) return;
5016
5021
  let e = this.target.rect(), t = e !== null && this.offWindow(e);
5017
- if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince > Ao) {
5022
+ if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince > Mo) {
5018
5023
  this.finish(!0, !1);
5019
5024
  return;
5020
5025
  }
5021
5026
  this.place(e), this.follow();
5022
5027
  });
5023
5028
  }
5024
- }, Mo = [
5029
+ }, Po = [
5025
5030
  {
5026
5031
  id: "regularScale",
5027
5032
  mode: "regular",
@@ -5042,7 +5047,7 @@ var K = {
5042
5047
  mode: "indexedTo100",
5043
5048
  label: "settings.scale.indexedTo100"
5044
5049
  }
5045
- ], No = [
5050
+ ], Fo = [
5046
5051
  {
5047
5052
  action: "resetView",
5048
5053
  keys: "Alt+R",
@@ -5059,20 +5064,20 @@ var K = {
5059
5064
  feature: "hotkeys.goToDate"
5060
5065
  }
5061
5066
  ];
5062
- function Po(e) {
5063
- return Mo.find((t) => t.id === e)?.mode;
5067
+ function Io(e) {
5068
+ return Po.find((t) => t.id === e)?.mode;
5064
5069
  }
5065
- function Fo(...e) {
5070
+ function Lo(...e) {
5066
5071
  return e.filter((e) => e.length > 0).flatMap((e, t) => t === 0 ? [...e] : ["separator", ...e]);
5067
5072
  }
5068
- function Io(e, t) {
5073
+ function Ro(e, t) {
5069
5074
  let n = t.keys[e.id];
5070
5075
  return n ? {
5071
5076
  ...e,
5072
5077
  shortcut: n
5073
5078
  } : e;
5074
5079
  }
5075
- function Lo(e, t) {
5080
+ function zo(e, t) {
5076
5081
  if (e.price === void 0 || !Number.isFinite(e.price)) return [];
5077
5082
  let n = e.formatPrice(e.price), r = [];
5078
5083
  if (e.canAlert && r.push({
@@ -5109,13 +5114,13 @@ function Lo(e, t) {
5109
5114
  icon: "minus"
5110
5115
  }), r;
5111
5116
  }
5112
- var Ro = (e) => ({
5117
+ var Bo = (e) => ({
5113
5118
  id: "settings",
5114
5119
  label: e("chartMenu.settings"),
5115
5120
  icon: "settings"
5116
5121
  });
5117
- function zo(e, t) {
5118
- let n = [Io({
5122
+ function Vo(e, t) {
5123
+ let n = [Ro({
5119
5124
  id: "resetView",
5120
5125
  label: t("chartMenu.resetView")
5121
5126
  }, e)];
@@ -5148,9 +5153,9 @@ function zo(e, t) {
5148
5153
  label: t("chartMenu.exportData"),
5149
5154
  icon: "save"
5150
5155
  }] : [];
5151
- return Fo(Lo(e, t), n, r, [...i, Ro(t)]);
5156
+ return Lo(zo(e, t), n, r, [...i, Bo(t)]);
5152
5157
  }
5153
- function Bo(e, t) {
5158
+ function Ho(e, t) {
5154
5159
  let n = [
5155
5160
  {
5156
5161
  id: "resetPriceScale",
@@ -5161,7 +5166,7 @@ function Bo(e, t) {
5161
5166
  label: t("settings.autoScale"),
5162
5167
  checked: e.autoScale
5163
5168
  },
5164
- Io({
5169
+ Ro({
5165
5170
  id: "invertScale",
5166
5171
  label: t("chartMenu.invertScale"),
5167
5172
  checked: e.inverted
@@ -5171,7 +5176,7 @@ function Bo(e, t) {
5171
5176
  label: t("settings.leftScale"),
5172
5177
  checked: e.leftScale
5173
5178
  }
5174
- ], r = Mo.filter((t) => t.mode !== "logarithmic" || e.canLog).map((n) => ({
5179
+ ], r = Po.filter((t) => t.mode !== "logarithmic" || e.canLog).map((n) => ({
5175
5180
  id: n.id,
5176
5181
  label: t(n.label),
5177
5182
  radio: !0,
@@ -5199,7 +5204,7 @@ function Bo(e, t) {
5199
5204
  label: t("chartMenu.lastPriceLine"),
5200
5205
  checked: e.lines.lastPrice
5201
5206
  }];
5202
- return Fo(n, r, [{
5207
+ return Lo(n, r, [{
5203
5208
  id: "labels",
5204
5209
  label: t("chartMenu.labels"),
5205
5210
  submenu: i
@@ -5207,18 +5212,18 @@ function Bo(e, t) {
5207
5212
  id: "lines",
5208
5213
  label: t("chartMenu.lines"),
5209
5214
  submenu: a
5210
- }], Lo({
5215
+ }], zo({
5211
5216
  ...e,
5212
5217
  canTrade: !1,
5213
5218
  canDraw: !1
5214
- }, t), [Ro(t)]);
5219
+ }, t), [Bo(t)]);
5215
5220
  }
5216
- function Vo(e, t) {
5217
- let n = [Io({
5221
+ function Uo(e, t) {
5222
+ let n = [Ro({
5218
5223
  id: "resetView",
5219
5224
  label: t("chartMenu.resetTimeScale")
5220
5225
  }, e)];
5221
- e.canGoToDate && n.push(Io({
5226
+ e.canGoToDate && n.push(Ro({
5222
5227
  id: "goToDate",
5223
5228
  label: t("chartMenu.goToDate"),
5224
5229
  icon: "calendar"
@@ -5229,13 +5234,13 @@ function Vo(e, t) {
5229
5234
  radio: !0,
5230
5235
  checked: t.value === e.timezone.current
5231
5236
  }));
5232
- return Fo(n, r.length > 0 ? [{
5237
+ return Lo(n, r.length > 0 ? [{
5233
5238
  id: "timezone",
5234
5239
  label: t("settings.timezone"),
5235
5240
  submenu: r
5236
5241
  }] : []);
5237
5242
  }
5238
- function Ho(e, t) {
5243
+ function Wo(e, t) {
5239
5244
  let n = e.pane ? [
5240
5245
  {
5241
5246
  id: "paneLog",
@@ -5253,53 +5258,53 @@ function Ho(e, t) {
5253
5258
  checked: e.pane.percent
5254
5259
  }
5255
5260
  ] : [];
5256
- return Fo([Io({
5261
+ return Lo([Ro({
5257
5262
  id: "resetView",
5258
5263
  label: t("chartMenu.resetView")
5259
- }, e)], n, [Ro(t)]);
5264
+ }, e)], n, [Bo(t)]);
5260
5265
  }
5261
- function Uo(e, t, n) {
5266
+ function Go(e, t, n) {
5262
5267
  switch (e) {
5263
- case "priceAxis": return Bo(t, n);
5264
- case "timeAxis": return Vo(t, n);
5265
- case "pane": return Ho(t, n);
5266
- default: return zo(t, n);
5268
+ case "priceAxis": return Ho(t, n);
5269
+ case "timeAxis": return Uo(t, n);
5270
+ case "pane": return Wo(t, n);
5271
+ default: return Vo(t, n);
5267
5272
  }
5268
5273
  }
5269
5274
  //#endregion
5270
5275
  //#region src/widget/signedFigure.ts
5271
- var Wo = /^[-+−]/;
5272
- function Go(e, t, n) {
5273
- let r = e.replace(Wo, "");
5274
- return r === n.replace(Wo, "") ? r : t > 0 ? `+${r}` : t < 0 ? `-${r}` : r;
5276
+ var Ko = /^[-+−]/;
5277
+ function qo(e, t, n) {
5278
+ let r = e.replace(Ko, "");
5279
+ return r === n.replace(Ko, "") ? r : t > 0 ? `+${r}` : t < 0 ? `-${r}` : r;
5275
5280
  }
5276
- function Ko(e) {
5281
+ function Jo(e) {
5277
5282
  return e.startsWith("+") ? "up" : e.startsWith("-") ? "down" : null;
5278
5283
  }
5279
5284
  //#endregion
5280
5285
  //#region src/widget/WidgetAccountPanel.ts
5281
- var qo = [
5286
+ var Yo = [
5282
5287
  "positions",
5283
5288
  "orders",
5284
5289
  "history"
5285
- ], Jo = [
5290
+ ], Xo = [
5286
5291
  "order",
5287
5292
  "close",
5288
5293
  "reverse",
5289
5294
  "stopLoss",
5290
5295
  "takeProfit"
5291
- ], Yo = [
5296
+ ], Zo = [
5292
5297
  "market",
5293
5298
  "limit",
5294
5299
  "stop"
5295
- ], Xo = ["gtc", "day"], q = "—", Zo = "{pnl}", Qo = 3;
5296
- function $o(e, t, n) {
5300
+ ], Qo = ["gtc", "day"], q = "—", $o = "{pnl}", es = 3;
5301
+ function ts(e, t, n) {
5297
5302
  return e.includes(t ?? "") ? t : n;
5298
5303
  }
5299
- function es(e, t) {
5304
+ function ns(e, t) {
5300
5305
  return e.length === t.length && e.every((e, n) => e === t[n]);
5301
5306
  }
5302
- function ts(e, t) {
5307
+ function rs(e, t) {
5303
5308
  if (t === null) return null;
5304
5309
  let n = e.quantity - (e.closedQuantity ?? 0), r = e.side === "buy" ? 1 : -1;
5305
5310
  return {
@@ -5307,15 +5312,15 @@ function ts(e, t) {
5307
5312
  pct: e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * r
5308
5313
  };
5309
5314
  }
5310
- function ns(e) {
5315
+ function is(e) {
5311
5316
  let t = document.createElement("span");
5312
5317
  return t.dir = "ltr", t.textContent = e, t;
5313
5318
  }
5314
- function rs(e) {
5315
- let t = Ko(e);
5319
+ function as(e) {
5320
+ let t = Jo(e);
5316
5321
  return t ? `tcw-account-${t}` : "";
5317
5322
  }
5318
- var is = class {
5323
+ var os = class {
5319
5324
  el;
5320
5325
  tabButtons = /* @__PURE__ */ new Map();
5321
5326
  tabLabels = /* @__PURE__ */ new Map();
@@ -5337,7 +5342,7 @@ var is = class {
5337
5342
  r.className = "tcw-account-head";
5338
5343
  let i = document.createElement("div");
5339
5344
  i.className = "tcw-account-tabs", i.setAttribute("role", "tablist"), i.addEventListener("keydown", (e) => this.onTabKey(e));
5340
- for (let e of qo) {
5345
+ for (let e of Yo) {
5341
5346
  let t = document.createElement("button");
5342
5347
  t.type = "button", t.className = "tcw-account-tab", t.setAttribute("role", "tab"), t.id = `tcw-account-tab-${e}`;
5343
5348
  let n = document.createElement("span");
@@ -5365,7 +5370,7 @@ var is = class {
5365
5370
  }
5366
5371
  update(e) {
5367
5372
  let t = this.snapshot;
5368
- if (this.snapshot = e, es(t.positions, e.positions) && es(t.orders, e.orders) && es(t.fills, e.fills) && t.realisedPnl === e.realisedPnl) {
5373
+ if (this.snapshot = e, ns(t.positions, e.positions) && ns(t.orders, e.orders) && ns(t.fills, e.fills) && t.realisedPnl === e.realisedPnl) {
5369
5374
  t.price !== e.price && (this.renderTotals(), this.open && this.tab === "positions" && this.patchPrices());
5370
5375
  return;
5371
5376
  }
@@ -5378,10 +5383,10 @@ var is = class {
5378
5383
  this.tab = e, this.renderTabs(), this.render();
5379
5384
  }
5380
5385
  onTabKey(e) {
5381
- let t = qo.indexOf(this.tab), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : -2;
5386
+ let t = Yo.indexOf(this.tab), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : -2;
5382
5387
  if (n === -2) return;
5383
5388
  e.preventDefault();
5384
- let r = qo[(n + qo.length) % qo.length];
5389
+ let r = Yo[(n + Yo.length) % Yo.length];
5385
5390
  this.selectTab(r), this.tabButtons.get(r)?.focus();
5386
5391
  }
5387
5392
  renderTabs() {
@@ -5398,15 +5403,15 @@ var is = class {
5398
5403
  }
5399
5404
  renderTotals() {
5400
5405
  let { positions: e, price: t, fills: n, realisedPnl: r } = this.snapshot, i = [], a = e.reduce((e, n) => {
5401
- let r = ts(n, t);
5406
+ let r = rs(n, t);
5402
5407
  return r === null ? e : (e ?? 0) + r.pnl;
5403
5408
  }, null);
5404
5409
  a !== null && i.push(this.total("account.openPnl", a)), (n.length > 0 || r !== void 0 && r !== 0) && i.push(this.total("account.realised", r ?? n.reduce((e, t) => e + (t.pnl ?? 0), 0))), this.totalsEl.replaceChildren(...i);
5405
5410
  }
5406
5411
  total(e, t) {
5407
5412
  let n = document.createElement("span"), r = this.amount(t);
5408
- n.className = `tcw-account-total ${rs(r)}`.trim();
5409
- let i = this.t(e), a = i.indexOf(Zo), o = ns(r);
5413
+ n.className = `tcw-account-total ${as(r)}`.trim();
5414
+ let i = this.t(e), a = i.indexOf($o), o = is(r);
5410
5415
  return a < 0 ? n.append(`${i} `, o) : n.append(i.slice(0, a), o, i.slice(a + 5)), n;
5411
5416
  }
5412
5417
  render() {
@@ -5415,17 +5420,17 @@ var is = class {
5415
5420
  }
5416
5421
  patchPrices() {
5417
5422
  let { price: e } = this.snapshot;
5418
- for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl, ts(t.position, e));
5423
+ for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl, rs(t.position, e));
5419
5424
  }
5420
5425
  amount(e) {
5421
- return Go(this.money(Math.abs(e)), e, this.money(0));
5426
+ return qo(this.money(Math.abs(e)), e, this.money(0));
5422
5427
  }
5423
5428
  money(e) {
5424
5429
  return this.callbacks.formatAmount ? this.callbacks.formatAmount(e) : e.toFixed(2);
5425
5430
  }
5426
5431
  percent(e) {
5427
5432
  let t = (e) => this.callbacks.formatNumber ? this.callbacks.formatNumber(e, 2) : e.toFixed(2);
5428
- return `${Go(t(Math.abs(e)), e, t(0))}%`;
5433
+ return `${qo(t(Math.abs(e)), e, t(0))}%`;
5429
5434
  }
5430
5435
  writePnl(e, t) {
5431
5436
  if (t === null) {
@@ -5433,7 +5438,7 @@ var is = class {
5433
5438
  return;
5434
5439
  }
5435
5440
  let n = this.amount(t.pnl);
5436
- e.className = rs(n), e.textContent = `${n} · ${this.percent(t.pct)}`;
5441
+ e.className = as(n), e.textContent = `${n} · ${this.percent(t.pct)}`;
5437
5442
  }
5438
5443
  table(e, t, n) {
5439
5444
  if (t.length === 0) {
@@ -5478,8 +5483,8 @@ var is = class {
5478
5483
  }
5479
5484
  renderPositions() {
5480
5485
  let { formatPrice: e } = this.callbacks, { price: t } = this.snapshot, n = [], r = this.snapshot.positions.map((r) => {
5481
- let i = r.quantity - (r.closedQuantity ?? 0), a = ns("");
5482
- this.writePnl(a, ts(r, t)), n.push(a);
5486
+ let i = r.quantity - (r.closedQuantity ?? 0), a = is("");
5487
+ this.writePnl(a, rs(r, t)), n.push(a);
5483
5488
  let o = `${this.sideText(r.side, "position")} ${i} @ ${e(r.entryPrice)}`;
5484
5489
  return [
5485
5490
  this.sideCell(r.side),
@@ -5534,13 +5539,13 @@ var is = class {
5534
5539
  let a = [...i.tBodies[0].rows];
5535
5540
  this.snapshot.positions.forEach((e, t) => this.live.push({
5536
5541
  position: e,
5537
- price: a[t].cells[Qo],
5542
+ price: a[t].cells[es],
5538
5543
  pnl: n[t]
5539
5544
  }));
5540
5545
  }
5541
5546
  renderOrders() {
5542
5547
  let { formatPrice: e } = this.callbacks, t = this.snapshot.orders.map((t) => {
5543
- let n = $o(Yo, t.type === "stopLimit" ? "stop" : t.type, "limit"), r = `${this.sideText(t.side, "trade")} ${t.quantity} @ ${e(t.price)}`;
5548
+ let n = ts(Zo, t.type === "stopLimit" ? "stop" : t.type, "limit"), r = `${this.sideText(t.side, "trade")} ${t.quantity} @ ${e(t.price)}`;
5544
5549
  return [
5545
5550
  this.sideCell(t.side, "trade"),
5546
5551
  this.t(`ticket.type.${n}`),
@@ -5548,7 +5553,7 @@ var is = class {
5548
5553
  e(t.price),
5549
5554
  this.price(t.stopLoss),
5550
5555
  this.price(t.takeProfit),
5551
- t.timeInForce ? this.t(`ticket.tif.${$o(Xo, t.timeInForce, "gtc")}`) : q,
5556
+ t.timeInForce ? this.t(`ticket.tif.${ts(Qo, t.timeInForce, "gtc")}`) : q,
5552
5557
  this.actions({
5553
5558
  icon: "x",
5554
5559
  label: `${this.t("account.cancelOrder")}: ${r}`,
@@ -5583,13 +5588,13 @@ var is = class {
5583
5588
  }
5584
5589
  renderHistory() {
5585
5590
  let { formatPrice: e, formatTime: t } = this.callbacks, n = [...this.snapshot.fills].reverse().map((n) => {
5586
- let r = ns("");
5587
- return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className = rs(r.textContent)), [
5591
+ let r = is("");
5592
+ return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className = as(r.textContent)), [
5588
5593
  t(n.time),
5589
5594
  this.sideCell(n.side, "trade"),
5590
5595
  String(n.quantity),
5591
5596
  e(n.price),
5592
- this.t(`account.reason.${$o(Jo, n.reason, "order")}`),
5597
+ this.t(`account.reason.${ts(Xo, n.reason, "order")}`),
5593
5598
  r
5594
5599
  ];
5595
5600
  });
@@ -5611,11 +5616,11 @@ var is = class {
5611
5616
  }
5612
5617
  ], n, "account.noFills");
5613
5618
  }
5614
- }, as = 1e-9;
5615
- function os(e, t) {
5619
+ }, ss = 1e-9;
5620
+ function cs(e, t) {
5616
5621
  return e.type === "market" ? t : e.price;
5617
5622
  }
5618
- function ss(e, t, n = {}) {
5623
+ function ls(e, t, n = {}) {
5619
5624
  let r = [];
5620
5625
  (!(e.quantity > 0) || !Number.isFinite(e.quantity)) && r.push("quantity"), e.type !== "market" && (!(e.price > 0) || !Number.isFinite(e.price)) && r.push("price"), e.type === "market" && !((t ?? e.price) > 0) && r.push("market");
5621
5626
  let i = e.side === "buy";
@@ -5625,18 +5630,18 @@ function ss(e, t, n = {}) {
5625
5630
  }
5626
5631
  let a = (e) => e === null || Number.isFinite(e) && e > 0;
5627
5632
  a(e.stopLoss) || r.push("stopLoss"), a(e.takeProfit) || r.push("takeProfit");
5628
- let o = os(e, t);
5629
- return o !== null && o > 0 && (e.stopLoss !== null && a(e.stopLoss) && (i ? e.stopLoss >= o : e.stopLoss <= o) && r.push("stopLossSide"), e.takeProfit !== null && a(e.takeProfit) && (i ? e.takeProfit <= o : e.takeProfit >= o) && r.push("takeProfitSide")), [...r, ...cs(e, n)];
5633
+ let o = cs(e, t);
5634
+ return o !== null && o > 0 && (e.stopLoss !== null && a(e.stopLoss) && (i ? e.stopLoss >= o : e.stopLoss <= o) && r.push("stopLossSide"), e.takeProfit !== null && a(e.takeProfit) && (i ? e.takeProfit <= o : e.takeProfit >= o) && r.push("takeProfitSide")), [...r, ...us(e, n)];
5630
5635
  }
5631
- function cs(e, t) {
5636
+ function us(e, t) {
5632
5637
  let n = [], r = e.type === "market" ? null : e.price, i = [
5633
5638
  r,
5634
5639
  e.stopLoss,
5635
5640
  e.takeProfit
5636
5641
  ].filter((e) => e !== null && Number.isFinite(e) && e > 0), { roundPrice: a, limits: o, lot: s } = t;
5637
- return a && i.some((e) => Math.abs(a(e) - e) > as) && n.push("priceStep"), o && r !== null && r > 0 && (r > o.ceiling + as || r < o.floor - as) && n.push("priceLimits"), s !== void 0 && s > 1 && e.quantity > s && e.quantity % s !== 0 && n.push("lot"), n;
5642
+ return a && i.some((e) => Math.abs(a(e) - e) > ss) && n.push("priceStep"), o && r !== null && r > 0 && (r > o.ceiling + ss || r < o.floor - ss) && n.push("priceLimits"), s !== void 0 && s > 1 && e.quantity > s && e.quantity % s !== 0 && n.push("lot"), n;
5638
5643
  }
5639
- function ls(e, t) {
5644
+ function ds(e, t) {
5640
5645
  let n = {
5641
5646
  side: e.side,
5642
5647
  type: e.type,
@@ -5645,14 +5650,14 @@ function ls(e, t) {
5645
5650
  };
5646
5651
  return e.type === "stop" && (n.stopPrice = e.price), e.type !== "market" && (n.timeInForce = e.timeInForce), e.stopLoss !== null && (n.stopLoss = e.stopLoss), e.takeProfit !== null && (n.takeProfit = e.takeProfit), n;
5647
5652
  }
5648
- function us(e, t) {
5649
- let n = os(e, t);
5653
+ function fs(e, t) {
5654
+ let n = cs(e, t);
5650
5655
  if (n === null || e.stopLoss === null || e.takeProfit === null) return null;
5651
5656
  let r = Math.abs(n - e.stopLoss);
5652
5657
  return r > 0 ? Math.abs(e.takeProfit - n) / r : null;
5653
5658
  }
5654
- function ds(e, t, n, r = 1) {
5655
- let i = os(e, t);
5659
+ function ps(e, t, n, r = 1) {
5660
+ let i = cs(e, t);
5656
5661
  if (i === null || !(i > 0) || !Number.isFinite(n) || !(e.quantity > 0)) return null;
5657
5662
  let a = e.side === "buy" ? 1 : -1;
5658
5663
  return {
@@ -5660,18 +5665,18 @@ function ds(e, t, n, r = 1) {
5660
5665
  amount: (n - i) * e.quantity * a * r
5661
5666
  };
5662
5667
  }
5663
- function fs(e, t, n = {}) {
5664
- let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i = os(e, t), a = i !== null && i > 0 && e.quantity > 0 ? i * e.quantity * r : null, o = ss(e, t), s = (n, i) => n === null || o.includes(i) ? null : ds(e, t, n, r)?.amount ?? null, c = s(e.stopLoss, "stopLossSide"), l = s(e.takeProfit, "takeProfitSide");
5668
+ function ms(e, t, n = {}) {
5669
+ let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i = cs(e, t), a = i !== null && i > 0 && e.quantity > 0 ? i * e.quantity * r : null, o = ls(e, t), s = (n, i) => n === null || o.includes(i) ? null : ps(e, t, n, r)?.amount ?? null, c = s(e.stopLoss, "stopLossSide"), l = s(e.takeProfit, "takeProfitSide");
5665
5670
  return {
5666
5671
  value: a,
5667
5672
  risk: c,
5668
5673
  reward: l,
5669
- ratio: c !== null && l !== null ? us(e, t) : null
5674
+ ratio: c !== null && l !== null ? fs(e, t) : null
5670
5675
  };
5671
5676
  }
5672
5677
  //#endregion
5673
5678
  //#region src/widget/WidgetOrderTicket.ts
5674
- var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5679
+ var hs = 229, gs = 1, _s = 2, vs = .999999999, ys = 0, bs = class {
5675
5680
  backdrop;
5676
5681
  modal;
5677
5682
  symbolEl;
@@ -5682,11 +5687,11 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5682
5687
  draft = null;
5683
5688
  lastPrice = null;
5684
5689
  rules = {};
5685
- step = bs;
5686
- round = (e) => xs(e, e);
5690
+ step = Ss;
5691
+ round = (e) => Cs(e, e);
5687
5692
  typed = /* @__PURE__ */ new Map();
5688
5693
  returnFocus = null;
5689
- uid = ++_s;
5694
+ uid = ++ys;
5690
5695
  constructor(e, t, n = T) {
5691
5696
  this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
5692
5697
  let r = !1;
@@ -5695,7 +5700,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5695
5700
  }), this.backdrop.addEventListener("click", (e) => {
5696
5701
  e.target === this.backdrop && r && this.close(), r = !1;
5697
5702
  }), this.modal = document.createElement("div"), this.modal.className = "tcw-modal tcw-order-ticket", this.modal.setAttribute("role", "dialog"), this.modal.setAttribute("aria-modal", "true"), this.modal.setAttribute("aria-labelledby", `tcw-ticket-title-${this.uid}`), this.modal.addEventListener("keydown", (e) => {
5698
- if (e.key === "Escape" && !e.isComposing && e.keyCode !== ps) {
5703
+ if (e.key === "Escape" && !e.isComposing && e.keyCode !== hs) {
5699
5704
  e.stopPropagation(), this.close();
5700
5705
  return;
5701
5706
  }
@@ -5717,7 +5722,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5717
5722
  u.className = "tcw-footer-end", u.append(l, this.submit), c.append(u), this.modal.append(i, this.body, this.summaryEl, this.problemsEl, c), this.backdrop.appendChild(this.modal), e.appendChild(this.backdrop);
5718
5723
  }
5719
5724
  open(e) {
5720
- this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ?? bs, this.round = e.round ?? ((e) => xs(e, e)), this.typed.clear(), this.symbolEl.textContent = e.symbol ? O(e.symbol) : "";
5725
+ this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ?? Ss, this.round = e.round ?? ((e) => Cs(e, e)), this.typed.clear(), this.symbolEl.textContent = e.symbol ? O(e.symbol) : "";
5721
5726
  let t = this.round(e.price ?? e.lastPrice ?? 0), n = e.side ?? "buy", r = "market";
5722
5727
  e.price !== void 0 && e.lastPrice !== null && t !== e.lastPrice && (r = t < e.lastPrice == (n === "buy") ? "limit" : "stop"), this.draft = {
5723
5728
  side: n,
@@ -5753,14 +5758,14 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5753
5758
  return t > 0 ? Number((10 ** -t).toFixed(t)) : 1;
5754
5759
  }
5755
5760
  priceStep(e, t) {
5756
- return this.step(t > 0 ? e : e * gs);
5761
+ return this.step(t > 0 ? e : e * vs);
5757
5762
  }
5758
5763
  writePrice(e) {
5759
- return Number.isFinite(e) ? this.step === bs ? String(e) : e.toFixed(gt(this.step(e))) : "";
5764
+ return Number.isFinite(e) ? this.step === Ss ? String(e) : e.toFixed(gt(this.step(e))) : "";
5760
5765
  }
5761
5766
  place() {
5762
5767
  let e = this.draft;
5763
- !e || ss(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(ls(e, this.lastPrice)), this.close());
5768
+ !e || ls(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(ds(e, this.lastPrice)), this.close());
5764
5769
  }
5765
5770
  set(e, t = !1) {
5766
5771
  this.draft && (this.draft = {
@@ -5795,7 +5800,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5795
5800
  return r.className = "tcw-settings-label", r.textContent = this.t(e), n.append(r, t), n;
5796
5801
  }
5797
5802
  choices(e, t, n, r, i) {
5798
- let a = e === "type" ? "ticket.type" : "ticket.tif", o = ys(e, Pe(t.map((e) => ({
5803
+ let a = e === "type" ? "ticket.type" : "ticket.tif", o = xs(e, Pe(t.map((e) => ({
5799
5804
  value: e,
5800
5805
  label: this.t(`${a}.${e}`)
5801
5806
  })), n, i, this.t(r)));
@@ -5828,7 +5833,7 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5828
5833
  return this.stepped(e, t, (e, t) => this.priceStep(e, t), () => this.lastPrice ?? this.draft?.price ?? 0, (e) => this.writePrice(e), n);
5829
5834
  }
5830
5835
  stepped(e, t, n, r, i, a) {
5831
- let o = ys(e, document.createElement("input"));
5836
+ let o = xs(e, document.createElement("input"));
5832
5837
  o.type = "number", o.className = "tcw-indi-input", o.step = "any", o.min = "0", o.value = this.typed.get(e) ?? i(t);
5833
5838
  let s = this.t(`ticket.${e}`);
5834
5839
  o.setAttribute("aria-label", s), o.addEventListener("input", () => {
@@ -5866,25 +5871,25 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5866
5871
  if (!t) return NaN;
5867
5872
  let n = t.type === "market" ? this.lastPrice ?? t.price : t.price;
5868
5873
  if (!(n > 0)) return NaN;
5869
- let r = e === "stopLoss" ? -ms : hs;
5874
+ let r = e === "stopLoss" ? -gs : _s;
5870
5875
  return this.round(n * (1 + (t.side === "buy" ? r : -r) / 100));
5871
5876
  }
5872
5877
  check() {
5873
5878
  let e = this.draft;
5874
5879
  if (!e) return;
5875
- let t = ss(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e));
5880
+ let t = ls(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e));
5876
5881
  n.join("\n") !== [...this.problemsEl.children].map((e) => e.textContent).join("\n") && this.problemsEl.replaceChildren(...n.map((e) => {
5877
5882
  let t = document.createElement("p");
5878
5883
  return t.textContent = e, t;
5879
5884
  }));
5880
5885
  for (let t of ["stopLoss", "takeProfit"]) {
5881
- let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null : ds(e, this.lastPrice, r, this.rules.multiplier);
5886
+ let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null : ps(e, this.lastPrice, r, this.rules.multiplier);
5882
5887
  n && (n.textContent = i ? `${this.signedNumber(i.pct, 2)}% · ${this.amount(i.amount)}` : "");
5883
5888
  }
5884
5889
  this.renderSummary(e), this.submit.disabled = t.length > 0, this.submit.textContent = this.t(e.side === "buy" ? "ticket.placeBuy" : "ticket.placeSell");
5885
5890
  }
5886
5891
  renderSummary(e) {
5887
- let t = fs(e, this.lastPrice, this.rules), n = t.risk === null ? null : this.amount(t.risk), r = t.reward === null ? null : this.amount(t.reward), i = [
5892
+ let t = ms(e, this.lastPrice, this.rules), n = t.risk === null ? null : this.amount(t.risk), r = t.reward === null ? null : this.amount(t.reward), i = [
5888
5893
  [
5889
5894
  "value",
5890
5895
  "ticket.value",
@@ -5895,13 +5900,13 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5895
5900
  "risk",
5896
5901
  "ticket.risk",
5897
5902
  n,
5898
- n === null ? null : Ko(n)
5903
+ n === null ? null : Jo(n)
5899
5904
  ],
5900
5905
  [
5901
5906
  "reward",
5902
5907
  "ticket.reward",
5903
5908
  r,
5904
- r === null ? null : Ko(r)
5909
+ r === null ? null : Jo(r)
5905
5910
  ],
5906
5911
  [
5907
5912
  "ratio",
@@ -5923,10 +5928,10 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5923
5928
  return this.callbacks.formatNumber ? this.callbacks.formatNumber(e, t) : e.toFixed(t);
5924
5929
  }
5925
5930
  signedNumber(e, t) {
5926
- return Go(this.number(Math.abs(e), t), e, this.number(0, t));
5931
+ return qo(this.number(Math.abs(e), t), e, this.number(0, t));
5927
5932
  }
5928
5933
  amount(e) {
5929
- return Go(this.money(Math.abs(e)), e, this.money(0));
5934
+ return qo(this.money(Math.abs(e)), e, this.money(0));
5930
5935
  }
5931
5936
  money(e) {
5932
5937
  return (this.callbacks.formatAmount ?? this.callbacks.formatPrice)(e);
@@ -5939,20 +5944,20 @@ var ps = 229, ms = 1, hs = 2, gs = .999999999, _s = 0, vs = class {
5939
5944
  }) : e === "lot" ? w(t, { lot: r ?? 1 }) : t;
5940
5945
  }
5941
5946
  };
5942
- function ys(e, t) {
5947
+ function xs(e, t) {
5943
5948
  return t.dataset.ticketField = e, t;
5944
5949
  }
5945
- function bs(e) {
5950
+ function Ss(e) {
5946
5951
  let t = Math.abs(e);
5947
5952
  return t > 0 ? 10 ** Math.floor(Math.log10(t / 100)) : 1;
5948
5953
  }
5949
- function xs(e, t) {
5954
+ function Cs(e, t) {
5950
5955
  let n = Math.abs(t), r = n >= 10 || n === 0 ? 2 : n >= 1 ? 4 : Math.min(10, Math.ceil(-Math.log10(n)) + 3);
5951
5956
  return Number(e.toFixed(r));
5952
5957
  }
5953
5958
  //#endregion
5954
5959
  //#region src/widget/WidgetNamePrompt.ts
5955
- var Ss = 0, Cs = class {
5960
+ var ws = 0, Ts = class {
5956
5961
  backdrop;
5957
5962
  titleEl;
5958
5963
  input;
@@ -5960,7 +5965,7 @@ var Ss = 0, Cs = class {
5960
5965
  request = null;
5961
5966
  returnFocus = null;
5962
5967
  busy = !1;
5963
- uid = ++Ss;
5968
+ uid = ++ws;
5964
5969
  constructor(e, t = T) {
5965
5970
  this.t = t, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
5966
5971
  let n = !1;
@@ -6020,13 +6025,13 @@ var Ss = 0, Cs = class {
6020
6025
  }
6021
6026
  }
6022
6027
  }
6023
- }, ws = 0, Ts = class {
6028
+ }, Es = 0, Ds = class {
6024
6029
  el;
6025
6030
  input;
6026
6031
  hint;
6027
6032
  returnFocus = null;
6028
6033
  constructor(e, t, n) {
6029
- this.labels = t, this.onApply = n, this.el = document.createElement("div"), this.el.className = "tcw-interval-input", this.el.hidden = !0, this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "tcw-interval-field", this.input.autocomplete = "off", this.input.spellcheck = !1, this.input.maxLength = 6, this.input.setAttribute("aria-label", t.title), this.hint = document.createElement("div"), this.hint.className = "tcw-interval-hint", this.hint.setAttribute("role", "status"), this.hint.id = `tcw-interval-hint-${++ws}`, this.input.setAttribute("aria-describedby", this.hint.id), this.el.append(this.input, this.hint), e.appendChild(this.el), this.input.addEventListener("input", () => this.check()), this.input.addEventListener("keydown", (e) => {
6034
+ this.labels = t, this.onApply = n, this.el = document.createElement("div"), this.el.className = "tcw-interval-input", this.el.hidden = !0, this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-label", t.title), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "tcw-interval-field", this.input.autocomplete = "off", this.input.spellcheck = !1, this.input.maxLength = 6, this.input.setAttribute("aria-label", t.title), this.hint = document.createElement("div"), this.hint.className = "tcw-interval-hint", this.hint.setAttribute("role", "status"), this.hint.id = `tcw-interval-hint-${++Es}`, this.input.setAttribute("aria-describedby", this.hint.id), this.el.append(this.input, this.hint), e.appendChild(this.el), this.input.addEventListener("input", () => this.check()), this.input.addEventListener("keydown", (e) => {
6030
6035
  e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), this.apply()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close());
6031
6036
  }), this.input.addEventListener("blur", () => this.close(!1));
6032
6037
  }
@@ -6057,7 +6062,7 @@ var Ss = 0, Cs = class {
6057
6062
  }
6058
6063
  this.input.setAttribute("aria-invalid", "true"), this.hint.textContent = this.labels.invalid;
6059
6064
  }
6060
- }, Es = class {
6065
+ }, Os = class {
6061
6066
  constructor(e = "tcw:indicator-templates") {
6062
6067
  this.key = e;
6063
6068
  }
@@ -6102,28 +6107,28 @@ var Ss = 0, Cs = class {
6102
6107
  localStorage.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
6103
6108
  } catch {}
6104
6109
  }
6105
- }, Ds = [
6110
+ }, ks = [
6106
6111
  "regular",
6107
6112
  "logarithmic",
6108
6113
  "percentage",
6109
6114
  "indexedTo100"
6110
- ], Os = (e) => typeof e == "object" && !!e && !Array.isArray(e);
6111
- function ks(e) {
6115
+ ], As = (e) => typeof e == "object" && !!e && !Array.isArray(e);
6116
+ function js(e) {
6112
6117
  let { theme: t, timestamp: n, ...r } = e;
6113
6118
  return r;
6114
6119
  }
6115
- function As(e) {
6116
- return !Os(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(nt(e.timeframe) || D(e.timeframe) !== null) ? null : {
6120
+ function Ms(e) {
6121
+ return !As(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(nt(e.timeframe) || D(e.timeframe) !== null) ? null : {
6117
6122
  v: 1,
6118
6123
  symbol: e.symbol,
6119
6124
  timeframe: e.timeframe,
6120
- scaleMode: Ds.find((t) => t === e.scaleMode) ?? "regular",
6125
+ scaleMode: ks.find((t) => t === e.scaleMode) ?? "regular",
6121
6126
  invertScale: e.invertScale === !0,
6122
- chart: Os(e.chart) ? ks(e.chart) : null,
6123
- ...Os(e.settings) ? { settings: W(e.settings, Pa) } : {}
6127
+ chart: As(e.chart) ? js(e.chart) : null,
6128
+ ...As(e.settings) ? { settings: W(e.settings, Pa) } : {}
6124
6129
  };
6125
6130
  }
6126
- function js(e) {
6131
+ function Ns(e) {
6127
6132
  try {
6128
6133
  return JSON.parse(e);
6129
6134
  } catch {
@@ -6132,16 +6137,16 @@ function js(e) {
6132
6137
  }
6133
6138
  //#endregion
6134
6139
  //#region src/widget/DrawingFavoritesStore.ts
6135
- function Ms() {
6140
+ function Ps() {
6136
6141
  try {
6137
6142
  return typeof localStorage < "u" ? localStorage : null;
6138
6143
  } catch {
6139
6144
  return null;
6140
6145
  }
6141
6146
  }
6142
- var Ns = class {
6147
+ var Fs = class {
6143
6148
  favorites = [];
6144
- constructor(e = "tcw:draw-favorites", t = Ms()) {
6149
+ constructor(e = "tcw:draw-favorites", t = Ps()) {
6145
6150
  this.storageKey = e, this.storage = t, this.load();
6146
6151
  }
6147
6152
  list() {
@@ -6178,7 +6183,7 @@ var Ns = class {
6178
6183
  };
6179
6184
  //#endregion
6180
6185
  //#region src/widget/keyboardInset.ts
6181
- function Ps(e) {
6186
+ function Is(e) {
6182
6187
  let t = typeof window < "u" ? window.visualViewport : null;
6183
6188
  if (!t) return () => {};
6184
6189
  let n = -1, r = () => {
@@ -6192,7 +6197,7 @@ function Ps(e) {
6192
6197
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
6193
6198
  };
6194
6199
  }
6195
- function Fs(e, t) {
6200
+ function Ls(e, t) {
6196
6201
  let n = null, r = () => {
6197
6202
  let r = e.clientWidth;
6198
6203
  if (r === 0 && n !== null) return;
@@ -6216,7 +6221,7 @@ function J(e) {
6216
6221
  }
6217
6222
  };
6218
6223
  }
6219
- var Is = class {
6224
+ var Rs = class {
6220
6225
  part = null;
6221
6226
  loading = null;
6222
6227
  gone = !1;
@@ -6251,14 +6256,14 @@ var Is = class {
6251
6256
  commandPalette: J(() => import("../WidgetCommandPalette-DpP-lG1A.js")),
6252
6257
  symbolSearch: J(() => import("../WidgetSymbolSearch-Cxxq4SrK.js"))
6253
6258
  };
6254
- async function Ls() {
6259
+ async function zs() {
6255
6260
  await Promise.all(Object.values(Y).map((e) => e.load().catch(() => null)));
6256
6261
  }
6257
6262
  //#endregion
6258
6263
  //#region src/widget/wallTime.ts
6259
- var Rs = /^(\d{4})-(\d{2})-(\d{2})$/, zs = /^(\d{2}):(\d{2})$/;
6260
- function Bs(e, t, n) {
6261
- let r = Rs.exec(e), i = t ? zs.exec(t) : [
6264
+ var Bs = /^(\d{4})-(\d{2})-(\d{2})$/, Vs = /^(\d{2}):(\d{2})$/;
6265
+ function Hs(e, t, n) {
6266
+ let r = Bs.exec(e), i = t ? Vs.exec(t) : [
6262
6267
  "",
6263
6268
  "00",
6264
6269
  "00"
@@ -6288,7 +6293,7 @@ var Z = {
6288
6293
  min: 233,
6289
6294
  default: 262,
6290
6295
  max: 377
6291
- }, Vs = .382, Hs = (e) => !e.hidden && getComputedStyle(e).display !== "none", Us = class {
6296
+ }, Us = .382, Ws = (e) => !e.hidden && getComputedStyle(e).display !== "none", Gs = class {
6292
6297
  element;
6293
6298
  panel;
6294
6299
  rail;
@@ -6335,7 +6340,7 @@ var Z = {
6335
6340
  let t = this.panel.contains(document.activeElement);
6336
6341
  if (this.hideCurrent(), this.panel.hidden = !0, t) {
6337
6342
  let t = this.pages.get(e)?.button;
6338
- (t && (this.options.railShown?.() ?? !0) && Hs(t) ? t : this.options.focusAfterClose?.(e))?.focus();
6343
+ (t && (this.options.railShown?.() ?? !0) && Ws(t) ? t : this.options.focusAfterClose?.(e))?.focus();
6339
6344
  }
6340
6345
  this.options.onChange?.(null);
6341
6346
  }
@@ -6352,7 +6357,7 @@ var Z = {
6352
6357
  return this.open_ === e;
6353
6358
  }
6354
6359
  syncRail() {
6355
- let e = [...this.pages.values()].map((e) => e.button), t = e.filter(Hs), n = e.find((e) => e.tabIndex === 0);
6360
+ let e = [...this.pages.values()].map((e) => e.button), t = e.filter(Ws), n = e.find((e) => e.tabIndex === 0);
6356
6361
  if (n && t.includes(n)) return;
6357
6362
  let r = t.find((e) => e.getAttribute("aria-pressed") === "true") ?? t[0];
6358
6363
  for (let t of e) t.tabIndex = t === r ? 0 : -1;
@@ -6376,7 +6381,7 @@ var Z = {
6376
6381
  }
6377
6382
  maxNow() {
6378
6383
  let e = this.options.room?.() ?? 0, t = Math.round(Z.max * this.scale);
6379
- return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e * Vs)));
6384
+ return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e * Us)));
6380
6385
  }
6381
6386
  clamp(e, t = this.maxNow()) {
6382
6387
  return Math.round(Math.min(t, Math.max(this.min(), e)));
@@ -6420,12 +6425,12 @@ var Z = {
6420
6425
  for (let { button: t } of this.pages.values()) t.tabIndex = t === e ? 0 : -1;
6421
6426
  }
6422
6427
  onRailKey(e) {
6423
- let t = [...this.pages.values()].map((e) => e.button).filter(Hs), n = t.indexOf(e.target);
6428
+ let t = [...this.pages.values()].map((e) => e.button).filter(Ws), n = t.indexOf(e.target);
6424
6429
  if (n < 0) return;
6425
6430
  let r = e.key === "ArrowDown" ? (n + 1) % t.length : e.key === "ArrowUp" ? (n - 1 + t.length) % t.length : e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : -1;
6426
6431
  r < 0 || (e.preventDefault(), t[r].focus());
6427
6432
  }
6428
- }, Ws = [
6433
+ }, Ks = [
6429
6434
  "percent",
6430
6435
  "scale",
6431
6436
  "pane",
@@ -6433,7 +6438,7 @@ var Z = {
6433
6438
  "ratio",
6434
6439
  "correlation",
6435
6440
  "correlationLog"
6436
- ], Gs = {
6441
+ ], qs = {
6437
6442
  percent: "compare.percent",
6438
6443
  scale: "compare.ownScale",
6439
6444
  pane: "compare.ownPane",
@@ -6442,24 +6447,24 @@ var Z = {
6442
6447
  correlation: "compare.way.correlation",
6443
6448
  correlationLog: "compare.way.correlationLog"
6444
6449
  };
6445
- function Ks(e) {
6446
- return Ws.includes(e);
6450
+ function Js(e) {
6451
+ return Ks.includes(e);
6447
6452
  }
6448
- function qs(e) {
6449
- return Ws.map((t) => ({
6453
+ function Ys(e) {
6454
+ return Ks.map((t) => ({
6450
6455
  id: t,
6451
- label: e(Gs[t])
6456
+ label: e(qs[t])
6452
6457
  }));
6453
6458
  }
6454
- function Js(e, t) {
6459
+ function Xs(e, t) {
6455
6460
  let n = e.findIndex((e) => e.time >= t);
6456
6461
  return n < 0 ? e.length : n;
6457
6462
  }
6458
- function Ys(e, t) {
6463
+ function Zs(e, t) {
6459
6464
  let n = e[0]?.time ?? Infinity, r = t.filter((e) => e.time < n);
6460
6465
  return r.length > 0 ? [...r, ...e] : null;
6461
6466
  }
6462
- function Xs(e, t) {
6467
+ function Qs(e, t) {
6463
6468
  switch (e.id) {
6464
6469
  case "compareSymbol": return t ? "pane" : "scale";
6465
6470
  case "compareSymbolPane": return "pane";
@@ -6469,24 +6474,24 @@ function Xs(e, t) {
6469
6474
  default: return null;
6470
6475
  }
6471
6476
  }
6472
- function Zs(e, t, n, r) {
6477
+ function $s(e, t, n, r) {
6473
6478
  let i = e.map((e) => ({
6474
6479
  id: e.id,
6475
6480
  symbol: e.symbol,
6476
- way: r(Gs.percent),
6481
+ way: r(qs.percent),
6477
6482
  color: e.color
6478
6483
  }));
6479
6484
  for (let e of t) {
6480
- let t = e.params.symbol, a = Xs(e, n.has(e.instanceId));
6485
+ let t = e.params.symbol, a = Qs(e, n.has(e.instanceId));
6481
6486
  !a || typeof t != "string" || !t || i.push({
6482
6487
  id: e.instanceId,
6483
6488
  symbol: t,
6484
- way: r(Gs[a])
6489
+ way: r(qs[a])
6485
6490
  });
6486
6491
  }
6487
6492
  return i;
6488
6493
  }
6489
- var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", tc = class {
6494
+ var Q = 8, ec = 4, tc = 3, nc = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", rc = class {
6490
6495
  el;
6491
6496
  target = null;
6492
6497
  source = null;
@@ -6497,9 +6502,9 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
6497
6502
  observer;
6498
6503
  constructor(e) {
6499
6504
  this.root = e, this.el = document.createElement("div"), this.el.className = "tcw-tooltip", this.el.setAttribute("aria-hidden", "true"), e.appendChild(this.el), e.addEventListener("pointerover", this.onOver), e.addEventListener("pointerout", this.onOut), e.addEventListener("pointerdown", this.onPress, !0), e.addEventListener("keydown", this.onPress, !0), e.addEventListener("focusin", this.onFocus), e.addEventListener("focusout", this.onBlur), e.addEventListener("wheel", this.hide, { passive: !0 }), this.observer = new MutationObserver(() => {
6500
- this.pressed?.hasAttribute("title") && nc(this.pressed);
6505
+ this.pressed?.hasAttribute("title") && ic(this.pressed);
6501
6506
  let e = this.target;
6502
- !e || this.source !== "pointer" || !e.hasAttribute("title") || (nc(e), this.isVisible() && this.show(e));
6507
+ !e || this.source !== "pointer" || !e.hasAttribute("title") || (ic(e), this.isVisible() && this.show(e));
6503
6508
  }), this.observer.observe(e, {
6504
6509
  subtree: !0,
6505
6510
  attributes: !0,
@@ -6507,24 +6512,24 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
6507
6512
  });
6508
6513
  }
6509
6514
  destroy() {
6510
- this.hide(), this.pressed && rc(this.pressed), this.observer.disconnect(), this.root.removeEventListener("pointerover", this.onOver), this.root.removeEventListener("pointerout", this.onOut), this.root.removeEventListener("pointerdown", this.onPress, !0), this.root.removeEventListener("keydown", this.onPress, !0), this.root.removeEventListener("focusin", this.onFocus), this.root.removeEventListener("focusout", this.onBlur), this.root.removeEventListener("wheel", this.hide), this.el.remove();
6515
+ this.hide(), this.pressed && ac(this.pressed), this.observer.disconnect(), this.root.removeEventListener("pointerover", this.onOver), this.root.removeEventListener("pointerout", this.onOut), this.root.removeEventListener("pointerdown", this.onPress, !0), this.root.removeEventListener("keydown", this.onPress, !0), this.root.removeEventListener("focusin", this.onFocus), this.root.removeEventListener("focusout", this.onBlur), this.root.removeEventListener("wheel", this.hide), this.el.remove();
6511
6516
  }
6512
6517
  onOver = (e) => {
6513
6518
  if (e.pointerType === "touch") return;
6514
6519
  let t = this.tipTarget(e.target);
6515
- !t || t === this.pressed || t === this.target && this.source === "pointer" || (nc(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
6520
+ !t || t === this.pressed || t === this.target && this.source === "pointer" || (ic(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
6516
6521
  };
6517
6522
  onOut = (e) => {
6518
6523
  let t = e.relatedTarget, n = (e) => !!e && !!t && e.contains(t);
6519
- this.pressed && !n(this.pressed) && (rc(this.pressed), this.pressed = null), this.source === "pointer" && !n(this.target) && this.hide();
6524
+ this.pressed && !n(this.pressed) && (ac(this.pressed), this.pressed = null), this.source === "pointer" && !n(this.target) && this.hide();
6520
6525
  };
6521
6526
  onPress = () => {
6522
6527
  let e = this.target, t = this.source === "pointer";
6523
- this.warmUntil = 0, this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.el.classList.remove("tcw-tooltip--visible"), this.target = null, this.source = null, this.pressed && this.pressed !== e && rc(this.pressed), this.pressed = t ? e : null;
6528
+ this.warmUntil = 0, this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.el.classList.remove("tcw-tooltip--visible"), this.target = null, this.source = null, this.pressed && this.pressed !== e && ac(this.pressed), this.pressed = t ? e : null;
6524
6529
  };
6525
6530
  onFocus = (e) => {
6526
6531
  let t = this.tipTarget(e.target);
6527
- !t || !oc(t) || t === this.pressed || this.schedule(t, "focus", !0);
6532
+ !t || !cc(t) || t === this.pressed || this.schedule(t, "focus", !0);
6528
6533
  };
6529
6534
  onBlur = (e) => {
6530
6535
  if (this.source !== "focus") return;
@@ -6532,16 +6537,16 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
6532
6537
  this.target && t && this.target.contains(t) || this.hide();
6533
6538
  };
6534
6539
  hide = () => {
6535
- this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" && rc(this.target), this.target = null, this.source = null;
6540
+ this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" && ac(this.target), this.target = null, this.source = null;
6536
6541
  };
6537
6542
  tipTarget(e) {
6538
6543
  if (!(e instanceof Element)) return null;
6539
- let t = e.closest(ec);
6544
+ let t = e.closest(nc);
6540
6545
  return t && t !== this.el && this.root.contains(t) ? t : null;
6541
6546
  }
6542
6547
  schedule(e, t, n) {
6543
6548
  let r = this.target;
6544
- if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" && rc(r), this.target = e, this.source = t, n) {
6549
+ if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" && ac(r), this.target = e, this.source = t, n) {
6545
6550
  this.show(e);
6546
6551
  return;
6547
6552
  }
@@ -6550,27 +6555,27 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
6550
6555
  }, 300);
6551
6556
  }
6552
6557
  show(e) {
6553
- if (!ac(e)) {
6558
+ if (!sc(e)) {
6554
6559
  this.hide();
6555
6560
  return;
6556
6561
  }
6557
- this.el.textContent = ic(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
6562
+ this.el.textContent = oc(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
6558
6563
  }
6559
6564
  watch(e) {
6560
6565
  cancelAnimationFrame(this.watchFrame), this.watchFrame = requestAnimationFrame(() => {
6561
- this.target === e && (ac(e) ? this.watch(e) : this.hide());
6566
+ this.target === e && (sc(e) ? this.watch(e) : this.hide());
6562
6567
  });
6563
6568
  }
6564
6569
  place(e) {
6565
- let t = this.root.getBoundingClientRect(), n = e.getBoundingClientRect(), r = this.el.offsetWidth, i = this.el.offsetHeight, a = n.left - t.left, o = n.top - t.top, s = sc(e);
6570
+ let t = this.root.getBoundingClientRect(), n = e.getBoundingClientRect(), r = this.el.offsetWidth, i = this.el.offsetHeight, a = n.left - t.left, o = n.top - t.top, s = lc(e);
6566
6571
  s === "bottom" && o + n.height + Q + i > t.height ? s = "top" : s === "top" && o - Q - i < 0 ? s = "bottom" : s === "right" && a + n.width + Q + r > t.width && (s = "left");
6567
6572
  let c, l;
6568
- s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + Q : o - Q - i) : (c = s === "right" ? a + n.width + Q : a - Q - r, l = o + n.height / 2 - i / 2), c = Math.max(Qs, Math.min(t.width - r - Qs, c)), l = Math.max(Qs, Math.min(t.height - i - Qs, l)), this.el.style.left = `${Math.round(c)}px`, this.el.style.top = `${Math.round(l)}px`;
6573
+ s === "top" || s === "bottom" ? (c = a + n.width / 2 - r / 2, l = s === "bottom" ? o + n.height + Q : o - Q - i) : (c = s === "right" ? a + n.width + Q : a - Q - r, l = o + n.height / 2 - i / 2), c = Math.max(ec, Math.min(t.width - r - ec, c)), l = Math.max(ec, Math.min(t.height - i - ec, l)), this.el.style.left = `${Math.round(c)}px`, this.el.style.top = `${Math.round(l)}px`;
6569
6574
  let u = {
6570
- top: [0, $s],
6571
- bottom: [0, -$s],
6572
- left: [$s, 0],
6573
- right: [-$s, 0]
6575
+ top: [0, tc],
6576
+ bottom: [0, -tc],
6577
+ left: [tc, 0],
6578
+ right: [-tc, 0]
6574
6579
  }[s];
6575
6580
  this.el.style.setProperty("--tcw-tip-dx", `${u[0]}px`), this.el.style.setProperty("--tcw-tip-dy", `${u[1]}px`), this.el.dataset.side = s;
6576
6581
  }
@@ -6581,32 +6586,32 @@ var Q = 8, Qs = 4, $s = 3, ec = "[title]:not([title=\"\"]), [data-tip]:not([data
6581
6586
  this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
6582
6587
  }
6583
6588
  };
6584
- function nc(e) {
6589
+ function ic(e) {
6585
6590
  let t = e.getAttribute("title");
6586
6591
  t !== null && (e.dataset.tip = t, e.removeAttribute("title"));
6587
6592
  }
6588
- function rc(e) {
6593
+ function ac(e) {
6589
6594
  e.dataset.tip !== void 0 && !e.hasAttribute("title") && (e.setAttribute("title", e.dataset.tip), delete e.dataset.tip);
6590
6595
  }
6591
- function ic(e) {
6596
+ function oc(e) {
6592
6597
  return e.dataset.tip ?? e.getAttribute("title") ?? "";
6593
6598
  }
6594
- function ac(e) {
6599
+ function sc(e) {
6595
6600
  return e.isConnected && e.getClientRects().length > 0 && !e.disabled;
6596
6601
  }
6597
- function oc(e) {
6602
+ function cc(e) {
6598
6603
  try {
6599
6604
  return e.matches(":focus-visible");
6600
6605
  } catch {
6601
6606
  return !1;
6602
6607
  }
6603
6608
  }
6604
- function sc(e) {
6609
+ function lc(e) {
6605
6610
  return e.dataset.tipSide || (e.closest(".tcw-sidebar") ? "right" : e.closest(".tcw-statusbar, .tcw-replay-bar") ? "top" : "bottom");
6606
6611
  }
6607
6612
  //#endregion
6608
6613
  //#region src/widget/WidgetIndicatorLegend.ts
6609
- var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class {
6614
+ var uc = 2, dc = 1.5, fc = "tcw-ind-legend-values--no-room", pc = 0, mc = class {
6610
6615
  stack;
6611
6616
  toggle;
6612
6617
  rows = /* @__PURE__ */ new Map();
@@ -6620,7 +6625,7 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
6620
6625
  this.host = e, this.callbacks = t, this.labels = n, this.stack = document.createElement("div"), this.stack.className = "tcw-ind-legend", y(this.stack, "indicatorLegend"), this.toggle = document.createElement("button"), this.toggle.type = "button", this.toggle.className = "tcw-ind-legend-toggle", this.toggle.addEventListener("click", () => {
6621
6626
  this.setCollapsed(!this.collapsed), this.renderToggle(this.overlayCount());
6622
6627
  }), this.stack.appendChild(this.toggle), e.appendChild(this.stack), this.stackObserver = typeof ResizeObserver > "u" || !t.onStackResize ? null : new ResizeObserver(() => this.reportStackSize()), this.stackObserver?.observe(this.stack), this.valuesObserver = typeof ResizeObserver > "u" ? null : new ResizeObserver((e) => {
6623
- for (let t of e) pc(t.target, t.contentRect.width);
6628
+ for (let t of e) hc(t.target, t.contentRect.width);
6624
6629
  });
6625
6630
  }
6626
6631
  update(e, t, n = []) {
@@ -6712,7 +6717,7 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
6712
6717
  }, c = s("visible", "eye", () => {
6713
6718
  this.callbacks.onToggleVisible(e, !m.visible, t);
6714
6719
  }, "indicatorLegend.visibility"), l = n ? null : s("settings", "settings", () => this.callbacks.onSettings(e), "indicatorSettings", "indicatorLegend.settings"), u = this.callbacks.onMore && !n ? s("more", "more", () => this.callbacks.onMore?.(e, u), "indicatorLegend.more") : null, d = s("remove", "x", () => this.callbacks.onRemove(e, t), "indicatorLegend.remove"), f = document.createElement("span");
6715
- f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++dc}`;
6720
+ f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++pc}`;
6716
6721
  let p = n ? document.createElement("span") : null;
6717
6722
  p && (p.className = "tcw-ind-legend-swatch", p.setAttribute("aria-hidden", "true"), r.append(p)), r.append(i, a, o, f);
6718
6723
  let m = {
@@ -6766,7 +6771,7 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
6766
6771
  return this.stack.querySelectorAll(":scope > .tcw-ind-legend-row").length;
6767
6772
  }
6768
6773
  renderToggle(e) {
6769
- let t = e >= cc;
6774
+ let t = e >= uc;
6770
6775
  !t && this.collapsed && this.setCollapsed(!1);
6771
6776
  let n = `${t}|${this.collapsed}|${e}`;
6772
6777
  if (n === this.toggleKey || (this.toggleKey = n, this.toggle.hidden = !t, !t)) return;
@@ -6776,19 +6781,19 @@ var cc = 2, lc = 1.5, uc = "tcw-ind-legend-values--no-room", dc = 0, fc = class
6776
6781
  this.toggle.innerHTML = this.collapsed ? `${i}<span>${e}</span>` : i;
6777
6782
  }
6778
6783
  };
6779
- function pc(e, t) {
6780
- let n = (parseFloat(getComputedStyle(e).fontSize) || 0) * lc;
6781
- e.classList.toggle(uc, t < n);
6784
+ function hc(e, t) {
6785
+ let n = (parseFloat(getComputedStyle(e).fontSize) || 0) * dc;
6786
+ e.classList.toggle(fc, t < n);
6782
6787
  }
6783
6788
  function $(e, t, n) {
6784
6789
  e.title = t, e.setAttribute("aria-label", n ? `${t} ${n}` : t);
6785
6790
  }
6786
6791
  //#endregion
6787
6792
  //#region src/widget/legendValues.ts
6788
- function mc(e, t) {
6793
+ function gc(e, t) {
6789
6794
  return !e || e.length === 0 ? null : e[t === null ? e.length - 1 : Math.min(Math.max(t, 0), e.length - 1)] ?? null;
6790
6795
  }
6791
- function hc(e, t, n, r) {
6796
+ function _c(e, t, n, r) {
6792
6797
  if (!t) return [];
6793
6798
  let i = e.plots;
6794
6799
  if (!i) {
@@ -6818,20 +6823,20 @@ function hc(e, t, n, r) {
6818
6823
  }
6819
6824
  return o;
6820
6825
  }
6821
- var gc = /* @__PURE__ */ new Map();
6822
- function _c(e) {
6823
- let t = gc.get(e);
6826
+ var vc = /* @__PURE__ */ new Map();
6827
+ function yc(e) {
6828
+ let t = vc.get(e);
6824
6829
  return t || (t = new Intl.NumberFormat(e, {
6825
6830
  notation: "compact",
6826
6831
  maximumFractionDigits: 2
6827
- }), gc.set(e, t)), t;
6832
+ }), vc.set(e, t)), t;
6828
6833
  }
6829
- function vc(e, t = "en-US") {
6830
- return Math.abs(e) >= 1e6 ? _c(t).format(e) : $e(e, Mt(e), t);
6834
+ function bc(e, t = "en-US") {
6835
+ return Math.abs(e) >= 1e6 ? yc(t).format(e) : $e(e, Mt(e), t);
6831
6836
  }
6832
6837
  //#endregion
6833
6838
  //#region src/widget/WidgetBracketBar.ts
6834
- var yc = class {
6839
+ var xc = class {
6835
6840
  el;
6836
6841
  labelEl;
6837
6842
  callbacks;
@@ -6859,7 +6864,7 @@ var yc = class {
6859
6864
  destroy() {
6860
6865
  this.el.remove();
6861
6866
  }
6862
- }, bc = class {
6867
+ }, Sc = class {
6863
6868
  options;
6864
6869
  audioCtx = null;
6865
6870
  audioEl = null;
@@ -6922,7 +6927,7 @@ var yc = class {
6922
6927
  };
6923
6928
  //#endregion
6924
6929
  //#region src/widget/ladderRows.ts
6925
- function xc(e, t = 12) {
6930
+ function Cc(e, t = 12) {
6926
6931
  let n = [...e.asks].sort((e, t) => e.price - t.price).slice(0, t), r = [...e.bids].sort((e, t) => t.price - e.price).slice(0, t), i = n.length > 0 ? n[0].price : null, a = r.length > 0 ? r[0].price : null, o = i !== null && a !== null ? (i + a) / 2 : null, s = /* @__PURE__ */ new Map(), c = (e) => {
6927
6932
  let t = s.get(e);
6928
6933
  return t || (t = {
@@ -6945,7 +6950,7 @@ function xc(e, t = 12) {
6945
6950
  }
6946
6951
  //#endregion
6947
6952
  //#region src/widget/WidgetDepthLadder.ts
6948
- var Sc = 1e-9, Cc = class {
6953
+ var wc = 1e-9, Tc = class {
6949
6954
  el;
6950
6955
  colsEl;
6951
6956
  bodyEl;
@@ -6991,7 +6996,7 @@ var Sc = 1e-9, Cc = class {
6991
6996
  this.open && (this.open = !1, this.el.hidden = !0, this.callbacks.onToggle?.(!1));
6992
6997
  }
6993
6998
  setData(e) {
6994
- this.model = e ? xc(e, this.levels) : null, this.render();
6999
+ this.model = e ? Cc(e, this.levels) : null, this.render();
6995
7000
  }
6996
7001
  setOrders(e) {
6997
7002
  this.orders = e, this.render();
@@ -7007,7 +7012,7 @@ var Sc = 1e-9, Cc = class {
7007
7012
  e.className = "tcw-ladder-empty", e.textContent = this.t("ladder.empty"), this.bodyEl.replaceChildren(e), this.drawn = [];
7008
7013
  return;
7009
7014
  }
7010
- let t = wc(e.rows);
7015
+ let t = Ec(e.rows);
7011
7016
  e.rows.length === this.drawn.length && e.rows.every((e, t) => e.price === this.drawn[t].price) || (this.drawn = e.rows.map((e) => this.newRow(e.price)), this.bodyEl.replaceChildren(...this.drawn.map((e) => e.row)));
7012
7017
  let n = e.maxVolume > 0 ? 100 / e.maxVolume : 0;
7013
7018
  e.rows.forEach((e, r) => this.fillRow(this.drawn[r], e, n, this.nearness(e.price, t))), this.putSpread(e, t), this.placeSpread();
@@ -7065,7 +7070,7 @@ var Sc = 1e-9, Cc = class {
7065
7070
  return;
7066
7071
  }
7067
7072
  e.disabled = !1;
7068
- let a = Tc(n);
7073
+ let a = Dc(n);
7069
7074
  e.textContent = a, e.style.setProperty("--w", `${(n * i).toFixed(1)}%`);
7070
7075
  let o = w(this.t(t === "sell" ? "ladder.sellAt" : "ladder.buyAt"), { price: this.callbacks.formatPrice(r) });
7071
7076
  e.setAttribute("aria-label", `${a}, ${o}`), e.title = o;
@@ -7077,15 +7082,15 @@ var Sc = 1e-9, Cc = class {
7077
7082
  e.scrollTop += r - n - (e.clientHeight - n - this.spreadEl.offsetHeight) / 2, this.placed = !0;
7078
7083
  }
7079
7084
  };
7080
- function wc(e) {
7085
+ function Ec(e) {
7081
7086
  let t = Infinity;
7082
7087
  for (let n = 1; n < e.length; n++) t = Math.min(t, Math.abs(e[n - 1].price - e[n].price));
7083
- return Number.isFinite(t) && t > 0 ? t / 2 : Sc;
7088
+ return Number.isFinite(t) && t > 0 ? t / 2 : wc;
7084
7089
  }
7085
- function Tc(e) {
7090
+ function Dc(e) {
7086
7091
  return e >= 1e3 ? `${Number((e / 1e3).toFixed(1))}k` : String(Number(e >= 1 ? e.toFixed(2) : e.toPrecision(2)));
7087
7092
  }
7088
- var Ec = class {
7093
+ var Oc = class {
7089
7094
  el;
7090
7095
  bodyEl;
7091
7096
  callbacks;
@@ -7127,11 +7132,11 @@ var Ec = class {
7127
7132
  let t = this.callbacks.formatPrice, n = e.ohlc;
7128
7133
  this.bodyEl.appendChild(this.row(this.t("dataWindow.open"), t(n.open))), this.bodyEl.appendChild(this.row(this.t("dataWindow.high"), t(n.high))), this.bodyEl.appendChild(this.row(this.t("dataWindow.low"), t(n.low))), this.bodyEl.appendChild(this.row(this.t("dataWindow.close"), t(n.close)));
7129
7134
  let r = e.change > 0 ? "up" : e.change < 0 ? "down" : "", i = e.change > 0 ? "+" : "", a = this.callbacks.formatPercent?.(e.changePct) ?? e.changePct.toFixed(2), o = e.changeText ?? t(e.change);
7130
- this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${o} (${i}${a}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), (this.callbacks.formatVolume ?? Oc)(n.volume)));
7135
+ this.bodyEl.appendChild(this.row(this.t("dataWindow.change"), `${i}${o} (${i}${a}%)`, r)), this.bodyEl.appendChild(this.row(this.t("dataWindow.volume"), (this.callbacks.formatVolume ?? Ac)(n.volume)));
7131
7136
  for (let t of e.indicators) {
7132
7137
  let e = document.createElement("div");
7133
7138
  e.className = "tcw-datawin-sub", e.textContent = t.name, this.bodyEl.appendChild(e);
7134
- for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ?? Dc(e.value)));
7139
+ for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ?? kc(e.value)));
7135
7140
  }
7136
7141
  }
7137
7142
  row(e, t, n = "") {
@@ -7143,15 +7148,15 @@ var Ec = class {
7143
7148
  return a.className = `tcw-datawin-value${n ? ` tcw-${n}` : ""}`, a.textContent = t, r.appendChild(i), r.appendChild(a), r;
7144
7149
  }
7145
7150
  };
7146
- function Dc(e) {
7151
+ function kc(e) {
7147
7152
  if (!Number.isFinite(e)) return "—";
7148
7153
  let t = Math.abs(e);
7149
7154
  return t >= 1e3 ? e.toFixed(2) : t >= 1 ? e.toFixed(4) : e.toPrecision(4);
7150
7155
  }
7151
- function Oc(e) {
7156
+ function Ac(e) {
7152
7157
  return e >= 1e9 ? (e / 1e9).toFixed(2) + "B" : e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(2) + "K" : e.toFixed(0);
7153
7158
  }
7154
- var kc = [
7159
+ var jc = [
7155
7160
  [
7156
7161
  34,
7157
7162
  16,
@@ -7208,7 +7213,7 @@ var kc = [
7208
7213
  30,
7209
7214
  !0
7210
7215
  ]
7211
- ], Ac = class {
7216
+ ], Mc = class {
7212
7217
  el;
7213
7218
  label;
7214
7219
  showTimer = null;
@@ -7216,7 +7221,7 @@ var kc = [
7216
7221
  constructor(e, t) {
7217
7222
  this.loadingText = t, this.el = document.createElement("div"), this.el.className = "tcw-loading-overlay", this.el.setAttribute("role", "status"), this.el.setAttribute("aria-live", "polite");
7218
7223
  let n = document.createElement("div");
7219
- n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"), kc.forEach(([e, t, r, i, a], o) => {
7224
+ n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"), jc.forEach(([e, t, r, i, a], o) => {
7220
7225
  let s = document.createElement("span");
7221
7226
  s.className = a ? "tcw-loading-candle tcw-loading-candle--up" : "tcw-loading-candle", s.style.setProperty("--tcw-body-top", `${e}px`), s.style.setProperty("--tcw-body-h", `${t}px`), s.style.setProperty("--tcw-wick-top", `${r}px`), s.style.setProperty("--tcw-wick-h", `${i}px`), s.style.setProperty("--tcw-delay", `${o * 110}ms`), n.appendChild(s);
7222
7227
  }), this.el.appendChild(n), this.label = document.createElement("div"), this.label.className = "tcw-loading-label", this.label.textContent = t, this.el.appendChild(this.label), e.appendChild(this.el);
@@ -7251,7 +7256,7 @@ var kc = [
7251
7256
  clearTimer() {
7252
7257
  this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
7253
7258
  }
7254
- }, jc = 4e3, Mc = class {
7259
+ }, Nc = 4e3, Pc = class {
7255
7260
  el;
7256
7261
  text;
7257
7262
  hideTimer = null;
@@ -7261,7 +7266,7 @@ var kc = [
7261
7266
  n.className = "tcw-history-spinner", n.setAttribute("aria-hidden", "true"), this.text = document.createElement("span"), this.el.append(n, this.text), e.appendChild(this.el);
7262
7267
  }
7263
7268
  update(e) {
7264
- this.clearTimer(), e.state === "loading" ? this.show(this.texts.loading, !1) : e.state === "error" ? (this.show(this.texts.failed, !0), this.hideTimer = setTimeout(() => this.hide(), jc)) : this.hide();
7269
+ this.clearTimer(), e.state === "loading" ? this.show(this.texts.loading, !1) : e.state === "error" ? (this.show(this.texts.failed, !0), this.hideTimer = setTimeout(() => this.hide(), Nc)) : this.hide();
7265
7270
  }
7266
7271
  destroy() {
7267
7272
  this.clearTimer(), this.el.remove();
@@ -7275,13 +7280,13 @@ var kc = [
7275
7280
  clearTimer() {
7276
7281
  this.hideTimer !== null && clearTimeout(this.hideTimer), this.hideTimer = null;
7277
7282
  }
7278
- }, Nc = "host:";
7279
- function Pc(e, t) {
7283
+ }, Fc = "host:";
7284
+ function Ic(e, t) {
7280
7285
  return [
7281
7286
  ...e,
7282
7287
  ...e.length > 0 && t.length > 0 ? ["separator"] : [],
7283
7288
  ...t.map((e, t) => ({
7284
- id: `${Nc}${t}`,
7289
+ id: `${Fc}${t}`,
7285
7290
  label: e.label,
7286
7291
  icon: e.icon,
7287
7292
  danger: e.danger,
@@ -7289,12 +7294,12 @@ function Pc(e, t) {
7289
7294
  }))
7290
7295
  ];
7291
7296
  }
7292
- function Fc(e, t) {
7293
- return e.startsWith(Nc) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
7297
+ function Lc(e, t) {
7298
+ return e.startsWith(Fc) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
7294
7299
  }
7295
7300
  //#endregion
7296
7301
  //#region src/widget/hostHotkeys.ts
7297
- var Ic = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), Lc = {
7302
+ var Rc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), zc = {
7298
7303
  ctrl: "ctrl",
7299
7304
  control: "ctrl",
7300
7305
  cmd: "ctrl",
@@ -7305,7 +7310,7 @@ var Ic = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
7305
7310
  option: "alt",
7306
7311
  opt: "alt",
7307
7312
  shift: "shift"
7308
- }, Rc = {
7313
+ }, Bc = {
7309
7314
  esc: "escape",
7310
7315
  space: " ",
7311
7316
  spacebar: " ",
@@ -7317,7 +7322,7 @@ var Ic = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
7317
7322
  return: "enter",
7318
7323
  plus: "+"
7319
7324
  };
7320
- function zc(e) {
7325
+ function Vc(e) {
7321
7326
  let t = e.split("+").map((e) => e.trim()), n = t.pop();
7322
7327
  if (!n) return null;
7323
7328
  let r = {
@@ -7327,23 +7332,23 @@ function zc(e) {
7327
7332
  display: []
7328
7333
  };
7329
7334
  for (let e of t) {
7330
- let t = Lc[e.toLowerCase()];
7335
+ let t = zc[e.toLowerCase()];
7331
7336
  if (!t) return null;
7332
7337
  r[t] = !0;
7333
7338
  }
7334
7339
  let i = n.toLowerCase();
7335
- if (Lc[i]) return null;
7340
+ if (zc[i]) return null;
7336
7341
  if (/^[a-z]$/.test(i)) r.code = `Key${i.toUpperCase()}`, r.char = i;
7337
7342
  else if (/^[0-9]$/.test(i)) r.code = `Digit${i}`, r.char = i;
7338
- else if (r.key = Rc[i] ?? i, r.shift && r.key.length === 1) return null;
7343
+ else if (r.key = Bc[i] ?? i, r.shift && r.key.length === 1) return null;
7339
7344
  return r.display = [
7340
- ...r.ctrl ? [Ic ? "⌘" : "Ctrl"] : [],
7345
+ ...r.ctrl ? [Rc ? "⌘" : "Ctrl"] : [],
7341
7346
  ...r.alt ? ["Alt"] : [],
7342
7347
  ...r.shift ? ["Shift"] : [],
7343
7348
  r.key === " " ? "Space" : n.length === 1 ? n.toUpperCase() : n
7344
7349
  ], r;
7345
7350
  }
7346
- function Bc(e, t) {
7351
+ function Hc(e, t) {
7347
7352
  if ((e.ctrlKey || e.metaKey) !== t.ctrl || e.altKey !== t.alt) return !1;
7348
7353
  if (t.code !== void 0) {
7349
7354
  if (e.shiftKey !== t.shift) return !1;
@@ -7353,25 +7358,25 @@ function Bc(e, t) {
7353
7358
  }
7354
7359
  return t.shift && !e.shiftKey ? !1 : e.key.toLowerCase() === t.key;
7355
7360
  }
7356
- var Vc = new Set(/* @__PURE__ */ "escape(enter(delete(backspace(arrowleft(arrowright(arrowup(arrowdown(home(end(+(-(=( (,(.(ctrl+z(ctrl+shift+z(ctrl+y(ctrl+c(ctrl+v(ctrl+d(ctrl+g(ctrl+shift+g(ctrl+[(ctrl+]".split("("));
7357
- function Hc(e) {
7361
+ var Uc = new Set(/* @__PURE__ */ "escape(enter(delete(backspace(arrowleft(arrowright(arrowup(arrowdown(home(end(+(-(=( (,(.(ctrl+z(ctrl+shift+z(ctrl+y(ctrl+c(ctrl+v(ctrl+d(ctrl+g(ctrl+shift+g(ctrl+[(ctrl+]".split("("));
7362
+ function Wc(e) {
7358
7363
  let t = `${e.ctrl ? "ctrl+" : ""}${e.alt ? "alt+" : ""}${e.shift ? "shift+" : ""}${e.char ?? e.key}`;
7359
- return Vc.has(t);
7364
+ return Uc.has(t);
7360
7365
  }
7361
- function Uc(e) {
7366
+ function Gc(e) {
7362
7367
  let t = typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
7363
7368
  return t instanceof HTMLElement ? t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) : !1;
7364
7369
  }
7365
7370
  //#endregion
7366
7371
  //#region src/widget/WidgetCompares.ts
7367
- var Wc = [
7372
+ var Kc = [
7368
7373
  "#b552c9",
7369
7374
  "#1398a8",
7370
7375
  "#d4622b",
7371
7376
  "#e25592",
7372
7377
  "#6f7a8c",
7373
7378
  "#3e9a4f"
7374
- ], Gc = class {
7379
+ ], qc = class {
7375
7380
  constructor(e) {
7376
7381
  this.host = e;
7377
7382
  }
@@ -7393,11 +7398,11 @@ var Wc = [
7393
7398
  symbols: this.host.symbolEntries(),
7394
7399
  current: this.host.state.symbol,
7395
7400
  search: this.host.symbolSearchFn(),
7396
- ways: qs(this.host.t),
7401
+ ways: Ys(this.host.t),
7397
7402
  way: this.compareWay,
7398
7403
  compared: this.comparedNow(),
7399
7404
  onAdd: (e, t) => {
7400
- Ks(t) && (this.compareWay = t, this.addCompareSymbol(e, t));
7405
+ Js(t) && (this.compareWay = t, this.addCompareSymbol(e, t));
7401
7406
  },
7402
7407
  onRemove: (e) => this.removeCompared(e)
7403
7408
  }));
@@ -7405,7 +7410,7 @@ var Wc = [
7405
7410
  }
7406
7411
  comparedNow() {
7407
7412
  let e = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds));
7408
- return Zs(this.compares, this.host.chart.getActiveIndicators(), e, this.host.t);
7413
+ return $s(this.compares, this.host.chart.getActiveIndicators(), e, this.host.t);
7409
7414
  }
7410
7415
  refreshCompareDialog() {
7411
7416
  this.host.symbolSearch?.isComparing() && this.host.symbolSearch.setCompared(this.comparedNow());
@@ -7425,7 +7430,7 @@ var Wc = [
7425
7430
  try {
7426
7431
  let t = await this.fetchCompareBars(this.host.adapter, e);
7427
7432
  if (!t || this.compares.some((t) => t.symbol === e)) return;
7428
- let r = this.host.state.timeframe, i = Wc[this.compares.length % Wc.length];
7433
+ let r = this.host.state.timeframe, i = Kc[this.compares.length % Kc.length];
7429
7434
  this.compares.length === 0 && this.host.chart.setCompareMode("percent"), this.host.chart.addCompareSymbol(n, O(e), t, i), this.compares = [...this.compares, {
7430
7435
  id: n,
7431
7436
  symbol: e,
@@ -7553,7 +7558,7 @@ var Wc = [
7553
7558
  }
7554
7559
  let i = r.bars[0]?.time;
7555
7560
  if (i === void 0 || r.atStart) continue;
7556
- let a = Js(this.host.chart.getData(), i);
7561
+ let a = Xs(this.host.chart.getData(), i);
7557
7562
  if (a !== 0) try {
7558
7563
  if (e.fetchHistoryBefore) {
7559
7564
  let o = await e.fetchHistoryBefore(r.symbol, n, i, a);
@@ -7576,7 +7581,7 @@ var Wc = [
7576
7581
  prependCompareBars(e, t, n) {
7577
7582
  let r = this.compares.find((t) => t.id === e);
7578
7583
  if (!r) return;
7579
- let i = Ys(r.bars, t);
7584
+ let i = Zs(r.bars, t);
7580
7585
  i ? this.setCompareBars(e, i, n) : this.compares = this.compares.map((t) => t.id === e ? {
7581
7586
  ...t,
7582
7587
  atStart: !0
@@ -7597,7 +7602,7 @@ var Wc = [
7597
7602
  failedAt: t
7598
7603
  } : n);
7599
7604
  }
7600
- }, Kc = class {
7605
+ }, Jc = class {
7601
7606
  constructor(e) {
7602
7607
  this.host = e;
7603
7608
  }
@@ -7742,7 +7747,7 @@ var Wc = [
7742
7747
  sparkline: r.slice()
7743
7748
  });
7744
7749
  }
7745
- }, qc = class {
7750
+ }, Yc = class {
7746
7751
  constructor(e) {
7747
7752
  this.host = e;
7748
7753
  }
@@ -7805,10 +7810,10 @@ var Wc = [
7805
7810
  if (e === "price") return t.length > 0 ? this.host.chart.roundPrice(t[t.length - 1].close) : null;
7806
7811
  let n = e.indexOf(":");
7807
7812
  if (n < 0 || t.length === 0) return null;
7808
- let r = e.slice(0, n), i = e.slice(n + 1), a = mc(this.host.chart.getIndicatorOutput(r)?.series, null)?.[i];
7813
+ let r = e.slice(0, n), i = e.slice(n + 1), a = gc(this.host.chart.getIndicatorOutput(r)?.series, null)?.[i];
7809
7814
  return typeof a == "number" && Number.isFinite(a) ? a : null;
7810
7815
  }
7811
- }, Jc = class {
7816
+ }, Xc = class {
7812
7817
  constructor(e) {
7813
7818
  this.host = e;
7814
7819
  }
@@ -7885,7 +7890,7 @@ var Wc = [
7885
7890
  };
7886
7891
  //#endregion
7887
7892
  //#region src/widget/drawingMenu.ts
7888
- function Yc(e, t) {
7893
+ function Zc(e, t) {
7889
7894
  let { selected: n } = e, r = n.length === 1, i = new Set(n.map((e) => e.groupId)), a = i.size === 1 && !i.has(null), o = [];
7890
7895
  e.canConfigure && r && o.push({
7891
7896
  id: "settings",
@@ -7942,7 +7947,7 @@ function Yc(e, t) {
7942
7947
  }
7943
7948
  //#endregion
7944
7949
  //#region src/widget/WidgetMenus.ts
7945
- var Xc = class {
7950
+ var Qc = class {
7946
7951
  constructor(e) {
7947
7952
  this.host = e;
7948
7953
  }
@@ -7961,7 +7966,7 @@ var Xc = class {
7961
7966
  }] : [];
7962
7967
  });
7963
7968
  if (i.length === 0) return;
7964
- let a = ce(Yc({
7969
+ let a = ce(Zc({
7965
7970
  selected: i,
7966
7971
  canConfigure: !0,
7967
7972
  canAlert: this.host.chart.canAddDrawingAlert(e)
@@ -7969,11 +7974,11 @@ var Xc = class {
7969
7974
  id: e,
7970
7975
  type: s.type,
7971
7976
  selected: o
7972
- }) ?? [] : [], l = Pc(a, c);
7977
+ }) ?? [] : [], l = Ic(a, c);
7973
7978
  if (l.length === 0) return;
7974
7979
  let u = this.host.chartContainer.getBoundingClientRect(), d = this.host.root.getBoundingClientRect();
7975
7980
  this.drawingMenu.open(l, u.left - d.left + t, u.top - d.top + n, (t) => {
7976
- Fc(t, c) || this.runDrawingMenuAction(e, o, t);
7981
+ Lc(t, c) || this.runDrawingMenuAction(e, o, t);
7977
7982
  });
7978
7983
  }
7979
7984
  runDrawingMenuAction(e, t, n) {
@@ -8050,7 +8055,7 @@ var Xc = class {
8050
8055
  current: r.timezone,
8051
8056
  options: this.timezoneChoices()
8052
8057
  },
8053
- keys: Object.fromEntries(No.filter((e) => this.host.featureState.hotkeys && this.host.featureState[e.feature]).map((e) => [e.action, e.keys]))
8058
+ keys: Object.fromEntries(Fo.filter((e) => this.host.featureState.hotkeys && this.host.featureState[e.feature]).map((e) => [e.action, e.keys]))
8054
8059
  };
8055
8060
  }
8056
8061
  removableIndicators() {
@@ -8071,15 +8076,15 @@ var Xc = class {
8071
8076
  }
8072
8077
  openChartMenu(e, t, n, r) {
8073
8078
  if (!this.chartMenu) return;
8074
- let i = this.host.options.chartMenuItems?.(r) ?? [], a = Pc(e, i);
8079
+ let i = this.host.options.chartMenuItems?.(r) ?? [], a = Ic(e, i);
8075
8080
  if (a.length === 0) return;
8076
8081
  let o = this.host.chartContainer.getBoundingClientRect(), s = this.host.root.getBoundingClientRect();
8077
8082
  this.chartMenu.open(a, o.left - s.left + t, o.top - s.top + n, (e) => {
8078
- Fc(e, i) || (e.startsWith("tz:") ? this.host.changeSettings({ timezone: e.slice(3) }) : this.runChartMenuAction(e, r));
8083
+ Lc(e, i) || (e.startsWith("tz:") ? this.host.changeSettings({ timezone: e.slice(3) }) : this.runChartMenuAction(e, r));
8079
8084
  });
8080
8085
  }
8081
8086
  runChartMenuAction(e, t) {
8082
- let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a = Po(e);
8087
+ let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a = Io(e);
8083
8088
  if (a) {
8084
8089
  this.host.changeSettings({ scaleMode: a });
8085
8090
  return;
@@ -8200,46 +8205,46 @@ var Xc = class {
8200
8205
  activeTool: null
8201
8206
  }, this.host.updateUI(), this.host.refreshDrawingsState(), this.host.refreshObjects();
8202
8207
  }
8203
- }, Zc = 2, Qc = 2;
8204
- function $c(e, t = "en-US") {
8205
- return $e(e, Math.max(Zc, Mt(e)), t);
8208
+ }, $c = 2, el = 2;
8209
+ function tl(e, t = "en-US") {
8210
+ return $e(e, Math.max($c, Mt(e)), t);
8206
8211
  }
8207
- function el(e, t = "en-US") {
8208
- return `${Go($e(Math.abs(e), Qc, t), e, $e(0, Qc, t))}%`;
8212
+ function nl(e, t = "en-US") {
8213
+ return `${qo($e(Math.abs(e), el, t), e, $e(0, el, t))}%`;
8209
8214
  }
8210
- function tl(e, t = "en-US", n = !0) {
8215
+ function rl(e, t = "en-US", n = !0) {
8211
8216
  return e.map((e) => ({
8212
8217
  instanceId: e.id,
8213
8218
  kind: "compare",
8214
8219
  label: e.label,
8215
8220
  swatch: e.color,
8216
8221
  visible: e.visible,
8217
- ...n ? { values: nl(e, t) } : {
8222
+ ...n ? { values: il(e, t) } : {
8218
8223
  values: [],
8219
8224
  offChartType: !0
8220
8225
  },
8221
8226
  pane: null
8222
8227
  }));
8223
8228
  }
8224
- function nl(e, t) {
8229
+ function il(e, t) {
8225
8230
  return [...e.close === null ? [] : [{
8226
- text: $c(e.close, t),
8231
+ text: tl(e.close, t),
8227
8232
  color: null
8228
8233
  }], ...e.change === null ? [] : [{
8229
- text: el(e.change, t),
8234
+ text: nl(e.change, t),
8230
8235
  color: null
8231
8236
  }]];
8232
8237
  }
8233
8238
  //#endregion
8234
8239
  //#region src/widget/WidgetLegendView.ts
8235
- var rl = 7, il = 17, al = 3, ol = 4;
8236
- function sl(e) {
8237
- return Ge[e.getDensity?.() ?? "comfortable"].legendInset - ol;
8240
+ var al = 7, ol = 17, sl = 3, cl = 4;
8241
+ function ll(e) {
8242
+ return Ge[e.getDensity?.() ?? "comfortable"].legendInset - cl;
8238
8243
  }
8239
- function cl(e) {
8244
+ function ul(e) {
8240
8245
  return !kt.has(e.id) && e.scale !== "left";
8241
8246
  }
8242
- var ll = class {
8247
+ var dl = class {
8243
8248
  constructor(e) {
8244
8249
  this.host = e;
8245
8250
  }
@@ -8252,13 +8257,13 @@ var ll = class {
8252
8257
  }
8253
8258
  renderLegend() {
8254
8259
  if (!this.host.indicatorLegend || this.host.destroyed) return;
8255
- let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r = sl(this.host.chart), i = n === null ? e : Math.min(Math.max(n, 0), e), a = /* @__PURE__ */ new Map();
8260
+ let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r = ll(this.host.chart), i = n === null ? e : Math.min(Math.max(n, 0), e), a = /* @__PURE__ */ new Map();
8256
8261
  for (let e of this.host.chart.getIndicatorPanes()) (e.instanceIds ?? [e.instanceId]).forEach((t, n) => a.set(t, {
8257
8262
  ...e.rect,
8258
8263
  row: n
8259
8264
  }));
8260
- let o = this.host.settingsState.numberLocale || "en-US", s = tl(i >= 0 ? this.host.chart.getCompareValues?.(n === null || !t ? void 0 : i) ?? [] : [], o, t), c = this.host.chart.getActiveIndicators().map((e) => {
8261
- let t = a.get(e.instanceId) ?? null, i = mc(this.host.chart.getIndicatorOutput(e.instanceId, { drawn: !0 })?.series, n), s = this.host.chart.getIndicatorStyle(e.instanceId), c = e.visible && e.offChartType === !0, l = e.visible && e.shown === !1 && !c, u = l || c ? [] : hc(e.descriptor, i, s?.colors ?? [], s?.plots);
8265
+ let o = this.host.settingsState.numberLocale || "en-US", s = rl(i >= 0 ? this.host.chart.getCompareValues?.(n === null || !t ? void 0 : i) ?? [] : [], o, t), c = this.host.chart.getActiveIndicators().map((e) => {
8266
+ let t = a.get(e.instanceId) ?? null, i = gc(this.host.chart.getIndicatorOutput(e.instanceId, { drawn: !0 })?.series, n), s = this.host.chart.getIndicatorStyle(e.instanceId), c = e.visible && e.offChartType === !0, l = e.visible && e.shown === !1 && !c, u = l || c ? [] : _c(e.descriptor, i, s?.colors ?? [], s?.plots);
8262
8267
  return {
8263
8268
  instanceId: e.instanceId,
8264
8269
  label: Ue(e, this.host.t),
@@ -8266,19 +8271,19 @@ var ll = class {
8266
8271
  offInterval: l,
8267
8272
  offChartType: c,
8268
8273
  values: u.map((n) => ({
8269
- text: this.host.indicatorValueText(n.value, t === null && cl(e), o),
8274
+ text: this.host.indicatorValueText(n.value, t === null && ul(e), o),
8270
8275
  color: n.color
8271
8276
  })),
8272
8277
  pane: t ? {
8273
8278
  x: t.x + r,
8274
- y: t.y + Math.min(rl + t.row * il, Math.max(rl, t.height - il)),
8279
+ y: t.y + Math.min(al + t.row * ol, Math.max(al, t.height - ol)),
8275
8280
  width: t.width - 2 * r
8276
8281
  } : null
8277
8282
  };
8278
8283
  }), l = [...s, ...c], u = this.host.chart.getPlotRect(), d = this.host.chart.getMaximizedPane(), f = (e) => l.find((t) => t.instanceId === e)?.label ?? "", p = this.host.chart.getIndicatorPanes().map((e) => ({
8279
8284
  instanceId: e.instanceId,
8280
8285
  x: e.rect.x + e.rect.width - r,
8281
- y: e.rect.y + al,
8286
+ y: e.rect.y + sl,
8282
8287
  label: f(e.instanceId),
8283
8288
  collapsed: this.host.chart.isPaneCollapsed(e.instanceId),
8284
8289
  maximized: d === e.instanceId,
@@ -8332,14 +8337,14 @@ var ll = class {
8332
8337
  let u = this.host.chart.getActiveIndicators().find((t) => t.instanceId === e)?.id ?? "", d = this.host.options.indicatorMenuItems?.({
8333
8338
  instanceId: e,
8334
8339
  indicatorId: u
8335
- }) ?? [], f = Pc(c, d);
8340
+ }) ?? [], f = Ic(c, d);
8336
8341
  if (f.length === 0) return;
8337
8342
  let p = t.getBoundingClientRect(), m = this.host.root.getBoundingClientRect();
8338
8343
  n.open(f, p.left - m.left, p.bottom - m.top + 2, (t) => {
8339
- Fc(t, d) || (t === "settings" ? this.host.openIndicatorSettings(e) : t === "remove" ? this.host.handleRemoveIndicator(e) : t.startsWith("move:") && this.host.chart.moveIndicatorToPane(e, t.slice(5)), this.scheduleLegend());
8344
+ Lc(t, d) || (t === "settings" ? this.host.openIndicatorSettings(e) : t === "remove" ? this.host.handleRemoveIndicator(e) : t.startsWith("move:") && this.host.chart.moveIndicatorToPane(e, t.slice(5)), this.scheduleLegend());
8340
8345
  }, t);
8341
8346
  }
8342
- }, ul = class {
8347
+ }, fl = class {
8343
8348
  constructor(e) {
8344
8349
  this.host = e;
8345
8350
  }
@@ -8544,7 +8549,7 @@ var ll = class {
8544
8549
  break;
8545
8550
  }
8546
8551
  }
8547
- }, dl = 0, fl = class {
8552
+ }, pl = 0, ml = class {
8548
8553
  backdrop;
8549
8554
  search;
8550
8555
  listEl;
@@ -8552,7 +8557,7 @@ var ll = class {
8552
8557
  confirming = null;
8553
8558
  returnFocus = null;
8554
8559
  loadSeq = 0;
8555
- uid = ++dl;
8560
+ uid = ++pl;
8556
8561
  constructor(e, t, n = T) {
8557
8562
  this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
8558
8563
  let r = !1;
@@ -8658,7 +8663,7 @@ var ll = class {
8658
8663
  this.confirming = null, await this.refresh(), this.isOpen() && this.search.focus();
8659
8664
  }
8660
8665
  }
8661
- }, pl = 5, ml = class {
8666
+ }, hl = 5, gl = class {
8662
8667
  menu;
8663
8668
  prompt;
8664
8669
  dialog;
@@ -8666,7 +8671,7 @@ var ll = class {
8666
8671
  constructor(e, t) {
8667
8672
  this.session = e, this.host = t;
8668
8673
  let { root: n, t: r } = t;
8669
- this.menu = new C(n, r("toolbar.layouts")), this.prompt = new Cs(n, r), this.dialog = new fl(n, {
8674
+ this.menu = new C(n, r("toolbar.layouts")), this.prompt = new Ts(n, r), this.dialog = new ml(n, {
8670
8675
  list: () => e.list(),
8671
8676
  currentId: () => e.current()?.id ?? null,
8672
8677
  onOpen: (e) => void this.open(e),
@@ -8744,7 +8749,7 @@ var ll = class {
8744
8749
  }
8745
8750
  let { session: t } = this, { t: n } = this.host, r = [];
8746
8751
  try {
8747
- r = (await t.list()).slice(0, pl);
8752
+ r = (await t.list()).slice(0, hl);
8748
8753
  } catch {}
8749
8754
  if (this.destroyed) return;
8750
8755
  let i = t.current(), a = [{
@@ -8780,53 +8785,53 @@ var ll = class {
8780
8785
  destroy() {
8781
8786
  this.destroyed = !0, this.menu.destroy(), this.prompt.destroy(), this.dialog.destroy();
8782
8787
  }
8783
- }, hl = (e) => typeof e == "object" && !!e && !Array.isArray(e), gl = globalThis.Buffer;
8784
- function _l(e) {
8785
- if (gl) return gl.from(e, "utf8").toString("base64");
8788
+ }, _l = (e) => typeof e == "object" && !!e && !Array.isArray(e), vl = globalThis.Buffer;
8789
+ function yl(e) {
8790
+ if (vl) return vl.from(e, "utf8").toString("base64");
8786
8791
  let t = new TextEncoder().encode(e), n = "";
8787
8792
  for (let e of t) n += String.fromCharCode(e);
8788
8793
  return btoa(n);
8789
8794
  }
8790
- function vl(e) {
8791
- if (gl) return gl.from(e, "base64").toString("utf8");
8795
+ function bl(e) {
8796
+ if (vl) return vl.from(e, "base64").toString("utf8");
8792
8797
  let t = atob(e), n = new Uint8Array(t.length);
8793
8798
  for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
8794
8799
  return new TextDecoder().decode(n);
8795
8800
  }
8796
- function yl(e) {
8801
+ function xl(e) {
8797
8802
  return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
8798
8803
  }
8799
- function bl(e) {
8804
+ function Sl(e) {
8800
8805
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
8801
8806
  return t + (t.length % 4 == 0 ? "" : "=".repeat(4 - t.length % 4));
8802
8807
  }
8803
- function xl(e) {
8804
- return yl(_l(JSON.stringify(e)));
8808
+ function Cl(e) {
8809
+ return xl(yl(JSON.stringify(e)));
8805
8810
  }
8806
- function Sl(e) {
8811
+ function wl(e) {
8807
8812
  if (!e) return null;
8808
8813
  try {
8809
- let t = vl(bl(e)), n = JSON.parse(t);
8814
+ let t = bl(Sl(e)), n = JSON.parse(t);
8810
8815
  return !n || n.v !== 1 || typeof n.symbol != "string" ? null : {
8811
8816
  v: 1,
8812
8817
  symbol: n.symbol,
8813
8818
  timeframe: n.timeframe,
8814
8819
  chartType: n.chartType,
8815
- scaleMode: Ds.find((e) => e === n.scaleMode) ?? "regular",
8820
+ scaleMode: ks.find((e) => e === n.scaleMode) ?? "regular",
8816
8821
  indicators: Array.isArray(n.indicators) ? n.indicators : [],
8817
8822
  drawings: Array.isArray(n.drawings) ? n.drawings : [],
8818
- ...hl(n.settings) ? { settings: W(n.settings, Fa) } : {}
8823
+ ..._l(n.settings) ? { settings: W(n.settings, Fa) } : {}
8819
8824
  };
8820
8825
  } catch {
8821
8826
  return null;
8822
8827
  }
8823
8828
  }
8824
- var Cl = "tcw";
8825
- function wl(e) {
8829
+ var Tl = "tcw";
8830
+ function El(e) {
8826
8831
  let t = e.startsWith("#") ? e.slice(1) : e;
8827
8832
  for (let e of t.split("&")) {
8828
8833
  let t = e.indexOf("=");
8829
- if (!(t <= 0 || e.slice(0, t) !== Cl)) try {
8834
+ if (!(t <= 0 || e.slice(0, t) !== Tl)) try {
8830
8835
  return decodeURIComponent(e.slice(t + 1));
8831
8836
  } catch {
8832
8837
  return null;
@@ -8834,19 +8839,19 @@ function wl(e) {
8834
8839
  }
8835
8840
  return null;
8836
8841
  }
8837
- function Tl(e, t) {
8842
+ function Dl(e, t) {
8838
8843
  let [n] = e.split("#");
8839
- return `${n}#${Cl}=${t}`;
8844
+ return `${n}#${Tl}=${t}`;
8840
8845
  }
8841
8846
  //#endregion
8842
8847
  //#region src/widget/WidgetLayouts.ts
8843
- var El = [
8848
+ var Ol = [
8844
8849
  "legendVisible",
8845
8850
  "volumeVisible",
8846
8851
  "barCountdown",
8847
8852
  "indicatorValueLabels",
8848
8853
  "alignAxisLabels"
8849
- ], Dl = class {
8854
+ ], kl = class {
8850
8855
  constructor(e) {
8851
8856
  this.host = e;
8852
8857
  }
@@ -8857,7 +8862,7 @@ var El = [
8857
8862
  activeLayoutKey = null;
8858
8863
  restoreSharedView() {
8859
8864
  if (!this.host.options.shareUrl || typeof location > "u") return;
8860
- let e = wl(location.hash);
8865
+ let e = El(location.hash);
8861
8866
  e && this.importState(e);
8862
8867
  }
8863
8868
  exportState() {
@@ -8866,9 +8871,9 @@ var El = [
8866
8871
  params: e.params
8867
8872
  })), t = this.host.getSettings(), n = Ya(t, {
8868
8873
  ..._,
8869
- ...Object.fromEntries(El.map((e) => [e, this.host.settingsDefaults[e]]))
8874
+ ...Object.fromEntries(Ol.map((e) => [e, this.host.settingsDefaults[e]]))
8870
8875
  });
8871
- return xl({
8876
+ return Cl({
8872
8877
  v: 1,
8873
8878
  symbol: this.host.state.symbol,
8874
8879
  timeframe: this.host.state.timeframe,
@@ -8880,7 +8885,7 @@ var El = [
8880
8885
  });
8881
8886
  }
8882
8887
  async importState(e) {
8883
- let t = Sl(e);
8888
+ let t = wl(e);
8884
8889
  if (!t) return !1;
8885
8890
  t.symbol && t.symbol !== this.host.state.symbol && await this.host.setSymbol(t.symbol), t.timeframe && t.timeframe !== this.host.state.timeframe && await this.host.setTimeframe(t.timeframe), t.chartType && this.host.applyChartType(t.chartType);
8886
8891
  let { chartTypeOptions: n, ...r } = this.host.allowedSettings({
@@ -8897,7 +8902,7 @@ var El = [
8897
8902
  }))), this.host.chart.setDrawings(t.drawings), this.host.updateUI(), !0;
8898
8903
  }
8899
8904
  async copyShareLink() {
8900
- let e = Tl(typeof location < "u" ? location.href : "", this.exportState());
8905
+ let e = Dl(typeof location < "u" ? location.href : "", this.exportState());
8901
8906
  try {
8902
8907
  await navigator.clipboard.writeText(e), this.host.say(this.host.t("toast.linkCopied"));
8903
8908
  } catch {
@@ -8908,7 +8913,7 @@ var El = [
8908
8913
  return this.layoutSession;
8909
8914
  }
8910
8915
  captureLayout() {
8911
- let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ? js(t) : null, r = n && typeof n == "object" ? ks(n) : null;
8916
+ let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ? Ns(t) : null, r = n && typeof n == "object" ? js(n) : null;
8912
8917
  return {
8913
8918
  v: 1,
8914
8919
  symbol: this.host.state.symbol,
@@ -8922,7 +8927,7 @@ var El = [
8922
8927
  async restoreLayout(e) {
8923
8928
  if (e.symbol !== this.host.state.symbol && await this.host.setSymbol(e.symbol), e.timeframe !== this.host.state.timeframe && await this.host.setTimeframe(e.timeframe), this.host.destroyed) return;
8924
8929
  if (e.chart) {
8925
- this.host.chart.loadState(JSON.stringify(ks(e.chart)));
8930
+ this.host.chart.loadState(JSON.stringify(js(e.chart)));
8926
8931
  let t = e.chart.chartType;
8927
8932
  typeof t == "string" && (this.host.state = {
8928
8933
  ...this.host.state,
@@ -8940,7 +8945,7 @@ var El = [
8940
8945
  return JSON.stringify(this.captureLayout());
8941
8946
  }
8942
8947
  async applyLayoutContent(e) {
8943
- let t = As(js(e));
8948
+ let t = Ms(Ns(e));
8944
8949
  return t ? (await this.restoreLayout(t), !0) : !1;
8945
8950
  }
8946
8951
  setupLayouts(e) {
@@ -8959,7 +8964,7 @@ var El = [
8959
8964
  onChange: () => this.host.toolbar?.setLayout(t.current()?.name ?? null, t.isDirty()),
8960
8965
  onError: () => this.host.say(this.host.t("layouts.saveFailed"), "error")
8961
8966
  });
8962
- this.layoutSession = t, this.layoutsUI = new ml(t, {
8967
+ this.layoutSession = t, this.layoutsUI = new gl(t, {
8963
8968
  root: this.host.root,
8964
8969
  t: this.host.t,
8965
8970
  saveKeys: () => this.host.keysShown("hotkeys.save", `${We}+S`),
@@ -9000,19 +9005,19 @@ var El = [
9000
9005
  this.host.chart.disableAutoSave(), this.activeLayoutKey = null;
9001
9006
  }
9002
9007
  }
9003
- }, Ol = {
9008
+ }, Al = {
9004
9009
  alerts: "alerts",
9005
9010
  objectTree: "objectTree",
9006
9011
  dataWindow: "dataWindow",
9007
9012
  symbolInfo: "symbolInfo",
9008
9013
  depthLadder: "depthLadder"
9009
- }, kl = {
9014
+ }, jl = {
9010
9015
  watchlist: "watchlist",
9011
9016
  alerts: "alerts",
9012
9017
  objectTree: "objects",
9013
9018
  symbolInfo: "symbolInfo",
9014
9019
  depthLadder: "trade"
9015
- }, Al = class {
9020
+ }, Ml = class {
9016
9021
  dataWindowFrame = 0;
9017
9022
  constructor(e) {
9018
9023
  this.host = e;
@@ -9029,7 +9034,7 @@ var El = [
9029
9034
  return !this.hasPanel(e) || !this.dock ? !1 : (this.dock.open(e), this.dock.current() === e);
9030
9035
  }
9031
9036
  hasPanel(e) {
9032
- return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[Ol[e]];
9037
+ return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[Al[e]];
9033
9038
  }
9034
9039
  closePanel() {
9035
9040
  this.dock?.close();
@@ -9062,7 +9067,7 @@ var El = [
9062
9067
  indicators: []
9063
9068
  };
9064
9069
  let { bar: n, prevClose: r } = t, i = n.close - r, a = r === 0 ? 0 : i / r * 100, o = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds ?? [e.instanceId])), s = this.host.settingsState.numberLocale || "en-US", c = this.host.chart.getActiveIndicators().map((t) => {
9065
- let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) && cl(t), i = t.descriptor.plots?.map((e) => [e.key, e.title]) ?? Object.keys(n ?? {}).map((e) => [e, e]), a = n ? i.filter(([e]) => typeof n[e] == "number" && Number.isFinite(n[e])).map(([e, t]) => {
9070
+ let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) && ul(t), i = t.descriptor.plots?.map((e) => [e.key, e.title]) ?? Object.keys(n ?? {}).map((e) => [e, e]), a = n ? i.filter(([e]) => typeof n[e] == "number" && Number.isFinite(n[e])).map(([e, t]) => {
9066
9071
  let i = n[e];
9067
9072
  return {
9068
9073
  key: t,
@@ -9191,7 +9196,7 @@ var El = [
9191
9196
  this.host.toolbar?.setRailed("watchlist", e && this.host.featureState["dock.watchlist"]), this.host.toolbar?.setRailed("alerts", e && this.host.featureState["dock.alerts"]), this.host.toolbar?.setRailed("objects", e && this.host.featureState["dock.objectTree"]), this.host.toolbar?.fit();
9192
9197
  }
9193
9198
  panelFocusTarget(e) {
9194
- let t = kl[e], n = t ? this.host.root.querySelector(`.tcw-toolbar [data-role="${t}"]`) : null, r = this.host.root.hasAttribute("data-tcw-narrow");
9199
+ let t = jl[e], n = t ? this.host.root.querySelector(`.tcw-toolbar [data-role="${t}"]`) : null, r = this.host.root.hasAttribute("data-tcw-narrow");
9195
9200
  return n && !n.hidden && !(r && n.classList.contains("tcw-toolbar-overflow")) ? n : this.host.root.querySelector(".tcw-toolbar-more") ?? this.host.chartContainer;
9196
9201
  }
9197
9202
  closePanelByHand(e) {
@@ -9219,29 +9224,29 @@ var El = [
9219
9224
  }));
9220
9225
  this.host.objectTree.setObjects(e, t, n);
9221
9226
  }
9222
- }, jl = new Set([
9227
+ }, Nl = new Set([
9223
9228
  "timezone",
9224
9229
  "numberLocale",
9225
9230
  "chartTypeOptions",
9226
9231
  "logScale",
9227
9232
  "autoScale"
9228
- ]), Ml = 80, Nl = (e) => typeof e == "object" && !!e && !Array.isArray(e);
9229
- function Pl(e) {
9230
- return W(e, jl);
9233
+ ]), Pl = 80, Fl = (e) => typeof e == "object" && !!e && !Array.isArray(e);
9234
+ function Il(e) {
9235
+ return W(e, Nl);
9231
9236
  }
9232
- function Fl(e) {
9237
+ function Ll(e) {
9233
9238
  let { overrides: t } = lt(e);
9234
9239
  return Object.fromEntries(Object.entries(t).filter(([e, t]) => t !== null && v.includes(e)));
9235
9240
  }
9236
- function Il() {
9241
+ function Rl() {
9237
9242
  try {
9238
9243
  return typeof localStorage < "u" ? localStorage : null;
9239
9244
  } catch {
9240
9245
  return null;
9241
9246
  }
9242
9247
  }
9243
- var Ll = class {
9244
- constructor(e = "tcw:chart-templates", t = Il()) {
9248
+ var zl = class {
9249
+ constructor(e = "tcw:chart-templates", t = Rl()) {
9245
9250
  this.key = e, this.storage = t;
9246
9251
  }
9247
9252
  list() {
@@ -9253,10 +9258,10 @@ var Ll = class {
9253
9258
  }
9254
9259
  if (!Array.isArray(e)) return [];
9255
9260
  let t = [];
9256
- for (let n of e) !Nl(n) || typeof n.name != "string" || !n.name.trim() || t.push({
9257
- name: n.name.slice(0, Ml).trim(),
9258
- settings: Pl(n.settings),
9259
- style: Fl(n.style)
9261
+ for (let n of e) !Fl(n) || typeof n.name != "string" || !n.name.trim() || t.push({
9262
+ name: n.name.slice(0, Pl).trim(),
9263
+ settings: Il(n.settings),
9264
+ style: Ll(n.style)
9260
9265
  });
9261
9266
  return t.sort((e, t) => e.name.localeCompare(t.name));
9262
9267
  }
@@ -9264,12 +9269,12 @@ var Ll = class {
9264
9269
  return this.list().find((t) => t.name === e) ?? null;
9265
9270
  }
9266
9271
  save(e, t, n) {
9267
- let r = e.replace(/\s+/g, " ").slice(0, Ml).trim();
9272
+ let r = e.replace(/\s+/g, " ").slice(0, Pl).trim();
9268
9273
  if (!r || !this.storage) return !1;
9269
9274
  let i = [...this.list().filter((e) => e.name !== r), {
9270
9275
  name: r,
9271
- settings: Pl(t),
9272
- style: Fl(n)
9276
+ settings: Il(t),
9277
+ style: Ll(n)
9273
9278
  }];
9274
9279
  try {
9275
9280
  return this.storage.setItem(this.key, JSON.stringify(i)), !0;
@@ -9282,11 +9287,11 @@ var Ll = class {
9282
9287
  this.storage?.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
9283
9288
  } catch {}
9284
9289
  }
9285
- }, Rl = new Set([...Ma, "autoScale"]), zl = class {
9290
+ }, Bl = new Set([...Ma, "autoScale"]), Vl = class {
9286
9291
  constructor(e) {
9287
9292
  this.host = e;
9288
9293
  }
9289
- chartTemplates = new Ll();
9294
+ chartTemplates = new zl();
9290
9295
  chartTemplatePrompt = null;
9291
9296
  settingsEdit = null;
9292
9297
  state = Qn(_);
@@ -9406,7 +9411,7 @@ var Ll = class {
9406
9411
  this.touchSettings(Object.keys(n), v), this.applySettings(n), this.host.chart.resetOverrides([...v], { layer: "user" }), this.host.chart.applyOverrides(t.style, { layer: "user" }), this.host.settings?.refresh(this.shownSettings()), this.host.say(w(this.host.t("templates.applied"), { name: e }));
9407
9412
  }
9408
9413
  promptSaveChartTemplate() {
9409
- this.chartTemplatePrompt ??= new Cs(this.host.overlayHost(), this.host.t), this.chartTemplatePrompt.open({
9414
+ this.chartTemplatePrompt ??= new Ts(this.host.overlayHost(), this.host.t), this.chartTemplatePrompt.open({
9410
9415
  title: this.host.t("settings.saveTemplateTitle"),
9411
9416
  submitLabel: this.host.t("common.save"),
9412
9417
  placeholder: this.host.t("settings.templatePlaceholder"),
@@ -9516,7 +9521,7 @@ var Ll = class {
9516
9521
  this.settingsState = {
9517
9522
  ...this.settingsState,
9518
9523
  ...e
9519
- }, Object.keys(e).some((e) => !Rl.has(e)) && this.host.layouts.layoutSession?.changed(), this.host.legend.scheduleLegend(), e.gridVisible !== void 0 && this.host.chart.setGridVisible(e.gridVisible), e.volumeVisible !== void 0 && this.host.chart.setVolumeVisible(e.volumeVisible), e.volumeProfileVisible !== void 0 && this.host.chart.setVolumeProfileVisible(e.volumeProfileVisible), e.marketProfileVisible !== void 0 && this.host.chart.setMarketProfileVisible(e.marketProfileVisible), e.marketProfileSplit !== void 0 && this.host.chart.setMarketProfileConfig({ splitBySession: e.marketProfileSplit }), e.marketProfileLetters !== void 0 && this.host.chart.setMarketProfileConfig({ letters: e.marketProfileLetters }), e.marketProfileBuckets !== void 0 && this.host.chart.setMarketProfileConfig({ buckets: e.marketProfileBuckets }), e.marketProfileOpacity !== void 0 && this.host.chart.setMarketProfileConfig({ opacity: e.marketProfileOpacity }), e.depthHeatmapVisible !== void 0 && this.host.chart.setDepthHeatmapVisible(e.depthHeatmapVisible), e.depthHeatmapOpacity !== void 0 && this.host.chart.setDepthHeatmapConfig({ opacity: e.depthHeatmapOpacity }), e.sessionShadingVisible !== void 0 && this.host.chart.setSessionShadingVisible(e.sessionShadingVisible), e.pivotMarkersVisible !== void 0 && this.host.chart.setPivotMarkersVisible(e.pivotMarkersVisible), e.pivotStrength !== void 0 && this.host.chart.setPivotMarkersConfig({
9524
+ }, Object.keys(e).some((e) => !Bl.has(e)) && this.host.layouts.layoutSession?.changed(), this.host.legend.scheduleLegend(), e.gridVisible !== void 0 && this.host.chart.setGridVisible(e.gridVisible), e.volumeVisible !== void 0 && this.host.chart.setVolumeVisible(e.volumeVisible), e.volumeProfileVisible !== void 0 && this.host.chart.setVolumeProfileVisible(e.volumeProfileVisible), e.marketProfileVisible !== void 0 && this.host.chart.setMarketProfileVisible(e.marketProfileVisible), e.marketProfileSplit !== void 0 && this.host.chart.setMarketProfileConfig({ splitBySession: e.marketProfileSplit }), e.marketProfileLetters !== void 0 && this.host.chart.setMarketProfileConfig({ letters: e.marketProfileLetters }), e.marketProfileBuckets !== void 0 && this.host.chart.setMarketProfileConfig({ buckets: e.marketProfileBuckets }), e.marketProfileOpacity !== void 0 && this.host.chart.setMarketProfileConfig({ opacity: e.marketProfileOpacity }), e.depthHeatmapVisible !== void 0 && this.host.chart.setDepthHeatmapVisible(e.depthHeatmapVisible), e.depthHeatmapOpacity !== void 0 && this.host.chart.setDepthHeatmapConfig({ opacity: e.depthHeatmapOpacity }), e.sessionShadingVisible !== void 0 && this.host.chart.setSessionShadingVisible(e.sessionShadingVisible), e.pivotMarkersVisible !== void 0 && this.host.chart.setPivotMarkersVisible(e.pivotMarkersVisible), e.pivotStrength !== void 0 && this.host.chart.setPivotMarkersConfig({
9520
9525
  left: e.pivotStrength,
9521
9526
  right: e.pivotStrength
9522
9527
  }), e.pivotStructureLabels !== void 0 && this.host.chart.setPivotMarkersConfig({ structureLabels: e.pivotStructureLabels }), e.periodLevelsVisible !== void 0 && this.host.chart.setPeriodLevelsVisible(e.periodLevelsVisible), e.periodLevelsPeriod !== void 0 && this.host.chart.setPeriodLevelsPeriod(e.periodLevelsPeriod), e.legendVisible !== void 0 && this.host.chart.setLegend({ visible: e.legendVisible }), e.barCountdown !== void 0 && this.host.chart.setBarCountdownVisible(e.barCountdown), e.indicatorValueLabels !== void 0 && this.host.chart.setIndicatorValueLabelsVisible(e.indicatorValueLabels), e.alignAxisLabels !== void 0 && this.host.chart.setAxisLabelsAligned(e.alignAxisLabels), e.crosshairMode !== void 0 && this.host.chart.setCrosshairMode(e.crosshairMode), e.crosshairCursor !== void 0 && this.host.chart.setCrosshairCursor(e.crosshairCursor), e.autoScale !== void 0 && this.host.chart.setAutoScale(e.autoScale), e.invertScale !== void 0 && this.host.chart.setInvertScale(e.invertScale), e.leftPriceScale !== void 0 && (this.host.chart.setLeftPriceScaleVisible(e.leftPriceScale), this.host.placeDrawingButton()), (e.scaleMode !== void 0 || e.autoScale !== void 0) && queueMicrotask(() => this.refreshScaleSwitches()), e.timezone !== void 0 && queueMicrotask(() => this.host.statusBar?.tick()), e.scaleMode === void 0 ? e.logScale !== void 0 && (this.settingsState = {
@@ -9578,8 +9583,8 @@ var Ll = class {
9578
9583
  restoreSettings(e, t = null, n) {
9579
9584
  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());
9580
9585
  }
9581
- }, Bl = 13;
9582
- function Vl(e) {
9586
+ }, Hl = 13;
9587
+ function Ul(e) {
9583
9588
  let t = e.filter((e) => e !== null);
9584
9589
  if (t.length === 0) return null;
9585
9590
  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));
@@ -9590,7 +9595,7 @@ function Vl(e) {
9590
9595
  height: a - r
9591
9596
  };
9592
9597
  }
9593
- var Hl = class {
9598
+ var Wl = class {
9594
9599
  constructor(e) {
9595
9600
  this.host = e;
9596
9601
  }
@@ -9621,7 +9626,7 @@ var Hl = class {
9621
9626
  e.hide();
9622
9627
  return;
9623
9628
  }
9624
- 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 = Vl(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
9629
+ 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 = Ul(r.flatMap((e) => [this.host.chart.getDrawingRect(e.id), this.host.chart.getDrawingTextRect?.(e.id) ?? null])) ?? {
9625
9630
  x: o.x + o.width / 2,
9626
9631
  y: o.y,
9627
9632
  width: 0,
@@ -9670,13 +9675,14 @@ var Hl = class {
9670
9675
  },
9671
9676
  text: o,
9672
9677
  font: {
9673
- size: a.fontSize || i?.fontSize || Bl,
9678
+ size: a.fontSize || i?.fontSize || Hl,
9674
9679
  bold: a.bold === !0,
9675
9680
  italic: a.italic === !0,
9676
9681
  family: this.host.chart.getFont?.()?.family ?? this.host.ui.font.family
9677
9682
  },
9678
9683
  color: a.textColor ?? So[n.type] ?? a.color,
9679
9684
  label: this.host.t("drawingSettings.text"),
9685
+ placeholder: this.host.drawingToolName(n.type),
9680
9686
  onInput: (n) => t ? this.host.chart.amendNewDrawing(e, { style: { text: n } }) : this.host.chart.updateDrawing(e, { style: { text: n } }),
9681
9687
  onCommit: (n) => {
9682
9688
  let r = n.replace(/\s+$/, "");
@@ -9709,7 +9715,7 @@ var Hl = class {
9709
9715
  }, { tab: n.tab }), n.justDrawn && e.isOpen() && (this.justDrawnText = t));
9710
9716
  }
9711
9717
  promptSaveDrawingTemplate(e, t) {
9712
- this.drawingTemplatePrompt ??= new Cs(this.host.root, this.host.t), this.drawingTemplatePrompt.open({
9718
+ this.drawingTemplatePrompt ??= new Ts(this.host.root, this.host.t), this.drawingTemplatePrompt.open({
9713
9719
  title: this.host.t("drawingSettings.saveTemplateTitle"),
9714
9720
  submitLabel: this.host.t("common.save"),
9715
9721
  placeholder: this.host.drawingToolName(t.type),
@@ -9721,7 +9727,7 @@ var Hl = class {
9721
9727
  }
9722
9728
  });
9723
9729
  }
9724
- }, Ul = 200, Wl = class {
9730
+ }, Gl = 200, Kl = class {
9725
9731
  constructor(e) {
9726
9732
  this.host = e;
9727
9733
  }
@@ -9750,7 +9756,7 @@ var Hl = class {
9750
9756
  for (; o > 0 && n[o - 1].time * r >= a;) o--;
9751
9757
  let s = this.host.displayTimezone();
9752
9758
  return En({
9753
- dayShare: n.slice(-Ul).some((e) => {
9759
+ dayShare: n.slice(-Gl).some((e) => {
9754
9760
  let t = e.time * r, n = new Date(t + at(s, t) * 6e4).getUTCDay();
9755
9761
  return n === 0 || n === 6;
9756
9762
  }) ? 1 : 5 / 7,
@@ -9795,7 +9801,7 @@ var Hl = class {
9795
9801
  handleToggleTimeframeFavorite(e) {
9796
9802
  this.host.timeframeFavorites.toggle(e), this.host.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()), this.host.updateUI();
9797
9803
  }
9798
- }, Gl = 600, Kl = 24, ql = [
9804
+ }, ql = 600, Jl = 24, Yl = [
9799
9805
  "--tcw-toolbar-h",
9800
9806
  "--tcw-control-h",
9801
9807
  "--tcw-control-h-sm",
@@ -9813,33 +9819,33 @@ var Hl = class {
9813
9819
  "--tcw-line-height",
9814
9820
  "--tcw-line-xs",
9815
9821
  "--tcw-label-size"
9816
- ], Jl = 48, Yl = 5e4, Xl = 100;
9817
- function Zl() {
9822
+ ], Xl = 48, Zl = 5e4, Ql = 100;
9823
+ function $l() {
9818
9824
  return new Promise((e) => {
9819
9825
  if (typeof requestAnimationFrame != "function" || document.hidden) {
9820
9826
  setTimeout(e, 0);
9821
9827
  return;
9822
9828
  }
9823
- let t = setTimeout(e, Xl);
9829
+ let t = setTimeout(e, Ql);
9824
9830
  requestAnimationFrame(() => setTimeout(() => {
9825
9831
  clearTimeout(t), e();
9826
9832
  }, 0));
9827
9833
  });
9828
9834
  }
9829
- var Ql = 864e5, $l = 5e3, eu = 2e3, tu = 48, nu = "rgba(255,255,255,0.03)", ru = "rgba(0,0,0,0.03)", iu = 2;
9830
- function au(e) {
9835
+ var eu = 864e5, tu = 5e3, nu = 2e3, ru = 48, iu = "rgba(255,255,255,0.03)", au = "rgba(0,0,0,0.03)", ou = 2;
9836
+ function su(e) {
9831
9837
  if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph")) return null;
9832
9838
  if (/^[a-z]$/i.test(e.key)) return e.key;
9833
9839
  let t = /^Key([A-Z])$/.exec(e.code ?? "");
9834
9840
  return t && [...e.key].length === 1 && !/[\s\d]/.test(e.key) ? t[1].toLowerCase() : null;
9835
9841
  }
9836
- var ou = 1e3, su = [
9842
+ var cu = 1e3, lu = [
9837
9843
  ["barCountdown", "barCountdown"],
9838
9844
  ["logScale", "logScale"],
9839
9845
  ["legendVisible", "legend"],
9840
9846
  ["volumeVisible", "volume"]
9841
- ], cu = v.filter((e) => Ke[e] !== "color");
9842
- function lu(e) {
9847
+ ], uu = v.filter((e) => Ke[e] !== "color");
9848
+ function du(e) {
9843
9849
  if (!e.feed) return e;
9844
9850
  if (e.adapter) throw TypeError("A widget takes an adapter or a feed, not both");
9845
9851
  return {
@@ -9848,19 +9854,19 @@ function lu(e) {
9848
9854
  feed: void 0
9849
9855
  };
9850
9856
  }
9851
- var uu = class {
9852
- intervals = new Wl(this.intervalsHost());
9853
- drawingEdit = new Hl(this.drawingEditHost());
9854
- chartSettings = new zl(this.chartSettingsHost());
9855
- docking = new Al(this.dockingHost());
9856
- layouts = new Dl(this.layoutsHost());
9857
- commands = new ul(this.commandsHost());
9858
- legend = new ll(this.legendHost());
9859
- menus = new Xc(this.menusHost());
9860
- trading = new Jc(this.tradingHost());
9861
- alerting = new qc(this.alertingHost());
9862
- watching = new Kc(this.watchingHost());
9863
- comparing = new Gc(this.comparingHost());
9857
+ var fu = class {
9858
+ intervals = new Kl(this.intervalsHost());
9859
+ drawingEdit = new Wl(this.drawingEditHost());
9860
+ chartSettings = new Vl(this.chartSettingsHost());
9861
+ docking = new Ml(this.dockingHost());
9862
+ layouts = new kl(this.layoutsHost());
9863
+ commands = new fl(this.commandsHost());
9864
+ legend = new dl(this.legendHost());
9865
+ menus = new Qc(this.menusHost());
9866
+ trading = new Xc(this.tradingHost());
9867
+ alerting = new Yc(this.alertingHost());
9868
+ watching = new Jc(this.watchingHost());
9869
+ comparing = new qc(this.comparingHost());
9864
9870
  chart;
9865
9871
  state;
9866
9872
  themeOf = {
@@ -9929,7 +9935,7 @@ var uu = class {
9929
9935
  uiVariables = !1;
9930
9936
  chartFontBase = null;
9931
9937
  scaleObserver = null;
9932
- templates = new Es();
9938
+ templates = new Os();
9933
9939
  templatePrompt = null;
9934
9940
  markerTip = null;
9935
9941
  dataWindow = null;
@@ -9938,11 +9944,11 @@ var uu = class {
9938
9944
  lastHoverPrevClose = null;
9939
9945
  legendHoverIndex = null;
9940
9946
  pointerOnChart = !1;
9941
- favoritesStore = new Ns();
9942
- indicatorFavorites = new Ns("tcw:indicator-favorites");
9947
+ favoritesStore = new Fs();
9948
+ indicatorFavorites = new Fs("tcw:indicator-favorites");
9943
9949
  indicatorDefaults = new ka();
9944
- timeframeFavorites = new Ns("tcw:tf-favorites");
9945
- customTimeframes = new Ns("tcw:tf-custom");
9950
+ timeframeFavorites = new Fs("tcw:tf-favorites");
9951
+ customTimeframes = new Fs("tcw:tf-custom");
9946
9952
  timeframes = [];
9947
9953
  sessionRefPrice = null;
9948
9954
  symbolInfoPanel = null;
@@ -9981,7 +9987,7 @@ var uu = class {
9981
9987
  hostLayer = null;
9982
9988
  priceAxisAddDefault = !1;
9983
9989
  constructor(e, t = {}) {
9984
- let n = lu(t);
9990
+ let n = du(t);
9985
9991
  this.options = n;
9986
9992
  let { isDark: r, resolvedTheme: i, features: a, chartFeatures: o } = this.readOptions(n);
9987
9993
  this.buildRoot(e, n, r, i), this.buildToolbar(n, a);
@@ -10042,7 +10048,7 @@ var uu = class {
10042
10048
  ...o,
10043
10049
  priceAxisAddButton: this.priceAxisAddDefault && this.featureState["menu.priceAxisAdd"]
10044
10050
  };
10045
- if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(su.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
10051
+ if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(lu.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
10046
10052
  ...this.chartSettings.settingsState,
10047
10053
  legendVisible: o.legend !== !1,
10048
10054
  volumeVisible: o.volume !== !1,
@@ -10077,8 +10083,8 @@ var uu = class {
10077
10083
  }
10078
10084
  buildRoot(e, t, n, r) {
10079
10085
  on(), this.root = document.createElement("div"), this.root.className = "tcw-root";
10080
- let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : yu(t.locale) ? "rtl" : "ltr";
10081
- this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new tc(this.root), this.portal.className = "tcw-root tcw-portal", this.look = Qn({
10086
+ let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : xu(t.locale) ? "rtl" : "ltr";
10087
+ this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new rc(this.root), this.portal.className = "tcw-root tcw-portal", this.look = Qn({
10082
10088
  dark: n,
10083
10089
  theme: r
10084
10090
  });
@@ -10086,7 +10092,7 @@ var uu = class {
10086
10092
  this.scope.run(() => $n(() => {
10087
10093
  let { dark: e, theme: t } = this.look.get();
10088
10094
  this.root.dataset.tcwTheme = this.portal.dataset.tcwTheme = e ? "dark" : "light", a && (this.keepingLook(() => this.chart.setTheme(t)), this.paintWatermark());
10089
- })), a = !0, this.stopKeyboardInset = Ps([this.root, this.portal]), this.stopNarrow = Fs(this.root, (e) => {
10095
+ })), a = !0, this.stopKeyboardInset = Is([this.root, this.portal]), this.stopNarrow = Ls(this.root, (e) => {
10090
10096
  this.toolbar?.fit(), e || this.sidebar?.closeOverlay(), this.docking.syncRail();
10091
10097
  }), this.ui = U(t.ui), this.uiVariables = t.ui !== void 0, this.uiScale = this.scaleNow(), this.applyLookTokens(), typeof ResizeObserver < "u" && (this.scaleObserver = new ResizeObserver(() => this.fitScale()), this.scaleObserver.observe(this.root)), this.markSwitchedOff(), this.stopFormControls = Qt([this.root, this.portal], {
10092
10098
  layer: this.overlayHost,
@@ -10163,16 +10169,16 @@ var uu = class {
10163
10169
  }, this.t), this.scope.run(() => $n(() => {
10164
10170
  let e = this.chartSettings.followCrosshairCursor();
10165
10171
  this.sidebar?.showCrosshairCursor(e);
10166
- })), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new Ac(this.chartContainer, this.t("status.loading")), this.historyPill = new Mc(this.chartContainer, {
10172
+ })), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new Mc(this.chartContainer, this.t("status.loading")), this.historyPill = new Pc(this.chartContainer, {
10167
10173
  loading: this.t("history.loading"),
10168
10174
  failed: this.t("history.failed")
10169
- }), this.docking.dock = new Us(n, {
10175
+ }), this.docking.dock = new Gs(n, {
10170
10176
  labels: {
10171
10177
  rail: this.t("dock.rail"),
10172
10178
  resize: this.t("dock.resize")
10173
10179
  },
10174
- savedWidth: () => _u(),
10175
- saveWidth: (e) => vu(e),
10180
+ savedWidth: () => yu(),
10181
+ saveWidth: (e) => bu(e),
10176
10182
  railShown: () => this.docking.railShown(),
10177
10183
  focusAfterClose: (e) => this.docking.panelFocusTarget(e),
10178
10184
  room: () => n.clientWidth
@@ -10275,7 +10281,7 @@ var uu = class {
10275
10281
  }
10276
10282
  }), this.clockTimer = setInterval(() => {
10277
10283
  !Kr() && this.featureState.statusBar && this.featureState["statusBar.clock"] && this.statusBar?.tick();
10278
- }, ou), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
10284
+ }, cu), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
10279
10285
  title: this.t("goTo.title"),
10280
10286
  date: this.t("range.date"),
10281
10287
  range: this.t("goTo.range"),
@@ -10334,7 +10340,7 @@ var uu = class {
10334
10340
  eraser: t ?? this.state.eraser,
10335
10341
  zoomArea: n ?? this.state.zoomArea
10336
10342
  }, this.updateUI();
10337
- }), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.on("legendResize", () => this.legend.scheduleLegend()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new fc(this.chartContainer, {
10343
+ }), this.chart.on("indicatorAdd", () => this.syncIndicatorsFromChart()), this.chart.on("indicatorRemove", () => this.syncIndicatorsFromChart()), this.chart.on("legendResize", () => this.legend.scheduleLegend()), this.chart.setPaneTitlesVisible(!this.featureState.indicatorLegend), this.indicatorLegend = new mc(this.chartContainer, {
10338
10344
  onToggleVisible: (e, t, n) => {
10339
10345
  n === "compare" ? this.chart.setCompareVisible(e, t) : this.chart.setIndicatorVisible(e, t), this.legend.scheduleLegend(), this.objectTree?.isOpen() && this.docking.refreshObjects();
10340
10346
  },
@@ -10347,7 +10353,7 @@ var uu = class {
10347
10353
  onMore: (e, t) => this.legend.openLegendMenu(e, t),
10348
10354
  onPaneAction: (e, t) => this.legend.runPaneAction(e, t),
10349
10355
  onStackResize: (e) => this.chart.setLegendStack?.(e ? {
10350
- width: sl(this.chart) + e.width,
10356
+ width: ll(this.chart) + e.width,
10351
10357
  height: 1 + e.height
10352
10358
  } : null)
10353
10359
  }, {
@@ -10396,7 +10402,7 @@ var uu = class {
10396
10402
  "dataUpdate",
10397
10403
  "symbolInfoChange"
10398
10404
  ]) this.chart.on(e, () => this.placeDrawingButton());
10399
- this.placeDrawingButton(), this.dataWindow = new Ec(this.root, {
10405
+ this.placeDrawingButton(), this.dataWindow = new Oc(this.root, {
10400
10406
  formatPrice: (e) => this.formatAlertPrice(e),
10401
10407
  formatPercent: (e) => this.formatNumber(e, 2),
10402
10408
  formatVolume: (e) => this.formatVolume(e),
@@ -10421,7 +10427,7 @@ var uu = class {
10421
10427
  },
10422
10428
  toWallTime: (e) => X(e * E(this.chart.getData()), this.displayTimezone()),
10423
10429
  fromWallTime: (e, t) => {
10424
- let n = Bs(e, t, this.displayTimezone());
10430
+ let n = Hs(e, t, this.displayTimezone());
10425
10431
  return n === null ? null : n / E(this.chart.getData());
10426
10432
  },
10427
10433
  roundPrice: (e) => this.chart.roundPrice(e),
@@ -10434,7 +10440,7 @@ var uu = class {
10434
10440
  save: (t) => this.drawingEdit.promptSaveDrawingTemplate(e, t),
10435
10441
  remove: (t, n) => e.remove(t, n)
10436
10442
  }
10437
- }, this.t)), this.drawingEdit.inlineText = new jo(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
10443
+ }, this.t)), this.drawingEdit.inlineText = new No(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
10438
10444
  let t = e.payload.id, n = this.chart.getDrawings().find((e) => e.id === t)?.type;
10439
10445
  n && K[n] && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, n && K[n] ? { tab: "text" } : {});
10440
10446
  }), this.chart.on("drawingRemove", (e) => {
@@ -10452,7 +10458,7 @@ var uu = class {
10452
10458
  justDrawn: !0
10453
10459
  }));
10454
10460
  }, s = () => setTimeout(o, 0);
10455
- window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, Gl), this.drawingEdit.cancelTextPrompt = a;
10461
+ window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, ql), this.drawingEdit.cancelTextPrompt = a;
10456
10462
  }), this.drawingStyle = new co(this.root, {
10457
10463
  onStyleChange: (e) => {
10458
10464
  this.chart.setDrawingStyle(e), this.chart.setSelectedDrawingStyle(e);
@@ -10530,19 +10536,19 @@ var uu = class {
10530
10536
  ...this.menus.chartMenuContext(s),
10531
10537
  ...o ? { pane: this.chart.getPaneScale(o) } : {}
10532
10538
  };
10533
- this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(Uo(t, c, this.t), _e, this.featureState), n, r, {
10539
+ this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(Go(t, c, this.t), _e, this.featureState), n, r, {
10534
10540
  area: t,
10535
10541
  price: s,
10536
10542
  time: a
10537
10543
  });
10538
10544
  }), this.chart.on("priceAxisAdd", (e) => {
10539
10545
  if (!this.featureState["menu.priceAxisAdd"]) return;
10540
- let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(Lo(this.menus.chartMenuContext(i), this.t), _e, this.featureState);
10546
+ let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(zo(this.menus.chartMenuContext(i), this.t), _e, this.featureState);
10541
10547
  this.menus.openChartMenu(a, n, r, {
10542
10548
  area: "priceAxisAdd",
10543
10549
  price: i
10544
10550
  });
10545
- }), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new Ts(this.chartContainer, {
10551
+ }), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new Ds(this.chartContainer, {
10546
10552
  title: this.t("interval.title"),
10547
10553
  hint: this.t("interval.hint"),
10548
10554
  invalid: this.t("interval.invalid")
@@ -10550,7 +10556,7 @@ var uu = class {
10550
10556
  }
10551
10557
  buildTrading(e, t) {
10552
10558
  if (e.layouts !== !1 && this.layouts.setupLayouts(e.layouts === !0 || e.layouts === void 0 ? {} : e.layouts), e.trading !== !1) {
10553
- this.trading.orderTicket = new vs(this.root, {
10559
+ this.trading.orderTicket = new bs(this.root, {
10554
10560
  onSubmit: (e) => {
10555
10561
  this.chart.placeOrderIntent(e), this.say(w(this.t("ticket.sent"), {
10556
10562
  side: this.t(e.side === "buy" ? "ticket.buy" : "ticket.sell"),
@@ -10561,7 +10567,7 @@ var uu = class {
10561
10567
  formatPrice: (e) => this.formatAlertPrice(e),
10562
10568
  formatAmount: (e) => this.formatMoney(e),
10563
10569
  formatNumber: (e, t) => this.formatNumber(e, t)
10564
- }, this.t), this.trading.accountPanel = new is(t, {
10570
+ }, this.t), this.trading.accountPanel = new os(t, {
10565
10571
  onClosePosition: (e) => this.chart.closePositionIntent(e),
10566
10572
  onReversePosition: (e) => this.chart.reversePositionIntent(e),
10567
10573
  onCancelOrder: (e) => this.chart.cancelOrderIntent(e),
@@ -10586,7 +10592,7 @@ var uu = class {
10586
10592
  ]) this.chart.on(e, () => this.trading.refreshAccountSoon());
10587
10593
  }
10588
10594
  if (e.trading !== !1) {
10589
- if (this.trading.bracketBar = new yc(this.chartContainer, {
10595
+ if (this.trading.bracketBar = new xc(this.chartContainer, {
10590
10596
  onConfirm: () => this.chart.confirmBracket(),
10591
10597
  onCancel: () => {
10592
10598
  this.chart.cancelBracket(), this.trading.bracketBar?.hide();
@@ -10595,7 +10601,7 @@ var uu = class {
10595
10601
  let t = e.payload;
10596
10602
  this.trading.bracketBar?.hide(), this.say(w(this.t(t.side === "buy" ? "bracket.longPlaced" : "bracket.shortPlaced"), { rr: t.riskReward.toFixed(2) }));
10597
10603
  }), e.depthLadder) {
10598
- this.trading.depthLadder = new Cc(this.root, {
10604
+ this.trading.depthLadder = new Tc(this.root, {
10599
10605
  onTrade: (e, t) => {
10600
10606
  this.chart.placeOrderIntent({
10601
10607
  side: e,
@@ -10637,7 +10643,7 @@ var uu = class {
10637
10643
  }, this.t), this.chart.on("alertAdd", () => this.alerting.refreshAlerts()), this.chart.on("alertRemove", () => this.alerting.refreshAlerts()), this.chart.on("alertUpdate", () => this.alerting.refreshAlerts()), this.chart.on("alertExpired", (e) => {
10638
10644
  let t = e.payload;
10639
10645
  this.alerting.refreshAlerts(), this.featureState.alerts && this.say(w(this.t("alerts.expiredToast"), { text: t.message ?? this.alerting.alertText(t) }));
10640
- }), e.alertNotifications && (this.alerting.alertNotifier = new bc(e.alertNotifications)), this.chart.on("alertTriggered", (e) => {
10646
+ }), e.alertNotifications && (this.alerting.alertNotifier = new Sc(e.alertNotifications)), this.chart.on("alertTriggered", (e) => {
10641
10647
  let t = e.payload;
10642
10648
  if (this.alerting.refreshAlerts(), !this.featureState.alerts) return;
10643
10649
  let n = `${this.alerting.alertText(t)}${t.message ? ` — ${t.message}` : ""}`;
@@ -10732,8 +10738,8 @@ var uu = class {
10732
10738
  onAction: (e) => this.commands.handleAction(e),
10733
10739
  onClose: () => {}
10734
10740
  }, this.overlayHost, this.t, {
10735
- list: () => mu(),
10736
- add: (e) => hu([e, ...mu().filter((t) => t !== e)])
10741
+ list: () => gu(),
10742
+ add: (e) => _u([e, ...gu().filter((t) => t !== e)])
10737
10743
  })), this.boundGlobalKeydown = (e) => {
10738
10744
  if (this.handleHostHotkey(e) || this.featureState.hotkeys && this.replay.isOpen() && this.replay.handleReplayKey(e)) return;
10739
10745
  let t = L(this.root), n = (e) => this.featureState.hotkeys && this.featureState[e];
@@ -10754,11 +10760,11 @@ var uu = class {
10754
10760
  let t = document.activeElement;
10755
10761
  if (t && t !== document.body && !this.root.contains(t)) return;
10756
10762
  e.preventDefault(), this.intervals.intervalInput.open(e.key);
10757
- } else if (au(e) !== null) {
10763
+ } else if (su(e) !== null) {
10758
10764
  if (e.defaultPrevented || !n("symbolTyping") || !this.featureState.symbolSearch || R() || Ar() || !L(this.root, !0)) return;
10759
10765
  let t = document.activeElement;
10760
10766
  if (t && t !== document.body && !this.root.contains(t)) return;
10761
- e.preventDefault(), this.openSymbolSearch(au(e));
10767
+ e.preventDefault(), this.openSymbolSearch(su(e));
10762
10768
  } else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyI" || e.code === "KeyG" || e.code === "KeyR")) {
10763
10769
  if (R() || !t) return;
10764
10770
  if (e.code === "KeyI") {
@@ -10787,13 +10793,13 @@ var uu = class {
10787
10793
  }
10788
10794
  preloadDialogsWhenIdle() {
10789
10795
  let e = () => {
10790
- this.destroyed || Ls();
10796
+ this.destroyed || zs();
10791
10797
  }, t = globalThis;
10792
10798
  if (t.requestIdleCallback && t.cancelIdleCallback) {
10793
- let n = t.requestIdleCallback(e, { timeout: $l }), r = t.cancelIdleCallback;
10799
+ let n = t.requestIdleCallback(e, { timeout: tu }), r = t.cancelIdleCallback;
10794
10800
  this.stopPreload = () => r(n);
10795
10801
  } else {
10796
- let t = setTimeout(e, eu);
10802
+ let t = setTimeout(e, nu);
10797
10803
  this.stopPreload = () => clearTimeout(t);
10798
10804
  }
10799
10805
  }
@@ -10955,7 +10961,7 @@ var uu = class {
10955
10961
  for (let t of [this.root, this.portal]) {
10956
10962
  if (ba(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
10957
10963
  let n = ya(e);
10958
- for (let e of ql) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
10964
+ for (let e of Yl) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
10959
10965
  }
10960
10966
  }
10961
10967
  fitScale() {
@@ -10964,7 +10970,7 @@ var uu = class {
10964
10970
  if (e !== this.uiScale) {
10965
10971
  if (this.ui.scale === "auto") {
10966
10972
  let t = this.root.clientWidth;
10967
- if ((e > this.uiScale ? ta(t - Kl) : ta(t + Kl)) === this.uiScale) return;
10973
+ if ((e > this.uiScale ? ta(t - Jl) : ta(t + Jl)) === this.uiScale) return;
10968
10974
  }
10969
10975
  this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
10970
10976
  }
@@ -11117,9 +11123,9 @@ var uu = class {
11117
11123
  for (let [n, r] of t) e(n) && r();
11118
11124
  }
11119
11125
  addHotkey(e) {
11120
- let t = zc(e.keys);
11126
+ let t = Vc(e.keys);
11121
11127
  if (!t) return console.warn(`[ChartWidget] Can't read the shortcut "${e.keys}": modifiers (Ctrl, Alt, Shift) and a key, joined by +.`), null;
11122
- Hc(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
11128
+ Wc(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
11123
11129
  let n = {
11124
11130
  spec: e,
11125
11131
  parsed: t
@@ -11129,8 +11135,8 @@ var uu = class {
11129
11135
  } };
11130
11136
  }
11131
11137
  handleHostHotkey(e) {
11132
- if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() || Uc(e) || Ar()) return !1;
11133
- let t = this.hostHotkeys.find((t) => Bc(e, t.parsed));
11138
+ if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() || Gc(e) || Ar()) return !1;
11139
+ let t = this.hostHotkeys.find((t) => Hc(e, t.parsed));
11134
11140
  if (!t) return !1;
11135
11141
  let n = !t.parsed.ctrl && !t.parsed.alt;
11136
11142
  if (!L(this.root, n)) return !1;
@@ -11139,13 +11145,13 @@ var uu = class {
11139
11145
  }
11140
11146
  paintWatermark() {
11141
11147
  this.chart.setWatermark(De(this.state.symbol).ticker.replace("USDT", " / USDT"), {
11142
- fontSize: tu,
11143
- color: this.state.isDark ? nu : ru
11148
+ fontSize: ru,
11149
+ color: this.state.isDark ? iu : au
11144
11150
  });
11145
11151
  }
11146
11152
  keepingLook(e) {
11147
11153
  this.chartSettings.settingsEdit && this.settings?.close();
11148
- let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(cu.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
11154
+ let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(uu.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
11149
11155
  e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
11150
11156
  }
11151
11157
  sheetKeyOn(e) {
@@ -11198,7 +11204,7 @@ var uu = class {
11198
11204
  let i = e.items();
11199
11205
  if (i.length === 0) return;
11200
11206
  let a = t.menuAnchor(r);
11201
- n.openUnder(Pc([], i), a, (e) => Fc(e, i));
11207
+ n.openUnder(Ic([], i), a, (e) => Lc(e, i));
11202
11208
  }
11203
11209
  });
11204
11210
  return r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), t.tidy(), {
@@ -11284,7 +11290,7 @@ var uu = class {
11284
11290
  from: i(o.from),
11285
11291
  to: i(o.to)
11286
11292
  },
11287
- withTime: !(k(this.state.timeframe) >= Ql),
11293
+ withTime: !(k(this.state.timeframe) >= eu),
11288
11294
  max: s,
11289
11295
  today: s
11290
11296
  });
@@ -11294,12 +11300,12 @@ var uu = class {
11294
11300
  if (t.length === 0) return;
11295
11301
  let r = E(t);
11296
11302
  if (e.kind === "date") {
11297
- let i = Bs(e.date, e.time, n);
11303
+ let i = Hs(e.date, e.time, n);
11298
11304
  if (i === null) return;
11299
11305
  this.chart.goToTime(i / r), i / r < t[0].time && this.say(this.t("range.beforeData"));
11300
11306
  return;
11301
11307
  }
11302
- let i = Bs(e.from.date, e.from.time, n), a = Bs(e.to.date, e.to.time, n);
11308
+ let i = Hs(e.from.date, e.from.time, n), a = Hs(e.to.date, e.to.time, n);
11303
11309
  i === null || a === null || (this.chart.setVisibleRange(i / r, a / r), Math.min(i, a) / r < t[0].time && this.say(this.t("range.beforeData")));
11304
11310
  }
11305
11311
  showMarkerTip(e) {
@@ -11329,7 +11335,7 @@ var uu = class {
11329
11335
  this.say(this.t("templates.nothing"), "error");
11330
11336
  return;
11331
11337
  }
11332
- this.templatePrompt ??= new Cs(this.root, this.t), this.templatePrompt.open({
11338
+ this.templatePrompt ??= new Ts(this.root, this.t), this.templatePrompt.open({
11333
11339
  title: this.t("templates.saveTitle"),
11334
11340
  submitLabel: this.t("common.save"),
11335
11341
  placeholder: this.t("templates.namePlaceholder"),
@@ -11349,9 +11355,9 @@ var uu = class {
11349
11355
  }
11350
11356
  async switchLocalTimeframe() {
11351
11357
  if (!this.baseSeries) return;
11352
- let e = ++this.localSeq, t = this.lastLocalSwitchMs >= Jl || this.baseSeries.length >= Yl;
11358
+ let e = ++this.localSeq, t = this.lastLocalSwitchMs >= Xl || this.baseSeries.length >= Zl;
11353
11359
  try {
11354
- if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await Zl(), e !== this.localSeq || this.destroyed)) return;
11360
+ if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await $l(), e !== this.localSeq || this.destroyed)) return;
11355
11361
  this.applyTimeframeData();
11356
11362
  } finally {
11357
11363
  e === this.localSeq && this.loading.end();
@@ -11465,7 +11471,7 @@ var uu = class {
11465
11471
  defaults: r.descriptor.defaultConfig,
11466
11472
  params: r.params,
11467
11473
  inputs: r.descriptor.inputs,
11468
- lineSources: du(t, n, this.t),
11474
+ lineSources: pu(t, n, this.t),
11469
11475
  plots: r.descriptor.plots,
11470
11476
  colors: i?.colors,
11471
11477
  lineWidth: i?.lineWidths[0],
@@ -11484,7 +11490,7 @@ var uu = class {
11484
11490
  this.alerting.refreshAlerts(), this.trading.refreshAccountSoon(), this.dataWindow?.isOpen() && this.dataWindow.render(this.docking.buildDataWindowModel());
11485
11491
  }
11486
11492
  formatMoney(e) {
11487
- return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()), iu));
11493
+ return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()), ou));
11488
11494
  }
11489
11495
  formatVolume(e) {
11490
11496
  return et(e, this.chartSettings.settingsState.numberLocale || "en-US");
@@ -11505,7 +11511,7 @@ var uu = class {
11505
11511
  });
11506
11512
  }
11507
11513
  indicatorValueText(e, t, n) {
11508
- return t ? this.chart.formatPrice(e) : vc(e, n);
11514
+ return t ? this.chart.formatPrice(e) : bc(e, n);
11509
11515
  }
11510
11516
  chartSetsDecimals() {
11511
11517
  return this.chart.getMarket?.()?.pricePrecision != null || this.chart.getSymbolInfo?.()?.pricePrecision != null;
@@ -11590,7 +11596,7 @@ var uu = class {
11590
11596
  }), this.updateUI();
11591
11597
  }
11592
11598
  lazyPart(e, t) {
11593
- return new Is(e, t, (e) => e.destroy(), () => this.say(this.t("common.partFailed"), "error"));
11599
+ return new Rs(e, t, (e) => e.destroy(), () => this.say(this.t("common.partFailed"), "error"));
11594
11600
  }
11595
11601
  whenLoaded(e, t, n) {
11596
11602
  if (!e || !t()) return;
@@ -12364,7 +12370,7 @@ var uu = class {
12364
12370
  };
12365
12371
  }
12366
12372
  };
12367
- function du(e, t, n) {
12373
+ function pu(e, t, n) {
12368
12374
  let r = (e) => {
12369
12375
  let t = Rt(e.descriptor);
12370
12376
  return t && st(e.params[t])?.instanceId || null;
@@ -12387,66 +12393,66 @@ function du(e, t, n) {
12387
12393
  }
12388
12394
  return a;
12389
12395
  }
12390
- var fu = "tcw:recentCommands", pu = 10;
12391
- function mu() {
12396
+ var mu = "tcw:recentCommands", hu = 10;
12397
+ function gu() {
12392
12398
  try {
12393
- let e = JSON.parse(qr()?.getItem(fu) ?? "[]");
12394
- return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, pu) : [];
12399
+ let e = JSON.parse(qr()?.getItem(mu) ?? "[]");
12400
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, hu) : [];
12395
12401
  } catch {
12396
12402
  return [];
12397
12403
  }
12398
12404
  }
12399
- function hu(e) {
12405
+ function _u(e) {
12400
12406
  try {
12401
- qr()?.setItem(fu, JSON.stringify(e.slice(0, pu)));
12407
+ qr()?.setItem(mu, JSON.stringify(e.slice(0, hu)));
12402
12408
  } catch {}
12403
12409
  }
12404
- var gu = "tcw:dockWidth";
12405
- function _u() {
12410
+ var vu = "tcw:dockWidth";
12411
+ function yu() {
12406
12412
  try {
12407
- let e = Number(qr()?.getItem(gu) ?? NaN);
12413
+ let e = Number(qr()?.getItem(vu) ?? NaN);
12408
12414
  return Number.isFinite(e) && e > 0 ? e : null;
12409
12415
  } catch {
12410
12416
  return null;
12411
12417
  }
12412
12418
  }
12413
- function vu(e) {
12419
+ function bu(e) {
12414
12420
  try {
12415
- qr()?.setItem(gu, String(e));
12421
+ qr()?.setItem(vu, String(e));
12416
12422
  } catch {}
12417
12423
  }
12418
- function yu(e) {
12424
+ function xu(e) {
12419
12425
  return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
12420
12426
  }
12421
12427
  //#endregion
12422
12428
  //#region src/widget/GridLayoutPicker.ts
12423
- var bu = 2, xu = 20, Su = 2, Cu = 16, wu = 2, Tu = 4, Eu = {
12429
+ var Su = 2, Cu = 20, wu = 2, Tu = 16, Eu = 2, Du = 4, Ou = {
12424
12430
  left: "grid.layoutBigLeft",
12425
12431
  right: "grid.layoutBigRight",
12426
12432
  top: "grid.layoutBigTop",
12427
12433
  bottom: "grid.layoutBigBottom"
12428
12434
  };
12429
- function Du(e, t, n) {
12430
- let r = (xu - Su * (n - 1)) / n;
12431
- return [bu + e * (r + Su), t * r + (t - 1) * Su];
12435
+ function ku(e, t, n) {
12436
+ let r = (Cu - wu * (n - 1)) / n;
12437
+ return [Su + e * (r + wu), t * r + (t - 1) * wu];
12432
12438
  }
12433
- function Ou(e, t = Cu) {
12439
+ function Au(e, t = Tu) {
12434
12440
  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]) => {
12435
- let [a, o] = Du(t, r, e.cols), [s, c] = Du(n, i, e.rows);
12441
+ let [a, o] = ku(t, r, e.cols), [s, c] = ku(n, i, e.rows);
12436
12442
  return `<rect x="${a}" y="${s}" width="${o}" height="${c}" rx="1"/>`;
12437
12443
  }).join("")}</svg>`;
12438
12444
  }
12439
- function ku(e, t) {
12445
+ function ju(e, t) {
12440
12446
  let n = f[e], r = s(n);
12441
12447
  if (r === 1) return t("grid.single");
12442
12448
  let i = m(n);
12443
- return i ? w(t(Eu[i]), { count: r }) : w(t("grid.layoutOption"), {
12449
+ return i ? w(t(Ou[i]), { count: r }) : w(t("grid.layoutOption"), {
12444
12450
  count: r,
12445
12451
  cols: n.cols,
12446
12452
  rows: n.rows
12447
12453
  });
12448
12454
  }
12449
- var Au = class {
12455
+ var Mu = class {
12450
12456
  button;
12451
12457
  panel = null;
12452
12458
  choices;
@@ -12463,8 +12469,8 @@ var Au = class {
12463
12469
  }), this.render();
12464
12470
  }
12465
12471
  render() {
12466
- let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${ku(n, e)}`;
12467
- this.button.innerHTML = Ou(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
12472
+ let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${ju(n, e)}`;
12473
+ this.button.innerHTML = Au(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
12468
12474
  for (let e of this.items()) e.setAttribute("aria-checked", String(e.dataset.layout === n));
12469
12475
  }
12470
12476
  isOpen() {
@@ -12505,15 +12511,15 @@ var Au = class {
12505
12511
  return a.className = "tcw-grid-picker-row", a.append(...t.map((e) => this.item(e))), r.append(i, a), r;
12506
12512
  }
12507
12513
  item(e) {
12508
- let t = ku(e, this.options.t), n = document.createElement("button");
12509
- 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 = Ou(f[e]), n.addEventListener("click", () => this.pick(e)), n;
12514
+ let t = ju(e, this.options.t), n = document.createElement("button");
12515
+ 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 = Au(f[e]), n.addEventListener("click", () => this.pick(e)), n;
12510
12516
  }
12511
12517
  pick(e) {
12512
12518
  this.close(), this.options.onPick(e), this.render();
12513
12519
  }
12514
12520
  place(e) {
12515
- 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 - Tu;
12516
- e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + wu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - wu - Tu)}px`;
12521
+ 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 - Du;
12522
+ e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top + Eu}px`, e.style.maxHeight = `${Math.max(0, t.clientHeight - (n.bottom - r.top) - Eu - Du)}px`;
12517
12523
  }
12518
12524
  items() {
12519
12525
  return this.panel ? [...this.panel.querySelectorAll("[role=\"menuitemradio\"]")] : [];
@@ -12544,32 +12550,32 @@ var Au = class {
12544
12550
  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];
12545
12551
  return l[Math.min(c, l.length - 1)];
12546
12552
  }
12547
- }, ju = {
12553
+ }, Nu = {
12548
12554
  symbol: !1,
12549
12555
  interval: !1,
12550
12556
  crosshair: !0,
12551
12557
  time: !1,
12552
12558
  drawings: !1,
12553
12559
  replay: !1
12554
- }, Mu = [
12560
+ }, Pu = [
12555
12561
  "symbol",
12556
12562
  "interval",
12557
12563
  "crosshair",
12558
12564
  "time",
12559
12565
  "drawings",
12560
12566
  "replay"
12561
- ], Nu = f;
12562
- function Pu(e) {
12567
+ ], Fu = f;
12568
+ function Iu(e) {
12563
12569
  return JSON.parse(JSON.stringify(e));
12564
12570
  }
12565
- function Fu(e) {
12571
+ function Lu(e) {
12566
12572
  if (typeof e != "object" || !e) return null;
12567
12573
  let t = e;
12568
12574
  if (t.v !== 1 || t.kind !== "grid" || !r(t.layout) || !Array.isArray(t.cells)) return null;
12569
- let n = t.cells.map(As);
12575
+ let n = t.cells.map(Ms);
12570
12576
  if (n.some((e) => e === null)) return null;
12571
- let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...ju };
12572
- for (let e of Mu) typeof i[e] == "boolean" && (a[e] = i[e]);
12577
+ let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Nu };
12578
+ for (let e of Pu) typeof i[e] == "boolean" && (a[e] = i[e]);
12573
12579
  let o = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
12574
12580
  return {
12575
12581
  v: 1,
@@ -12580,7 +12586,7 @@ function Fu(e) {
12580
12586
  cells: n
12581
12587
  };
12582
12588
  }
12583
- var Iu = class {
12589
+ var Ru = class {
12584
12590
  root;
12585
12591
  cellsEl;
12586
12592
  cells = [];
@@ -12610,9 +12616,9 @@ var Iu = class {
12610
12616
  };
12611
12617
  constructor(e, t = {}) {
12612
12618
  this.options = t, this.layout = r(t.layout) ? t.layout : "1x2", this.sync = {
12613
- ...ju,
12619
+ ...Nu,
12614
12620
  ...t.sync
12615
- }, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), on(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ba(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 = Fs(this.root), this.applyShape();
12621
+ }, this.t = Be(Ve(t.widget?.locale, t.widget?.messages)), on(), this.root = document.createElement("div"), this.root.className = "tcw-root tcw-grid", this.root.dataset.tcwTheme = t.widget?.theme === "light" ? "light" : "dark", ba(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 = Ls(this.root), this.applyShape();
12616
12622
  for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
12617
12623
  this.markActive();
12618
12624
  let n = this.cells[0]?.el.querySelector(".tcw-root")?.dataset.tcwTheme;
@@ -12738,7 +12744,7 @@ var Iu = class {
12738
12744
  return JSON.stringify(this.captureLayout());
12739
12745
  }
12740
12746
  async applyLayoutContent(e) {
12741
- let t = Fu(js(e));
12747
+ let t = Lu(Ns(e));
12742
12748
  return t ? (await this.restoreLayout(t), !0) : !1;
12743
12749
  }
12744
12750
  destroy() {
@@ -12760,7 +12766,7 @@ var Iu = class {
12760
12766
  createCell(e) {
12761
12767
  let t = document.createElement("div");
12762
12768
  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);
12763
- let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new uu(t, {
12769
+ let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new fu(t, {
12764
12770
  ...r,
12765
12771
  ...a,
12766
12772
  ...a.adapter ? { feed: void 0 } : {},
@@ -12817,7 +12823,7 @@ var Iu = class {
12817
12823
  t.replaySeekToTime(n);
12818
12824
  return;
12819
12825
  }
12820
- let r = Lu(t.getData(), n);
12826
+ let r = zu(t.getData(), n);
12821
12827
  r >= 0 && t.replayStart({
12822
12828
  startIndex: r,
12823
12829
  paused: !0
@@ -12862,7 +12868,7 @@ var Iu = class {
12862
12868
  copyDrawings(e) {
12863
12869
  let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
12864
12870
  this.quietly(() => {
12865
- for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Pu(n));
12871
+ for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Iu(n));
12866
12872
  });
12867
12873
  }
12868
12874
  mergeDrawings() {
@@ -12874,7 +12880,7 @@ var Iu = class {
12874
12880
  let e = /* @__PURE__ */ new Map();
12875
12881
  for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
12876
12882
  let n = [...e.values()];
12877
- for (let e of t) e.widget.getChart().setDrawings(Pu(n));
12883
+ for (let e of t) e.widget.getChart().setDrawings(Iu(n));
12878
12884
  }
12879
12885
  });
12880
12886
  }
@@ -12911,7 +12917,7 @@ var Iu = class {
12911
12917
  let t = document.createElement("div");
12912
12918
  t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
12913
12919
  let n = this.options.layoutChoices?.filter(r) ?? l;
12914
- n.length > 0 && (this.layoutPicker = new Au({
12920
+ n.length > 0 && (this.layoutPicker = new Mu({
12915
12921
  host: this.root,
12916
12922
  t: this.t,
12917
12923
  choices: n,
@@ -12922,7 +12928,7 @@ var Iu = class {
12922
12928
  i.className = "tcw-grid-group", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.t("grid.sync"));
12923
12929
  let a = document.createElement("span");
12924
12930
  a.className = "tcw-grid-label", a.innerHTML = `${x("link", 13)}<span>${S(this.t("grid.sync"))}</span>`, i.appendChild(a);
12925
- for (let e of Mu) {
12931
+ for (let e of Pu) {
12926
12932
  let t = document.createElement("button");
12927
12933
  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);
12928
12934
  }
@@ -12966,7 +12972,7 @@ var Iu = class {
12966
12972
  onChange: () => this.renderLayoutsButton(),
12967
12973
  onError: () => this.toast(this.t("layouts.saveFailed"), "error")
12968
12974
  });
12969
- this.session = t, this.layoutsUI = new ml(t, {
12975
+ this.session = t, this.layoutsUI = new gl(t, {
12970
12976
  root: this.root,
12971
12977
  t: this.t,
12972
12978
  toast: (e, t) => this.toast(e, t),
@@ -12980,12 +12986,12 @@ var Iu = class {
12980
12986
  this.cells[this.active]?.widget.toast(e, t);
12981
12987
  }
12982
12988
  };
12983
- function Lu(e, t) {
12989
+ function zu(e, t) {
12984
12990
  let n = -1;
12985
12991
  for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
12986
12992
  return n;
12987
12993
  }
12988
12994
  //#endregion
12989
- export { Se as CHART_TYPE_ICONS, uu as ChartWidget, Iu as ChartWidgetGrid, ju as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, Nu as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, fa as WIDGET_UI_PRESETS, ba 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, Fu as readGridLayout, oi as readWatchlists, As as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, ya as widgetUIVariables };
12995
+ export { Se as CHART_TYPE_ICONS, fu as ChartWidget, Ru as ChartWidgetGrid, Nu as DEFAULT_GRID_SYNC, we as DRAWING_TOOL_ICONS, Re as EN_MESSAGES, Fu as GRID_SHAPES, p as LayoutSession, c as MAX_LAYOUT_NAME, ye as UI_ICONS, He as VI_MESSAGES, he as WIDGET_FEATURES, fa as WIDGET_UI_PRESETS, ba 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, Lu as readGridLayout, oi as readWatchlists, Ms as readWidgetLayout, Le as registerWidgetLocale, U as resolveWidgetUI, ya as widgetUIVariables };
12990
12996
 
12991
12997
  //# sourceMappingURL=index.js.map