@tradecanvas/chart 1.73.1 → 1.73.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-D9PnPT6B.js → LayoutSession-BvBm2mOF.js} +2 -2
- package/dist/{LayoutSession-D9PnPT6B.js.map → LayoutSession-BvBm2mOF.js.map} +1 -1
- package/dist/{LayoutSession-DqKeuucc.cjs → LayoutSession-CWMw1hwg.cjs} +2 -2
- package/dist/{LayoutSession-DqKeuucc.cjs.map → LayoutSession-CWMw1hwg.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/widget/WidgetToolbar.d.ts +5 -2
- package/dist/widget/WidgetToolbar.d.ts.map +1 -1
- package/dist/widget/index.cjs +5 -5
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +153 -153
- package/dist/widget/index.js.map +1 -1
- package/package.json +3 -3
package/dist/widget/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, n as a, o, r as s, t as c } from "../LayoutSession-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, n as a, o, r as s, t as c } from "../LayoutSession-BvBm2mOF.js";
|
|
2
2
|
import { _ as l, b as u, g as d, h as f, l as p, m, n as ee, t as h, v as g, y as te } from "../widgetLocales-DgTR8JSu.js";
|
|
3
3
|
import { t as ne } from "../monthView-N8yDaTqZ.js";
|
|
4
4
|
import { a as _, c as re, d as ie, f as ae, i as oe, l as se, n as ce, o as v, r as le, s as ue, t as de, u as fe } from "../widgetFeatures-BM6u0u74.js";
|
|
@@ -630,7 +630,7 @@ var Cn = class {
|
|
|
630
630
|
let e = r.getBoundingClientRect();
|
|
631
631
|
s = Math.max(s, (i ? t.right - e.left : e.right - t.left) / n);
|
|
632
632
|
}
|
|
633
|
-
return
|
|
633
|
+
return s - o <= yn;
|
|
634
634
|
}
|
|
635
635
|
foldedState() {
|
|
636
636
|
let e = [...this.el.querySelectorAll(".tcw-toolbar-overflow")];
|
|
@@ -2329,7 +2329,7 @@ function Dr(e, t) {
|
|
|
2329
2329
|
//#endregion
|
|
2330
2330
|
//#region src/widget/pageEnv.ts
|
|
2331
2331
|
var Or = () => typeof document < "u" && document.hidden;
|
|
2332
|
-
function
|
|
2332
|
+
function L() {
|
|
2333
2333
|
try {
|
|
2334
2334
|
return typeof localStorage < "u" ? localStorage : null;
|
|
2335
2335
|
} catch {
|
|
@@ -2338,7 +2338,7 @@ function kr() {
|
|
|
2338
2338
|
}
|
|
2339
2339
|
//#endregion
|
|
2340
2340
|
//#region src/widget/WidgetWatchlist.ts
|
|
2341
|
-
var
|
|
2341
|
+
var kr = class {
|
|
2342
2342
|
el;
|
|
2343
2343
|
headerEl;
|
|
2344
2344
|
nameBtn;
|
|
@@ -2413,7 +2413,7 @@ var Ar = class {
|
|
|
2413
2413
|
let t = document.createElement("div");
|
|
2414
2414
|
t.className = "tcw-watchlist-row", t.setAttribute("role", "listitem"), t.dataset.symbol = e, t.tabIndex = 0, t.draggable = !!this.callbacks.onMove;
|
|
2415
2415
|
let n = document.createElement("div");
|
|
2416
|
-
n.className = "tcw-watchlist-symbol", n.textContent =
|
|
2416
|
+
n.className = "tcw-watchlist-symbol", n.textContent = Ar(e);
|
|
2417
2417
|
let r = document.createElement("canvas");
|
|
2418
2418
|
r.className = "tcw-watchlist-spark", r.width = 64, r.height = 22;
|
|
2419
2419
|
let i = document.createElement("div");
|
|
@@ -2473,14 +2473,14 @@ var Ar = class {
|
|
|
2473
2473
|
renderRow(e) {
|
|
2474
2474
|
let t = this.rowMap.get(e), n = this.entries.get(e);
|
|
2475
2475
|
if (!(!t || !n)) {
|
|
2476
|
-
if (n.lastPrice !== void 0 && (t.priceEl.textContent =
|
|
2476
|
+
if (n.lastPrice !== void 0 && (t.priceEl.textContent = jr(n.lastPrice, this.locale)), n.lastPrice !== void 0 && n.refPrice !== void 0 && n.refPrice !== 0) {
|
|
2477
2477
|
let e = n.lastPrice - n.refPrice, r = e / n.refPrice * 100, i = e >= 0 ? "+" : "-", a = Math.abs(r).toLocaleString(this.locale, {
|
|
2478
2478
|
minimumFractionDigits: 2,
|
|
2479
2479
|
maximumFractionDigits: 2
|
|
2480
2480
|
});
|
|
2481
2481
|
t.changeEl.textContent = `${i}${a}%`, t.changeEl.className = `tcw-watchlist-change ${e >= 0 ? "tcw-up" : "tcw-down"}`;
|
|
2482
2482
|
} else t.changeEl.textContent = "";
|
|
2483
|
-
n.sparkline && n.sparkline.length >= 2 &&
|
|
2483
|
+
n.sparkline && n.sparkline.length >= 2 && Mr(t.sparkCanvas, n.sparkline, n.refPrice ?? n.sparkline[0]);
|
|
2484
2484
|
}
|
|
2485
2485
|
}
|
|
2486
2486
|
openMenu() {
|
|
@@ -2539,7 +2539,7 @@ var Ar = class {
|
|
|
2539
2539
|
}), n.addEventListener("blur", () => i(!1)), n.focus();
|
|
2540
2540
|
}
|
|
2541
2541
|
};
|
|
2542
|
-
function
|
|
2542
|
+
function Ar(e) {
|
|
2543
2543
|
for (let t of [
|
|
2544
2544
|
"USDT",
|
|
2545
2545
|
"USD",
|
|
@@ -2549,7 +2549,7 @@ function jr(e) {
|
|
|
2549
2549
|
]) if (e.length > t.length && e.endsWith(t)) return e.slice(0, -t.length) + "/" + t;
|
|
2550
2550
|
return e;
|
|
2551
2551
|
}
|
|
2552
|
-
function
|
|
2552
|
+
function jr(e, t) {
|
|
2553
2553
|
if (e === 0) return "0";
|
|
2554
2554
|
let n = Math.abs(e);
|
|
2555
2555
|
return n >= 1e3 ? e.toLocaleString(t, {
|
|
@@ -2560,7 +2560,7 @@ function Mr(e, t) {
|
|
|
2560
2560
|
maximumFractionDigits: 4
|
|
2561
2561
|
}) : Number(e.toPrecision(4)).toLocaleString(t, { maximumFractionDigits: 10 });
|
|
2562
2562
|
}
|
|
2563
|
-
function
|
|
2563
|
+
function Mr(e, t, n) {
|
|
2564
2564
|
let r = e.getContext("2d");
|
|
2565
2565
|
if (!r) return;
|
|
2566
2566
|
let i = window.devicePixelRatio || 1;
|
|
@@ -2578,28 +2578,28 @@ function Nr(e, t, n) {
|
|
|
2578
2578
|
}
|
|
2579
2579
|
//#endregion
|
|
2580
2580
|
//#region src/widget/WatchlistStore.ts
|
|
2581
|
-
var
|
|
2582
|
-
function
|
|
2581
|
+
var Nr = 50, Pr = 500, Fr = 60, Ir = (e) => typeof e == "string" && e.trim().slice(0, Fr) || null;
|
|
2582
|
+
function Lr(e) {
|
|
2583
2583
|
let t = [];
|
|
2584
2584
|
for (let n of e) {
|
|
2585
2585
|
let e = Se(n);
|
|
2586
|
-
if (e && !t.includes(e) && t.push(e), t.length ===
|
|
2586
|
+
if (e && !t.includes(e) && t.push(e), t.length === Pr) break;
|
|
2587
2587
|
}
|
|
2588
2588
|
return t;
|
|
2589
2589
|
}
|
|
2590
|
-
function
|
|
2590
|
+
function Rr(e) {
|
|
2591
2591
|
if (!e || typeof e != "object") return null;
|
|
2592
2592
|
let t = e;
|
|
2593
2593
|
if (!Array.isArray(t.lists)) return null;
|
|
2594
2594
|
let n = [];
|
|
2595
2595
|
for (let e of t.lists) {
|
|
2596
|
-
if (n.length ===
|
|
2596
|
+
if (n.length === Nr) break;
|
|
2597
2597
|
if (!e || typeof e != "object") continue;
|
|
2598
|
-
let t = e, r = typeof t.id == "string" && t.id && t.id.length <= 64 ? t.id : null, i =
|
|
2598
|
+
let t = e, r = typeof t.id == "string" && t.id && t.id.length <= 64 ? t.id : null, i = Ir(t.name);
|
|
2599
2599
|
!r || !i || n.some((e) => e.id === r) || n.push({
|
|
2600
2600
|
id: r,
|
|
2601
2601
|
name: i,
|
|
2602
|
-
symbols: Array.isArray(t.symbols) ?
|
|
2602
|
+
symbols: Array.isArray(t.symbols) ? Lr(t.symbols) : []
|
|
2603
2603
|
});
|
|
2604
2604
|
}
|
|
2605
2605
|
return n.length === 0 ? null : {
|
|
@@ -2607,10 +2607,10 @@ function zr(e) {
|
|
|
2607
2607
|
active: typeof t.active == "string" && n.some((e) => e.id === t.active) ? t.active : n[0].id
|
|
2608
2608
|
};
|
|
2609
2609
|
}
|
|
2610
|
-
var
|
|
2610
|
+
var zr = (e) => ({
|
|
2611
2611
|
...e,
|
|
2612
2612
|
symbols: [...e.symbols]
|
|
2613
|
-
}),
|
|
2613
|
+
}), Br = class {
|
|
2614
2614
|
lists;
|
|
2615
2615
|
active;
|
|
2616
2616
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2618,38 +2618,38 @@ var Br = (e) => ({
|
|
|
2618
2618
|
storageKey;
|
|
2619
2619
|
constructor(e) {
|
|
2620
2620
|
this.storage = e.storage ?? null, this.storageKey = e.storageKey ?? "tcw:watchlists";
|
|
2621
|
-
let t = this.load(), n = e.lists ?
|
|
2621
|
+
let t = this.load(), n = e.lists ? Rr({
|
|
2622
2622
|
lists: e.lists,
|
|
2623
2623
|
active: e.activeList
|
|
2624
2624
|
}) : null, r = t ?? n ?? {
|
|
2625
2625
|
lists: [{
|
|
2626
2626
|
id: "default",
|
|
2627
|
-
name:
|
|
2628
|
-
symbols:
|
|
2627
|
+
name: Ir(e.defaultName) ?? "Watchlist",
|
|
2628
|
+
symbols: Lr(e.symbols ?? [])
|
|
2629
2629
|
}],
|
|
2630
2630
|
active: "default"
|
|
2631
2631
|
};
|
|
2632
2632
|
this.lists = r.lists, this.active = r.active;
|
|
2633
2633
|
}
|
|
2634
2634
|
getLists() {
|
|
2635
|
-
return this.lists.map(
|
|
2635
|
+
return this.lists.map(zr);
|
|
2636
2636
|
}
|
|
2637
2637
|
getActive() {
|
|
2638
|
-
return
|
|
2638
|
+
return zr(this.activeList());
|
|
2639
2639
|
}
|
|
2640
2640
|
setActive(e) {
|
|
2641
2641
|
e === this.active || !this.lists.some((t) => t.id === e) || (this.active = e, this.changed());
|
|
2642
2642
|
}
|
|
2643
2643
|
replace(e, t) {
|
|
2644
|
-
let n =
|
|
2644
|
+
let n = Rr({
|
|
2645
2645
|
lists: e,
|
|
2646
2646
|
active: t ?? this.active
|
|
2647
2647
|
});
|
|
2648
2648
|
n && (this.lists = n.lists, this.active = n.active, this.changed());
|
|
2649
2649
|
}
|
|
2650
2650
|
create(e) {
|
|
2651
|
-
let t =
|
|
2652
|
-
if (!t || this.lists.length >=
|
|
2651
|
+
let t = Ir(e);
|
|
2652
|
+
if (!t || this.lists.length >= Nr) return null;
|
|
2653
2653
|
let n = this.lists.length + 1;
|
|
2654
2654
|
for (; this.lists.some((e) => e.id === `list-${n}`);) n++;
|
|
2655
2655
|
let r = {
|
|
@@ -2657,10 +2657,10 @@ var Br = (e) => ({
|
|
|
2657
2657
|
name: t,
|
|
2658
2658
|
symbols: []
|
|
2659
2659
|
};
|
|
2660
|
-
return this.lists = [...this.lists, r], this.active = r.id, this.changed(),
|
|
2660
|
+
return this.lists = [...this.lists, r], this.active = r.id, this.changed(), zr(r);
|
|
2661
2661
|
}
|
|
2662
2662
|
rename(e, t) {
|
|
2663
|
-
let n =
|
|
2663
|
+
let n = Ir(t);
|
|
2664
2664
|
n && this.update(e, (e) => ({
|
|
2665
2665
|
...e,
|
|
2666
2666
|
name: n
|
|
@@ -2671,7 +2671,7 @@ var Br = (e) => ({
|
|
|
2671
2671
|
}
|
|
2672
2672
|
add(e, t = this.active) {
|
|
2673
2673
|
let n = Se(e), r = this.lists.find((e) => e.id === t);
|
|
2674
|
-
return !n || !r || r.symbols.includes(n) || r.symbols.length >=
|
|
2674
|
+
return !n || !r || r.symbols.includes(n) || r.symbols.length >= Pr ? !1 : (this.update(t, (e) => ({
|
|
2675
2675
|
...e,
|
|
2676
2676
|
symbols: [...e.symbols, n]
|
|
2677
2677
|
})), !0);
|
|
@@ -2714,7 +2714,7 @@ var Br = (e) => ({
|
|
|
2714
2714
|
if (!this.storage) return null;
|
|
2715
2715
|
try {
|
|
2716
2716
|
let e = this.storage.getItem(this.storageKey);
|
|
2717
|
-
return e ?
|
|
2717
|
+
return e ? Rr(JSON.parse(e)) : null;
|
|
2718
2718
|
} catch {
|
|
2719
2719
|
return null;
|
|
2720
2720
|
}
|
|
@@ -2727,7 +2727,7 @@ var Br = (e) => ({
|
|
|
2727
2727
|
}));
|
|
2728
2728
|
} catch {}
|
|
2729
2729
|
}
|
|
2730
|
-
},
|
|
2730
|
+
}, Vr = class {
|
|
2731
2731
|
el;
|
|
2732
2732
|
bodyEl;
|
|
2733
2733
|
newsEl;
|
|
@@ -2758,19 +2758,19 @@ var Br = (e) => ({
|
|
|
2758
2758
|
}
|
|
2759
2759
|
render(e) {
|
|
2760
2760
|
let t = document.createElement("div");
|
|
2761
|
-
t.className = "tcw-syminfo-head", t.append(
|
|
2761
|
+
t.className = "tcw-syminfo-head", t.append(R("div", "tcw-syminfo-symbol", e.symbol)), e.description && t.append(R("div", "tcw-syminfo-desc", e.description)), e.meta && t.append(R("div", "tcw-syminfo-meta", e.meta));
|
|
2762
2762
|
let n = document.createElement("div");
|
|
2763
|
-
if (n.className = "tcw-syminfo-quote", e.price && n.append(
|
|
2764
|
-
let t =
|
|
2763
|
+
if (n.className = "tcw-syminfo-quote", e.price && n.append(R("span", "tcw-syminfo-price", e.price)), e.change) {
|
|
2764
|
+
let t = R("span", "tcw-syminfo-change", e.change.text);
|
|
2765
2765
|
t.classList.add(e.change.up ? "tcw-up" : "tcw-down"), n.append(t);
|
|
2766
2766
|
}
|
|
2767
|
-
let r =
|
|
2767
|
+
let r = R("div", "tcw-syminfo-status", e.status.text);
|
|
2768
2768
|
r.dataset.state = e.status.state;
|
|
2769
2769
|
let i = document.createElement("dl");
|
|
2770
2770
|
i.className = "tcw-syminfo-stats";
|
|
2771
2771
|
for (let t of e.stats) {
|
|
2772
2772
|
let e = document.createElement("div");
|
|
2773
|
-
e.className = "tcw-syminfo-stat", e.append(
|
|
2773
|
+
e.className = "tcw-syminfo-stat", e.append(R("dt", "", t.label), R("dd", "", t.value)), i.append(e);
|
|
2774
2774
|
}
|
|
2775
2775
|
this.bodyEl.replaceChildren(t, n, r, i);
|
|
2776
2776
|
}
|
|
@@ -2779,10 +2779,10 @@ var Br = (e) => ({
|
|
|
2779
2779
|
this.newsEl.replaceChildren();
|
|
2780
2780
|
return;
|
|
2781
2781
|
}
|
|
2782
|
-
let t =
|
|
2782
|
+
let t = R("div", "tcw-syminfo-news-title", this.t("symbolInfo.news"));
|
|
2783
2783
|
if (e.kind === "loading" || e.kind === "failed" || e.items.length === 0) {
|
|
2784
2784
|
let t = e.kind === "loading" ? "symbolInfo.loading" : e.kind === "failed" ? "symbolInfo.newsFailed" : "symbolInfo.noNews";
|
|
2785
|
-
this.newsEl.replaceChildren(
|
|
2785
|
+
this.newsEl.replaceChildren(R("div", "tcw-syminfo-news-note", this.t(t)));
|
|
2786
2786
|
return;
|
|
2787
2787
|
}
|
|
2788
2788
|
let n = document.createElement("ul");
|
|
@@ -2792,8 +2792,8 @@ var Br = (e) => ({
|
|
|
2792
2792
|
if (e.className = "tcw-syminfo-news-item", t.url) {
|
|
2793
2793
|
let n = document.createElement("a");
|
|
2794
2794
|
n.href = t.url, n.target = "_blank", n.rel = "noopener noreferrer", n.textContent = t.title, e.append(n);
|
|
2795
|
-
} else e.append(
|
|
2796
|
-
t.meta && e.append(
|
|
2795
|
+
} else e.append(R("span", "", t.title));
|
|
2796
|
+
t.meta && e.append(R("div", "tcw-syminfo-news-meta", t.meta)), n.append(e);
|
|
2797
2797
|
}
|
|
2798
2798
|
this.newsEl.replaceChildren(t, n);
|
|
2799
2799
|
}
|
|
@@ -2801,17 +2801,17 @@ var Br = (e) => ({
|
|
|
2801
2801
|
this.el.remove();
|
|
2802
2802
|
}
|
|
2803
2803
|
};
|
|
2804
|
-
function
|
|
2804
|
+
function R(e, t, n) {
|
|
2805
2805
|
let r = document.createElement(e);
|
|
2806
2806
|
return t && (r.className = t), r.textContent = n, r;
|
|
2807
2807
|
}
|
|
2808
2808
|
//#endregion
|
|
2809
2809
|
//#region src/widget/symbolInfoView.ts
|
|
2810
|
-
var
|
|
2811
|
-
function
|
|
2812
|
-
let { info: t, quote: n, t: r, textLocale: i } = e, a = at(t), o =
|
|
2810
|
+
var Hr = 10, Ur = 5 * 6e4, Wr = 864e5, Gr = 2;
|
|
2811
|
+
function Kr(e) {
|
|
2812
|
+
let { info: t, quote: n, t: r, textLocale: i } = e, a = at(t), o = Jr(e.bars, a), s = e.formatPrice, c = n?.last ?? o?.close, l = n?.prevClose ?? o?.prevClose, u = n?.change ?? (c !== void 0 && l !== void 0 ? c - l : void 0), d = c !== void 0 && u !== void 0 ? c - u : void 0, f = n?.changePercent ?? (u !== void 0 && d ? u / d * 100 : void 0), p = qe(t, e.now), m = r(p.state === "open" ? "symbolInfo.open" : p.state === "closed" ? "symbolInfo.closed" : "symbolInfo.always");
|
|
2813
2813
|
if (p.state !== "always" && p.next !== null) {
|
|
2814
|
-
let t =
|
|
2814
|
+
let t = Yr(p.next - e.now, i);
|
|
2815
2815
|
m += ` · ${C(r(p.state === "open" ? "symbolInfo.closesIn" : "symbolInfo.opensIn"), { when: t })}`;
|
|
2816
2816
|
}
|
|
2817
2817
|
let ee = [], h = (e, t) => {
|
|
@@ -2822,7 +2822,7 @@ function qr(e) {
|
|
|
2822
2822
|
}, g = (e) => e === void 0 ? void 0 : s(e);
|
|
2823
2823
|
h(r("dataWindow.open"), g(n?.open ?? o?.open)), h(r("dataWindow.high"), g(n?.high ?? o?.high)), h(r("dataWindow.low"), g(n?.low ?? o?.low)), h(r("symbolInfo.prevClose"), g(l));
|
|
2824
2824
|
let te = n?.volume ?? o?.volume;
|
|
2825
|
-
h(r("dataWindow.volume"), te === void 0 ? void 0 :
|
|
2825
|
+
h(r("dataWindow.volume"), te === void 0 ? void 0 : Zr(te, e.numberLocale)), h(r("symbolInfo.bid"), g(n?.bid)), h(r("symbolInfo.ask"), g(n?.ask)), h(r("symbolInfo.tick"), t?.minTick === void 0 ? void 0 : String(t.minTick)), h(r("symbolInfo.currency"), t?.currency), h(r("symbolInfo.timezone"), a), h(r("symbolInfo.hours"), Qr(t, i));
|
|
2826
2826
|
let ne = (u ?? 0) >= 0 ? "+" : "-", _ = e.names === void 0 ? t : e.names;
|
|
2827
2827
|
return {
|
|
2828
2828
|
symbol: e.symbol,
|
|
@@ -2830,7 +2830,7 @@ function qr(e) {
|
|
|
2830
2830
|
meta: [_?.exchange, _?.type].filter(Boolean).join(" · ") || void 0,
|
|
2831
2831
|
price: c === void 0 ? void 0 : s(c),
|
|
2832
2832
|
change: u === void 0 ? void 0 : {
|
|
2833
|
-
text: `${ne}${s(Math.abs(u))}${f === void 0 ? "" : ` (${ne}${
|
|
2833
|
+
text: `${ne}${s(Math.abs(u))}${f === void 0 ? "" : ` (${ne}${Xr(Math.abs(f), Gr, e.numberLocale)}%)`}`,
|
|
2834
2834
|
up: u >= 0
|
|
2835
2835
|
},
|
|
2836
2836
|
status: {
|
|
@@ -2840,7 +2840,7 @@ function qr(e) {
|
|
|
2840
2840
|
stats: ee
|
|
2841
2841
|
};
|
|
2842
2842
|
}
|
|
2843
|
-
var
|
|
2843
|
+
var qr = class {
|
|
2844
2844
|
request = 0;
|
|
2845
2845
|
cache = /* @__PURE__ */ new Map();
|
|
2846
2846
|
load(e, t, n, r, i) {
|
|
@@ -2856,17 +2856,17 @@ var Jr = class {
|
|
|
2856
2856
|
items: e.map((e) => ({
|
|
2857
2857
|
title: e.title,
|
|
2858
2858
|
url: e.url,
|
|
2859
|
-
meta: [e.source,
|
|
2859
|
+
meta: [e.source, Yr(e.time - t, r)].filter(Boolean).join(" · ")
|
|
2860
2860
|
}))
|
|
2861
2861
|
});
|
|
2862
2862
|
}, s = this.cache.get(e);
|
|
2863
|
-
if (s && Date.now() - s.at <
|
|
2863
|
+
if (s && Date.now() - s.at < Ur) {
|
|
2864
2864
|
o(s.items);
|
|
2865
2865
|
return;
|
|
2866
2866
|
}
|
|
2867
|
-
n({ kind: "loading" }), Promise.resolve().then(() => t(e,
|
|
2867
|
+
n({ kind: "loading" }), Promise.resolve().then(() => t(e, Hr)).then((t) => {
|
|
2868
2868
|
if (a !== this.request || i()) return;
|
|
2869
|
-
let n = et(t,
|
|
2869
|
+
let n = et(t, Hr);
|
|
2870
2870
|
this.cache.set(e, {
|
|
2871
2871
|
at: Date.now(),
|
|
2872
2872
|
items: n
|
|
@@ -2876,11 +2876,11 @@ var Jr = class {
|
|
|
2876
2876
|
});
|
|
2877
2877
|
}
|
|
2878
2878
|
};
|
|
2879
|
-
function
|
|
2879
|
+
function Jr(e, t) {
|
|
2880
2880
|
if (e.length === 0) return null;
|
|
2881
2881
|
let n = t && Ke(t) ? t : null, r = T(e), i = (e) => {
|
|
2882
2882
|
let t = e * r;
|
|
2883
|
-
return Math.floor((t + (n ? ut(n, t) * 6e4 : 0)) /
|
|
2883
|
+
return Math.floor((t + (n ? ut(n, t) * 6e4 : 0)) / Wr);
|
|
2884
2884
|
}, a = e[e.length - 1], o = i(a.time), s = e.length - 1;
|
|
2885
2885
|
for (; s > 0 && i(e[s - 1].time) === o;) s--;
|
|
2886
2886
|
let c = -Infinity, l = Infinity, u = 0;
|
|
@@ -2894,7 +2894,7 @@ function Yr(e, t) {
|
|
|
2894
2894
|
prevClose: s > 0 ? e[s - 1].close : void 0
|
|
2895
2895
|
};
|
|
2896
2896
|
}
|
|
2897
|
-
function
|
|
2897
|
+
function Yr(e, t) {
|
|
2898
2898
|
let n = e / 6e4, [r, i] = Math.abs(n) < 60 ? [Math.round(n) || Math.sign(n) || 1, "minute"] : Math.abs(n) < 1440 ? [Math.round(n / 60), "hour"] : [Math.round(n / 1440), "day"];
|
|
2899
2899
|
try {
|
|
2900
2900
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(r, i);
|
|
@@ -2902,14 +2902,14 @@ function Xr(e, t) {
|
|
|
2902
2902
|
return new Intl.RelativeTimeFormat("en", { numeric: "auto" }).format(r, i);
|
|
2903
2903
|
}
|
|
2904
2904
|
}
|
|
2905
|
-
function
|
|
2905
|
+
function Xr(e, t, n) {
|
|
2906
2906
|
try {
|
|
2907
2907
|
return He(e, t, n);
|
|
2908
2908
|
} catch {
|
|
2909
2909
|
return e.toFixed(t);
|
|
2910
2910
|
}
|
|
2911
2911
|
}
|
|
2912
|
-
function
|
|
2912
|
+
function Zr(e, t) {
|
|
2913
2913
|
try {
|
|
2914
2914
|
return new Intl.NumberFormat(t, {
|
|
2915
2915
|
notation: "compact",
|
|
@@ -2919,7 +2919,7 @@ function Qr(e, t) {
|
|
|
2919
2919
|
return String(e);
|
|
2920
2920
|
}
|
|
2921
2921
|
}
|
|
2922
|
-
function
|
|
2922
|
+
function Qr(e, t) {
|
|
2923
2923
|
let n = e?.sessions ?? [];
|
|
2924
2924
|
if (n.length === 0) return;
|
|
2925
2925
|
let r;
|
|
@@ -2948,7 +2948,7 @@ function $r(e, t) {
|
|
|
2948
2948
|
}
|
|
2949
2949
|
//#endregion
|
|
2950
2950
|
//#region src/widget/drawingHotkeys.ts
|
|
2951
|
-
var
|
|
2951
|
+
var $r = {
|
|
2952
2952
|
KeyT: "trendLine",
|
|
2953
2953
|
KeyH: "horizontalLine",
|
|
2954
2954
|
KeyJ: "horizontalRay",
|
|
@@ -2956,14 +2956,14 @@ var ei = {
|
|
|
2956
2956
|
KeyC: "crossLine",
|
|
2957
2957
|
KeyF: "fibRetracement"
|
|
2958
2958
|
};
|
|
2959
|
-
function
|
|
2959
|
+
function ei() {
|
|
2960
2960
|
let e = {};
|
|
2961
|
-
for (let [t, n] of Object.entries(
|
|
2961
|
+
for (let [t, n] of Object.entries($r)) e[n] = `Alt+${t.replace(/^Key/, "")}`;
|
|
2962
2962
|
return e;
|
|
2963
2963
|
}
|
|
2964
2964
|
//#endregion
|
|
2965
2965
|
//#region src/widget/WidgetChartNav.ts
|
|
2966
|
-
var
|
|
2966
|
+
var ti = 300, ni = 80, ri = Be ** -3, ii = 80, ai = class {
|
|
2967
2967
|
el;
|
|
2968
2968
|
holdTimer = null;
|
|
2969
2969
|
repeatTimer = null;
|
|
@@ -3061,7 +3061,7 @@ var ni = 300, ri = 80, ii = Be ** -3, ai = 80, oi = class {
|
|
|
3061
3061
|
this.stopHold(), this.host.removeEventListener("pointermove", this.onMove), this.host.removeEventListener("pointerleave", this.onLeave), this.el.remove();
|
|
3062
3062
|
}
|
|
3063
3063
|
nearBottom(e) {
|
|
3064
|
-
let t = this.actions.plotRect(), n = this.host.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = Math.max(
|
|
3064
|
+
let t = this.actions.plotRect(), n = this.host.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top, a = Math.max(ii, t.height * ri);
|
|
3065
3065
|
return r >= t.x && r <= t.x + t.width && i <= t.y + t.height && i >= t.y + t.height - a;
|
|
3066
3066
|
}
|
|
3067
3067
|
place() {
|
|
@@ -3070,8 +3070,8 @@ var ni = 300, ri = 80, ii = Be ** -3, ai = 80, oi = class {
|
|
|
3070
3070
|
}
|
|
3071
3071
|
startHold(e) {
|
|
3072
3072
|
this.stopHold(), this.actions.scroll(e), this.holdTimer = setTimeout(() => {
|
|
3073
|
-
this.repeatTimer = setInterval(() => this.actions.scroll(e),
|
|
3074
|
-
},
|
|
3073
|
+
this.repeatTimer = setInterval(() => this.actions.scroll(e), ni);
|
|
3074
|
+
}, ti);
|
|
3075
3075
|
}
|
|
3076
3076
|
stopHold() {
|
|
3077
3077
|
this.holdTimer && clearTimeout(this.holdTimer), this.repeatTimer && clearInterval(this.repeatTimer), this.holdTimer = null, this.repeatTimer = null;
|
|
@@ -3079,17 +3079,17 @@ var ni = 300, ri = 80, ii = Be ** -3, ai = 80, oi = class {
|
|
|
3079
3079
|
};
|
|
3080
3080
|
//#endregion
|
|
3081
3081
|
//#region src/widget/WidgetAlertsPanel.ts
|
|
3082
|
-
function
|
|
3083
|
-
let i = e.label ?? t("alerts.source.price"), a =
|
|
3084
|
-
if (
|
|
3082
|
+
function oi(e, t, n, r = !1) {
|
|
3083
|
+
let i = e.label ?? t("alerts.source.price"), a = di.get(e.condition), o = a ? t(a) : e.condition;
|
|
3084
|
+
if (ci.includes(e.condition)) return `${i} ${o} ${C(t("alerts.moveSummary"), {
|
|
3085
3085
|
percent: e.percent ?? 0,
|
|
3086
3086
|
bars: e.bars ?? 0
|
|
3087
3087
|
})}`;
|
|
3088
3088
|
if (e.target) return `${i} ${o} ${e.targetLabel ?? e.target}`;
|
|
3089
|
-
let s = e.channel && e.channel !== "price", c = Number.isFinite(e.price) ? s ?
|
|
3089
|
+
let s = e.channel && e.channel !== "price", c = Number.isFinite(e.price) ? s ? pi(e.price) : n(e.price) : "—";
|
|
3090
3090
|
return `${(s || e.drawingId) && e.label ? `${e.label} ` : r ? `${i} ` : ""}${o} ${c}`;
|
|
3091
3091
|
}
|
|
3092
|
-
var
|
|
3092
|
+
var si = [
|
|
3093
3093
|
{
|
|
3094
3094
|
value: "crossing",
|
|
3095
3095
|
key: "alerts.condition.crossing"
|
|
@@ -3118,20 +3118,20 @@ var ci = [
|
|
|
3118
3118
|
value: "movesDown",
|
|
3119
3119
|
key: "alerts.condition.movesDown"
|
|
3120
3120
|
}
|
|
3121
|
-
],
|
|
3121
|
+
], ci = ["movesUp", "movesDown"], li = {
|
|
3122
3122
|
hour: 36e5,
|
|
3123
3123
|
day: 864e5,
|
|
3124
3124
|
week: 7 * 864e5,
|
|
3125
3125
|
month: 30 * 864e5
|
|
3126
|
-
},
|
|
3127
|
-
function
|
|
3126
|
+
}, ui = "", di = new Map(si.map((e) => [e.value, e.key]));
|
|
3127
|
+
function fi(e) {
|
|
3128
3128
|
return Math.round(e * 1e6) / 1e6;
|
|
3129
3129
|
}
|
|
3130
|
-
function
|
|
3130
|
+
function pi(e) {
|
|
3131
3131
|
let t = Math.abs(e);
|
|
3132
3132
|
return t >= 1e3 || t >= 1 ? e.toFixed(2) : e.toPrecision(4);
|
|
3133
3133
|
}
|
|
3134
|
-
var
|
|
3134
|
+
var mi = class {
|
|
3135
3135
|
el;
|
|
3136
3136
|
listEl;
|
|
3137
3137
|
priceInput;
|
|
@@ -3165,7 +3165,7 @@ var hi = class {
|
|
|
3165
3165
|
o.className = "tcw-alerts-form", o.noValidate = !0, this.sourceSelect = document.createElement("select"), this.sourceSelect.className = "tcw-alerts-source", this.sourceSelect.setAttribute("aria-label", this.t("alerts.source")), this.sourceSelect.addEventListener("change", () => {
|
|
3166
3166
|
this.renderTargets(), this.prefillPrice();
|
|
3167
3167
|
}), this.conditionSelect = document.createElement("select"), this.conditionSelect.className = "tcw-alerts-condition", this.conditionSelect.setAttribute("aria-label", this.t("alerts.conditionLabel"));
|
|
3168
|
-
for (let e of
|
|
3168
|
+
for (let e of si) {
|
|
3169
3169
|
let t = document.createElement("option");
|
|
3170
3170
|
t.value = e.value, t.textContent = this.t(e.key), this.conditionSelect.appendChild(t);
|
|
3171
3171
|
}
|
|
@@ -3195,20 +3195,20 @@ var hi = class {
|
|
|
3195
3195
|
return i.type = "number", i.step = r, i.min = "0", i.value = n, i.className = e, i.placeholder = t, i.setAttribute("aria-label", t), i;
|
|
3196
3196
|
}
|
|
3197
3197
|
showFields() {
|
|
3198
|
-
let e =
|
|
3199
|
-
this.moveRow.hidden = !e, this.levelRow.hidden = e, this.priceInput.hidden = this.targetSelect.value !==
|
|
3198
|
+
let e = ci.includes(this.conditionSelect.value);
|
|
3199
|
+
this.moveRow.hidden = !e, this.levelRow.hidden = e, this.priceInput.hidden = this.targetSelect.value !== ui;
|
|
3200
3200
|
}
|
|
3201
3201
|
renderTargets() {
|
|
3202
3202
|
let e = this.targetSelect.value, t = this.sourceSelect.value || "price";
|
|
3203
3203
|
this.targetSelect.replaceChildren();
|
|
3204
3204
|
let n = document.createElement("option");
|
|
3205
|
-
n.value =
|
|
3205
|
+
n.value = ui, n.textContent = this.t("alerts.compare.value"), this.targetSelect.appendChild(n);
|
|
3206
3206
|
for (let e of this.sources) {
|
|
3207
3207
|
if (e.channel === t) continue;
|
|
3208
3208
|
let n = document.createElement("option");
|
|
3209
3209
|
n.value = e.channel, n.textContent = e.label, this.targetSelect.appendChild(n);
|
|
3210
3210
|
}
|
|
3211
|
-
this.targetSelect.value = [...this.targetSelect.options].some((t) => t.value === e) ? e :
|
|
3211
|
+
this.targetSelect.value = [...this.targetSelect.options].some((t) => t.value === e) ? e : ui, this.showFields();
|
|
3212
3212
|
}
|
|
3213
3213
|
setSources(e) {
|
|
3214
3214
|
this.sources = e.length > 0 ? e : [{
|
|
@@ -3239,7 +3239,7 @@ var hi = class {
|
|
|
3239
3239
|
}
|
|
3240
3240
|
prefillPrice() {
|
|
3241
3241
|
let e = this.callbacks.getChannelValue(this.sourceSelect.value || "price");
|
|
3242
|
-
this.priceInput.value = e === null ? "" : String(
|
|
3242
|
+
this.priceInput.value = e === null ? "" : String(fi(e));
|
|
3243
3243
|
}
|
|
3244
3244
|
close() {
|
|
3245
3245
|
this.open = !1, this.el.hidden = !0;
|
|
@@ -3252,20 +3252,20 @@ var hi = class {
|
|
|
3252
3252
|
}
|
|
3253
3253
|
submitForm() {
|
|
3254
3254
|
let e = this.conditionSelect.value, t = this.messageInput.value.trim() || void 0, n = this.sourceSelect.value || "price", r = this.sources.find((e) => e.channel === n)?.label ?? this.t("alerts.source.price"), i = {}, a = NaN;
|
|
3255
|
-
if (
|
|
3255
|
+
if (ci.includes(e)) {
|
|
3256
3256
|
i.percent = Number(this.percentInput.value), i.bars = Number(this.barsInput.value);
|
|
3257
3257
|
let e = Number.isInteger(i.bars) && i.bars >= mt && i.bars <= pt;
|
|
3258
3258
|
if (!(i.percent > 0) || !e) {
|
|
3259
3259
|
this.markInvalid(i.percent > 0 ? this.barsInput : this.percentInput);
|
|
3260
3260
|
return;
|
|
3261
3261
|
}
|
|
3262
|
-
} else if (this.targetSelect.value !==
|
|
3262
|
+
} else if (this.targetSelect.value !== ui) i.target = this.targetSelect.value;
|
|
3263
3263
|
else if (a = Number(this.priceInput.value), this.priceInput.value.trim() === "" || !Number.isFinite(a)) {
|
|
3264
3264
|
this.markInvalid(this.priceInput);
|
|
3265
3265
|
return;
|
|
3266
3266
|
}
|
|
3267
3267
|
this.closeCheck.checked && (i.onBarClose = !0);
|
|
3268
|
-
let o =
|
|
3268
|
+
let o = li[this.expirySelect.value];
|
|
3269
3269
|
o && (i.expiresAt = (this.callbacks.now ?? Date.now)() + o), this.callbacks.onAdd({
|
|
3270
3270
|
price: a,
|
|
3271
3271
|
condition: e,
|
|
@@ -3279,7 +3279,7 @@ var hi = class {
|
|
|
3279
3279
|
e.setAttribute("aria-invalid", "true"), e.focus(), e.addEventListener("input", () => e.removeAttribute("aria-invalid"), { once: !0 });
|
|
3280
3280
|
}
|
|
3281
3281
|
describe(e) {
|
|
3282
|
-
return
|
|
3282
|
+
return oi(e, this.t, this.callbacks.formatPrice);
|
|
3283
3283
|
}
|
|
3284
3284
|
renderList() {
|
|
3285
3285
|
if (this.listEl.replaceChildren(), this.alerts.length === 0) {
|
|
@@ -3314,16 +3314,16 @@ var hi = class {
|
|
|
3314
3314
|
a.type = "button", a.className = "tcw-alerts-del", a.setAttribute("aria-label", this.t("alerts.delete")), a.innerHTML = b("trash", 14), a.addEventListener("click", () => this.callbacks.onRemove(e.id)), t.appendChild(n), t.appendChild(a), this.listEl.appendChild(t);
|
|
3315
3315
|
}
|
|
3316
3316
|
}
|
|
3317
|
-
},
|
|
3317
|
+
}, hi = "print", gi = 3, _i = 10, vi = [
|
|
3318
3318
|
[3400, 1 / 2],
|
|
3319
3319
|
[2560, 1 / 3],
|
|
3320
3320
|
[1800, 1 / 6]
|
|
3321
|
-
],
|
|
3322
|
-
function
|
|
3323
|
-
let t =
|
|
3321
|
+
], yi = Math.sqrt(Be), bi = .75, xi = 2;
|
|
3322
|
+
function Si(e) {
|
|
3323
|
+
let t = vi.find(([t]) => e >= t);
|
|
3324
3324
|
return t ? Be ** t[1] : 1;
|
|
3325
3325
|
}
|
|
3326
|
-
function
|
|
3326
|
+
function Ci(e, t) {
|
|
3327
3327
|
if (t === 1) return e;
|
|
3328
3328
|
let n = e.sizes, r = (e) => Math.round(e * t);
|
|
3329
3329
|
return {
|
|
@@ -3342,10 +3342,10 @@ function wi(e, t) {
|
|
|
3342
3342
|
}
|
|
3343
3343
|
};
|
|
3344
3344
|
}
|
|
3345
|
-
function
|
|
3346
|
-
return Math.max(
|
|
3345
|
+
function z(e, t) {
|
|
3346
|
+
return Math.max(_i, Xe(e, t, gi));
|
|
3347
3347
|
}
|
|
3348
|
-
var
|
|
3348
|
+
var wi = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ti = "'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', ui-monospace, monospace", Ei = Ve, Di = "'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif", Oi = "Tahoma, Verdana, 'Segoe UI', 'DejaVu Sans', sans-serif", ki = {
|
|
3349
3349
|
print: {
|
|
3350
3350
|
radius: {
|
|
3351
3351
|
xs: 1,
|
|
@@ -3386,8 +3386,8 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3386
3386
|
}
|
|
3387
3387
|
},
|
|
3388
3388
|
font: {
|
|
3389
|
-
family:
|
|
3390
|
-
mono:
|
|
3389
|
+
family: Ei,
|
|
3390
|
+
mono: Di,
|
|
3391
3391
|
size: 13,
|
|
3392
3392
|
weight: 400,
|
|
3393
3393
|
strongWeight: 600,
|
|
@@ -3431,8 +3431,8 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3431
3431
|
menuItem: 30
|
|
3432
3432
|
},
|
|
3433
3433
|
font: {
|
|
3434
|
-
family: `'Manrope', 'Inter', ${
|
|
3435
|
-
mono:
|
|
3434
|
+
family: `'Manrope', 'Inter', ${wi}`,
|
|
3435
|
+
mono: Ti,
|
|
3436
3436
|
size: 13,
|
|
3437
3437
|
weight: 500,
|
|
3438
3438
|
strongWeight: 600,
|
|
@@ -3477,7 +3477,7 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3477
3477
|
menuItem: 26
|
|
3478
3478
|
},
|
|
3479
3479
|
font: {
|
|
3480
|
-
family: `'IBM Plex Sans Condensed', 'Roboto Condensed', 'Arial Narrow', ${
|
|
3480
|
+
family: `'IBM Plex Sans Condensed', 'Roboto Condensed', 'Arial Narrow', ${wi}`,
|
|
3481
3481
|
mono: "'IBM Plex Mono', ui-monospace, monospace",
|
|
3482
3482
|
size: 12,
|
|
3483
3483
|
weight: 500,
|
|
@@ -3525,8 +3525,8 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3525
3525
|
menuItem: 34
|
|
3526
3526
|
},
|
|
3527
3527
|
font: {
|
|
3528
|
-
family: `'Sora', 'Manrope', ${
|
|
3529
|
-
mono:
|
|
3528
|
+
family: `'Sora', 'Manrope', ${wi}`,
|
|
3529
|
+
mono: Ti,
|
|
3530
3530
|
size: 13,
|
|
3531
3531
|
weight: 500,
|
|
3532
3532
|
strongWeight: 600,
|
|
@@ -3571,8 +3571,8 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3571
3571
|
menuItem: 24
|
|
3572
3572
|
},
|
|
3573
3573
|
font: {
|
|
3574
|
-
family:
|
|
3575
|
-
mono:
|
|
3574
|
+
family: Oi,
|
|
3575
|
+
mono: Oi,
|
|
3576
3576
|
size: 12,
|
|
3577
3577
|
weight: 400,
|
|
3578
3578
|
strongWeight: 700,
|
|
@@ -3595,7 +3595,7 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3595
3595
|
intervals: "plain",
|
|
3596
3596
|
tagRadius: 0
|
|
3597
3597
|
}
|
|
3598
|
-
},
|
|
3598
|
+
}, Ai = {
|
|
3599
3599
|
compact: {
|
|
3600
3600
|
toolbar: 38,
|
|
3601
3601
|
control: 26,
|
|
@@ -3613,7 +3613,7 @@ var Ti = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", Ei = "'JetB
|
|
|
3613
3613
|
menuItem: 34
|
|
3614
3614
|
}
|
|
3615
3615
|
};
|
|
3616
|
-
function
|
|
3616
|
+
function ji(e, t) {
|
|
3617
3617
|
return {
|
|
3618
3618
|
control: e.md,
|
|
3619
3619
|
input: e.md,
|
|
@@ -3628,28 +3628,28 @@ function Mi(e, t) {
|
|
|
3628
3628
|
...t
|
|
3629
3629
|
};
|
|
3630
3630
|
}
|
|
3631
|
-
var
|
|
3632
|
-
function
|
|
3633
|
-
let { density: t, ...n } =
|
|
3631
|
+
var Mi = Object.freeze(Object.fromEntries(Object.keys(ki).map((e) => [e, Pi(Ni(e))])));
|
|
3632
|
+
function Ni(e) {
|
|
3633
|
+
let { density: t, ...n } = ki[e];
|
|
3634
3634
|
return {
|
|
3635
3635
|
...n,
|
|
3636
3636
|
preset: e,
|
|
3637
3637
|
density: "comfortable",
|
|
3638
3638
|
scale: "auto",
|
|
3639
3639
|
radius: { ...n.radius },
|
|
3640
|
-
components:
|
|
3640
|
+
components: ji(n.radius, n.components),
|
|
3641
3641
|
sizes: { ...n.sizes },
|
|
3642
3642
|
font: { ...n.font },
|
|
3643
3643
|
borders: { ...n.borders },
|
|
3644
3644
|
shadows: { ...n.shadows }
|
|
3645
3645
|
};
|
|
3646
3646
|
}
|
|
3647
|
-
function
|
|
3648
|
-
for (let t of Object.values(e)) t && typeof t == "object" &&
|
|
3647
|
+
function Pi(e) {
|
|
3648
|
+
for (let t of Object.values(e)) t && typeof t == "object" && Pi(t);
|
|
3649
3649
|
return Object.freeze(e);
|
|
3650
3650
|
}
|
|
3651
|
-
var
|
|
3652
|
-
function
|
|
3651
|
+
var Fi = (e) => typeof e == "string" && Object.prototype.hasOwnProperty.call(ki, e), B = (e, t, n) => typeof e == "number" && Number.isFinite(e) && e >= t && e <= n, Ii = (e) => typeof e == "string" && e.trim().length > 0 && e.length <= 300 && !/[;{}<>\\]|url\s*\(|expression\s*\(|\/\*/i.test(e) && Li(e);
|
|
3652
|
+
function Li(e) {
|
|
3653
3653
|
let t = 0, n = "";
|
|
3654
3654
|
for (let r of e) if (n) r === n && (n = "");
|
|
3655
3655
|
else if (r === "\"" || r === "'") n = r;
|
|
@@ -3657,7 +3657,7 @@ function Ri(e) {
|
|
|
3657
3657
|
else if (r === ")" && --t < 0) return !1;
|
|
3658
3658
|
return t === 0 && !n;
|
|
3659
3659
|
}
|
|
3660
|
-
var
|
|
3660
|
+
var Ri = (e, t) => typeof e == "string" && t.includes(e);
|
|
3661
3661
|
function V(e, t, n) {
|
|
3662
3662
|
let r = { ...e };
|
|
3663
3663
|
if (!t || typeof t != "object") return r;
|
|
@@ -3668,12 +3668,12 @@ function V(e, t, n) {
|
|
|
3668
3668
|
return r;
|
|
3669
3669
|
}
|
|
3670
3670
|
function H(e) {
|
|
3671
|
-
let t = typeof e == "string" ? { preset: e } : e ?? {}, n =
|
|
3671
|
+
let t = typeof e == "string" ? { preset: e } : e ?? {}, n = Fi(t.preset) ? t.preset : hi, r = ki[n], i = V(r.radius, t.radius, (e, t) => B(t, 0, 999)), a = Ri(t.density, [
|
|
3672
3672
|
"compact",
|
|
3673
3673
|
"comfortable",
|
|
3674
3674
|
"spacious",
|
|
3675
3675
|
"airy"
|
|
3676
|
-
]) ? t.density : "comfortable", o = a === "airy" ? "spacious" : a, s = V(o === "compact" || o === "spacious" ? (r.density ??
|
|
3676
|
+
]) ? t.density : "comfortable", o = a === "airy" ? "spacious" : a, s = V(o === "compact" || o === "spacious" ? (r.density ?? Ai)[o] : r.sizes, t.sizes, (e, t) => e === "icon" ? B(t, 10, 32) : B(t, 16, 80)), c = V(r.font, t.font, (e, t) => e === "family" || e === "mono" ? Ii(t) : e === "size" ? B(t, 11, 20) : e === "weight" || e === "strongWeight" ? B(t, 100, 900) : e === "labelCase" ? t === "none" || t === "uppercase" : B(t, 0, .5)), l = a === "airy" && t.font?.mono === void 0 ? {
|
|
3677
3677
|
...c,
|
|
3678
3678
|
mono: c.family
|
|
3679
3679
|
} : c;
|
|
@@ -3681,26 +3681,26 @@ function H(e) {
|
|
|
3681
3681
|
preset: n,
|
|
3682
3682
|
density: a,
|
|
3683
3683
|
radius: i,
|
|
3684
|
-
components: V(
|
|
3684
|
+
components: V(ji(i, r.components), t.components, (e, t) => B(t, 0, 999)),
|
|
3685
3685
|
sizes: s,
|
|
3686
3686
|
font: l,
|
|
3687
|
-
borders: V(r.borders, t.borders, (e, t) => e === "width" ?
|
|
3688
|
-
shadows: V(r.shadows, t.shadows, (e, t) =>
|
|
3689
|
-
blur:
|
|
3690
|
-
active:
|
|
3687
|
+
borders: V(r.borders, t.borders, (e, t) => e === "width" ? B(t, 0, 4) : typeof t == "boolean"),
|
|
3688
|
+
shadows: V(r.shadows, t.shadows, (e, t) => Ii(t)),
|
|
3689
|
+
blur: B(t.blur, 0, 40) ? t.blur : r.blur,
|
|
3690
|
+
active: Ri(t.active, [
|
|
3691
3691
|
"tint",
|
|
3692
3692
|
"solid",
|
|
3693
3693
|
"underline"
|
|
3694
3694
|
]) ? t.active : r.active,
|
|
3695
|
-
toolbar:
|
|
3696
|
-
sidebar:
|
|
3697
|
-
intervals:
|
|
3698
|
-
tagRadius:
|
|
3699
|
-
scale: typeof t.scale == "number" && Number.isFinite(t.scale) && t.scale >=
|
|
3695
|
+
toolbar: Ri(t.toolbar, ["docked", "floating"]) ? t.toolbar : r.toolbar,
|
|
3696
|
+
sidebar: Ri(t.sidebar, ["docked", "floating"]) ? t.sidebar : r.sidebar,
|
|
3697
|
+
intervals: Ri(t.intervals, ["plain", "segmented"]) ? t.intervals : r.intervals,
|
|
3698
|
+
tagRadius: B(t.tagRadius, 0, 999) ? t.tagRadius : r.tagRadius,
|
|
3699
|
+
scale: typeof t.scale == "number" && Number.isFinite(t.scale) && t.scale >= bi && t.scale <= xi ? t.scale : "auto"
|
|
3700
3700
|
};
|
|
3701
3701
|
}
|
|
3702
3702
|
function zi(e) {
|
|
3703
|
-
let t = (e) => `${e}px`, n = e.radius, r = e.components, i = e.sizes, a = e.font, o = e.density === "compact" ? 1 :
|
|
3703
|
+
let t = (e) => `${e}px`, n = e.radius, r = e.components, i = e.sizes, a = e.font, o = e.density === "compact" ? 1 : yi;
|
|
3704
3704
|
return {
|
|
3705
3705
|
"--tcw-radius-xs": t(n.xs),
|
|
3706
3706
|
"--tcw-radius-sm": t(n.sm),
|
|
@@ -3728,11 +3728,11 @@ function zi(e) {
|
|
|
3728
3728
|
"--tcw-font": a.family,
|
|
3729
3729
|
"--tcw-font-mono": a.mono,
|
|
3730
3730
|
"--tcw-font-size": t(a.size),
|
|
3731
|
-
"--tcw-font-size-sm": t(
|
|
3732
|
-
"--tcw-font-size-xs": t(
|
|
3733
|
-
"--tcw-font-size-lg": t(
|
|
3734
|
-
"--tcw-font-size-xl": t(
|
|
3735
|
-
"--tcw-font-size-display": t(
|
|
3731
|
+
"--tcw-font-size-sm": t(z(a.size, -1)),
|
|
3732
|
+
"--tcw-font-size-xs": t(z(a.size, -2)),
|
|
3733
|
+
"--tcw-font-size-lg": t(z(a.size, 1)),
|
|
3734
|
+
"--tcw-font-size-xl": t(z(a.size, 2)),
|
|
3735
|
+
"--tcw-font-size-display": t(z(a.size, 3)),
|
|
3736
3736
|
"--tcw-weight": String(a.weight),
|
|
3737
3737
|
"--tcw-weight-strong": String(a.strongWeight),
|
|
3738
3738
|
"--tcw-label-case": a.labelCase,
|
|
@@ -7383,7 +7383,7 @@ var lc = [
|
|
|
7383
7383
|
return t ? { ...t } : null;
|
|
7384
7384
|
}
|
|
7385
7385
|
createWatchlist(e, t) {
|
|
7386
|
-
let n = t.persist ?
|
|
7386
|
+
let n = t.persist ? L() : null, r = new Br({
|
|
7387
7387
|
lists: t.lists,
|
|
7388
7388
|
activeList: t.activeList,
|
|
7389
7389
|
symbols: this.host.symbols,
|
|
@@ -7393,7 +7393,7 @@ var lc = [
|
|
|
7393
7393
|
});
|
|
7394
7394
|
this.watchlistStore = r, this.watchlistFromSymbols = !t.lists && !t.persist, this.quoteSource = t.quotes === !1 ? null : t.quotes ?? (this.host.options.adapter?.subscribeQuotes ? this.host.options.adapter : null);
|
|
7395
7395
|
let i = (e) => this.host.t(e);
|
|
7396
|
-
this.watchlist = new
|
|
7396
|
+
this.watchlist = new kr(e, {
|
|
7397
7397
|
onSelect: (e) => {
|
|
7398
7398
|
this.host.setSymbol(e);
|
|
7399
7399
|
},
|
|
@@ -7517,7 +7517,7 @@ var lc = [
|
|
|
7517
7517
|
};
|
|
7518
7518
|
}
|
|
7519
7519
|
alertText(e) {
|
|
7520
|
-
return
|
|
7520
|
+
return oi(this.alertListItem(e, this.buildAlertSources()), this.host.t, (e) => this.host.formatAlertPrice(e), !0);
|
|
7521
7521
|
}
|
|
7522
7522
|
buildAlertSources() {
|
|
7523
7523
|
let e = [{
|
|
@@ -8099,7 +8099,7 @@ var Ec = class {
|
|
|
8099
8099
|
category: "chartType",
|
|
8100
8100
|
active: this.host.state.chartType === t.value
|
|
8101
8101
|
});
|
|
8102
|
-
let t =
|
|
8102
|
+
let t = ei();
|
|
8103
8103
|
for (let n of ee(l, this.host.t)) for (let r of n.tools) e.push({
|
|
8104
8104
|
id: r.value,
|
|
8105
8105
|
label: r.label,
|
|
@@ -9659,7 +9659,7 @@ var Dl = class {
|
|
|
9659
9659
|
timeframes = [];
|
|
9660
9660
|
sessionRefPrice = null;
|
|
9661
9661
|
symbolInfoPanel = null;
|
|
9662
|
-
news = new
|
|
9662
|
+
news = new qr();
|
|
9663
9663
|
marketTimer = null;
|
|
9664
9664
|
clockTimer = null;
|
|
9665
9665
|
onPageShown = null;
|
|
@@ -9853,7 +9853,7 @@ var Dl = class {
|
|
|
9853
9853
|
n.className = "tcw-body", e.drawingFavorites && this.favoritesStore.seedDefaults(e.drawingFavorites), this.sidebar = new $n(n, {
|
|
9854
9854
|
drawingToolGroups: ee(l, this.t),
|
|
9855
9855
|
favorites: this.favoritesStore.list(),
|
|
9856
|
-
shortcuts:
|
|
9856
|
+
shortcuts: ei()
|
|
9857
9857
|
}, {
|
|
9858
9858
|
onDrawingTool: (e) => this.handleDrawingTool(e),
|
|
9859
9859
|
onCancelDrawing: () => this.handleCancelDrawing(),
|
|
@@ -9912,7 +9912,7 @@ var Dl = class {
|
|
|
9912
9912
|
this.chart.on("visibleRangeChange", (e) => {
|
|
9913
9913
|
let { from: t, to: n } = e.payload;
|
|
9914
9914
|
Number.isFinite(t) && Number.isFinite(n) && (this.visibleBarCount = Math.max(1, n - t));
|
|
9915
|
-
}), this.chartNav = new
|
|
9915
|
+
}), this.chartNav = new ai(this.chartContainer, {
|
|
9916
9916
|
zoomIn: () => this.chart.zoomIn(),
|
|
9917
9917
|
zoomOut: () => this.chart.zoomOut(),
|
|
9918
9918
|
scroll: (e) => this.chart.scrollBars(e * Math.max(1, Math.round(this.visibleBarCount / 10))),
|
|
@@ -9923,7 +9923,7 @@ var Dl = class {
|
|
|
9923
9923
|
this.historyPill.update(t), t.state === "loaded" && this.comparing.extendPercentCompares();
|
|
9924
9924
|
}), this.chart.on("symbolInfoChange", () => {
|
|
9925
9925
|
this.refreshSymbolTitle(), this.refreshMarket(), this.rebuildForZone(), this.refreshPriceTexts();
|
|
9926
|
-
}), this.chart.on("marketChange", () => this.rebuildForZone()), this.refreshSymbolTitle(), this.symbolInfoPanel = new
|
|
9926
|
+
}), this.chart.on("marketChange", () => this.rebuildForZone()), this.refreshSymbolTitle(), this.symbolInfoPanel = new Vr(this.root, this.t, {
|
|
9927
9927
|
onClose: () => this.docking.closePanelByHand("symbolInfo"),
|
|
9928
9928
|
onToggle: (e) => {
|
|
9929
9929
|
this.markOpen("symbolInfo", e), e && (this.refreshSymbolInfo(), this.loadNews());
|
|
@@ -10324,7 +10324,7 @@ var Dl = class {
|
|
|
10324
10324
|
}
|
|
10325
10325
|
}
|
|
10326
10326
|
buildAlerts(e) {
|
|
10327
|
-
this.alerting.alertsPanel = new
|
|
10327
|
+
this.alerting.alertsPanel = new mi(this.root, {
|
|
10328
10328
|
onClose: () => this.docking.closePanelByHand("alerts"),
|
|
10329
10329
|
onAdd: ({ price: e, condition: t, message: n, channel: r, label: i, options: a }) => {
|
|
10330
10330
|
try {
|
|
@@ -10453,9 +10453,9 @@ var Dl = class {
|
|
|
10453
10453
|
} else if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === "s" || e.key === "S")) {
|
|
10454
10454
|
if (!this.layouts.layoutSession || !n("hotkeys.save") || !this.featureState.layouts || F() || !P(this.root, !0)) return;
|
|
10455
10455
|
e.preventDefault(), this.layouts.saveLayout();
|
|
10456
|
-
} else if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey &&
|
|
10456
|
+
} else if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey && $r[e.code]) {
|
|
10457
10457
|
if (e.defaultPrevented || F() || !t || I() || !n("hotkeys.tools")) return;
|
|
10458
|
-
e.preventDefault(), this.handleDrawingTool(
|
|
10458
|
+
e.preventDefault(), this.handleDrawingTool($r[e.code]);
|
|
10459
10459
|
} else if (/^[0-9]$/.test(e.key) && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
10460
10460
|
if (e.defaultPrevented || !this.intervals.intervalInput || !n("intervalTyping") || F() || I() || !P(this.root, !0)) return;
|
|
10461
10461
|
let t = document.activeElement;
|
|
@@ -10576,7 +10576,7 @@ var Dl = class {
|
|
|
10576
10576
|
}
|
|
10577
10577
|
symbolInfoView() {
|
|
10578
10578
|
let e = this.state.symbol;
|
|
10579
|
-
return
|
|
10579
|
+
return Kr({
|
|
10580
10580
|
symbol: e,
|
|
10581
10581
|
info: this.chart.getSymbolInfo(),
|
|
10582
10582
|
names: this.displayInfo(),
|
|
@@ -10651,10 +10651,10 @@ var Dl = class {
|
|
|
10651
10651
|
scaleNow() {
|
|
10652
10652
|
if (this.ui.scale !== "auto" && this.ui.scale !== void 0) return this.ui.scale;
|
|
10653
10653
|
let e = this.root.clientWidth;
|
|
10654
|
-
return e > 0 ?
|
|
10654
|
+
return e > 0 ? Si(e) : 1;
|
|
10655
10655
|
}
|
|
10656
10656
|
applyLookTokens() {
|
|
10657
|
-
let e =
|
|
10657
|
+
let e = Ci(this.ui, this.uiScale);
|
|
10658
10658
|
for (let t of [this.root, this.portal]) {
|
|
10659
10659
|
if (Bi(t, e, { variables: this.uiVariables }), this.uiVariables) continue;
|
|
10660
10660
|
let n = zi(e);
|
|
@@ -10667,7 +10667,7 @@ var Dl = class {
|
|
|
10667
10667
|
if (e !== this.uiScale) {
|
|
10668
10668
|
if (this.ui.scale === "auto") {
|
|
10669
10669
|
let t = this.root.clientWidth;
|
|
10670
|
-
if ((e > this.uiScale ?
|
|
10670
|
+
if ((e > this.uiScale ? Si(t - ll) : Si(t + ll)) === this.uiScale) return;
|
|
10671
10671
|
}
|
|
10672
10672
|
this.uiScale = e, this.applyLookTokens(), this.applyLegendFont(), this.applyChartLook(), this.toolbar?.fit();
|
|
10673
10673
|
}
|
|
@@ -10678,7 +10678,7 @@ var Dl = class {
|
|
|
10678
10678
|
applyLegendFont() {
|
|
10679
10679
|
this.chart.setLegend({
|
|
10680
10680
|
fontFamily: this.ui.font.mono,
|
|
10681
|
-
fontSize:
|
|
10681
|
+
fontSize: z(Math.round(this.ui.font.size * this.uiScale), -1)
|
|
10682
10682
|
});
|
|
10683
10683
|
}
|
|
10684
10684
|
applyChartLook() {
|
|
@@ -12085,7 +12085,7 @@ function Ol(e, t, n) {
|
|
|
12085
12085
|
var kl = "tcw:recentCommands", Al = 10;
|
|
12086
12086
|
function jl() {
|
|
12087
12087
|
try {
|
|
12088
|
-
let e = JSON.parse(
|
|
12088
|
+
let e = JSON.parse(L()?.getItem(kl) ?? "[]");
|
|
12089
12089
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string").slice(0, Al) : [];
|
|
12090
12090
|
} catch {
|
|
12091
12091
|
return [];
|
|
@@ -12093,13 +12093,13 @@ function jl() {
|
|
|
12093
12093
|
}
|
|
12094
12094
|
function Ml(e) {
|
|
12095
12095
|
try {
|
|
12096
|
-
|
|
12096
|
+
L()?.setItem(kl, JSON.stringify(e.slice(0, Al)));
|
|
12097
12097
|
} catch {}
|
|
12098
12098
|
}
|
|
12099
12099
|
var Nl = "tcw:dockWidth";
|
|
12100
12100
|
function Pl() {
|
|
12101
12101
|
try {
|
|
12102
|
-
let e = Number(
|
|
12102
|
+
let e = Number(L()?.getItem(Nl) ?? NaN);
|
|
12103
12103
|
return Number.isFinite(e) && e > 0 ? e : null;
|
|
12104
12104
|
} catch {
|
|
12105
12105
|
return null;
|
|
@@ -12107,7 +12107,7 @@ function Pl() {
|
|
|
12107
12107
|
}
|
|
12108
12108
|
function Fl(e) {
|
|
12109
12109
|
try {
|
|
12110
|
-
|
|
12110
|
+
L()?.setItem(Nl, String(e));
|
|
12111
12111
|
} catch {}
|
|
12112
12112
|
}
|
|
12113
12113
|
function Il(e) {
|
|
@@ -12601,6 +12601,6 @@ function Wl(e, t) {
|
|
|
12601
12601
|
return n;
|
|
12602
12602
|
}
|
|
12603
12603
|
//#endregion
|
|
12604
|
-
export { ge as CHART_TYPE_ICONS, Dl as ChartWidget, Ul as ChartWidgetGrid, Ll as DEFAULT_GRID_SYNC, ve as DRAWING_TOOL_ICONS, Ae as EN_MESSAGES, $ as GRID_SHAPES, c as LayoutSession, a as MAX_LAYOUT_NAME, pe as UI_ICONS, Pe as VI_MESSAGES, le as WIDGET_FEATURES,
|
|
12604
|
+
export { ge as CHART_TYPE_ICONS, Dl as ChartWidget, Ul as ChartWidgetGrid, Ll as DEFAULT_GRID_SYNC, ve as DRAWING_TOOL_ICONS, Ae as EN_MESSAGES, $ as GRID_SHAPES, c as LayoutSession, a as MAX_LAYOUT_NAME, pe as UI_ICONS, Pe as VI_MESSAGES, le as WIDGET_FEATURES, Mi as WIDGET_UI_PRESETS, Bi as applyWidgetUI, s as cleanLayoutName, _e as createChartTypeIcon, b as createIcon, y as createToolIcon, je as findWidgetLocale, me as iconSvg, i as localStorageLayouts, e as memoryLayouts, Hl as readGridLayout, Rr as readWatchlists, Yo as readWidgetLayout, ke as registerWidgetLocale, H as resolveWidgetUI, zi as widgetUIVariables };
|
|
12605
12605
|
|
|
12606
12606
|
//# sourceMappingURL=index.js.map
|