@gearbox-protocol/ui-kit 3.14.0-next.6 → 3.14.0-next.60

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.
Files changed (361) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/components/alert-badge/alert-badge.cjs +1 -1
  3. package/dist/cjs/components/app-bar/app-bar.cjs +1 -1
  4. package/dist/cjs/components/apy/apy.cjs +1 -1
  5. package/dist/cjs/components/assets-list-cell/assets-list-cell.cjs +1 -1
  6. package/dist/cjs/components/block-sync/block-sync.cjs +1 -1
  7. package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -0
  8. package/dist/cjs/components/block-sync-pill/block-sync-status.cjs +1 -0
  9. package/dist/cjs/components/block-sync-pill/index.cjs +1 -0
  10. package/dist/cjs/components/buttons/button/button.cjs +1 -1
  11. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  12. package/dist/cjs/components/client-adapters/styled-button/styled-button.cjs +1 -1
  13. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  14. package/dist/cjs/components/complex-input/complex-input.cjs +1 -1
  15. package/dist/cjs/components/composites/credit-account-history/body.cjs +1 -0
  16. package/dist/cjs/components/composites/credit-account-history/cells/details.cjs +1 -0
  17. package/dist/cjs/components/composites/credit-account-history/cells/hash.cjs +1 -0
  18. package/dist/cjs/components/composites/credit-account-history/cells/index.cjs +1 -0
  19. package/dist/cjs/components/composites/credit-account-history/cells/protocol.cjs +1 -0
  20. package/dist/cjs/components/composites/credit-account-history/cells/token-list.cjs +1 -0
  21. package/dist/cjs/components/composites/credit-account-history/credit-account-history.cjs +1 -0
  22. package/dist/cjs/components/composites/credit-account-history/index.cjs +1 -0
  23. package/dist/cjs/components/composites/credit-account-history/line.cjs +1 -0
  24. package/dist/cjs/components/composites/credit-account-history/types.cjs +1 -0
  25. package/dist/cjs/components/composites/index.cjs +1 -1
  26. package/dist/cjs/components/composites/notification-center/index.cjs +1 -0
  27. package/dist/cjs/components/composites/notification-center/notification-center.cjs +1 -0
  28. package/dist/cjs/components/composites/notification-center/types.cjs +1 -0
  29. package/dist/cjs/components/composites/pool-table/columns.cjs +1 -1
  30. package/dist/cjs/components/composites/tx-preview/components/AddressAvatar.cjs +1 -0
  31. package/dist/cjs/components/composites/tx-preview/components/AddressParty.cjs +1 -0
  32. package/dist/cjs/components/composites/tx-preview/components/AddressRow.cjs +1 -0
  33. package/dist/cjs/components/composites/tx-preview/components/AmountRow.cjs +1 -0
  34. package/dist/cjs/components/composites/tx-preview/components/CollapsibleCard.cjs +1 -0
  35. package/dist/cjs/components/composites/tx-preview/components/SectionDivider.cjs +1 -0
  36. package/dist/cjs/components/composites/tx-preview/components/TransferList.cjs +1 -0
  37. package/dist/cjs/components/composites/tx-preview/components/TransferRow.cjs +1 -0
  38. package/dist/cjs/components/composites/tx-preview/components/addressLabel.cjs +1 -0
  39. package/dist/cjs/components/composites/tx-preview/components/index.cjs +1 -0
  40. package/dist/cjs/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.cjs +1 -0
  41. package/dist/cjs/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountPair.cjs +1 -0
  42. package/dist/cjs/components/composites/tx-preview/confirm/amounts/constants.cjs +1 -0
  43. package/dist/cjs/components/composites/tx-preview/confirm/amounts/index.cjs +1 -0
  44. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmDialogView.cjs +1 -0
  45. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.cjs +1 -0
  46. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -0
  47. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.constants.cjs +1 -0
  48. package/dist/cjs/components/composites/tx-preview/confirm/dialog/computeTransactionConfirmDialogLayout.cjs +1 -0
  49. package/dist/cjs/components/composites/tx-preview/confirm/dialog/constants.cjs +1 -0
  50. package/dist/cjs/components/composites/tx-preview/confirm/dialog/index.cjs +1 -0
  51. package/dist/cjs/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.cjs +1 -0
  52. package/dist/cjs/components/composites/tx-preview/confirm/dialog/useTransactionConfirmDialog.cjs +1 -0
  53. package/dist/cjs/components/composites/tx-preview/confirm/execution/TransactionConfirmExecuteButton.cjs +1 -0
  54. package/dist/cjs/components/composites/tx-preview/confirm/execution/index.cjs +1 -0
  55. package/dist/cjs/components/composites/tx-preview/confirm/index.cjs +1 -0
  56. package/dist/cjs/components/composites/tx-preview/confirm/preview/OperationPreviewContent.cjs +1 -0
  57. package/dist/cjs/components/composites/tx-preview/confirm/preview/index.cjs +1 -0
  58. package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.cjs +1 -0
  59. package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessIcon.cjs +1 -0
  60. package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.cjs +1 -0
  61. package/dist/cjs/components/composites/tx-preview/confirm/result/TransactionConfirmTxHashRow.cjs +1 -0
  62. package/dist/cjs/components/composites/tx-preview/confirm/result/constants.cjs +1 -0
  63. package/dist/cjs/components/composites/tx-preview/confirm/result/index.cjs +1 -0
  64. package/dist/cjs/components/composites/tx-preview/confirm/stepper/ProgressStepper.cjs +1 -0
  65. package/dist/cjs/components/composites/tx-preview/confirm/stepper/TransactionProgressStepper.cjs +1 -0
  66. package/dist/cjs/components/composites/tx-preview/confirm/stepper/constants.cjs +1 -0
  67. package/dist/cjs/components/composites/tx-preview/confirm/stepper/index.cjs +1 -0
  68. package/dist/cjs/components/composites/tx-preview/confirm/stepper/transactionExecutionStepTypes.cjs +1 -0
  69. package/dist/cjs/components/composites/tx-preview/confirm/summary/PoolOperationConfirmDetails.cjs +1 -0
  70. package/dist/cjs/components/composites/tx-preview/confirm/summary/constants.cjs +1 -0
  71. package/dist/cjs/components/composites/tx-preview/confirm/summary/index.cjs +1 -0
  72. package/dist/cjs/components/composites/tx-preview/index.cjs +1 -0
  73. package/dist/cjs/components/composites/tx-preview/operations/OperationBody.cjs +1 -0
  74. package/dist/cjs/components/composites/tx-preview/operations/OperationsCard.cjs +1 -0
  75. package/dist/cjs/components/composites/tx-preview/operations/PoolDepositView.cjs +1 -0
  76. package/dist/cjs/components/composites/tx-preview/operations/PoolRow.cjs +1 -0
  77. package/dist/cjs/components/composites/tx-preview/operations/PoolWithdrawView.cjs +1 -0
  78. package/dist/cjs/components/composites/tx-preview/operations/index.cjs +1 -0
  79. package/dist/cjs/components/composites/tx-preview/state-change/BalanceChangeGroup.cjs +1 -0
  80. package/dist/cjs/components/composites/tx-preview/state-change/BalanceChangeRow.cjs +1 -0
  81. package/dist/cjs/components/composites/tx-preview/state-change/PoolStateChangeCard.cjs +1 -0
  82. package/dist/cjs/components/composites/tx-preview/state-change/StateChangeCard.cjs +1 -0
  83. package/dist/cjs/components/composites/tx-preview/state-change/index.cjs +1 -0
  84. package/dist/cjs/components/composites/tx-preview/types.cjs +1 -0
  85. package/dist/cjs/components/composites/tx-preview/utils/addressLabels.cjs +1 -0
  86. package/dist/cjs/components/composites/tx-preview/utils/index.cjs +1 -0
  87. package/dist/cjs/components/composites/tx-preview/utils/poolTokenInfo.cjs +1 -0
  88. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  89. package/dist/cjs/components/confirm-menu/confirm-menu.cjs +1 -1
  90. package/dist/cjs/components/detailed-page-title/detailed-page-title.cjs +1 -1
  91. package/dist/cjs/components/graph/formatters.cjs +1 -1
  92. package/dist/cjs/components/graph/graph.cjs +1 -1
  93. package/dist/cjs/components/graph/index.cjs +1 -1
  94. package/dist/cjs/components/health-factor/health-factor.cjs +1 -1
  95. package/dist/cjs/components/index.cjs +1 -1
  96. package/dist/cjs/components/layout/app-footer/app-footer.cjs +1 -0
  97. package/dist/cjs/components/layout/app-footer/index.cjs +1 -0
  98. package/dist/cjs/components/layout/app-header/app-header.cjs +1 -0
  99. package/dist/cjs/components/layout/app-header/index.cjs +1 -0
  100. package/dist/cjs/components/layout/index.cjs +1 -1
  101. package/dist/cjs/components/layout/main-aside-layout/main-aside-layout.cjs +1 -1
  102. package/dist/cjs/components/legal-agreement/index.cjs +1 -1
  103. package/dist/cjs/components/legal-agreement/legal-agreement-awaiting-panel.cjs +1 -0
  104. package/dist/cjs/components/legal-agreement/legal-agreement-dialog.cjs +1 -1
  105. package/dist/cjs/components/legal-agreement/legal-agreement-link.cjs +1 -0
  106. package/dist/cjs/components/legal-agreement/legal-agreement-panel.cjs +1 -0
  107. package/dist/cjs/components/legal-agreement/legal-agreement-theme.cjs +1 -0
  108. package/dist/cjs/components/legal-agreement/legal-agreement.stories-config.cjs +1 -0
  109. package/dist/cjs/components/link/link.cjs +1 -1
  110. package/dist/cjs/components/loader-guard/loader-guard.cjs +1 -1
  111. package/dist/cjs/components/markdown-viewer/markdown-viewer.cjs +1 -1
  112. package/dist/cjs/components/segmented-control/segmented-control.cjs +1 -1
  113. package/dist/cjs/components/smart-number-input/smart-number-input.cjs +1 -1
  114. package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
  115. package/dist/cjs/components/time-to-liquidation/time-to-liquidation.cjs +1 -1
  116. package/dist/cjs/components/token-template/token-template.cjs +1 -1
  117. package/dist/cjs/components/tokens-list-cell/tokens-list-cell.cjs +1 -1
  118. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  119. package/dist/cjs/components/vertical-indicator/vertical-indicator.cjs +1 -1
  120. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  121. package/dist/cjs/configs/tailwind-preset.cjs +1 -1
  122. package/dist/cjs/hooks/index.cjs +1 -1
  123. package/dist/cjs/hooks/use-filter.cjs +1 -1
  124. package/dist/cjs/index.cjs +1 -1
  125. package/dist/cjs/locale/en.json.cjs +1 -1
  126. package/dist/cjs/test-ids/index.cjs +1 -1
  127. package/dist/cjs/test-ids/notification-center.cjs +1 -0
  128. package/dist/esm/components/alert-badge/alert-badge.js +12 -10
  129. package/dist/esm/components/app-bar/app-bar.js +1 -1
  130. package/dist/esm/components/apy/apy.js +9 -9
  131. package/dist/esm/components/assets-list-cell/assets-list-cell.js +9 -5
  132. package/dist/esm/components/block-sync/block-sync.js +9 -5
  133. package/dist/esm/components/block-sync-pill/block-sync-pill.js +241 -0
  134. package/dist/esm/components/block-sync-pill/block-sync-status.js +12 -0
  135. package/dist/esm/components/block-sync-pill/index.js +4 -0
  136. package/dist/esm/components/buttons/button/button.js +1 -0
  137. package/dist/esm/components/checkbox/checkbox-labeled.js +7 -3
  138. package/dist/esm/components/client-adapters/styled-button/styled-button.js +11 -11
  139. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -3
  140. package/dist/esm/components/complex-input/complex-input.js +9 -5
  141. package/dist/esm/components/composites/credit-account-history/body.js +73 -0
  142. package/dist/esm/components/composites/credit-account-history/cells/details.js +22 -0
  143. package/dist/esm/components/composites/credit-account-history/cells/hash.js +24 -0
  144. package/dist/esm/components/composites/credit-account-history/cells/index.js +10 -0
  145. package/dist/esm/components/composites/credit-account-history/cells/protocol.js +25 -0
  146. package/dist/esm/components/composites/credit-account-history/cells/token-list.js +43 -0
  147. package/dist/esm/components/composites/credit-account-history/credit-account-history.js +46 -0
  148. package/dist/esm/components/composites/credit-account-history/index.js +8 -0
  149. package/dist/esm/components/composites/credit-account-history/line.js +125 -0
  150. package/dist/esm/components/composites/credit-account-history/types.js +9 -0
  151. package/dist/esm/components/composites/index.js +87 -79
  152. package/dist/esm/components/composites/notification-center/index.js +4 -0
  153. package/dist/esm/components/composites/notification-center/notification-center.js +208 -0
  154. package/dist/esm/components/composites/notification-center/types.js +1 -0
  155. package/dist/esm/components/composites/pool-table/columns.js +49 -45
  156. package/dist/esm/components/composites/tx-preview/components/AddressAvatar.js +47 -0
  157. package/dist/esm/components/composites/tx-preview/components/AddressParty.js +17 -0
  158. package/dist/esm/components/composites/tx-preview/components/AddressRow.js +16 -0
  159. package/dist/esm/components/composites/tx-preview/components/AmountRow.js +30 -0
  160. package/dist/esm/components/composites/tx-preview/components/CollapsibleCard.js +45 -0
  161. package/dist/esm/components/composites/tx-preview/components/SectionDivider.js +12 -0
  162. package/dist/esm/components/composites/tx-preview/components/TransferList.js +25 -0
  163. package/dist/esm/components/composites/tx-preview/components/TransferRow.js +52 -0
  164. package/dist/esm/components/composites/tx-preview/components/addressLabel.js +7 -0
  165. package/dist/esm/components/composites/tx-preview/components/index.js +20 -0
  166. package/dist/esm/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.js +233 -0
  167. package/dist/esm/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountPair.js +63 -0
  168. package/dist/esm/components/composites/tx-preview/confirm/amounts/constants.js +10 -0
  169. package/dist/esm/components/composites/tx-preview/confirm/amounts/index.js +9 -0
  170. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmDialogView.js +50 -0
  171. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.js +70 -0
  172. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.constants.js +6 -0
  173. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +93 -0
  174. package/dist/esm/components/composites/tx-preview/confirm/dialog/computeTransactionConfirmDialogLayout.js +35 -0
  175. package/dist/esm/components/composites/tx-preview/confirm/dialog/constants.js +23 -0
  176. package/dist/esm/components/composites/tx-preview/confirm/dialog/index.js +20 -0
  177. package/dist/esm/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.js +1 -0
  178. package/dist/esm/components/composites/tx-preview/confirm/dialog/useTransactionConfirmDialog.js +20 -0
  179. package/dist/esm/components/composites/tx-preview/confirm/execution/TransactionConfirmExecuteButton.js +30 -0
  180. package/dist/esm/components/composites/tx-preview/confirm/execution/index.js +4 -0
  181. package/dist/esm/components/composites/tx-preview/confirm/index.js +57 -0
  182. package/dist/esm/components/composites/tx-preview/confirm/preview/OperationPreviewContent.js +195 -0
  183. package/dist/esm/components/composites/tx-preview/confirm/preview/index.js +4 -0
  184. package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.js +55 -0
  185. package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessIcon.js +25 -0
  186. package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.js +60 -0
  187. package/dist/esm/components/composites/tx-preview/confirm/result/TransactionConfirmTxHashRow.js +21 -0
  188. package/dist/esm/components/composites/tx-preview/confirm/result/constants.js +24 -0
  189. package/dist/esm/components/composites/tx-preview/confirm/result/index.js +15 -0
  190. package/dist/esm/components/composites/tx-preview/confirm/stepper/ProgressStepper.js +100 -0
  191. package/dist/esm/components/composites/tx-preview/confirm/stepper/TransactionProgressStepper.js +67 -0
  192. package/dist/esm/components/composites/tx-preview/confirm/stepper/constants.js +10 -0
  193. package/dist/esm/components/composites/tx-preview/confirm/stepper/index.js +11 -0
  194. package/dist/esm/components/composites/tx-preview/confirm/stepper/transactionExecutionStepTypes.js +6 -0
  195. package/dist/esm/components/composites/tx-preview/confirm/summary/PoolOperationConfirmDetails.js +65 -0
  196. package/dist/esm/components/composites/tx-preview/confirm/summary/constants.js +6 -0
  197. package/dist/esm/components/composites/tx-preview/confirm/summary/index.js +6 -0
  198. package/dist/esm/components/composites/tx-preview/index.js +98 -0
  199. package/dist/esm/components/composites/tx-preview/operations/OperationBody.js +10 -0
  200. package/dist/esm/components/composites/tx-preview/operations/OperationsCard.js +195 -0
  201. package/dist/esm/components/composites/tx-preview/operations/PoolDepositView.js +204 -0
  202. package/dist/esm/components/composites/tx-preview/operations/PoolRow.js +20 -0
  203. package/dist/esm/components/composites/tx-preview/operations/PoolWithdrawView.js +198 -0
  204. package/dist/esm/components/composites/tx-preview/operations/index.js +13 -0
  205. package/dist/esm/components/composites/tx-preview/state-change/BalanceChangeGroup.js +185 -0
  206. package/dist/esm/components/composites/tx-preview/state-change/BalanceChangeRow.js +61 -0
  207. package/dist/esm/components/composites/tx-preview/state-change/PoolStateChangeCard.js +23 -0
  208. package/dist/esm/components/composites/tx-preview/state-change/StateChangeCard.js +200 -0
  209. package/dist/esm/components/composites/tx-preview/state-change/index.js +10 -0
  210. package/dist/esm/components/composites/tx-preview/types.js +1 -0
  211. package/dist/esm/components/composites/tx-preview/utils/addressLabels.js +41 -0
  212. package/dist/esm/components/composites/tx-preview/utils/index.js +6 -0
  213. package/dist/esm/components/composites/tx-preview/utils/poolTokenInfo.js +12 -0
  214. package/dist/esm/components/compound-apy/compound-apy.js +9 -5
  215. package/dist/esm/components/confirm-menu/confirm-menu.js +28 -25
  216. package/dist/esm/components/detailed-page-title/detailed-page-title.js +7 -3
  217. package/dist/esm/components/graph/formatters.js +128 -132
  218. package/dist/esm/components/graph/graph.js +744 -389
  219. package/dist/esm/components/graph/index.js +26 -24
  220. package/dist/esm/components/health-factor/health-factor.js +27 -26
  221. package/dist/esm/components/index.js +750 -717
  222. package/dist/esm/components/layout/app-footer/app-footer.js +54 -0
  223. package/dist/esm/components/layout/app-footer/index.js +5 -0
  224. package/dist/esm/components/layout/app-header/app-header.js +100 -0
  225. package/dist/esm/components/layout/app-header/index.js +4 -0
  226. package/dist/esm/components/layout/index.js +32 -27
  227. package/dist/esm/components/layout/main-aside-layout/main-aside-layout.js +107 -58
  228. package/dist/esm/components/legal-agreement/index.js +23 -7
  229. package/dist/esm/components/legal-agreement/legal-agreement-awaiting-panel.js +29 -0
  230. package/dist/esm/components/legal-agreement/legal-agreement-dialog.js +72 -212
  231. package/dist/esm/components/legal-agreement/legal-agreement-link.js +22 -0
  232. package/dist/esm/components/legal-agreement/legal-agreement-panel.js +130 -0
  233. package/dist/esm/components/legal-agreement/legal-agreement-theme.js +137 -0
  234. package/dist/esm/components/legal-agreement/legal-agreement.stories-config.js +170 -0
  235. package/dist/esm/components/link/link.js +42 -35
  236. package/dist/esm/components/loader-guard/loader-guard.js +7 -5
  237. package/dist/esm/components/markdown-viewer/markdown-viewer.js +9 -5
  238. package/dist/esm/components/segmented-control/segmented-control.js +21 -21
  239. package/dist/esm/components/smart-number-input/smart-number-input.js +33 -29
  240. package/dist/esm/components/tab-control/tab-control.js +1 -1
  241. package/dist/esm/components/time-to-liquidation/time-to-liquidation.js +7 -3
  242. package/dist/esm/components/token-template/token-template.js +17 -17
  243. package/dist/esm/components/tokens-list-cell/tokens-list-cell.js +9 -5
  244. package/dist/esm/components/trading-view/trading-view.js +164 -147
  245. package/dist/esm/components/vertical-indicator/vertical-indicator.js +39 -33
  246. package/dist/esm/components/with-copy/with-copy.js +9 -5
  247. package/dist/esm/configs/tailwind-preset.js +1 -0
  248. package/dist/esm/hooks/index.js +50 -47
  249. package/dist/esm/hooks/use-filter.js +63 -29
  250. package/dist/esm/index.js +932 -894
  251. package/dist/esm/locale/en.json.js +10 -0
  252. package/dist/esm/test-ids/index.js +14 -12
  253. package/dist/esm/test-ids/notification-center.js +16 -0
  254. package/dist/globals.css +1 -1
  255. package/dist/types/components/alert-badge/alert-badge.d.ts +1 -1
  256. package/dist/types/components/block-sync-pill/block-sync-pill.d.ts +35 -0
  257. package/dist/types/components/block-sync-pill/block-sync-status.d.ts +29 -0
  258. package/dist/types/components/block-sync-pill/index.d.ts +1 -0
  259. package/dist/types/components/buttons/button/button.d.ts +4 -3
  260. package/dist/types/components/composites/credit-account-history/body.d.ts +14 -0
  261. package/dist/types/components/composites/credit-account-history/cells/details.d.ts +9 -0
  262. package/dist/types/components/composites/credit-account-history/cells/hash.d.ts +6 -0
  263. package/dist/types/components/composites/credit-account-history/cells/index.d.ts +4 -0
  264. package/dist/types/components/composites/credit-account-history/cells/protocol.d.ts +7 -0
  265. package/dist/types/components/composites/credit-account-history/cells/token-list.d.ts +9 -0
  266. package/dist/types/components/composites/credit-account-history/credit-account-history.d.ts +15 -0
  267. package/dist/types/components/composites/credit-account-history/index.d.ts +2 -0
  268. package/dist/types/components/composites/credit-account-history/line.d.ts +18 -0
  269. package/dist/types/components/composites/credit-account-history/types.d.ts +36 -0
  270. package/dist/types/components/composites/index.d.ts +2 -0
  271. package/dist/types/components/composites/notification-center/index.d.ts +2 -0
  272. package/dist/types/components/composites/notification-center/notification-center.d.ts +9 -0
  273. package/dist/types/components/composites/notification-center/types.d.ts +31 -0
  274. package/dist/types/components/composites/tx-preview/components/AddressAvatar.d.ts +12 -0
  275. package/dist/types/components/composites/tx-preview/components/AddressParty.d.ts +14 -0
  276. package/dist/types/components/composites/tx-preview/components/AddressRow.d.ts +7 -0
  277. package/dist/types/components/composites/tx-preview/components/AmountRow.d.ts +15 -0
  278. package/dist/types/components/composites/tx-preview/components/CollapsibleCard.d.ts +22 -0
  279. package/dist/types/components/composites/tx-preview/components/SectionDivider.d.ts +10 -0
  280. package/dist/types/components/composites/tx-preview/components/TransferList.d.ts +19 -0
  281. package/dist/types/components/composites/tx-preview/components/TransferRow.d.ts +30 -0
  282. package/dist/types/components/composites/tx-preview/components/addressLabel.d.ts +27 -0
  283. package/dist/types/components/composites/tx-preview/components/index.d.ts +9 -0
  284. package/dist/types/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountField.d.ts +29 -0
  285. package/dist/types/components/composites/tx-preview/confirm/amounts/TransactionConfirmAmountPair.d.ts +16 -0
  286. package/dist/types/components/composites/tx-preview/confirm/amounts/constants.d.ts +6 -0
  287. package/dist/types/components/composites/tx-preview/confirm/amounts/index.d.ts +3 -0
  288. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmDialogView.d.ts +24 -0
  289. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.d.ts +23 -0
  290. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.constants.d.ts +3 -0
  291. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.d.ts +19 -0
  292. package/dist/types/components/composites/tx-preview/confirm/dialog/computeTransactionConfirmDialogLayout.d.ts +8 -0
  293. package/dist/types/components/composites/tx-preview/confirm/dialog/constants.d.ts +17 -0
  294. package/dist/types/components/composites/tx-preview/confirm/dialog/index.d.ts +8 -0
  295. package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.d.ts +4 -0
  296. package/dist/types/components/composites/tx-preview/confirm/dialog/useTransactionConfirmDialog.d.ts +8 -0
  297. package/dist/types/components/composites/tx-preview/confirm/execution/TransactionConfirmExecuteButton.d.ts +6 -0
  298. package/dist/types/components/composites/tx-preview/confirm/execution/index.d.ts +1 -0
  299. package/dist/types/components/composites/tx-preview/confirm/index.d.ts +7 -0
  300. package/dist/types/components/composites/tx-preview/confirm/preview/OperationPreviewContent.d.ts +12 -0
  301. package/dist/types/components/composites/tx-preview/confirm/preview/index.d.ts +1 -0
  302. package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmFailureResult.d.ts +8 -0
  303. package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessIcon.d.ts +2 -0
  304. package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmSuccessResult.d.ts +8 -0
  305. package/dist/types/components/composites/tx-preview/confirm/result/TransactionConfirmTxHashRow.d.ts +6 -0
  306. package/dist/types/components/composites/tx-preview/confirm/result/constants.d.ts +18 -0
  307. package/dist/types/components/composites/tx-preview/confirm/result/index.d.ts +5 -0
  308. package/dist/types/components/composites/tx-preview/confirm/stepper/ProgressStepper.d.ts +29 -0
  309. package/dist/types/components/composites/tx-preview/confirm/stepper/TransactionProgressStepper.d.ts +7 -0
  310. package/dist/types/components/composites/tx-preview/confirm/stepper/constants.d.ts +6 -0
  311. package/dist/types/components/composites/tx-preview/confirm/stepper/index.d.ts +4 -0
  312. package/dist/types/components/composites/tx-preview/confirm/stepper/transactionExecutionStepTypes.d.ts +10 -0
  313. package/dist/types/components/composites/tx-preview/confirm/summary/PoolOperationConfirmDetails.d.ts +15 -0
  314. package/dist/types/components/composites/tx-preview/confirm/summary/constants.d.ts +3 -0
  315. package/dist/types/components/composites/tx-preview/confirm/summary/index.d.ts +2 -0
  316. package/dist/types/components/composites/tx-preview/index.d.ts +17 -0
  317. package/dist/types/components/composites/tx-preview/operations/OperationBody.d.ts +15 -0
  318. package/dist/types/components/composites/tx-preview/operations/OperationsCard.d.ts +21 -0
  319. package/dist/types/components/composites/tx-preview/operations/PoolDepositView.d.ts +11 -0
  320. package/dist/types/components/composites/tx-preview/operations/PoolRow.d.ts +8 -0
  321. package/dist/types/components/composites/tx-preview/operations/PoolWithdrawView.d.ts +11 -0
  322. package/dist/types/components/composites/tx-preview/operations/index.d.ts +5 -0
  323. package/dist/types/components/composites/tx-preview/state-change/BalanceChangeGroup.d.ts +11 -0
  324. package/dist/types/components/composites/tx-preview/state-change/BalanceChangeRow.d.ts +14 -0
  325. package/dist/types/components/composites/tx-preview/state-change/PoolStateChangeCard.d.ts +18 -0
  326. package/dist/types/components/composites/tx-preview/state-change/StateChangeCard.d.ts +21 -0
  327. package/dist/types/components/composites/tx-preview/state-change/index.d.ts +4 -0
  328. package/dist/types/components/composites/tx-preview/types.d.ts +19 -0
  329. package/dist/types/components/composites/tx-preview/utils/addressLabels.d.ts +16 -0
  330. package/dist/types/components/composites/tx-preview/utils/index.d.ts +2 -0
  331. package/dist/types/components/composites/tx-preview/utils/poolTokenInfo.d.ts +14 -0
  332. package/dist/types/components/confirm-menu/confirm-menu.d.ts +4 -2
  333. package/dist/types/components/graph/graph.d.ts +112 -2
  334. package/dist/types/components/graph/index.d.ts +1 -1
  335. package/dist/types/components/health-factor/health-factor.d.ts +6 -3
  336. package/dist/types/components/index.d.ts +1 -0
  337. package/dist/types/components/layout/app-footer/app-footer.d.ts +62 -0
  338. package/dist/types/components/layout/app-footer/index.d.ts +1 -0
  339. package/dist/types/components/layout/app-header/app-header.d.ts +67 -0
  340. package/dist/types/components/layout/app-header/index.d.ts +1 -0
  341. package/dist/types/components/layout/index.d.ts +2 -0
  342. package/dist/types/components/layout/main-aside-layout/main-aside-layout.d.ts +42 -0
  343. package/dist/types/components/legal-agreement/index.d.ts +5 -1
  344. package/dist/types/components/legal-agreement/legal-agreement-awaiting-panel.d.ts +10 -0
  345. package/dist/types/components/legal-agreement/legal-agreement-dialog.d.ts +19 -52
  346. package/dist/types/components/legal-agreement/legal-agreement-link.d.ts +11 -0
  347. package/dist/types/components/legal-agreement/legal-agreement-panel.d.ts +16 -0
  348. package/dist/types/components/legal-agreement/legal-agreement-theme.d.ts +36 -0
  349. package/dist/types/components/legal-agreement/legal-agreement.stories-config.d.ts +11 -0
  350. package/dist/types/components/trading-view/trading-view.d.ts +15 -1
  351. package/dist/types/components/vertical-indicator/vertical-indicator.d.ts +6 -0
  352. package/dist/types/configs/tailwind-preset.d.ts +1 -0
  353. package/dist/types/hooks/use-filter.d.ts +46 -0
  354. package/dist/types/index.d.ts +2 -0
  355. package/dist/types/locale/en.json.d.ts +13 -0
  356. package/dist/types/test-ids/index.d.ts +1 -0
  357. package/dist/types/test-ids/notification-center.d.ts +13 -0
  358. package/dist/types/types/footer.d.ts +24 -3
  359. package/package.json +17 -4
  360. package/src/styles/base.css +2 -0
  361. package/src/styles/theme.css +1 -0
@@ -1,30 +1,161 @@
1
- import { jsxs as K, jsx as p } from "react/jsx-runtime";
2
- import { createChart as We, CrosshairMode as Ye, AreaSeries as Ge } from "lightweight-charts";
3
- import * as fe from "react";
4
- import { useRef as L, useState as de, useEffect as $ } from "react";
5
- import { useIsMobile as Be } from "../../hooks/use-media-query.js";
6
- import { cn as he } from "../../utils/cn.js";
7
- import { resolveCSSColor as Me, generateColorsFromBase as ee, hslToHex as je } from "../../utils/colors.js";
8
- import { getDefaultOptions as Pe, getDefaultSeries as He, getDefaultVerticalLine as _e } from "./default-config.js";
9
- import { getXFormatters as Te, createAdaptiveYAxisFormatter as Xe, formatExactValue as ge } from "./formatters.js";
10
- import { GraphCurrentValue as qe } from "./graph-current-value.js";
11
- import { GraphTooltip as Ke } from "./graph-tooltip.js";
12
- import { VertLine as Je } from "./plugins/vertical-line.js";
13
- function Qe(t, v, u) {
14
- const D = t.labelText ?? "", g = t.value, N = g === void 0 ? "" : typeof g == "number" ? v === "$" ? `$${ge(g, void 0, u)}` : v === "%" ? `${ge(g, void 0, u)}%` : ge(
15
- g,
16
- v !== "none" && v !== "%" && v !== "$" ? v : void 0,
1
+ import { jsxs as le, jsx as w } from "react/jsx-runtime";
2
+ import { createChart as at, CrosshairMode as st, LineStyle as te, LineSeries as ct, AreaSeries as ut } from "lightweight-charts";
3
+ import * as xe from "react";
4
+ import { useRef as H, useState as U, useEffect as $, useLayoutEffect as ft } from "react";
5
+ import { useIsMobile as ht } from "../../hooks/use-media-query.js";
6
+ import { cn as ie } from "../../utils/cn.js";
7
+ import { resolveCSSColor as ee, generateColorsFromBase as fe, hslToHex as dt } from "../../utils/colors.js";
8
+ import { getDefaultOptions as Xe, getDefaultSeries as mt, getDefaultVerticalLine as pt } from "./default-config.js";
9
+ import { getXFormatters as qe, formatExactValue as we, createAdaptiveYAxisFormatter as gt } from "./formatters.js";
10
+ import { GraphCurrentValue as bt } from "./graph-current-value.js";
11
+ import { GraphTooltip as vt } from "./graph-tooltip.js";
12
+ import { VertLine as Ct } from "./plugins/vertical-line.js";
13
+ class St {
14
+ _yTop;
15
+ _yBottom;
16
+ _color;
17
+ constructor(l, u, c) {
18
+ this._yTop = l, this._yBottom = u, this._color = c;
19
+ }
20
+ draw(l) {
21
+ l.useBitmapCoordinateSpace((u) => {
22
+ const c = u.context, h = u.verticalPixelRatio, b = this._yTop === null ? 0 : this._yTop * h, L = this._yBottom === null ? u.bitmapSize.height : this._yBottom * h, y = Math.min(b, L), k = Math.max(b, L);
23
+ c.fillStyle = this._color, c.fillRect(0, y, u.bitmapSize.width, k - y);
24
+ });
25
+ }
26
+ }
27
+ class yt {
28
+ _source;
29
+ _yTop = null;
30
+ _yBottom = null;
31
+ constructor(l) {
32
+ this._source = l;
33
+ }
34
+ update() {
35
+ const l = this._source.series;
36
+ this._yTop = this._source.priceTop === void 0 ? null : l.priceToCoordinate(this._source.priceTop), this._yBottom = this._source.priceBottom === void 0 ? null : l.priceToCoordinate(this._source.priceBottom);
37
+ }
38
+ /** Draw beneath the series line/area so the data stays readable. */
39
+ zOrder() {
40
+ return "bottom";
41
+ }
42
+ renderer() {
43
+ return new St(this._yTop, this._yBottom, this._source.color);
44
+ }
45
+ }
46
+ class xt {
47
+ series;
48
+ priceTop;
49
+ priceBottom;
50
+ color;
51
+ _paneViews;
52
+ constructor(l, u, c, h) {
53
+ this.series = l, this.priceTop = u, this.priceBottom = c, this.color = h, this._paneViews = [new yt(this)];
54
+ }
55
+ updateAllViews() {
56
+ for (const l of this._paneViews) l.update();
57
+ }
58
+ paneViews() {
59
+ return this._paneViews;
60
+ }
61
+ }
62
+ function wt(o, l) {
63
+ switch (o) {
64
+ case te.Dotted:
65
+ return [l, l];
66
+ case te.Dashed:
67
+ return [2 * l, 2 * l];
68
+ case te.LargeDashed:
69
+ return [6 * l, 6 * l];
70
+ case te.SparseDotted:
71
+ return [l, 4 * l];
72
+ default:
73
+ return [];
74
+ }
75
+ }
76
+ class _t {
77
+ _y;
78
+ _color;
79
+ _lineWidth;
80
+ _lineStyle;
81
+ constructor(l, u, c, h) {
82
+ this._y = l, this._color = u, this._lineWidth = c, this._lineStyle = h;
83
+ }
84
+ draw(l) {
85
+ l.useBitmapCoordinateSpace((u) => {
86
+ if (this._y === null) return;
87
+ const c = u.context, h = u.verticalPixelRatio, b = Math.max(1, Math.round(this._lineWidth * h)), L = Math.round(this._y * h);
88
+ c.save(), c.strokeStyle = this._color, c.lineWidth = b, c.setLineDash(wt(this._lineStyle, b)), c.beginPath(), c.moveTo(0, L), c.lineTo(u.bitmapSize.width, L), c.stroke(), c.restore();
89
+ });
90
+ }
91
+ }
92
+ class Nt {
93
+ _source;
94
+ _y = null;
95
+ constructor(l) {
96
+ this._source = l;
97
+ }
98
+ update() {
99
+ this._y = this._source.series.priceToCoordinate(this._source.price);
100
+ }
101
+ /**
102
+ * Draw on the top pane (top canvas) so a liquidation price line stays above
103
+ * every series' area/line fill, price zones and the crosshair — native
104
+ * `createPriceLine` only draws in the "normal" group and can be hidden behind
105
+ * a later series in multi-series charts.
106
+ */
107
+ zOrder() {
108
+ return "top";
109
+ }
110
+ renderer() {
111
+ return new _t(
112
+ this._y,
113
+ this._source.color,
114
+ this._source.lineWidth,
115
+ this._source.lineStyle
116
+ );
117
+ }
118
+ }
119
+ class Tt {
120
+ series;
121
+ price;
122
+ color;
123
+ lineWidth;
124
+ lineStyle;
125
+ _paneViews;
126
+ constructor(l, u, c, h, b) {
127
+ this.series = l, this.price = u, this.color = c, this.lineWidth = h, this.lineStyle = b, this._paneViews = [new Nt(this)];
128
+ }
129
+ updateAllViews() {
130
+ for (const l of this._paneViews) l.update();
131
+ }
132
+ paneViews() {
133
+ return this._paneViews;
134
+ }
135
+ }
136
+ function Vt(o, l, u) {
137
+ const c = o.labelText ?? "", h = o.value, b = h === void 0 ? "" : typeof h == "number" ? l === "$" ? `$${we(h, void 0, u)}` : l === "%" ? `${we(h, void 0, u)}%` : we(
138
+ h,
139
+ l !== "none" && l !== "%" && l !== "$" ? l : void 0,
17
140
  u
18
- ) : String(g);
19
- return { labelText: D, valueStr: N };
141
+ ) : String(h);
142
+ return { labelText: c, valueStr: b };
20
143
  }
21
- function Ze(t, v) {
22
- for (let u = t.length - 1; u >= 0; u--)
23
- if (Number(t[u].time) <= v)
24
- return t[u].value;
144
+ const Ze = 4;
145
+ function Pt(o, l, u) {
146
+ const c = { left: o, transform: "translateX(-50%)" };
147
+ if (l <= 0 || !u || u <= 0)
148
+ return c;
149
+ const h = u / 2, b = Ze + h, L = l - Ze - h;
150
+ return L < b ? { left: l / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(o, b), L), transform: "translateX(-50%)" };
151
+ }
152
+ function Lt(o, l) {
153
+ for (let u = o.length - 1; u >= 0; u--)
154
+ if (Number(o[u].time) <= l)
155
+ return o[u].value;
25
156
  return 0;
26
157
  }
27
- const me = [
158
+ const _e = [
28
159
  // 0 green (emerald)
29
160
  {
30
161
  line: "#02c39a",
@@ -139,65 +270,70 @@ const me = [
139
270
  top: "rgba(71, 85, 105, 0.56)",
140
271
  bottom: "rgba(71, 85, 105, 0.04)"
141
272
  }
142
- ], Ue = 137.5;
143
- function Le(t) {
144
- if (t < me.length)
145
- return me[t];
146
- const u = (t - me.length) * Ue % 360, D = je(u, 70, 50), { topColor: g, bottomColor: N } = ee(D);
147
- return { line: D, top: g, bottom: N };
273
+ ], Rt = 137.5;
274
+ function Ke(o) {
275
+ if (o < _e.length)
276
+ return _e[o];
277
+ const u = (o - _e.length) * Rt % 360, c = dt(u, 70, 50), { topColor: h, bottomColor: b } = fe(c);
278
+ return { line: c, top: h, bottom: b };
148
279
  }
149
- function ht({
150
- series: t,
151
- className: v,
280
+ function Ot({
281
+ series: o,
282
+ className: l,
152
283
  showLegend: u = !1,
153
- onUnselectSeries: D,
154
- xMeasureUnit: g = "time",
155
- yMeasureUnit: N = "token",
156
- optionsOverrides: _,
157
- verticalLineOptions: x,
158
- currentValueDecimals: te,
159
- useSharedPriceScale: M = !1,
160
- showCurrentValue: De = !0,
161
- graphTitle: oe,
162
- yScaleMin: be,
163
- yScaleMinMultiple: pe,
164
- visibleTimeFrom: E,
165
- disableZoom: J = !1
284
+ onUnselectSeries: c,
285
+ xMeasureUnit: h = "time",
286
+ yMeasureUnit: b = "token",
287
+ optionsOverrides: L,
288
+ verticalLineOptions: y,
289
+ priceLineOptions: k,
290
+ zoneOptions: O,
291
+ currentValueDecimals: he,
292
+ useSharedPriceScale: G = !1,
293
+ dualYAxis: I = !1,
294
+ defaultVisiblePriceScaleId: Ne = "right",
295
+ leftPriceScaleTitle: Te,
296
+ rightPriceScaleTitle: kt,
297
+ showCurrentValue: Je = !0,
298
+ graphTitle: de,
299
+ yScaleMin: Ve,
300
+ yScaleMinMultiple: Pe,
301
+ visibleTimeFrom: K,
302
+ disableZoom: ae = !1,
303
+ hideDefaultTooltip: me = !1
166
304
  }) {
167
- const R = L(null), w = L(/* @__PURE__ */ new Map()), re = L(!1), ve = L(!0), ne = L(
168
- null
169
- ), Ie = L(null), O = L(null), ae = L(null), Q = L(null), V = Be(), I = fe.useMemo(() => t.flatMap((e) => e.data), [t]), ze = fe.useMemo(() => {
170
- if (t.length > 0) {
171
- const e = t[t.length - 1];
305
+ const E = H(null), x = H(/* @__PURE__ */ new Map()), pe = H(!1), Le = H(!0), Re = H([]), B = H(null), ge = H(null), se = H(null), V = ht(), X = xe.useMemo(() => o.flatMap((e) => e.data), [o]), Qe = xe.useMemo(() => {
306
+ if (o.length > 0) {
307
+ const e = o[o.length - 1];
172
308
  if (e.data.length > 0)
173
309
  return e.data[e.data.length - 1];
174
310
  }
175
- }, [t]), [Ce, le] = de(() => {
176
- if (!ze) return;
311
+ }, [o]), [Me, be] = U(() => {
312
+ if (!Qe) return;
177
313
  const e = /* @__PURE__ */ new Map();
178
- for (const a of t)
314
+ for (const a of o)
179
315
  a.data.length > 0 && e.set(a.label, a.data[a.data.length - 1]);
180
316
  return e;
181
- }), [xe, z] = de(null), [Se, Ne] = de([]);
317
+ }), [ke, q] = U(null), [De, Ie] = U([]), [Ye, Be] = U(0), Fe = H(/* @__PURE__ */ new Map()), [Ue, et] = U({}), [ce, tt] = U(0);
182
318
  $(() => {
183
319
  const e = () => {
184
320
  try {
185
- if (R.current && O.current) {
186
- const l = O.current.clientWidth, i = O.current.clientHeight;
187
- R.current.resize(l, i);
321
+ if (B.current && Be(B.current.clientWidth), E.current && B.current) {
322
+ const s = B.current.clientWidth, i = B.current.clientHeight;
323
+ E.current.resize(s, i);
188
324
  }
189
325
  } catch {
190
326
  }
191
- }, a = O.current, r = a ? new ResizeObserver(e) : null;
192
- return Q.current = r, a && r?.observe(a), () => {
193
- a && r?.unobserve(a), r?.disconnect(), Q.current = null;
327
+ }, a = B.current, n = a ? new ResizeObserver(e) : null;
328
+ return se.current = n, a && n?.observe(a), () => {
329
+ a && n?.unobserve(a), n?.disconnect(), se.current = null;
194
330
  };
195
331
  }, []), $(() => {
196
- if (!ae.current || re.current) return;
197
- const e = Pe(), a = Me(
332
+ if (!ge.current || pe.current) return;
333
+ const e = Xe(), a = ee(
198
334
  "hsl(var(--foreground))",
199
335
  "rgb(0, 0, 0)"
200
- ), r = J ? {
336
+ ), n = ae ? {
201
337
  handleScale: {
202
338
  mouseWheel: !1,
203
339
  pinch: !1,
@@ -210,8 +346,13 @@ function ht({
210
346
  horzTouchDrag: !1,
211
347
  vertTouchDrag: !1
212
348
  }
213
- } : {}, l = We(ae.current, {
349
+ } : {}, s = at(ge.current, {
214
350
  ...e,
351
+ leftPriceScale: {
352
+ ...e.leftPriceScale || {},
353
+ visible: !1,
354
+ textColor: a
355
+ },
215
356
  rightPriceScale: {
216
357
  ...e.rightPriceScale || {},
217
358
  visible: !V,
@@ -220,19 +361,19 @@ function ht({
220
361
  ...V && {
221
362
  crosshair: {
222
363
  ...e.crosshair,
223
- mode: Ye.Magnet
364
+ mode: st.Magnet
224
365
  }
225
366
  },
226
- ...r,
227
- ..._
367
+ ...n,
368
+ ...L
228
369
  });
229
- return R.current = l, re.current = !0, () => {
230
- Q.current?.disconnect(), Q.current = null, l.remove(), R.current = null, re.current = !1, w.current.clear();
370
+ return E.current = s, pe.current = !0, tt((i) => i + 1), () => {
371
+ se.current?.disconnect(), se.current = null, s.remove(), E.current = null, pe.current = !1, x.current.clear();
231
372
  };
232
- }, [V, _, J]), $(() => {
233
- const e = R.current;
373
+ }, [V, L, ae]), $(() => {
374
+ const e = E.current;
234
375
  e && e.applyOptions(
235
- J ? {
376
+ ae ? {
236
377
  handleScale: {
237
378
  mouseWheel: !1,
238
379
  pinch: !1,
@@ -260,47 +401,89 @@ function ht({
260
401
  }
261
402
  }
262
403
  );
263
- }, [J]), $(() => {
264
- const e = R.current;
265
- if (!e || t.length === 0) return;
266
- const r = t.filter((o) => o.data.length > 0).length <= 1 ? be : pe, l = g === "time" ? Te(g, I) : Te(g), i = I.map((o) => o.value), {
267
- formatter: c,
268
- tickmarksFormatter: f,
269
- updateVisibleRange: P,
270
- updateLastValues: m
271
- } = Xe(i, N, {
272
- yScaleMin: r
273
- });
274
- ne.current = P, Ie.current = m;
275
- const T = t.filter((o) => o.data.length > 0).map((o) => o.data[o.data.length - 1].value);
276
- m(T);
277
- const k = Pe();
404
+ }, [ae]), $(() => {
405
+ const e = E.current;
406
+ if (!e || o.length === 0) return;
407
+ const n = o.filter((r) => r.data.length > 0).length <= 1 ? Ve : Pe, s = h === "time" ? qe(h, X) : qe(h), i = /* @__PURE__ */ new Map();
408
+ {
409
+ let r = 0;
410
+ for (const t of o)
411
+ t.data.length !== 0 && (i.set(
412
+ t.label,
413
+ t.priceScaleId ?? (r === 0 ? "left" : "right")
414
+ ), r++);
415
+ }
416
+ const f = (r, t, m) => {
417
+ const {
418
+ formatter: D,
419
+ tickmarksFormatter: T,
420
+ updateVisibleRange: A,
421
+ updateLastValues: We
422
+ } = gt(r, t, {
423
+ yScaleMin: n
424
+ }), Ce = o.filter((J) => J.data.length > 0 && m.has(J.label)).map((J) => J.data[J.data.length - 1].value);
425
+ return We(Ce), { formatter: D, tickmarksFormatter: T, updateVisibleRange: A, labels: m };
426
+ }, d = [];
427
+ if (I)
428
+ for (const r of ["left", "right"]) {
429
+ const t = /* @__PURE__ */ new Set(), m = [];
430
+ let D = b;
431
+ for (const T of o)
432
+ if (T.data.length !== 0 && i.get(T.label) === r) {
433
+ t.size === 0 && T.yMeasureUnit && (D = T.yMeasureUnit), t.add(T.label);
434
+ for (const A of T.data) m.push(A.value);
435
+ }
436
+ t.size > 0 && d.push(f(m, D, t));
437
+ }
438
+ else {
439
+ const r = X.map((m) => m.value), t = new Set(
440
+ o.filter((m) => m.data.length > 0).map((m) => m.label)
441
+ );
442
+ d.push(f(r, b, t));
443
+ }
444
+ Re.current = d;
445
+ const v = /* @__PURE__ */ new Map();
446
+ for (const r of d)
447
+ for (const t of r.labels)
448
+ v.set(t, r);
449
+ const C = Xe();
278
450
  e.applyOptions({
279
451
  localization: {
280
- ...k.localization || {},
452
+ ...C.localization || {},
281
453
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
282
- timeFormatter: (o) => (
454
+ timeFormatter: (r) => (
283
455
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
284
- l.timeFormatter(parseFloat(o), void 0)
456
+ s.timeFormatter(parseFloat(r), void 0)
285
457
  )
286
458
  },
287
459
  timeScale: {
288
- ...k.timeScale || {},
460
+ ...C.timeScale || {},
289
461
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
290
- tickMarkFormatter: l.tickMarkFormatter,
462
+ tickMarkFormatter: s.tickMarkFormatter,
291
463
  minBarSpacing: 0
292
464
  }
293
465
  });
294
- const d = (I.length > 0 ? Math.min(...I.map((o) => o.value)) : 0) < 0, S = I.some((o) => o.value === 0), h = !d && S, C = t.length > 1 && !M, b = t.length > 1 && !M || V, A = Me(
466
+ const P = (X.length > 0 ? Math.min(...X.map((r) => r.value)) : 0) < 0, _ = X.some((r) => r.value === 0), p = !P && _, S = !I && o.length > 1 && !G, R = I ? V : o.length > 1 && !G || V, M = ee(
295
467
  "hsl(var(--foreground))",
296
468
  "rgb(0, 0, 0)"
297
469
  );
298
470
  e.applyOptions({
471
+ ...I && {
472
+ defaultVisiblePriceScaleId: Ne
473
+ },
474
+ leftPriceScale: {
475
+ ...C.leftPriceScale || {},
476
+ visible: I && !V,
477
+ textColor: M,
478
+ ...I && Te && {
479
+ // lightweight-charts uses scale margins; title shown via localization if needed
480
+ }
481
+ },
299
482
  rightPriceScale: {
300
- ...k.rightPriceScale || {},
301
- visible: !b,
302
- textColor: A,
303
- ...h && {
483
+ ...C.rightPriceScale || {},
484
+ visible: I ? !V : !R,
485
+ textColor: M,
486
+ ...p && !I && {
304
487
  scaleMargins: {
305
488
  top: 0.3,
306
489
  bottom: 0
@@ -308,92 +491,129 @@ function ht({
308
491
  }
309
492
  }
310
493
  });
311
- const X = new Set(w.current.keys()), se = new Set(t.map((o) => o.label));
312
- for (const o of X)
313
- if (!se.has(o)) {
314
- const n = w.current.get(o);
315
- n && (e.removeSeries(n), w.current.delete(o));
494
+ const N = new Set(x.current.keys()), Z = new Set(o.map((r) => r.label));
495
+ for (const r of N)
496
+ if (!Z.has(r)) {
497
+ const t = x.current.get(r);
498
+ t && (e.removeSeries(t), x.current.delete(r));
499
+ }
500
+ const Q = mt(), oe = [];
501
+ let re = 0;
502
+ const Ee = o.find((r) => r.data.length > 0), ne = /* @__PURE__ */ new Map();
503
+ if (k && k.length > 0)
504
+ for (const r of k) {
505
+ if (!Number.isFinite(r.price)) continue;
506
+ const t = r.seriesLabel ?? Ee?.label;
507
+ if (!t) continue;
508
+ const m = ne.get(t) ?? [];
509
+ m.push(r.price), ne.set(t, m);
316
510
  }
317
- const Ae = He(), ie = [];
318
- let U = 0;
319
- for (let o = 0; o < t.length; o++) {
320
- const n = t[o], q = Le(o), W = n.lineColor ?? n.color ?? q.line;
321
- let F, Y;
322
- if (n.lineColor ?? n.color)
323
- if (n.topColor && n.bottomColor)
324
- F = n.topColor, Y = n.bottomColor;
325
- else if (n.topColor) {
326
- const s = ee(W);
327
- F = n.topColor, Y = s.bottomColor;
328
- } else if (n.bottomColor)
329
- F = ee(W).topColor, Y = n.bottomColor;
511
+ if (O && O.length > 0)
512
+ for (const r of O) {
513
+ const t = r.seriesLabel ?? Ee?.label;
514
+ if (!t) continue;
515
+ const m = ne.get(t) ?? [];
516
+ Number.isFinite(r.priceTop) && m.push(r.priceTop), Number.isFinite(r.priceBottom) && m.push(r.priceBottom), ne.set(t, m);
517
+ }
518
+ for (let r = 0; r < o.length; r++) {
519
+ const t = o[r], m = Ke(r), D = t.lineColor ?? t.color ?? m.line;
520
+ let T, A;
521
+ if (t.lineColor ?? t.color)
522
+ if (t.topColor && t.bottomColor)
523
+ T = t.topColor, A = t.bottomColor;
524
+ else if (t.topColor) {
525
+ const g = fe(D);
526
+ T = t.topColor, A = g.bottomColor;
527
+ } else if (t.bottomColor)
528
+ T = fe(D).topColor, A = t.bottomColor;
330
529
  else {
331
- const s = ee(W);
332
- F = s.topColor, Y = s.bottomColor;
530
+ const g = fe(D);
531
+ T = g.topColor, A = g.bottomColor;
333
532
  }
334
533
  else
335
- F = n.topColor || q.top, Y = n.bottomColor || q.bottom;
336
- if (n.data.length === 0) {
337
- const s = w.current.get(n.label);
338
- s && (e.removeSeries(s), w.current.delete(n.label));
534
+ T = t.topColor || m.top, A = t.bottomColor || m.bottom;
535
+ if (t.data.length === 0) {
536
+ const g = x.current.get(t.label);
537
+ g && (e.removeSeries(g), x.current.delete(t.label));
339
538
  continue;
340
539
  }
341
- const Fe = (n.data.length > 0 ? Math.min(...n.data.map((s) => s.value)) : 0) < 0, $e = n.data.some((s) => s.value === 0), Ee = !Fe && $e, Re = M || !C || U === 0 ? "right" : `scale-${U}`;
342
- C && ie.push({
343
- priceScaleId: Re || "right",
344
- shouldPreventNegativeAxis: Ee,
345
- seriesIndex: U
540
+ const Ce = (t.data.length > 0 ? Math.min(...t.data.map((g) => g.value)) : 0) < 0, J = t.data.some((g) => g.value === 0), ot = !Ce && J, Ae = I ? t.priceScaleId ?? (re === 0 ? "left" : "right") : G || !S || re === 0 ? "right" : `scale-${re}`;
541
+ S && oe.push({
542
+ priceScaleId: Ae || "right",
543
+ shouldPreventNegativeAxis: ot,
544
+ seriesIndex: re
346
545
  });
347
- const Ve = (M || !C) && r !== void 0 && typeof r == "number", ke = {
348
- lineColor: W,
349
- topColor: F,
350
- bottomColor: Y,
351
- priceScaleId: Re,
546
+ const $e = (G || !S) && n !== void 0 && typeof n == "number", rt = ne.get(t.label) ?? [], nt = (g) => {
547
+ const z = g();
548
+ if (z?.priceRange) {
549
+ $e && (z.priceRange.minValue = n);
550
+ for (const j of rt)
551
+ j < z.priceRange.minValue && (z.priceRange.minValue = j), j > z.priceRange.maxValue && (z.priceRange.maxValue = j);
552
+ }
553
+ return z;
554
+ }, Ge = v.get(t.label) ?? d[0], je = Ge.formatter, lt = Ge.tickmarksFormatter, Se = {
555
+ lineColor: D,
556
+ topColor: T,
557
+ bottomColor: A,
558
+ priceScaleId: Ae,
559
+ ...t.seriesType === "line" && {
560
+ lineStyle: t.lineStyle ?? te.Solid
561
+ },
352
562
  priceFormat: {
353
563
  type: "custom",
354
564
  minMove: 0.01,
355
- formatter: Ve && typeof r == "number" ? (s) => c(
356
- s < r ? r : s
357
- ) : c,
358
- tickmarksFormatter: f
565
+ formatter: $e && typeof n == "number" ? (g) => je(
566
+ g < n ? n : g
567
+ ) : je,
568
+ tickmarksFormatter: lt
359
569
  },
360
- autoscaleInfoProvider: (s) => {
361
- if (!Ve) return s();
362
- const j = s();
363
- if (j?.priceRange) {
364
- const H = r;
365
- j.priceRange.minValue = H;
366
- }
367
- return j;
368
- }
369
- };
370
- let G = w.current.get(n.label);
371
- const B = n.data.map((s) => ({
372
- ...s,
373
- time: s.time
570
+ autoscaleInfoProvider: nt
571
+ }, He = t.seriesType === "line";
572
+ let F = x.current.get(t.label);
573
+ const Y = t.data.map((g) => ({
574
+ ...g,
575
+ time: g.time
374
576
  }));
375
- if (E !== void 0 && B.length > 0 && Number(B[0].time) > E) {
376
- const s = Number(B[0].time), j = s - E, H = 86400, Oe = j > 180 * H ? 7 * H : j > 30 * H ? H : 6 * 3600, ye = [];
377
- for (let ue = E; ue < s; ue += Oe)
378
- ye.push({ time: ue });
379
- B.unshift(...ye);
577
+ if (K !== void 0 && Y.length > 0 && Number(Y[0].time) > K) {
578
+ const g = Number(Y[0].time), z = g - K, j = 86400, it = z > 180 * j ? 7 * j : z > 30 * j ? j : 6 * 3600, Oe = [];
579
+ for (let ye = K; ye < g; ye += it)
580
+ Oe.push({ time: ye });
581
+ Y.unshift(...Oe);
380
582
  }
381
- G ? (G.applyOptions(ke), G.setData(B)) : (G = e.addSeries(Ge, {
382
- ...Ae,
383
- ...ke
384
- }), G.setData(B), w.current.set(n.label, G)), U++;
583
+ F && F.seriesType() !== (He ? "Line" : "Area") && (e.removeSeries(F), x.current.delete(t.label), F = void 0), F ? (F.applyOptions(Se), F.setData(Y)) : (He ? F = e.addSeries(ct, {
584
+ ...Q,
585
+ ...Se
586
+ }) : F = e.addSeries(ut, {
587
+ ...Q,
588
+ ...Se
589
+ }), F.setData(Y), x.current.set(t.label, F)), re++;
385
590
  }
386
- if (C && ie.length > 0)
387
- for (const o of ie)
591
+ if (I)
592
+ try {
593
+ const r = e.priceScale("left"), t = e.priceScale("right"), m = {
594
+ visible: !V,
595
+ autoScale: !0,
596
+ scaleMargins: { top: 0.1, bottom: 0.1 },
597
+ alignLabels: !0,
598
+ borderVisible: !0,
599
+ borderColor: "rgba(224, 227, 235, 0.1)",
600
+ entireTextOnly: !1,
601
+ textColor: M
602
+ };
603
+ r?.applyOptions(m), t?.applyOptions(m);
604
+ } catch {
605
+ }
606
+ else if (S && oe.length > 0)
607
+ for (const r of oe)
388
608
  try {
389
- const n = e.priceScale(o.priceScaleId);
390
- n && n.applyOptions({
609
+ const t = e.priceScale(r.priceScaleId);
610
+ t && t.applyOptions({
391
611
  visible: !1,
392
612
  autoScale: !0,
393
613
  scaleMargins: {
394
614
  top: 0.1,
395
615
  bottom: 0.1,
396
- ...o.shouldPreventNegativeAxis && {
616
+ ...r.shouldPreventNegativeAxis && {
397
617
  top: 0.3,
398
618
  bottom: 0
399
619
  }
@@ -402,25 +622,25 @@ function ht({
402
622
  borderVisible: !0,
403
623
  borderColor: "rgba(224, 227, 235, 0.1)",
404
624
  entireTextOnly: !1,
405
- textColor: A
625
+ textColor: M
406
626
  });
407
- } catch (n) {
627
+ } catch (t) {
408
628
  console.warn(
409
- `Failed to configure price scale ${o.priceScaleId} for series ${o.seriesIndex}:`,
410
- n
629
+ `Failed to configure price scale ${r.priceScaleId} for series ${r.seriesIndex}:`,
630
+ t
411
631
  );
412
632
  }
413
- else if (!C)
633
+ else if (!S)
414
634
  try {
415
- const o = e.priceScale("right");
416
- o && o.applyOptions({
635
+ const r = e.priceScale("right");
636
+ r && r.applyOptions({
417
637
  visible: !V,
418
638
  autoScale: !0,
419
639
  scaleMargins: {
420
640
  top: 0.1,
421
641
  // No bottom margin when yScaleMin is set so the scale doesn't extend below the minimum (avoids negative labels like -10M)
422
- bottom: r !== void 0 || h ? 0 : 0.1,
423
- ...h && {
642
+ bottom: n !== void 0 || p ? 0 : 0.1,
643
+ ...p && {
424
644
  top: 0.3
425
645
  }
426
646
  },
@@ -428,240 +648,362 @@ function ht({
428
648
  borderVisible: !0,
429
649
  borderColor: "rgba(224, 227, 235, 0.1)",
430
650
  entireTextOnly: !1,
431
- textColor: A
651
+ textColor: M
432
652
  });
433
653
  } catch {
434
654
  }
435
- if (r !== void 0 && !V && (M || !C) && e.applyOptions({
655
+ if (n !== void 0 && !V && (G || !S) && e.applyOptions({
436
656
  handleScroll: {
437
657
  vertTouchDrag: !1
438
658
  }
439
- }), I.length > 0) {
440
- const o = I.map((F) => Number(F.time)), n = Math.min(...o), q = E !== void 0 ? Math.min(E, n) : n, W = Math.max(...o);
441
- e.timeScale().setVisibleRange({ from: q, to: W });
659
+ }), X.length > 0) {
660
+ const r = X.map((t) => Number(t.time)).filter((t) => Number.isFinite(t));
661
+ if (r.length > 0) {
662
+ const t = Math.min(...r), m = K !== void 0 ? Math.min(K, t) : t, D = Math.max(...r);
663
+ if (Number(m) <= Number(D))
664
+ try {
665
+ e.timeScale().setVisibleRange({ from: m, to: D });
666
+ } catch {
667
+ try {
668
+ e.timeScale().fitContent();
669
+ } catch {
670
+ }
671
+ }
672
+ }
442
673
  }
443
- ve.current && (ve.current = !1);
444
- const ce = /* @__PURE__ */ new Map();
445
- for (const o of t)
446
- o.data.length > 0 && ce.set(o.label, o.data[o.data.length - 1]);
447
- le(ce.size > 0 ? ce : void 0);
674
+ Le.current && (Le.current = !1);
675
+ const ve = /* @__PURE__ */ new Map();
676
+ for (const r of o)
677
+ r.data.length > 0 && ve.set(r.label, r.data[r.data.length - 1]);
678
+ be(ve.size > 0 ? ve : void 0);
448
679
  }, [
449
- t,
450
- I,
451
- g,
452
- N,
680
+ o,
681
+ X,
682
+ h,
683
+ b,
453
684
  V,
454
- M,
455
- be,
456
- pe,
457
- E
685
+ G,
686
+ I,
687
+ Ne,
688
+ Te,
689
+ Ve,
690
+ Pe,
691
+ K,
692
+ k,
693
+ O
458
694
  ]), $(() => {
459
- const e = R.current;
460
- if (!e || t.length === 0) return;
461
- const a = t.length === 1;
462
- let r;
463
- for (const i of t)
695
+ const e = E.current;
696
+ if (!e || o.length === 0) return;
697
+ const a = o.length === 1;
698
+ let n;
699
+ for (const i of o)
464
700
  if (i.data.length > 0) {
465
- r = i.data[i.data.length - 1].time;
701
+ n = i.data[i.data.length - 1].time;
466
702
  break;
467
703
  }
468
- if (!r) return;
469
- const l = (i) => {
470
- const { time: c = r, seriesData: f, point: P } = i || {}, m = Array.from(w.current.values());
471
- if (!P || !c) {
472
- const y = /* @__PURE__ */ new Map();
473
- for (const d of t)
474
- d.data.length > 0 && y.set(d.label, d.data[d.data.length - 1]);
475
- if (le(y.size > 0 ? y : void 0), a || M)
476
- z(null);
477
- else if (m[0] && r) {
478
- const S = e.timeScale().timeToCoordinate(r), h = t[0];
479
- if (h.data.length > 0) {
480
- const C = h.data[h.data.length - 1].value, b = m[0].priceToCoordinate(C);
481
- S !== null && b !== null && z({ x: S, y: b });
704
+ if (!n) return;
705
+ const s = (i) => {
706
+ const { time: f = n, seriesData: d, point: v } = i || {}, C = Array.from(x.current.values());
707
+ if (!v || !f) {
708
+ const _ = /* @__PURE__ */ new Map();
709
+ for (const p of o)
710
+ p.data.length > 0 && _.set(p.label, p.data[p.data.length - 1]);
711
+ if (be(_.size > 0 ? _ : void 0), a || G || me)
712
+ q(null);
713
+ else if (C[0] && n) {
714
+ const S = e.timeScale().timeToCoordinate(n), R = o[0];
715
+ if (R.data.length > 0) {
716
+ const M = R.data[R.data.length - 1].value, N = C[0].priceToCoordinate(M);
717
+ S !== null && N !== null && q({ x: S, y: N });
482
718
  }
483
719
  }
484
720
  return;
485
721
  }
486
- const T = /* @__PURE__ */ new Map();
487
- let k;
488
- for (let y = 0; y < t.length; y++) {
489
- const d = t[y], S = m[y];
722
+ const W = /* @__PURE__ */ new Map();
723
+ let P;
724
+ for (let _ = 0; _ < o.length; _++) {
725
+ const p = o[_], S = x.current.get(p.label);
490
726
  if (!S) continue;
491
- const h = f?.get(S), C = h && "value" in h ? h.value : void 0;
492
- let b;
493
- if (C !== void 0)
494
- b = C;
727
+ const R = d?.get(S), M = R && "value" in R ? R.value : void 0;
728
+ let N;
729
+ if (M !== void 0)
730
+ N = M;
495
731
  else if (a) {
496
- const A = Number(c), X = d.data.length > 0 ? Number(d.data[0].time) : Number.POSITIVE_INFINITY;
497
- A < X ? b = Number.NaN : b = d.data[d.data.length - 1]?.value ?? 0;
498
- } else
499
- b = Ze(d.data, Number(c));
500
- Number.isNaN(b) || (k === void 0 && (k = b), T.set(d.label, { value: b, time: c }));
732
+ const Z = Number(f), Q = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
733
+ Z < Q ? N = Number.NaN : N = p.data[p.data.length - 1]?.value ?? 0;
734
+ } else {
735
+ const Z = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
736
+ if (Number(f) < Z) continue;
737
+ N = Lt(p.data, Number(f));
738
+ }
739
+ Number.isNaN(N) || (P === void 0 && (P = N), W.set(p.label, { value: N, time: f }));
501
740
  }
502
- if (le(T), k !== void 0 && m[0]) {
503
- const d = e.timeScale().timeToCoordinate(c), S = m[0].priceToCoordinate(k);
504
- if (d !== null && S !== null) {
505
- const h = O.current;
506
- if (h) {
507
- const C = h.querySelector(
741
+ if (be(W), P !== void 0 && C[0]) {
742
+ const p = e.timeScale().timeToCoordinate(f), S = C[0].priceToCoordinate(P);
743
+ if (p !== null && S !== null) {
744
+ const R = B.current;
745
+ if (R) {
746
+ const M = R.querySelector(
508
747
  ".LightweightChart"
509
748
  );
510
- if (C) {
511
- const b = C.getBoundingClientRect(), A = h.getBoundingClientRect(), X = d + (b.left - A.left), se = S + (b.top - A.top);
512
- z({ x: X, y: se });
749
+ if (M) {
750
+ const N = M.getBoundingClientRect(), Z = R.getBoundingClientRect(), Q = p + (N.left - Z.left), oe = S + (N.top - Z.top);
751
+ q({ x: Q, y: oe });
513
752
  } else
514
- z({ x: d, y: S });
753
+ q({ x: p, y: S });
515
754
  } else
516
- z({ x: d, y: S });
755
+ q({ x: p, y: S });
517
756
  } else
518
- z(null);
757
+ q(null);
519
758
  } else
520
- z(null);
759
+ q(null);
521
760
  };
522
- return e.subscribeCrosshairMove(l), V && e.subscribeClick(l), !a && !M && requestAnimationFrame(() => {
523
- const i = Array.from(w.current.values());
524
- if (i[0] && r && t[0]?.data.length > 0) {
525
- const f = e.timeScale().timeToCoordinate(r), P = t[0].data[t[0].data.length - 1].value, m = i[0].priceToCoordinate(P);
526
- f !== null && m !== null && z({ x: f, y: m });
761
+ return e.subscribeCrosshairMove(s), V && e.subscribeClick(s), !a && !G && !me && requestAnimationFrame(() => {
762
+ const i = Array.from(x.current.values());
763
+ if (i[0] && n && o[0]?.data.length > 0) {
764
+ const d = e.timeScale().timeToCoordinate(n), v = o[0].data[o[0].data.length - 1].value, C = i[0].priceToCoordinate(v);
765
+ d !== null && C !== null && q({ x: d, y: C });
527
766
  }
528
767
  }), () => {
529
- e.unsubscribeCrosshairMove(l), V && e.unsubscribeClick(l);
768
+ e.unsubscribeCrosshairMove(s), V && e.unsubscribeClick(s);
530
769
  };
531
- }, [t, M, V]), $(() => {
532
- const e = R.current;
533
- if (!e || t.length === 0) return;
534
- const a = e.timeScale(), r = () => {
535
- if (!ne.current) return;
536
- const l = a.getVisibleRange();
537
- if (!l) return;
538
- const i = Number(l.from), c = Number(l.to), f = [];
539
- for (const P of t)
540
- for (const m of P.data) {
541
- const T = Number(m.time);
542
- T >= i && T <= c && f.push(m.value);
543
- }
544
- f.length > 0 && ne.current(f);
770
+ }, [o, G, V, me]), $(() => {
771
+ const e = E.current;
772
+ if (!e || o.length === 0) return;
773
+ const a = e.timeScale(), n = () => {
774
+ const s = Re.current;
775
+ if (s.length === 0) return;
776
+ const i = a.getVisibleRange();
777
+ if (!i) return;
778
+ const f = Number(i.from), d = Number(i.to);
779
+ for (const v of s) {
780
+ const C = [];
781
+ for (const W of o)
782
+ if (v.labels.has(W.label))
783
+ for (const P of W.data) {
784
+ const _ = Number(P.time);
785
+ _ >= f && _ <= d && C.push(P.value);
786
+ }
787
+ C.length > 0 && v.updateVisibleRange(C);
788
+ }
545
789
  };
546
- return a.subscribeVisibleLogicalRangeChange(r), () => {
790
+ return a.subscribeVisibleLogicalRangeChange(n), () => {
547
791
  a.unsubscribeVisibleLogicalRangeChange(
548
- r
792
+ n
549
793
  );
550
794
  };
551
- }, [t]), $(() => {
552
- const e = R.current, a = Array.from(w.current.values()), r = [];
553
- if (e && a.length > 0 && x) {
554
- const l = _e(), i = a[0];
555
- for (const c of x) {
556
- const f = new Je(e, i, c.xCoordinate, {
557
- ...l,
558
- ...c.options || {}
559
- });
560
- i.attachPrimitive(f), r.push(f);
795
+ }, [o]), $(() => {
796
+ const e = E.current, a = Array.from(x.current.values()), n = [];
797
+ if (e && a.length > 0 && y) {
798
+ const s = pt(), i = a[0];
799
+ for (const f of y) {
800
+ const d = {
801
+ ...s,
802
+ ...f.options || {}
803
+ };
804
+ d.color && (d.color = ee(d.color, d.color));
805
+ const v = new Ct(e, i, f.xCoordinate, d);
806
+ i.attachPrimitive(v), n.push(v);
561
807
  }
562
808
  }
563
809
  return () => {
564
810
  if (a.length > 0) {
565
- const l = a[0];
566
- for (const i of r)
567
- l.detachPrimitive(i);
811
+ const s = a[0];
812
+ for (const i of n)
813
+ try {
814
+ s.detachPrimitive(i);
815
+ } catch {
816
+ }
568
817
  }
569
818
  };
570
- }, [x, t]), $(() => {
571
- const e = R.current;
572
- if (!e || !x?.length) {
573
- Ne([]);
819
+ }, [y, o, ce]), $(() => {
820
+ const e = [], a = [];
821
+ if (k && k.length > 0) {
822
+ const n = Array.from(x.current.values())[0], s = ee(
823
+ "hsl(var(--destructive))",
824
+ "rgb(239, 68, 68)"
825
+ );
826
+ for (const i of k) {
827
+ if (!Number.isFinite(i.price)) continue;
828
+ const f = i.seriesLabel ? x.current.get(i.seriesLabel) : n;
829
+ if (!f) continue;
830
+ const d = i.color ? ee(i.color, i.color) : s, v = i.lineWidth ?? 1, C = i.lineStyle ?? te.Dashed, W = f.createPriceLine({
831
+ price: i.price,
832
+ color: d,
833
+ lineWidth: v,
834
+ lineStyle: C,
835
+ axisLabelVisible: i.axisLabelVisible ?? !0,
836
+ title: i.title ?? ""
837
+ });
838
+ e.push({ series: f, line: W });
839
+ const P = new Tt(
840
+ f,
841
+ i.price,
842
+ d,
843
+ v,
844
+ C
845
+ );
846
+ f.attachPrimitive(P), a.push({ series: f, primitive: P });
847
+ }
848
+ }
849
+ return () => {
850
+ for (const { series: n, primitive: s } of a)
851
+ try {
852
+ n.detachPrimitive(s);
853
+ } catch {
854
+ }
855
+ for (const { series: n, line: s } of e)
856
+ try {
857
+ n.removePriceLine(s);
858
+ } catch {
859
+ }
860
+ };
861
+ }, [k, o, ce]), $(() => {
862
+ const e = [];
863
+ if (O && O.length > 0) {
864
+ const a = Array.from(x.current.values())[0], n = "rgba(239, 68, 68, 0.12)";
865
+ for (const s of O) {
866
+ const i = s.seriesLabel ? x.current.get(s.seriesLabel) : a;
867
+ if (!i) continue;
868
+ const f = s.color ? ee(s.color, n) : n, d = new xt(
869
+ i,
870
+ s.priceTop,
871
+ s.priceBottom,
872
+ f
873
+ );
874
+ i.attachPrimitive(d), e.push({ series: i, zone: d });
875
+ }
876
+ }
877
+ return () => {
878
+ for (const { series: a, zone: n } of e)
879
+ try {
880
+ a.detachPrimitive(n);
881
+ } catch {
882
+ }
883
+ };
884
+ }, [O, o, ce]), $(() => {
885
+ const e = E.current;
886
+ if (!e || !y?.length) {
887
+ Ie([]);
574
888
  return;
575
889
  }
576
890
  const a = () => {
577
- const i = e.timeScale(), c = x.map((f) => i.timeToCoordinate(f.xCoordinate) ?? null);
578
- Ne(c);
891
+ const i = e.timeScale(), f = y.map((d) => i.timeToCoordinate(d.xCoordinate) ?? null);
892
+ Ie(f), B.current && Be(B.current.clientWidth);
579
893
  };
580
894
  a();
581
- const r = e.timeScale(), l = () => {
895
+ const n = e.timeScale(), s = () => {
582
896
  a();
583
897
  };
584
- return r.subscribeVisibleLogicalRangeChange(l), () => {
585
- r.unsubscribeVisibleLogicalRangeChange(l);
898
+ return n.subscribeVisibleLogicalRangeChange(s), () => {
899
+ n.unsubscribeVisibleLogicalRangeChange(s);
586
900
  };
587
- }, [x, t]);
588
- const Z = t.length === 1, we = fe.useMemo(() => {
589
- if (Z && t.length > 0) {
590
- const e = t[0];
901
+ }, [y, o, ce]), ft(() => {
902
+ et((e) => {
903
+ const a = {};
904
+ let n = !1;
905
+ for (const [s, i] of Fe.current) {
906
+ if (!i) continue;
907
+ const f = i.offsetWidth;
908
+ a[s] = f, e[s] !== f && (n = !0);
909
+ }
910
+ return Object.keys(e).length !== Object.keys(a).length && (n = !0), n ? a : e;
911
+ });
912
+ });
913
+ const ue = o.length === 1, ze = xe.useMemo(() => {
914
+ if (ue && o.length > 0) {
915
+ const e = o[0];
591
916
  if (e.data.length > 0)
592
917
  return e.data[e.data.length - 1];
593
918
  }
594
- }, [Z, t]);
595
- return /* @__PURE__ */ K(
919
+ }, [ue, o]);
920
+ return /* @__PURE__ */ le(
596
921
  "div",
597
922
  {
598
- ref: O,
599
- className: he(
923
+ ref: B,
924
+ className: ie(
600
925
  "relative z-[1] w-full h-full overflow-hidden p-0",
601
- v
926
+ l
602
927
  ),
603
928
  children: [
604
- oe != null && oe !== !1 && Z ? /* @__PURE__ */ p("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ p("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: oe }) }) : De && Z && we && /* @__PURE__ */ p(
605
- qe,
929
+ de != null && de !== !1 && ue ? /* @__PURE__ */ w("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ w("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: de }) }) : Je && ue && ze && /* @__PURE__ */ w(
930
+ bt,
606
931
  {
607
- point: we,
608
- xMeasureUnit: g,
609
- yMeasureUnit: N,
610
- decimals: te
932
+ point: ze,
933
+ xMeasureUnit: h,
934
+ yMeasureUnit: b,
935
+ decimals: he
611
936
  }
612
937
  ),
613
- Ce && xe && /* @__PURE__ */ p(
614
- Ke,
938
+ Me && ke && /* @__PURE__ */ w(
939
+ vt,
615
940
  {
616
- points: Ce,
617
- xMeasureUnit: g,
618
- yMeasureUnit: N,
619
- series: t,
620
- position: xe,
621
- containerRef: O,
622
- decimals: te
941
+ points: Me,
942
+ xMeasureUnit: h,
943
+ yMeasureUnit: b,
944
+ series: o,
945
+ position: ke,
946
+ containerRef: B,
947
+ decimals: he
623
948
  }
624
949
  ),
625
- u && /* @__PURE__ */ p(et, { series: t, onUnselect: D }),
626
- x && x.length > 0 && Se.length === x.length && /* @__PURE__ */ p(
950
+ u && /* @__PURE__ */ w(Mt, { series: o, onUnselect: c }),
951
+ y && y.length > 0 && De.length === y.length && /* @__PURE__ */ w(
627
952
  "div",
628
953
  {
629
954
  className: "absolute inset-0 z-[5] pointer-events-none",
630
955
  "aria-hidden": !0,
631
- children: x.map((e, a) => {
632
- const r = Se[a], l = e.options ?? {}, i = l.showLabel !== !1;
633
- if (r === null || !i) return null;
634
- const { labelText: c, valueStr: f } = Qe(
635
- l,
636
- N,
637
- te
956
+ children: y.map((e, a) => {
957
+ const n = De[a], s = e.options ?? {}, i = s.showLabel !== !1;
958
+ if (n === null || !i) return null;
959
+ const { labelText: f, valueStr: d } = Vt(
960
+ s,
961
+ b,
962
+ he
963
+ ), v = s.tooltipText ?? "";
964
+ if (!(f || d || v)) return null;
965
+ const W = s.labelBackgroundColor ?? s.color ?? "hsl(var(--background))", P = s.labelTextColor ?? "hsl(var(--foreground))", _ = `${String(e.xCoordinate)}-${f}-${v}`, p = Pt(
966
+ n,
967
+ Ye,
968
+ Ue[a]
638
969
  );
639
- if (!(c || f)) return null;
640
- const m = l.labelBackgroundColor ?? l.color ?? "hsl(var(--background))", T = l.labelTextColor ?? "hsl(var(--foreground))", k = `${String(e.xCoordinate)}-${c}`;
641
- return /* @__PURE__ */ K(
970
+ return /* @__PURE__ */ le(
642
971
  "div",
643
972
  {
644
- className: "absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
973
+ ref: (S) => {
974
+ Fe.current.set(a, S);
975
+ },
976
+ className: ie(
977
+ "group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
978
+ v && "pointer-events-auto cursor-default"
979
+ ),
645
980
  style: {
646
- left: r,
647
- transform: "translateX(-50%)",
648
- backgroundColor: m,
649
- color: T
981
+ ...p,
982
+ backgroundColor: W,
983
+ color: P
650
984
  },
651
985
  children: [
652
- c && /* @__PURE__ */ p("span", { className: "block", children: c }),
653
- f && /* @__PURE__ */ p("span", { className: he("block", c && "mt-0.5"), children: f })
986
+ f && /* @__PURE__ */ w("span", { className: "block", children: f }),
987
+ d && /* @__PURE__ */ w("span", { className: ie("block", f && "mt-0.5"), children: d }),
988
+ v && /* @__PURE__ */ w(
989
+ "span",
990
+ {
991
+ className: "pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",
992
+ role: "tooltip",
993
+ children: v
994
+ }
995
+ )
654
996
  ]
655
997
  },
656
- k
998
+ _
657
999
  );
658
1000
  })
659
1001
  }
660
1002
  ),
661
- /* @__PURE__ */ p(
1003
+ /* @__PURE__ */ w(
662
1004
  "div",
663
1005
  {
664
- ref: ae,
1006
+ ref: ge,
665
1007
  className: "LightweightChart w-full h-full overflow-hidden"
666
1008
  }
667
1009
  )
@@ -669,73 +1011,86 @@ function ht({
669
1011
  }
670
1012
  );
671
1013
  }
672
- function et({
673
- series: t,
674
- onUnselect: v
1014
+ function Mt({
1015
+ series: o,
1016
+ onUnselect: l,
1017
+ inline: u = !1
675
1018
  }) {
676
- return /* @__PURE__ */ p("div", { className: "absolute top-0 left-2 z-[10] flex flex-wrap gap-2", children: t.map((u, D) => {
677
- const g = Le(D), N = (u.lineColor ?? u.color) || g.line, _ = u.data.length === 0;
678
- return /* @__PURE__ */ K(
679
- "div",
680
- {
681
- className: he(
682
- "flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
683
- _ && "opacity-50"
684
- ),
685
- children: [
686
- /* @__PURE__ */ p(
687
- "div",
688
- {
689
- className: "w-3 h-3 rounded-sm",
690
- style: { backgroundColor: N }
691
- }
692
- ),
693
- /* @__PURE__ */ K("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
694
- u.label,
695
- _ && " (no data)"
696
- ] }),
697
- v && /* @__PURE__ */ p(
698
- "button",
699
- {
700
- type: "button",
701
- onClick: (x) => {
702
- x.stopPropagation(), v(u.label);
703
- },
704
- className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
705
- "aria-label": `Remove ${u.label}`,
706
- children: /* @__PURE__ */ K(
707
- "svg",
1019
+ return /* @__PURE__ */ w(
1020
+ "div",
1021
+ {
1022
+ className: ie(
1023
+ "flex flex-wrap gap-2",
1024
+ u ? "items-center" : "absolute top-0 left-2 z-[10]"
1025
+ ),
1026
+ children: o.map((c, h) => {
1027
+ const b = Ke(h), L = (c.lineColor ?? c.color) || b.line, y = c.data.length === 0;
1028
+ return /* @__PURE__ */ le(
1029
+ "div",
1030
+ {
1031
+ className: ie(
1032
+ "flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
1033
+ y && "opacity-50"
1034
+ ),
1035
+ children: [
1036
+ /* @__PURE__ */ w(
1037
+ "div",
708
1038
  {
709
- xmlns: "http://www.w3.org/2000/svg",
710
- width: "12",
711
- height: "12",
712
- viewBox: "0 0 24 24",
713
- fill: "none",
714
- stroke: "currentColor",
715
- strokeWidth: "2",
716
- strokeLinecap: "round",
717
- strokeLinejoin: "round",
718
- className: "text-muted-foreground hover:text-foreground",
719
- "aria-hidden": "true",
720
- children: [
721
- /* @__PURE__ */ p("title", { children: "Close" }),
722
- /* @__PURE__ */ p("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
723
- /* @__PURE__ */ p("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
724
- ]
1039
+ className: "w-3 h-3 rounded-sm",
1040
+ style: { backgroundColor: L }
1041
+ }
1042
+ ),
1043
+ /* @__PURE__ */ le("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
1044
+ c.label,
1045
+ y && " (no data)"
1046
+ ] }),
1047
+ l && /* @__PURE__ */ w(
1048
+ "button",
1049
+ {
1050
+ type: "button",
1051
+ onClick: (k) => {
1052
+ k.stopPropagation(), l(c.label);
1053
+ },
1054
+ className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
1055
+ "aria-label": `Remove ${c.label}`,
1056
+ children: /* @__PURE__ */ le(
1057
+ "svg",
1058
+ {
1059
+ xmlns: "http://www.w3.org/2000/svg",
1060
+ width: "12",
1061
+ height: "12",
1062
+ viewBox: "0 0 24 24",
1063
+ fill: "none",
1064
+ stroke: "currentColor",
1065
+ strokeWidth: "2",
1066
+ strokeLinecap: "round",
1067
+ strokeLinejoin: "round",
1068
+ className: "text-muted-foreground hover:text-foreground",
1069
+ "aria-hidden": "true",
1070
+ children: [
1071
+ /* @__PURE__ */ w("title", { children: "Close" }),
1072
+ /* @__PURE__ */ w("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1073
+ /* @__PURE__ */ w("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1074
+ ]
1075
+ }
1076
+ )
725
1077
  }
726
1078
  )
727
- }
728
- )
729
- ]
730
- },
731
- u.label
732
- );
733
- }) });
1079
+ ]
1080
+ },
1081
+ c.label
1082
+ );
1083
+ })
1084
+ }
1085
+ );
734
1086
  }
735
1087
  export {
736
- me as DEFAULT_SERIES_COLORS,
737
- ht as Graph,
738
- Le as getSeriesColorPalette,
739
- Ze as getStepForwardValue,
740
- Qe as getVerticalLineTooltipContent
1088
+ _e as DEFAULT_SERIES_COLORS,
1089
+ Ot as Graph,
1090
+ Mt as GraphLegend,
1091
+ Ze as VERTICAL_LINE_LABEL_EDGE_PADDING,
1092
+ Ke as getSeriesColorPalette,
1093
+ Lt as getStepForwardValue,
1094
+ Pt as getVerticalLineLabelStyle,
1095
+ Vt as getVerticalLineTooltipContent
741
1096
  };