@tradecanvas/chart 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{LayoutSession-DUkQpWp6.cjs → LayoutSession-CwpR5ScW.cjs} +2 -2
- package/dist/{LayoutSession-DUkQpWp6.cjs.map → LayoutSession-CwpR5ScW.cjs.map} +1 -1
- package/dist/{LayoutSession-QZPqjaRt.js → LayoutSession-fJQLPSQ8.js} +2 -2
- package/dist/{LayoutSession-QZPqjaRt.js.map → LayoutSession-fJQLPSQ8.js.map} +1 -1
- package/dist/{WidgetCommandPalette-CdqVGBYg.cjs → WidgetCommandPalette-CASDu1gu.cjs} +2 -2
- package/dist/{WidgetCommandPalette-CdqVGBYg.cjs.map → WidgetCommandPalette-CASDu1gu.cjs.map} +1 -1
- package/dist/{WidgetCommandPalette-BRVQZRQe.js → WidgetCommandPalette-DpP-lG1A.js} +2 -2
- package/dist/{WidgetCommandPalette-BRVQZRQe.js.map → WidgetCommandPalette-DpP-lG1A.js.map} +1 -1
- package/dist/{WidgetDrawingSettings-CFksb9-G.cjs → WidgetDrawingSettings-BpX4Cdys.cjs} +2 -2
- package/dist/{WidgetDrawingSettings-CFksb9-G.cjs.map → WidgetDrawingSettings-BpX4Cdys.cjs.map} +1 -1
- package/dist/{WidgetDrawingSettings-DBBFUUg7.js → WidgetDrawingSettings-Cwds8CdJ.js} +2 -2
- package/dist/{WidgetDrawingSettings-DBBFUUg7.js.map → WidgetDrawingSettings-Cwds8CdJ.js.map} +1 -1
- package/dist/{WidgetIndicatorPicker-DiB_819o.cjs → WidgetIndicatorPicker-CTK-2QvV.cjs} +2 -2
- package/dist/{WidgetIndicatorPicker-DiB_819o.cjs.map → WidgetIndicatorPicker-CTK-2QvV.cjs.map} +1 -1
- package/dist/{WidgetIndicatorPicker-CcIYSWPd.js → WidgetIndicatorPicker-DsFCT2xZ.js} +2 -2
- package/dist/{WidgetIndicatorPicker-CcIYSWPd.js.map → WidgetIndicatorPicker-DsFCT2xZ.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-DcRbZpJJ.js → WidgetIndicatorSettings-D3W40Nud.js} +3 -3
- package/dist/{WidgetIndicatorSettings-DcRbZpJJ.js.map → WidgetIndicatorSettings-D3W40Nud.js.map} +1 -1
- package/dist/{WidgetIndicatorSettings-GnMFEumO.cjs → WidgetIndicatorSettings-DRt-E8Y_.cjs} +2 -2
- package/dist/{WidgetIndicatorSettings-GnMFEumO.cjs.map → WidgetIndicatorSettings-DRt-E8Y_.cjs.map} +1 -1
- package/dist/{WidgetSettings-Ds8LIQJL.js → WidgetSettings-BsjEg-Dj.js} +2 -2
- package/dist/{WidgetSettings-Ds8LIQJL.js.map → WidgetSettings-BsjEg-Dj.js.map} +1 -1
- package/dist/{WidgetSettings-BnXD_NEb.cjs → WidgetSettings-D0fnEBqC.cjs} +2 -2
- package/dist/{WidgetSettings-BnXD_NEb.cjs.map → WidgetSettings-D0fnEBqC.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-CB27E553.cjs → WidgetSymbolSearch-CTfNYC_m.cjs} +2 -2
- package/dist/{WidgetSymbolSearch-CB27E553.cjs.map → WidgetSymbolSearch-CTfNYC_m.cjs.map} +1 -1
- package/dist/{WidgetSymbolSearch-W9ZoSxTR.js → WidgetSymbolSearch-Cxxq4SrK.js} +2 -2
- package/dist/{WidgetSymbolSearch-W9ZoSxTR.js.map → WidgetSymbolSearch-Cxxq4SrK.js.map} +1 -1
- package/dist/{i18n-BudCuwZD.js → i18n-COYPJUtF.js} +33 -33
- package/dist/i18n-COYPJUtF.js.map +1 -0
- package/dist/i18n-Q4mxL2mj.cjs +2 -0
- package/dist/i18n-Q4mxL2mj.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{indicatorInputWords-BfiSCSB-.js → indicatorInputWords-DFmWy8Ah.js} +2 -2
- package/dist/{indicatorInputWords-BfiSCSB-.js.map → indicatorInputWords-DFmWy8Ah.js.map} +1 -1
- package/dist/{indicatorInputWords-CdAL8a73.cjs → indicatorInputWords-hVKLYuVB.cjs} +2 -2
- package/dist/{indicatorInputWords-CdAL8a73.cjs.map → indicatorInputWords-hVKLYuVB.cjs.map} +1 -1
- package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -1
- package/dist/widget/WidgetInlineText.d.ts +2 -0
- package/dist/widget/WidgetInlineText.d.ts.map +1 -1
- package/dist/widget/WidgetSelectionToolbar.d.ts +7 -1
- package/dist/widget/WidgetSelectionToolbar.d.ts.map +1 -1
- package/dist/widget/index.cjs +3 -3
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +520 -519
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/locales/index.cjs +1 -1
- package/dist/widget/locales/index.js +1 -1
- package/package.json +3 -3
- package/dist/i18n-BudCuwZD.js.map +0 -1
- package/dist/i18n-D8MhJwUv.cjs +0 -2
- package/dist/i18n-D8MhJwUv.cjs.map +0 -1
package/dist/widget/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-
|
|
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-fJQLPSQ8.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";
|
|
5
5
|
import { a as b, c as ye, i as x, l as be, n as xe, o as Se, r as Ce, s as we } from "../focusTrap-Br9Zfje0.js";
|
|
6
6
|
import { a as Te, d as S, i as Ee, l as De, n as Oe, o as ke, r as Ae, s as je, t as Me, u as Ne } from "../symbolCatalog-B_9kDAjE.js";
|
|
7
7
|
import { a as Pe, c as Fe, f as C, u as Ie } from "../settingsControls-DIjzCFHI.js";
|
|
8
|
-
import { a as Le, c as Re, i as ze, n as Be, o as Ve, r as w, s as He, t as T } from "../i18n-
|
|
9
|
-
import { r as Ue } from "../indicatorInputWords-
|
|
8
|
+
import { a as Le, c as Re, i as ze, n as Be, o as Ve, r as w, s as He, t as T } from "../i18n-COYPJUtF.js";
|
|
9
|
+
import { r as Ue } from "../indicatorInputWords-DFmWy8Ah.js";
|
|
10
10
|
import { t as We } from "../platformKeys-Dd1qOCjF.js";
|
|
11
11
|
import { CHART_SPACING as Ge, CHART_STYLE_KEYS as Ke, DARK_THEME as qe, FIGURES_FONT_FAMILY as Je, LIGHT_THEME as Ye, PHI as Xe, SANS_FONT_FAMILY as Ze, barTimeUnit as E, evenPx as Qe, formatPrice as $e, formatVolumeLoc as et, indicatorSource as tt, isTimeFrame as nt, isValidTimeZone as rt, marketStatus as it, offsetAt as at, ownFillColor as ot, parseIndicatorSource as st, phiStep as ct, readChartStyleOverrides as lt, readChartTypeOptions as ut, readIndicatorPlotStyles as dt, readNews as ft, readQuote as pt, resampleBars as mt, sanitizeDrawingStyle as ht, stepDecimals as gt, symbolTimeZone as _t, tickBarCount as D, tickerOf as O, timeParts as vt, timeframeFollowsDays as yt, timeframeToMs as k, tzLabel as bt, wallToUtc as xt, zoneOffsetMinutes as St, zonedDateFormatter as Ct } from "@tradecanvas/commons";
|
|
12
12
|
import { ChartStateManager as wt, MAX_ALERT_BARS as Tt, MIN_ALERT_BARS as Et, RANGE_PRESETS as Dt, ResamplingAdapter as Ot, SYMBOL_INDICATOR_IDS as kt, adapterFromFeed as At, indicatorCategory as jt, indicatorValuePrecision as Mt, isCrosshairCursor as Nt, plotColor as Pt, plotShown as Ft, rangePresetStart as It, servesTimeframe as Lt, sourceParam as Rt, withResampling as A } from "@tradecanvas/core";
|
|
@@ -4697,18 +4697,18 @@ var ro = class {
|
|
|
4697
4697
|
color: "color",
|
|
4698
4698
|
fill: "fillColor",
|
|
4699
4699
|
textColor: "textColor"
|
|
4700
|
-
}, uo =
|
|
4701
|
-
function ho(e) {
|
|
4702
|
-
return typeof e == "string" && mo.test(e.trim()) ? e.trim() : "#7d8696";
|
|
4703
|
-
}
|
|
4700
|
+
}, uo = 32, fo = .618, G = 4, po = 4, mo = 20, ho = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([\d\s.,%/+-]+\)|[a-z]+)$/i;
|
|
4704
4701
|
function go(e) {
|
|
4705
|
-
|
|
4706
|
-
return Number.isFinite(t) && t > 0 ? Math.min(t, po) : 1;
|
|
4702
|
+
return typeof e == "string" && ho.test(e.trim()) ? e.trim() : "#7d8696";
|
|
4707
4703
|
}
|
|
4708
4704
|
function _o(e) {
|
|
4705
|
+
let t = Number(e);
|
|
4706
|
+
return Number.isFinite(t) && t > 0 ? Math.min(t, mo) : 1;
|
|
4707
|
+
}
|
|
4708
|
+
function vo(e) {
|
|
4709
4709
|
return so.includes(e) ? e : "solid";
|
|
4710
4710
|
}
|
|
4711
|
-
var
|
|
4711
|
+
var yo = class {
|
|
4712
4712
|
el;
|
|
4713
4713
|
pop;
|
|
4714
4714
|
target = null;
|
|
@@ -4750,9 +4750,9 @@ var vo = class {
|
|
|
4750
4750
|
show(e) {
|
|
4751
4751
|
this.target = e;
|
|
4752
4752
|
let t = e.style, n = [
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4753
|
+
go(t.color),
|
|
4754
|
+
_o(t.lineWidth),
|
|
4755
|
+
vo(t.lineStyle),
|
|
4756
4756
|
e.locked,
|
|
4757
4757
|
e.canDelete,
|
|
4758
4758
|
e.canSettings,
|
|
@@ -4774,14 +4774,14 @@ var vo = class {
|
|
|
4774
4774
|
this.onDragEnd(), document.removeEventListener("pointerdown", this.onDocDown, !0), this.el.remove(), this.pop.remove();
|
|
4775
4775
|
}
|
|
4776
4776
|
render(e) {
|
|
4777
|
-
let t = this.t, n =
|
|
4777
|
+
let t = this.t, n = go(e.style.color), r = _o(e.style.lineWidth), i = vo(e.style.lineStyle), a = e.locked, o = this.el.contains(document.activeElement) ? document.activeElement.dataset.action : void 0, s = (e, t, n, r = "") => `<button type="button" class="tcw-sel-btn${r}" data-action="${e}" aria-label="${S(t)}" title="${S(t)}">${n}</button>`, c = (e, t, n) => s(e, t, n, " tcw-sel-has-pop").replace("<button ", "<button aria-haspopup=\"dialog\" aria-expanded=\"false\" ");
|
|
4778
4778
|
this.el.innerHTML = [
|
|
4779
4779
|
"<span class=\"tcw-sel-grip\" aria-hidden=\"true\"></span>",
|
|
4780
4780
|
c("color", t("drawingSettings.color"), `<span class="tcw-sel-color" style="background:${S(n)}"></span>`),
|
|
4781
4781
|
c("width", t("drawingSettings.lineWidth"), `<span class="tcw-sel-width" style="--w:${r}px"></span><span class="tcw-sel-num">${r}px</span>`),
|
|
4782
|
-
c("lineStyle", t("drawingSettings.lineStyle"),
|
|
4783
|
-
e.canFill ? c("fill", t("drawingSettings.fill"), `<span class="tcw-sel-color tcw-sel-fill" style="background:${S(
|
|
4784
|
-
e.canText ? c("textColor", t("drawingSettings.textColor"), `<span class="tcw-sel-text" style="--c:${S(
|
|
4782
|
+
c("lineStyle", t("drawingSettings.lineStyle"), bo(i)),
|
|
4783
|
+
e.canFill ? c("fill", t("drawingSettings.fill"), `<span class="tcw-sel-color tcw-sel-fill" style="background:${S(go(ot(e.style) ?? n))}"></span>`) : "",
|
|
4784
|
+
e.canText ? c("textColor", t("drawingSettings.textColor"), `<span class="tcw-sel-text" style="--c:${S(go(e.style.textColor ?? n))}">T</span>`) : "",
|
|
4785
4785
|
"<span class=\"tcw-sel-sep\" aria-hidden=\"true\"></span>",
|
|
4786
4786
|
e.canSettings ? s("settings", t("legend.settings"), x("settings", 15)) : "",
|
|
4787
4787
|
e.canAlert ? s("alert", t("drawingSettings.addAlert"), x("bell", 15)) : "",
|
|
@@ -4800,19 +4800,17 @@ var vo = class {
|
|
|
4800
4800
|
t && e?.focus();
|
|
4801
4801
|
}
|
|
4802
4802
|
place(e) {
|
|
4803
|
-
let {
|
|
4803
|
+
let { bounds: t } = e, { w: n, h: r } = this.size ?? {
|
|
4804
4804
|
w: 0,
|
|
4805
4805
|
h: 0
|
|
4806
4806
|
};
|
|
4807
4807
|
if (this.pinned) {
|
|
4808
|
-
let e = Math.max(
|
|
4809
|
-
this.el.style.left = `${Math.round(e)}px`, this.el.style.top = `${Math.round(
|
|
4808
|
+
let e = Math.max(t.x + G, Math.min(this.pinned.left, t.x + t.width - n - G)), i = Math.max(t.y + G, Math.min(this.pinned.top, t.y + t.height - r - G));
|
|
4809
|
+
this.el.style.left = `${Math.round(e)}px`, this.el.style.top = `${Math.round(i)}px`;
|
|
4810
4810
|
return;
|
|
4811
4811
|
}
|
|
4812
|
-
let
|
|
4813
|
-
|
|
4814
|
-
let o = t.y - i - uo;
|
|
4815
|
-
o < n.y + G && (o = Math.min(t.y + t.height + uo, n.y + n.height - i - G)), o = Math.max(o, n.y + G), this.el.style.left = `${Math.round(a)}px`, this.el.style.top = `${Math.round(o)}px`;
|
|
4812
|
+
let i = Math.max(t.x + G, t.x + (t.width - n) / 2), a = n > t.width * fo, o = t.y + t.height - r - G, s = Math.max(t.y + G, a ? o : Math.min(t.y + uo, o));
|
|
4813
|
+
this.el.style.left = `${Math.round(i)}px`, this.el.style.top = `${Math.round(s)}px`;
|
|
4816
4814
|
}
|
|
4817
4815
|
onClick(e) {
|
|
4818
4816
|
let t = e.target.closest("[data-action]");
|
|
@@ -4843,8 +4841,8 @@ var vo = class {
|
|
|
4843
4841
|
r < 0 || (e.preventDefault(), this.rove(t[r], !0));
|
|
4844
4842
|
}
|
|
4845
4843
|
openPopover(e, t) {
|
|
4846
|
-
let n = this.target.style, r =
|
|
4847
|
-
this.openPop = e, e === "color" || e === "fill" || e === "textColor" ? this.pop.innerHTML = ao.map((e) => o("tcw-sel-swatch", e.toLowerCase() === r, `data-color="${e}" style="background:${e}" aria-label="${e}"`)).join("") : e === "width" ? this.pop.innerHTML = oo.map((e) => o("tcw-sel-option", e === i, `data-width="${e}"`, `<span class="tcw-sel-width" style="--w:${e}px"></span>${e}px`)).join("") : this.pop.innerHTML = so.map((e) => o("tcw-sel-option", e === a, `data-style="${e}"`,
|
|
4844
|
+
let n = this.target.style, r = go(e === "fill" ? ot(n) ?? n.color : e === "textColor" ? n.textColor ?? n.color : n.color).toLowerCase(), i = _o(n.lineWidth), a = vo(n.lineStyle), o = (e, t, n, r = "") => `<button type="button" class="${e}${t ? " tcw-sel-on" : ""}" aria-pressed="${t}" ${n}>${r}</button>`;
|
|
4845
|
+
this.openPop = e, e === "color" || e === "fill" || e === "textColor" ? this.pop.innerHTML = ao.map((e) => o("tcw-sel-swatch", e.toLowerCase() === r, `data-color="${e}" style="background:${e}" aria-label="${e}"`)).join("") : e === "width" ? this.pop.innerHTML = oo.map((e) => o("tcw-sel-option", e === i, `data-width="${e}"`, `<span class="tcw-sel-width" style="--w:${e}px"></span>${e}px`)).join("") : this.pop.innerHTML = so.map((e) => o("tcw-sel-option", e === a, `data-style="${e}"`, bo(e) + S(this.t(`drawingSettings.lineStyle.${e}`)))).join(""), this.pop.className = `tcw-sel-pop tcw-sel-pop--${e}`, this.pop.setAttribute("aria-label", t.getAttribute("aria-label") ?? ""), this.pop.hidden = !1;
|
|
4848
4846
|
for (let e of this.el.querySelectorAll("[aria-expanded=\"true\"]")) e.setAttribute("aria-expanded", "false");
|
|
4849
4847
|
t.setAttribute("aria-expanded", "true"), this.placePop(), this.pop.querySelector(".tcw-sel-on, button")?.focus();
|
|
4850
4848
|
}
|
|
@@ -4855,7 +4853,7 @@ var vo = class {
|
|
|
4855
4853
|
}
|
|
4856
4854
|
let t = [...this.pop.querySelectorAll("button")], n = t.indexOf(document.activeElement);
|
|
4857
4855
|
if (n < 0) return;
|
|
4858
|
-
let r = this.openPop === "color" || this.openPop === "fill" || this.openPop === "textColor" ?
|
|
4856
|
+
let r = this.openPop === "color" || this.openPop === "fill" || this.openPop === "textColor" ? po : 1, i = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : e.key === "ArrowDown" ? r : e.key === "ArrowUp" ? -r : 0;
|
|
4859
4857
|
i && (e.preventDefault(), t[(n + i + t.length) % t.length].focus());
|
|
4860
4858
|
}
|
|
4861
4859
|
placePop() {
|
|
@@ -4866,7 +4864,7 @@ var vo = class {
|
|
|
4866
4864
|
let t = e.target.closest("button");
|
|
4867
4865
|
if (!t) return;
|
|
4868
4866
|
let n = this.openPop && this.openPop in lo ? lo[this.openPop] : "color";
|
|
4869
|
-
t.dataset.color ? this.callbacks.onStyle({ [n]: t.dataset.color }) : t.dataset.width ? this.callbacks.onStyle({ lineWidth: Number(t.dataset.width) }) : t.dataset.style && this.callbacks.onStyle({ lineStyle:
|
|
4867
|
+
t.dataset.color ? this.callbacks.onStyle({ [n]: t.dataset.color }) : t.dataset.width ? this.callbacks.onStyle({ lineWidth: Number(t.dataset.width) }) : t.dataset.style && this.callbacks.onStyle({ lineStyle: vo(t.dataset.style) }), this.closePop(!0);
|
|
4870
4868
|
}
|
|
4871
4869
|
closePop(e = !1) {
|
|
4872
4870
|
if (!this.openPop) return;
|
|
@@ -4874,7 +4872,7 @@ var vo = class {
|
|
|
4874
4872
|
t?.setAttribute("aria-expanded", "false"), this.openPop = null, this.pop.hidden = !0, e && t?.focus();
|
|
4875
4873
|
}
|
|
4876
4874
|
};
|
|
4877
|
-
function
|
|
4875
|
+
function bo(e) {
|
|
4878
4876
|
return `<svg class="tcw-sel-line" width="22" height="10" viewBox="0 0 22 10" aria-hidden="true"><line x1="1" y1="5" x2="21" y2="5" stroke="currentColor" stroke-width="2"${e === "dashed" ? " stroke-dasharray=\"4 3\"" : e === "dotted" ? " stroke-dasharray=\"1 3\" stroke-linecap=\"round\"" : ""}/></svg>`;
|
|
4879
4877
|
}
|
|
4880
4878
|
//#endregion
|
|
@@ -4922,7 +4920,7 @@ var K = {
|
|
|
4922
4920
|
wrap: 240,
|
|
4923
4921
|
fontSize: 14
|
|
4924
4922
|
}
|
|
4925
|
-
},
|
|
4923
|
+
}, xo = new Set([
|
|
4926
4924
|
"trendLine",
|
|
4927
4925
|
"ray",
|
|
4928
4926
|
"extendedLine",
|
|
@@ -4933,7 +4931,7 @@ var K = {
|
|
|
4933
4931
|
"horizontalRay",
|
|
4934
4932
|
"verticalLine",
|
|
4935
4933
|
"rectangle"
|
|
4936
|
-
]),
|
|
4934
|
+
]), 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 {
|
|
4937
4935
|
wrap = null;
|
|
4938
4936
|
area = null;
|
|
4939
4937
|
target = null;
|
|
@@ -4943,7 +4941,7 @@ var K = {
|
|
|
4943
4941
|
offSince = 0;
|
|
4944
4942
|
onPressAway = (e) => {
|
|
4945
4943
|
if (!(!this.area || e.target === this.area)) {
|
|
4946
|
-
if (this.area.value === this.target?.text && performance.now() - this.openedAt <
|
|
4944
|
+
if (this.area.value === this.target?.text && performance.now() - this.openedAt < Ao) {
|
|
4947
4945
|
e.preventDefault(), e.stopPropagation();
|
|
4948
4946
|
return;
|
|
4949
4947
|
}
|
|
@@ -4964,22 +4962,22 @@ var K = {
|
|
|
4964
4962
|
let n = document.createElement("div");
|
|
4965
4963
|
n.className = "tcw-inline-text";
|
|
4966
4964
|
let r = document.createElement("textarea");
|
|
4967
|
-
r.className = "tcw-inline-text-input", r.value = e.text, r.rows = 1, r.spellcheck = !1, r.setAttribute("aria-label", e.label);
|
|
4965
|
+
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);
|
|
4968
4966
|
let { size: i, bold: a, italic: o, family: s } = e.font;
|
|
4969
4967
|
return Object.assign(r.style, {
|
|
4970
4968
|
fontSize: `${i}px`,
|
|
4971
4969
|
fontWeight: a ? "bold" : "normal",
|
|
4972
4970
|
fontStyle: o ? "italic" : "normal",
|
|
4973
4971
|
fontFamily: s,
|
|
4974
|
-
lineHeight: String(
|
|
4972
|
+
lineHeight: String(To),
|
|
4975
4973
|
color: e.color,
|
|
4976
|
-
padding: `${
|
|
4974
|
+
padding: `${wo}px ${Co}px`
|
|
4977
4975
|
}), r.addEventListener("input", () => {
|
|
4978
4976
|
this.fit(), this.target?.onInput(r.value);
|
|
4979
4977
|
let e = this.target?.rect();
|
|
4980
|
-
e && this.place(e);
|
|
4978
|
+
e && this.place(e), this.fit(), e && this.place(e);
|
|
4981
4979
|
}), r.addEventListener("keydown", (e) => {
|
|
4982
|
-
e.stopPropagation(), !(e.isComposing || e.keyCode ===
|
|
4980
|
+
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)));
|
|
4983
4981
|
}), 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;
|
|
4984
4982
|
}
|
|
4985
4983
|
commit() {
|
|
@@ -5000,10 +4998,12 @@ var K = {
|
|
|
5000
4998
|
place(e) {
|
|
5001
4999
|
let t = this.area;
|
|
5002
5000
|
if (!t) return;
|
|
5003
|
-
let n = Math.max(
|
|
5004
|
-
t.style.maxWidth = `${n}px
|
|
5005
|
-
let r =
|
|
5006
|
-
t.style.
|
|
5001
|
+
let n = Math.max(Eo, window.innerWidth - jo * 2);
|
|
5002
|
+
t.style.maxWidth = `${n}px`;
|
|
5003
|
+
let r = Math.max(Eo, e.width + Do * 2 + Oo);
|
|
5004
|
+
t.style.width = `${Math.min(n, r)}px`, t.style.minHeight = `${e.height + Do * 2}px`;
|
|
5005
|
+
let i = t.offsetWidth || r, a = t.offsetHeight || e.height + Do * 2;
|
|
5006
|
+
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`;
|
|
5007
5007
|
}
|
|
5008
5008
|
offWindow(e) {
|
|
5009
5009
|
return e.x > window.innerWidth || e.x + e.width < 0 || e.y > window.innerHeight || e.y + e.height < 0;
|
|
@@ -5016,14 +5016,14 @@ var K = {
|
|
|
5016
5016
|
this.frame = requestAnimationFrame(() => {
|
|
5017
5017
|
if (!this.target || this.done) return;
|
|
5018
5018
|
let e = this.target.rect(), t = e !== null && this.offWindow(e);
|
|
5019
|
-
if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince >
|
|
5019
|
+
if (t ? this.offSince === 0 && (this.offSince = performance.now()) : this.offSince = 0, !e || t && performance.now() - this.offSince > Mo) {
|
|
5020
5020
|
this.finish(!0, !1);
|
|
5021
5021
|
return;
|
|
5022
5022
|
}
|
|
5023
5023
|
this.place(e), this.follow();
|
|
5024
5024
|
});
|
|
5025
5025
|
}
|
|
5026
|
-
},
|
|
5026
|
+
}, Po = [
|
|
5027
5027
|
{
|
|
5028
5028
|
id: "regularScale",
|
|
5029
5029
|
mode: "regular",
|
|
@@ -5044,7 +5044,7 @@ var K = {
|
|
|
5044
5044
|
mode: "indexedTo100",
|
|
5045
5045
|
label: "settings.scale.indexedTo100"
|
|
5046
5046
|
}
|
|
5047
|
-
],
|
|
5047
|
+
], Fo = [
|
|
5048
5048
|
{
|
|
5049
5049
|
action: "resetView",
|
|
5050
5050
|
keys: "Alt+R",
|
|
@@ -5061,20 +5061,20 @@ var K = {
|
|
|
5061
5061
|
feature: "hotkeys.goToDate"
|
|
5062
5062
|
}
|
|
5063
5063
|
];
|
|
5064
|
-
function
|
|
5065
|
-
return
|
|
5064
|
+
function Io(e) {
|
|
5065
|
+
return Po.find((t) => t.id === e)?.mode;
|
|
5066
5066
|
}
|
|
5067
|
-
function
|
|
5067
|
+
function Lo(...e) {
|
|
5068
5068
|
return e.filter((e) => e.length > 0).flatMap((e, t) => t === 0 ? [...e] : ["separator", ...e]);
|
|
5069
5069
|
}
|
|
5070
|
-
function
|
|
5070
|
+
function Ro(e, t) {
|
|
5071
5071
|
let n = t.keys[e.id];
|
|
5072
5072
|
return n ? {
|
|
5073
5073
|
...e,
|
|
5074
5074
|
shortcut: n
|
|
5075
5075
|
} : e;
|
|
5076
5076
|
}
|
|
5077
|
-
function
|
|
5077
|
+
function zo(e, t) {
|
|
5078
5078
|
if (e.price === void 0 || !Number.isFinite(e.price)) return [];
|
|
5079
5079
|
let n = e.formatPrice(e.price), r = [];
|
|
5080
5080
|
if (e.canAlert && r.push({
|
|
@@ -5111,13 +5111,13 @@ function Io(e, t) {
|
|
|
5111
5111
|
icon: "minus"
|
|
5112
5112
|
}), r;
|
|
5113
5113
|
}
|
|
5114
|
-
var
|
|
5114
|
+
var Bo = (e) => ({
|
|
5115
5115
|
id: "settings",
|
|
5116
5116
|
label: e("chartMenu.settings"),
|
|
5117
5117
|
icon: "settings"
|
|
5118
5118
|
});
|
|
5119
|
-
function
|
|
5120
|
-
let n = [
|
|
5119
|
+
function Vo(e, t) {
|
|
5120
|
+
let n = [Ro({
|
|
5121
5121
|
id: "resetView",
|
|
5122
5122
|
label: t("chartMenu.resetView")
|
|
5123
5123
|
}, e)];
|
|
@@ -5150,9 +5150,9 @@ function Ro(e, t) {
|
|
|
5150
5150
|
label: t("chartMenu.exportData"),
|
|
5151
5151
|
icon: "save"
|
|
5152
5152
|
}] : [];
|
|
5153
|
-
return
|
|
5153
|
+
return Lo(zo(e, t), n, r, [...i, Bo(t)]);
|
|
5154
5154
|
}
|
|
5155
|
-
function
|
|
5155
|
+
function Ho(e, t) {
|
|
5156
5156
|
let n = [
|
|
5157
5157
|
{
|
|
5158
5158
|
id: "resetPriceScale",
|
|
@@ -5163,7 +5163,7 @@ function zo(e, t) {
|
|
|
5163
5163
|
label: t("settings.autoScale"),
|
|
5164
5164
|
checked: e.autoScale
|
|
5165
5165
|
},
|
|
5166
|
-
|
|
5166
|
+
Ro({
|
|
5167
5167
|
id: "invertScale",
|
|
5168
5168
|
label: t("chartMenu.invertScale"),
|
|
5169
5169
|
checked: e.inverted
|
|
@@ -5173,7 +5173,7 @@ function zo(e, t) {
|
|
|
5173
5173
|
label: t("settings.leftScale"),
|
|
5174
5174
|
checked: e.leftScale
|
|
5175
5175
|
}
|
|
5176
|
-
], r =
|
|
5176
|
+
], r = Po.filter((t) => t.mode !== "logarithmic" || e.canLog).map((n) => ({
|
|
5177
5177
|
id: n.id,
|
|
5178
5178
|
label: t(n.label),
|
|
5179
5179
|
radio: !0,
|
|
@@ -5201,7 +5201,7 @@ function zo(e, t) {
|
|
|
5201
5201
|
label: t("chartMenu.lastPriceLine"),
|
|
5202
5202
|
checked: e.lines.lastPrice
|
|
5203
5203
|
}];
|
|
5204
|
-
return
|
|
5204
|
+
return Lo(n, r, [{
|
|
5205
5205
|
id: "labels",
|
|
5206
5206
|
label: t("chartMenu.labels"),
|
|
5207
5207
|
submenu: i
|
|
@@ -5209,18 +5209,18 @@ function zo(e, t) {
|
|
|
5209
5209
|
id: "lines",
|
|
5210
5210
|
label: t("chartMenu.lines"),
|
|
5211
5211
|
submenu: a
|
|
5212
|
-
}],
|
|
5212
|
+
}], zo({
|
|
5213
5213
|
...e,
|
|
5214
5214
|
canTrade: !1,
|
|
5215
5215
|
canDraw: !1
|
|
5216
|
-
}, t), [
|
|
5216
|
+
}, t), [Bo(t)]);
|
|
5217
5217
|
}
|
|
5218
|
-
function
|
|
5219
|
-
let n = [
|
|
5218
|
+
function Uo(e, t) {
|
|
5219
|
+
let n = [Ro({
|
|
5220
5220
|
id: "resetView",
|
|
5221
5221
|
label: t("chartMenu.resetTimeScale")
|
|
5222
5222
|
}, e)];
|
|
5223
|
-
e.canGoToDate && n.push(
|
|
5223
|
+
e.canGoToDate && n.push(Ro({
|
|
5224
5224
|
id: "goToDate",
|
|
5225
5225
|
label: t("chartMenu.goToDate"),
|
|
5226
5226
|
icon: "calendar"
|
|
@@ -5231,13 +5231,13 @@ function Bo(e, t) {
|
|
|
5231
5231
|
radio: !0,
|
|
5232
5232
|
checked: t.value === e.timezone.current
|
|
5233
5233
|
}));
|
|
5234
|
-
return
|
|
5234
|
+
return Lo(n, r.length > 0 ? [{
|
|
5235
5235
|
id: "timezone",
|
|
5236
5236
|
label: t("settings.timezone"),
|
|
5237
5237
|
submenu: r
|
|
5238
5238
|
}] : []);
|
|
5239
5239
|
}
|
|
5240
|
-
function
|
|
5240
|
+
function Wo(e, t) {
|
|
5241
5241
|
let n = e.pane ? [
|
|
5242
5242
|
{
|
|
5243
5243
|
id: "paneLog",
|
|
@@ -5255,53 +5255,53 @@ function Vo(e, t) {
|
|
|
5255
5255
|
checked: e.pane.percent
|
|
5256
5256
|
}
|
|
5257
5257
|
] : [];
|
|
5258
|
-
return
|
|
5258
|
+
return Lo([Ro({
|
|
5259
5259
|
id: "resetView",
|
|
5260
5260
|
label: t("chartMenu.resetView")
|
|
5261
|
-
}, e)], n, [
|
|
5261
|
+
}, e)], n, [Bo(t)]);
|
|
5262
5262
|
}
|
|
5263
|
-
function
|
|
5263
|
+
function Go(e, t, n) {
|
|
5264
5264
|
switch (e) {
|
|
5265
|
-
case "priceAxis": return
|
|
5266
|
-
case "timeAxis": return
|
|
5267
|
-
case "pane": return
|
|
5268
|
-
default: return
|
|
5265
|
+
case "priceAxis": return Ho(t, n);
|
|
5266
|
+
case "timeAxis": return Uo(t, n);
|
|
5267
|
+
case "pane": return Wo(t, n);
|
|
5268
|
+
default: return Vo(t, n);
|
|
5269
5269
|
}
|
|
5270
5270
|
}
|
|
5271
5271
|
//#endregion
|
|
5272
5272
|
//#region src/widget/signedFigure.ts
|
|
5273
|
-
var
|
|
5274
|
-
function
|
|
5275
|
-
let r = e.replace(
|
|
5276
|
-
return r === n.replace(
|
|
5273
|
+
var Ko = /^[-+−]/;
|
|
5274
|
+
function qo(e, t, n) {
|
|
5275
|
+
let r = e.replace(Ko, "");
|
|
5276
|
+
return r === n.replace(Ko, "") ? r : t > 0 ? `+${r}` : t < 0 ? `-${r}` : r;
|
|
5277
5277
|
}
|
|
5278
|
-
function
|
|
5278
|
+
function Jo(e) {
|
|
5279
5279
|
return e.startsWith("+") ? "up" : e.startsWith("-") ? "down" : null;
|
|
5280
5280
|
}
|
|
5281
5281
|
//#endregion
|
|
5282
5282
|
//#region src/widget/WidgetAccountPanel.ts
|
|
5283
|
-
var
|
|
5283
|
+
var Yo = [
|
|
5284
5284
|
"positions",
|
|
5285
5285
|
"orders",
|
|
5286
5286
|
"history"
|
|
5287
|
-
],
|
|
5287
|
+
], Xo = [
|
|
5288
5288
|
"order",
|
|
5289
5289
|
"close",
|
|
5290
5290
|
"reverse",
|
|
5291
5291
|
"stopLoss",
|
|
5292
5292
|
"takeProfit"
|
|
5293
|
-
],
|
|
5293
|
+
], Zo = [
|
|
5294
5294
|
"market",
|
|
5295
5295
|
"limit",
|
|
5296
5296
|
"stop"
|
|
5297
|
-
],
|
|
5298
|
-
function
|
|
5297
|
+
], Qo = ["gtc", "day"], q = "—", $o = "{pnl}", es = 3;
|
|
5298
|
+
function ts(e, t, n) {
|
|
5299
5299
|
return e.includes(t ?? "") ? t : n;
|
|
5300
5300
|
}
|
|
5301
|
-
function
|
|
5301
|
+
function ns(e, t) {
|
|
5302
5302
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
5303
5303
|
}
|
|
5304
|
-
function
|
|
5304
|
+
function rs(e, t) {
|
|
5305
5305
|
if (t === null) return null;
|
|
5306
5306
|
let n = e.quantity - (e.closedQuantity ?? 0), r = e.side === "buy" ? 1 : -1;
|
|
5307
5307
|
return {
|
|
@@ -5309,15 +5309,15 @@ function es(e, t) {
|
|
|
5309
5309
|
pct: e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * r
|
|
5310
5310
|
};
|
|
5311
5311
|
}
|
|
5312
|
-
function
|
|
5312
|
+
function is(e) {
|
|
5313
5313
|
let t = document.createElement("span");
|
|
5314
5314
|
return t.dir = "ltr", t.textContent = e, t;
|
|
5315
5315
|
}
|
|
5316
|
-
function
|
|
5317
|
-
let t =
|
|
5316
|
+
function as(e) {
|
|
5317
|
+
let t = Jo(e);
|
|
5318
5318
|
return t ? `tcw-account-${t}` : "";
|
|
5319
5319
|
}
|
|
5320
|
-
var
|
|
5320
|
+
var os = class {
|
|
5321
5321
|
el;
|
|
5322
5322
|
tabButtons = /* @__PURE__ */ new Map();
|
|
5323
5323
|
tabLabels = /* @__PURE__ */ new Map();
|
|
@@ -5339,7 +5339,7 @@ var rs = class {
|
|
|
5339
5339
|
r.className = "tcw-account-head";
|
|
5340
5340
|
let i = document.createElement("div");
|
|
5341
5341
|
i.className = "tcw-account-tabs", i.setAttribute("role", "tablist"), i.addEventListener("keydown", (e) => this.onTabKey(e));
|
|
5342
|
-
for (let e of
|
|
5342
|
+
for (let e of Yo) {
|
|
5343
5343
|
let t = document.createElement("button");
|
|
5344
5344
|
t.type = "button", t.className = "tcw-account-tab", t.setAttribute("role", "tab"), t.id = `tcw-account-tab-${e}`;
|
|
5345
5345
|
let n = document.createElement("span");
|
|
@@ -5367,7 +5367,7 @@ var rs = class {
|
|
|
5367
5367
|
}
|
|
5368
5368
|
update(e) {
|
|
5369
5369
|
let t = this.snapshot;
|
|
5370
|
-
if (this.snapshot = e,
|
|
5370
|
+
if (this.snapshot = e, ns(t.positions, e.positions) && ns(t.orders, e.orders) && ns(t.fills, e.fills) && t.realisedPnl === e.realisedPnl) {
|
|
5371
5371
|
t.price !== e.price && (this.renderTotals(), this.open && this.tab === "positions" && this.patchPrices());
|
|
5372
5372
|
return;
|
|
5373
5373
|
}
|
|
@@ -5380,10 +5380,10 @@ var rs = class {
|
|
|
5380
5380
|
this.tab = e, this.renderTabs(), this.render();
|
|
5381
5381
|
}
|
|
5382
5382
|
onTabKey(e) {
|
|
5383
|
-
let t =
|
|
5383
|
+
let t = Yo.indexOf(this.tab), n = e.key === "ArrowRight" ? t + 1 : e.key === "ArrowLeft" ? t - 1 : -2;
|
|
5384
5384
|
if (n === -2) return;
|
|
5385
5385
|
e.preventDefault();
|
|
5386
|
-
let r =
|
|
5386
|
+
let r = Yo[(n + Yo.length) % Yo.length];
|
|
5387
5387
|
this.selectTab(r), this.tabButtons.get(r)?.focus();
|
|
5388
5388
|
}
|
|
5389
5389
|
renderTabs() {
|
|
@@ -5400,15 +5400,15 @@ var rs = class {
|
|
|
5400
5400
|
}
|
|
5401
5401
|
renderTotals() {
|
|
5402
5402
|
let { positions: e, price: t, fills: n, realisedPnl: r } = this.snapshot, i = [], a = e.reduce((e, n) => {
|
|
5403
|
-
let r =
|
|
5403
|
+
let r = rs(n, t);
|
|
5404
5404
|
return r === null ? e : (e ?? 0) + r.pnl;
|
|
5405
5405
|
}, null);
|
|
5406
5406
|
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);
|
|
5407
5407
|
}
|
|
5408
5408
|
total(e, t) {
|
|
5409
5409
|
let n = document.createElement("span"), r = this.amount(t);
|
|
5410
|
-
n.className = `tcw-account-total ${
|
|
5411
|
-
let i = this.t(e), a = i.indexOf(
|
|
5410
|
+
n.className = `tcw-account-total ${as(r)}`.trim();
|
|
5411
|
+
let i = this.t(e), a = i.indexOf($o), o = is(r);
|
|
5412
5412
|
return a < 0 ? n.append(`${i} `, o) : n.append(i.slice(0, a), o, i.slice(a + 5)), n;
|
|
5413
5413
|
}
|
|
5414
5414
|
render() {
|
|
@@ -5417,17 +5417,17 @@ var rs = class {
|
|
|
5417
5417
|
}
|
|
5418
5418
|
patchPrices() {
|
|
5419
5419
|
let { price: e } = this.snapshot;
|
|
5420
|
-
for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl,
|
|
5420
|
+
for (let t of this.live) t.price.textContent = e === null ? q : this.callbacks.formatPrice(e), this.writePnl(t.pnl, rs(t.position, e));
|
|
5421
5421
|
}
|
|
5422
5422
|
amount(e) {
|
|
5423
|
-
return
|
|
5423
|
+
return qo(this.money(Math.abs(e)), e, this.money(0));
|
|
5424
5424
|
}
|
|
5425
5425
|
money(e) {
|
|
5426
5426
|
return this.callbacks.formatAmount ? this.callbacks.formatAmount(e) : e.toFixed(2);
|
|
5427
5427
|
}
|
|
5428
5428
|
percent(e) {
|
|
5429
5429
|
let t = (e) => this.callbacks.formatNumber ? this.callbacks.formatNumber(e, 2) : e.toFixed(2);
|
|
5430
|
-
return `${
|
|
5430
|
+
return `${qo(t(Math.abs(e)), e, t(0))}%`;
|
|
5431
5431
|
}
|
|
5432
5432
|
writePnl(e, t) {
|
|
5433
5433
|
if (t === null) {
|
|
@@ -5435,7 +5435,7 @@ var rs = class {
|
|
|
5435
5435
|
return;
|
|
5436
5436
|
}
|
|
5437
5437
|
let n = this.amount(t.pnl);
|
|
5438
|
-
e.className =
|
|
5438
|
+
e.className = as(n), e.textContent = `${n} · ${this.percent(t.pct)}`;
|
|
5439
5439
|
}
|
|
5440
5440
|
table(e, t, n) {
|
|
5441
5441
|
if (t.length === 0) {
|
|
@@ -5480,8 +5480,8 @@ var rs = class {
|
|
|
5480
5480
|
}
|
|
5481
5481
|
renderPositions() {
|
|
5482
5482
|
let { formatPrice: e } = this.callbacks, { price: t } = this.snapshot, n = [], r = this.snapshot.positions.map((r) => {
|
|
5483
|
-
let i = r.quantity - (r.closedQuantity ?? 0), a =
|
|
5484
|
-
this.writePnl(a,
|
|
5483
|
+
let i = r.quantity - (r.closedQuantity ?? 0), a = is("");
|
|
5484
|
+
this.writePnl(a, rs(r, t)), n.push(a);
|
|
5485
5485
|
let o = `${this.sideText(r.side, "position")} ${i} @ ${e(r.entryPrice)}`;
|
|
5486
5486
|
return [
|
|
5487
5487
|
this.sideCell(r.side),
|
|
@@ -5536,13 +5536,13 @@ var rs = class {
|
|
|
5536
5536
|
let a = [...i.tBodies[0].rows];
|
|
5537
5537
|
this.snapshot.positions.forEach((e, t) => this.live.push({
|
|
5538
5538
|
position: e,
|
|
5539
|
-
price: a[t].cells[
|
|
5539
|
+
price: a[t].cells[es],
|
|
5540
5540
|
pnl: n[t]
|
|
5541
5541
|
}));
|
|
5542
5542
|
}
|
|
5543
5543
|
renderOrders() {
|
|
5544
5544
|
let { formatPrice: e } = this.callbacks, t = this.snapshot.orders.map((t) => {
|
|
5545
|
-
let n =
|
|
5545
|
+
let n = ts(Zo, t.type === "stopLimit" ? "stop" : t.type, "limit"), r = `${this.sideText(t.side, "trade")} ${t.quantity} @ ${e(t.price)}`;
|
|
5546
5546
|
return [
|
|
5547
5547
|
this.sideCell(t.side, "trade"),
|
|
5548
5548
|
this.t(`ticket.type.${n}`),
|
|
@@ -5550,7 +5550,7 @@ var rs = class {
|
|
|
5550
5550
|
e(t.price),
|
|
5551
5551
|
this.price(t.stopLoss),
|
|
5552
5552
|
this.price(t.takeProfit),
|
|
5553
|
-
t.timeInForce ? this.t(`ticket.tif.${Qo
|
|
5553
|
+
t.timeInForce ? this.t(`ticket.tif.${ts(Qo, t.timeInForce, "gtc")}`) : q,
|
|
5554
5554
|
this.actions({
|
|
5555
5555
|
icon: "x",
|
|
5556
5556
|
label: `${this.t("account.cancelOrder")}: ${r}`,
|
|
@@ -5585,13 +5585,13 @@ var rs = class {
|
|
|
5585
5585
|
}
|
|
5586
5586
|
renderHistory() {
|
|
5587
5587
|
let { formatPrice: e, formatTime: t } = this.callbacks, n = [...this.snapshot.fills].reverse().map((n) => {
|
|
5588
|
-
let r =
|
|
5589
|
-
return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className =
|
|
5588
|
+
let r = is("");
|
|
5589
|
+
return n.pnl === void 0 ? r.textContent = q : (r.textContent = this.amount(n.pnl), r.className = as(r.textContent)), [
|
|
5590
5590
|
t(n.time),
|
|
5591
5591
|
this.sideCell(n.side, "trade"),
|
|
5592
5592
|
String(n.quantity),
|
|
5593
5593
|
e(n.price),
|
|
5594
|
-
this.t(`account.reason.${
|
|
5594
|
+
this.t(`account.reason.${ts(Xo, n.reason, "order")}`),
|
|
5595
5595
|
r
|
|
5596
5596
|
];
|
|
5597
5597
|
});
|
|
@@ -5613,11 +5613,11 @@ var rs = class {
|
|
|
5613
5613
|
}
|
|
5614
5614
|
], n, "account.noFills");
|
|
5615
5615
|
}
|
|
5616
|
-
},
|
|
5617
|
-
function
|
|
5616
|
+
}, ss = 1e-9;
|
|
5617
|
+
function cs(e, t) {
|
|
5618
5618
|
return e.type === "market" ? t : e.price;
|
|
5619
5619
|
}
|
|
5620
|
-
function
|
|
5620
|
+
function ls(e, t, n = {}) {
|
|
5621
5621
|
let r = [];
|
|
5622
5622
|
(!(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");
|
|
5623
5623
|
let i = e.side === "buy";
|
|
@@ -5627,18 +5627,18 @@ function os(e, t, n = {}) {
|
|
|
5627
5627
|
}
|
|
5628
5628
|
let a = (e) => e === null || Number.isFinite(e) && e > 0;
|
|
5629
5629
|
a(e.stopLoss) || r.push("stopLoss"), a(e.takeProfit) || r.push("takeProfit");
|
|
5630
|
-
let o =
|
|
5631
|
-
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, ...
|
|
5630
|
+
let o = cs(e, t);
|
|
5631
|
+
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)];
|
|
5632
5632
|
}
|
|
5633
|
-
function
|
|
5633
|
+
function us(e, t) {
|
|
5634
5634
|
let n = [], r = e.type === "market" ? null : e.price, i = [
|
|
5635
5635
|
r,
|
|
5636
5636
|
e.stopLoss,
|
|
5637
5637
|
e.takeProfit
|
|
5638
5638
|
].filter((e) => e !== null && Number.isFinite(e) && e > 0), { roundPrice: a, limits: o, lot: s } = t;
|
|
5639
|
-
return a && i.some((e) => Math.abs(a(e) - e) >
|
|
5639
|
+
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;
|
|
5640
5640
|
}
|
|
5641
|
-
function
|
|
5641
|
+
function ds(e, t) {
|
|
5642
5642
|
let n = {
|
|
5643
5643
|
side: e.side,
|
|
5644
5644
|
type: e.type,
|
|
@@ -5647,14 +5647,14 @@ function cs(e, t) {
|
|
|
5647
5647
|
};
|
|
5648
5648
|
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;
|
|
5649
5649
|
}
|
|
5650
|
-
function
|
|
5651
|
-
let n =
|
|
5650
|
+
function fs(e, t) {
|
|
5651
|
+
let n = cs(e, t);
|
|
5652
5652
|
if (n === null || e.stopLoss === null || e.takeProfit === null) return null;
|
|
5653
5653
|
let r = Math.abs(n - e.stopLoss);
|
|
5654
5654
|
return r > 0 ? Math.abs(e.takeProfit - n) / r : null;
|
|
5655
5655
|
}
|
|
5656
|
-
function
|
|
5657
|
-
let i =
|
|
5656
|
+
function ps(e, t, n, r = 1) {
|
|
5657
|
+
let i = cs(e, t);
|
|
5658
5658
|
if (i === null || !(i > 0) || !Number.isFinite(n) || !(e.quantity > 0)) return null;
|
|
5659
5659
|
let a = e.side === "buy" ? 1 : -1;
|
|
5660
5660
|
return {
|
|
@@ -5662,18 +5662,18 @@ function us(e, t, n, r = 1) {
|
|
|
5662
5662
|
amount: (n - i) * e.quantity * a * r
|
|
5663
5663
|
};
|
|
5664
5664
|
}
|
|
5665
|
-
function
|
|
5666
|
-
let r = n.multiplier !== void 0 && n.multiplier > 0 ? n.multiplier : 1, i =
|
|
5665
|
+
function ms(e, t, n = {}) {
|
|
5666
|
+
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");
|
|
5667
5667
|
return {
|
|
5668
5668
|
value: a,
|
|
5669
5669
|
risk: c,
|
|
5670
5670
|
reward: l,
|
|
5671
|
-
ratio: c !== null && l !== null ?
|
|
5671
|
+
ratio: c !== null && l !== null ? fs(e, t) : null
|
|
5672
5672
|
};
|
|
5673
5673
|
}
|
|
5674
5674
|
//#endregion
|
|
5675
5675
|
//#region src/widget/WidgetOrderTicket.ts
|
|
5676
|
-
var
|
|
5676
|
+
var hs = 229, gs = 1, _s = 2, vs = .999999999, ys = 0, bs = class {
|
|
5677
5677
|
backdrop;
|
|
5678
5678
|
modal;
|
|
5679
5679
|
symbolEl;
|
|
@@ -5684,11 +5684,11 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5684
5684
|
draft = null;
|
|
5685
5685
|
lastPrice = null;
|
|
5686
5686
|
rules = {};
|
|
5687
|
-
step =
|
|
5688
|
-
round = (e) =>
|
|
5687
|
+
step = Ss;
|
|
5688
|
+
round = (e) => Cs(e, e);
|
|
5689
5689
|
typed = /* @__PURE__ */ new Map();
|
|
5690
5690
|
returnFocus = null;
|
|
5691
|
-
uid = ++
|
|
5691
|
+
uid = ++ys;
|
|
5692
5692
|
constructor(e, t, n = T) {
|
|
5693
5693
|
this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
5694
5694
|
let r = !1;
|
|
@@ -5697,7 +5697,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5697
5697
|
}), this.backdrop.addEventListener("click", (e) => {
|
|
5698
5698
|
e.target === this.backdrop && r && this.close(), r = !1;
|
|
5699
5699
|
}), 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) => {
|
|
5700
|
-
if (e.key === "Escape" && !e.isComposing && e.keyCode !==
|
|
5700
|
+
if (e.key === "Escape" && !e.isComposing && e.keyCode !== hs) {
|
|
5701
5701
|
e.stopPropagation(), this.close();
|
|
5702
5702
|
return;
|
|
5703
5703
|
}
|
|
@@ -5719,7 +5719,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5719
5719
|
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);
|
|
5720
5720
|
}
|
|
5721
5721
|
open(e) {
|
|
5722
|
-
this.returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.lastPrice = e.lastPrice, this.rules = e.rules ?? {}, this.step = e.step ??
|
|
5722
|
+
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) : "";
|
|
5723
5723
|
let t = this.round(e.price ?? e.lastPrice ?? 0), n = e.side ?? "buy", r = "market";
|
|
5724
5724
|
e.price !== void 0 && e.lastPrice !== null && t !== e.lastPrice && (r = t < e.lastPrice == (n === "buy") ? "limit" : "stop"), this.draft = {
|
|
5725
5725
|
side: n,
|
|
@@ -5755,14 +5755,14 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5755
5755
|
return t > 0 ? Number((10 ** -t).toFixed(t)) : 1;
|
|
5756
5756
|
}
|
|
5757
5757
|
priceStep(e, t) {
|
|
5758
|
-
return this.step(t > 0 ? e : e *
|
|
5758
|
+
return this.step(t > 0 ? e : e * vs);
|
|
5759
5759
|
}
|
|
5760
5760
|
writePrice(e) {
|
|
5761
|
-
return Number.isFinite(e) ? this.step ===
|
|
5761
|
+
return Number.isFinite(e) ? this.step === Ss ? String(e) : e.toFixed(gt(this.step(e))) : "";
|
|
5762
5762
|
}
|
|
5763
5763
|
place() {
|
|
5764
5764
|
let e = this.draft;
|
|
5765
|
-
!e ||
|
|
5765
|
+
!e || ls(e, this.lastPrice, this.rules).length > 0 || (this.callbacks.onSubmit(ds(e, this.lastPrice)), this.close());
|
|
5766
5766
|
}
|
|
5767
5767
|
set(e, t = !1) {
|
|
5768
5768
|
this.draft && (this.draft = {
|
|
@@ -5797,7 +5797,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5797
5797
|
return r.className = "tcw-settings-label", r.textContent = this.t(e), n.append(r, t), n;
|
|
5798
5798
|
}
|
|
5799
5799
|
choices(e, t, n, r, i) {
|
|
5800
|
-
let a = e === "type" ? "ticket.type" : "ticket.tif", o =
|
|
5800
|
+
let a = e === "type" ? "ticket.type" : "ticket.tif", o = xs(e, Pe(t.map((e) => ({
|
|
5801
5801
|
value: e,
|
|
5802
5802
|
label: this.t(`${a}.${e}`)
|
|
5803
5803
|
})), n, i, this.t(r)));
|
|
@@ -5830,7 +5830,7 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5830
5830
|
return this.stepped(e, t, (e, t) => this.priceStep(e, t), () => this.lastPrice ?? this.draft?.price ?? 0, (e) => this.writePrice(e), n);
|
|
5831
5831
|
}
|
|
5832
5832
|
stepped(e, t, n, r, i, a) {
|
|
5833
|
-
let o =
|
|
5833
|
+
let o = xs(e, document.createElement("input"));
|
|
5834
5834
|
o.type = "number", o.className = "tcw-indi-input", o.step = "any", o.min = "0", o.value = this.typed.get(e) ?? i(t);
|
|
5835
5835
|
let s = this.t(`ticket.${e}`);
|
|
5836
5836
|
o.setAttribute("aria-label", s), o.addEventListener("input", () => {
|
|
@@ -5868,25 +5868,25 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5868
5868
|
if (!t) return NaN;
|
|
5869
5869
|
let n = t.type === "market" ? this.lastPrice ?? t.price : t.price;
|
|
5870
5870
|
if (!(n > 0)) return NaN;
|
|
5871
|
-
let r = e === "stopLoss" ? -
|
|
5871
|
+
let r = e === "stopLoss" ? -gs : _s;
|
|
5872
5872
|
return this.round(n * (1 + (t.side === "buy" ? r : -r) / 100));
|
|
5873
5873
|
}
|
|
5874
5874
|
check() {
|
|
5875
5875
|
let e = this.draft;
|
|
5876
5876
|
if (!e) return;
|
|
5877
|
-
let t =
|
|
5877
|
+
let t = ls(e, this.lastPrice, this.rules), n = t.map((e) => this.problemText(e));
|
|
5878
5878
|
n.join("\n") !== [...this.problemsEl.children].map((e) => e.textContent).join("\n") && this.problemsEl.replaceChildren(...n.map((e) => {
|
|
5879
5879
|
let t = document.createElement("p");
|
|
5880
5880
|
return t.textContent = e, t;
|
|
5881
5881
|
}));
|
|
5882
5882
|
for (let t of ["stopLoss", "takeProfit"]) {
|
|
5883
|
-
let n = this.body.querySelector(`.tcw-ticket-away[data-for="${t}"]`), r = e[t], i = r === null ? null :
|
|
5883
|
+
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);
|
|
5884
5884
|
n && (n.textContent = i ? `${this.signedNumber(i.pct, 2)}% · ${this.amount(i.amount)}` : "");
|
|
5885
5885
|
}
|
|
5886
5886
|
this.renderSummary(e), this.submit.disabled = t.length > 0, this.submit.textContent = this.t(e.side === "buy" ? "ticket.placeBuy" : "ticket.placeSell");
|
|
5887
5887
|
}
|
|
5888
5888
|
renderSummary(e) {
|
|
5889
|
-
let t =
|
|
5889
|
+
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 = [
|
|
5890
5890
|
[
|
|
5891
5891
|
"value",
|
|
5892
5892
|
"ticket.value",
|
|
@@ -5897,13 +5897,13 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5897
5897
|
"risk",
|
|
5898
5898
|
"ticket.risk",
|
|
5899
5899
|
n,
|
|
5900
|
-
n === null ? null :
|
|
5900
|
+
n === null ? null : Jo(n)
|
|
5901
5901
|
],
|
|
5902
5902
|
[
|
|
5903
5903
|
"reward",
|
|
5904
5904
|
"ticket.reward",
|
|
5905
5905
|
r,
|
|
5906
|
-
r === null ? null :
|
|
5906
|
+
r === null ? null : Jo(r)
|
|
5907
5907
|
],
|
|
5908
5908
|
[
|
|
5909
5909
|
"ratio",
|
|
@@ -5925,10 +5925,10 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5925
5925
|
return this.callbacks.formatNumber ? this.callbacks.formatNumber(e, t) : e.toFixed(t);
|
|
5926
5926
|
}
|
|
5927
5927
|
signedNumber(e, t) {
|
|
5928
|
-
return
|
|
5928
|
+
return qo(this.number(Math.abs(e), t), e, this.number(0, t));
|
|
5929
5929
|
}
|
|
5930
5930
|
amount(e) {
|
|
5931
|
-
return
|
|
5931
|
+
return qo(this.money(Math.abs(e)), e, this.money(0));
|
|
5932
5932
|
}
|
|
5933
5933
|
money(e) {
|
|
5934
5934
|
return (this.callbacks.formatAmount ?? this.callbacks.formatPrice)(e);
|
|
@@ -5941,20 +5941,20 @@ var fs = 229, ps = 1, ms = 2, hs = .999999999, gs = 0, _s = class {
|
|
|
5941
5941
|
}) : e === "lot" ? w(t, { lot: r ?? 1 }) : t;
|
|
5942
5942
|
}
|
|
5943
5943
|
};
|
|
5944
|
-
function
|
|
5944
|
+
function xs(e, t) {
|
|
5945
5945
|
return t.dataset.ticketField = e, t;
|
|
5946
5946
|
}
|
|
5947
|
-
function
|
|
5947
|
+
function Ss(e) {
|
|
5948
5948
|
let t = Math.abs(e);
|
|
5949
5949
|
return t > 0 ? 10 ** Math.floor(Math.log10(t / 100)) : 1;
|
|
5950
5950
|
}
|
|
5951
|
-
function
|
|
5951
|
+
function Cs(e, t) {
|
|
5952
5952
|
let n = Math.abs(t), r = n >= 10 || n === 0 ? 2 : n >= 1 ? 4 : Math.min(10, Math.ceil(-Math.log10(n)) + 3);
|
|
5953
5953
|
return Number(e.toFixed(r));
|
|
5954
5954
|
}
|
|
5955
5955
|
//#endregion
|
|
5956
5956
|
//#region src/widget/WidgetNamePrompt.ts
|
|
5957
|
-
var
|
|
5957
|
+
var ws = 0, Ts = class {
|
|
5958
5958
|
backdrop;
|
|
5959
5959
|
titleEl;
|
|
5960
5960
|
input;
|
|
@@ -5962,7 +5962,7 @@ var xs = 0, Ss = class {
|
|
|
5962
5962
|
request = null;
|
|
5963
5963
|
returnFocus = null;
|
|
5964
5964
|
busy = !1;
|
|
5965
|
-
uid = ++
|
|
5965
|
+
uid = ++ws;
|
|
5966
5966
|
constructor(e, t = T) {
|
|
5967
5967
|
this.t = t, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
5968
5968
|
let n = !1;
|
|
@@ -6022,13 +6022,13 @@ var xs = 0, Ss = class {
|
|
|
6022
6022
|
}
|
|
6023
6023
|
}
|
|
6024
6024
|
}
|
|
6025
|
-
},
|
|
6025
|
+
}, Es = 0, Ds = class {
|
|
6026
6026
|
el;
|
|
6027
6027
|
input;
|
|
6028
6028
|
hint;
|
|
6029
6029
|
returnFocus = null;
|
|
6030
6030
|
constructor(e, t, n) {
|
|
6031
|
-
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-${++
|
|
6031
|
+
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) => {
|
|
6032
6032
|
e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), this.apply()) : e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), this.close());
|
|
6033
6033
|
}), this.input.addEventListener("blur", () => this.close(!1));
|
|
6034
6034
|
}
|
|
@@ -6059,7 +6059,7 @@ var xs = 0, Ss = class {
|
|
|
6059
6059
|
}
|
|
6060
6060
|
this.input.setAttribute("aria-invalid", "true"), this.hint.textContent = this.labels.invalid;
|
|
6061
6061
|
}
|
|
6062
|
-
},
|
|
6062
|
+
}, Os = class {
|
|
6063
6063
|
constructor(e = "tcw:indicator-templates") {
|
|
6064
6064
|
this.key = e;
|
|
6065
6065
|
}
|
|
@@ -6104,28 +6104,28 @@ var xs = 0, Ss = class {
|
|
|
6104
6104
|
localStorage.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
|
|
6105
6105
|
} catch {}
|
|
6106
6106
|
}
|
|
6107
|
-
},
|
|
6107
|
+
}, ks = [
|
|
6108
6108
|
"regular",
|
|
6109
6109
|
"logarithmic",
|
|
6110
6110
|
"percentage",
|
|
6111
6111
|
"indexedTo100"
|
|
6112
|
-
],
|
|
6113
|
-
function
|
|
6112
|
+
], As = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
6113
|
+
function js(e) {
|
|
6114
6114
|
let { theme: t, timestamp: n, ...r } = e;
|
|
6115
6115
|
return r;
|
|
6116
6116
|
}
|
|
6117
|
-
function
|
|
6118
|
-
return !
|
|
6117
|
+
function Ms(e) {
|
|
6118
|
+
return !As(e) || e.v !== 1 || typeof e.symbol != "string" || !e.symbol || typeof e.timeframe != "string" || !(nt(e.timeframe) || D(e.timeframe) !== null) ? null : {
|
|
6119
6119
|
v: 1,
|
|
6120
6120
|
symbol: e.symbol,
|
|
6121
6121
|
timeframe: e.timeframe,
|
|
6122
|
-
scaleMode:
|
|
6122
|
+
scaleMode: ks.find((t) => t === e.scaleMode) ?? "regular",
|
|
6123
6123
|
invertScale: e.invertScale === !0,
|
|
6124
|
-
chart:
|
|
6125
|
-
...
|
|
6124
|
+
chart: As(e.chart) ? js(e.chart) : null,
|
|
6125
|
+
...As(e.settings) ? { settings: W(e.settings, Pa) } : {}
|
|
6126
6126
|
};
|
|
6127
6127
|
}
|
|
6128
|
-
function
|
|
6128
|
+
function Ns(e) {
|
|
6129
6129
|
try {
|
|
6130
6130
|
return JSON.parse(e);
|
|
6131
6131
|
} catch {
|
|
@@ -6134,16 +6134,16 @@ function As(e) {
|
|
|
6134
6134
|
}
|
|
6135
6135
|
//#endregion
|
|
6136
6136
|
//#region src/widget/DrawingFavoritesStore.ts
|
|
6137
|
-
function
|
|
6137
|
+
function Ps() {
|
|
6138
6138
|
try {
|
|
6139
6139
|
return typeof localStorage < "u" ? localStorage : null;
|
|
6140
6140
|
} catch {
|
|
6141
6141
|
return null;
|
|
6142
6142
|
}
|
|
6143
6143
|
}
|
|
6144
|
-
var
|
|
6144
|
+
var Fs = class {
|
|
6145
6145
|
favorites = [];
|
|
6146
|
-
constructor(e = "tcw:draw-favorites", t =
|
|
6146
|
+
constructor(e = "tcw:draw-favorites", t = Ps()) {
|
|
6147
6147
|
this.storageKey = e, this.storage = t, this.load();
|
|
6148
6148
|
}
|
|
6149
6149
|
list() {
|
|
@@ -6180,7 +6180,7 @@ var Ms = class {
|
|
|
6180
6180
|
};
|
|
6181
6181
|
//#endregion
|
|
6182
6182
|
//#region src/widget/keyboardInset.ts
|
|
6183
|
-
function
|
|
6183
|
+
function Is(e) {
|
|
6184
6184
|
let t = typeof window < "u" ? window.visualViewport : null;
|
|
6185
6185
|
if (!t) return () => {};
|
|
6186
6186
|
let n = -1, r = () => {
|
|
@@ -6194,7 +6194,7 @@ function Ns(e) {
|
|
|
6194
6194
|
t.removeEventListener("resize", r), t.removeEventListener("scroll", r);
|
|
6195
6195
|
};
|
|
6196
6196
|
}
|
|
6197
|
-
function
|
|
6197
|
+
function Ls(e, t) {
|
|
6198
6198
|
let n = null, r = () => {
|
|
6199
6199
|
let r = e.clientWidth;
|
|
6200
6200
|
if (r === 0 && n !== null) return;
|
|
@@ -6218,7 +6218,7 @@ function J(e) {
|
|
|
6218
6218
|
}
|
|
6219
6219
|
};
|
|
6220
6220
|
}
|
|
6221
|
-
var
|
|
6221
|
+
var Rs = class {
|
|
6222
6222
|
part = null;
|
|
6223
6223
|
loading = null;
|
|
6224
6224
|
gone = !1;
|
|
@@ -6244,23 +6244,23 @@ var Fs = class {
|
|
|
6244
6244
|
this.gone = !0, this.part && this.dispose(this.part), this.part = null;
|
|
6245
6245
|
}
|
|
6246
6246
|
}, Y = {
|
|
6247
|
-
settings: J(() => import("../WidgetSettings-
|
|
6248
|
-
indicatorSettings: J(() => import("../WidgetIndicatorSettings-
|
|
6249
|
-
drawingSettings: J(() => import("../WidgetDrawingSettings-
|
|
6247
|
+
settings: J(() => import("../WidgetSettings-BsjEg-Dj.js")),
|
|
6248
|
+
indicatorSettings: J(() => import("../WidgetIndicatorSettings-D3W40Nud.js")),
|
|
6249
|
+
drawingSettings: J(() => import("../WidgetDrawingSettings-Cwds8CdJ.js")),
|
|
6250
6250
|
goToDate: J(() => import("../WidgetGoToDate-hcDtezRm.js")),
|
|
6251
6251
|
hotkeySheet: J(() => import("../WidgetHotkeySheet-1lRFSdvt.js")),
|
|
6252
|
-
indicatorPicker: J(() => import("../WidgetIndicatorPicker-
|
|
6253
|
-
commandPalette: J(() => import("../WidgetCommandPalette-
|
|
6254
|
-
symbolSearch: J(() => import("../WidgetSymbolSearch-
|
|
6252
|
+
indicatorPicker: J(() => import("../WidgetIndicatorPicker-DsFCT2xZ.js")),
|
|
6253
|
+
commandPalette: J(() => import("../WidgetCommandPalette-DpP-lG1A.js")),
|
|
6254
|
+
symbolSearch: J(() => import("../WidgetSymbolSearch-Cxxq4SrK.js"))
|
|
6255
6255
|
};
|
|
6256
|
-
async function
|
|
6256
|
+
async function zs() {
|
|
6257
6257
|
await Promise.all(Object.values(Y).map((e) => e.load().catch(() => null)));
|
|
6258
6258
|
}
|
|
6259
6259
|
//#endregion
|
|
6260
6260
|
//#region src/widget/wallTime.ts
|
|
6261
|
-
var
|
|
6262
|
-
function
|
|
6263
|
-
let r =
|
|
6261
|
+
var Bs = /^(\d{4})-(\d{2})-(\d{2})$/, Vs = /^(\d{2}):(\d{2})$/;
|
|
6262
|
+
function Hs(e, t, n) {
|
|
6263
|
+
let r = Bs.exec(e), i = t ? Vs.exec(t) : [
|
|
6264
6264
|
"",
|
|
6265
6265
|
"00",
|
|
6266
6266
|
"00"
|
|
@@ -6290,7 +6290,7 @@ var Z = {
|
|
|
6290
6290
|
min: 233,
|
|
6291
6291
|
default: 262,
|
|
6292
6292
|
max: 377
|
|
6293
|
-
},
|
|
6293
|
+
}, Us = .382, Ws = (e) => !e.hidden && getComputedStyle(e).display !== "none", Gs = class {
|
|
6294
6294
|
element;
|
|
6295
6295
|
panel;
|
|
6296
6296
|
rail;
|
|
@@ -6337,7 +6337,7 @@ var Z = {
|
|
|
6337
6337
|
let t = this.panel.contains(document.activeElement);
|
|
6338
6338
|
if (this.hideCurrent(), this.panel.hidden = !0, t) {
|
|
6339
6339
|
let t = this.pages.get(e)?.button;
|
|
6340
|
-
(t && (this.options.railShown?.() ?? !0) &&
|
|
6340
|
+
(t && (this.options.railShown?.() ?? !0) && Ws(t) ? t : this.options.focusAfterClose?.(e))?.focus();
|
|
6341
6341
|
}
|
|
6342
6342
|
this.options.onChange?.(null);
|
|
6343
6343
|
}
|
|
@@ -6354,7 +6354,7 @@ var Z = {
|
|
|
6354
6354
|
return this.open_ === e;
|
|
6355
6355
|
}
|
|
6356
6356
|
syncRail() {
|
|
6357
|
-
let e = [...this.pages.values()].map((e) => e.button), t = e.filter(
|
|
6357
|
+
let e = [...this.pages.values()].map((e) => e.button), t = e.filter(Ws), n = e.find((e) => e.tabIndex === 0);
|
|
6358
6358
|
if (n && t.includes(n)) return;
|
|
6359
6359
|
let r = t.find((e) => e.getAttribute("aria-pressed") === "true") ?? t[0];
|
|
6360
6360
|
for (let t of e) t.tabIndex = t === r ? 0 : -1;
|
|
@@ -6378,7 +6378,7 @@ var Z = {
|
|
|
6378
6378
|
}
|
|
6379
6379
|
maxNow() {
|
|
6380
6380
|
let e = this.options.room?.() ?? 0, t = Math.round(Z.max * this.scale);
|
|
6381
|
-
return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e *
|
|
6381
|
+
return e <= 0 ? t : Math.max(this.min(), Math.min(t, Math.floor(e * Us)));
|
|
6382
6382
|
}
|
|
6383
6383
|
clamp(e, t = this.maxNow()) {
|
|
6384
6384
|
return Math.round(Math.min(t, Math.max(this.min(), e)));
|
|
@@ -6422,12 +6422,12 @@ var Z = {
|
|
|
6422
6422
|
for (let { button: t } of this.pages.values()) t.tabIndex = t === e ? 0 : -1;
|
|
6423
6423
|
}
|
|
6424
6424
|
onRailKey(e) {
|
|
6425
|
-
let t = [...this.pages.values()].map((e) => e.button).filter(
|
|
6425
|
+
let t = [...this.pages.values()].map((e) => e.button).filter(Ws), n = t.indexOf(e.target);
|
|
6426
6426
|
if (n < 0) return;
|
|
6427
6427
|
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;
|
|
6428
6428
|
r < 0 || (e.preventDefault(), t[r].focus());
|
|
6429
6429
|
}
|
|
6430
|
-
},
|
|
6430
|
+
}, Ks = [
|
|
6431
6431
|
"percent",
|
|
6432
6432
|
"scale",
|
|
6433
6433
|
"pane",
|
|
@@ -6435,7 +6435,7 @@ var Z = {
|
|
|
6435
6435
|
"ratio",
|
|
6436
6436
|
"correlation",
|
|
6437
6437
|
"correlationLog"
|
|
6438
|
-
],
|
|
6438
|
+
], qs = {
|
|
6439
6439
|
percent: "compare.percent",
|
|
6440
6440
|
scale: "compare.ownScale",
|
|
6441
6441
|
pane: "compare.ownPane",
|
|
@@ -6444,24 +6444,24 @@ var Z = {
|
|
|
6444
6444
|
correlation: "compare.way.correlation",
|
|
6445
6445
|
correlationLog: "compare.way.correlationLog"
|
|
6446
6446
|
};
|
|
6447
|
-
function
|
|
6448
|
-
return
|
|
6447
|
+
function Js(e) {
|
|
6448
|
+
return Ks.includes(e);
|
|
6449
6449
|
}
|
|
6450
|
-
function
|
|
6451
|
-
return
|
|
6450
|
+
function Ys(e) {
|
|
6451
|
+
return Ks.map((t) => ({
|
|
6452
6452
|
id: t,
|
|
6453
|
-
label: e(
|
|
6453
|
+
label: e(qs[t])
|
|
6454
6454
|
}));
|
|
6455
6455
|
}
|
|
6456
|
-
function
|
|
6456
|
+
function Xs(e, t) {
|
|
6457
6457
|
let n = e.findIndex((e) => e.time >= t);
|
|
6458
6458
|
return n < 0 ? e.length : n;
|
|
6459
6459
|
}
|
|
6460
|
-
function
|
|
6460
|
+
function Zs(e, t) {
|
|
6461
6461
|
let n = e[0]?.time ?? Infinity, r = t.filter((e) => e.time < n);
|
|
6462
6462
|
return r.length > 0 ? [...r, ...e] : null;
|
|
6463
6463
|
}
|
|
6464
|
-
function
|
|
6464
|
+
function Qs(e, t) {
|
|
6465
6465
|
switch (e.id) {
|
|
6466
6466
|
case "compareSymbol": return t ? "pane" : "scale";
|
|
6467
6467
|
case "compareSymbolPane": return "pane";
|
|
@@ -6471,24 +6471,24 @@ function Ys(e, t) {
|
|
|
6471
6471
|
default: return null;
|
|
6472
6472
|
}
|
|
6473
6473
|
}
|
|
6474
|
-
function
|
|
6474
|
+
function $s(e, t, n, r) {
|
|
6475
6475
|
let i = e.map((e) => ({
|
|
6476
6476
|
id: e.id,
|
|
6477
6477
|
symbol: e.symbol,
|
|
6478
|
-
way: r(
|
|
6478
|
+
way: r(qs.percent),
|
|
6479
6479
|
color: e.color
|
|
6480
6480
|
}));
|
|
6481
6481
|
for (let e of t) {
|
|
6482
|
-
let t = e.params.symbol, a =
|
|
6482
|
+
let t = e.params.symbol, a = Qs(e, n.has(e.instanceId));
|
|
6483
6483
|
!a || typeof t != "string" || !t || i.push({
|
|
6484
6484
|
id: e.instanceId,
|
|
6485
6485
|
symbol: t,
|
|
6486
|
-
way: r(
|
|
6486
|
+
way: r(qs[a])
|
|
6487
6487
|
});
|
|
6488
6488
|
}
|
|
6489
6489
|
return i;
|
|
6490
6490
|
}
|
|
6491
|
-
var Q = 8,
|
|
6491
|
+
var Q = 8, ec = 4, tc = 3, nc = "[title]:not([title=\"\"]), [data-tip]:not([data-tip=\"\"])", rc = class {
|
|
6492
6492
|
el;
|
|
6493
6493
|
target = null;
|
|
6494
6494
|
source = null;
|
|
@@ -6499,9 +6499,9 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6499
6499
|
observer;
|
|
6500
6500
|
constructor(e) {
|
|
6501
6501
|
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(() => {
|
|
6502
|
-
this.pressed?.hasAttribute("title") &&
|
|
6502
|
+
this.pressed?.hasAttribute("title") && ic(this.pressed);
|
|
6503
6503
|
let e = this.target;
|
|
6504
|
-
!e || this.source !== "pointer" || !e.hasAttribute("title") || (
|
|
6504
|
+
!e || this.source !== "pointer" || !e.hasAttribute("title") || (ic(e), this.isVisible() && this.show(e));
|
|
6505
6505
|
}), this.observer.observe(e, {
|
|
6506
6506
|
subtree: !0,
|
|
6507
6507
|
attributes: !0,
|
|
@@ -6509,24 +6509,24 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6509
6509
|
});
|
|
6510
6510
|
}
|
|
6511
6511
|
destroy() {
|
|
6512
|
-
this.hide(), this.pressed &&
|
|
6512
|
+
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();
|
|
6513
6513
|
}
|
|
6514
6514
|
onOver = (e) => {
|
|
6515
6515
|
if (e.pointerType === "touch") return;
|
|
6516
6516
|
let t = this.tipTarget(e.target);
|
|
6517
|
-
!t || t === this.pressed || t === this.target && this.source === "pointer" || (
|
|
6517
|
+
!t || t === this.pressed || t === this.target && this.source === "pointer" || (ic(t), this.schedule(t, "pointer", Date.now() < this.warmUntil || this.isVisible()));
|
|
6518
6518
|
};
|
|
6519
6519
|
onOut = (e) => {
|
|
6520
6520
|
let t = e.relatedTarget, n = (e) => !!e && !!t && e.contains(t);
|
|
6521
|
-
this.pressed && !n(this.pressed) && (
|
|
6521
|
+
this.pressed && !n(this.pressed) && (ac(this.pressed), this.pressed = null), this.source === "pointer" && !n(this.target) && this.hide();
|
|
6522
6522
|
};
|
|
6523
6523
|
onPress = () => {
|
|
6524
6524
|
let e = this.target, t = this.source === "pointer";
|
|
6525
|
-
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 &&
|
|
6525
|
+
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;
|
|
6526
6526
|
};
|
|
6527
6527
|
onFocus = (e) => {
|
|
6528
6528
|
let t = this.tipTarget(e.target);
|
|
6529
|
-
!t || !
|
|
6529
|
+
!t || !cc(t) || t === this.pressed || this.schedule(t, "focus", !0);
|
|
6530
6530
|
};
|
|
6531
6531
|
onBlur = (e) => {
|
|
6532
6532
|
if (this.source !== "focus") return;
|
|
@@ -6534,16 +6534,16 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6534
6534
|
this.target && t && this.target.contains(t) || this.hide();
|
|
6535
6535
|
};
|
|
6536
6536
|
hide = () => {
|
|
6537
|
-
this.clearTimer(), cancelAnimationFrame(this.watchFrame), this.isVisible() && (this.warmUntil = Date.now() + 500), this.el.classList.remove("tcw-tooltip--visible"), this.target && this.source === "pointer" &&
|
|
6537
|
+
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;
|
|
6538
6538
|
};
|
|
6539
6539
|
tipTarget(e) {
|
|
6540
6540
|
if (!(e instanceof Element)) return null;
|
|
6541
|
-
let t = e.closest(
|
|
6541
|
+
let t = e.closest(nc);
|
|
6542
6542
|
return t && t !== this.el && this.root.contains(t) ? t : null;
|
|
6543
6543
|
}
|
|
6544
6544
|
schedule(e, t, n) {
|
|
6545
6545
|
let r = this.target;
|
|
6546
|
-
if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" &&
|
|
6546
|
+
if (this.clearTimer(), cancelAnimationFrame(this.watchFrame), r && r !== e && this.source === "pointer" && ac(r), this.target = e, this.source = t, n) {
|
|
6547
6547
|
this.show(e);
|
|
6548
6548
|
return;
|
|
6549
6549
|
}
|
|
@@ -6552,27 +6552,27 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6552
6552
|
}, 300);
|
|
6553
6553
|
}
|
|
6554
6554
|
show(e) {
|
|
6555
|
-
if (!
|
|
6555
|
+
if (!sc(e)) {
|
|
6556
6556
|
this.hide();
|
|
6557
6557
|
return;
|
|
6558
6558
|
}
|
|
6559
|
-
this.el.textContent =
|
|
6559
|
+
this.el.textContent = oc(e), this.place(e), this.el.classList.add("tcw-tooltip--visible"), this.watch(e);
|
|
6560
6560
|
}
|
|
6561
6561
|
watch(e) {
|
|
6562
6562
|
cancelAnimationFrame(this.watchFrame), this.watchFrame = requestAnimationFrame(() => {
|
|
6563
|
-
this.target === e && (
|
|
6563
|
+
this.target === e && (sc(e) ? this.watch(e) : this.hide());
|
|
6564
6564
|
});
|
|
6565
6565
|
}
|
|
6566
6566
|
place(e) {
|
|
6567
|
-
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 =
|
|
6567
|
+
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);
|
|
6568
6568
|
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");
|
|
6569
6569
|
let c, l;
|
|
6570
|
-
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(
|
|
6570
|
+
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`;
|
|
6571
6571
|
let u = {
|
|
6572
|
-
top: [0,
|
|
6573
|
-
bottom: [0, -
|
|
6574
|
-
left: [
|
|
6575
|
-
right: [-
|
|
6572
|
+
top: [0, tc],
|
|
6573
|
+
bottom: [0, -tc],
|
|
6574
|
+
left: [tc, 0],
|
|
6575
|
+
right: [-tc, 0]
|
|
6576
6576
|
}[s];
|
|
6577
6577
|
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;
|
|
6578
6578
|
}
|
|
@@ -6583,32 +6583,32 @@ var Q = 8, Zs = 4, Qs = 3, $s = "[title]:not([title=\"\"]), [data-tip]:not([data
|
|
|
6583
6583
|
this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
|
|
6584
6584
|
}
|
|
6585
6585
|
};
|
|
6586
|
-
function
|
|
6586
|
+
function ic(e) {
|
|
6587
6587
|
let t = e.getAttribute("title");
|
|
6588
6588
|
t !== null && (e.dataset.tip = t, e.removeAttribute("title"));
|
|
6589
6589
|
}
|
|
6590
|
-
function
|
|
6590
|
+
function ac(e) {
|
|
6591
6591
|
e.dataset.tip !== void 0 && !e.hasAttribute("title") && (e.setAttribute("title", e.dataset.tip), delete e.dataset.tip);
|
|
6592
6592
|
}
|
|
6593
|
-
function
|
|
6593
|
+
function oc(e) {
|
|
6594
6594
|
return e.dataset.tip ?? e.getAttribute("title") ?? "";
|
|
6595
6595
|
}
|
|
6596
|
-
function
|
|
6596
|
+
function sc(e) {
|
|
6597
6597
|
return e.isConnected && e.getClientRects().length > 0 && !e.disabled;
|
|
6598
6598
|
}
|
|
6599
|
-
function
|
|
6599
|
+
function cc(e) {
|
|
6600
6600
|
try {
|
|
6601
6601
|
return e.matches(":focus-visible");
|
|
6602
6602
|
} catch {
|
|
6603
6603
|
return !1;
|
|
6604
6604
|
}
|
|
6605
6605
|
}
|
|
6606
|
-
function
|
|
6606
|
+
function lc(e) {
|
|
6607
6607
|
return e.dataset.tipSide || (e.closest(".tcw-sidebar") ? "right" : e.closest(".tcw-statusbar, .tcw-replay-bar") ? "top" : "bottom");
|
|
6608
6608
|
}
|
|
6609
6609
|
//#endregion
|
|
6610
6610
|
//#region src/widget/WidgetIndicatorLegend.ts
|
|
6611
|
-
var
|
|
6611
|
+
var uc = 2, dc = 1.5, fc = "tcw-ind-legend-values--no-room", pc = 0, mc = class {
|
|
6612
6612
|
stack;
|
|
6613
6613
|
toggle;
|
|
6614
6614
|
rows = /* @__PURE__ */ new Map();
|
|
@@ -6622,7 +6622,7 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
|
|
|
6622
6622
|
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", () => {
|
|
6623
6623
|
this.setCollapsed(!this.collapsed), this.renderToggle(this.overlayCount());
|
|
6624
6624
|
}), 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) => {
|
|
6625
|
-
for (let t of e)
|
|
6625
|
+
for (let t of e) hc(t.target, t.contentRect.width);
|
|
6626
6626
|
});
|
|
6627
6627
|
}
|
|
6628
6628
|
update(e, t, n = []) {
|
|
@@ -6714,7 +6714,7 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
|
|
|
6714
6714
|
}, c = s("visible", "eye", () => {
|
|
6715
6715
|
this.callbacks.onToggleVisible(e, !m.visible, t);
|
|
6716
6716
|
}, "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");
|
|
6717
|
-
f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++
|
|
6717
|
+
f.className = "tcw-visually-hidden", f.id = `tcw-ind-note-${++pc}`;
|
|
6718
6718
|
let p = n ? document.createElement("span") : null;
|
|
6719
6719
|
p && (p.className = "tcw-ind-legend-swatch", p.setAttribute("aria-hidden", "true"), r.append(p)), r.append(i, a, o, f);
|
|
6720
6720
|
let m = {
|
|
@@ -6768,7 +6768,7 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
|
|
|
6768
6768
|
return this.stack.querySelectorAll(":scope > .tcw-ind-legend-row").length;
|
|
6769
6769
|
}
|
|
6770
6770
|
renderToggle(e) {
|
|
6771
|
-
let t = e >=
|
|
6771
|
+
let t = e >= uc;
|
|
6772
6772
|
!t && this.collapsed && this.setCollapsed(!1);
|
|
6773
6773
|
let n = `${t}|${this.collapsed}|${e}`;
|
|
6774
6774
|
if (n === this.toggleKey || (this.toggleKey = n, this.toggle.hidden = !t, !t)) return;
|
|
@@ -6778,19 +6778,19 @@ var sc = 2, cc = 1.5, lc = "tcw-ind-legend-values--no-room", uc = 0, dc = class
|
|
|
6778
6778
|
this.toggle.innerHTML = this.collapsed ? `${i}<span>${e}</span>` : i;
|
|
6779
6779
|
}
|
|
6780
6780
|
};
|
|
6781
|
-
function
|
|
6782
|
-
let n = (parseFloat(getComputedStyle(e).fontSize) || 0) *
|
|
6783
|
-
e.classList.toggle(
|
|
6781
|
+
function hc(e, t) {
|
|
6782
|
+
let n = (parseFloat(getComputedStyle(e).fontSize) || 0) * dc;
|
|
6783
|
+
e.classList.toggle(fc, t < n);
|
|
6784
6784
|
}
|
|
6785
6785
|
function $(e, t, n) {
|
|
6786
6786
|
e.title = t, e.setAttribute("aria-label", n ? `${t} ${n}` : t);
|
|
6787
6787
|
}
|
|
6788
6788
|
//#endregion
|
|
6789
6789
|
//#region src/widget/legendValues.ts
|
|
6790
|
-
function
|
|
6790
|
+
function gc(e, t) {
|
|
6791
6791
|
return !e || e.length === 0 ? null : e[t === null ? e.length - 1 : Math.min(Math.max(t, 0), e.length - 1)] ?? null;
|
|
6792
6792
|
}
|
|
6793
|
-
function
|
|
6793
|
+
function _c(e, t, n, r) {
|
|
6794
6794
|
if (!t) return [];
|
|
6795
6795
|
let i = e.plots;
|
|
6796
6796
|
if (!i) {
|
|
@@ -6820,20 +6820,20 @@ function mc(e, t, n, r) {
|
|
|
6820
6820
|
}
|
|
6821
6821
|
return o;
|
|
6822
6822
|
}
|
|
6823
|
-
var
|
|
6824
|
-
function
|
|
6825
|
-
let t =
|
|
6823
|
+
var vc = /* @__PURE__ */ new Map();
|
|
6824
|
+
function yc(e) {
|
|
6825
|
+
let t = vc.get(e);
|
|
6826
6826
|
return t || (t = new Intl.NumberFormat(e, {
|
|
6827
6827
|
notation: "compact",
|
|
6828
6828
|
maximumFractionDigits: 2
|
|
6829
|
-
}),
|
|
6829
|
+
}), vc.set(e, t)), t;
|
|
6830
6830
|
}
|
|
6831
|
-
function
|
|
6832
|
-
return Math.abs(e) >= 1e6 ?
|
|
6831
|
+
function bc(e, t = "en-US") {
|
|
6832
|
+
return Math.abs(e) >= 1e6 ? yc(t).format(e) : $e(e, Mt(e), t);
|
|
6833
6833
|
}
|
|
6834
6834
|
//#endregion
|
|
6835
6835
|
//#region src/widget/WidgetBracketBar.ts
|
|
6836
|
-
var
|
|
6836
|
+
var xc = class {
|
|
6837
6837
|
el;
|
|
6838
6838
|
labelEl;
|
|
6839
6839
|
callbacks;
|
|
@@ -6861,7 +6861,7 @@ var vc = class {
|
|
|
6861
6861
|
destroy() {
|
|
6862
6862
|
this.el.remove();
|
|
6863
6863
|
}
|
|
6864
|
-
},
|
|
6864
|
+
}, Sc = class {
|
|
6865
6865
|
options;
|
|
6866
6866
|
audioCtx = null;
|
|
6867
6867
|
audioEl = null;
|
|
@@ -6924,7 +6924,7 @@ var vc = class {
|
|
|
6924
6924
|
};
|
|
6925
6925
|
//#endregion
|
|
6926
6926
|
//#region src/widget/ladderRows.ts
|
|
6927
|
-
function
|
|
6927
|
+
function Cc(e, t = 12) {
|
|
6928
6928
|
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) => {
|
|
6929
6929
|
let t = s.get(e);
|
|
6930
6930
|
return t || (t = {
|
|
@@ -6947,7 +6947,7 @@ function bc(e, t = 12) {
|
|
|
6947
6947
|
}
|
|
6948
6948
|
//#endregion
|
|
6949
6949
|
//#region src/widget/WidgetDepthLadder.ts
|
|
6950
|
-
var
|
|
6950
|
+
var wc = 1e-9, Tc = class {
|
|
6951
6951
|
el;
|
|
6952
6952
|
colsEl;
|
|
6953
6953
|
bodyEl;
|
|
@@ -6993,7 +6993,7 @@ var xc = 1e-9, Sc = class {
|
|
|
6993
6993
|
this.open && (this.open = !1, this.el.hidden = !0, this.callbacks.onToggle?.(!1));
|
|
6994
6994
|
}
|
|
6995
6995
|
setData(e) {
|
|
6996
|
-
this.model = e ?
|
|
6996
|
+
this.model = e ? Cc(e, this.levels) : null, this.render();
|
|
6997
6997
|
}
|
|
6998
6998
|
setOrders(e) {
|
|
6999
6999
|
this.orders = e, this.render();
|
|
@@ -7009,7 +7009,7 @@ var xc = 1e-9, Sc = class {
|
|
|
7009
7009
|
e.className = "tcw-ladder-empty", e.textContent = this.t("ladder.empty"), this.bodyEl.replaceChildren(e), this.drawn = [];
|
|
7010
7010
|
return;
|
|
7011
7011
|
}
|
|
7012
|
-
let t =
|
|
7012
|
+
let t = Ec(e.rows);
|
|
7013
7013
|
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)));
|
|
7014
7014
|
let n = e.maxVolume > 0 ? 100 / e.maxVolume : 0;
|
|
7015
7015
|
e.rows.forEach((e, r) => this.fillRow(this.drawn[r], e, n, this.nearness(e.price, t))), this.putSpread(e, t), this.placeSpread();
|
|
@@ -7067,7 +7067,7 @@ var xc = 1e-9, Sc = class {
|
|
|
7067
7067
|
return;
|
|
7068
7068
|
}
|
|
7069
7069
|
e.disabled = !1;
|
|
7070
|
-
let a =
|
|
7070
|
+
let a = Dc(n);
|
|
7071
7071
|
e.textContent = a, e.style.setProperty("--w", `${(n * i).toFixed(1)}%`);
|
|
7072
7072
|
let o = w(this.t(t === "sell" ? "ladder.sellAt" : "ladder.buyAt"), { price: this.callbacks.formatPrice(r) });
|
|
7073
7073
|
e.setAttribute("aria-label", `${a}, ${o}`), e.title = o;
|
|
@@ -7079,15 +7079,15 @@ var xc = 1e-9, Sc = class {
|
|
|
7079
7079
|
e.scrollTop += r - n - (e.clientHeight - n - this.spreadEl.offsetHeight) / 2, this.placed = !0;
|
|
7080
7080
|
}
|
|
7081
7081
|
};
|
|
7082
|
-
function
|
|
7082
|
+
function Ec(e) {
|
|
7083
7083
|
let t = Infinity;
|
|
7084
7084
|
for (let n = 1; n < e.length; n++) t = Math.min(t, Math.abs(e[n - 1].price - e[n].price));
|
|
7085
|
-
return Number.isFinite(t) && t > 0 ? t / 2 :
|
|
7085
|
+
return Number.isFinite(t) && t > 0 ? t / 2 : wc;
|
|
7086
7086
|
}
|
|
7087
|
-
function
|
|
7087
|
+
function Dc(e) {
|
|
7088
7088
|
return e >= 1e3 ? `${Number((e / 1e3).toFixed(1))}k` : String(Number(e >= 1 ? e.toFixed(2) : e.toPrecision(2)));
|
|
7089
7089
|
}
|
|
7090
|
-
var
|
|
7090
|
+
var Oc = class {
|
|
7091
7091
|
el;
|
|
7092
7092
|
bodyEl;
|
|
7093
7093
|
callbacks;
|
|
@@ -7129,11 +7129,11 @@ var Tc = class {
|
|
|
7129
7129
|
let t = this.callbacks.formatPrice, n = e.ohlc;
|
|
7130
7130
|
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)));
|
|
7131
7131
|
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);
|
|
7132
|
-
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 ??
|
|
7132
|
+
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)));
|
|
7133
7133
|
for (let t of e.indicators) {
|
|
7134
7134
|
let e = document.createElement("div");
|
|
7135
7135
|
e.className = "tcw-datawin-sub", e.textContent = t.name, this.bodyEl.appendChild(e);
|
|
7136
|
-
for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ??
|
|
7136
|
+
for (let e of t.values) this.bodyEl.appendChild(this.row(e.key, e.text ?? kc(e.value)));
|
|
7137
7137
|
}
|
|
7138
7138
|
}
|
|
7139
7139
|
row(e, t, n = "") {
|
|
@@ -7145,15 +7145,15 @@ var Tc = class {
|
|
|
7145
7145
|
return a.className = `tcw-datawin-value${n ? ` tcw-${n}` : ""}`, a.textContent = t, r.appendChild(i), r.appendChild(a), r;
|
|
7146
7146
|
}
|
|
7147
7147
|
};
|
|
7148
|
-
function
|
|
7148
|
+
function kc(e) {
|
|
7149
7149
|
if (!Number.isFinite(e)) return "—";
|
|
7150
7150
|
let t = Math.abs(e);
|
|
7151
7151
|
return t >= 1e3 ? e.toFixed(2) : t >= 1 ? e.toFixed(4) : e.toPrecision(4);
|
|
7152
7152
|
}
|
|
7153
|
-
function
|
|
7153
|
+
function Ac(e) {
|
|
7154
7154
|
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);
|
|
7155
7155
|
}
|
|
7156
|
-
var
|
|
7156
|
+
var jc = [
|
|
7157
7157
|
[
|
|
7158
7158
|
34,
|
|
7159
7159
|
16,
|
|
@@ -7210,7 +7210,7 @@ var Oc = [
|
|
|
7210
7210
|
30,
|
|
7211
7211
|
!0
|
|
7212
7212
|
]
|
|
7213
|
-
],
|
|
7213
|
+
], Mc = class {
|
|
7214
7214
|
el;
|
|
7215
7215
|
label;
|
|
7216
7216
|
showTimer = null;
|
|
@@ -7218,7 +7218,7 @@ var Oc = [
|
|
|
7218
7218
|
constructor(e, t) {
|
|
7219
7219
|
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");
|
|
7220
7220
|
let n = document.createElement("div");
|
|
7221
|
-
n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"),
|
|
7221
|
+
n.className = "tcw-loading-candles", n.setAttribute("aria-hidden", "true"), jc.forEach(([e, t, r, i, a], o) => {
|
|
7222
7222
|
let s = document.createElement("span");
|
|
7223
7223
|
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);
|
|
7224
7224
|
}), 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);
|
|
@@ -7253,7 +7253,7 @@ var Oc = [
|
|
|
7253
7253
|
clearTimer() {
|
|
7254
7254
|
this.showTimer !== null && (clearTimeout(this.showTimer), this.showTimer = null);
|
|
7255
7255
|
}
|
|
7256
|
-
},
|
|
7256
|
+
}, Nc = 4e3, Pc = class {
|
|
7257
7257
|
el;
|
|
7258
7258
|
text;
|
|
7259
7259
|
hideTimer = null;
|
|
@@ -7263,7 +7263,7 @@ var Oc = [
|
|
|
7263
7263
|
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);
|
|
7264
7264
|
}
|
|
7265
7265
|
update(e) {
|
|
7266
|
-
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(),
|
|
7266
|
+
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();
|
|
7267
7267
|
}
|
|
7268
7268
|
destroy() {
|
|
7269
7269
|
this.clearTimer(), this.el.remove();
|
|
@@ -7277,13 +7277,13 @@ var Oc = [
|
|
|
7277
7277
|
clearTimer() {
|
|
7278
7278
|
this.hideTimer !== null && clearTimeout(this.hideTimer), this.hideTimer = null;
|
|
7279
7279
|
}
|
|
7280
|
-
},
|
|
7281
|
-
function
|
|
7280
|
+
}, Fc = "host:";
|
|
7281
|
+
function Ic(e, t) {
|
|
7282
7282
|
return [
|
|
7283
7283
|
...e,
|
|
7284
7284
|
...e.length > 0 && t.length > 0 ? ["separator"] : [],
|
|
7285
7285
|
...t.map((e, t) => ({
|
|
7286
|
-
id: `${
|
|
7286
|
+
id: `${Fc}${t}`,
|
|
7287
7287
|
label: e.label,
|
|
7288
7288
|
icon: e.icon,
|
|
7289
7289
|
danger: e.danger,
|
|
@@ -7291,12 +7291,12 @@ function Nc(e, t) {
|
|
|
7291
7291
|
}))
|
|
7292
7292
|
];
|
|
7293
7293
|
}
|
|
7294
|
-
function
|
|
7295
|
-
return e.startsWith(
|
|
7294
|
+
function Lc(e, t) {
|
|
7295
|
+
return e.startsWith(Fc) ? (t[Number(e.slice(5))]?.onSelect(), !0) : !1;
|
|
7296
7296
|
}
|
|
7297
7297
|
//#endregion
|
|
7298
7298
|
//#region src/widget/hostHotkeys.ts
|
|
7299
|
-
var
|
|
7299
|
+
var Rc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platform || navigator.userAgent), zc = {
|
|
7300
7300
|
ctrl: "ctrl",
|
|
7301
7301
|
control: "ctrl",
|
|
7302
7302
|
cmd: "ctrl",
|
|
@@ -7307,7 +7307,7 @@ var Fc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
|
|
|
7307
7307
|
option: "alt",
|
|
7308
7308
|
opt: "alt",
|
|
7309
7309
|
shift: "shift"
|
|
7310
|
-
},
|
|
7310
|
+
}, Bc = {
|
|
7311
7311
|
esc: "escape",
|
|
7312
7312
|
space: " ",
|
|
7313
7313
|
spacebar: " ",
|
|
@@ -7319,7 +7319,7 @@ var Fc = typeof navigator < "u" && /mac|iphone|ipad|ipod/i.test(navigator.platfo
|
|
|
7319
7319
|
return: "enter",
|
|
7320
7320
|
plus: "+"
|
|
7321
7321
|
};
|
|
7322
|
-
function
|
|
7322
|
+
function Vc(e) {
|
|
7323
7323
|
let t = e.split("+").map((e) => e.trim()), n = t.pop();
|
|
7324
7324
|
if (!n) return null;
|
|
7325
7325
|
let r = {
|
|
@@ -7329,23 +7329,23 @@ function Rc(e) {
|
|
|
7329
7329
|
display: []
|
|
7330
7330
|
};
|
|
7331
7331
|
for (let e of t) {
|
|
7332
|
-
let t =
|
|
7332
|
+
let t = zc[e.toLowerCase()];
|
|
7333
7333
|
if (!t) return null;
|
|
7334
7334
|
r[t] = !0;
|
|
7335
7335
|
}
|
|
7336
7336
|
let i = n.toLowerCase();
|
|
7337
|
-
if (
|
|
7337
|
+
if (zc[i]) return null;
|
|
7338
7338
|
if (/^[a-z]$/.test(i)) r.code = `Key${i.toUpperCase()}`, r.char = i;
|
|
7339
7339
|
else if (/^[0-9]$/.test(i)) r.code = `Digit${i}`, r.char = i;
|
|
7340
|
-
else if (r.key =
|
|
7340
|
+
else if (r.key = Bc[i] ?? i, r.shift && r.key.length === 1) return null;
|
|
7341
7341
|
return r.display = [
|
|
7342
|
-
...r.ctrl ? [
|
|
7342
|
+
...r.ctrl ? [Rc ? "⌘" : "Ctrl"] : [],
|
|
7343
7343
|
...r.alt ? ["Alt"] : [],
|
|
7344
7344
|
...r.shift ? ["Shift"] : [],
|
|
7345
7345
|
r.key === " " ? "Space" : n.length === 1 ? n.toUpperCase() : n
|
|
7346
7346
|
], r;
|
|
7347
7347
|
}
|
|
7348
|
-
function
|
|
7348
|
+
function Hc(e, t) {
|
|
7349
7349
|
if ((e.ctrlKey || e.metaKey) !== t.ctrl || e.altKey !== t.alt) return !1;
|
|
7350
7350
|
if (t.code !== void 0) {
|
|
7351
7351
|
if (e.shiftKey !== t.shift) return !1;
|
|
@@ -7355,25 +7355,25 @@ function zc(e, t) {
|
|
|
7355
7355
|
}
|
|
7356
7356
|
return t.shift && !e.shiftKey ? !1 : e.key.toLowerCase() === t.key;
|
|
7357
7357
|
}
|
|
7358
|
-
var
|
|
7359
|
-
function
|
|
7358
|
+
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("("));
|
|
7359
|
+
function Wc(e) {
|
|
7360
7360
|
let t = `${e.ctrl ? "ctrl+" : ""}${e.alt ? "alt+" : ""}${e.shift ? "shift+" : ""}${e.char ?? e.key}`;
|
|
7361
|
-
return
|
|
7361
|
+
return Uc.has(t);
|
|
7362
7362
|
}
|
|
7363
|
-
function
|
|
7363
|
+
function Gc(e) {
|
|
7364
7364
|
let t = typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
|
|
7365
7365
|
return t instanceof HTMLElement ? t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) : !1;
|
|
7366
7366
|
}
|
|
7367
7367
|
//#endregion
|
|
7368
7368
|
//#region src/widget/WidgetCompares.ts
|
|
7369
|
-
var
|
|
7369
|
+
var Kc = [
|
|
7370
7370
|
"#b552c9",
|
|
7371
7371
|
"#1398a8",
|
|
7372
7372
|
"#d4622b",
|
|
7373
7373
|
"#e25592",
|
|
7374
7374
|
"#6f7a8c",
|
|
7375
7375
|
"#3e9a4f"
|
|
7376
|
-
],
|
|
7376
|
+
], qc = class {
|
|
7377
7377
|
constructor(e) {
|
|
7378
7378
|
this.host = e;
|
|
7379
7379
|
}
|
|
@@ -7395,11 +7395,11 @@ var Uc = [
|
|
|
7395
7395
|
symbols: this.host.symbolEntries(),
|
|
7396
7396
|
current: this.host.state.symbol,
|
|
7397
7397
|
search: this.host.symbolSearchFn(),
|
|
7398
|
-
ways:
|
|
7398
|
+
ways: Ys(this.host.t),
|
|
7399
7399
|
way: this.compareWay,
|
|
7400
7400
|
compared: this.comparedNow(),
|
|
7401
7401
|
onAdd: (e, t) => {
|
|
7402
|
-
|
|
7402
|
+
Js(t) && (this.compareWay = t, this.addCompareSymbol(e, t));
|
|
7403
7403
|
},
|
|
7404
7404
|
onRemove: (e) => this.removeCompared(e)
|
|
7405
7405
|
}));
|
|
@@ -7407,7 +7407,7 @@ var Uc = [
|
|
|
7407
7407
|
}
|
|
7408
7408
|
comparedNow() {
|
|
7409
7409
|
let e = new Set(this.host.chart.getIndicatorPanes().flatMap((e) => e.instanceIds));
|
|
7410
|
-
return
|
|
7410
|
+
return $s(this.compares, this.host.chart.getActiveIndicators(), e, this.host.t);
|
|
7411
7411
|
}
|
|
7412
7412
|
refreshCompareDialog() {
|
|
7413
7413
|
this.host.symbolSearch?.isComparing() && this.host.symbolSearch.setCompared(this.comparedNow());
|
|
@@ -7427,7 +7427,7 @@ var Uc = [
|
|
|
7427
7427
|
try {
|
|
7428
7428
|
let t = await this.fetchCompareBars(this.host.adapter, e);
|
|
7429
7429
|
if (!t || this.compares.some((t) => t.symbol === e)) return;
|
|
7430
|
-
let r = this.host.state.timeframe, i =
|
|
7430
|
+
let r = this.host.state.timeframe, i = Kc[this.compares.length % Kc.length];
|
|
7431
7431
|
this.compares.length === 0 && this.host.chart.setCompareMode("percent"), this.host.chart.addCompareSymbol(n, O(e), t, i), this.compares = [...this.compares, {
|
|
7432
7432
|
id: n,
|
|
7433
7433
|
symbol: e,
|
|
@@ -7555,7 +7555,7 @@ var Uc = [
|
|
|
7555
7555
|
}
|
|
7556
7556
|
let i = r.bars[0]?.time;
|
|
7557
7557
|
if (i === void 0 || r.atStart) continue;
|
|
7558
|
-
let a =
|
|
7558
|
+
let a = Xs(this.host.chart.getData(), i);
|
|
7559
7559
|
if (a !== 0) try {
|
|
7560
7560
|
if (e.fetchHistoryBefore) {
|
|
7561
7561
|
let o = await e.fetchHistoryBefore(r.symbol, n, i, a);
|
|
@@ -7578,7 +7578,7 @@ var Uc = [
|
|
|
7578
7578
|
prependCompareBars(e, t, n) {
|
|
7579
7579
|
let r = this.compares.find((t) => t.id === e);
|
|
7580
7580
|
if (!r) return;
|
|
7581
|
-
let i =
|
|
7581
|
+
let i = Zs(r.bars, t);
|
|
7582
7582
|
i ? this.setCompareBars(e, i, n) : this.compares = this.compares.map((t) => t.id === e ? {
|
|
7583
7583
|
...t,
|
|
7584
7584
|
atStart: !0
|
|
@@ -7599,7 +7599,7 @@ var Uc = [
|
|
|
7599
7599
|
failedAt: t
|
|
7600
7600
|
} : n);
|
|
7601
7601
|
}
|
|
7602
|
-
},
|
|
7602
|
+
}, Jc = class {
|
|
7603
7603
|
constructor(e) {
|
|
7604
7604
|
this.host = e;
|
|
7605
7605
|
}
|
|
@@ -7744,7 +7744,7 @@ var Uc = [
|
|
|
7744
7744
|
sparkline: r.slice()
|
|
7745
7745
|
});
|
|
7746
7746
|
}
|
|
7747
|
-
},
|
|
7747
|
+
}, Yc = class {
|
|
7748
7748
|
constructor(e) {
|
|
7749
7749
|
this.host = e;
|
|
7750
7750
|
}
|
|
@@ -7807,10 +7807,10 @@ var Uc = [
|
|
|
7807
7807
|
if (e === "price") return t.length > 0 ? this.host.chart.roundPrice(t[t.length - 1].close) : null;
|
|
7808
7808
|
let n = e.indexOf(":");
|
|
7809
7809
|
if (n < 0 || t.length === 0) return null;
|
|
7810
|
-
let r = e.slice(0, n), i = e.slice(n + 1), a =
|
|
7810
|
+
let r = e.slice(0, n), i = e.slice(n + 1), a = gc(this.host.chart.getIndicatorOutput(r)?.series, null)?.[i];
|
|
7811
7811
|
return typeof a == "number" && Number.isFinite(a) ? a : null;
|
|
7812
7812
|
}
|
|
7813
|
-
},
|
|
7813
|
+
}, Xc = class {
|
|
7814
7814
|
constructor(e) {
|
|
7815
7815
|
this.host = e;
|
|
7816
7816
|
}
|
|
@@ -7887,7 +7887,7 @@ var Uc = [
|
|
|
7887
7887
|
};
|
|
7888
7888
|
//#endregion
|
|
7889
7889
|
//#region src/widget/drawingMenu.ts
|
|
7890
|
-
function
|
|
7890
|
+
function Zc(e, t) {
|
|
7891
7891
|
let { selected: n } = e, r = n.length === 1, i = new Set(n.map((e) => e.groupId)), a = i.size === 1 && !i.has(null), o = [];
|
|
7892
7892
|
e.canConfigure && r && o.push({
|
|
7893
7893
|
id: "settings",
|
|
@@ -7944,7 +7944,7 @@ function Jc(e, t) {
|
|
|
7944
7944
|
}
|
|
7945
7945
|
//#endregion
|
|
7946
7946
|
//#region src/widget/WidgetMenus.ts
|
|
7947
|
-
var
|
|
7947
|
+
var Qc = class {
|
|
7948
7948
|
constructor(e) {
|
|
7949
7949
|
this.host = e;
|
|
7950
7950
|
}
|
|
@@ -7963,7 +7963,7 @@ var Yc = class {
|
|
|
7963
7963
|
}] : [];
|
|
7964
7964
|
});
|
|
7965
7965
|
if (i.length === 0) return;
|
|
7966
|
-
let a = ce(
|
|
7966
|
+
let a = ce(Zc({
|
|
7967
7967
|
selected: i,
|
|
7968
7968
|
canConfigure: !0,
|
|
7969
7969
|
canAlert: this.host.chart.canAddDrawingAlert(e)
|
|
@@ -7971,11 +7971,11 @@ var Yc = class {
|
|
|
7971
7971
|
id: e,
|
|
7972
7972
|
type: s.type,
|
|
7973
7973
|
selected: o
|
|
7974
|
-
}) ?? [] : [], l =
|
|
7974
|
+
}) ?? [] : [], l = Ic(a, c);
|
|
7975
7975
|
if (l.length === 0) return;
|
|
7976
7976
|
let u = this.host.chartContainer.getBoundingClientRect(), d = this.host.root.getBoundingClientRect();
|
|
7977
7977
|
this.drawingMenu.open(l, u.left - d.left + t, u.top - d.top + n, (t) => {
|
|
7978
|
-
|
|
7978
|
+
Lc(t, c) || this.runDrawingMenuAction(e, o, t);
|
|
7979
7979
|
});
|
|
7980
7980
|
}
|
|
7981
7981
|
runDrawingMenuAction(e, t, n) {
|
|
@@ -8052,7 +8052,7 @@ var Yc = class {
|
|
|
8052
8052
|
current: r.timezone,
|
|
8053
8053
|
options: this.timezoneChoices()
|
|
8054
8054
|
},
|
|
8055
|
-
keys: Object.fromEntries(
|
|
8055
|
+
keys: Object.fromEntries(Fo.filter((e) => this.host.featureState.hotkeys && this.host.featureState[e.feature]).map((e) => [e.action, e.keys]))
|
|
8056
8056
|
};
|
|
8057
8057
|
}
|
|
8058
8058
|
removableIndicators() {
|
|
@@ -8073,15 +8073,15 @@ var Yc = class {
|
|
|
8073
8073
|
}
|
|
8074
8074
|
openChartMenu(e, t, n, r) {
|
|
8075
8075
|
if (!this.chartMenu) return;
|
|
8076
|
-
let i = this.host.options.chartMenuItems?.(r) ?? [], a =
|
|
8076
|
+
let i = this.host.options.chartMenuItems?.(r) ?? [], a = Ic(e, i);
|
|
8077
8077
|
if (a.length === 0) return;
|
|
8078
8078
|
let o = this.host.chartContainer.getBoundingClientRect(), s = this.host.root.getBoundingClientRect();
|
|
8079
8079
|
this.chartMenu.open(a, o.left - s.left + t, o.top - s.top + n, (e) => {
|
|
8080
|
-
|
|
8080
|
+
Lc(e, i) || (e.startsWith("tz:") ? this.host.changeSettings({ timezone: e.slice(3) }) : this.runChartMenuAction(e, r));
|
|
8081
8081
|
});
|
|
8082
8082
|
}
|
|
8083
8083
|
runChartMenuAction(e, t) {
|
|
8084
|
-
let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a =
|
|
8084
|
+
let { price: n } = t, r = n ?? NaN, i = this.host.settingsState, a = Io(e);
|
|
8085
8085
|
if (a) {
|
|
8086
8086
|
this.host.changeSettings({ scaleMode: a });
|
|
8087
8087
|
return;
|
|
@@ -8202,46 +8202,46 @@ var Yc = class {
|
|
|
8202
8202
|
activeTool: null
|
|
8203
8203
|
}, this.host.updateUI(), this.host.refreshDrawingsState(), this.host.refreshObjects();
|
|
8204
8204
|
}
|
|
8205
|
-
},
|
|
8206
|
-
function
|
|
8207
|
-
return $e(e, Math.max(
|
|
8205
|
+
}, $c = 2, el = 2;
|
|
8206
|
+
function tl(e, t = "en-US") {
|
|
8207
|
+
return $e(e, Math.max($c, Mt(e)), t);
|
|
8208
8208
|
}
|
|
8209
|
-
function
|
|
8210
|
-
return `${
|
|
8209
|
+
function nl(e, t = "en-US") {
|
|
8210
|
+
return `${qo($e(Math.abs(e), el, t), e, $e(0, el, t))}%`;
|
|
8211
8211
|
}
|
|
8212
|
-
function
|
|
8212
|
+
function rl(e, t = "en-US", n = !0) {
|
|
8213
8213
|
return e.map((e) => ({
|
|
8214
8214
|
instanceId: e.id,
|
|
8215
8215
|
kind: "compare",
|
|
8216
8216
|
label: e.label,
|
|
8217
8217
|
swatch: e.color,
|
|
8218
8218
|
visible: e.visible,
|
|
8219
|
-
...n ? { values:
|
|
8219
|
+
...n ? { values: il(e, t) } : {
|
|
8220
8220
|
values: [],
|
|
8221
8221
|
offChartType: !0
|
|
8222
8222
|
},
|
|
8223
8223
|
pane: null
|
|
8224
8224
|
}));
|
|
8225
8225
|
}
|
|
8226
|
-
function
|
|
8226
|
+
function il(e, t) {
|
|
8227
8227
|
return [...e.close === null ? [] : [{
|
|
8228
|
-
text:
|
|
8228
|
+
text: tl(e.close, t),
|
|
8229
8229
|
color: null
|
|
8230
8230
|
}], ...e.change === null ? [] : [{
|
|
8231
|
-
text:
|
|
8231
|
+
text: nl(e.change, t),
|
|
8232
8232
|
color: null
|
|
8233
8233
|
}]];
|
|
8234
8234
|
}
|
|
8235
8235
|
//#endregion
|
|
8236
8236
|
//#region src/widget/WidgetLegendView.ts
|
|
8237
|
-
var
|
|
8238
|
-
function
|
|
8239
|
-
return Ge[e.getDensity?.() ?? "comfortable"].legendInset -
|
|
8237
|
+
var al = 7, ol = 17, sl = 3, cl = 4;
|
|
8238
|
+
function ll(e) {
|
|
8239
|
+
return Ge[e.getDensity?.() ?? "comfortable"].legendInset - cl;
|
|
8240
8240
|
}
|
|
8241
|
-
function
|
|
8241
|
+
function ul(e) {
|
|
8242
8242
|
return !kt.has(e.id) && e.scale !== "left";
|
|
8243
8243
|
}
|
|
8244
|
-
var
|
|
8244
|
+
var dl = class {
|
|
8245
8245
|
constructor(e) {
|
|
8246
8246
|
this.host = e;
|
|
8247
8247
|
}
|
|
@@ -8254,13 +8254,13 @@ var cl = class {
|
|
|
8254
8254
|
}
|
|
8255
8255
|
renderLegend() {
|
|
8256
8256
|
if (!this.host.indicatorLegend || this.host.destroyed) return;
|
|
8257
|
-
let e = this.host.chart.getData().length - 1, t = this.host.chart.isTimeAligned(), n = this.host.legendHoverIndex, r =
|
|
8257
|
+
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();
|
|
8258
8258
|
for (let e of this.host.chart.getIndicatorPanes()) (e.instanceIds ?? [e.instanceId]).forEach((t, n) => a.set(t, {
|
|
8259
8259
|
...e.rect,
|
|
8260
8260
|
row: n
|
|
8261
8261
|
}));
|
|
8262
|
-
let o = this.host.settingsState.numberLocale || "en-US", s =
|
|
8263
|
-
let t = a.get(e.instanceId) ?? null, i =
|
|
8262
|
+
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) => {
|
|
8263
|
+
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);
|
|
8264
8264
|
return {
|
|
8265
8265
|
instanceId: e.instanceId,
|
|
8266
8266
|
label: Ue(e, this.host.t),
|
|
@@ -8268,19 +8268,19 @@ var cl = class {
|
|
|
8268
8268
|
offInterval: l,
|
|
8269
8269
|
offChartType: c,
|
|
8270
8270
|
values: u.map((n) => ({
|
|
8271
|
-
text: this.host.indicatorValueText(n.value, t === null &&
|
|
8271
|
+
text: this.host.indicatorValueText(n.value, t === null && ul(e), o),
|
|
8272
8272
|
color: n.color
|
|
8273
8273
|
})),
|
|
8274
8274
|
pane: t ? {
|
|
8275
8275
|
x: t.x + r,
|
|
8276
|
-
y: t.y + Math.min(
|
|
8276
|
+
y: t.y + Math.min(al + t.row * ol, Math.max(al, t.height - ol)),
|
|
8277
8277
|
width: t.width - 2 * r
|
|
8278
8278
|
} : null
|
|
8279
8279
|
};
|
|
8280
8280
|
}), 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) => ({
|
|
8281
8281
|
instanceId: e.instanceId,
|
|
8282
8282
|
x: e.rect.x + e.rect.width - r,
|
|
8283
|
-
y: e.rect.y +
|
|
8283
|
+
y: e.rect.y + sl,
|
|
8284
8284
|
label: f(e.instanceId),
|
|
8285
8285
|
collapsed: this.host.chart.isPaneCollapsed(e.instanceId),
|
|
8286
8286
|
maximized: d === e.instanceId,
|
|
@@ -8334,14 +8334,14 @@ var cl = class {
|
|
|
8334
8334
|
let u = this.host.chart.getActiveIndicators().find((t) => t.instanceId === e)?.id ?? "", d = this.host.options.indicatorMenuItems?.({
|
|
8335
8335
|
instanceId: e,
|
|
8336
8336
|
indicatorId: u
|
|
8337
|
-
}) ?? [], f =
|
|
8337
|
+
}) ?? [], f = Ic(c, d);
|
|
8338
8338
|
if (f.length === 0) return;
|
|
8339
8339
|
let p = t.getBoundingClientRect(), m = this.host.root.getBoundingClientRect();
|
|
8340
8340
|
n.open(f, p.left - m.left, p.bottom - m.top + 2, (t) => {
|
|
8341
|
-
|
|
8341
|
+
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());
|
|
8342
8342
|
}, t);
|
|
8343
8343
|
}
|
|
8344
|
-
},
|
|
8344
|
+
}, fl = class {
|
|
8345
8345
|
constructor(e) {
|
|
8346
8346
|
this.host = e;
|
|
8347
8347
|
}
|
|
@@ -8546,7 +8546,7 @@ var cl = class {
|
|
|
8546
8546
|
break;
|
|
8547
8547
|
}
|
|
8548
8548
|
}
|
|
8549
|
-
},
|
|
8549
|
+
}, pl = 0, ml = class {
|
|
8550
8550
|
backdrop;
|
|
8551
8551
|
search;
|
|
8552
8552
|
listEl;
|
|
@@ -8554,7 +8554,7 @@ var cl = class {
|
|
|
8554
8554
|
confirming = null;
|
|
8555
8555
|
returnFocus = null;
|
|
8556
8556
|
loadSeq = 0;
|
|
8557
|
-
uid = ++
|
|
8557
|
+
uid = ++pl;
|
|
8558
8558
|
constructor(e, t, n = T) {
|
|
8559
8559
|
this.callbacks = t, this.t = n, this.backdrop = document.createElement("div"), this.backdrop.className = "tcw-modal-backdrop", this.backdrop.hidden = !0;
|
|
8560
8560
|
let r = !1;
|
|
@@ -8660,7 +8660,7 @@ var cl = class {
|
|
|
8660
8660
|
this.confirming = null, await this.refresh(), this.isOpen() && this.search.focus();
|
|
8661
8661
|
}
|
|
8662
8662
|
}
|
|
8663
|
-
},
|
|
8663
|
+
}, hl = 5, gl = class {
|
|
8664
8664
|
menu;
|
|
8665
8665
|
prompt;
|
|
8666
8666
|
dialog;
|
|
@@ -8668,7 +8668,7 @@ var cl = class {
|
|
|
8668
8668
|
constructor(e, t) {
|
|
8669
8669
|
this.session = e, this.host = t;
|
|
8670
8670
|
let { root: n, t: r } = t;
|
|
8671
|
-
this.menu = new C(n, r("toolbar.layouts")), this.prompt = new
|
|
8671
|
+
this.menu = new C(n, r("toolbar.layouts")), this.prompt = new Ts(n, r), this.dialog = new ml(n, {
|
|
8672
8672
|
list: () => e.list(),
|
|
8673
8673
|
currentId: () => e.current()?.id ?? null,
|
|
8674
8674
|
onOpen: (e) => void this.open(e),
|
|
@@ -8746,7 +8746,7 @@ var cl = class {
|
|
|
8746
8746
|
}
|
|
8747
8747
|
let { session: t } = this, { t: n } = this.host, r = [];
|
|
8748
8748
|
try {
|
|
8749
|
-
r = (await t.list()).slice(0,
|
|
8749
|
+
r = (await t.list()).slice(0, hl);
|
|
8750
8750
|
} catch {}
|
|
8751
8751
|
if (this.destroyed) return;
|
|
8752
8752
|
let i = t.current(), a = [{
|
|
@@ -8782,53 +8782,53 @@ var cl = class {
|
|
|
8782
8782
|
destroy() {
|
|
8783
8783
|
this.destroyed = !0, this.menu.destroy(), this.prompt.destroy(), this.dialog.destroy();
|
|
8784
8784
|
}
|
|
8785
|
-
},
|
|
8786
|
-
function
|
|
8787
|
-
if (
|
|
8785
|
+
}, _l = (e) => typeof e == "object" && !!e && !Array.isArray(e), vl = globalThis.Buffer;
|
|
8786
|
+
function yl(e) {
|
|
8787
|
+
if (vl) return vl.from(e, "utf8").toString("base64");
|
|
8788
8788
|
let t = new TextEncoder().encode(e), n = "";
|
|
8789
8789
|
for (let e of t) n += String.fromCharCode(e);
|
|
8790
8790
|
return btoa(n);
|
|
8791
8791
|
}
|
|
8792
|
-
function
|
|
8793
|
-
if (
|
|
8792
|
+
function bl(e) {
|
|
8793
|
+
if (vl) return vl.from(e, "base64").toString("utf8");
|
|
8794
8794
|
let t = atob(e), n = new Uint8Array(t.length);
|
|
8795
8795
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
8796
8796
|
return new TextDecoder().decode(n);
|
|
8797
8797
|
}
|
|
8798
|
-
function
|
|
8798
|
+
function xl(e) {
|
|
8799
8799
|
return e.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
8800
8800
|
}
|
|
8801
|
-
function
|
|
8801
|
+
function Sl(e) {
|
|
8802
8802
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
8803
8803
|
return t + (t.length % 4 == 0 ? "" : "=".repeat(4 - t.length % 4));
|
|
8804
8804
|
}
|
|
8805
|
-
function
|
|
8806
|
-
return
|
|
8805
|
+
function Cl(e) {
|
|
8806
|
+
return xl(yl(JSON.stringify(e)));
|
|
8807
8807
|
}
|
|
8808
|
-
function
|
|
8808
|
+
function wl(e) {
|
|
8809
8809
|
if (!e) return null;
|
|
8810
8810
|
try {
|
|
8811
|
-
let t =
|
|
8811
|
+
let t = bl(Sl(e)), n = JSON.parse(t);
|
|
8812
8812
|
return !n || n.v !== 1 || typeof n.symbol != "string" ? null : {
|
|
8813
8813
|
v: 1,
|
|
8814
8814
|
symbol: n.symbol,
|
|
8815
8815
|
timeframe: n.timeframe,
|
|
8816
8816
|
chartType: n.chartType,
|
|
8817
|
-
scaleMode:
|
|
8817
|
+
scaleMode: ks.find((e) => e === n.scaleMode) ?? "regular",
|
|
8818
8818
|
indicators: Array.isArray(n.indicators) ? n.indicators : [],
|
|
8819
8819
|
drawings: Array.isArray(n.drawings) ? n.drawings : [],
|
|
8820
|
-
...
|
|
8820
|
+
..._l(n.settings) ? { settings: W(n.settings, Fa) } : {}
|
|
8821
8821
|
};
|
|
8822
8822
|
} catch {
|
|
8823
8823
|
return null;
|
|
8824
8824
|
}
|
|
8825
8825
|
}
|
|
8826
|
-
var
|
|
8827
|
-
function
|
|
8826
|
+
var Tl = "tcw";
|
|
8827
|
+
function El(e) {
|
|
8828
8828
|
let t = e.startsWith("#") ? e.slice(1) : e;
|
|
8829
8829
|
for (let e of t.split("&")) {
|
|
8830
8830
|
let t = e.indexOf("=");
|
|
8831
|
-
if (!(t <= 0 || e.slice(0, t) !==
|
|
8831
|
+
if (!(t <= 0 || e.slice(0, t) !== Tl)) try {
|
|
8832
8832
|
return decodeURIComponent(e.slice(t + 1));
|
|
8833
8833
|
} catch {
|
|
8834
8834
|
return null;
|
|
@@ -8836,19 +8836,19 @@ function Cl(e) {
|
|
|
8836
8836
|
}
|
|
8837
8837
|
return null;
|
|
8838
8838
|
}
|
|
8839
|
-
function
|
|
8839
|
+
function Dl(e, t) {
|
|
8840
8840
|
let [n] = e.split("#");
|
|
8841
|
-
return `${n}#${
|
|
8841
|
+
return `${n}#${Tl}=${t}`;
|
|
8842
8842
|
}
|
|
8843
8843
|
//#endregion
|
|
8844
8844
|
//#region src/widget/WidgetLayouts.ts
|
|
8845
|
-
var
|
|
8845
|
+
var Ol = [
|
|
8846
8846
|
"legendVisible",
|
|
8847
8847
|
"volumeVisible",
|
|
8848
8848
|
"barCountdown",
|
|
8849
8849
|
"indicatorValueLabels",
|
|
8850
8850
|
"alignAxisLabels"
|
|
8851
|
-
],
|
|
8851
|
+
], kl = class {
|
|
8852
8852
|
constructor(e) {
|
|
8853
8853
|
this.host = e;
|
|
8854
8854
|
}
|
|
@@ -8859,7 +8859,7 @@ var Tl = [
|
|
|
8859
8859
|
activeLayoutKey = null;
|
|
8860
8860
|
restoreSharedView() {
|
|
8861
8861
|
if (!this.host.options.shareUrl || typeof location > "u") return;
|
|
8862
|
-
let e =
|
|
8862
|
+
let e = El(location.hash);
|
|
8863
8863
|
e && this.importState(e);
|
|
8864
8864
|
}
|
|
8865
8865
|
exportState() {
|
|
@@ -8868,9 +8868,9 @@ var Tl = [
|
|
|
8868
8868
|
params: e.params
|
|
8869
8869
|
})), t = this.host.getSettings(), n = Ya(t, {
|
|
8870
8870
|
..._,
|
|
8871
|
-
...Object.fromEntries(
|
|
8871
|
+
...Object.fromEntries(Ol.map((e) => [e, this.host.settingsDefaults[e]]))
|
|
8872
8872
|
});
|
|
8873
|
-
return
|
|
8873
|
+
return Cl({
|
|
8874
8874
|
v: 1,
|
|
8875
8875
|
symbol: this.host.state.symbol,
|
|
8876
8876
|
timeframe: this.host.state.timeframe,
|
|
@@ -8882,7 +8882,7 @@ var Tl = [
|
|
|
8882
8882
|
});
|
|
8883
8883
|
}
|
|
8884
8884
|
async importState(e) {
|
|
8885
|
-
let t =
|
|
8885
|
+
let t = wl(e);
|
|
8886
8886
|
if (!t) return !1;
|
|
8887
8887
|
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);
|
|
8888
8888
|
let { chartTypeOptions: n, ...r } = this.host.allowedSettings({
|
|
@@ -8899,7 +8899,7 @@ var Tl = [
|
|
|
8899
8899
|
}))), this.host.chart.setDrawings(t.drawings), this.host.updateUI(), !0;
|
|
8900
8900
|
}
|
|
8901
8901
|
async copyShareLink() {
|
|
8902
|
-
let e =
|
|
8902
|
+
let e = Dl(typeof location < "u" ? location.href : "", this.exportState());
|
|
8903
8903
|
try {
|
|
8904
8904
|
await navigator.clipboard.writeText(e), this.host.say(this.host.t("toast.linkCopied"));
|
|
8905
8905
|
} catch {
|
|
@@ -8910,7 +8910,7 @@ var Tl = [
|
|
|
8910
8910
|
return this.layoutSession;
|
|
8911
8911
|
}
|
|
8912
8912
|
captureLayout() {
|
|
8913
|
-
let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ?
|
|
8913
|
+
let e = this.host.getSettings(), t = this.host.chart.saveState(), n = t ? Ns(t) : null, r = n && typeof n == "object" ? js(n) : null;
|
|
8914
8914
|
return {
|
|
8915
8915
|
v: 1,
|
|
8916
8916
|
symbol: this.host.state.symbol,
|
|
@@ -8924,7 +8924,7 @@ var Tl = [
|
|
|
8924
8924
|
async restoreLayout(e) {
|
|
8925
8925
|
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;
|
|
8926
8926
|
if (e.chart) {
|
|
8927
|
-
this.host.chart.loadState(JSON.stringify(
|
|
8927
|
+
this.host.chart.loadState(JSON.stringify(js(e.chart)));
|
|
8928
8928
|
let t = e.chart.chartType;
|
|
8929
8929
|
typeof t == "string" && (this.host.state = {
|
|
8930
8930
|
...this.host.state,
|
|
@@ -8942,7 +8942,7 @@ var Tl = [
|
|
|
8942
8942
|
return JSON.stringify(this.captureLayout());
|
|
8943
8943
|
}
|
|
8944
8944
|
async applyLayoutContent(e) {
|
|
8945
|
-
let t =
|
|
8945
|
+
let t = Ms(Ns(e));
|
|
8946
8946
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
8947
8947
|
}
|
|
8948
8948
|
setupLayouts(e) {
|
|
@@ -8961,7 +8961,7 @@ var Tl = [
|
|
|
8961
8961
|
onChange: () => this.host.toolbar?.setLayout(t.current()?.name ?? null, t.isDirty()),
|
|
8962
8962
|
onError: () => this.host.say(this.host.t("layouts.saveFailed"), "error")
|
|
8963
8963
|
});
|
|
8964
|
-
this.layoutSession = t, this.layoutsUI = new
|
|
8964
|
+
this.layoutSession = t, this.layoutsUI = new gl(t, {
|
|
8965
8965
|
root: this.host.root,
|
|
8966
8966
|
t: this.host.t,
|
|
8967
8967
|
saveKeys: () => this.host.keysShown("hotkeys.save", `${We}+S`),
|
|
@@ -9002,19 +9002,19 @@ var Tl = [
|
|
|
9002
9002
|
this.host.chart.disableAutoSave(), this.activeLayoutKey = null;
|
|
9003
9003
|
}
|
|
9004
9004
|
}
|
|
9005
|
-
},
|
|
9005
|
+
}, Al = {
|
|
9006
9006
|
alerts: "alerts",
|
|
9007
9007
|
objectTree: "objectTree",
|
|
9008
9008
|
dataWindow: "dataWindow",
|
|
9009
9009
|
symbolInfo: "symbolInfo",
|
|
9010
9010
|
depthLadder: "depthLadder"
|
|
9011
|
-
},
|
|
9011
|
+
}, jl = {
|
|
9012
9012
|
watchlist: "watchlist",
|
|
9013
9013
|
alerts: "alerts",
|
|
9014
9014
|
objectTree: "objects",
|
|
9015
9015
|
symbolInfo: "symbolInfo",
|
|
9016
9016
|
depthLadder: "trade"
|
|
9017
|
-
},
|
|
9017
|
+
}, Ml = class {
|
|
9018
9018
|
dataWindowFrame = 0;
|
|
9019
9019
|
constructor(e) {
|
|
9020
9020
|
this.host = e;
|
|
@@ -9031,7 +9031,7 @@ var Tl = [
|
|
|
9031
9031
|
return !this.hasPanel(e) || !this.dock ? !1 : (this.dock.open(e), this.dock.current() === e);
|
|
9032
9032
|
}
|
|
9033
9033
|
hasPanel(e) {
|
|
9034
|
-
return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[
|
|
9034
|
+
return e === "watchlist" ? this.host.watching.watchlist !== null : e === "depthLadder" && this.host.trading.depthLadder === null ? !1 : this.host.featureState[Al[e]];
|
|
9035
9035
|
}
|
|
9036
9036
|
closePanel() {
|
|
9037
9037
|
this.dock?.close();
|
|
@@ -9064,7 +9064,7 @@ var Tl = [
|
|
|
9064
9064
|
indicators: []
|
|
9065
9065
|
};
|
|
9066
9066
|
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) => {
|
|
9067
|
-
let n = this.host.chart.getIndicatorOutput(t.instanceId, { drawn: !0 })?.series?.[e] ?? null, r = !o.has(t.instanceId) &&
|
|
9067
|
+
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]) => {
|
|
9068
9068
|
let i = n[e];
|
|
9069
9069
|
return {
|
|
9070
9070
|
key: t,
|
|
@@ -9193,7 +9193,7 @@ var Tl = [
|
|
|
9193
9193
|
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();
|
|
9194
9194
|
}
|
|
9195
9195
|
panelFocusTarget(e) {
|
|
9196
|
-
let t =
|
|
9196
|
+
let t = jl[e], n = t ? this.host.root.querySelector(`.tcw-toolbar [data-role="${t}"]`) : null, r = this.host.root.hasAttribute("data-tcw-narrow");
|
|
9197
9197
|
return n && !n.hidden && !(r && n.classList.contains("tcw-toolbar-overflow")) ? n : this.host.root.querySelector(".tcw-toolbar-more") ?? this.host.chartContainer;
|
|
9198
9198
|
}
|
|
9199
9199
|
closePanelByHand(e) {
|
|
@@ -9221,29 +9221,29 @@ var Tl = [
|
|
|
9221
9221
|
}));
|
|
9222
9222
|
this.host.objectTree.setObjects(e, t, n);
|
|
9223
9223
|
}
|
|
9224
|
-
},
|
|
9224
|
+
}, Nl = new Set([
|
|
9225
9225
|
"timezone",
|
|
9226
9226
|
"numberLocale",
|
|
9227
9227
|
"chartTypeOptions",
|
|
9228
9228
|
"logScale",
|
|
9229
9229
|
"autoScale"
|
|
9230
|
-
]),
|
|
9231
|
-
function
|
|
9232
|
-
return W(e,
|
|
9230
|
+
]), Pl = 80, Fl = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
9231
|
+
function Il(e) {
|
|
9232
|
+
return W(e, Nl);
|
|
9233
9233
|
}
|
|
9234
|
-
function
|
|
9234
|
+
function Ll(e) {
|
|
9235
9235
|
let { overrides: t } = lt(e);
|
|
9236
9236
|
return Object.fromEntries(Object.entries(t).filter(([e, t]) => t !== null && v.includes(e)));
|
|
9237
9237
|
}
|
|
9238
|
-
function
|
|
9238
|
+
function Rl() {
|
|
9239
9239
|
try {
|
|
9240
9240
|
return typeof localStorage < "u" ? localStorage : null;
|
|
9241
9241
|
} catch {
|
|
9242
9242
|
return null;
|
|
9243
9243
|
}
|
|
9244
9244
|
}
|
|
9245
|
-
var
|
|
9246
|
-
constructor(e = "tcw:chart-templates", t =
|
|
9245
|
+
var zl = class {
|
|
9246
|
+
constructor(e = "tcw:chart-templates", t = Rl()) {
|
|
9247
9247
|
this.key = e, this.storage = t;
|
|
9248
9248
|
}
|
|
9249
9249
|
list() {
|
|
@@ -9255,10 +9255,10 @@ var Il = class {
|
|
|
9255
9255
|
}
|
|
9256
9256
|
if (!Array.isArray(e)) return [];
|
|
9257
9257
|
let t = [];
|
|
9258
|
-
for (let n of e) !
|
|
9259
|
-
name: n.name.slice(0,
|
|
9260
|
-
settings:
|
|
9261
|
-
style:
|
|
9258
|
+
for (let n of e) !Fl(n) || typeof n.name != "string" || !n.name.trim() || t.push({
|
|
9259
|
+
name: n.name.slice(0, Pl).trim(),
|
|
9260
|
+
settings: Il(n.settings),
|
|
9261
|
+
style: Ll(n.style)
|
|
9262
9262
|
});
|
|
9263
9263
|
return t.sort((e, t) => e.name.localeCompare(t.name));
|
|
9264
9264
|
}
|
|
@@ -9266,12 +9266,12 @@ var Il = class {
|
|
|
9266
9266
|
return this.list().find((t) => t.name === e) ?? null;
|
|
9267
9267
|
}
|
|
9268
9268
|
save(e, t, n) {
|
|
9269
|
-
let r = e.replace(/\s+/g, " ").slice(0,
|
|
9269
|
+
let r = e.replace(/\s+/g, " ").slice(0, Pl).trim();
|
|
9270
9270
|
if (!r || !this.storage) return !1;
|
|
9271
9271
|
let i = [...this.list().filter((e) => e.name !== r), {
|
|
9272
9272
|
name: r,
|
|
9273
|
-
settings:
|
|
9274
|
-
style:
|
|
9273
|
+
settings: Il(t),
|
|
9274
|
+
style: Ll(n)
|
|
9275
9275
|
}];
|
|
9276
9276
|
try {
|
|
9277
9277
|
return this.storage.setItem(this.key, JSON.stringify(i)), !0;
|
|
@@ -9284,11 +9284,11 @@ var Il = class {
|
|
|
9284
9284
|
this.storage?.setItem(this.key, JSON.stringify(this.list().filter((t) => t.name !== e)));
|
|
9285
9285
|
} catch {}
|
|
9286
9286
|
}
|
|
9287
|
-
},
|
|
9287
|
+
}, Bl = new Set([...Ma, "autoScale"]), Vl = class {
|
|
9288
9288
|
constructor(e) {
|
|
9289
9289
|
this.host = e;
|
|
9290
9290
|
}
|
|
9291
|
-
chartTemplates = new
|
|
9291
|
+
chartTemplates = new zl();
|
|
9292
9292
|
chartTemplatePrompt = null;
|
|
9293
9293
|
settingsEdit = null;
|
|
9294
9294
|
state = Qn(_);
|
|
@@ -9408,7 +9408,7 @@ var Il = class {
|
|
|
9408
9408
|
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 }));
|
|
9409
9409
|
}
|
|
9410
9410
|
promptSaveChartTemplate() {
|
|
9411
|
-
this.chartTemplatePrompt ??= new
|
|
9411
|
+
this.chartTemplatePrompt ??= new Ts(this.host.overlayHost(), this.host.t), this.chartTemplatePrompt.open({
|
|
9412
9412
|
title: this.host.t("settings.saveTemplateTitle"),
|
|
9413
9413
|
submitLabel: this.host.t("common.save"),
|
|
9414
9414
|
placeholder: this.host.t("settings.templatePlaceholder"),
|
|
@@ -9518,7 +9518,7 @@ var Il = class {
|
|
|
9518
9518
|
this.settingsState = {
|
|
9519
9519
|
...this.settingsState,
|
|
9520
9520
|
...e
|
|
9521
|
-
}, Object.keys(e).some((e) => !
|
|
9521
|
+
}, 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({
|
|
9522
9522
|
left: e.pivotStrength,
|
|
9523
9523
|
right: e.pivotStrength
|
|
9524
9524
|
}), 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 = {
|
|
@@ -9580,8 +9580,8 @@ var Il = class {
|
|
|
9580
9580
|
restoreSettings(e, t = null, n) {
|
|
9581
9581
|
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());
|
|
9582
9582
|
}
|
|
9583
|
-
},
|
|
9584
|
-
function
|
|
9583
|
+
}, Hl = 13;
|
|
9584
|
+
function Ul(e) {
|
|
9585
9585
|
let t = e.filter((e) => e !== null);
|
|
9586
9586
|
if (t.length === 0) return null;
|
|
9587
9587
|
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));
|
|
@@ -9592,7 +9592,7 @@ function Bl(e) {
|
|
|
9592
9592
|
height: a - r
|
|
9593
9593
|
};
|
|
9594
9594
|
}
|
|
9595
|
-
var
|
|
9595
|
+
var Wl = class {
|
|
9596
9596
|
constructor(e) {
|
|
9597
9597
|
this.host = e;
|
|
9598
9598
|
}
|
|
@@ -9623,7 +9623,7 @@ var Vl = class {
|
|
|
9623
9623
|
e.hide();
|
|
9624
9624
|
return;
|
|
9625
9625
|
}
|
|
9626
|
-
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 =
|
|
9626
|
+
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])) ?? {
|
|
9627
9627
|
x: o.x + o.width / 2,
|
|
9628
9628
|
y: o.y,
|
|
9629
9629
|
width: 0,
|
|
@@ -9631,17 +9631,17 @@ var Vl = class {
|
|
|
9631
9631
|
};
|
|
9632
9632
|
e.show({
|
|
9633
9633
|
rect: {
|
|
9634
|
+
x: c.x + i.x,
|
|
9635
|
+
y: c.y + i.y,
|
|
9636
|
+
width: c.width,
|
|
9637
|
+
height: c.height
|
|
9638
|
+
},
|
|
9639
|
+
bounds: {
|
|
9634
9640
|
x: s.x + i.x,
|
|
9635
9641
|
y: s.y + i.y,
|
|
9636
9642
|
width: s.width,
|
|
9637
9643
|
height: s.height
|
|
9638
9644
|
},
|
|
9639
|
-
bounds: {
|
|
9640
|
-
x: o.x + i.x,
|
|
9641
|
-
y: o.y + i.y,
|
|
9642
|
-
width: o.width,
|
|
9643
|
-
height: o.height
|
|
9644
|
-
},
|
|
9645
9645
|
style: a.style,
|
|
9646
9646
|
locked: r.every((e) => e.locked),
|
|
9647
9647
|
canDelete: r.some((e) => !e.locked),
|
|
@@ -9672,13 +9672,14 @@ var Vl = class {
|
|
|
9672
9672
|
},
|
|
9673
9673
|
text: o,
|
|
9674
9674
|
font: {
|
|
9675
|
-
size: a.fontSize || i?.fontSize ||
|
|
9675
|
+
size: a.fontSize || i?.fontSize || Hl,
|
|
9676
9676
|
bold: a.bold === !0,
|
|
9677
9677
|
italic: a.italic === !0,
|
|
9678
9678
|
family: this.host.chart.getFont?.()?.family ?? this.host.ui.font.family
|
|
9679
9679
|
},
|
|
9680
|
-
color: a.textColor ??
|
|
9680
|
+
color: a.textColor ?? So[n.type] ?? a.color,
|
|
9681
9681
|
label: this.host.t("drawingSettings.text"),
|
|
9682
|
+
placeholder: this.host.drawingToolName(n.type),
|
|
9682
9683
|
onInput: (n) => t ? this.host.chart.amendNewDrawing(e, { style: { text: n } }) : this.host.chart.updateDrawing(e, { style: { text: n } }),
|
|
9683
9684
|
onCommit: (n) => {
|
|
9684
9685
|
let r = n.replace(/\s+$/, "");
|
|
@@ -9704,14 +9705,14 @@ var Vl = class {
|
|
|
9704
9705
|
fill: i.fill === !0,
|
|
9705
9706
|
text: i.text === !0,
|
|
9706
9707
|
textLayout: K[r.type],
|
|
9707
|
-
textColor:
|
|
9708
|
-
textPlace:
|
|
9708
|
+
textColor: So[r.type],
|
|
9709
|
+
textPlace: xo.has(r.type),
|
|
9709
9710
|
coordinates: i.anchoring !== "screen",
|
|
9710
9711
|
intervals: r.intervals ?? null
|
|
9711
9712
|
}, { tab: n.tab }), n.justDrawn && e.isOpen() && (this.justDrawnText = t));
|
|
9712
9713
|
}
|
|
9713
9714
|
promptSaveDrawingTemplate(e, t) {
|
|
9714
|
-
this.drawingTemplatePrompt ??= new
|
|
9715
|
+
this.drawingTemplatePrompt ??= new Ts(this.host.root, this.host.t), this.drawingTemplatePrompt.open({
|
|
9715
9716
|
title: this.host.t("drawingSettings.saveTemplateTitle"),
|
|
9716
9717
|
submitLabel: this.host.t("common.save"),
|
|
9717
9718
|
placeholder: this.host.drawingToolName(t.type),
|
|
@@ -9723,7 +9724,7 @@ var Vl = class {
|
|
|
9723
9724
|
}
|
|
9724
9725
|
});
|
|
9725
9726
|
}
|
|
9726
|
-
},
|
|
9727
|
+
}, Gl = 200, Kl = class {
|
|
9727
9728
|
constructor(e) {
|
|
9728
9729
|
this.host = e;
|
|
9729
9730
|
}
|
|
@@ -9752,7 +9753,7 @@ var Vl = class {
|
|
|
9752
9753
|
for (; o > 0 && n[o - 1].time * r >= a;) o--;
|
|
9753
9754
|
let s = this.host.displayTimezone();
|
|
9754
9755
|
return En({
|
|
9755
|
-
dayShare: n.slice(-
|
|
9756
|
+
dayShare: n.slice(-Gl).some((e) => {
|
|
9756
9757
|
let t = e.time * r, n = new Date(t + at(s, t) * 6e4).getUTCDay();
|
|
9757
9758
|
return n === 0 || n === 6;
|
|
9758
9759
|
}) ? 1 : 5 / 7,
|
|
@@ -9797,7 +9798,7 @@ var Vl = class {
|
|
|
9797
9798
|
handleToggleTimeframeFavorite(e) {
|
|
9798
9799
|
this.host.timeframeFavorites.toggle(e), this.host.toolbar?.setTimeframeFavorites(this.pinnedTimeframes()), this.host.updateUI();
|
|
9799
9800
|
}
|
|
9800
|
-
},
|
|
9801
|
+
}, ql = 600, Jl = 24, Yl = [
|
|
9801
9802
|
"--tcw-toolbar-h",
|
|
9802
9803
|
"--tcw-control-h",
|
|
9803
9804
|
"--tcw-control-h-sm",
|
|
@@ -9815,33 +9816,33 @@ var Vl = class {
|
|
|
9815
9816
|
"--tcw-line-height",
|
|
9816
9817
|
"--tcw-line-xs",
|
|
9817
9818
|
"--tcw-label-size"
|
|
9818
|
-
],
|
|
9819
|
-
function
|
|
9819
|
+
], Xl = 48, Zl = 5e4, Ql = 100;
|
|
9820
|
+
function $l() {
|
|
9820
9821
|
return new Promise((e) => {
|
|
9821
9822
|
if (typeof requestAnimationFrame != "function" || document.hidden) {
|
|
9822
9823
|
setTimeout(e, 0);
|
|
9823
9824
|
return;
|
|
9824
9825
|
}
|
|
9825
|
-
let t = setTimeout(e,
|
|
9826
|
+
let t = setTimeout(e, Ql);
|
|
9826
9827
|
requestAnimationFrame(() => setTimeout(() => {
|
|
9827
9828
|
clearTimeout(t), e();
|
|
9828
9829
|
}, 0));
|
|
9829
9830
|
});
|
|
9830
9831
|
}
|
|
9831
|
-
var
|
|
9832
|
-
function
|
|
9832
|
+
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;
|
|
9833
|
+
function su(e) {
|
|
9833
9834
|
if (e.ctrlKey || e.metaKey || e.altKey || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph")) return null;
|
|
9834
9835
|
if (/^[a-z]$/i.test(e.key)) return e.key;
|
|
9835
9836
|
let t = /^Key([A-Z])$/.exec(e.code ?? "");
|
|
9836
9837
|
return t && [...e.key].length === 1 && !/[\s\d]/.test(e.key) ? t[1].toLowerCase() : null;
|
|
9837
9838
|
}
|
|
9838
|
-
var
|
|
9839
|
+
var cu = 1e3, lu = [
|
|
9839
9840
|
["barCountdown", "barCountdown"],
|
|
9840
9841
|
["logScale", "logScale"],
|
|
9841
9842
|
["legendVisible", "legend"],
|
|
9842
9843
|
["volumeVisible", "volume"]
|
|
9843
|
-
],
|
|
9844
|
-
function
|
|
9844
|
+
], uu = v.filter((e) => Ke[e] !== "color");
|
|
9845
|
+
function du(e) {
|
|
9845
9846
|
if (!e.feed) return e;
|
|
9846
9847
|
if (e.adapter) throw TypeError("A widget takes an adapter or a feed, not both");
|
|
9847
9848
|
return {
|
|
@@ -9850,19 +9851,19 @@ function cu(e) {
|
|
|
9850
9851
|
feed: void 0
|
|
9851
9852
|
};
|
|
9852
9853
|
}
|
|
9853
|
-
var
|
|
9854
|
-
intervals = new
|
|
9855
|
-
drawingEdit = new
|
|
9856
|
-
chartSettings = new
|
|
9857
|
-
docking = new
|
|
9858
|
-
layouts = new
|
|
9859
|
-
commands = new
|
|
9860
|
-
legend = new
|
|
9861
|
-
menus = new
|
|
9862
|
-
trading = new
|
|
9863
|
-
alerting = new
|
|
9864
|
-
watching = new
|
|
9865
|
-
comparing = new
|
|
9854
|
+
var fu = class {
|
|
9855
|
+
intervals = new Kl(this.intervalsHost());
|
|
9856
|
+
drawingEdit = new Wl(this.drawingEditHost());
|
|
9857
|
+
chartSettings = new Vl(this.chartSettingsHost());
|
|
9858
|
+
docking = new Ml(this.dockingHost());
|
|
9859
|
+
layouts = new kl(this.layoutsHost());
|
|
9860
|
+
commands = new fl(this.commandsHost());
|
|
9861
|
+
legend = new dl(this.legendHost());
|
|
9862
|
+
menus = new Qc(this.menusHost());
|
|
9863
|
+
trading = new Xc(this.tradingHost());
|
|
9864
|
+
alerting = new Yc(this.alertingHost());
|
|
9865
|
+
watching = new Jc(this.watchingHost());
|
|
9866
|
+
comparing = new qc(this.comparingHost());
|
|
9866
9867
|
chart;
|
|
9867
9868
|
state;
|
|
9868
9869
|
themeOf = {
|
|
@@ -9931,7 +9932,7 @@ var lu = class {
|
|
|
9931
9932
|
uiVariables = !1;
|
|
9932
9933
|
chartFontBase = null;
|
|
9933
9934
|
scaleObserver = null;
|
|
9934
|
-
templates = new
|
|
9935
|
+
templates = new Os();
|
|
9935
9936
|
templatePrompt = null;
|
|
9936
9937
|
markerTip = null;
|
|
9937
9938
|
dataWindow = null;
|
|
@@ -9940,11 +9941,11 @@ var lu = class {
|
|
|
9940
9941
|
lastHoverPrevClose = null;
|
|
9941
9942
|
legendHoverIndex = null;
|
|
9942
9943
|
pointerOnChart = !1;
|
|
9943
|
-
favoritesStore = new
|
|
9944
|
-
indicatorFavorites = new
|
|
9944
|
+
favoritesStore = new Fs();
|
|
9945
|
+
indicatorFavorites = new Fs("tcw:indicator-favorites");
|
|
9945
9946
|
indicatorDefaults = new ka();
|
|
9946
|
-
timeframeFavorites = new
|
|
9947
|
-
customTimeframes = new
|
|
9947
|
+
timeframeFavorites = new Fs("tcw:tf-favorites");
|
|
9948
|
+
customTimeframes = new Fs("tcw:tf-custom");
|
|
9948
9949
|
timeframes = [];
|
|
9949
9950
|
sessionRefPrice = null;
|
|
9950
9951
|
symbolInfoPanel = null;
|
|
@@ -9983,7 +9984,7 @@ var lu = class {
|
|
|
9983
9984
|
hostLayer = null;
|
|
9984
9985
|
priceAxisAddDefault = !1;
|
|
9985
9986
|
constructor(e, t = {}) {
|
|
9986
|
-
let n =
|
|
9987
|
+
let n = du(t);
|
|
9987
9988
|
this.options = n;
|
|
9988
9989
|
let { isDark: r, resolvedTheme: i, features: a, chartFeatures: o } = this.readOptions(n);
|
|
9989
9990
|
this.buildRoot(e, n, r, i), this.buildToolbar(n, a);
|
|
@@ -10044,7 +10045,7 @@ var lu = class {
|
|
|
10044
10045
|
...o,
|
|
10045
10046
|
priceAxisAddButton: this.priceAxisAddDefault && this.featureState["menu.priceAxisAdd"]
|
|
10046
10047
|
};
|
|
10047
|
-
if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(
|
|
10048
|
+
if (this.canExport = o.dataExport !== !1, this.chartSettings.settingsLocked = new Set(lu.filter(([, e]) => o[e] === !1).map(([e]) => e)), this.chartSettings.settingsDefaults = {
|
|
10048
10049
|
...this.chartSettings.settingsState,
|
|
10049
10050
|
legendVisible: o.legend !== !1,
|
|
10050
10051
|
volumeVisible: o.volume !== !1,
|
|
@@ -10079,8 +10080,8 @@ var lu = class {
|
|
|
10079
10080
|
}
|
|
10080
10081
|
buildRoot(e, t, n, r) {
|
|
10081
10082
|
on(), this.root = document.createElement("div"), this.root.className = "tcw-root";
|
|
10082
|
-
let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir :
|
|
10083
|
-
this.root.dir = i, this.portal.dir = i, e.appendChild(this.root), this.tooltip = new
|
|
10083
|
+
let i = t.dir === "ltr" || t.dir === "rtl" ? t.dir : xu(t.locale) ? "rtl" : "ltr";
|
|
10084
|
+
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({
|
|
10084
10085
|
dark: n,
|
|
10085
10086
|
theme: r
|
|
10086
10087
|
});
|
|
@@ -10088,7 +10089,7 @@ var lu = class {
|
|
|
10088
10089
|
this.scope.run(() => $n(() => {
|
|
10089
10090
|
let { dark: e, theme: t } = this.look.get();
|
|
10090
10091
|
this.root.dataset.tcwTheme = this.portal.dataset.tcwTheme = e ? "dark" : "light", a && (this.keepingLook(() => this.chart.setTheme(t)), this.paintWatermark());
|
|
10091
|
-
})), a = !0, this.stopKeyboardInset =
|
|
10092
|
+
})), a = !0, this.stopKeyboardInset = Is([this.root, this.portal]), this.stopNarrow = Ls(this.root, (e) => {
|
|
10092
10093
|
this.toolbar?.fit(), e || this.sidebar?.closeOverlay(), this.docking.syncRail();
|
|
10093
10094
|
}), 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], {
|
|
10094
10095
|
layer: this.overlayHost,
|
|
@@ -10165,16 +10166,16 @@ var lu = class {
|
|
|
10165
10166
|
}, this.t), this.scope.run(() => $n(() => {
|
|
10166
10167
|
let e = this.chartSettings.followCrosshairCursor();
|
|
10167
10168
|
this.sidebar?.showCrosshairCursor(e);
|
|
10168
|
-
})), this.chartContainer = document.createElement("div"), this.chartContainer.className = "tcw-chart-container", this.chartContainer.dir = "ltr", n.appendChild(this.chartContainer), this.loading = new
|
|
10169
|
+
})), 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, {
|
|
10169
10170
|
loading: this.t("history.loading"),
|
|
10170
10171
|
failed: this.t("history.failed")
|
|
10171
|
-
}), this.docking.dock = new
|
|
10172
|
+
}), this.docking.dock = new Gs(n, {
|
|
10172
10173
|
labels: {
|
|
10173
10174
|
rail: this.t("dock.rail"),
|
|
10174
10175
|
resize: this.t("dock.resize")
|
|
10175
10176
|
},
|
|
10176
|
-
savedWidth: () =>
|
|
10177
|
-
saveWidth: (e) =>
|
|
10177
|
+
savedWidth: () => yu(),
|
|
10178
|
+
saveWidth: (e) => bu(e),
|
|
10178
10179
|
railShown: () => this.docking.railShown(),
|
|
10179
10180
|
focusAfterClose: (e) => this.docking.panelFocusTarget(e),
|
|
10180
10181
|
room: () => n.clientWidth
|
|
@@ -10277,7 +10278,7 @@ var lu = class {
|
|
|
10277
10278
|
}
|
|
10278
10279
|
}), this.clockTimer = setInterval(() => {
|
|
10279
10280
|
!Kr() && this.featureState.statusBar && this.featureState["statusBar.clock"] && this.statusBar?.tick();
|
|
10280
|
-
},
|
|
10281
|
+
}, cu), this.chart.on("priceRangeChange", () => this.chartSettings.refreshScaleSwitches()), this.chartSettings.refreshScaleSwitches(), this.goToDatePart = this.lazyPart(Y.goToDate, ({ WidgetGoToDate: e }) => new e(this.overlayHost, () => ({
|
|
10281
10282
|
title: this.t("goTo.title"),
|
|
10282
10283
|
date: this.t("range.date"),
|
|
10283
10284
|
range: this.t("goTo.range"),
|
|
@@ -10336,7 +10337,7 @@ var lu = class {
|
|
|
10336
10337
|
eraser: t ?? this.state.eraser,
|
|
10337
10338
|
zoomArea: n ?? this.state.zoomArea
|
|
10338
10339
|
}, this.updateUI();
|
|
10339
|
-
}), 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
|
|
10340
|
+
}), 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, {
|
|
10340
10341
|
onToggleVisible: (e, t, n) => {
|
|
10341
10342
|
n === "compare" ? this.chart.setCompareVisible(e, t) : this.chart.setIndicatorVisible(e, t), this.legend.scheduleLegend(), this.objectTree?.isOpen() && this.docking.refreshObjects();
|
|
10342
10343
|
},
|
|
@@ -10349,7 +10350,7 @@ var lu = class {
|
|
|
10349
10350
|
onMore: (e, t) => this.legend.openLegendMenu(e, t),
|
|
10350
10351
|
onPaneAction: (e, t) => this.legend.runPaneAction(e, t),
|
|
10351
10352
|
onStackResize: (e) => this.chart.setLegendStack?.(e ? {
|
|
10352
|
-
width:
|
|
10353
|
+
width: ll(this.chart) + e.width,
|
|
10353
10354
|
height: 1 + e.height
|
|
10354
10355
|
} : null)
|
|
10355
10356
|
}, {
|
|
@@ -10398,7 +10399,7 @@ var lu = class {
|
|
|
10398
10399
|
"dataUpdate",
|
|
10399
10400
|
"symbolInfoChange"
|
|
10400
10401
|
]) this.chart.on(e, () => this.placeDrawingButton());
|
|
10401
|
-
this.placeDrawingButton(), this.dataWindow = new
|
|
10402
|
+
this.placeDrawingButton(), this.dataWindow = new Oc(this.root, {
|
|
10402
10403
|
formatPrice: (e) => this.formatAlertPrice(e),
|
|
10403
10404
|
formatPercent: (e) => this.formatNumber(e, 2),
|
|
10404
10405
|
formatVolume: (e) => this.formatVolume(e),
|
|
@@ -10423,7 +10424,7 @@ var lu = class {
|
|
|
10423
10424
|
},
|
|
10424
10425
|
toWallTime: (e) => X(e * E(this.chart.getData()), this.displayTimezone()),
|
|
10425
10426
|
fromWallTime: (e, t) => {
|
|
10426
|
-
let n =
|
|
10427
|
+
let n = Hs(e, t, this.displayTimezone());
|
|
10427
10428
|
return n === null ? null : n / E(this.chart.getData());
|
|
10428
10429
|
},
|
|
10429
10430
|
roundPrice: (e) => this.chart.roundPrice(e),
|
|
@@ -10436,7 +10437,7 @@ var lu = class {
|
|
|
10436
10437
|
save: (t) => this.drawingEdit.promptSaveDrawingTemplate(e, t),
|
|
10437
10438
|
remove: (t, n) => e.remove(t, n)
|
|
10438
10439
|
}
|
|
10439
|
-
}, this.t)), this.drawingEdit.inlineText = new
|
|
10440
|
+
}, this.t)), this.drawingEdit.inlineText = new No(this.overlayHost), this.chart.on("drawingDoubleClick", (e) => {
|
|
10440
10441
|
let t = e.payload.id, n = this.chart.getDrawings().find((e) => e.id === t)?.type;
|
|
10441
10442
|
n && K[n] && this.drawingEdit.editTextInPlace(t, !1) || this.drawingEdit.openDrawingSettings(t, n && K[n] ? { tab: "text" } : {});
|
|
10442
10443
|
}), this.chart.on("drawingRemove", (e) => {
|
|
@@ -10454,7 +10455,7 @@ var lu = class {
|
|
|
10454
10455
|
justDrawn: !0
|
|
10455
10456
|
}));
|
|
10456
10457
|
}, s = () => setTimeout(o, 0);
|
|
10457
|
-
window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o,
|
|
10458
|
+
window.addEventListener("pointerup", s), window.addEventListener("pointercancel", s), i = window.setTimeout(o, ql), this.drawingEdit.cancelTextPrompt = a;
|
|
10458
10459
|
}), this.drawingStyle = new co(this.root, {
|
|
10459
10460
|
onStyleChange: (e) => {
|
|
10460
10461
|
this.chart.setDrawingStyle(e), this.chart.setSelectedDrawingStyle(e);
|
|
@@ -10466,7 +10467,7 @@ var lu = class {
|
|
|
10466
10467
|
this.menus.drawingMenu = new C(this.root, this.t("drawingMenu.label")), this.chart.on("drawingContextMenu", (e) => {
|
|
10467
10468
|
let { id: t, x: n, y: r } = e.payload;
|
|
10468
10469
|
this.menus.openDrawingMenu(t, n, r);
|
|
10469
|
-
}), this.drawingEdit.selectionToolbar = new
|
|
10470
|
+
}), this.drawingEdit.selectionToolbar = new yo(this.root, {
|
|
10470
10471
|
onStyle: (e) => {
|
|
10471
10472
|
for (let t of this.chart.getSelectedDrawingIds()) {
|
|
10472
10473
|
let n = this.chart.getDrawings().find((e) => e.id === t)?.type, r = n ? K[n] : void 0, i = e.fillColor !== void 0 && r && !r.box ? {
|
|
@@ -10532,19 +10533,19 @@ var lu = class {
|
|
|
10532
10533
|
...this.menus.chartMenuContext(s),
|
|
10533
10534
|
...o ? { pane: this.chart.getPaneScale(o) } : {}
|
|
10534
10535
|
};
|
|
10535
|
-
this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(
|
|
10536
|
+
this.menus.menuPane = o ?? null, this.menus.openChartMenu(ce(Go(t, c, this.t), _e, this.featureState), n, r, {
|
|
10536
10537
|
area: t,
|
|
10537
10538
|
price: s,
|
|
10538
10539
|
time: a
|
|
10539
10540
|
});
|
|
10540
10541
|
}), this.chart.on("priceAxisAdd", (e) => {
|
|
10541
10542
|
if (!this.featureState["menu.priceAxisAdd"]) return;
|
|
10542
|
-
let { price: t, x: n, y: r } = e.payload, i = this.chart.roundPrice(t), a = ce(
|
|
10543
|
+
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);
|
|
10543
10544
|
this.menus.openChartMenu(a, n, r, {
|
|
10544
10545
|
area: "priceAxisAdd",
|
|
10545
10546
|
price: i
|
|
10546
10547
|
});
|
|
10547
|
-
}), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new
|
|
10548
|
+
}), this.chart.on("signalMarkerHover", (e) => this.showMarkerTip(e.payload)), this.intervals.intervalInput = new Ds(this.chartContainer, {
|
|
10548
10549
|
title: this.t("interval.title"),
|
|
10549
10550
|
hint: this.t("interval.hint"),
|
|
10550
10551
|
invalid: this.t("interval.invalid")
|
|
@@ -10552,7 +10553,7 @@ var lu = class {
|
|
|
10552
10553
|
}
|
|
10553
10554
|
buildTrading(e, t) {
|
|
10554
10555
|
if (e.layouts !== !1 && this.layouts.setupLayouts(e.layouts === !0 || e.layouts === void 0 ? {} : e.layouts), e.trading !== !1) {
|
|
10555
|
-
this.trading.orderTicket = new
|
|
10556
|
+
this.trading.orderTicket = new bs(this.root, {
|
|
10556
10557
|
onSubmit: (e) => {
|
|
10557
10558
|
this.chart.placeOrderIntent(e), this.say(w(this.t("ticket.sent"), {
|
|
10558
10559
|
side: this.t(e.side === "buy" ? "ticket.buy" : "ticket.sell"),
|
|
@@ -10563,7 +10564,7 @@ var lu = class {
|
|
|
10563
10564
|
formatPrice: (e) => this.formatAlertPrice(e),
|
|
10564
10565
|
formatAmount: (e) => this.formatMoney(e),
|
|
10565
10566
|
formatNumber: (e, t) => this.formatNumber(e, t)
|
|
10566
|
-
}, this.t), this.trading.accountPanel = new
|
|
10567
|
+
}, this.t), this.trading.accountPanel = new os(t, {
|
|
10567
10568
|
onClosePosition: (e) => this.chart.closePositionIntent(e),
|
|
10568
10569
|
onReversePosition: (e) => this.chart.reversePositionIntent(e),
|
|
10569
10570
|
onCancelOrder: (e) => this.chart.cancelOrderIntent(e),
|
|
@@ -10588,7 +10589,7 @@ var lu = class {
|
|
|
10588
10589
|
]) this.chart.on(e, () => this.trading.refreshAccountSoon());
|
|
10589
10590
|
}
|
|
10590
10591
|
if (e.trading !== !1) {
|
|
10591
|
-
if (this.trading.bracketBar = new
|
|
10592
|
+
if (this.trading.bracketBar = new xc(this.chartContainer, {
|
|
10592
10593
|
onConfirm: () => this.chart.confirmBracket(),
|
|
10593
10594
|
onCancel: () => {
|
|
10594
10595
|
this.chart.cancelBracket(), this.trading.bracketBar?.hide();
|
|
@@ -10597,7 +10598,7 @@ var lu = class {
|
|
|
10597
10598
|
let t = e.payload;
|
|
10598
10599
|
this.trading.bracketBar?.hide(), this.say(w(this.t(t.side === "buy" ? "bracket.longPlaced" : "bracket.shortPlaced"), { rr: t.riskReward.toFixed(2) }));
|
|
10599
10600
|
}), e.depthLadder) {
|
|
10600
|
-
this.trading.depthLadder = new
|
|
10601
|
+
this.trading.depthLadder = new Tc(this.root, {
|
|
10601
10602
|
onTrade: (e, t) => {
|
|
10602
10603
|
this.chart.placeOrderIntent({
|
|
10603
10604
|
side: e,
|
|
@@ -10639,7 +10640,7 @@ var lu = class {
|
|
|
10639
10640
|
}, 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) => {
|
|
10640
10641
|
let t = e.payload;
|
|
10641
10642
|
this.alerting.refreshAlerts(), this.featureState.alerts && this.say(w(this.t("alerts.expiredToast"), { text: t.message ?? this.alerting.alertText(t) }));
|
|
10642
|
-
}), e.alertNotifications && (this.alerting.alertNotifier = new
|
|
10643
|
+
}), e.alertNotifications && (this.alerting.alertNotifier = new Sc(e.alertNotifications)), this.chart.on("alertTriggered", (e) => {
|
|
10643
10644
|
let t = e.payload;
|
|
10644
10645
|
if (this.alerting.refreshAlerts(), !this.featureState.alerts) return;
|
|
10645
10646
|
let n = `${this.alerting.alertText(t)}${t.message ? ` — ${t.message}` : ""}`;
|
|
@@ -10734,8 +10735,8 @@ var lu = class {
|
|
|
10734
10735
|
onAction: (e) => this.commands.handleAction(e),
|
|
10735
10736
|
onClose: () => {}
|
|
10736
10737
|
}, this.overlayHost, this.t, {
|
|
10737
|
-
list: () =>
|
|
10738
|
-
add: (e) =>
|
|
10738
|
+
list: () => gu(),
|
|
10739
|
+
add: (e) => _u([e, ...gu().filter((t) => t !== e)])
|
|
10739
10740
|
})), this.boundGlobalKeydown = (e) => {
|
|
10740
10741
|
if (this.handleHostHotkey(e) || this.featureState.hotkeys && this.replay.isOpen() && this.replay.handleReplayKey(e)) return;
|
|
10741
10742
|
let t = L(this.root), n = (e) => this.featureState.hotkeys && this.featureState[e];
|
|
@@ -10756,11 +10757,11 @@ var lu = class {
|
|
|
10756
10757
|
let t = document.activeElement;
|
|
10757
10758
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
10758
10759
|
e.preventDefault(), this.intervals.intervalInput.open(e.key);
|
|
10759
|
-
} else if (
|
|
10760
|
+
} else if (su(e) !== null) {
|
|
10760
10761
|
if (e.defaultPrevented || !n("symbolTyping") || !this.featureState.symbolSearch || R() || Ar() || !L(this.root, !0)) return;
|
|
10761
10762
|
let t = document.activeElement;
|
|
10762
10763
|
if (t && t !== document.body && !this.root.contains(t)) return;
|
|
10763
|
-
e.preventDefault(), this.openSymbolSearch(
|
|
10764
|
+
e.preventDefault(), this.openSymbolSearch(su(e));
|
|
10764
10765
|
} else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyI" || e.code === "KeyG" || e.code === "KeyR")) {
|
|
10765
10766
|
if (R() || !t) return;
|
|
10766
10767
|
if (e.code === "KeyI") {
|
|
@@ -10789,13 +10790,13 @@ var lu = class {
|
|
|
10789
10790
|
}
|
|
10790
10791
|
preloadDialogsWhenIdle() {
|
|
10791
10792
|
let e = () => {
|
|
10792
|
-
this.destroyed ||
|
|
10793
|
+
this.destroyed || zs();
|
|
10793
10794
|
}, t = globalThis;
|
|
10794
10795
|
if (t.requestIdleCallback && t.cancelIdleCallback) {
|
|
10795
|
-
let n = t.requestIdleCallback(e, { timeout:
|
|
10796
|
+
let n = t.requestIdleCallback(e, { timeout: tu }), r = t.cancelIdleCallback;
|
|
10796
10797
|
this.stopPreload = () => r(n);
|
|
10797
10798
|
} else {
|
|
10798
|
-
let t = setTimeout(e,
|
|
10799
|
+
let t = setTimeout(e, nu);
|
|
10799
10800
|
this.stopPreload = () => clearTimeout(t);
|
|
10800
10801
|
}
|
|
10801
10802
|
}
|
|
@@ -10957,7 +10958,7 @@ var lu = class {
|
|
|
10957
10958
|
for (let t of [this.root, this.portal]) {
|
|
10958
10959
|
if (ba(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
|
|
10959
10960
|
let n = ya(e);
|
|
10960
|
-
for (let e of
|
|
10961
|
+
for (let e of Yl) this.uiScale === 1 ? t.style.removeProperty(e) : t.style.setProperty(e, n[e]);
|
|
10961
10962
|
}
|
|
10962
10963
|
}
|
|
10963
10964
|
fitScale() {
|
|
@@ -10966,7 +10967,7 @@ var lu = class {
|
|
|
10966
10967
|
if (e !== this.uiScale) {
|
|
10967
10968
|
if (this.ui.scale === "auto") {
|
|
10968
10969
|
let t = this.root.clientWidth;
|
|
10969
|
-
if ((e > this.uiScale ? ta(t -
|
|
10970
|
+
if ((e > this.uiScale ? ta(t - Jl) : ta(t + Jl)) === this.uiScale) return;
|
|
10970
10971
|
}
|
|
10971
10972
|
this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
|
|
10972
10973
|
}
|
|
@@ -11119,9 +11120,9 @@ var lu = class {
|
|
|
11119
11120
|
for (let [n, r] of t) e(n) && r();
|
|
11120
11121
|
}
|
|
11121
11122
|
addHotkey(e) {
|
|
11122
|
-
let t =
|
|
11123
|
+
let t = Vc(e.keys);
|
|
11123
11124
|
if (!t) return console.warn(`[ChartWidget] Can't read the shortcut "${e.keys}": modifiers (Ctrl, Alt, Shift) and a key, joined by +.`), null;
|
|
11124
|
-
|
|
11125
|
+
Wc(t) && console.warn(`[ChartWidget] The chart answers ${e.keys} itself (drawings, scrolling or zoom): both will run.`);
|
|
11125
11126
|
let n = {
|
|
11126
11127
|
spec: e,
|
|
11127
11128
|
parsed: t
|
|
@@ -11131,8 +11132,8 @@ var lu = class {
|
|
|
11131
11132
|
} };
|
|
11132
11133
|
}
|
|
11133
11134
|
handleHostHotkey(e) {
|
|
11134
|
-
if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() ||
|
|
11135
|
-
let t = this.hostHotkeys.find((t) =>
|
|
11135
|
+
if (this.hostHotkeys.length === 0 || !this.featureState.hotkeys || e.isComposing || e.keyCode === 229 || e.getModifierState?.("AltGraph") || e.defaultPrevented || R() || Gc(e) || Ar()) return !1;
|
|
11136
|
+
let t = this.hostHotkeys.find((t) => Hc(e, t.parsed));
|
|
11136
11137
|
if (!t) return !1;
|
|
11137
11138
|
let n = !t.parsed.ctrl && !t.parsed.alt;
|
|
11138
11139
|
if (!L(this.root, n)) return !1;
|
|
@@ -11141,13 +11142,13 @@ var lu = class {
|
|
|
11141
11142
|
}
|
|
11142
11143
|
paintWatermark() {
|
|
11143
11144
|
this.chart.setWatermark(De(this.state.symbol).ticker.replace("USDT", " / USDT"), {
|
|
11144
|
-
fontSize:
|
|
11145
|
-
color: this.state.isDark ?
|
|
11145
|
+
fontSize: ru,
|
|
11146
|
+
color: this.state.isDark ? iu : au
|
|
11146
11147
|
});
|
|
11147
11148
|
}
|
|
11148
11149
|
keepingLook(e) {
|
|
11149
11150
|
this.chartSettings.settingsEdit && this.settings?.close();
|
|
11150
|
-
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(
|
|
11151
|
+
let t = this.chart.getOverrides?.({ layer: "user" }) ?? {}, n = Object.fromEntries(uu.filter((e) => t[e] !== void 0).map((e) => [e, t[e]]));
|
|
11151
11152
|
e(), Object.keys(n).length > 0 && this.chart.applyOverrides(n, { layer: "user" });
|
|
11152
11153
|
}
|
|
11153
11154
|
sheetKeyOn(e) {
|
|
@@ -11200,7 +11201,7 @@ var lu = class {
|
|
|
11200
11201
|
let i = e.items();
|
|
11201
11202
|
if (i.length === 0) return;
|
|
11202
11203
|
let a = t.menuAnchor(r);
|
|
11203
|
-
n.openUnder(
|
|
11204
|
+
n.openUnder(Ic([], i), a, (e) => Lc(e, i));
|
|
11204
11205
|
}
|
|
11205
11206
|
});
|
|
11206
11207
|
return r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", "false"), t.tidy(), {
|
|
@@ -11286,7 +11287,7 @@ var lu = class {
|
|
|
11286
11287
|
from: i(o.from),
|
|
11287
11288
|
to: i(o.to)
|
|
11288
11289
|
},
|
|
11289
|
-
withTime: !(k(this.state.timeframe) >=
|
|
11290
|
+
withTime: !(k(this.state.timeframe) >= eu),
|
|
11290
11291
|
max: s,
|
|
11291
11292
|
today: s
|
|
11292
11293
|
});
|
|
@@ -11296,12 +11297,12 @@ var lu = class {
|
|
|
11296
11297
|
if (t.length === 0) return;
|
|
11297
11298
|
let r = E(t);
|
|
11298
11299
|
if (e.kind === "date") {
|
|
11299
|
-
let i =
|
|
11300
|
+
let i = Hs(e.date, e.time, n);
|
|
11300
11301
|
if (i === null) return;
|
|
11301
11302
|
this.chart.goToTime(i / r), i / r < t[0].time && this.say(this.t("range.beforeData"));
|
|
11302
11303
|
return;
|
|
11303
11304
|
}
|
|
11304
|
-
let i =
|
|
11305
|
+
let i = Hs(e.from.date, e.from.time, n), a = Hs(e.to.date, e.to.time, n);
|
|
11305
11306
|
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")));
|
|
11306
11307
|
}
|
|
11307
11308
|
showMarkerTip(e) {
|
|
@@ -11331,7 +11332,7 @@ var lu = class {
|
|
|
11331
11332
|
this.say(this.t("templates.nothing"), "error");
|
|
11332
11333
|
return;
|
|
11333
11334
|
}
|
|
11334
|
-
this.templatePrompt ??= new
|
|
11335
|
+
this.templatePrompt ??= new Ts(this.root, this.t), this.templatePrompt.open({
|
|
11335
11336
|
title: this.t("templates.saveTitle"),
|
|
11336
11337
|
submitLabel: this.t("common.save"),
|
|
11337
11338
|
placeholder: this.t("templates.namePlaceholder"),
|
|
@@ -11351,9 +11352,9 @@ var lu = class {
|
|
|
11351
11352
|
}
|
|
11352
11353
|
async switchLocalTimeframe() {
|
|
11353
11354
|
if (!this.baseSeries) return;
|
|
11354
|
-
let e = ++this.localSeq, t = this.lastLocalSwitchMs >=
|
|
11355
|
+
let e = ++this.localSeq, t = this.lastLocalSwitchMs >= Xl || this.baseSeries.length >= Zl;
|
|
11355
11356
|
try {
|
|
11356
|
-
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await
|
|
11357
|
+
if (t && (this.loading.begin(this.chart.getData().length > 0, !0), await $l(), e !== this.localSeq || this.destroyed)) return;
|
|
11357
11358
|
this.applyTimeframeData();
|
|
11358
11359
|
} finally {
|
|
11359
11360
|
e === this.localSeq && this.loading.end();
|
|
@@ -11467,7 +11468,7 @@ var lu = class {
|
|
|
11467
11468
|
defaults: r.descriptor.defaultConfig,
|
|
11468
11469
|
params: r.params,
|
|
11469
11470
|
inputs: r.descriptor.inputs,
|
|
11470
|
-
lineSources:
|
|
11471
|
+
lineSources: pu(t, n, this.t),
|
|
11471
11472
|
plots: r.descriptor.plots,
|
|
11472
11473
|
colors: i?.colors,
|
|
11473
11474
|
lineWidth: i?.lineWidths[0],
|
|
@@ -11486,7 +11487,7 @@ var lu = class {
|
|
|
11486
11487
|
this.alerting.refreshAlerts(), this.trading.refreshAccountSoon(), this.dataWindow?.isOpen() && this.dataWindow.render(this.docking.buildDataWindowModel());
|
|
11487
11488
|
}
|
|
11488
11489
|
formatMoney(e) {
|
|
11489
|
-
return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()),
|
|
11490
|
+
return this.formatNumber(e, Math.min(gt(this.chart.getPriceStep()), ou));
|
|
11490
11491
|
}
|
|
11491
11492
|
formatVolume(e) {
|
|
11492
11493
|
return et(e, this.chartSettings.settingsState.numberLocale || "en-US");
|
|
@@ -11507,7 +11508,7 @@ var lu = class {
|
|
|
11507
11508
|
});
|
|
11508
11509
|
}
|
|
11509
11510
|
indicatorValueText(e, t, n) {
|
|
11510
|
-
return t ? this.chart.formatPrice(e) :
|
|
11511
|
+
return t ? this.chart.formatPrice(e) : bc(e, n);
|
|
11511
11512
|
}
|
|
11512
11513
|
chartSetsDecimals() {
|
|
11513
11514
|
return this.chart.getMarket?.()?.pricePrecision != null || this.chart.getSymbolInfo?.()?.pricePrecision != null;
|
|
@@ -11592,7 +11593,7 @@ var lu = class {
|
|
|
11592
11593
|
}), this.updateUI();
|
|
11593
11594
|
}
|
|
11594
11595
|
lazyPart(e, t) {
|
|
11595
|
-
return new
|
|
11596
|
+
return new Rs(e, t, (e) => e.destroy(), () => this.say(this.t("common.partFailed"), "error"));
|
|
11596
11597
|
}
|
|
11597
11598
|
whenLoaded(e, t, n) {
|
|
11598
11599
|
if (!e || !t()) return;
|
|
@@ -12366,7 +12367,7 @@ var lu = class {
|
|
|
12366
12367
|
};
|
|
12367
12368
|
}
|
|
12368
12369
|
};
|
|
12369
|
-
function
|
|
12370
|
+
function pu(e, t, n) {
|
|
12370
12371
|
let r = (e) => {
|
|
12371
12372
|
let t = Rt(e.descriptor);
|
|
12372
12373
|
return t && st(e.params[t])?.instanceId || null;
|
|
@@ -12389,66 +12390,66 @@ function uu(e, t, n) {
|
|
|
12389
12390
|
}
|
|
12390
12391
|
return a;
|
|
12391
12392
|
}
|
|
12392
|
-
var
|
|
12393
|
-
function
|
|
12393
|
+
var mu = "tcw:recentCommands", hu = 10;
|
|
12394
|
+
function gu() {
|
|
12394
12395
|
try {
|
|
12395
|
-
let e = JSON.parse(qr()?.getItem(
|
|
12396
|
-
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0,
|
|
12396
|
+
let e = JSON.parse(qr()?.getItem(mu) ?? "[]");
|
|
12397
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, hu) : [];
|
|
12397
12398
|
} catch {
|
|
12398
12399
|
return [];
|
|
12399
12400
|
}
|
|
12400
12401
|
}
|
|
12401
|
-
function
|
|
12402
|
+
function _u(e) {
|
|
12402
12403
|
try {
|
|
12403
|
-
qr()?.setItem(
|
|
12404
|
+
qr()?.setItem(mu, JSON.stringify(e.slice(0, hu)));
|
|
12404
12405
|
} catch {}
|
|
12405
12406
|
}
|
|
12406
|
-
var
|
|
12407
|
-
function
|
|
12407
|
+
var vu = "tcw:dockWidth";
|
|
12408
|
+
function yu() {
|
|
12408
12409
|
try {
|
|
12409
|
-
let e = Number(qr()?.getItem(
|
|
12410
|
+
let e = Number(qr()?.getItem(vu) ?? NaN);
|
|
12410
12411
|
return Number.isFinite(e) && e > 0 ? e : null;
|
|
12411
12412
|
} catch {
|
|
12412
12413
|
return null;
|
|
12413
12414
|
}
|
|
12414
12415
|
}
|
|
12415
|
-
function
|
|
12416
|
+
function bu(e) {
|
|
12416
12417
|
try {
|
|
12417
|
-
qr()?.setItem(
|
|
12418
|
+
qr()?.setItem(vu, String(e));
|
|
12418
12419
|
} catch {}
|
|
12419
12420
|
}
|
|
12420
|
-
function
|
|
12421
|
+
function xu(e) {
|
|
12421
12422
|
return !!e && /^(ar|he|iw|fa|ur|ps|yi|dv|ckb|sd|ug)(-|$)/i.test(e);
|
|
12422
12423
|
}
|
|
12423
12424
|
//#endregion
|
|
12424
12425
|
//#region src/widget/GridLayoutPicker.ts
|
|
12425
|
-
var
|
|
12426
|
+
var Su = 2, Cu = 20, wu = 2, Tu = 16, Eu = 2, Du = 4, Ou = {
|
|
12426
12427
|
left: "grid.layoutBigLeft",
|
|
12427
12428
|
right: "grid.layoutBigRight",
|
|
12428
12429
|
top: "grid.layoutBigTop",
|
|
12429
12430
|
bottom: "grid.layoutBigBottom"
|
|
12430
12431
|
};
|
|
12431
|
-
function
|
|
12432
|
-
let r = (
|
|
12433
|
-
return [
|
|
12432
|
+
function ku(e, t, n) {
|
|
12433
|
+
let r = (Cu - wu * (n - 1)) / n;
|
|
12434
|
+
return [Su + e * (r + wu), t * r + (t - 1) * wu];
|
|
12434
12435
|
}
|
|
12435
|
-
function
|
|
12436
|
+
function Au(e, t = Tu) {
|
|
12436
12437
|
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]) => {
|
|
12437
|
-
let [a, o] =
|
|
12438
|
+
let [a, o] = ku(t, r, e.cols), [s, c] = ku(n, i, e.rows);
|
|
12438
12439
|
return `<rect x="${a}" y="${s}" width="${o}" height="${c}" rx="1"/>`;
|
|
12439
12440
|
}).join("")}</svg>`;
|
|
12440
12441
|
}
|
|
12441
|
-
function
|
|
12442
|
+
function ju(e, t) {
|
|
12442
12443
|
let n = f[e], r = s(n);
|
|
12443
12444
|
if (r === 1) return t("grid.single");
|
|
12444
12445
|
let i = m(n);
|
|
12445
|
-
return i ? w(t(
|
|
12446
|
+
return i ? w(t(Ou[i]), { count: r }) : w(t("grid.layoutOption"), {
|
|
12446
12447
|
count: r,
|
|
12447
12448
|
cols: n.cols,
|
|
12448
12449
|
rows: n.rows
|
|
12449
12450
|
});
|
|
12450
12451
|
}
|
|
12451
|
-
var
|
|
12452
|
+
var Mu = class {
|
|
12452
12453
|
button;
|
|
12453
12454
|
panel = null;
|
|
12454
12455
|
choices;
|
|
@@ -12465,8 +12466,8 @@ var ku = class {
|
|
|
12465
12466
|
}), this.render();
|
|
12466
12467
|
}
|
|
12467
12468
|
render() {
|
|
12468
|
-
let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${
|
|
12469
|
-
this.button.innerHTML =
|
|
12469
|
+
let { t: e, current: t } = this.options, n = t(), r = `${e("grid.layout")}: ${ju(n, e)}`;
|
|
12470
|
+
this.button.innerHTML = Au(f[n]) + x("chevronDown", 12), this.button.title = r, this.button.setAttribute("aria-label", r);
|
|
12470
12471
|
for (let e of this.items()) e.setAttribute("aria-checked", String(e.dataset.layout === n));
|
|
12471
12472
|
}
|
|
12472
12473
|
isOpen() {
|
|
@@ -12507,15 +12508,15 @@ var ku = class {
|
|
|
12507
12508
|
return a.className = "tcw-grid-picker-row", a.append(...t.map((e) => this.item(e))), r.append(i, a), r;
|
|
12508
12509
|
}
|
|
12509
12510
|
item(e) {
|
|
12510
|
-
let t =
|
|
12511
|
-
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 =
|
|
12511
|
+
let t = ju(e, this.options.t), n = document.createElement("button");
|
|
12512
|
+
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;
|
|
12512
12513
|
}
|
|
12513
12514
|
pick(e) {
|
|
12514
12515
|
this.close(), this.options.onPick(e), this.render();
|
|
12515
12516
|
}
|
|
12516
12517
|
place(e) {
|
|
12517
|
-
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 -
|
|
12518
|
-
e.style.left = `${Math.max(0, Math.min(o, s))}px`, e.style.top = `${n.bottom - r.top +
|
|
12518
|
+
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;
|
|
12519
|
+
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`;
|
|
12519
12520
|
}
|
|
12520
12521
|
items() {
|
|
12521
12522
|
return this.panel ? [...this.panel.querySelectorAll("[role=\"menuitemradio\"]")] : [];
|
|
@@ -12546,32 +12547,32 @@ var ku = class {
|
|
|
12546
12547
|
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];
|
|
12547
12548
|
return l[Math.min(c, l.length - 1)];
|
|
12548
12549
|
}
|
|
12549
|
-
},
|
|
12550
|
+
}, Nu = {
|
|
12550
12551
|
symbol: !1,
|
|
12551
12552
|
interval: !1,
|
|
12552
12553
|
crosshair: !0,
|
|
12553
12554
|
time: !1,
|
|
12554
12555
|
drawings: !1,
|
|
12555
12556
|
replay: !1
|
|
12556
|
-
},
|
|
12557
|
+
}, Pu = [
|
|
12557
12558
|
"symbol",
|
|
12558
12559
|
"interval",
|
|
12559
12560
|
"crosshair",
|
|
12560
12561
|
"time",
|
|
12561
12562
|
"drawings",
|
|
12562
12563
|
"replay"
|
|
12563
|
-
],
|
|
12564
|
-
function
|
|
12564
|
+
], Fu = f;
|
|
12565
|
+
function Iu(e) {
|
|
12565
12566
|
return JSON.parse(JSON.stringify(e));
|
|
12566
12567
|
}
|
|
12567
|
-
function
|
|
12568
|
+
function Lu(e) {
|
|
12568
12569
|
if (typeof e != "object" || !e) return null;
|
|
12569
12570
|
let t = e;
|
|
12570
12571
|
if (t.v !== 1 || t.kind !== "grid" || !r(t.layout) || !Array.isArray(t.cells)) return null;
|
|
12571
|
-
let n = t.cells.map(
|
|
12572
|
+
let n = t.cells.map(Ms);
|
|
12572
12573
|
if (n.some((e) => e === null)) return null;
|
|
12573
|
-
let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...
|
|
12574
|
-
for (let e of
|
|
12574
|
+
let i = typeof t.sync == "object" && t.sync !== null ? t.sync : {}, a = { ...Nu };
|
|
12575
|
+
for (let e of Pu) typeof i[e] == "boolean" && (a[e] = i[e]);
|
|
12575
12576
|
let o = typeof t.active == "number" && Number.isInteger(t.active) ? t.active : 0;
|
|
12576
12577
|
return {
|
|
12577
12578
|
v: 1,
|
|
@@ -12582,7 +12583,7 @@ function Pu(e) {
|
|
|
12582
12583
|
cells: n
|
|
12583
12584
|
};
|
|
12584
12585
|
}
|
|
12585
|
-
var
|
|
12586
|
+
var Ru = class {
|
|
12586
12587
|
root;
|
|
12587
12588
|
cellsEl;
|
|
12588
12589
|
cells = [];
|
|
@@ -12612,9 +12613,9 @@ var Fu = class {
|
|
|
12612
12613
|
};
|
|
12613
12614
|
constructor(e, t = {}) {
|
|
12614
12615
|
this.options = t, this.layout = r(t.layout) ? t.layout : "1x2", this.sync = {
|
|
12615
|
-
...
|
|
12616
|
+
...Nu,
|
|
12616
12617
|
...t.sync
|
|
12617
|
-
}, 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 =
|
|
12618
|
+
}, 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();
|
|
12618
12619
|
for (let e = 0; e < this.shapeCount(); e++) this.cells.push(this.createCell(e));
|
|
12619
12620
|
this.markActive();
|
|
12620
12621
|
let n = this.cells[0]?.el.querySelector(".tcw-root")?.dataset.tcwTheme;
|
|
@@ -12740,7 +12741,7 @@ var Fu = class {
|
|
|
12740
12741
|
return JSON.stringify(this.captureLayout());
|
|
12741
12742
|
}
|
|
12742
12743
|
async applyLayoutContent(e) {
|
|
12743
|
-
let t =
|
|
12744
|
+
let t = Lu(Ns(e));
|
|
12744
12745
|
return t ? (await this.restoreLayout(t), !0) : !1;
|
|
12745
12746
|
}
|
|
12746
12747
|
destroy() {
|
|
@@ -12762,7 +12763,7 @@ var Fu = class {
|
|
|
12762
12763
|
createCell(e) {
|
|
12763
12764
|
let t = document.createElement("div");
|
|
12764
12765
|
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);
|
|
12765
|
-
let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new
|
|
12766
|
+
let r = this.options.widget ?? {}, a = this.options.cells?.[e] ?? {}, o = this.cells[this.active]?.widget, s = {}, c = new fu(t, {
|
|
12766
12767
|
...r,
|
|
12767
12768
|
...a,
|
|
12768
12769
|
...a.adapter ? { feed: void 0 } : {},
|
|
@@ -12819,7 +12820,7 @@ var Fu = class {
|
|
|
12819
12820
|
t.replaySeekToTime(n);
|
|
12820
12821
|
return;
|
|
12821
12822
|
}
|
|
12822
|
-
let r =
|
|
12823
|
+
let r = zu(t.getData(), n);
|
|
12823
12824
|
r >= 0 && t.replayStart({
|
|
12824
12825
|
startIndex: r,
|
|
12825
12826
|
paused: !0
|
|
@@ -12864,7 +12865,7 @@ var Fu = class {
|
|
|
12864
12865
|
copyDrawings(e) {
|
|
12865
12866
|
let t = e.widget.getSymbol(), n = e.widget.getChart().getDrawings();
|
|
12866
12867
|
this.quietly(() => {
|
|
12867
|
-
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(
|
|
12868
|
+
for (let r of this.cells) r !== e && r.widget.getSymbol() === t && r.widget.getChart().setDrawings(Iu(n));
|
|
12868
12869
|
});
|
|
12869
12870
|
}
|
|
12870
12871
|
mergeDrawings() {
|
|
@@ -12876,7 +12877,7 @@ var Fu = class {
|
|
|
12876
12877
|
let e = /* @__PURE__ */ new Map();
|
|
12877
12878
|
for (let n of t) for (let t of n.widget.getChart().getDrawings()) e.has(t.id) || e.set(t.id, t);
|
|
12878
12879
|
let n = [...e.values()];
|
|
12879
|
-
for (let e of t) e.widget.getChart().setDrawings(
|
|
12880
|
+
for (let e of t) e.widget.getChart().setDrawings(Iu(n));
|
|
12880
12881
|
}
|
|
12881
12882
|
});
|
|
12882
12883
|
}
|
|
@@ -12913,7 +12914,7 @@ var Fu = class {
|
|
|
12913
12914
|
let t = document.createElement("div");
|
|
12914
12915
|
t.className = "tcw-grid-group", t.setAttribute("role", "group"), t.setAttribute("aria-label", this.t("grid.layout"));
|
|
12915
12916
|
let n = this.options.layoutChoices?.filter(r) ?? l;
|
|
12916
|
-
n.length > 0 && (this.layoutPicker = new
|
|
12917
|
+
n.length > 0 && (this.layoutPicker = new Mu({
|
|
12917
12918
|
host: this.root,
|
|
12918
12919
|
t: this.t,
|
|
12919
12920
|
choices: n,
|
|
@@ -12924,7 +12925,7 @@ var Fu = class {
|
|
|
12924
12925
|
i.className = "tcw-grid-group", i.setAttribute("role", "group"), i.setAttribute("aria-label", this.t("grid.sync"));
|
|
12925
12926
|
let a = document.createElement("span");
|
|
12926
12927
|
a.className = "tcw-grid-label", a.innerHTML = `${x("link", 13)}<span>${S(this.t("grid.sync"))}</span>`, i.appendChild(a);
|
|
12927
|
-
for (let e of
|
|
12928
|
+
for (let e of Pu) {
|
|
12928
12929
|
let t = document.createElement("button");
|
|
12929
12930
|
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);
|
|
12930
12931
|
}
|
|
@@ -12968,7 +12969,7 @@ var Fu = class {
|
|
|
12968
12969
|
onChange: () => this.renderLayoutsButton(),
|
|
12969
12970
|
onError: () => this.toast(this.t("layouts.saveFailed"), "error")
|
|
12970
12971
|
});
|
|
12971
|
-
this.session = t, this.layoutsUI = new
|
|
12972
|
+
this.session = t, this.layoutsUI = new gl(t, {
|
|
12972
12973
|
root: this.root,
|
|
12973
12974
|
t: this.t,
|
|
12974
12975
|
toast: (e, t) => this.toast(e, t),
|
|
@@ -12982,12 +12983,12 @@ var Fu = class {
|
|
|
12982
12983
|
this.cells[this.active]?.widget.toast(e, t);
|
|
12983
12984
|
}
|
|
12984
12985
|
};
|
|
12985
|
-
function
|
|
12986
|
+
function zu(e, t) {
|
|
12986
12987
|
let n = -1;
|
|
12987
12988
|
for (let r = 0; r < e.length && e[r].time < t; r++) n = r;
|
|
12988
12989
|
return n;
|
|
12989
12990
|
}
|
|
12990
12991
|
//#endregion
|
|
12991
|
-
export { Se as CHART_TYPE_ICONS,
|
|
12992
|
+
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 };
|
|
12992
12993
|
|
|
12993
12994
|
//# sourceMappingURL=index.js.map
|