@nabeeltahirdeveloper/chart-sdk 2.3.9 → 2.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { jsx as h, jsxs as G, Fragment as ct } from "react/jsx-runtime";
2
- import kA, { createContext as ad, useContext as ld, useState as Pe, useRef as et, useEffect as it, useCallback as vt, useMemo as Di, forwardRef as cd, useImperativeHandle as hd } from "react";
2
+ import kA, { createContext as ad, useContext as ld, useState as Ne, useRef as et, useEffect as it, useCallback as vt, useMemo as Di, forwardRef as cd, useImperativeHandle as hd } from "react";
3
3
  const kt = "17:00-17:00", Ot = "America/New_York", xA = "24x7", TA = "UTC", ud = {
4
4
  // Forex Major Pairs
5
5
  EURUSD: { type: "forex", sessionTZ: Ot, session: kt, priceMode: "mid" },
@@ -10648,7 +10648,7 @@ function gg() {
10648
10648
  // with polling-first, a failed WS upgrade invalidates the polling session on the server,
10649
10649
  // so subsequent polling POSTs return 400. With websocket-first, if WS fails the fallback
10650
10650
  // polling starts fresh with no stale session ID.
10651
- transports: ["websocket", "polling"],
10651
+ // transports: ['websocket', 'polling'],
10652
10652
  reconnection: !0,
10653
10653
  reconnectionDelay: 1e3,
10654
10654
  reconnectionAttempts: 10,
@@ -10759,11 +10759,11 @@ const Wn = {
10759
10759
  symbols: "/symbols",
10760
10760
  trades: "/trades",
10761
10761
  account: "/api/user/account"
10762
- }, ...t }, l = t?.params || {}, [c, m] = Pe(r || "BTC/USD"), [C, T] = Pe(n || "M1"), [b, v] = Pe([]), [U, F] = Pe(!0), [M, N] = Pe([]), [W, L] = Pe(!1), [V, j] = Pe(1e5), [X, K] = Pe(null), [ee, Ae] = Pe([]), [ce, Z] = Pe(!0), [te, se] = Pe(!1), [le, ne] = Pe(!0), [he, pe] = Pe("candles"), [we, Te] = Pe(!1), [Ue, ye] = Pe("dark"), [ve, be] = Pe(!1), [Se, Ie] = Pe([]), Ze = et(null);
10762
+ }, ...t }, l = t?.params || {}, [c, m] = Ne(r || "BTC/USD"), [C, T] = Ne(n || "M1"), [b, v] = Ne([]), [U, F] = Ne(!0), [M, N] = Ne([]), [W, L] = Ne(!1), [V, j] = Ne(1e5), [X, K] = Ne(null), [ee, Ae] = Ne([]), [ce, Z] = Ne(!0), [te, se] = Ne(!1), [le, ne] = Ne(!0), [he, pe] = Ne("candles"), [we, Te] = Ne(!1), [Ue, ye] = Ne("dark"), [ve, be] = Ne(!1), [Se, Ie] = Ne([]), Ze = et(null);
10763
10763
  it(() => {
10764
10764
  Wn.setBaseUrl(s);
10765
10765
  }, [s]);
10766
- const ze = et(/* @__PURE__ */ new Map()), Ce = et(null), Ne = 1e3, Ee = vt(async () => {
10766
+ const ze = et(/* @__PURE__ */ new Map()), Ce = et(null), ke = 1e3, Ee = vt(async () => {
10767
10767
  if (A)
10768
10768
  try {
10769
10769
  const ge = localStorage.getItem("token");
@@ -10777,11 +10777,11 @@ const Wn = {
10777
10777
  Array.isArray(me.data) ? Me = me.data : me.data?.data && Array.isArray(me.data.data) && (Me = me.data.data);
10778
10778
  const Re = Me.filter((Qe) => Qe.closePrice === null || Qe.closePrice === void 0).map((Qe) => ({
10779
10779
  id: Qe.id,
10780
- ticket: Qe.id?.substring(0, 8),
10780
+ ticket: 23,
10781
10781
  symbol: Qe.symbol,
10782
10782
  type: Qe.type,
10783
10783
  volume: Qe.volume,
10784
- price: Qe.openPrice,
10784
+ openPrice: Qe.openPrice ?? Qe.price,
10785
10785
  stopLoss: Qe.stopLoss,
10786
10786
  takeProfit: Qe.takeProfit,
10787
10787
  comment: Qe.comment || "",
@@ -10801,7 +10801,7 @@ const Wn = {
10801
10801
  } finally {
10802
10802
  L(!1);
10803
10803
  }
10804
- }, [s, A]), de = vt((ge, me) => !me || !ge.price || isNaN(me) || isNaN(ge.price) ? ge.profit || 0 : (ge.type === "BUY" ? me - ge.price : ge.price - me) * ge.volume, []), ke = vt(async () => {
10804
+ }, [s, A]), de = vt((ge, me) => !me || !ge.price || isNaN(me) || isNaN(ge.price) ? ge.profit || 0 : (ge?.type?.toUpperCase() === "BUY" ? me - ge.price : ge.price - me) * ge.volume, []), _e = vt(async () => {
10805
10805
  try {
10806
10806
  const ge = localStorage.getItem("token");
10807
10807
  if (!ge)
@@ -10828,11 +10828,11 @@ const Wn = {
10828
10828
  Array.isArray(me.data) ? Me = me.data : me.data?.data && Array.isArray(me.data.data) && (Me = me.data.data);
10829
10829
  const Re = Me.filter((Qe) => Qe.closePrice !== null && Qe.closePrice !== void 0).map((Qe) => ({
10830
10830
  id: Qe.id,
10831
- ticket: Qe.id?.substring(0, 8),
10831
+ ticket: 23,
10832
10832
  symbol: Qe.symbol,
10833
10833
  type: Qe.type,
10834
10834
  volume: Qe.volume,
10835
- openPrice: Qe.openPrice,
10835
+ openPrice: Qe.openPrice ?? Qe.price,
10836
10836
  closePrice: Qe.closePrice,
10837
10837
  stopLoss: Qe.stopLoss,
10838
10838
  takeProfit: Qe.takeProfit,
@@ -10866,8 +10866,8 @@ const Wn = {
10866
10866
  };
10867
10867
  }, [M, b, V, de]);
10868
10868
  it(() => {
10869
- localStorage.getItem("token") && A && (Ee(), ke(), Ye());
10870
- }, [Ee, ke, Ye, A]), it(() => {
10869
+ localStorage.getItem("token") && A && (Ee(), _e(), Ye());
10870
+ }, [Ee, _e, Ye, A]), it(() => {
10871
10871
  (async () => {
10872
10872
  try {
10873
10873
  F(!0);
@@ -10902,8 +10902,8 @@ const Wn = {
10902
10902
  let Re = !1;
10903
10903
  const Qe = Me.map((Ke) => {
10904
10904
  const Ve = me.get(Ke.symbol);
10905
- if (!Ve) return Ke;
10906
- const ft = Ke.type === "BUY" ? parseFloat(Ve.bid || 0) : parseFloat(Ve.ask || 0);
10905
+ if (console.log("UASDSAD", Ve), !Ve) return Ke;
10906
+ const ft = Ke.type?.toUpperCase() === "BUY" ? parseFloat(Ve.bid || 0) : parseFloat(Ve.ask || 0);
10907
10907
  if (!ft || isNaN(ft) || ft <= 0) return Ke;
10908
10908
  const yt = de(Ke, ft);
10909
10909
  return yt === Ke.profit ? Ke : (Re = !0, { ...Ke, profit: yt });
@@ -10916,7 +10916,7 @@ const Wn = {
10916
10916
  const ge = Ze.current, me = () => console.log("✅ TradingContext: Connected"), Me = () => console.log("⚠️ TradingContext: Disconnected"), Re = (Ke) => {
10917
10917
  Ke?.symbol && (ze.current.set(Ke.symbol, Ke), Ce.current || (Ce.current = setTimeout(() => {
10918
10918
  Ce.current = null, nt();
10919
- }, Ne)));
10919
+ }, ke)));
10920
10920
  }, Qe = async (Ke) => {
10921
10921
  if (Ke) {
10922
10922
  if (Ke.newBalance !== void 0) {
@@ -10930,13 +10930,13 @@ const Wn = {
10930
10930
  Ve >= 0 ? "success" : "error"
10931
10931
  );
10932
10932
  }
10933
- Ke.tradeId && N((Ve) => Ve.filter((ft) => ft.id !== Ke.tradeId)), await Ee(), await ke();
10933
+ Ke.tradeId && N((Ve) => Ve.filter((ft) => ft.id !== Ke.tradeId)), await Ee(), await _e();
10934
10934
  }
10935
10935
  };
10936
10936
  return ge.on("connect", me), ge.on("disconnect", Me), ge.on("priceUpdate", Re), ge.on("tradeClosed", Qe), () => {
10937
10937
  ge.off("connect", me), ge.off("disconnect", Me), ge.off("priceUpdate", Re), ge.off("tradeClosed", Qe), Ce.current && (clearTimeout(Ce.current), Ce.current = null), ze.current.clear();
10938
10938
  };
10939
- }, [nt, Ee, ke]), it(() => {
10939
+ }, [nt, Ee, _e]), it(() => {
10940
10940
  try {
10941
10941
  const ge = document.documentElement;
10942
10942
  if (!ge) return;
@@ -10948,7 +10948,7 @@ const Wn = {
10948
10948
  bid: "0.00000",
10949
10949
  ask: "0.00000",
10950
10950
  change: 0
10951
- }, [b, c]), _e = Di(
10951
+ }, [b, c]), Pe = Di(
10952
10952
  () => ({
10953
10953
  selectedSymbol: c,
10954
10954
  setSelectedSymbol: m,
@@ -10961,7 +10961,7 @@ const Wn = {
10961
10961
  setOrders: N,
10962
10962
  ordersLoading: W,
10963
10963
  fetchOrders: Ee,
10964
- fetchUserBalance: ke,
10964
+ fetchUserBalance: _e,
10965
10965
  userBalance: V,
10966
10966
  setUserBalance: j,
10967
10967
  accountSummary: rt,
@@ -11000,7 +11000,7 @@ const Wn = {
11000
11000
  M,
11001
11001
  W,
11002
11002
  Ee,
11003
- ke,
11003
+ _e,
11004
11004
  V,
11005
11005
  rt,
11006
11006
  $e,
@@ -11020,7 +11020,7 @@ const Wn = {
11020
11020
  Ye
11021
11021
  ]
11022
11022
  );
11023
- return /* @__PURE__ */ h(Ou.Provider, { value: _e, children: i });
11023
+ return /* @__PURE__ */ h(Ou.Provider, { value: Pe, children: i });
11024
11024
  };
11025
11025
  var Ku = {
11026
11026
  color: void 0,
@@ -11161,7 +11161,7 @@ function Pg(i) {
11161
11161
  return Jt({ attr: { viewBox: "0 0 352 512" }, child: [{ tag: "path", attr: { d: "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }, child: [] }] })(i);
11162
11162
  }
11163
11163
  const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg = ({ bidPrice: i, askPrice: e, userAccountId: t }) => {
11164
- const { theme: A, selectedSymbol: r, fetchOrders: n, baseUrl: s, endpoints: o } = Wt(), a = A === "light", [l, c] = Pe("0.01"), [m, C] = Pe(""), [T, b] = Pe(!1), v = a ? "bg-slate-100" : "bg-[#12161d]", U = a ? "text-slate-700" : "text-white", F = a ? "hover:bg-slate-200" : "hover:bg-[#1e2635]", M = (W) => {
11164
+ const { theme: A, selectedSymbol: r, fetchOrders: n, baseUrl: s, endpoints: o } = Wt(), a = A === "light", [l, c] = Ne("0.01"), [m, C] = Ne(""), [T, b] = Ne(!1), v = a ? "bg-slate-100" : "bg-[#12161d]", U = a ? "text-slate-700" : "text-white", F = a ? "hover:bg-slate-200" : "hover:bg-[#1e2635]", M = (W) => {
11165
11165
  const L = parseFloat(l) || 0.01, V = Math.max(0.01, L + W);
11166
11166
  c(V.toFixed(2));
11167
11167
  }, N = async (W) => {
@@ -11312,20 +11312,20 @@ const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg
11312
11312
  const Me = W.getContractSpec(ge);
11313
11313
  return (parseFloat(me) || 0) * (Me.contractSize || 1);
11314
11314
  }
11315
- }, L = c || W, [V, j] = Pe("0.01"), [X, K] = Pe(""), [ee, Ae] = Pe(""), [ce, Z] = Pe(""), [te, se] = Pe(!1), [le, ne] = Pe(null), [he, pe] = Pe(""), [we, Te] = Pe(t || "BUY"), [Ue, ye] = Pe(parseFloat(A) || 0), [ve, be] = Pe(parseFloat(r) || 0), [Se, Ie] = Pe("text-white"), [Ze, ze] = Pe("text-white"), Ce = et(parseFloat(A) || 0), Ne = et(parseFloat(r) || 0);
11315
+ }, L = c || W, [V, j] = Ne("0.01"), [X, K] = Ne(""), [ee, Ae] = Ne(""), [ce, Z] = Ne(""), [te, se] = Ne(!1), [le, ne] = Ne(null), [he, pe] = Ne(""), [we, Te] = Ne(t || "BUY"), [Ue, ye] = Ne(parseFloat(A) || 0), [ve, be] = Ne(parseFloat(r) || 0), [Se, Ie] = Ne("text-white"), [Ze, ze] = Ne("text-white"), Ce = et(parseFloat(A) || 0), ke = et(parseFloat(r) || 0);
11316
11316
  it(() => {
11317
11317
  if (!i) return;
11318
11318
  const ge = Wn.getSocket(), me = (Re) => {
11319
11319
  if (!(!Re || !Re.symbol) && Re.symbol.toUpperCase() === m?.toUpperCase()) {
11320
11320
  const Qe = parseFloat(Re.bid) || 0, Ke = parseFloat(Re.ask) || 0;
11321
- Qe > 0 && (Qe > Ce.current ? (Ie("text-green-400"), setTimeout(() => Ie("text-white"), 500)) : Qe < Ce.current && Ce.current > 0 && (Ie("text-red-400"), setTimeout(() => Ie("text-white"), 500)), ye(Qe), Ce.current = Qe), Ke > 0 && (Ke > Ne.current ? (ze("text-green-400"), setTimeout(() => ze("text-white"), 500)) : Ke < Ne.current && Ne.current > 0 && (ze("text-red-400"), setTimeout(() => ze("text-white"), 500)), be(Ke), Ne.current = Ke);
11321
+ Qe > 0 && (Qe > Ce.current ? (Ie("text-green-400"), setTimeout(() => Ie("text-white"), 500)) : Qe < Ce.current && Ce.current > 0 && (Ie("text-red-400"), setTimeout(() => Ie("text-white"), 500)), ye(Qe), Ce.current = Qe), Ke > 0 && (Ke > ke.current ? (ze("text-green-400"), setTimeout(() => ze("text-white"), 500)) : Ke < ke.current && ke.current > 0 && (ze("text-red-400"), setTimeout(() => ze("text-white"), 500)), be(Ke), ke.current = Ke);
11322
11322
  }
11323
11323
  };
11324
11324
  ge.on("priceUpdate", me);
11325
11325
  const Me = b.find((Re) => Re.symbol === m);
11326
11326
  if (Me) {
11327
11327
  const Re = parseFloat(Me.bid) || 0, Qe = parseFloat(Me.ask) || 0;
11328
- Re > 0 && (ye(Re), Ce.current = Re), Qe > 0 && (be(Qe), Ne.current = Qe);
11328
+ Re > 0 && (ye(Re), Ce.current = Re), Qe > 0 && (be(Qe), ke.current = Qe);
11329
11329
  }
11330
11330
  return () => {
11331
11331
  ge.off("priceUpdate", me);
@@ -11334,10 +11334,10 @@ const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg
11334
11334
  if (i) {
11335
11335
  j(o ? String(o) : "0.01"), K(""), Ae(""), Z(""), pe(""), Te(t || "BUY");
11336
11336
  const ge = parseFloat(A) || 0, me = parseFloat(r) || 0;
11337
- ge > 0 && (ye(ge), Ce.current = ge), me > 0 && (be(me), Ne.current = me);
11337
+ ge > 0 && (ye(ge), Ce.current = ge), me > 0 && (be(me), ke.current = me);
11338
11338
  }
11339
11339
  }, [i, t, A, r, o]);
11340
- const Ee = Ue || 0, de = ve || 0, ke = (ge) => {
11340
+ const Ee = Ue || 0, de = ve || 0, _e = (ge) => {
11341
11341
  const me = parseFloat(V) || 0.01, Me = Math.max(0.01, me + ge);
11342
11342
  j(Me.toFixed(2));
11343
11343
  }, Ye = (ge) => {
@@ -11505,7 +11505,7 @@ const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg
11505
11505
  window.notify && window.notify(xt, "error");
11506
11506
  });
11507
11507
  }
11508
- }, _e = (L?.calculateVolumeUnits?.({
11508
+ }, Pe = (L?.calculateVolumeUnits?.({
11509
11509
  symbol: m,
11510
11510
  volume: parseFloat(V) || 0
11511
11511
  }) ?? 0).toLocaleString("en-US", {
@@ -11586,7 +11586,7 @@ const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg
11586
11586
  }
11587
11587
  ),
11588
11588
  /* @__PURE__ */ G("span", { className: `text-sm ${N ? "text-slate-700" : "text-white"}`, children: [
11589
- _e,
11589
+ Pe,
11590
11590
  " ",
11591
11591
  m
11592
11592
  ] })
@@ -11596,7 +11596,7 @@ const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg
11596
11596
  "button",
11597
11597
  {
11598
11598
  type: "button",
11599
- onClick: () => ke(-0.01),
11599
+ onClick: () => _e(-0.01),
11600
11600
  className: `absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N ? "bg-slate-100 hover:bg-slate-400 text-slate-700" : "bg-[#12161d] hover:bg-slate-600 text-white"}`,
11601
11601
  children: "−"
11602
11602
  }
@@ -11624,7 +11624,7 @@ const Ng = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, kg
11624
11624
  "button",
11625
11625
  {
11626
11626
  type: "button",
11627
- onClick: () => ke(0.01),
11627
+ onClick: () => _e(0.01),
11628
11628
  className: `absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N ? "bg-slate-100 hover:bg-slate-400 text-slate-700" : "bg-[#12161d] hover:bg-slate-600 text-white"}`,
11629
11629
  children: "+"
11630
11630
  }
@@ -13958,7 +13958,7 @@ function uw(i) {
13958
13958
  } : e;
13959
13959
  }
13960
13960
  const pw = ({ isOpen: i, onClose: e, chartObject: t, onUpdate: A }) => {
13961
- const { theme: r } = Wt(), s = Wg(r === "light"), [o, a] = Pe("style"), [l, c] = Pe({}), [m, C] = Pe(null), T = et(null), b = et(null);
13961
+ const { theme: r } = Wt(), s = Wg(r === "light"), [o, a] = Ne("style"), [l, c] = Ne({}), [m, C] = Ne(null), T = et(null), b = et(null);
13962
13962
  it(() => {
13963
13963
  t && (c(uw(t)), a("style"));
13964
13964
  }, [t]), it(() => {
@@ -19515,9 +19515,9 @@ class yh {
19515
19515
  const Ue = se.reduce((Ee, de) => Math.max(Ee, L.measureText(de).width), 0) + we * 2, ye = se.length * pe + we * 2, [ve, be, Se, Ie] = v <= F ? [v, U, F, M] : [F, M, v, U];
19516
19516
  let Ze, ze;
19517
19517
  r.statsPosition === "left" ? (Ze = ve, ze = be) : r.statsPosition === "center" ? (Ze = (ve + Se) / 2, ze = (be + Ie) / 2) : (Ze = Se, ze = Ie);
19518
- const Ce = Ze - Ue / 2, Ne = ze - ye - 12 * ne;
19519
- L.fillStyle = "rgba(20, 20, 30, 0.72)", L.fillRect(Ce, Ne, Ue, ye), L.strokeStyle = r.statsColor, L.lineWidth = 1 * ne, L.strokeRect(Ce, Ne, Ue, ye), L.fillStyle = r.statsColor, L.textBaseline = "top", L.textAlign = "left", se.forEach((Ee, de) => {
19520
- L.fillText(Ee, Ce + we, Ne + we + de * pe);
19518
+ const Ce = Ze - Ue / 2, ke = ze - ye - 12 * ne;
19519
+ L.fillStyle = "rgba(20, 20, 30, 0.72)", L.fillRect(Ce, ke, Ue, ye), L.strokeStyle = r.statsColor, L.lineWidth = 1 * ne, L.strokeRect(Ce, ke, Ue, ye), L.fillStyle = r.statsColor, L.textBaseline = "top", L.textAlign = "left", se.forEach((Ee, de) => {
19520
+ L.fillText(Ee, Ce + we, ke + we + de * pe);
19521
19521
  });
19522
19522
  }
19523
19523
  }
@@ -19608,9 +19608,9 @@ class Gv {
19608
19608
  const Ue = se.reduce((Ee, de) => Math.max(Ee, L.measureText(de).width), 0) + we * 2, ye = se.length * pe + we * 2, [ve, be, Se, Ie] = v <= F ? [v, U, F, M] : [F, M, v, U];
19609
19609
  let Ze, ze;
19610
19610
  r.statsPosition === "left" ? (Ze = ve, ze = be) : r.statsPosition === "center" ? (Ze = (ve + Se) / 2, ze = (be + Ie) / 2) : (Ze = Se, ze = Ie);
19611
- const Ce = Ze - Ue / 2, Ne = ze - ye - 12 * ne;
19612
- L.fillStyle = "rgba(20, 20, 30, 0.72)", L.fillRect(Ce, Ne, Ue, ye), L.strokeStyle = r.statsColor, L.lineWidth = 1 * ne, L.strokeRect(Ce, Ne, Ue, ye), L.fillStyle = r.statsColor, L.textBaseline = "top", L.textAlign = "left", se.forEach((Ee, de) => {
19613
- L.fillText(Ee, Ce + we, Ne + we + de * pe);
19611
+ const Ce = Ze - Ue / 2, ke = ze - ye - 12 * ne;
19612
+ L.fillStyle = "rgba(20, 20, 30, 0.72)", L.fillRect(Ce, ke, Ue, ye), L.strokeStyle = r.statsColor, L.lineWidth = 1 * ne, L.strokeRect(Ce, ke, Ue, ye), L.fillStyle = r.statsColor, L.textBaseline = "top", L.textAlign = "left", se.forEach((Ee, de) => {
19613
+ L.fillText(Ee, Ce + we, ke + we + de * pe);
19614
19614
  });
19615
19615
  }
19616
19616
  }
@@ -19701,9 +19701,9 @@ class $v {
19701
19701
  const Ue = se.reduce((Ee, de) => Math.max(Ee, L.measureText(de).width), 0) + we * 2, ye = se.length * pe + we * 2, [ve, be, Se, Ie] = v <= F ? [v, U, F, M] : [F, M, v, U];
19702
19702
  let Ze, ze;
19703
19703
  r.statsPosition === "left" ? (Ze = ve, ze = be) : r.statsPosition === "center" ? (Ze = (ve + Se) / 2, ze = (be + Ie) / 2) : (Ze = Se, ze = Ie);
19704
- const Ce = Ze - Ue / 2, Ne = ze - ye - 12 * ne;
19705
- L.fillStyle = "rgba(20, 20, 30, 0.72)", L.fillRect(Ce, Ne, Ue, ye), L.strokeStyle = r.statsColor, L.lineWidth = 1 * ne, L.strokeRect(Ce, Ne, Ue, ye), L.fillStyle = r.statsColor, L.textBaseline = "top", L.textAlign = "left", se.forEach((Ee, de) => {
19706
- L.fillText(Ee, Ce + we, Ne + we + de * pe);
19704
+ const Ce = Ze - Ue / 2, ke = ze - ye - 12 * ne;
19705
+ L.fillStyle = "rgba(20, 20, 30, 0.72)", L.fillRect(Ce, ke, Ue, ye), L.strokeStyle = r.statsColor, L.lineWidth = 1 * ne, L.strokeRect(Ce, ke, Ue, ye), L.fillStyle = r.statsColor, L.textBaseline = "top", L.textAlign = "left", se.forEach((Ee, de) => {
19706
+ L.fillText(Ee, Ce + we, ke + we + de * pe);
19707
19707
  });
19708
19708
  }
19709
19709
  }
@@ -19794,14 +19794,14 @@ class Xv {
19794
19794
  const ye = Math.min(C, T), ve = 11 * ye, be = ve * 1.5, Se = 5 * ye;
19795
19795
  Z.font = ve + "px sans-serif";
19796
19796
  const Ze = Te.reduce(
19797
- (ke, Ye) => Math.max(ke, Z.measureText(Ye).width),
19797
+ (_e, Ye) => Math.max(_e, Z.measureText(Ye).width),
19798
19798
  0
19799
19799
  ) + Se * 2, ze = Te.length * be + Se * 2;
19800
- let Ce, Ne;
19801
- n.statsPosition === "left" ? (Ce = V, Ne = j) : n.statsPosition === "center" ? (Ce = (V + X) / 2, Ne = (j + K) / 2) : (Ce = X, Ne = K);
19802
- const Ee = Ce - Ze / 2, de = Ne - ze - 12 * ye;
19803
- Z.fillStyle = "rgba(20, 20, 30, 0.72)", Z.fillRect(Ee, de, Ze, ze), Z.strokeStyle = n.statsColor, Z.lineWidth = 1 * ye, Z.strokeRect(Ee, de, Ze, ze), Z.fillStyle = n.statsColor, Z.textBaseline = "top", Z.textAlign = "left", Te.forEach((ke, Ye) => {
19804
- Z.fillText(ke, Ee + Se, de + Se + Ye * be);
19800
+ let Ce, ke;
19801
+ n.statsPosition === "left" ? (Ce = V, ke = j) : n.statsPosition === "center" ? (Ce = (V + X) / 2, ke = (j + K) / 2) : (Ce = X, ke = K);
19802
+ const Ee = Ce - Ze / 2, de = ke - ze - 12 * ye;
19803
+ Z.fillStyle = "rgba(20, 20, 30, 0.72)", Z.fillRect(Ee, de, Ze, ze), Z.strokeStyle = n.statsColor, Z.lineWidth = 1 * ye, Z.strokeRect(Ee, de, Ze, ze), Z.fillStyle = n.statsColor, Z.textBaseline = "top", Z.textAlign = "left", Te.forEach((_e, Ye) => {
19804
+ Z.fillText(_e, Ee + Se, de + Se + Ye * be);
19805
19805
  });
19806
19806
  }
19807
19807
  }
@@ -19920,12 +19920,12 @@ class Jv {
19920
19920
  if (Ue.length > 0 && Te.push(Ue.join(", ")), Te.length > 0) {
19921
19921
  const ye = Math.min(l, c), ve = 11 * ye, be = ve * 1.5, Se = 5 * ye;
19922
19922
  ee.font = ve + "px sans-serif";
19923
- const Ze = Te.reduce(($e, _e) => Math.max($e, ee.measureText(_e).width), 0) + Se * 2, ze = Te.length * be + Se * 2, [Ce, Ne, Ee, de] = v <= F ? [v, U, F, M] : [F, M, v, U];
19924
- let ke, Ye;
19925
- r.statsPosition === "left" ? (ke = Ce, Ye = Ne) : r.statsPosition === "center" ? (ke = (Ce + Ee) / 2, Ye = (Ne + de) / 2) : (ke = Ee, Ye = de);
19926
- const rt = ke - Ze / 2, nt = Ye - ze - 12 * ye;
19927
- ee.fillStyle = "rgba(20, 20, 30, 0.72)", ee.fillRect(rt, nt, Ze, ze), ee.strokeStyle = r.statsColor, ee.lineWidth = 1 * ye, ee.strokeRect(rt, nt, Ze, ze), ee.fillStyle = r.statsColor, ee.textBaseline = "top", ee.textAlign = "left", Te.forEach(($e, _e) => {
19928
- ee.fillText($e, rt + Se, nt + Se + _e * be);
19923
+ const Ze = Te.reduce(($e, Pe) => Math.max($e, ee.measureText(Pe).width), 0) + Se * 2, ze = Te.length * be + Se * 2, [Ce, ke, Ee, de] = v <= F ? [v, U, F, M] : [F, M, v, U];
19924
+ let _e, Ye;
19925
+ r.statsPosition === "left" ? (_e = Ce, Ye = ke) : r.statsPosition === "center" ? (_e = (Ce + Ee) / 2, Ye = (ke + de) / 2) : (_e = Ee, Ye = de);
19926
+ const rt = _e - Ze / 2, nt = Ye - ze - 12 * ye;
19927
+ ee.fillStyle = "rgba(20, 20, 30, 0.72)", ee.fillRect(rt, nt, Ze, ze), ee.strokeStyle = r.statsColor, ee.lineWidth = 1 * ye, ee.strokeRect(rt, nt, Ze, ze), ee.fillStyle = r.statsColor, ee.textBaseline = "top", ee.textAlign = "left", Te.forEach(($e, Pe) => {
19928
+ ee.fillText($e, rt + Se, nt + Se + Pe * be);
19929
19929
  });
19930
19930
  }
19931
19931
  }
@@ -20142,20 +20142,20 @@ class ha {
20142
20142
  const W = F._chart, L = F._series;
20143
20143
  if (!W || !L) return;
20144
20144
  const V = N.horizontalPixelRatio, j = N.verticalPixelRatio, X = [F.p1, F.p3, F.p4, F.p2].map((ze) => {
20145
- const Ce = W.timeScale().timeToCoordinate(ze.rawTime), Ne = L.priceToCoordinate(ze.price);
20146
- return Ce == null || Ne == null ? null : { x: Ce * V, y: Ne * j };
20145
+ const Ce = W.timeScale().timeToCoordinate(ze.rawTime), ke = L.priceToCoordinate(ze.price);
20146
+ return Ce == null || ke == null ? null : { x: Ce * V, y: ke * j };
20147
20147
  }).filter(Boolean);
20148
20148
  if (X.length !== 4) return;
20149
20149
  const [K, ee, Ae, ce] = X, Z = N.context;
20150
20150
  Z.save();
20151
20151
  const te = ee.x - K.x, se = ee.y - K.y, le = Math.sqrt(te * te + se * se) || 1, ne = te / le, he = se / le, pe = Ae.x - ce.x, we = Ae.y - ce.y, Te = Math.sqrt(pe * pe + we * we) || 1, Ue = pe / Te, ye = we / Te, ve = 1e5, be = F.rayLeft ? { x: K.x - ne * ve, y: K.y - he * ve } : K, Se = F.rayRight ? { x: ee.x + ne * ve, y: ee.y + he * ve } : ee, Ie = F.rayLeft ? { x: ce.x - Ue * ve, y: ce.y - ye * ve } : ce, Ze = F.rayRight ? { x: Ae.x + Ue * ve, y: Ae.y + ye * ve } : Ae;
20152
20152
  if (F.showBackground) {
20153
- const ze = F.fillColor || "#6aa84f", Ce = parseInt(ze.slice(1, 3), 16), Ne = parseInt(ze.slice(3, 5), 16), Ee = parseInt(ze.slice(5, 7), 16);
20154
- Z.beginPath(), Z.moveTo(K.x, K.y), Z.lineTo(ee.x, ee.y), Z.lineTo(Ae.x, Ae.y), Z.lineTo(ce.x, ce.y), Z.closePath(), Z.fillStyle = `rgba(${Ce},${Ne},${Ee},${F.fillOpacity ?? 0.1})`, Z.fill();
20153
+ const ze = F.fillColor || "#6aa84f", Ce = parseInt(ze.slice(1, 3), 16), ke = parseInt(ze.slice(3, 5), 16), Ee = parseInt(ze.slice(5, 7), 16);
20154
+ Z.beginPath(), Z.moveTo(K.x, K.y), Z.lineTo(ee.x, ee.y), Z.lineTo(Ae.x, Ae.y), Z.lineTo(ce.x, ce.y), Z.closePath(), Z.fillStyle = `rgba(${Ce},${ke},${Ee},${F.fillOpacity ?? 0.1})`, Z.fill();
20155
20155
  }
20156
20156
  if (Z.strokeStyle = F.lineColor, Z.lineWidth = F.lineWidth * j, Z.setLineDash([]), Z.beginPath(), Z.moveTo(be.x, be.y), Z.lineTo(Se.x, Se.y), Z.moveTo(Ie.x, Ie.y), Z.lineTo(Ze.x, Ze.y), Z.moveTo(K.x, K.y), Z.lineTo(ce.x, ce.y), Z.moveTo(ee.x, ee.y), Z.lineTo(Ae.x, Ae.y), Z.stroke(), F.arrowLeft || F.arrowRight) {
20157
- const ze = 8 * j, Ce = (Ne, Ee, de) => {
20158
- Z.save(), Z.translate(Ne, Ee), Z.rotate(de), Z.beginPath(), Z.moveTo(0, 0), Z.lineTo(-ze, -ze / 2), Z.lineTo(-ze, ze / 2), Z.closePath(), Z.fillStyle = F.lineColor, Z.fill(), Z.restore();
20157
+ const ze = 8 * j, Ce = (ke, Ee, de) => {
20158
+ Z.save(), Z.translate(ke, Ee), Z.rotate(de), Z.beginPath(), Z.moveTo(0, 0), Z.lineTo(-ze, -ze / 2), Z.lineTo(-ze, ze / 2), Z.closePath(), Z.fillStyle = F.lineColor, Z.fill(), Z.restore();
20159
20159
  };
20160
20160
  F.arrowLeft && (Ce(be.x, be.y, Math.atan2(-he, -ne)), Ce(Ie.x, Ie.y, Math.atan2(-ye, -Ue))), F.arrowRight && (Ce(Se.x, Se.y, Math.atan2(he, ne)), Ce(Ze.x, Ze.y, Math.atan2(ye, Ue)));
20161
20161
  }
@@ -20163,9 +20163,9 @@ class ha {
20163
20163
  Z.beginPath(), Z.arc(ze.x, ze.y, 6 * j, 0, Math.PI * 2), Z.fill(), Z.stroke();
20164
20164
  }), F.showPrices) {
20165
20165
  const ze = [F.p1, F.p3, F.p2, F.p4], Ce = [K, ee, ce, Ae];
20166
- Z.fillStyle = F.pricesColor || F.lineColor, Z.font = `${Math.round(10 * j)}px sans-serif`, Z.textAlign = "left", Z.textBaseline = "middle", Ce.forEach((Ne, Ee) => {
20166
+ Z.fillStyle = F.pricesColor || F.lineColor, Z.font = `${Math.round(10 * j)}px sans-serif`, Z.textAlign = "left", Z.textBaseline = "middle", Ce.forEach((ke, Ee) => {
20167
20167
  const de = ze[Ee]?.price;
20168
- typeof de == "number" && Z.fillText(de.toFixed(5), Ne.x + 8 * V, Ne.y);
20168
+ typeof de == "number" && Z.fillText(de.toFixed(5), ke.x + 8 * V, ke.y);
20169
20169
  });
20170
20170
  }
20171
20171
  Z.restore();
@@ -20791,7 +20791,7 @@ const nT = cd(function({
20791
20791
  onBuyClick: r,
20792
20792
  onSellClick: n
20793
20793
  }, s) {
20794
- const o = et(null), a = et(null), l = et(null), c = et(null), m = et(null), C = et(null), T = et([]), b = et(!1), v = et(null), U = et(null), F = et(null), M = et(null), N = et([]), [W, L] = Pe(null), [V, j] = Pe(null), [X, K] = Pe([]), [ee, Ae] = Pe(null), [ce, Z] = Pe([]), te = et(null), se = et(null), le = et(null), ne = et(!1), he = et(!1);
20794
+ const o = et(null), a = et(null), l = et(null), c = et(null), m = et(null), C = et(null), T = et([]), b = et(!1), v = et(null), U = et(null), F = et(null), M = et(null), N = et([]), [W, L] = Ne(null), [V, j] = Ne(null), [X, K] = Ne([]), [ee, Ae] = Ne(null), [ce, Z] = Ne([]), te = et(null), se = et(null), le = et(null), ne = et(!1), he = et(!1);
20795
20795
  it(() => {
20796
20796
  le.current = W;
20797
20797
  let p = !1;
@@ -20816,17 +20816,17 @@ const nT = cd(function({
20816
20816
  snapToGrid: Ze,
20817
20817
  chartObjects: ze,
20818
20818
  setChartObjects: Ce,
20819
- orders: Ne,
20819
+ orders: ke,
20820
20820
  selectedSymbol: Ee,
20821
20821
  selectedTimeframe: de,
20822
- drawingsVisible: ke,
20822
+ drawingsVisible: _e,
20823
20823
  chartType: Ye,
20824
20824
  chartLocked: rt,
20825
20825
  theme: nt,
20826
20826
  baseUrl: $e,
20827
- endpoints: _e,
20827
+ endpoints: Pe,
20828
20828
  endpointParams: ge
20829
- } = Wt(), me = et([]), [Me, Re] = Pe(!1), [Qe, Ke] = Pe(null), [Ve, ft] = Pe([]), [yt, It] = Pe(!0), [Gi, kr] = Pe(null), [ri, Or] = Pe(0), Rt = Di(() => {
20829
+ } = Wt(), me = et([]), [Me, Re] = Ne(!1), [Qe, Ke] = Ne(null), [Ve, ft] = Ne([]), [yt, It] = Ne(!0), [Gi, kr] = Ne(null), [ri, Or] = Ne(0), Rt = Di(() => {
20830
20830
  const p = Ve.map((d) => q(d?.time)).filter((d) => Number.isFinite(d));
20831
20831
  return p.sort((d, k) => d - k), p;
20832
20832
  }, [Ve]), xt = et(null), Lt = et(/* @__PURE__ */ new Map());
@@ -21688,7 +21688,7 @@ const nT = cd(function({
21688
21688
  c.current.setData([]);
21689
21689
  } catch {
21690
21690
  }
21691
- const d = Zp(de), k = rx(de, d), xe = $e || Nv?.VITE_BASE_URL || "http://localhost:5002", E = _e?.candles || "/api/chart/candles", y = ge?.candles || {}, Y = {
21691
+ const d = Zp(de), k = rx(de, d), xe = $e || Nv?.VITE_BASE_URL || "http://localhost:5002", E = Pe?.candles || "/api/chart/candles", y = ge?.candles || {}, Y = {
21692
21692
  symbol: y.symbol || "symbol",
21693
21693
  timeframe: y.timeframe || "timeframe",
21694
21694
  limit: y.limit || "limit",
@@ -26242,10 +26242,10 @@ const nT = cd(function({
26242
26242
  }), p && l.current?.applyOptions({});
26243
26243
  }, [W, ee]), it(() => {
26244
26244
  !l.current || !c.current || T.current.forEach((p) => {
26245
- if (p.series && p.series.applyOptions({ visible: ke }), p.priceLine) {
26246
- const d = ke && p.showPrice !== !1;
26245
+ if (p.series && p.series.applyOptions({ visible: _e }), p.priceLine) {
26246
+ const d = _e && p.showPrice !== !1;
26247
26247
  p.priceLine.applyOptions(
26248
- ke ? {
26248
+ _e ? {
26249
26249
  color: p.lineColor ?? "#3b82f6",
26250
26250
  axisLabelVisible: d,
26251
26251
  title: d && typeof p.price == "number" ? p.price.toFixed(5) : ""
@@ -26257,30 +26257,30 @@ const nT = cd(function({
26257
26257
  );
26258
26258
  }
26259
26259
  if (p.type === "fibonacci" && p.primitive) {
26260
- p.primitive.visible = ke;
26260
+ p.primitive.visible = _e;
26261
26261
  try {
26262
26262
  l.current?.applyOptions({});
26263
26263
  } catch {
26264
26264
  }
26265
26265
  }
26266
26266
  if (p.type === "rectangle" && p.primitive) {
26267
- p.primitive.visible = ke;
26267
+ p.primitive.visible = _e;
26268
26268
  try {
26269
26269
  l.current?.applyOptions({});
26270
26270
  } catch {
26271
26271
  }
26272
26272
  }
26273
- if (p.type === "parallellines" && (p.baseLine && p.baseLine.applyOptions({ visible: ke }), p.parallelLine && p.parallelLine.applyOptions({ visible: ke }), p.firstLine && p.firstLine.applyOptions({ visible: ke }), p.secondLine && p.secondLine.applyOptions({ visible: ke })), (p.type === "horizontalray" || p.type === "verticalline" || p.type === "infoline" || p.type === "rulerline" || p.type === "arrowedline" || p.type === "rayline" || p.type === "extendedline" || p.type === "crossline" || p.type === "trendbyangle" || p.type === "equidistantchannel" || p.type === "regressionchannel" || p.type === "stddevchannel" || p.type === "gannfan" || p.type === "ganngrid" || p.type === "andrewspitchfork" || p.type === "disjointchannel" || p.type === "flattopbottom" || p.type === "circle" || p.type === "triangle" || p.type === "ellipse" || p.type === "text") && p.primitive) {
26274
- p.primitive.visible = ke;
26273
+ if (p.type === "parallellines" && (p.baseLine && p.baseLine.applyOptions({ visible: _e }), p.parallelLine && p.parallelLine.applyOptions({ visible: _e }), p.firstLine && p.firstLine.applyOptions({ visible: _e }), p.secondLine && p.secondLine.applyOptions({ visible: _e })), (p.type === "horizontalray" || p.type === "verticalline" || p.type === "infoline" || p.type === "rulerline" || p.type === "arrowedline" || p.type === "rayline" || p.type === "extendedline" || p.type === "crossline" || p.type === "trendbyangle" || p.type === "equidistantchannel" || p.type === "regressionchannel" || p.type === "stddevchannel" || p.type === "gannfan" || p.type === "ganngrid" || p.type === "andrewspitchfork" || p.type === "disjointchannel" || p.type === "flattopbottom" || p.type === "circle" || p.type === "triangle" || p.type === "ellipse" || p.type === "text") && p.primitive) {
26274
+ p.primitive.visible = _e;
26275
26275
  try {
26276
26276
  l.current?.applyOptions({});
26277
26277
  } catch {
26278
26278
  }
26279
26279
  }
26280
26280
  });
26281
- }, [ke, ze]), it(() => {
26282
- !ke && W && (L(null), K([]));
26283
- }, [ke, W]), it(() => {
26281
+ }, [_e, ze]), it(() => {
26282
+ !_e && W && (L(null), K([]));
26283
+ }, [_e, W]), it(() => {
26284
26284
  if (T.current.length > ze.length) {
26285
26285
  const p = T.current.filter(
26286
26286
  (d, k) => !ze.includes(d)
@@ -26420,7 +26420,7 @@ const nT = cd(function({
26420
26420
  p.removePriceLine(k);
26421
26421
  } catch {
26422
26422
  }
26423
- }), me.current = [], Ne.filter((k) => k.symbol === Ee).forEach((k) => {
26423
+ }), me.current = [], ke.filter((k) => k.symbol === Ee).forEach((k) => {
26424
26424
  const xe = parseFloat(k.price);
26425
26425
  if (isNaN(xe)) return;
26426
26426
  const y = k.type === "BUY" ? "#26A69A" : "#EF5350", Y = p.createPriceLine({
@@ -26442,7 +26442,7 @@ const nT = cd(function({
26442
26442
  }
26443
26443
  }), me.current = [];
26444
26444
  }) : void 0;
26445
- }, [Ne, Ee]), it(() => {
26445
+ }, [ke, Ee]), it(() => {
26446
26446
  const p = o.current;
26447
26447
  if (!p) return;
26448
26448
  const d = (k) => {
@@ -26503,7 +26503,7 @@ const nT = cd(function({
26503
26503
  p.removeEventListener("dblclick", d, !0);
26504
26504
  };
26505
26505
  }, [Ve, de]);
26506
- const Wa = W ?? ee, Ga = W ? X : ce, td = ke && lx(Wa, Ga), Ad = cx(Wa?.type);
26506
+ const Wa = W ?? ee, Ga = W ? X : ce, td = _e && lx(Wa, Ga), Ad = cx(Wa?.type);
26507
26507
  it(() => {
26508
26508
  const p = o.current, d = a.current;
26509
26509
  if (!p || !d) return;
@@ -26845,7 +26845,7 @@ const nT = cd(function({
26845
26845
  }
26846
26846
  };
26847
26847
  function fx({ style: i, className: e }) {
26848
- const { selectedSymbol: t, setSelectedSymbol: A, symbols: r, symbolsLoading: n } = Wt(), [s, o] = Pe(!1), [a, l] = Pe(""), [c, m] = Pe(-1), C = et(null), T = et(null);
26848
+ const { selectedSymbol: t, setSelectedSymbol: A, symbols: r, symbolsLoading: n } = Wt(), [s, o] = Ne(!1), [a, l] = Ne(""), [c, m] = Ne(-1), C = et(null), T = et(null);
26849
26849
  it(() => {
26850
26850
  const M = (N) => {
26851
26851
  C.current && !C.current.contains(N.target) && (o(!1), l(""));
@@ -27042,7 +27042,7 @@ function gx({
27042
27042
  style: l,
27043
27043
  className: c
27044
27044
  }) {
27045
- const [m, C] = Pe(0.1), T = i !== void 0 ? i : m, b = vt(
27045
+ const [m, C] = Ne(0.1), T = i !== void 0 ? i : m, b = vt(
27046
27046
  (M) => {
27047
27047
  const N = Math.max(t, Math.min(A, parseFloat(M) || t)), W = Math.round(N / r) * r, L = parseFloat(W.toFixed(8));
27048
27048
  i !== void 0 || C(L), e?.(L);
@@ -27206,7 +27206,7 @@ function wx({
27206
27206
  style: c,
27207
27207
  className: m
27208
27208
  }) {
27209
- const { currentSymbolData: C } = Wt(), [T, b] = Pe(""), [v, U] = Pe(!1), [F, M] = Pe("price"), N = i !== void 0 ? i : T, W = t !== void 0 ? t : v, L = r !== void 0 ? r : F, V = vt(
27209
+ const { currentSymbolData: C } = Wt(), [T, b] = Ne(""), [v, U] = Ne(!1), [F, M] = Ne("price"), N = i !== void 0 ? i : T, W = t !== void 0 ? t : v, L = r !== void 0 ? r : F, V = vt(
27210
27210
  (Ae) => {
27211
27211
  t !== void 0 || U(Ae), A?.(Ae);
27212
27212
  },
@@ -27387,7 +27387,7 @@ function Bx({
27387
27387
  style: c,
27388
27388
  className: m
27389
27389
  }) {
27390
- const { currentSymbolData: C } = Wt(), [T, b] = Pe(""), [v, U] = Pe(!1), [F, M] = Pe("price"), N = i !== void 0 ? i : T, W = t !== void 0 ? t : v, L = r !== void 0 ? r : F, V = vt(
27390
+ const { currentSymbolData: C } = Wt(), [T, b] = Ne(""), [v, U] = Ne(!1), [F, M] = Ne("price"), N = i !== void 0 ? i : T, W = t !== void 0 ? t : v, L = r !== void 0 ? r : F, V = vt(
27391
27391
  (Ae) => {
27392
27392
  t !== void 0 || U(Ae), A?.(Ae);
27393
27393
  },
@@ -27948,7 +27948,7 @@ const $t = {
27948
27948
  }
27949
27949
  };
27950
27950
  function lT({ volume: i = 0.1, stopLoss: e, takeProfit: t, onTradeExecuted: A, style: r, className: n }) {
27951
- const { selectedSymbol: s, currentSymbolData: o, setOrders: a, setUserBalance: l } = Wt(), [c, m] = Pe(null), C = parseFloat(o?.bid || 0), T = parseFloat(o?.ask || 0), b = T > 0 && C > 0 ? Math.abs(T - C) : 0, v = (M) => !M || M === 0 ? "-.-----" : M >= 1e3 ? M.toFixed(2) : M >= 1 ? M.toFixed(4) : M.toFixed(5), U = (M) => M === 0 ? "-" : M >= 1 ? M.toFixed(1) : M >= 0.01 ? M.toFixed(3) : (M * 1e4).toFixed(1) + "p", F = vt(
27951
+ const { selectedSymbol: s, currentSymbolData: o, setOrders: a, setUserBalance: l } = Wt(), [c, m] = Ne(null), C = parseFloat(o?.bid || 0), T = parseFloat(o?.ask || 0), b = T > 0 && C > 0 ? Math.abs(T - C) : 0, v = (M) => !M || M === 0 ? "-.-----" : M >= 1e3 ? M.toFixed(2) : M >= 1 ? M.toFixed(4) : M.toFixed(5), U = (M) => M === 0 ? "-" : M >= 1 ? M.toFixed(1) : M >= 0.01 ? M.toFixed(3) : (M * 1e4).toFixed(1) + "p", F = vt(
27952
27952
  (M) => {
27953
27953
  if (!s) return;
27954
27954
  const N = M === "BUY" ? T : C;
@@ -28139,7 +28139,7 @@ const tt = {
28139
28139
  }
28140
28140
  };
28141
28141
  function cT({ style: i, className: e, maxHeight: t = 200 }) {
28142
- const { orders: A, setOrders: r, symbols: n, accountSummary: s, setUserBalance: o } = Wt(), [a, l] = Pe(null), c = A.filter((v) => v.status === "OPEN" || !v.closeAt), m = vt(
28142
+ const { orders: A, setOrders: r, symbols: n, accountSummary: s, setUserBalance: o } = Wt(), [a, l] = Ne(null), c = A.filter((v) => v.status === "OPEN" || !v.closeAt), m = vt(
28143
28143
  (v, U) => {
28144
28144
  const F = n.find((M) => M.symbol === v);
28145
28145
  return F ? parseFloat(U === "BUY" ? F.bid || 0 : F.ask || 0) : 0;
@@ -29147,13 +29147,13 @@ const hT = ({
29147
29147
  theme: v,
29148
29148
  setTheme: U,
29149
29149
  setIsShow: F
29150
- } = Wt(), [M, N] = Pe(!1), [W, L] = Pe(null), [V, j] = Pe(null), [X, K] = Pe(0), [ee, Ae] = Pe(!1), [ce, Z] = Pe(0), [te, se] = Pe(!1), [le, ne] = Pe(0), [he, pe] = Pe(!1), [we, Te] = Pe(0), [Ue, ye] = Pe(!1), [ve, be] = Pe({
29150
+ } = Wt(), [M, N] = Ne(!1), [W, L] = Ne(null), [V, j] = Ne(null), [X, K] = Ne(0), [ee, Ae] = Ne(!1), [ce, Z] = Ne(0), [te, se] = Ne(!1), [le, ne] = Ne(0), [he, pe] = Ne(!1), [we, Te] = Ne(0), [Ue, ye] = Ne(!1), [ve, be] = Ne({
29151
29151
  chart: "Grid",
29152
29152
  colors: "Green & Red",
29153
29153
  lang: "English"
29154
- }), Se = et(null), Ie = et(null), Ze = et(null), ze = et(null), Ce = et(null), Ne = et(null);
29154
+ }), Se = et(null), Ie = et(null), Ze = et(null), ze = et(null), Ce = et(null), ke = et(null);
29155
29155
  it(() => {
29156
- const _e = (ge) => {
29156
+ const Pe = (ge) => {
29157
29157
  const me = Se.current;
29158
29158
  M && me && !me.contains(ge.target) && (N(!1), L(null));
29159
29159
  const Me = Ie.current;
@@ -29165,12 +29165,12 @@ const hT = ({
29165
29165
  const Ke = Ce.current;
29166
29166
  V === "shape" && Ke && !Ke.contains(ge.target) && j(null);
29167
29167
  };
29168
- return window.addEventListener("mousedown", _e), () => window.removeEventListener("mousedown", _e);
29168
+ return window.addEventListener("mousedown", Pe), () => window.removeEventListener("mousedown", Pe);
29169
29169
  }, [M, V]), it(() => {
29170
- const _e = (ge) => {
29170
+ const Pe = (ge) => {
29171
29171
  ge.key === "Escape" && (N(!1), L(null), j(null));
29172
29172
  };
29173
- return window.addEventListener("keydown", _e), () => window.removeEventListener("keydown", _e);
29173
+ return window.addEventListener("keydown", Pe), () => window.removeEventListener("keydown", Pe);
29174
29174
  }, []);
29175
29175
  const Ee = Di(
29176
29176
  () => [
@@ -29481,8 +29481,8 @@ const hT = ({
29481
29481
  }
29482
29482
  ],
29483
29483
  []
29484
- ), de = (_e) => {
29485
- const ge = Ee[_e].label;
29484
+ ), de = (Pe) => {
29485
+ const ge = Ee[Pe].label;
29486
29486
  if (ge === "Menu") {
29487
29487
  N((me) => !me), L(null);
29488
29488
  return;
@@ -29492,7 +29492,7 @@ const hT = ({
29492
29492
  return;
29493
29493
  }
29494
29494
  if (ge === "Magnet") {
29495
- a(!o), r(o ? null : _e);
29495
+ a(!o), r(o ? null : Pe);
29496
29496
  return;
29497
29497
  }
29498
29498
  if (ge === "Delete") {
@@ -29518,10 +29518,10 @@ const hT = ({
29518
29518
  F(!0);
29519
29519
  return;
29520
29520
  }
29521
- r(A === _e ? null : _e);
29521
+ r(A === Pe ? null : Pe);
29522
29522
  };
29523
29523
  Ee.slice(0, 12);
29524
- const ke = Ee.slice(12), Ye = [0, 1, 2, 3, "gann", 5, 4, 6, 7, 8, 9, 10, 11], rt = [
29524
+ const _e = Ee.slice(12), Ye = [0, 1, 2, 3, "gann", 5, 4, 6, 7, 8, 9, 10, 11], rt = [
29525
29525
  {
29526
29526
  key: "accounts",
29527
29527
  label: "Trading accounts",
@@ -30546,17 +30546,17 @@ const hT = ({
30546
30546
  }
30547
30547
  )
30548
30548
  }
30549
- ], nt = ({ item: _e }) => {
30550
- const ge = !!_e.submenu?.length;
30549
+ ], nt = ({ item: Pe }) => {
30550
+ const ge = !!Pe.submenu?.length;
30551
30551
  return /* @__PURE__ */ G(
30552
30552
  "div",
30553
30553
  {
30554
30554
  className: "relative",
30555
30555
  onMouseEnter: () => {
30556
- Ne.current && (clearTimeout(Ne.current), Ne.current = null), ge && L(_e.key);
30556
+ ke.current && (clearTimeout(ke.current), ke.current = null), ge && L(Pe.key);
30557
30557
  },
30558
30558
  onMouseLeave: () => {
30559
- ge && (Ne.current = setTimeout(() => L(null), 120));
30559
+ ge && (ke.current = setTimeout(() => L(null), 120));
30560
30560
  },
30561
30561
  children: [
30562
30562
  /* @__PURE__ */ G(
@@ -30564,7 +30564,7 @@ const hT = ({
30564
30564
  {
30565
30565
  type: "button",
30566
30566
  onClick: () => {
30567
- ge ? L((me) => me === _e.key ? null : _e.key) : (_e.key === "theme" && U((me) => me === "light" ? "dark" : "light"), N(!1), L(null));
30567
+ ge ? L((me) => me === Pe.key ? null : Pe.key) : (Pe.key === "theme" && U((me) => me === "light" ? "dark" : "light"), N(!1), L(null));
30568
30568
  },
30569
30569
  className: `w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${$e ? "text-slate-700 hover:bg-slate-100" : "text-slate-200 hover:bg-[#202933]"}`,
30570
30570
  children: [
@@ -30572,15 +30572,15 @@ const hT = ({
30572
30572
  "span",
30573
30573
  {
30574
30574
  className: `w-5 h-5 flex shrink-0 items-center justify-center ${$e ? "text-slate-500" : "text-slate-400"}`,
30575
- children: _e.icon
30575
+ children: Pe.icon
30576
30576
  }
30577
30577
  ),
30578
- /* @__PURE__ */ h("span", { className: "flex-1 text-[15px]", children: _e.label }),
30579
- _e.rightText && /* @__PURE__ */ h(
30578
+ /* @__PURE__ */ h("span", { className: "flex-1 text-[15px]", children: Pe.label }),
30579
+ Pe.rightText && /* @__PURE__ */ h(
30580
30580
  "span",
30581
30581
  {
30582
30582
  className: `text-xs ${$e ? "text-slate-500" : "text-slate-400"}`,
30583
- children: _e.rightText
30583
+ children: Pe.rightText
30584
30584
  }
30585
30585
  ),
30586
30586
  ge && /* @__PURE__ */ h(
@@ -30605,12 +30605,12 @@ const hT = ({
30605
30605
  ]
30606
30606
  }
30607
30607
  ),
30608
- ge && W === _e.key && /* @__PURE__ */ h(
30608
+ ge && W === Pe.key && /* @__PURE__ */ h(
30609
30609
  "div",
30610
30610
  {
30611
30611
  className: `absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${$e ? "bg-white border-slate-200" : "bg-[#262F3F] border-white/10"}`,
30612
- children: /* @__PURE__ */ h("div", { className: "py-1", children: _e.submenu.map((me, Me) => {
30613
- const Re = ve[_e.key] === me.label || me.selected && ve[_e.key] == null;
30612
+ children: /* @__PURE__ */ h("div", { className: "py-1", children: Pe.submenu.map((me, Me) => {
30613
+ const Re = ve[Pe.key] === me.label || me.selected && ve[Pe.key] == null;
30614
30614
  return /* @__PURE__ */ G(
30615
30615
  "button",
30616
30616
  {
@@ -30618,7 +30618,7 @@ const hT = ({
30618
30618
  onClick: () => {
30619
30619
  be((Qe) => ({
30620
30620
  ...Qe,
30621
- [_e.key]: me.label
30621
+ [Pe.key]: me.label
30622
30622
  }));
30623
30623
  },
30624
30624
  className: `w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${$e ? "text-slate-700 hover:bg-slate-100" : "text-slate-200 hover:bg-[#202933]"}`,
@@ -30667,8 +30667,8 @@ const hT = ({
30667
30667
  {
30668
30668
  className: `w-12 flex flex-col items-center py-3 h-full border-r ${$e ? "bg-white border-slate-200" : "bg-[#12161d] border-slate-700"}`,
30669
30669
  children: [
30670
- /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-2", children: Ye.map((_e, ge) => {
30671
- const me = _e === "gann", Me = me ? null : Ee[_e], Re = me ? -1 : _e;
30670
+ /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-2", children: Ye.map((Pe, ge) => {
30671
+ const me = Pe === "gann", Me = me ? null : Ee[Pe], Re = me ? -1 : Pe;
30672
30672
  return /* @__PURE__ */ G(
30673
30673
  kA.Fragment,
30674
30674
  {
@@ -30923,35 +30923,35 @@ const hT = ({
30923
30923
  )
30924
30924
  ]
30925
30925
  },
30926
- me ? "gann-slot" : `${Me.label}-${_e}`
30926
+ me ? "gann-slot" : `${Me.label}-${Pe}`
30927
30927
  );
30928
30928
  }) }),
30929
30929
  /* @__PURE__ */ h("div", { className: "flex-1" }),
30930
- /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-2 pb-1", children: ke.map((_e, ge) => {
30930
+ /* @__PURE__ */ h("div", { className: "flex flex-col items-center gap-2 pb-1", children: _e.map((Pe, ge) => {
30931
30931
  const me = 12 + ge;
30932
30932
  return /* @__PURE__ */ h(
30933
30933
  "button",
30934
30934
  {
30935
30935
  onClick: () => de(me),
30936
30936
  className: `w-10 h-10 flex items-center justify-center transition-colors duration-150
30937
- ${_e.label === "Grid" && n || _e.label === "Eye" && !m || _e.label === "Lock" && T || A === me ? $e ? "text-sky-600 hover:bg-sky-100" : "text-sky-300 hover:bg-slate-700" : $e ? "text-slate-600 hover:bg-sky-100" : "text-slate-400 hover:bg-slate-700"}`,
30938
- title: `${_e.label}: ${_e.description}`,
30939
- children: _e.icon
30937
+ ${Pe.label === "Grid" && n || Pe.label === "Eye" && !m || Pe.label === "Lock" && T || A === me ? $e ? "text-sky-600 hover:bg-sky-100" : "text-sky-300 hover:bg-slate-700" : $e ? "text-slate-600 hover:bg-sky-100" : "text-slate-400 hover:bg-slate-700"}`,
30938
+ title: `${Pe.label}: ${Pe.description}`,
30939
+ children: Pe.icon
30940
30940
  },
30941
- _e.label
30941
+ Pe.label
30942
30942
  );
30943
30943
  }) })
30944
30944
  ]
30945
30945
  }
30946
30946
  ),
30947
- V === "line" && /* @__PURE__ */ h(Un, { top: 84, panelRef: Ie, isLight: $e, children: Ar.map((_e, ge) => {
30947
+ V === "line" && /* @__PURE__ */ h(Un, { top: 84, panelRef: Ie, isLight: $e, children: Ar.map((Pe, ge) => {
30948
30948
  const me = X === ge;
30949
30949
  return /* @__PURE__ */ G(
30950
30950
  "button",
30951
30951
  {
30952
30952
  type: "button",
30953
30953
  onMouseDown: (Me) => {
30954
- Me.stopPropagation(), K(ge), r(_e.toolId), j(null);
30954
+ Me.stopPropagation(), K(ge), r(Pe.toolId), j(null);
30955
30955
  },
30956
30956
  className: `w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e ? "text-slate-700 hover:bg-slate-100" : "text-slate-200 hover:bg-[#202933]"}`,
30957
30957
  children: [
@@ -30959,10 +30959,10 @@ const hT = ({
30959
30959
  "span",
30960
30960
  {
30961
30961
  className: `w-5 h-5 flex shrink-0 items-center justify-center ${$e ? "text-slate-500" : "text-slate-400"}`,
30962
- children: _e.icon
30962
+ children: Pe.icon
30963
30963
  }
30964
30964
  ),
30965
- /* @__PURE__ */ h("span", { className: "flex-1", children: _e.label }),
30965
+ /* @__PURE__ */ h("span", { className: "flex-1", children: Pe.label }),
30966
30966
  me && /* @__PURE__ */ h("span", { className: "w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400", children: /* @__PURE__ */ h(
30967
30967
  "svg",
30968
30968
  {
@@ -30983,17 +30983,17 @@ const hT = ({
30983
30983
  ) })
30984
30984
  ]
30985
30985
  },
30986
- _e.toolId
30986
+ Pe.toolId
30987
30987
  );
30988
30988
  }) }),
30989
- V === "channel" && /* @__PURE__ */ h(Un, { top: 128, panelRef: Ze, isLight: $e, children: ir.map((_e, ge) => {
30989
+ V === "channel" && /* @__PURE__ */ h(Un, { top: 128, panelRef: Ze, isLight: $e, children: ir.map((Pe, ge) => {
30990
30990
  const me = ce === ge;
30991
30991
  return /* @__PURE__ */ G(
30992
30992
  "button",
30993
30993
  {
30994
30994
  type: "button",
30995
30995
  onMouseDown: (Me) => {
30996
- Me.stopPropagation(), Z(ge), r(_e.toolId), j(null);
30996
+ Me.stopPropagation(), Z(ge), r(Pe.toolId), j(null);
30997
30997
  },
30998
30998
  className: `w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e ? "text-slate-700 hover:bg-slate-100" : "text-slate-200 hover:bg-[#202933]"}`,
30999
30999
  children: [
@@ -31001,10 +31001,10 @@ const hT = ({
31001
31001
  "span",
31002
31002
  {
31003
31003
  className: `w-5 h-5 flex shrink-0 items-center justify-center ${$e ? "text-slate-500" : "text-slate-400"}`,
31004
- children: _e.icon
31004
+ children: Pe.icon
31005
31005
  }
31006
31006
  ),
31007
- /* @__PURE__ */ h("span", { className: "flex-1", children: _e.label }),
31007
+ /* @__PURE__ */ h("span", { className: "flex-1", children: Pe.label }),
31008
31008
  me && /* @__PURE__ */ h("span", { className: "w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400", children: /* @__PURE__ */ h(
31009
31009
  "svg",
31010
31010
  {
@@ -31025,17 +31025,17 @@ const hT = ({
31025
31025
  ) })
31026
31026
  ]
31027
31027
  },
31028
- _e.toolId
31028
+ Pe.toolId
31029
31029
  );
31030
31030
  }) }),
31031
- V === "gann" && /* @__PURE__ */ h(Un, { top: 210, panelRef: ze, isLight: $e, children: rr.map((_e, ge) => {
31031
+ V === "gann" && /* @__PURE__ */ h(Un, { top: 210, panelRef: ze, isLight: $e, children: rr.map((Pe, ge) => {
31032
31032
  const me = le === ge;
31033
31033
  return /* @__PURE__ */ G(
31034
31034
  "button",
31035
31035
  {
31036
31036
  type: "button",
31037
31037
  onMouseDown: (Me) => {
31038
- Me.stopPropagation(), ne(ge), r(_e.toolId), j(null);
31038
+ Me.stopPropagation(), ne(ge), r(Pe.toolId), j(null);
31039
31039
  },
31040
31040
  className: `w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e ? "text-slate-700 hover:bg-slate-100" : "text-slate-200 hover:bg-[#202933]"}`,
31041
31041
  children: [
@@ -31043,10 +31043,10 @@ const hT = ({
31043
31043
  "span",
31044
31044
  {
31045
31045
  className: `w-5 h-5 flex shrink-0 items-center justify-center ${$e ? "text-slate-500" : "text-slate-400"}`,
31046
- children: _e.icon
31046
+ children: Pe.icon
31047
31047
  }
31048
31048
  ),
31049
- /* @__PURE__ */ h("span", { className: "flex-1", children: _e.label }),
31049
+ /* @__PURE__ */ h("span", { className: "flex-1", children: Pe.label }),
31050
31050
  me && /* @__PURE__ */ h("span", { className: "w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400", children: /* @__PURE__ */ h(
31051
31051
  "svg",
31052
31052
  {
@@ -31067,17 +31067,17 @@ const hT = ({
31067
31067
  ) })
31068
31068
  ]
31069
31069
  },
31070
- _e.toolId
31070
+ Pe.toolId
31071
31071
  );
31072
31072
  }) }),
31073
- V === "shape" && /* @__PURE__ */ h(Un, { top: 250, panelRef: Ce, isLight: $e, children: nr.map((_e, ge) => {
31073
+ V === "shape" && /* @__PURE__ */ h(Un, { top: 250, panelRef: Ce, isLight: $e, children: nr.map((Pe, ge) => {
31074
31074
  const me = we === ge;
31075
31075
  return /* @__PURE__ */ G(
31076
31076
  "button",
31077
31077
  {
31078
31078
  type: "button",
31079
31079
  onMouseDown: (Me) => {
31080
- Me.stopPropagation(), Te(ge), r(_e.toolId), j(null);
31080
+ Me.stopPropagation(), Te(ge), r(Pe.toolId), j(null);
31081
31081
  },
31082
31082
  className: `w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${$e ? "text-slate-700 hover:bg-slate-100" : "text-slate-200 hover:bg-[#202933]"}`,
31083
31083
  children: [
@@ -31085,10 +31085,10 @@ const hT = ({
31085
31085
  "span",
31086
31086
  {
31087
31087
  className: `w-5 h-5 flex shrink-0 items-center justify-center ${$e ? "text-slate-500" : "text-slate-400"}`,
31088
- children: _e.icon
31088
+ children: Pe.icon
31089
31089
  }
31090
31090
  ),
31091
- /* @__PURE__ */ h("span", { className: "flex-1", children: _e.label }),
31091
+ /* @__PURE__ */ h("span", { className: "flex-1", children: Pe.label }),
31092
31092
  me && /* @__PURE__ */ h("span", { className: "w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400", children: /* @__PURE__ */ h(
31093
31093
  "svg",
31094
31094
  {
@@ -31109,7 +31109,7 @@ const hT = ({
31109
31109
  ) })
31110
31110
  ]
31111
31111
  },
31112
- _e.toolId
31112
+ Pe.toolId
31113
31113
  );
31114
31114
  }) }),
31115
31115
  M && /* @__PURE__ */ G(ct, { children: [
@@ -31151,7 +31151,7 @@ const hT = ({
31151
31151
  ]
31152
31152
  }
31153
31153
  ),
31154
- /* @__PURE__ */ h("div", { className: "py-2", children: rt.map((_e) => /* @__PURE__ */ h(nt, { item: _e }, _e.key)) })
31154
+ /* @__PURE__ */ h("div", { className: "py-2", children: rt.map((Pe) => /* @__PURE__ */ h(nt, { item: Pe }, Pe.key)) })
31155
31155
  ]
31156
31156
  }
31157
31157
  )
@@ -31169,7 +31169,7 @@ const pT = ({
31169
31169
  symbolsLoading: r = !1,
31170
31170
  isOpen: n
31171
31171
  }) => {
31172
- const { theme: s } = Wt(), o = s === "light", [a, l] = Pe(""), c = e.filter(
31172
+ const { theme: s } = Wt(), o = s === "light", [a, l] = Ne(""), c = e.filter(
31173
31173
  (T) => T.symbol.toLowerCase().includes(a.toLowerCase())
31174
31174
  ), m = c.filter((T) => !T.symbol.toUpperCase().endsWith("USDT")), C = c.filter((T) => T.symbol.toUpperCase().endsWith("USDT"));
31175
31175
  return /* @__PURE__ */ G(ct, { children: [
@@ -31415,34 +31415,34 @@ const pT = ({
31415
31415
  setIsShow: l,
31416
31416
  historyOrders: c,
31417
31417
  fetchHistoryOrders: m
31418
- } = Wt(), C = i || n, T = e || s, b = c || [], v = o === "light", U = a ? "history" : "trade";
31418
+ } = Wt(), C = i || n, T = e?.length > 0 ? e : s, b = c || [], v = o === "light", U = a ? "history" : "trade";
31419
31419
  it(() => {
31420
31420
  a && m && m();
31421
31421
  }, [a, m]);
31422
- const F = "#26A69A", M = "#EF5350", N = v ? "#f8fafc" : "#12161D", W = v ? "#e2e8f0" : "#1e293b", L = v ? "#f1f5f9" : "#12161D", V = v ? "#F0F5F9" : "#2B3543", j = v ? "#f8fafc" : "#131c2e", X = v ? "#12161D" : "#fff", K = v ? "#64748b" : "#fff", ee = (T || []).filter((de) => de.status === "OPEN" || !de.closeAt), Ae = C?.balance || 0, ce = C?.equity ?? Ae, Z = C?.margin || 0, te = C?.freeMargin ?? ce - Z, se = Z > 0 ? ce / Z * 100 : 0, le = ee.reduce((de, ke) => de + (ke.livePnL ?? ke.profit ?? 0), 0), ne = (de) => {
31423
- const ke = parseFloat(de);
31424
- return Number.isFinite(ke) ? ke.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : "0.00";
31422
+ const F = "#26A69A", M = "#EF5350", N = v ? "#f8fafc" : "#12161D", W = v ? "#e2e8f0" : "#1e293b", L = v ? "#f1f5f9" : "#12161D", V = v ? "#F0F5F9" : "#2B3543", j = v ? "#f8fafc" : "#131c2e", X = v ? "#12161D" : "#fff", K = v ? "#64748b" : "#fff", ee = (T || []).filter((de) => de.status === "OPEN" || !de.closeAt), Ae = C?.balance || 0, ce = C?.equity ?? Ae, Z = C?.margin || 0, te = C?.freeMargin ?? ce - Z, se = Z > 0 ? ce / Z * 100 : 0, le = ee.reduce((de, _e) => de + (_e.livePnL ?? _e.profit ?? 0), 0), ne = (de) => {
31423
+ const _e = parseFloat(de);
31424
+ return Number.isFinite(_e) ? _e.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : "0.00";
31425
31425
  }, he = (de) => {
31426
- const ke = parseFloat(de);
31427
- return !ke || isNaN(ke) ? "—" : ke >= 1e4 ? ke.toFixed(2) : ke >= 10 ? ke.toFixed(4) : ke.toFixed(5);
31426
+ const _e = parseFloat(de);
31427
+ return !_e || isNaN(_e) ? "—" : _e >= 1e4 ? _e.toFixed(2) : _e >= 10 ? _e.toFixed(4) : _e.toFixed(5);
31428
31428
  }, pe = (de) => {
31429
- const ke = parseFloat(de);
31430
- return isNaN(ke) ? "—" : (ke >= 0 ? "+" : "") + ke.toFixed(2);
31429
+ const _e = parseFloat(de);
31430
+ return isNaN(_e) ? "—" : (_e >= 0 ? "+" : "") + _e.toFixed(2);
31431
31431
  }, we = (de) => {
31432
- const ke = parseFloat(de);
31433
- return isNaN(ke) ? "—" : ke.toFixed(2);
31432
+ const _e = parseFloat(de);
31433
+ return isNaN(_e) ? "—" : _e.toFixed(2);
31434
31434
  }, Te = (de) => {
31435
31435
  if (!de) return "—";
31436
- const ke = new Date(de);
31437
- return isNaN(ke.getTime()) ? String(de) : `${ke.toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "2-digit" })} ${ke.toTimeString().slice(0, 8)}`;
31436
+ const _e = new Date(de);
31437
+ return isNaN(_e.getTime()) ? String(de) : `${_e.toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "2-digit" })} ${_e.toTimeString().slice(0, 8)}`;
31438
31438
  }, Ue = vt(
31439
- (de, ke) => {
31440
- de.stopPropagation(), t && t(ke.id);
31439
+ (de, _e) => {
31440
+ de.stopPropagation(), t && t(_e.id, _e);
31441
31441
  },
31442
31442
  [t]
31443
31443
  ), ye = vt(
31444
- (de, ke) => {
31445
- de.stopPropagation(), A && A(ke);
31444
+ (de, _e) => {
31445
+ de.stopPropagation(), A && A(_e);
31446
31446
  },
31447
31447
  [A]
31448
31448
  ), ve = {
@@ -31499,7 +31499,7 @@ const pT = ({
31499
31499
  cursor: "pointer",
31500
31500
  transition: "color 0.15s",
31501
31501
  outline: "none"
31502
- }), Ne = {
31502
+ }), ke = {
31503
31503
  padding: "4px 8px",
31504
31504
  textAlign: "left",
31505
31505
  color: K,
@@ -31615,18 +31615,18 @@ const pT = ({
31615
31615
  ] }),
31616
31616
  U === "trade" && /* @__PURE__ */ h("div", { style: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ G("table", { style: { width: "100%", borderCollapse: "collapse", minWidth: "800px" }, children: [
31617
31617
  /* @__PURE__ */ h("thead", { children: /* @__PURE__ */ G("tr", { children: [
31618
- /* @__PURE__ */ h("th", { style: Ne, children: "Symbol" }),
31619
- /* @__PURE__ */ h("th", { style: Ne, children: "Ticket" }),
31620
- /* @__PURE__ */ h("th", { style: Ne, children: "Time" }),
31621
- /* @__PURE__ */ h("th", { style: Ne, children: "Type" }),
31622
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Volume" }),
31623
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Price" }),
31624
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "S/L" }),
31625
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "T/P" }),
31626
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Current" }),
31627
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Profit" }),
31628
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "center" }, children: "Action" }),
31629
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "center" }, children: "Close" })
31618
+ /* @__PURE__ */ h("th", { style: ke, children: "Symbol" }),
31619
+ /* @__PURE__ */ h("th", { style: ke, children: "Ticket" }),
31620
+ /* @__PURE__ */ h("th", { style: ke, children: "Time" }),
31621
+ /* @__PURE__ */ h("th", { style: ke, children: "Type" }),
31622
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Volume" }),
31623
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Price" }),
31624
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "S/L" }),
31625
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "T/P" }),
31626
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Current" }),
31627
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Profit" }),
31628
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "center" }, children: "Action" }),
31629
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "center" }, children: "Close" })
31630
31630
  ] }) }),
31631
31631
  /* @__PURE__ */ h("tbody", { children: ee.length === 0 ? /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ h(
31632
31632
  "td",
@@ -31641,7 +31641,7 @@ const pT = ({
31641
31641
  children: "No open positions"
31642
31642
  }
31643
31643
  ) }) : ee.map((de) => {
31644
- const ke = de.livePnL ?? de.profit ?? 0, Ye = ke >= 0 ? F : M;
31644
+ const _e = de.livePnL ?? de.profit ?? 0, Ye = _e >= 0 ? F : M;
31645
31645
  return /* @__PURE__ */ G(
31646
31646
  "tr",
31647
31647
  {
@@ -31715,8 +31715,7 @@ const pT = ({
31715
31715
  ...Ee,
31716
31716
  textAlign: "right",
31717
31717
  color: K
31718
- },
31719
- children: de.currentPrice ? he(de.currentPrice) : "—"
31718
+ }
31720
31719
  }
31721
31720
  ),
31722
31721
  /* @__PURE__ */ h(
@@ -31728,7 +31727,7 @@ const pT = ({
31728
31727
  fontWeight: 700,
31729
31728
  color: Ye
31730
31729
  },
31731
- children: pe(ke)
31730
+ children: pe(_e)
31732
31731
  }
31733
31732
  ),
31734
31733
  /* @__PURE__ */ h("td", { style: { ...Ee, textAlign: "center" }, children: /* @__PURE__ */ h(
@@ -31790,17 +31789,17 @@ const pT = ({
31790
31789
  ] }) }),
31791
31790
  U === "history" && /* @__PURE__ */ h("div", { style: { overflowY: "auto", flex: 1 }, children: /* @__PURE__ */ G("table", { style: { width: "100%", borderCollapse: "collapse", minWidth: "900px" }, children: [
31792
31791
  /* @__PURE__ */ h("thead", { children: /* @__PURE__ */ G("tr", { children: [
31793
- /* @__PURE__ */ h("th", { style: Ne, children: "Symbol" }),
31794
- /* @__PURE__ */ h("th", { style: Ne, children: "Ticket" }),
31795
- /* @__PURE__ */ h("th", { style: Ne, children: "Open Time" }),
31796
- /* @__PURE__ */ h("th", { style: Ne, children: "Type" }),
31797
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Volume" }),
31798
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Open Price" }),
31799
- /* @__PURE__ */ h("th", { style: Ne, children: "Close Time" }),
31800
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Close Price" }),
31801
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "S/L" }),
31802
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "T/P" }),
31803
- /* @__PURE__ */ h("th", { style: { ...Ne, textAlign: "right" }, children: "Profit" })
31792
+ /* @__PURE__ */ h("th", { style: ke, children: "Symbol" }),
31793
+ /* @__PURE__ */ h("th", { style: ke, children: "Ticket" }),
31794
+ /* @__PURE__ */ h("th", { style: ke, children: "Open Time" }),
31795
+ /* @__PURE__ */ h("th", { style: ke, children: "Type" }),
31796
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Volume" }),
31797
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Open Price" }),
31798
+ /* @__PURE__ */ h("th", { style: ke, children: "Close Time" }),
31799
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Close Price" }),
31800
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "S/L" }),
31801
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "T/P" }),
31802
+ /* @__PURE__ */ h("th", { style: { ...ke, textAlign: "right" }, children: "Profit" })
31804
31803
  ] }) }),
31805
31804
  /* @__PURE__ */ h("tbody", { children: b.length === 0 ? /* @__PURE__ */ h("tr", { children: /* @__PURE__ */ h(
31806
31805
  "td",
@@ -31815,7 +31814,7 @@ const pT = ({
31815
31814
  children: "No trade history"
31816
31815
  }
31817
31816
  ) }) : b.map((de) => {
31818
- const ke = de.profit ?? 0, Ye = ke >= 0 ? F : M;
31817
+ const _e = de.profit ?? 0, Ye = _e >= 0 ? F : M;
31819
31818
  return /* @__PURE__ */ G(
31820
31819
  "tr",
31821
31820
  {
@@ -31893,7 +31892,7 @@ const pT = ({
31893
31892
  fontWeight: 700,
31894
31893
  color: Ye
31895
31894
  },
31896
- children: pe(ke)
31895
+ children: pe(_e)
31897
31896
  }
31898
31897
  )
31899
31898
  ]