@orderly.network/trading 2.8.10-alpha.0 → 2.8.11-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var hooks = require('@orderly.network/hooks');
4
- var React11 = require('react');
4
+ var React12 = require('react');
5
5
  var reactApp = require('@orderly.network/react-app');
6
6
  var types = require('@orderly.network/types');
7
7
  var uiOrders = require('@orderly.network/ui-orders');
@@ -26,7 +26,7 @@ var markets = require('@orderly.network/markets');
26
26
 
27
27
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
28
28
 
29
- var React11__default = /*#__PURE__*/_interopDefault(React11);
29
+ var React12__default = /*#__PURE__*/_interopDefault(React12);
30
30
  var Split__default = /*#__PURE__*/_interopDefault(Split);
31
31
 
32
32
  var __defProp = Object.defineProperty;
@@ -75,7 +75,7 @@ var init_usePositionsCount = __esm({
75
75
  exports.usePositionsCount = (symbol) => {
76
76
  const { showAllSymbol } = exports.useTradingLocalStorage();
77
77
  const [data] = hooks.usePositionStream(showAllSymbol ? void 0 : symbol);
78
- const count = React11.useMemo(() => {
78
+ const count = React12.useMemo(() => {
79
79
  return data.rows?.length;
80
80
  }, [data.rows?.length]);
81
81
  const positionCount = reactApp.useDataTap(count) ?? 0;
@@ -140,9 +140,9 @@ var init_hooks = __esm({
140
140
  exports.TradingPageContext = void 0; exports.useTradingPageContext = void 0;
141
141
  var init_tradingPageContext = __esm({
142
142
  "src/provider/tradingPageContext.tsx"() {
143
- exports.TradingPageContext = React11.createContext({});
143
+ exports.TradingPageContext = React12.createContext({});
144
144
  exports.useTradingPageContext = () => {
145
- return React11.useContext(exports.TradingPageContext);
145
+ return React12.useContext(exports.TradingPageContext);
146
146
  };
147
147
  }
148
148
  });
@@ -184,10 +184,10 @@ var Setting, UnPnlPriceBasisCheckBox, DecimalPrecisionCheckbox, RadioButton, Sel
184
184
  var init_setting_ui = __esm({
185
185
  "src/components/desktop/dataList/setting/setting.ui.tsx"() {
186
186
  Setting = (props) => {
187
- const [open, setOpen] = React11.useState(false);
187
+ const [open, setOpen] = React12.useState(false);
188
188
  const { t } = i18n.useTranslation();
189
189
  const { isMobile } = ui.useScreen();
190
- const SettingsContent = React11.useMemo(() => {
190
+ const SettingsContent = React12.useMemo(() => {
191
191
  return () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
192
192
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-col oui-text-sm", children: [
193
193
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -695,19 +695,19 @@ var LazySettingWidget, LazyPositionHeaderWidget, PositionsView, LiquidationTab;
695
695
  var init_dataList_ui = __esm({
696
696
  "src/components/desktop/dataList/dataList.ui.tsx"() {
697
697
  init_dataList_script();
698
- LazySettingWidget = React11__default.default.lazy(
698
+ LazySettingWidget = React12__default.default.lazy(
699
699
  () => Promise.resolve().then(() => (init_setting(), setting_exports)).then((mod) => {
700
700
  return { default: mod.SettingWidget };
701
701
  })
702
702
  );
703
- LazyPositionHeaderWidget = React11__default.default.lazy(
703
+ LazyPositionHeaderWidget = React12__default.default.lazy(
704
704
  () => Promise.resolve().then(() => (init_positionHeader(), positionHeader_exports)).then((mod) => {
705
705
  return { default: mod.PositionHeaderWidget };
706
706
  })
707
707
  );
708
708
  PositionsView = (props) => {
709
709
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", width: "100%", height: "100%", children: [
710
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
710
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
711
711
  LazyPositionHeaderWidget,
712
712
  {
713
713
  setPnlNotionalDecimalPrecision: props.setPnlNotionalDecimalPrecision,
@@ -890,7 +890,7 @@ var init_dataList_ui = __esm({
890
890
  {
891
891
  defaultValue: current || "Positions" /* positions */,
892
892
  variant: "contained",
893
- trailing: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
893
+ trailing: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
894
894
  LazySettingWidget,
895
895
  {
896
896
  pnlNotionalDecimalPrecision,
@@ -909,7 +909,7 @@ var init_dataList_ui = __esm({
909
909
  },
910
910
  children: tabPanelItems.map((item) => {
911
911
  const { content, ...rest } = item;
912
- return /* @__PURE__ */ React11.createElement(ui.TabPanel, { ...rest, key: `item-${rest.value}` }, content);
912
+ return /* @__PURE__ */ React12.createElement(ui.TabPanel, { ...rest, key: `item-${rest.value}` }, content);
913
913
  })
914
914
  }
915
915
  );
@@ -1141,8 +1141,8 @@ function useFaucetScript() {
1141
1141
  const [getTestUSDC, { isMutating }] = hooks.useMutation(
1142
1142
  `${operatorUrl}/v1/faucet/usdc`
1143
1143
  );
1144
- const [loading, setLoading] = React11.useState(false);
1145
- const showFaucet = React11.useMemo(() => {
1144
+ const [loading, setLoading] = React12.useState(false);
1145
+ const showFaucet = React12.useMemo(() => {
1146
1146
  if (!connectedChain || !connectedChain.id) {
1147
1147
  return false;
1148
1148
  }
@@ -1214,7 +1214,7 @@ var init_assetView_ui = __esm({
1214
1214
  const { state } = hooks.useAccount();
1215
1215
  const { wrongNetwork, disabledConnect } = reactApp.useAppContext();
1216
1216
  const { t } = i18n.useTranslation();
1217
- return React11.useMemo(() => {
1217
+ return React12.useMemo(() => {
1218
1218
  const statusText = {
1219
1219
  wrongNetwork: {
1220
1220
  title: t("connector.wrongNetwork"),
@@ -1388,6 +1388,8 @@ var init_assetView_ui = __esm({
1388
1388
  freeCollateral,
1389
1389
  marginRatioVal,
1390
1390
  renderMMR,
1391
+ maintenanceMargin,
1392
+ currentLeverage,
1391
1393
  isConnected,
1392
1394
  currentLtv
1393
1395
  } = props;
@@ -1395,9 +1397,9 @@ var init_assetView_ui = __esm({
1395
1397
  "orderly_entry_asset_list_open",
1396
1398
  false
1397
1399
  );
1398
- const [open, setOpen] = React11.useState(optionsOpen);
1400
+ const [open, setOpen] = React12.useState(optionsOpen);
1399
1401
  const { t } = i18n.useTranslation();
1400
- const toggleOpen = React11.useCallback(() => {
1402
+ const toggleOpen = React12.useCallback(() => {
1401
1403
  setOpen((prevOpen) => !prevOpen);
1402
1404
  setTimeout(() => {
1403
1405
  setOptionsOpen(!open);
@@ -1435,7 +1437,7 @@ var init_assetView_ui = __esm({
1435
1437
  "oui-select-none oui-space-y-1.5 oui-overflow-hidden",
1436
1438
  "oui-transition-[max-height] oui-duration-150",
1437
1439
  "group-hover:oui-will-change-[max-height]",
1438
- open ? showLTV ? "oui-max-h-[94px]" : "oui-max-h-[69px]" : "oui-max-h-0"
1440
+ open ? showLTV ? "oui-max-h-[144px]" : "oui-max-h-[119px]" : "oui-max-h-0"
1439
1441
  ),
1440
1442
  children: [
1441
1443
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1476,6 +1478,28 @@ var init_assetView_ui = __esm({
1476
1478
  placeholder: "--%"
1477
1479
  }
1478
1480
  ),
1481
+ /* @__PURE__ */ jsxRuntime.jsx(
1482
+ AssetDetail,
1483
+ {
1484
+ label: t("trading.asset.maintenanceMargin"),
1485
+ description: t("trading.asset.maintenanceMargin.tooltip"),
1486
+ formula: t("trading.asset.maintenanceMargin.formula"),
1487
+ visible,
1488
+ value: maintenanceMargin,
1489
+ unit: "USDC"
1490
+ }
1491
+ ),
1492
+ /* @__PURE__ */ jsxRuntime.jsx(
1493
+ AssetDetail,
1494
+ {
1495
+ label: t("trading.asset.currentLeverage"),
1496
+ description: t("trading.asset.currentLeverage.tooltip"),
1497
+ formula: t("trading.asset.currentLeverage.formula"),
1498
+ visible,
1499
+ value: currentLeverage,
1500
+ unit: "x"
1501
+ }
1502
+ ),
1479
1503
  showLTV && /* @__PURE__ */ jsxRuntime.jsx(LTVDetail, { visible, value: currentLtv })
1480
1504
  ]
1481
1505
  }
@@ -1494,6 +1518,8 @@ var init_assetView_ui = __esm({
1494
1518
  freeCollateral,
1495
1519
  marginRatioVal,
1496
1520
  renderMMR,
1521
+ maintenanceMargin,
1522
+ currentLeverage,
1497
1523
  isConnected,
1498
1524
  isMainAccount,
1499
1525
  hasSubAccount,
@@ -1615,6 +1641,8 @@ var init_assetView_ui = __esm({
1615
1641
  freeCollateral,
1616
1642
  marginRatioVal,
1617
1643
  renderMMR,
1644
+ maintenanceMargin,
1645
+ currentLeverage,
1618
1646
  isConnected,
1619
1647
  currentLtv
1620
1648
  }
@@ -1666,16 +1694,16 @@ var init_assetView_script = __esm({
1666
1694
  const { freeCollateral } = hooks.useCollateral({
1667
1695
  dp: 2
1668
1696
  });
1669
- const { marginRatio, mmr } = hooks.useMarginRatio();
1697
+ const { marginRatio, mmr, maintenanceMargin, currentLeverage } = hooks.useMarginRatio();
1670
1698
  const isConnected = state.status >= types.AccountStatusEnum.Connected;
1671
1699
  const [{ aggregated }, positionsInfo] = hooks.usePositionStream();
1672
- const marginRatioVal = React11.useMemo(() => {
1700
+ const marginRatioVal = React12.useMemo(() => {
1673
1701
  return Math.min(
1674
1702
  10,
1675
1703
  aggregated.notional === 0 ? positionsInfo["margin_ratio"](10) : marginRatio
1676
1704
  );
1677
1705
  }, [marginRatio, aggregated]);
1678
- const openDepositAndWithdraw = React11.useCallback(
1706
+ const openDepositAndWithdraw = React12.useCallback(
1679
1707
  (viewName) => {
1680
1708
  return ui.modal.show(uiTransfer.DepositAndWithdrawWithDialogId, {
1681
1709
  activeTab: viewName
@@ -1683,16 +1711,16 @@ var init_assetView_script = __esm({
1683
1711
  },
1684
1712
  []
1685
1713
  );
1686
- const onDeposit = React11.useCallback(async () => {
1714
+ const onDeposit = React12.useCallback(async () => {
1687
1715
  return openDepositAndWithdraw("deposit");
1688
1716
  }, []);
1689
- const onWithdraw = React11.useCallback(async () => {
1717
+ const onWithdraw = React12.useCallback(async () => {
1690
1718
  return openDepositAndWithdraw("withdraw");
1691
1719
  }, []);
1692
- const onTransfer = React11.useCallback(async () => {
1720
+ const onTransfer = React12.useCallback(async () => {
1693
1721
  return ui.modal.show(uiTransfer.TransferDialogId);
1694
1722
  }, []);
1695
- const onSettle = React11.useCallback(async () => {
1723
+ const onSettle = React12.useCallback(async () => {
1696
1724
  return account.settle().catch((e) => {
1697
1725
  if (e.code === -1104) {
1698
1726
  ui.toast.error(t("settle.settlement.error"));
@@ -1715,7 +1743,7 @@ var init_assetView_script = __esm({
1715
1743
  "orderly_assets_visible",
1716
1744
  true
1717
1745
  );
1718
- const toggleVisible = React11.useCallback(() => {
1746
+ const toggleVisible = React12.useCallback(() => {
1719
1747
  setVisible((visible2) => {
1720
1748
  return !visible2;
1721
1749
  });
@@ -1724,6 +1752,8 @@ var init_assetView_script = __esm({
1724
1752
  const _freeCollateral = reactApp.useDataTap(freeCollateral) ?? void 0;
1725
1753
  const _marginRatioVal = reactApp.useDataTap(marginRatioVal) ?? void 0;
1726
1754
  const _mmr = reactApp.useDataTap(mmr) ?? void 0;
1755
+ const _maintenanceMargin = reactApp.useDataTap(maintenanceMargin) ?? void 0;
1756
+ const _currentLeverage = reactApp.useDataTap(currentLeverage) ?? void 0;
1727
1757
  const _totalValue = reactApp.useDataTap(totalValue) ?? void 0;
1728
1758
  return {
1729
1759
  onDeposit,
@@ -1738,6 +1768,8 @@ var init_assetView_script = __esm({
1738
1768
  freeCollateral: _freeCollateral,
1739
1769
  marginRatioVal: _marginRatioVal,
1740
1770
  renderMMR: _mmr,
1771
+ maintenanceMargin: _maintenanceMargin,
1772
+ currentLeverage: _currentLeverage,
1741
1773
  isConnected,
1742
1774
  isMainAccount,
1743
1775
  hasSubAccount: !!state.subAccounts?.length,
@@ -1773,16 +1805,16 @@ var init_assetView = __esm({
1773
1805
  var OrderBookContext, useOrderBookContext, ORDERBOOK_COIN_TYPE_KEY, ORDERBOOK_MOBILE_COIN_TYPE_KEY, OrderBookProvider;
1774
1806
  var init_orderContext = __esm({
1775
1807
  "src/components/base/orderBook/orderContext.tsx"() {
1776
- OrderBookContext = React11.createContext({
1808
+ OrderBookContext = React12.createContext({
1777
1809
  cellHeight: 22
1778
1810
  });
1779
- useOrderBookContext = () => React11.useContext(OrderBookContext);
1811
+ useOrderBookContext = () => React12.useContext(OrderBookContext);
1780
1812
  ORDERBOOK_COIN_TYPE_KEY = "orderbook_coin_type";
1781
1813
  ORDERBOOK_MOBILE_COIN_TYPE_KEY = "orderbook_mobile_coin_unit";
1782
1814
  OrderBookProvider = (props) => {
1783
- const [mode, setMode] = React11.useState("quantity");
1784
- const [totalMode, setTotalMode] = React11.useState("quantity");
1785
- const memoizedValue = React11__default.default.useMemo(() => {
1815
+ const [mode, setMode] = React12.useState("quantity");
1816
+ const [totalMode, setTotalMode] = React12.useState("quantity");
1817
+ const memoizedValue = React12__default.default.useMemo(() => {
1786
1818
  return {
1787
1819
  cellHeight: props.cellHeight,
1788
1820
  onItemClick: props.onItemClick,
@@ -1793,7 +1825,9 @@ var init_orderContext = __esm({
1793
1825
  onTotalModeChange: setTotalMode,
1794
1826
  showTotal: props.showTotal || false,
1795
1827
  pendingOrders: props.pendingOrders,
1796
- symbolInfo: props.symbolInfo
1828
+ symbolInfo: props.symbolInfo,
1829
+ showBuySellRatio: props.showBuySellRatio ?? true,
1830
+ onShowBuySellRatioChange: props.onShowBuySellRatioChange
1797
1831
  };
1798
1832
  }, [
1799
1833
  mode,
@@ -1803,6 +1837,8 @@ var init_orderContext = __esm({
1803
1837
  props.pendingOrders,
1804
1838
  props.showTotal,
1805
1839
  props.symbolInfo,
1840
+ props.showBuySellRatio,
1841
+ props.onShowBuySellRatioChange,
1806
1842
  totalMode
1807
1843
  ]);
1808
1844
  return /* @__PURE__ */ jsxRuntime.jsx(OrderBookContext.Provider, { value: memoizedValue, children: props.children });
@@ -1820,7 +1856,7 @@ var init_cellBar = __esm({
1820
1856
  "src/components/base/orderBook/cellBar.tsx"() {
1821
1857
  CellBar = (props) => {
1822
1858
  const { direction = 1 /* RIGHT_TO_LEFT */ } = props;
1823
- const transform = React11.useMemo(() => {
1859
+ const transform = React12.useMemo(() => {
1824
1860
  const x = Math.max(props.width, 0);
1825
1861
  if (direction === 0 /* LEFT_TO_RIGHT */) {
1826
1862
  return { transform: `translateX(${x}%)` };
@@ -1863,11 +1899,11 @@ var init_cell_desktop = __esm({
1863
1899
  const { base_dp, quote_dp } = symbolInfo;
1864
1900
  const [coinType] = hooks.useLocalStorage(ORDERBOOK_COIN_TYPE_KEY, base);
1865
1901
  const width = Number.isNaN(price) ? 0 : accumulated / count * 100;
1866
- const dp = React11.useMemo(() => {
1902
+ const dp = React12.useMemo(() => {
1867
1903
  return utils.getPrecisionByNumber(depth || `${quote_dp}`);
1868
1904
  }, [depth, quote_dp]);
1869
1905
  const totalAmount = Number.isNaN(accumulated) ? "-" : accumulatedAmount?.toString();
1870
- const isPendingOrder = React11.useMemo(() => {
1906
+ const isPendingOrder = React12.useMemo(() => {
1871
1907
  const priceStr = ui.parseNumber(price, { dp, padding: true });
1872
1908
  return pendingOrders.some(
1873
1909
  (item) => priceStr === ui.parseNumber(item, { dp, padding: true })
@@ -1996,7 +2032,7 @@ var init_listBox_desktop = __esm({
1996
2032
  DesktopListBox = (props) => {
1997
2033
  const { data, type, countQty } = props;
1998
2034
  const { symbolInfo, depth } = useOrderBookContext();
1999
- const findMaxItem = React11.useCallback(() => {
2035
+ const findMaxItem = React12.useCallback(() => {
2000
2036
  if (!data?.length) {
2001
2037
  return null;
2002
2038
  }
@@ -2017,16 +2053,16 @@ var init_listBox_desktop = __esm({
2017
2053
  return null;
2018
2054
  }
2019
2055
  }, [data, type]);
2020
- const priceDp = React11.useMemo(() => {
2056
+ const priceDp = React12.useMemo(() => {
2021
2057
  if (depth?.toString().includes(".")) {
2022
2058
  return depth.toString().split(".")[1].length;
2023
2059
  }
2024
2060
  return 0;
2025
2061
  }, [depth]);
2026
- const maxQty = React11.useMemo(() => {
2062
+ const maxQty = React12.useMemo(() => {
2027
2063
  return data.reduce((a, b) => Math.max(a, b[1]), 0);
2028
2064
  }, [data]);
2029
- const [hoverIndex, setHoverIndex] = React11.useState(-1);
2065
+ const [hoverIndex, setHoverIndex] = React12.useState(-1);
2030
2066
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-order-book-list oui-flex oui-flex-col oui-gap-px", children: data.map((item, index) => {
2031
2067
  return /* @__PURE__ */ jsxRuntime.jsx(
2032
2068
  Tip,
@@ -2062,8 +2098,8 @@ var init_listBox_desktop = __esm({
2062
2098
  const { base, quote, base_dp: baseDp, quote_dp: quoteDp } = symbolInfo;
2063
2099
  const { t } = i18n.useTranslation();
2064
2100
  const isHover = hoverIndex !== -1 ? type === "ask" /* ASK */ ? index >= hoverIndex : index <= hoverIndex : false;
2065
- const [open, setOpen] = React11.useState(false);
2066
- const hintInfo = React11.useMemo(() => {
2101
+ const [open, setOpen] = React12.useState(false);
2102
+ const hintInfo = React12.useMemo(() => {
2067
2103
  const info = calcHintInfo(item);
2068
2104
  return info.avgPrice === 0 ? calcHintInfo(findMaxItem()) : info;
2069
2105
  }, [item, findMaxItem]);
@@ -2161,7 +2197,7 @@ var init_asks_desktop = __esm({
2161
2197
  init_listBox_desktop();
2162
2198
  DesktopAsks = (props) => {
2163
2199
  const { data } = props;
2164
- const countQty = React11.useMemo(() => {
2200
+ const countQty = React12.useMemo(() => {
2165
2201
  let max = Number.NaN;
2166
2202
  const len = data.length;
2167
2203
  let index = 0;
@@ -2189,7 +2225,7 @@ var init_bids_desktop = __esm({
2189
2225
  init_listBox_desktop();
2190
2226
  DesktopBids = (props) => {
2191
2227
  const { data } = props;
2192
- const countQty = React11.useMemo(() => {
2228
+ const countQty = React12.useMemo(() => {
2193
2229
  let max = Number.NaN;
2194
2230
  let index = data.length - 1;
2195
2231
  while (Number.isNaN(max) && index > 0) {
@@ -2209,11 +2245,70 @@ var init_bids_desktop = __esm({
2209
2245
  };
2210
2246
  }
2211
2247
  });
2248
+ var BuySellRatioSettings, MoreIcon;
2249
+ var init_buySellRatio = __esm({
2250
+ "src/components/desktop/orderBook/buySellRatio.tsx"() {
2251
+ BuySellRatioSettings = ({
2252
+ showBuySellRatio,
2253
+ setShowBuySellRatio
2254
+ }) => {
2255
+ const { t } = i18n.useTranslation();
2256
+ const [settingsOpen, setSettingsOpen] = React12.useState(false);
2257
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.PopoverRoot, { open: settingsOpen, onOpenChange: setSettingsOpen, children: [
2258
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2259
+ "button",
2260
+ {
2261
+ className: "oui-cursor-pointer oui-text-base-contrast-54 hover:oui-text-base-contrast oui-transition-colors",
2262
+ "aria-label": t("trading.orderBook.settings"),
2263
+ children: /* @__PURE__ */ jsxRuntime.jsx(MoreIcon, {})
2264
+ }
2265
+ ) }),
2266
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverContent, { align: "end", sideOffset: 8, className: "oui-w-[200px] ", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { itemAlign: "center", gap: 2, children: [
2267
+ /* @__PURE__ */ jsxRuntime.jsx(
2268
+ ui.Checkbox,
2269
+ {
2270
+ id: "show-buy-sell-ratio",
2271
+ checked: showBuySellRatio,
2272
+ onCheckedChange: (checked) => {
2273
+ setShowBuySellRatio?.(checked === true);
2274
+ setSettingsOpen(false);
2275
+ }
2276
+ }
2277
+ ),
2278
+ /* @__PURE__ */ jsxRuntime.jsx(
2279
+ "label",
2280
+ {
2281
+ htmlFor: "show-buy-sell-ratio",
2282
+ className: "oui-cursor-pointer oui-text-xs oui-text-base-contrast-54",
2283
+ children: t("trading.orderBook.showBuySellRatio")
2284
+ }
2285
+ )
2286
+ ] }) })
2287
+ ] });
2288
+ };
2289
+ MoreIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
2290
+ "svg",
2291
+ {
2292
+ xmlns: "http://www.w3.org/2000/svg",
2293
+ width: "16",
2294
+ height: "16",
2295
+ viewBox: "0 0 16 16",
2296
+ fill: "currentColor",
2297
+ ...props,
2298
+ children: [
2299
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.00521 6.66797C8.74161 6.66797 9.33854 7.26464 9.33854 8.0013C9.33854 8.73797 8.74161 9.33464 8.00521 9.33464C7.26881 9.33464 6.67188 8.73797 6.67188 8.0013C6.67188 7.26464 7.26881 6.66797 8.00521 6.66797Z" }),
2300
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.33333 6.66797C4.06973 6.66797 4.66667 7.26464 4.66667 8.0013C4.66667 8.73797 4.06973 9.33464 3.33333 9.33464C2.59693 9.33464 2 8.73797 2 8.0013C2 7.26464 2.59693 6.66797 3.33333 6.66797Z" }),
2301
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.6666 6.66797C13.403 6.66797 14 7.26464 14 8.0013C14 8.73797 13.403 9.33464 12.6666 9.33464C11.9302 9.33464 11.3333 8.73797 11.3333 8.0013C11.3333 7.26464 11.9302 6.66797 12.6666 6.66797Z" })
2302
+ ]
2303
+ }
2304
+ );
2305
+ }
2306
+ });
2212
2307
  var DesktopDepthSelect;
2213
2308
  var init_depthSelect_desktop = __esm({
2214
2309
  "src/components/desktop/orderBook/depthSelect.desktop.tsx"() {
2215
2310
  DesktopDepthSelect = (props) => {
2216
- const options = React11.useMemo(() => {
2311
+ const options = React12.useMemo(() => {
2217
2312
  return props.depths.map((d) => ({
2218
2313
  value: d,
2219
2314
  label: `${d}`
@@ -2244,7 +2339,7 @@ var init_header_desktop = __esm({
2244
2339
  ORDERBOOK_COIN_TYPE_KEY,
2245
2340
  base
2246
2341
  );
2247
- const optimizedItem = React11.useMemo(() => {
2342
+ const optimizedItem = React12.useMemo(() => {
2248
2343
  return utils.optimizeSymbolDisplay(item);
2249
2344
  }, [item]);
2250
2345
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2289,13 +2384,13 @@ var init_header_desktop = __esm({
2289
2384
  const { base, quote = "USDC" } = props;
2290
2385
  const { showTotal } = useOrderBookContext();
2291
2386
  const { t } = i18n.useTranslation();
2292
- const [popoverOpen, setOpen] = React11__default.default.useState(false);
2387
+ const [popoverOpen, setOpen] = React12__default.default.useState(false);
2293
2388
  const [coinType] = hooks.useLocalStorage(ORDERBOOK_COIN_TYPE_KEY, base);
2294
2389
  const TriggerIcon = popoverOpen ? ui.CaretUpIcon : ui.CaretDownIcon;
2295
- const optimizedBase = React11.useMemo(() => {
2390
+ const optimizedBase = React12.useMemo(() => {
2296
2391
  return utils.optimizeSymbolDisplay(base);
2297
2392
  }, [base]);
2298
- const optimizedCoinType = React11.useMemo(() => {
2393
+ const optimizedCoinType = React12.useMemo(() => {
2299
2394
  return utils.optimizeSymbolDisplay(coinType);
2300
2395
  }, [coinType]);
2301
2396
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { pl: 3, justify: "between", className: "oui-py-[6px]", children: [
@@ -2473,7 +2568,7 @@ var init_markPrice = __esm({
2473
2568
  };
2474
2569
  MobileLayout2 = (props) => {
2475
2570
  const { quote_dp, className, iconSize = 18 } = props;
2476
- const [open, setOpen] = React11.useState(false);
2571
+ const [open, setOpen] = React12.useState(false);
2477
2572
  const { t } = i18n.useTranslation();
2478
2573
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2479
2574
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2586,7 +2681,7 @@ var init_markPrice_desktop = __esm({
2586
2681
  Spread = (props) => {
2587
2682
  const { asks, bids } = props;
2588
2683
  const { t } = i18n.useTranslation();
2589
- const spread = React11.useMemo(() => {
2684
+ const spread = React12.useMemo(() => {
2590
2685
  if (bids.length === 0 && asks.length === 0) {
2591
2686
  return 0;
2592
2687
  }
@@ -2621,26 +2716,39 @@ var init_markPrice_desktop = __esm({
2621
2716
  var DesktopOrderBook;
2622
2717
  var init_index_desktop = __esm({
2623
2718
  "src/components/desktop/orderBook/index.desktop.tsx"() {
2719
+ init_orderBook2();
2624
2720
  init_orderContext();
2625
2721
  init_asks_desktop();
2626
2722
  init_bids_desktop();
2723
+ init_buySellRatio();
2627
2724
  init_depthSelect_desktop();
2628
2725
  init_header_desktop();
2629
2726
  init_markPrice_desktop();
2630
2727
  DesktopOrderBook = (props) => {
2631
- const { lastPrice, markPrice, quote, base, isLoading, onDepthChange } = props;
2632
- const divRef = React11.useRef(null);
2633
- const [showTotal, setShowTotal] = React11.useState(false);
2728
+ const {
2729
+ lastPrice,
2730
+ markPrice,
2731
+ quote,
2732
+ base,
2733
+ isLoading,
2734
+ onDepthChange,
2735
+ showBuySellRatio = true,
2736
+ setShowBuySellRatio,
2737
+ buySellRatio
2738
+ } = props;
2739
+ const { t } = i18n.useTranslation();
2740
+ const divRef = React12.useRef(null);
2741
+ const [showTotal, setShowTotal] = React12.useState(false);
2634
2742
  const [coinType, setCoinType] = hooks.useLocalStorage(
2635
2743
  ORDERBOOK_COIN_TYPE_KEY,
2636
2744
  base
2637
2745
  );
2638
- React11.useEffect(() => {
2746
+ React12.useEffect(() => {
2639
2747
  if (coinType !== quote && base) {
2640
2748
  setCoinType(base);
2641
2749
  }
2642
2750
  }, [base, quote]);
2643
- React11.useEffect(() => {
2751
+ React12.useEffect(() => {
2644
2752
  const resizeObserver = new ResizeObserver((entries) => {
2645
2753
  for (const entry of entries) {
2646
2754
  const { inlineSize: width } = entry.borderBoxSize[0];
@@ -2666,23 +2774,37 @@ var init_index_desktop = __esm({
2666
2774
  showTotal,
2667
2775
  pendingOrders: props.pendingOrders || types.EMPTY_LIST,
2668
2776
  symbolInfo: props.symbolInfo,
2777
+ showBuySellRatio,
2778
+ onShowBuySellRatioChange: setShowBuySellRatio,
2669
2779
  children: /* @__PURE__ */ jsxRuntime.jsxs(
2670
2780
  ui.Grid,
2671
2781
  {
2672
2782
  cols: 1,
2673
- rows: 5,
2783
+ rows: showBuySellRatio ? 6 : 5,
2674
2784
  id: "oui-orderbook-desktop",
2675
2785
  ref: divRef,
2676
- className: "oui-relative oui-size-full oui-grid-rows-[auto,auto,1fr,auto,1fr]",
2786
+ className: ui.cn(
2787
+ "oui-relative oui-size-full",
2788
+ showBuySellRatio ? "oui-grid-rows-[auto,auto,1fr,auto,1fr,auto]" : "oui-grid-rows-[auto,auto,1fr,auto,1fr]"
2789
+ ),
2677
2790
  children: [
2678
- /* @__PURE__ */ jsxRuntime.jsx(
2679
- DesktopDepthSelect,
2680
- {
2681
- depths: props.depths,
2682
- value: props.activeDepth,
2683
- onChange: onDepthChange
2684
- }
2685
- ),
2791
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", itemAlign: "center", className: "oui-pr-3", children: [
2792
+ /* @__PURE__ */ jsxRuntime.jsx(
2793
+ DesktopDepthSelect,
2794
+ {
2795
+ depths: props.depths,
2796
+ value: props.activeDepth,
2797
+ onChange: onDepthChange
2798
+ }
2799
+ ),
2800
+ /* @__PURE__ */ jsxRuntime.jsx(
2801
+ BuySellRatioSettings,
2802
+ {
2803
+ showBuySellRatio,
2804
+ setShowBuySellRatio
2805
+ }
2806
+ )
2807
+ ] }),
2686
2808
  /* @__PURE__ */ jsxRuntime.jsx(DesktopHeader, { quote, base }),
2687
2809
  /* @__PURE__ */ jsxRuntime.jsx(DesktopAsks, { data: [...props.asks] }),
2688
2810
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2696,6 +2818,13 @@ var init_index_desktop = __esm({
2696
2818
  }
2697
2819
  ),
2698
2820
  /* @__PURE__ */ jsxRuntime.jsx(DesktopBids, { data: [...props.bids] }),
2821
+ showBuySellRatio && /* @__PURE__ */ jsxRuntime.jsx(
2822
+ exports.BuySellRatioBar,
2823
+ {
2824
+ ratio: buySellRatio || null,
2825
+ className: "oui-text-2xs oui-px-3 oui-h-[38px]"
2826
+ }
2827
+ ),
2699
2828
  isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-bg-bg-8/70 oui-absolute oui-inset-0 oui-z-10 oui-flex oui-items-center oui-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) })
2700
2829
  ]
2701
2830
  }
@@ -2741,49 +2870,48 @@ var init_fundingRateModal_script = __esm({
2741
2870
  const { last_funding_rate, est_funding_rate } = hooks.useFundingRateBySymbol(options.symbol) ?? {};
2742
2871
  const [{ aggregated, rows }] = hooks.usePositionStream(options.symbol);
2743
2872
  const { notional } = aggregated ?? {};
2744
- const fundingPeriod = React11.useMemo(() => {
2873
+ const fundingPeriod = React12.useMemo(() => {
2745
2874
  if (!data || isLoading) {
2746
2875
  return "-";
2747
2876
  }
2748
2877
  return `${data.funding_period}h`;
2749
2878
  }, [data, isLoading]);
2750
- const capFunding = React11.useMemo(() => {
2879
+ const capFunding = React12.useMemo(() => {
2751
2880
  if (!data || isLoading) {
2752
2881
  return "-";
2753
2882
  }
2754
2883
  return `${new utils.Decimal(data.cap_funding).mul(100).toNumber()}%`;
2755
2884
  }, [data, isLoading]);
2756
- const floorFunding = React11.useMemo(() => {
2885
+ const floorFunding = React12.useMemo(() => {
2757
2886
  if (!data || isLoading) {
2758
2887
  return "-";
2759
2888
  }
2760
2889
  return `${new utils.Decimal(data.floor_funding).mul(100).toNumber()}%`;
2761
2890
  }, [data, isLoading]);
2762
- const lastFundingRate = React11.useMemo(() => {
2891
+ const lastFundingRate = React12.useMemo(() => {
2763
2892
  if (!last_funding_rate) {
2764
2893
  return void 0;
2765
2894
  }
2766
2895
  return `${new utils.Decimal(last_funding_rate).mul(100).toNumber()}%`;
2767
2896
  }, [last_funding_rate]);
2768
- const estFundingRate = React11.useMemo(() => {
2897
+ const estFundingRate = React12.useMemo(() => {
2769
2898
  if (!est_funding_rate) {
2770
2899
  return void 0;
2771
2900
  }
2772
2901
  return `${new utils.Decimal(est_funding_rate).mul(100).toNumber()}%`;
2773
2902
  }, [est_funding_rate]);
2774
- const estFundingFee = React11.useMemo(() => {
2903
+ const estFundingFee = React12.useMemo(() => {
2775
2904
  if (!est_funding_rate || !notional || rows.length === 0) {
2776
2905
  return "--";
2777
2906
  }
2778
2907
  return `${new utils.Decimal(est_funding_rate).mul(notional).todp(4).toNumber()}`;
2779
2908
  }, [est_funding_rate, notional, rows]);
2780
2909
  const calculateAnnualizedRate = (rate, intervalHours) => {
2781
- if (!rate || !intervalHours)
2782
- return void 0;
2910
+ if (!rate || !intervalHours) return void 0;
2783
2911
  const annualizedRate = new utils.Decimal(rate).mul(24).div(intervalHours).mul(365);
2784
2912
  return annualizedRate.todp(2, utils.Decimal.ROUND_DOWN).toNumber();
2785
2913
  };
2786
- const lastFundingRateAnnualized = React11.useMemo(() => {
2914
+ const lastFundingRateAnnualized = React12.useMemo(() => {
2787
2915
  if (!last_funding_rate || !data?.funding_period) {
2788
2916
  return void 0;
2789
2917
  }
@@ -2791,7 +2919,7 @@ var init_fundingRateModal_script = __esm({
2791
2919
  const annualized = calculateAnnualizedRate(rate, data.funding_period);
2792
2920
  return annualized ? `${annualized}%` : void 0;
2793
2921
  }, [last_funding_rate, data?.funding_period]);
2794
- const estFundingRateAnnualized = React11.useMemo(() => {
2922
+ const estFundingRateAnnualized = React12.useMemo(() => {
2795
2923
  if (!est_funding_rate || !data?.funding_period) {
2796
2924
  return void 0;
2797
2925
  }
@@ -2902,7 +3030,7 @@ var init_fundingRate_script = __esm({
2902
3030
  init_fundingRateModal_widget();
2903
3031
  exports.useFundingRateScript = (symbol) => {
2904
3032
  const data = hooks.useFundingRate(symbol);
2905
- const onClick = React11.useCallback(() => {
3033
+ const onClick = React12.useCallback(() => {
2906
3034
  ui.modal.show(exports.FundingRateSheetId, { symbol });
2907
3035
  }, [symbol]);
2908
3036
  return {
@@ -2941,14 +3069,14 @@ var init_cell = __esm({
2941
3069
  OrderBookCell = (props) => {
2942
3070
  const { accumulated, count, quantity, price, type, accumulatedAmount } = props;
2943
3071
  const width = accumulated / count * 100;
2944
- const { cellHeight, onItemClick, depth, symbolInfo } = React11.useContext(OrderBookContext);
3072
+ const { cellHeight, onItemClick, depth, symbolInfo } = React12.useContext(OrderBookContext);
2945
3073
  const { base_dp, quote_dp, base, quote } = symbolInfo;
2946
3074
  const [coinUnit, setCoinUnit] = hooks.useLocalStorage(
2947
3075
  ORDERBOOK_MOBILE_COIN_TYPE_KEY,
2948
3076
  "qty"
2949
3077
  );
2950
3078
  const totalAmount = Number.isNaN(accumulated) ? "-" : accumulatedAmount?.toString();
2951
- const dp = React11.useMemo(() => {
3079
+ const dp = React12.useMemo(() => {
2952
3080
  return utils.getPrecisionByNumber(depth || `${quote_dp}`);
2953
3081
  }, [depth, quote_dp]);
2954
3082
  const renderCell = () => {
@@ -3035,7 +3163,7 @@ var init_asks = __esm({
3035
3163
  init_listBox();
3036
3164
  Asks = (props) => {
3037
3165
  const { data } = props;
3038
- const countQty = React11.useMemo(() => {
3166
+ const countQty = React12.useMemo(() => {
3039
3167
  const len = data.length;
3040
3168
  let max = Number.NaN;
3041
3169
  let index = 0;
@@ -3056,7 +3184,7 @@ var init_bids = __esm({
3056
3184
  init_listBox();
3057
3185
  Bids = (props) => {
3058
3186
  const { data } = props;
3059
- const countQty = React11.useMemo(() => {
3187
+ const countQty = React12.useMemo(() => {
3060
3188
  let max = Number.NaN;
3061
3189
  let index = data.length - 1;
3062
3190
  while (Number.isNaN(max) && index > 0) {
@@ -3073,7 +3201,7 @@ var DepthSelect;
3073
3201
  var init_depthSelect = __esm({
3074
3202
  "src/components/mobile/orderBook/depthSelect.tsx"() {
3075
3203
  DepthSelect = (props) => {
3076
- const options = React11.useMemo(() => {
3204
+ const options = React12.useMemo(() => {
3077
3205
  return props.depth.map((d) => ({
3078
3206
  value: d,
3079
3207
  label: `${d}`
@@ -3106,7 +3234,7 @@ var init_header = __esm({
3106
3234
  ORDERBOOK_MOBILE_COIN_TYPE_KEY,
3107
3235
  "qty"
3108
3236
  );
3109
- const options = React11.useMemo(() => {
3237
+ const options = React12.useMemo(() => {
3110
3238
  return [
3111
3239
  {
3112
3240
  value: "qty",
@@ -3217,7 +3345,9 @@ var init_markPrice2 = __esm({
3217
3345
  var OrderBook;
3218
3346
  var init_orderBook = __esm({
3219
3347
  "src/components/mobile/orderBook/index.tsx"() {
3348
+ init_orderBook2();
3220
3349
  init_orderContext();
3350
+ init_buySellRatio();
3221
3351
  init_fundingRate();
3222
3352
  init_asks();
3223
3353
  init_bids();
@@ -3225,7 +3355,19 @@ var init_orderBook = __esm({
3225
3355
  init_header();
3226
3356
  init_markPrice2();
3227
3357
  OrderBook = (props) => {
3228
- const { lastPrice, markPrice, quote, base, isLoading, onDepthChange } = props;
3358
+ const {
3359
+ lastPrice,
3360
+ markPrice,
3361
+ quote,
3362
+ base,
3363
+ isLoading,
3364
+ onDepthChange,
3365
+ showBuySellRatio = true,
3366
+ setShowBuySellRatio,
3367
+ buySellRatio
3368
+ } = props;
3369
+ const { t } = i18n.useTranslation();
3370
+ const [settingsOpen, setSettingsOpen] = React12.useState(false);
3229
3371
  const symbol = `PERP_${props.symbolInfo.base}_${props.symbolInfo.quote}`;
3230
3372
  const [coinUnit, setCoinUnit] = hooks.useLocalStorage(
3231
3373
  ORDERBOOK_MOBILE_COIN_TYPE_KEY,
@@ -3240,6 +3382,8 @@ var init_orderBook = __esm({
3240
3382
  pendingOrders: types.EMPTY_LIST,
3241
3383
  showTotal: false,
3242
3384
  symbolInfo: props.symbolInfo,
3385
+ showBuySellRatio,
3386
+ onShowBuySellRatioChange: setShowBuySellRatio,
3243
3387
  children: /* @__PURE__ */ jsxRuntime.jsxs(
3244
3388
  ui.Flex,
3245
3389
  {
@@ -3250,7 +3394,16 @@ var init_orderBook = __esm({
3250
3394
  justify: "start",
3251
3395
  itemAlign: "start",
3252
3396
  children: [
3253
- /* @__PURE__ */ jsxRuntime.jsx(exports.FundingRateWidget, { symbol }),
3397
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "between", itemAlign: "center", className: "oui-w-full", children: [
3398
+ /* @__PURE__ */ jsxRuntime.jsx(exports.FundingRateWidget, { symbol }),
3399
+ /* @__PURE__ */ jsxRuntime.jsx(
3400
+ BuySellRatioSettings,
3401
+ {
3402
+ showBuySellRatio,
3403
+ setShowBuySellRatio
3404
+ }
3405
+ )
3406
+ ] }),
3254
3407
  /* @__PURE__ */ jsxRuntime.jsx(Header2, { quote, base }),
3255
3408
  /* @__PURE__ */ jsxRuntime.jsx(Asks, { data: props.asks }),
3256
3409
  /* @__PURE__ */ jsxRuntime.jsx(MarkPrice, { lastPrice, markPrice }),
@@ -3263,6 +3416,13 @@ var init_orderBook = __esm({
3263
3416
  onChange: onDepthChange
3264
3417
  }
3265
3418
  ),
3419
+ showBuySellRatio && /* @__PURE__ */ jsxRuntime.jsx(
3420
+ exports.BuySellRatioBar,
3421
+ {
3422
+ ratio: buySellRatio || null,
3423
+ className: "oui-px-0 oui-text-[8px] oui-h-6 oui-mt-2"
3424
+ }
3425
+ ),
3266
3426
  isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-bg-base-800/70 oui-absolute oui-inset-0 oui-z-10 oui-flex oui-h-full oui-min-h-[420px] oui-items-center oui-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, {}) })
3267
3427
  ]
3268
3428
  }
@@ -3295,7 +3455,10 @@ var init_orderBook_ui = __esm({
3295
3455
  cellHeight: props.cellHeight,
3296
3456
  onDepthChange: props.onDepthChange,
3297
3457
  className: props.className,
3298
- symbolInfo: props.symbolInfo
3458
+ symbolInfo: props.symbolInfo,
3459
+ showBuySellRatio: props.showBuySellRatio,
3460
+ setShowBuySellRatio: props.setShowBuySellRatio,
3461
+ buySellRatio: props.buySellRatio
3299
3462
  }
3300
3463
  ) : /* @__PURE__ */ jsxRuntime.jsx(
3301
3464
  DesktopOrderBook,
@@ -3315,7 +3478,10 @@ var init_orderBook_ui = __esm({
3315
3478
  onDepthChange: props.onDepthChange,
3316
3479
  className: props.className,
3317
3480
  pendingOrders: props.pendingOrders,
3318
- symbolInfo: props.symbolInfo
3481
+ symbolInfo: props.symbolInfo,
3482
+ showBuySellRatio: props.showBuySellRatio,
3483
+ setShowBuySellRatio: props.setShowBuySellRatio,
3484
+ buySellRatio: props.buySellRatio
3319
3485
  }
3320
3486
  ) });
3321
3487
  };
@@ -3337,27 +3503,36 @@ var init_utils = __esm({
3337
3503
  };
3338
3504
  }
3339
3505
  });
3340
- var DEFAULT_CELL_HEIGHT, SPACE; exports.useOrderBookScript = void 0; var usePendingOrderStream;
3506
+ var DEFAULT_CELL_HEIGHT, SPACE, BUY_SELL_RATIO_BAR_HEIGHT_MOBILE, BUY_SELL_RATIO_BAR_HEIGHT_DESKTOP, ORDERBOOK_SHOW_BUY_SELL_RATIO_KEY; exports.useOrderBookScript = void 0; var usePendingOrderStream;
3341
3507
  var init_orderBook_script = __esm({
3342
3508
  "src/components/base/orderBook/orderBook.script.tsx"() {
3343
3509
  init_utils();
3344
3510
  DEFAULT_CELL_HEIGHT = 20;
3345
3511
  SPACE = 104;
3512
+ BUY_SELL_RATIO_BAR_HEIGHT_MOBILE = 28;
3513
+ BUY_SELL_RATIO_BAR_HEIGHT_DESKTOP = 38;
3514
+ ORDERBOOK_SHOW_BUY_SELL_RATIO_KEY = "orderbook_show_buy_sell_ratio";
3346
3515
  exports.useOrderBookScript = (props) => {
3347
3516
  const { symbol, height } = props;
3348
3517
  const symbolInfo = hooks.useSymbolsInfo()[symbol];
3349
- const [cellHeight, setCellHeight] = React11.useState(DEFAULT_CELL_HEIGHT);
3350
- const [level, setLevel] = React11.useState(10);
3518
+ const [cellHeight, setCellHeight] = React12.useState(DEFAULT_CELL_HEIGHT);
3519
+ const [level, setLevel] = React12.useState(10);
3351
3520
  const { base, quote, quote_dp } = getBasicSymbolInfo(symbolInfo);
3352
3521
  const [data, { onDepthChange, isLoading, onItemClick, depth, allDepths }] = hooks.useOrderbookStream(symbol, void 0, { level });
3353
3522
  const pendingOrders = usePendingOrderStream(symbol);
3354
- React11.useEffect(() => {
3523
+ const { isMobile } = ui.useScreen();
3524
+ const [showBuySellRatio, setShowBuySellRatio] = hooks.useLocalStorage(
3525
+ ORDERBOOK_SHOW_BUY_SELL_RATIO_KEY,
3526
+ true
3527
+ );
3528
+ React12.useEffect(() => {
3355
3529
  if (height) {
3530
+ const availableSpace = SPACE + (showBuySellRatio ? isMobile ? BUY_SELL_RATIO_BAR_HEIGHT_MOBILE : BUY_SELL_RATIO_BAR_HEIGHT_DESKTOP : 0);
3356
3531
  const level2 = Math.floor(
3357
- (height - SPACE) / ((DEFAULT_CELL_HEIGHT + 1) * 2)
3532
+ (height - availableSpace) / ((DEFAULT_CELL_HEIGHT + 1) * 2)
3358
3533
  );
3359
3534
  const cellsHeight = (DEFAULT_CELL_HEIGHT + 1) * 2 * level2;
3360
- const restSpace = height - SPACE - cellsHeight;
3535
+ const restSpace = height - availableSpace - cellsHeight;
3361
3536
  if (restSpace > 10) {
3362
3537
  setCellHeight(DEFAULT_CELL_HEIGHT + restSpace / level2 / 2);
3363
3538
  } else {
@@ -3365,17 +3540,48 @@ var init_orderBook_script = __esm({
3365
3540
  }
3366
3541
  setLevel(level2);
3367
3542
  }
3368
- }, [height]);
3369
- const selDepth = React11.useMemo(() => {
3543
+ }, [height, showBuySellRatio]);
3544
+ const selDepth = React12.useMemo(() => {
3370
3545
  if (typeof depth === "undefined" || typeof quote_dp === "undefined") {
3371
3546
  return void 0;
3372
3547
  }
3373
3548
  return utils.removeTrailingZeros(depth);
3374
3549
  }, [depth, quote_dp, symbol]);
3375
- const depths = React11.useMemo(() => {
3550
+ const depths = React12.useMemo(() => {
3376
3551
  return allDepths?.map((e) => utils.removeTrailingZeros(e)) || [];
3377
3552
  }, [allDepths, quote_dp]);
3378
- const { isMobile } = ui.useScreen();
3553
+ const buySellRatio = React12.useMemo(() => {
3554
+ if (!data?.asks || !data?.bids || level === void 0) {
3555
+ return null;
3556
+ }
3557
+ const isValidNumber = (value) => {
3558
+ return typeof value === "number" && !Number.isNaN(value) && Number.isFinite(value) && value >= 0;
3559
+ };
3560
+ const visibleAsks = data.asks.slice(0, level);
3561
+ const visibleBids = data.bids.slice(-level);
3562
+ if (visibleAsks.length > 0 && visibleBids.length > 0) {
3563
+ const firstAsk = visibleAsks.find(
3564
+ (ask) => Array.isArray(ask) && ask.length === 4 && ask[3] !== void 0 && ask[3] !== null && isValidNumber(ask[3])
3565
+ );
3566
+ const lastBid = [...visibleBids].reverse().find(
3567
+ (bid) => Array.isArray(bid) && bid.length === 4 && bid[3] !== void 0 && bid[3] !== null && isValidNumber(bid[3])
3568
+ );
3569
+ if (firstAsk && lastBid) {
3570
+ const askAmount = new utils.Decimal(firstAsk[3]);
3571
+ const bidAmount = new utils.Decimal(lastBid[3]);
3572
+ const totalAmount = askAmount.add(bidAmount);
3573
+ const buyPercentage = bidAmount.div(totalAmount).mul(100).toNumber();
3574
+ const sellPercentage = 100 - buyPercentage;
3575
+ return {
3576
+ buyPercentage,
3577
+ sellPercentage,
3578
+ buyAmount: askAmount.toNumber(),
3579
+ sellAmount: bidAmount.toNumber()
3580
+ };
3581
+ }
3582
+ }
3583
+ return null;
3584
+ }, [data?.asks, data?.bids, level]);
3379
3585
  return {
3380
3586
  level,
3381
3587
  asks: data?.asks,
@@ -3392,7 +3598,10 @@ var init_orderBook_script = __esm({
3392
3598
  onDepthChange,
3393
3599
  pendingOrders,
3394
3600
  symbolInfo: getBasicSymbolInfo(symbolInfo),
3395
- isMobile
3601
+ isMobile,
3602
+ showBuySellRatio,
3603
+ setShowBuySellRatio,
3604
+ buySellRatio
3396
3605
  };
3397
3606
  };
3398
3607
  usePendingOrderStream = (symbol) => {
@@ -3400,7 +3609,7 @@ var init_orderBook_script = __esm({
3400
3609
  status: types.OrderStatus.INCOMPLETE,
3401
3610
  symbol
3402
3611
  });
3403
- const pendingOrders = React11.useMemo(() => {
3612
+ const pendingOrders = React12.useMemo(() => {
3404
3613
  const info = data?.filter((item) => item.symbol === symbol).reduce((a, b) => {
3405
3614
  const price = b.price || b.trigger_price || 0;
3406
3615
  return [...a, price];
@@ -3423,10 +3632,91 @@ var init_orderBook_widget = __esm({
3423
3632
  };
3424
3633
  }
3425
3634
  });
3635
+ exports.BuySellRatioBar = void 0;
3636
+ var init_buySellRatioBar = __esm({
3637
+ "src/components/base/orderBook/buySellRatioBar.tsx"() {
3638
+ exports.BuySellRatioBar = (props) => {
3639
+ const { ratio, className } = props;
3640
+ const { buyPercentage, sellPercentage } = React12.useMemo(() => {
3641
+ if (!ratio) {
3642
+ return { buyPercentage: 50, sellPercentage: 50 };
3643
+ }
3644
+ const isValidNumber = (value) => {
3645
+ return typeof value === "number" && !Number.isNaN(value) && Number.isFinite(value) && value >= 0 && value <= 100;
3646
+ };
3647
+ const buyPct = isValidNumber(ratio.buyPercentage) ? ratio.buyPercentage : 50;
3648
+ const buyPctRounded = new utils.Decimal(buyPct).toDecimalPlaces(1, utils.Decimal.ROUND_HALF_UP).toNumber();
3649
+ const sellPctRounded = new utils.Decimal(100).sub(buyPctRounded).toDecimalPlaces(1, utils.Decimal.ROUND_HALF_UP).toNumber();
3650
+ return {
3651
+ buyPercentage: buyPctRounded,
3652
+ sellPercentage: sellPctRounded
3653
+ };
3654
+ }, [ratio]);
3655
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { className: ui.cn("oui-w-full", className), gap: 1, children: [
3656
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { itemAlign: "center", gap: 1, children: [
3657
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 80, children: "B" }),
3658
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { color: "success", children: [
3659
+ buyPercentage.toFixed(1),
3660
+ "%"
3661
+ ] })
3662
+ ] }),
3663
+ /* @__PURE__ */ jsxRuntime.jsxs(
3664
+ "div",
3665
+ {
3666
+ style: {
3667
+ flex: 1,
3668
+ height: "4px",
3669
+ position: "relative",
3670
+ borderRadius: "2px",
3671
+ overflow: "hidden",
3672
+ backgroundColor: "rgb(var(--oui-line-4))"
3673
+ },
3674
+ children: [
3675
+ /* @__PURE__ */ jsxRuntime.jsx(
3676
+ "div",
3677
+ {
3678
+ className: "oui-bg-trade-profit oui-mr-[2px] oui-rounded-sm",
3679
+ style: {
3680
+ position: "absolute",
3681
+ left: 0,
3682
+ top: 0,
3683
+ width: `${buyPercentage}%`,
3684
+ height: "100%"
3685
+ }
3686
+ }
3687
+ ),
3688
+ /* @__PURE__ */ jsxRuntime.jsx(
3689
+ "div",
3690
+ {
3691
+ className: "oui-bg-trade-loss oui-ml-[2px] oui-rounded-sm",
3692
+ style: {
3693
+ position: "absolute",
3694
+ left: `${buyPercentage}%`,
3695
+ top: 0,
3696
+ width: `${sellPercentage}%`,
3697
+ height: "100%"
3698
+ }
3699
+ }
3700
+ )
3701
+ ]
3702
+ }
3703
+ ),
3704
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { itemAlign: "center", gap: 1, children: [
3705
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { color: "danger", children: [
3706
+ sellPercentage.toFixed(1),
3707
+ "%"
3708
+ ] }),
3709
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 80, children: "S" })
3710
+ ] })
3711
+ ] });
3712
+ };
3713
+ }
3714
+ });
3426
3715
 
3427
3716
  // src/components/base/orderBook/index.ts
3428
3717
  var orderBook_exports = {};
3429
3718
  __export(orderBook_exports, {
3719
+ BuySellRatioBar: () => exports.BuySellRatioBar,
3430
3720
  OrderBook: () => exports.OrderBook,
3431
3721
  OrderBookWidget: () => exports.OrderBookWidget,
3432
3722
  useOrderBookScript: () => exports.useOrderBookScript
@@ -3436,6 +3726,7 @@ var init_orderBook2 = __esm({
3436
3726
  init_orderBook_ui();
3437
3727
  init_orderBook_widget();
3438
3728
  init_orderBook_script();
3729
+ init_buySellRatioBar();
3439
3730
  }
3440
3731
  });
3441
3732
  exports.RiskRate = void 0;
@@ -3524,7 +3815,7 @@ var init_riskRate_script = __esm({
3524
3815
  const isConnected = state.status >= types.AccountStatusEnum.EnableTrading || state.status === types.AccountStatusEnum.EnableTradingWithoutConnected;
3525
3816
  const { marginRatio, currentLeverage, mmr } = hooks.useMarginRatio();
3526
3817
  const { curLeverage } = hooks.useLeverage();
3527
- const riskRate = React11.useMemo(() => {
3818
+ const riskRate = React12.useMemo(() => {
3528
3819
  if (!isConnected || marginRatio === null || mmr === null) {
3529
3820
  return "--";
3530
3821
  }
@@ -3535,7 +3826,7 @@ var init_riskRate_script = __esm({
3535
3826
  return `${calculatedRiskRate.toString().replace(/\.?0+$/, "")}%`;
3536
3827
  }, [isConnected, marginRatio, mmr]);
3537
3828
  const riskRateNumber = riskRate === "--" ? null : parseFloat(riskRate);
3538
- const riskRateColor = React11.useMemo(() => {
3829
+ const riskRateColor = React12.useMemo(() => {
3539
3830
  return getRiskRateColor(riskRateNumber);
3540
3831
  }, [riskRateNumber]);
3541
3832
  const _curLeverage = reactApp.useDataTap(currentLeverage);
@@ -3578,14 +3869,14 @@ var init_riskRate = __esm({
3578
3869
  var LazyLastTradesWidget, LazyOrderBookWidget, TwoColLayout, TabLayout, Title2; exports.OrderBookAndTrades = void 0;
3579
3870
  var init_orderBookAndTrades_ui = __esm({
3580
3871
  "src/components/desktop/orderBookAndTrades/orderBookAndTrades.ui.tsx"() {
3581
- LazyLastTradesWidget = React11__default.default.lazy(
3872
+ LazyLastTradesWidget = React12__default.default.lazy(
3582
3873
  () => Promise.resolve().then(() => (init_lastTrades(), lastTrades_exports)).then((mod) => {
3583
3874
  return {
3584
3875
  default: mod.LastTradesWidget
3585
3876
  };
3586
3877
  })
3587
3878
  );
3588
- LazyOrderBookWidget = React11__default.default.lazy(
3879
+ LazyOrderBookWidget = React12__default.default.lazy(
3589
3880
  () => Promise.resolve().then(() => (init_orderBook2(), orderBook_exports)).then((mod) => {
3590
3881
  return {
3591
3882
  default: mod.OrderBookWidget
@@ -3622,7 +3913,7 @@ var init_orderBookAndTrades_ui = __esm({
3622
3913
  className: "oui-pl-3 oui-text-sm"
3623
3914
  }
3624
3915
  ),
3625
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3916
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3626
3917
  LazyOrderBookWidget,
3627
3918
  {
3628
3919
  symbol: props.symbol,
@@ -3648,7 +3939,7 @@ var init_orderBookAndTrades_ui = __esm({
3648
3939
  className: "oui-text-sm oui-px-3"
3649
3940
  }
3650
3941
  ),
3651
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3942
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3652
3943
  LazyLastTradesWidget,
3653
3944
  {
3654
3945
  symbol: props.symbol,
@@ -3690,14 +3981,14 @@ var init_orderBookAndTrades_ui = __esm({
3690
3981
  },
3691
3982
  size: "lg",
3692
3983
  children: [
3693
- /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { value: "orderBook", title: t("trading.orderBook"), children: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3984
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { value: "orderBook", title: t("trading.orderBook"), children: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3694
3985
  LazyOrderBookWidget,
3695
3986
  {
3696
3987
  symbol: props.symbol,
3697
3988
  height: props.containerSize ? props.containerSize.height - 29 - 18 : void 0
3698
3989
  }
3699
3990
  ) }) }),
3700
- /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { value: "lastTrades", title: t("trading.lastTrades"), children: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3991
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { value: "lastTrades", title: t("trading.lastTrades"), children: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
3701
3992
  LazyLastTradesWidget,
3702
3993
  {
3703
3994
  symbol: props.symbol,
@@ -3738,10 +4029,10 @@ exports.useOrderBookAndTradesScript = void 0;
3738
4029
  var init_orderBookAndTrades_script = __esm({
3739
4030
  "src/components/desktop/orderBookAndTrades/orderBookAndTrades.script.tsx"() {
3740
4031
  exports.useOrderBookAndTradesScript = (symbol) => {
3741
- const [containerSize, setContainerSize] = React11.useState(void 0);
3742
- const [tab, setTab] = React11.useState("orderBook");
3743
- const containerRef = React11.useRef(null);
3744
- React11.useEffect(() => {
4032
+ const [containerSize, setContainerSize] = React12.useState(void 0);
4033
+ const [tab, setTab] = React12.useState("orderBook");
4034
+ const containerRef = React12.useRef(null);
4035
+ React12.useEffect(() => {
3745
4036
  const resizeObserver = new ResizeObserver((entries) => {
3746
4037
  for (const entry of entries) {
3747
4038
  const { width, height } = entry.contentRect;
@@ -3838,8 +4129,8 @@ var init_switchLayout = __esm({
3838
4129
  ) });
3839
4130
  };
3840
4131
  SwitchLayoutDropDown = (props) => {
3841
- const [open, setOpen] = React11.useState(false);
3842
- const [hoveredMarket, setHoveredMarket] = React11.useState(null);
4132
+ const [open, setOpen] = React12.useState(false);
4133
+ const [hoveredMarket, setHoveredMarket] = React12.useState(null);
3843
4134
  const { t } = i18n.useTranslation();
3844
4135
  const renderItem = (position) => {
3845
4136
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4060,10 +4351,8 @@ var init_switchLayout = __esm({
4060
4351
  );
4061
4352
  MarketLeftIcon = ({ isSelected, isHovered, ...props }) => {
4062
4353
  const getStrokeColor = () => {
4063
- if (isSelected)
4064
- return "rgb(var(--oui-color-primary-light))";
4065
- if (isHovered)
4066
- return "rgb(var(--oui-color-primary-light))";
4354
+ if (isSelected) return "rgb(var(--oui-color-primary-light))";
4355
+ if (isHovered) return "rgb(var(--oui-color-primary-light))";
4067
4356
  return "rgb(var(--oui-color-base-5))";
4068
4357
  };
4069
4358
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4101,10 +4390,8 @@ var init_switchLayout = __esm({
4101
4390
  };
4102
4391
  MarketTopIcon = ({ isSelected, isHovered, ...props }) => {
4103
4392
  const getStrokeColor = () => {
4104
- if (isSelected)
4105
- return "rgb(var(--oui-color-primary-light))";
4106
- if (isHovered)
4107
- return "rgb(var(--oui-color-primary-light))";
4393
+ if (isSelected) return "rgb(var(--oui-color-primary-light))";
4394
+ if (isHovered) return "rgb(var(--oui-color-primary-light))";
4108
4395
  return "rgb(var(--oui-color-base-5))";
4109
4396
  };
4110
4397
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4156,10 +4443,8 @@ var init_switchLayout = __esm({
4156
4443
  };
4157
4444
  MarketBottomIcon = ({ isSelected, isHovered, ...props }) => {
4158
4445
  const getStrokeColor = () => {
4159
- if (isSelected)
4160
- return "rgb(var(--oui-color-primary-light))";
4161
- if (isHovered)
4162
- return "rgb(var(--oui-color-primary-light))";
4446
+ if (isSelected) return "rgb(var(--oui-color-primary-light))";
4447
+ if (isHovered) return "rgb(var(--oui-color-primary-light))";
4163
4448
  return "rgb(var(--oui-color-base-5))";
4164
4449
  };
4165
4450
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4211,10 +4496,8 @@ var init_switchLayout = __esm({
4211
4496
  };
4212
4497
  MarketHideIcon = ({ isSelected, isHovered, ...props }) => {
4213
4498
  const getStrokeColor = () => {
4214
- if (isSelected)
4215
- return "rgb(var(--oui-color-primary-light))";
4216
- if (isHovered)
4217
- return "rgb(var(--oui-color-primary-light))";
4499
+ if (isSelected) return "rgb(var(--oui-color-primary-light))";
4500
+ if (isHovered) return "rgb(var(--oui-color-primary-light))";
4218
4501
  return "rgb(var(--oui-color-base-5))";
4219
4502
  };
4220
4503
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4503,9 +4786,9 @@ var init_topTab_script = __esm({
4503
4786
  "src/components/mobile/topTab/topTab.script.tsx"() {
4504
4787
  init_tradingPageContext();
4505
4788
  useTopTabScript = () => {
4506
- const [tab, setTab] = React11.useState("chart" /* chart */);
4789
+ const [tab, setTab] = React12.useState("chart" /* chart */);
4507
4790
  const { symbol } = exports.useTradingPageContext();
4508
- const [visible, setVisible] = React11.useState(true);
4791
+ const [visible, setVisible] = React12.useState(true);
4509
4792
  const toggleContentVisible = () => {
4510
4793
  setVisible((e) => !e);
4511
4794
  };
@@ -4522,12 +4805,12 @@ var init_topTab_script = __esm({
4522
4805
  });
4523
4806
  function useTradingviewScript(props) {
4524
4807
  const [height, setHeight] = hooks.useLocalStorage(Key, MaxHeight);
4525
- const [dragging, setDragging] = React11.useState(false);
4526
- const dragRef = React11.useRef(null);
4527
- const boxRef = React11.useRef(null);
4528
- const [offsetY, setOffsetY] = React11.useState(0);
4529
- const topRef = React11.useRef(0);
4530
- const handleTouchStart = React11.useCallback((e) => {
4808
+ const [dragging, setDragging] = React12.useState(false);
4809
+ const dragRef = React12.useRef(null);
4810
+ const boxRef = React12.useRef(null);
4811
+ const [offsetY, setOffsetY] = React12.useState(0);
4812
+ const topRef = React12.useRef(0);
4813
+ const handleTouchStart = React12.useCallback((e) => {
4531
4814
  if (!boxRef.current) {
4532
4815
  return;
4533
4816
  }
@@ -4540,7 +4823,7 @@ function useTradingviewScript(props) {
4540
4823
  topRef.current = rect.top;
4541
4824
  setOffsetY(offsetY2);
4542
4825
  }, []);
4543
- const handleTouchMove = React11.useCallback(
4826
+ const handleTouchMove = React12.useCallback(
4544
4827
  (e) => {
4545
4828
  if (!boxRef.current) {
4546
4829
  return;
@@ -4558,10 +4841,10 @@ function useTradingviewScript(props) {
4558
4841
  },
4559
4842
  [dragging, offsetY]
4560
4843
  );
4561
- const handleTouchEnd = React11.useCallback(() => {
4844
+ const handleTouchEnd = React12.useCallback(() => {
4562
4845
  setDragging(false);
4563
4846
  }, []);
4564
- React11.useEffect(() => {
4847
+ React12.useEffect(() => {
4565
4848
  const drag = dragRef.current;
4566
4849
  if (!drag) {
4567
4850
  return;
@@ -4571,7 +4854,7 @@ function useTradingviewScript(props) {
4571
4854
  drag.removeEventListener("touchstart", handleTouchStart);
4572
4855
  };
4573
4856
  }, [handleTouchStart]);
4574
- React11.useEffect(() => {
4857
+ React12.useEffect(() => {
4575
4858
  document.addEventListener("touchmove", handleTouchMove, { passive: false });
4576
4859
  document.addEventListener("touchend", handleTouchEnd);
4577
4860
  return () => {
@@ -4793,7 +5076,7 @@ var init_tradeData_script = __esm({
4793
5076
  const { symbol } = props;
4794
5077
  const ticker = hooks.useTickerStream(symbol);
4795
5078
  const { symbolInfo } = exports.useTradingPageContext();
4796
- const vol_24h = React11.useMemo(() => {
5079
+ const vol_24h = React12.useMemo(() => {
4797
5080
  const close = ticker?.["24h_close"];
4798
5081
  const volume = ticker?.["24h_volume"];
4799
5082
  if (close && volume && !isNaN(close) && !isNaN(volume)) {
@@ -4801,7 +5084,7 @@ var init_tradeData_script = __esm({
4801
5084
  }
4802
5085
  return void 0;
4803
5086
  }, [ticker]);
4804
- const openInterest = React11.useMemo(() => {
5087
+ const openInterest = React12.useMemo(() => {
4805
5088
  const markPrice = ticker?.["mark_price"];
4806
5089
  const openInterest2 = ticker?.["open_interest"];
4807
5090
  if (markPrice && openInterest2 && !isNaN(markPrice)) {
@@ -4849,17 +5132,17 @@ var init_topTab_ui = __esm({
4849
5132
  "src/components/mobile/topTab/topTab.ui.tsx"() {
4850
5133
  init_tradingPageContext();
4851
5134
  init_topTab_script();
4852
- LazyTradingviewWidget = React11__default.default.lazy(
5135
+ LazyTradingviewWidget = React12__default.default.lazy(
4853
5136
  () => Promise.resolve().then(() => (init_tradingview_widget(), tradingview_widget_exports)).then((mod) => {
4854
5137
  return { default: mod.TradingviewWidget };
4855
5138
  })
4856
5139
  );
4857
- LazyMWebLastTrades = React11__default.default.lazy(
5140
+ LazyMWebLastTrades = React12__default.default.lazy(
4858
5141
  () => Promise.resolve().then(() => (init_lastTrades_widget2(), lastTrades_widget_exports)).then((mod) => {
4859
5142
  return { default: mod.MWebLastTrades };
4860
5143
  })
4861
5144
  );
4862
- LazyTradeDataWidget = React11__default.default.lazy(
5145
+ LazyTradeDataWidget = React12__default.default.lazy(
4863
5146
  () => Promise.resolve().then(() => (init_tradeData(), tradeData_exports)).then((mod) => {
4864
5147
  return { default: mod.TradeDataWidget };
4865
5148
  })
@@ -4892,15 +5175,15 @@ var init_topTab_ui = __esm({
4892
5175
  }
4893
5176
  ) }),
4894
5177
  children: [
4895
- /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { title: t("trading.tabs.chart"), value: "chart" /* chart */, children: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5178
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { title: t("trading.tabs.chart"), value: "chart" /* chart */, children: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
4896
5179
  LazyTradingviewWidget,
4897
5180
  {
4898
5181
  symbol: props.symbol,
4899
5182
  tradingViewConfig
4900
5183
  }
4901
5184
  ) }) }),
4902
- /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { title: t("trading.tabs.trades"), value: "trades" /* trades */, children: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyMWebLastTrades, { symbol: props.symbol }) }) }),
4903
- /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { title: t("trading.tabs.data"), value: "data" /* data */, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { px: 3, children: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyTradeDataWidget, { symbol: props.symbol }) }) }) })
5185
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { title: t("trading.tabs.trades"), value: "trades" /* trades */, children: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyMWebLastTrades, { symbol: props.symbol }) }) }),
5186
+ /* @__PURE__ */ jsxRuntime.jsx(ui.TabPanel, { title: t("trading.tabs.data"), value: "data" /* data */, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { px: 3, children: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyTradeDataWidget, { symbol: props.symbol }) }) }) })
4904
5187
  ]
4905
5188
  }
4906
5189
  );
@@ -4961,15 +5244,15 @@ var init_topTab = __esm({
4961
5244
  var LazyOrderBookWidget2, OrderBookAndEntry;
4962
5245
  var init_orderBookAndEntry_ui = __esm({
4963
5246
  "src/components/mobile/orderBookAndEntry/orderBookAndEntry.ui.tsx"() {
4964
- LazyOrderBookWidget2 = React11__default.default.lazy(
5247
+ LazyOrderBookWidget2 = React12__default.default.lazy(
4965
5248
  () => Promise.resolve().then(() => (init_orderBook2(), orderBook_exports)).then((mod) => {
4966
5249
  return { default: mod.OrderBookWidget };
4967
5250
  })
4968
5251
  );
4969
5252
  OrderBookAndEntry = (props) => {
4970
- const [height, setHeight] = React11.useState(0);
4971
- const divRef = React11.useRef(null);
4972
- React11.useEffect(() => {
5253
+ const [height, setHeight] = React12.useState(0);
5254
+ const divRef = React12.useRef(null);
5255
+ React12.useEffect(() => {
4973
5256
  const div = divRef.current;
4974
5257
  if (!div) {
4975
5258
  return;
@@ -4997,7 +5280,7 @@ var init_orderBookAndEntry_ui = __esm({
4997
5280
  {
4998
5281
  className: "oui-rounded-xl oui-bg-base-9",
4999
5282
  style: { height: `${height + 16}px` },
5000
- children: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5283
+ children: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5001
5284
  LazyOrderBookWidget2,
5002
5285
  {
5003
5286
  symbol: props.symbol,
@@ -5060,8 +5343,8 @@ var init_dataList_script2 = __esm({
5060
5343
  init_tradingPageContext();
5061
5344
  useDataListScript2 = (props) => {
5062
5345
  const { symbol, sharePnLConfig } = props;
5063
- const [tab, setTab] = React11.useState("Position" /* position */);
5064
- const [subTab, setSubTab] = React11.useState(
5346
+ const [tab, setTab] = React12.useState("Position" /* position */);
5347
+ const [subTab, setSubTab] = React12.useState(
5065
5348
  "Position history" /* positionHistory */
5066
5349
  );
5067
5350
  const { t } = i18n.useTranslation();
@@ -5165,7 +5448,7 @@ var LazyPositionHeaderWidget2, SymbolControlHeader, OrdersView, PositionsView2,
5165
5448
  var init_dataList_ui2 = __esm({
5166
5449
  "src/components/mobile/dataList/dataList.ui.tsx"() {
5167
5450
  init_dataList_script2();
5168
- LazyPositionHeaderWidget2 = React11__default.default.lazy(
5451
+ LazyPositionHeaderWidget2 = React12__default.default.lazy(
5169
5452
  () => Promise.resolve().then(() => (init_positionHeader(), positionHeader_exports)).then((mod) => {
5170
5453
  return { default: mod.PositionHeaderWidget };
5171
5454
  })
@@ -5173,7 +5456,7 @@ var init_dataList_ui2 = __esm({
5173
5456
  SymbolControlHeader = (props) => {
5174
5457
  const { pendingOrderCount, tpSlOrderCount, type, symbol } = props;
5175
5458
  const { t } = i18n.useTranslation();
5176
- const cancelAllDisabled = React11.useMemo(() => {
5459
+ const cancelAllDisabled = React12.useMemo(() => {
5177
5460
  if (type === uiOrders.TabType.pending) {
5178
5461
  return pendingOrderCount === 0;
5179
5462
  }
@@ -5256,7 +5539,7 @@ var init_dataList_ui2 = __esm({
5256
5539
  };
5257
5540
  PositionsView2 = (props) => {
5258
5541
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 2, children: [
5259
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5542
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5260
5543
  LazyPositionHeaderWidget2,
5261
5544
  {
5262
5545
  pnlNotionalDecimalPrecision: props.pnlNotionalDecimalPrecision,
@@ -5266,7 +5549,7 @@ var init_dataList_ui2 = __esm({
5266
5549
  setUnPnlPriceBasic: props.setUnPnlPriceBasic
5267
5550
  }
5268
5551
  ) }),
5269
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5552
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
5270
5553
  uiPositions.MobilePositionsWidget,
5271
5554
  {
5272
5555
  symbol: props.showAllSymbol ? void 0 : props.symbol,
@@ -5393,7 +5676,7 @@ var init_dataList_ui2 = __esm({
5393
5676
  },
5394
5677
  children: tabPanelItems.map((item) => {
5395
5678
  const { content, ...rest } = item;
5396
- return /* @__PURE__ */ React11.createElement(ui.TabPanel, { ...rest, key: `item-${rest.value}` }, content);
5679
+ return /* @__PURE__ */ React12.createElement(ui.TabPanel, { ...rest, key: `item-${rest.value}` }, content);
5397
5680
  })
5398
5681
  }
5399
5682
  );
@@ -5436,11 +5719,11 @@ init_riskRate();
5436
5719
  init_orderBookAndTrades();
5437
5720
  var SplitLineBar = (props) => {
5438
5721
  const { onMouseDown, mode = "horizontal", ...rest } = props;
5439
- const disable = React11.useMemo(
5722
+ const disable = React12.useMemo(
5440
5723
  () => props.className?.split(" ").includes("disable"),
5441
5724
  [props.className]
5442
5725
  );
5443
- const filterCls = React11.useMemo(
5726
+ const filterCls = React12.useMemo(
5444
5727
  () => props.className?.split(" ").filter((cls) => cls !== "disable"),
5445
5728
  [props.className]
5446
5729
  );
@@ -5472,7 +5755,7 @@ var SplitLineBar = (props) => {
5472
5755
  }
5473
5756
  );
5474
5757
  };
5475
- var SplitLayout = React11.forwardRef((props, ref) => {
5758
+ var SplitLayout = React12.forwardRef((props, ref) => {
5476
5759
  const { onSizeChange, ...rest } = props;
5477
5760
  return /* @__PURE__ */ jsxRuntime.jsx(
5478
5761
  Split__default.default,
@@ -5902,7 +6185,7 @@ var useAccountSheetScript = (props) => {
5902
6185
  const config = hooks.useConfig();
5903
6186
  const { connectedChain, disconnect, namespace } = hooks.useWalletConnector();
5904
6187
  const chainId = account.chainId || connectedChain?.id || linkDeviceStorage?.chainId;
5905
- const showGetTestUSDC = React11.useMemo(() => {
6188
+ const showGetTestUSDC = React12.useMemo(() => {
5906
6189
  if (chainId) {
5907
6190
  return (state.status === types.AccountStatusEnum.EnableTrading || state.status === types.AccountStatusEnum.EnableTradingWithoutConnected) && // @ts-ignore
5908
6191
  utils.isTestnet(parseInt(chainId));
@@ -5987,13 +6270,13 @@ var useAccountSheetScript = (props) => {
5987
6270
  };
5988
6271
  var useReferral = (_onClickReferral) => {
5989
6272
  const { data, isLoading, isAffiliate, isTrader } = hooks.useReferralInfo();
5990
- const affiliateCommission30D = React11.useMemo(() => {
6273
+ const affiliateCommission30D = React12.useMemo(() => {
5991
6274
  if (isAffiliate) {
5992
6275
  return data?.referrer_info?.["30d_referrer_rebate"];
5993
6276
  }
5994
6277
  return void 0;
5995
6278
  }, [data, isAffiliate]);
5996
- const traderCommission30D = React11.useMemo(() => {
6279
+ const traderCommission30D = React12.useMemo(() => {
5997
6280
  if (isTrader) {
5998
6281
  return data?.referee_info?.["30d_referee_rebate"];
5999
6282
  }
@@ -6018,10 +6301,10 @@ var useReferral = (_onClickReferral) => {
6018
6301
  var useTradingRewards = (_onClick) => {
6019
6302
  const [curEpochEstimate] = hooks.useCurEpochEstimate(hooks.TWType.normal);
6020
6303
  const [list, curEpoch] = hooks.useEpochInfo(hooks.TWType.normal);
6021
- const curEpochId = React11.useMemo(() => {
6304
+ const curEpochId = React12.useMemo(() => {
6022
6305
  return curEpoch.curEpochInfo?.epoch_id ?? "--";
6023
6306
  }, [curEpoch]);
6024
- const estRewards = React11.useMemo(() => {
6307
+ const estRewards = React12.useMemo(() => {
6025
6308
  if (typeof curEpochEstimate?.est_r_wallet === "undefined") {
6026
6309
  return "--";
6027
6310
  }
@@ -6041,7 +6324,7 @@ function useGetChains(chainId) {
6041
6324
  pick: "network_infos",
6042
6325
  filter: (chain) => chain.network_infos?.bridge_enable || chain.network_infos?.bridgeless
6043
6326
  });
6044
- const chainName = React11.useMemo(() => {
6327
+ const chainName = React12.useMemo(() => {
6045
6328
  const chain = findByChainId(parseInt(chainId), "network_infos");
6046
6329
  if (!chain) {
6047
6330
  return "Unknown";
@@ -6228,7 +6511,7 @@ var BottomNavBar = (props) => {
6228
6511
  ] });
6229
6512
  };
6230
6513
  var LinkDevice = (props) => {
6231
- const [open, setOpen] = React11.useState(false);
6514
+ const [open, setOpen] = React12.useState(false);
6232
6515
  const { t } = i18n.useTranslation();
6233
6516
  const showDialog = () => {
6234
6517
  setOpen(true);
@@ -6413,8 +6696,8 @@ var usePortfolioSheetScript = () => {
6413
6696
  const ee = hooks.useEventEmitter();
6414
6697
  const { t } = i18n.useTranslation();
6415
6698
  const subAccounts = state.subAccounts ?? [];
6416
- const [showSliderTip, setShowSliderTip] = React11.useState(false);
6417
- const onSettlePnL = React11.useCallback(async () => {
6699
+ const [showSliderTip, setShowSliderTip] = React12.useState(false);
6700
+ const onSettlePnL = React12.useCallback(async () => {
6418
6701
  return account.settle().catch((e) => {
6419
6702
  if (e.code == -1104) {
6420
6703
  ui.toast.error(t("settle.settlement.error"));
@@ -6438,17 +6721,17 @@ var usePortfolioSheetScript = () => {
6438
6721
  return Promise.resolve(res);
6439
6722
  });
6440
6723
  }, [account, t]);
6441
- const onDeposit = React11.useCallback(() => {
6724
+ const onDeposit = React12.useCallback(() => {
6442
6725
  ui.modal.show(uiTransfer.DepositAndWithdrawWithSheetId, {
6443
6726
  activeTab: "deposit"
6444
6727
  });
6445
6728
  }, []);
6446
- const onWithdraw = React11.useCallback(() => {
6729
+ const onWithdraw = React12.useCallback(() => {
6447
6730
  ui.modal.show(uiTransfer.DepositAndWithdrawWithSheetId, {
6448
6731
  activeTab: "withdraw"
6449
6732
  });
6450
6733
  }, []);
6451
- const onTransfer = React11.useCallback(() => {
6734
+ const onTransfer = React12.useCallback(() => {
6452
6735
  ui.modal.show(uiTransfer.TransferSheetId);
6453
6736
  }, []);
6454
6737
  return {
@@ -6485,20 +6768,20 @@ var useMarginRatioAndLeverage = () => {
6485
6768
  const { t } = i18n.useTranslation();
6486
6769
  const [{ aggregated, totalUnrealizedROI }, positionsInfo] = hooks.usePositionStream();
6487
6770
  const { marginRatio, currentLeverage, mmr } = hooks.useMarginRatio();
6488
- const marginRatioVal = React11.useMemo(() => {
6771
+ const marginRatioVal = React12.useMemo(() => {
6489
6772
  return Math.min(
6490
6773
  10,
6491
6774
  aggregated.notional === 0 ? positionsInfo["margin_ratio"](10) : marginRatio
6492
6775
  );
6493
6776
  }, [marginRatio, aggregated]);
6494
6777
  const { update, curLeverage, maxLeverage, leverageLevers } = hooks.useLeverage();
6495
- const marks = React11.useMemo(() => {
6778
+ const marks = React12.useMemo(() => {
6496
6779
  return leverageLevers?.map((e) => ({
6497
6780
  label: `${e}x`,
6498
6781
  value: e
6499
6782
  }));
6500
6783
  }, [leverageLevers]);
6501
- const [leverage, setLeverage] = React11.useState(curLeverage ?? 0);
6784
+ const [leverage, setLeverage] = React12.useState(curLeverage ?? 0);
6502
6785
  const step = 100 / ((marks?.length || 0) - 1);
6503
6786
  const onLeverageChange = (leverage2) => {
6504
6787
  setLeverage(leverage2);
@@ -6516,11 +6799,11 @@ var useMarginRatioAndLeverage = () => {
6516
6799
  } catch {
6517
6800
  }
6518
6801
  };
6519
- const onValueCommit = React11.useCallback((value) => {
6802
+ const onValueCommit = React12.useCallback((value) => {
6520
6803
  onSave(Array.isArray(value) ? value[0] : value);
6521
6804
  }, []);
6522
6805
  const debouncedCommit = hooks.useDebouncedCallback(onValueCommit, 500);
6523
- const onInputChange = React11.useCallback(
6806
+ const onInputChange = React12.useCallback(
6524
6807
  (e) => {
6525
6808
  const parsed = Number.parseInt(e.target.value, 10);
6526
6809
  const raw = Number.isNaN(parsed) ? 0 : parsed;
@@ -6615,7 +6898,7 @@ var PortfolioSheet = (props) => {
6615
6898
  };
6616
6899
  var Asset = (props) => {
6617
6900
  const { t } = i18n.useTranslation();
6618
- const onUnsettleClick = React11.useCallback(() => {
6901
+ const onUnsettleClick = React12.useCallback(() => {
6619
6902
  return ui.modal.confirm({
6620
6903
  title: t("settle.settlePnl"),
6621
6904
  // maxWidth: "xs",
@@ -6898,8 +7181,8 @@ init_fundingRateModal_ui();
6898
7181
  init_fundingRateModal_widget();
6899
7182
  var SortablePanel = (props) => {
6900
7183
  const { showIndicator, dragOverlay } = props;
6901
- const nodeRef = React11.useRef(null);
6902
- const [dimensions, setDimensions] = React11__default.default.useState(null);
7184
+ const nodeRef = React12.useRef(null);
7185
+ const [dimensions, setDimensions] = React12__default.default.useState(null);
6903
7186
  const sortableResult = sortable.useSortable({
6904
7187
  id: props.id
6905
7188
  });
@@ -6912,7 +7195,7 @@ var SortablePanel = (props) => {
6912
7195
  isDragging,
6913
7196
  setActivatorNodeRef
6914
7197
  } = sortableResult;
6915
- React11.useEffect(() => {
7198
+ React12.useEffect(() => {
6916
7199
  if (isDragging && nodeRef.current && !dimensions) {
6917
7200
  const rect = nodeRef.current.getBoundingClientRect();
6918
7201
  setDimensions({
@@ -7026,7 +7309,7 @@ var RwaOutsideMarketHoursNotify = () => {
7026
7309
  ui.toast.remove(toastId);
7027
7310
  };
7028
7311
  const { isMobile } = ui.useScreen();
7029
- React11.useEffect(() => {
7312
+ React12.useEffect(() => {
7030
7313
  if (isMobile) {
7031
7314
  setTimeout(() => {
7032
7315
  ui.toast.dismiss(toastId);
@@ -7070,18 +7353,18 @@ var showRwaOutsideMarketHoursNotify = () => {
7070
7353
  };
7071
7354
  RwaOutsideMarketHoursNotify.displayName = "RwaOutsideMarketHoursNotify";
7072
7355
  var useShowRwaCountdown = (symbol) => {
7073
- const [showCountdown, setShowCountdown] = React11.useState(
7356
+ const [showCountdown, setShowCountdown] = React12.useState(
7074
7357
  void 0
7075
7358
  );
7076
- const [manulClose, setManulClose] = React11.useState(false);
7359
+ const [manulClose, setManulClose] = React12.useState(false);
7077
7360
  const { isRwa, open, closeTimeInterval } = hooks.useGetRwaSymbolCloseTimeInterval(symbol);
7078
- React11.useEffect(() => {
7361
+ React12.useEffect(() => {
7079
7362
  if (manulClose) {
7080
7363
  return;
7081
7364
  }
7082
7365
  setShowCountdown(isRwa && open && !!closeTimeInterval);
7083
7366
  }, [isRwa, open, closeTimeInterval, manulClose]);
7084
- React11.useEffect(() => {
7367
+ React12.useEffect(() => {
7085
7368
  return () => {
7086
7369
  setShowCountdown(void 0);
7087
7370
  setManulClose(false);
@@ -7091,7 +7374,7 @@ var useShowRwaCountdown = (symbol) => {
7091
7374
  setShowCountdown(false);
7092
7375
  setManulClose(true);
7093
7376
  };
7094
- return React11.useMemo(() => {
7377
+ return React12.useMemo(() => {
7095
7378
  return {
7096
7379
  showCountdown,
7097
7380
  closeCountdown
@@ -7099,7 +7382,7 @@ var useShowRwaCountdown = (symbol) => {
7099
7382
  }, [showCountdown, closeCountdown]);
7100
7383
  };
7101
7384
  var useSplitPersistent = (key, defaulValue, dep) => {
7102
- const size = React11.useMemo(() => {
7385
+ const size = React12.useMemo(() => {
7103
7386
  const size2 = localStorage.getItem(key);
7104
7387
  if (size2) {
7105
7388
  return `${size2}%`;
@@ -7122,7 +7405,7 @@ var useFirstTimeDeposit = () => {
7122
7405
  dp: 2
7123
7406
  });
7124
7407
  const unavailable = wrongNetwork || disabledConnect || state.status < types.AccountStatusEnum.EnableTrading && state.status !== types.AccountStatusEnum.EnableTradingWithoutConnected;
7125
- const { startTime, endTime } = React11.useMemo(() => {
7408
+ const { startTime, endTime } = React12.useMemo(() => {
7126
7409
  const d = /* @__PURE__ */ new Date();
7127
7410
  const today = new Date(
7128
7411
  d.getFullYear(),
@@ -7173,7 +7456,7 @@ var ORDERLY_ORDER_ENTRY_SIDE_MARKETS_LAYOUT = "orderly_order_entry_side_markets_
7173
7456
  var ORDERLY_SIDE_MARKETS_MODE_KEY = "orderly_side_markets_mode";
7174
7457
  var ORDERLY_HORIZONTAL_MARKETS_LAYOUT = "orderly_horizontal_markets_layout";
7175
7458
  var useTradingScript = () => {
7176
- const [openMarketsSheet, setOpenMarketsSheet] = React11.useState(false);
7459
+ const [openMarketsSheet, setOpenMarketsSheet] = React12.useState(false);
7177
7460
  const props = exports.useTradingPageContext();
7178
7461
  const { state } = hooks.useAccount();
7179
7462
  const { t } = i18n.useTranslation();
@@ -7193,7 +7476,7 @@ var useTradingScript = () => {
7193
7476
  ORDERLY_HORIZONTAL_MARKETS_LAYOUT,
7194
7477
  "left"
7195
7478
  );
7196
- const canTrade = React11.useMemo(() => {
7479
+ const canTrade = React12.useMemo(() => {
7197
7480
  return !wrongNetwork && !disabledConnect && (state.status >= types.AccountStatusEnum.EnableTrading || state.status === types.AccountStatusEnum.EnableTradingWithoutConnected);
7198
7481
  }, [state.status, wrongNetwork, disabledConnect]);
7199
7482
  const onShowPortfolioSheet = () => {
@@ -7205,14 +7488,14 @@ var useTradingScript = () => {
7205
7488
  });
7206
7489
  }
7207
7490
  };
7208
- const horizontalDraggable = React11.useMemo(() => min3XL, [min3XL]);
7491
+ const horizontalDraggable = React12.useMemo(() => min3XL, [min3XL]);
7209
7492
  const positionsState = useOrderEntryPositions({
7210
7493
  canTrade,
7211
7494
  isFirstTimeDeposit
7212
7495
  });
7213
7496
  const marketsCollapseState = useMarketsCollapse({ resizeable: min3XL });
7214
7497
  const observerState = useObserverOrderEntry({ max2XL });
7215
- const marketsWidth = React11.useMemo(() => {
7498
+ const marketsWidth = React12.useMemo(() => {
7216
7499
  switch (marketsCollapseState.panelSize) {
7217
7500
  case "small":
7218
7501
  return 0;
@@ -7266,13 +7549,13 @@ var useTradingScript = () => {
7266
7549
  };
7267
7550
  var useMarketsCollapse = (options) => {
7268
7551
  const { resizeable } = options;
7269
- const [animating, setAnimating] = React11.useState(false);
7552
+ const [animating, setAnimating] = React12.useState(false);
7270
7553
  const [panelSize, setPanelSize] = hooks.useLocalStorage(ORDERLY_SIDE_MARKETS_MODE_KEY, "large");
7271
7554
  const onPanelSizeChange = (collapsed) => {
7272
7555
  setPanelSize(collapsed);
7273
7556
  setAnimating(true);
7274
7557
  };
7275
- const memoizedPanelSize = React11.useMemo(() => {
7558
+ const memoizedPanelSize = React12.useMemo(() => {
7276
7559
  const normalized = panelSize === "large" ? "large" : "middle";
7277
7560
  return resizeable ? normalized : "middle";
7278
7561
  }, [resizeable, panelSize]);
@@ -7307,11 +7590,11 @@ var useOrderEntryPositions = (options) => {
7307
7590
  }
7308
7591
  setPositions(pos2);
7309
7592
  };
7310
- const showPositionIcon = React11.useMemo(
7593
+ const showPositionIcon = React12.useMemo(
7311
7594
  () => canTrade && !isFirstTimeDeposit,
7312
7595
  [canTrade, isFirstTimeDeposit]
7313
7596
  );
7314
- const pos = React11.useMemo(() => {
7597
+ const pos = React12.useMemo(() => {
7315
7598
  return showPositionIcon ? positions : [0, 1, 2];
7316
7599
  }, [showPositionIcon, positions]);
7317
7600
  return {
@@ -7357,9 +7640,9 @@ var useSplitSize = (options) => {
7357
7640
  };
7358
7641
  var useObserverOrderEntry = (options) => {
7359
7642
  const { max2XL } = options;
7360
- const [orderEntryHeight, setOrderEntryHeight] = React11.useState(0);
7361
- const orderEntryViewRef = React11.useRef(null);
7362
- React11.useEffect(() => {
7643
+ const [orderEntryHeight, setOrderEntryHeight] = React12.useState(0);
7644
+ const orderEntryViewRef = React12.useRef(null);
7645
+ React12.useEffect(() => {
7363
7646
  const element = orderEntryViewRef.current;
7364
7647
  if (!element || !max2XL) {
7365
7648
  return;
@@ -7390,8 +7673,8 @@ function getOffsetSizeNum(size) {
7390
7673
  }
7391
7674
  function useExtraHeight(options) {
7392
7675
  const { tradindviewMaxHeight, dataListMinHeight } = options;
7393
- const tradingviewAndOrderbookSplitRef = React11.useRef(null);
7394
- const max2XLSplitRef = React11.useRef(null);
7676
+ const tradingviewAndOrderbookSplitRef = React12.useRef(null);
7677
+ const max2XLSplitRef = React12.useRef(null);
7395
7678
  const [extraHeight, setExtraHeight] = hooks.useLocalStorage(
7396
7679
  "orderly_order_entry_extra_height",
7397
7680
  0
@@ -7449,35 +7732,35 @@ function useExtraHeight(options) {
7449
7732
  dataListHeight
7450
7733
  };
7451
7734
  }
7452
- var LazyRiskRateWidget = React11__default.default.lazy(
7735
+ var LazyRiskRateWidget = React12__default.default.lazy(
7453
7736
  () => Promise.resolve().then(() => (init_riskRate(), riskRate_exports)).then((mod) => {
7454
7737
  return {
7455
7738
  default: mod.RiskRateWidget
7456
7739
  };
7457
7740
  })
7458
7741
  );
7459
- var LazyAssetViewWidget = React11__default.default.lazy(
7742
+ var LazyAssetViewWidget = React12__default.default.lazy(
7460
7743
  () => Promise.resolve().then(() => (init_assetView(), assetView_exports)).then((mod) => {
7461
7744
  return {
7462
7745
  default: mod.AssetViewWidget
7463
7746
  };
7464
7747
  })
7465
7748
  );
7466
- var LazyDataListWidget = React11__default.default.lazy(
7749
+ var LazyDataListWidget = React12__default.default.lazy(
7467
7750
  () => Promise.resolve().then(() => (init_dataList(), dataList_exports)).then((mod) => {
7468
7751
  return {
7469
7752
  default: mod.DataListWidget
7470
7753
  };
7471
7754
  })
7472
7755
  );
7473
- var LazySwitchLayout = React11__default.default.lazy(
7756
+ var LazySwitchLayout = React12__default.default.lazy(
7474
7757
  () => Promise.resolve().then(() => (init_switchLayout(), switchLayout_exports)).then((mod) => {
7475
7758
  return {
7476
7759
  default: mod.SwitchLayout
7477
7760
  };
7478
7761
  })
7479
7762
  );
7480
- var LazyOrderBookAndTradesWidget = React11__default.default.lazy(
7763
+ var LazyOrderBookAndTradesWidget = React12__default.default.lazy(
7481
7764
  () => Promise.resolve().then(() => (init_orderBookAndTrades(), orderBookAndTrades_exports)).then((mod) => {
7482
7765
  return {
7483
7766
  default: mod.OrderBookAndTradesWidget
@@ -7515,11 +7798,11 @@ var DesktopLayout3 = (props) => {
7515
7798
  dataListMinHeight
7516
7799
  } = props;
7517
7800
  const { showCountdown, closeCountdown } = useShowRwaCountdown(props.symbol);
7518
- const symbolInfoBarHeight2 = React11.useMemo(() => {
7801
+ const symbolInfoBarHeight2 = React12.useMemo(() => {
7519
7802
  return showCountdown ? 104 : 56;
7520
7803
  }, [showCountdown]);
7521
7804
  const { isRwa, open } = hooks.useGetRwaSymbolOpenStatus(props.symbol);
7522
- React11.useEffect(() => {
7805
+ React12.useEffect(() => {
7523
7806
  if (isRwa && !open) {
7524
7807
  showRwaOutsideMarketHoursNotify();
7525
7808
  }
@@ -7532,7 +7815,7 @@ var DesktopLayout3 = (props) => {
7532
7815
  types.OrderEntrySortKeys,
7533
7816
  ["margin", "assets", "orderEntry"]
7534
7817
  );
7535
- const dropAnimationConfig = React11.useMemo(() => {
7818
+ const dropAnimationConfig = React12.useMemo(() => {
7536
7819
  return {
7537
7820
  keyframes({
7538
7821
  transform
@@ -7578,7 +7861,7 @@ var DesktopLayout3 = (props) => {
7578
7861
  coordinateGetter: sortable.sortableKeyboardCoordinates
7579
7862
  })
7580
7863
  );
7581
- const [activeId, setActiveId] = React11.useState(null);
7864
+ const [activeId, setActiveId] = React12.useState(null);
7582
7865
  function handleDragStart(event) {
7583
7866
  setActiveId(event.active.id);
7584
7867
  }
@@ -7594,7 +7877,7 @@ var DesktopLayout3 = (props) => {
7594
7877
  }
7595
7878
  setActiveId(null);
7596
7879
  }
7597
- const minScreenHeight = React11.useMemo(() => {
7880
+ const minScreenHeight = React12.useMemo(() => {
7598
7881
  return tradingViewFullScreen ? 0 : symbolInfoBarHeight2 + orderbookMaxHeight + dataListInitialHeight + space * 4;
7599
7882
  }, [tradingViewFullScreen]);
7600
7883
  const minScreenHeightSM = topBarHeight + bottomBarHeight + symbolInfoBarHeight2 + tradindviewMinHeight + orderbookMinHeight + dataListMinHeight + space * 4;
@@ -7607,7 +7890,7 @@ var DesktopLayout3 = (props) => {
7607
7890
  dropdownPos: marketLayout === "bottom" ? "top" : "bottom"
7608
7891
  }
7609
7892
  );
7610
- const containerPaddingX = React11.useMemo(() => max2XL ? 12 : 8, [max2XL]);
7893
+ const containerPaddingX = React12.useMemo(() => max2XL ? 12 : 8, [max2XL]);
7611
7894
  const stickyHorizontalMarketsView = /* @__PURE__ */ jsxRuntime.jsx(
7612
7895
  ui.Box,
7613
7896
  {
@@ -7667,7 +7950,7 @@ var DesktopLayout3 = (props) => {
7667
7950
  onSymbolChange: props.onSymbolChange,
7668
7951
  closeCountdown,
7669
7952
  showCountdown,
7670
- trailing: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
7953
+ trailing: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
7671
7954
  LazySwitchLayout,
7672
7955
  {
7673
7956
  layout,
@@ -7709,7 +7992,7 @@ var DesktopLayout3 = (props) => {
7709
7992
  children: tradingviewWidget
7710
7993
  }
7711
7994
  );
7712
- const orderbookWidget = /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyOrderBookAndTradesWidget, { symbol: props.symbol }) });
7995
+ const orderbookWidget = /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyOrderBookAndTradesWidget, { symbol: props.symbol }) });
7713
7996
  const orderbookView = /* @__PURE__ */ jsxRuntime.jsx(
7714
7997
  ui.Box,
7715
7998
  {
@@ -7724,7 +8007,7 @@ var DesktopLayout3 = (props) => {
7724
8007
  children: orderbookWidget
7725
8008
  }
7726
8009
  );
7727
- const dataListWidget = /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
8010
+ const dataListWidget = /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
7728
8011
  LazyDataListWidget,
7729
8012
  {
7730
8013
  current: void 0,
@@ -7748,16 +8031,16 @@ var DesktopLayout3 = (props) => {
7748
8031
  children: dataListWidget
7749
8032
  }
7750
8033
  );
7751
- const orderInteractionWidgets = React11.useMemo(() => {
8034
+ const orderInteractionWidgets = React12.useMemo(() => {
7752
8035
  return {
7753
8036
  margin: {
7754
8037
  className: "",
7755
- element: /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyRiskRateWidget, {}) })
8038
+ element: /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyRiskRateWidget, {}) })
7756
8039
  },
7757
8040
  assets: {
7758
8041
  className: "oui-border oui-border-line-12",
7759
8042
  element: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7760
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
8043
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
7761
8044
  LazyAssetViewWidget,
7762
8045
  {
7763
8046
  isFirstTimeDeposit: props.isFirstTimeDeposit
@@ -8279,17 +8562,17 @@ function breakDownSeconds(total) {
8279
8562
  const secs = remAfterHours % SEC_PER_MIN;
8280
8563
  return [days, hours, mins, secs];
8281
8564
  }
8282
- var LazyTopTabWidget = React11__default.default.lazy(
8565
+ var LazyTopTabWidget = React12__default.default.lazy(
8283
8566
  () => Promise.resolve().then(() => (init_topTab(), topTab_exports)).then((mod) => {
8284
8567
  return { default: mod.TopTabWidget };
8285
8568
  })
8286
8569
  );
8287
- var LazyOrderBookAndEntryWidget = React11__default.default.lazy(
8570
+ var LazyOrderBookAndEntryWidget = React12__default.default.lazy(
8288
8571
  () => Promise.resolve().then(() => (init_orderBookAndEntry(), orderBookAndEntry_exports)).then((mod) => {
8289
8572
  return { default: mod.OrderBookAndEntryWidget };
8290
8573
  })
8291
8574
  );
8292
- var LazyDataListWidget2 = React11__default.default.lazy(
8575
+ var LazyDataListWidget2 = React12__default.default.lazy(
8293
8576
  () => Promise.resolve().then(() => (init_dataList2(), dataList_exports2)).then((mod) => {
8294
8577
  return { default: mod.DataListWidget };
8295
8578
  })
@@ -8317,12 +8600,12 @@ var MaybeEqual = () => {
8317
8600
  var MobileLayout3 = (props) => {
8318
8601
  const { t } = i18n.useTranslation();
8319
8602
  const { isRwa, open, closeTimeInterval } = hooks.useGetRwaSymbolInfo(props.symbol);
8320
- React11.useEffect(() => {
8603
+ React12.useEffect(() => {
8321
8604
  if (isRwa && !open) {
8322
8605
  showRwaOutsideMarketHoursNotify();
8323
8606
  }
8324
8607
  }, [isRwa, open, props.symbol]);
8325
- const rwaStatusBar = React11.useMemo(() => {
8608
+ const rwaStatusBar = React12.useMemo(() => {
8326
8609
  if (!isRwa) {
8327
8610
  return null;
8328
8611
  }
@@ -8438,9 +8721,9 @@ var MobileLayout3 = (props) => {
8438
8721
  ] });
8439
8722
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-relative oui-grid oui-gap-1 oui-bg-base-10", children: /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "oui-hide-scrollbar oui-space-y-1 oui-overflow-y-auto", children: [
8440
8723
  topBar,
8441
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyTopTabWidget, { className: "oui-mx-1 oui-rounded-xl oui-bg-base-9" }) }),
8442
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyOrderBookAndEntryWidget, {}) }),
8443
- /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
8724
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyTopTabWidget, { className: "oui-mx-1 oui-rounded-xl oui-bg-base-9" }) }),
8725
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(LazyOrderBookAndEntryWidget, {}) }),
8726
+ /* @__PURE__ */ jsxRuntime.jsx(React12__default.default.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
8444
8727
  LazyDataListWidget2,
8445
8728
  {
8446
8729
  symbol: props.symbol,
@@ -8474,7 +8757,7 @@ init_tradingPageContext();
8474
8757
  var TradingPageProvider = (props) => {
8475
8758
  const { symbol, children } = props;
8476
8759
  const symbolInfo = hooks.useSymbolsInfo()[symbol];
8477
- const memoizedValue = React11.useMemo(() => {
8760
+ const memoizedValue = React12.useMemo(() => {
8478
8761
  const basicSymbol = getBasicSymbolInfo(symbolInfo);
8479
8762
  return {
8480
8763
  ...props,
@@ -8520,5 +8803,5 @@ exports.TradingWidget = TradingWidget;
8520
8803
  exports.useBottomNavBarScript = useBottomNavBarScript;
8521
8804
  exports.usePortfolioSheetScript = usePortfolioSheetScript;
8522
8805
  exports.useTradingScript = useTradingScript;
8523
- //# sourceMappingURL=out.js.map
8806
+ //# sourceMappingURL=index.js.map
8524
8807
  //# sourceMappingURL=index.js.map