@agg-market/ui 5.0.0 → 7.0.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.
Files changed (541) hide show
  1. package/README.md +42 -27
  2. package/dist/chunk-6I474QXG.mjs +2736 -0
  3. package/dist/chunk-AVHMI47G.mjs +2409 -0
  4. package/dist/chunk-BXW3VIKV.mjs +90 -0
  5. package/dist/{chunk-5K7VXAYM.mjs → chunk-EEQPPN7N.mjs} +2 -4
  6. package/dist/chunk-EERL6BZF.mjs +997 -0
  7. package/dist/chunk-KQKLLL4D.mjs +730 -0
  8. package/dist/chunk-KZOQW6NT.mjs +0 -0
  9. package/dist/chunk-L5U7RGJV.mjs +1211 -0
  10. package/dist/{connect-button.js → chunk-MUB7NYWZ.mjs} +1039 -876
  11. package/dist/chunk-OAJBTVZT.mjs +119 -0
  12. package/dist/{chunk-QDMHLRDY.mjs → chunk-OVQVAUAI.mjs} +167 -40
  13. package/dist/chunk-ZYUJ7YEJ.mjs +645 -0
  14. package/dist/events.d.mts +1 -0
  15. package/dist/events.d.ts +1 -0
  16. package/dist/{event-market-page.js → events.js} +5552 -5315
  17. package/dist/events.mjs +16 -0
  18. package/dist/index.d.mts +1 -79
  19. package/dist/index.d.ts +1 -79
  20. package/dist/index.js +9186 -8374
  21. package/dist/index.mjs +644 -170
  22. package/dist/modals.d.mts +1 -0
  23. package/dist/modals.d.ts +1 -0
  24. package/dist/{onboarding-modal.js → modals.js} +3472 -1335
  25. package/dist/modals.mjs +24 -0
  26. package/dist/pages.d.mts +1 -0
  27. package/dist/pages.d.ts +1 -0
  28. package/dist/pages.js +8590 -0
  29. package/dist/pages.mjs +16 -0
  30. package/dist/primitives.d.mts +1 -0
  31. package/dist/primitives.d.ts +1 -0
  32. package/dist/{market-details.js → primitives.js} +3914 -3741
  33. package/dist/{icon.mjs → primitives.mjs} +70 -9
  34. package/dist/styles.css +1 -1
  35. package/dist/tailwind.css +1 -1
  36. package/dist/trading.d.mts +1 -0
  37. package/dist/trading.d.ts +1 -0
  38. package/dist/{place-order.js → trading.js} +2404 -1409
  39. package/dist/trading.mjs +65 -0
  40. package/dist/types/auth/connect-button-view/connect-button-view.constants.d.mts +31 -0
  41. package/dist/types/auth/connect-button-view/connect-button-view.constants.d.ts +31 -0
  42. package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +83 -0
  43. package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +83 -0
  44. package/dist/types/auth/connect-button-view/index.d.mts +7 -0
  45. package/dist/types/auth/connect-button-view/index.d.ts +7 -0
  46. package/dist/types/auth/index.d.mts +1 -0
  47. package/dist/types/auth/index.d.ts +1 -0
  48. package/dist/types/constants.d.mts +1 -0
  49. package/dist/types/constants.d.ts +1 -0
  50. package/dist/types/deposit/deposit-modal.constants.d.mts +9 -0
  51. package/dist/types/deposit/deposit-modal.constants.d.ts +9 -0
  52. package/dist/{deposit-modal.d.mts → types/deposit/deposit-modal.types.d.mts} +3 -10
  53. package/dist/{deposit-modal.d.ts → types/deposit/deposit-modal.types.d.ts} +3 -10
  54. package/dist/types/deposit/index.d.mts +6 -0
  55. package/dist/types/deposit/index.d.ts +6 -0
  56. package/dist/types/deposit/steps/card-deposit.d.mts +7 -0
  57. package/dist/types/deposit/steps/card-deposit.d.ts +7 -0
  58. package/dist/types/deposit/steps/crypto-transfer.d.mts +7 -0
  59. package/dist/types/deposit/steps/crypto-transfer.d.ts +7 -0
  60. package/dist/types/deposit/steps/deposit-method.d.mts +7 -0
  61. package/dist/types/deposit/steps/deposit-method.d.ts +7 -0
  62. package/dist/types/deposit/steps/kalshi-deposit.d.mts +5 -0
  63. package/dist/types/deposit/steps/kalshi-deposit.d.ts +5 -0
  64. package/dist/types/deposit/steps/venue-selection.d.mts +7 -0
  65. package/dist/types/deposit/steps/venue-selection.d.ts +7 -0
  66. package/dist/types/events/index.d.mts +4 -0
  67. package/dist/types/events/index.d.ts +4 -0
  68. package/dist/types/events/item/event-list-item.constants.d.mts +1 -0
  69. package/dist/types/events/item/event-list-item.constants.d.ts +1 -0
  70. package/dist/types/events/item/event-list-item.types.d.mts +46 -0
  71. package/dist/types/events/item/event-list-item.types.d.ts +46 -0
  72. package/dist/types/events/item/event-list-item.utils.d.mts +23 -0
  73. package/dist/types/events/item/event-list-item.utils.d.ts +23 -0
  74. package/dist/types/events/item/index.d.mts +6 -0
  75. package/dist/types/events/item/index.d.ts +6 -0
  76. package/dist/types/events/item-details/event-list-item-details.constants.d.mts +10 -0
  77. package/dist/types/events/item-details/event-list-item-details.constants.d.ts +10 -0
  78. package/dist/types/events/item-details/event-list-item-details.types.d.mts +53 -0
  79. package/dist/types/events/item-details/event-list-item-details.types.d.ts +53 -0
  80. package/dist/types/events/item-details/event-list-item-details.utils.d.mts +26 -0
  81. package/dist/types/events/item-details/event-list-item-details.utils.d.ts +26 -0
  82. package/dist/types/events/item-details/index.d.mts +6 -0
  83. package/dist/types/events/item-details/index.d.ts +6 -0
  84. package/dist/types/events/list/event-list.constants.d.mts +3 -0
  85. package/dist/types/events/list/event-list.constants.d.ts +3 -0
  86. package/dist/types/events/list/event-list.types.d.mts +21 -0
  87. package/dist/types/events/list/event-list.types.d.ts +21 -0
  88. package/dist/types/events/list/event-list.utils.d.mts +6 -0
  89. package/dist/types/events/list/event-list.utils.d.ts +6 -0
  90. package/dist/types/events/list/index.d.mts +6 -0
  91. package/dist/types/events/list/index.d.ts +6 -0
  92. package/dist/types/events/market-details/index.d.mts +6 -0
  93. package/dist/types/events/market-details/index.d.ts +6 -0
  94. package/dist/types/events/market-details/market-details.constants.d.mts +9 -0
  95. package/dist/types/events/market-details/market-details.constants.d.ts +9 -0
  96. package/dist/types/events/market-details/market-details.types.d.mts +63 -0
  97. package/dist/types/events/market-details/market-details.types.d.ts +63 -0
  98. package/dist/types/events/market-details/market-details.utils.d.mts +46 -0
  99. package/dist/types/events/market-details/market-details.utils.d.ts +46 -0
  100. package/dist/types/index.d.mts +9 -0
  101. package/dist/types/index.d.ts +9 -0
  102. package/dist/types/modals/index.d.mts +4 -0
  103. package/dist/types/modals/index.d.ts +4 -0
  104. package/dist/types/onboarding/index.d.mts +11 -0
  105. package/dist/types/onboarding/index.d.ts +11 -0
  106. package/dist/types/onboarding/onboarding-modal.constants.d.mts +10 -0
  107. package/dist/types/onboarding/onboarding-modal.constants.d.ts +10 -0
  108. package/dist/types/onboarding/onboarding-modal.types.d.mts +55 -0
  109. package/dist/types/onboarding/onboarding-modal.types.d.ts +55 -0
  110. package/dist/types/onboarding/steps/connect-accounts.d.mts +5 -0
  111. package/dist/types/onboarding/steps/connect-accounts.d.ts +5 -0
  112. package/dist/types/onboarding/steps/connect-kalshi-modal.d.mts +5 -0
  113. package/dist/types/onboarding/steps/connect-kalshi-modal.d.ts +5 -0
  114. package/dist/types/onboarding/steps/connect-onchain-modal.d.mts +5 -0
  115. package/dist/types/onboarding/steps/connect-onchain-modal.d.ts +5 -0
  116. package/dist/types/onboarding/steps/how-it-works.d.mts +5 -0
  117. package/dist/types/onboarding/steps/how-it-works.d.ts +5 -0
  118. package/dist/types/onboarding/steps/profile-setup.d.mts +5 -0
  119. package/dist/types/onboarding/steps/profile-setup.d.ts +5 -0
  120. package/dist/types/pages/event-market/event-market.types.d.mts +42 -0
  121. package/dist/types/pages/event-market/event-market.types.d.ts +42 -0
  122. package/dist/types/pages/event-market/index.d.mts +6 -0
  123. package/dist/types/pages/event-market/index.d.ts +6 -0
  124. package/dist/types/pages/home/home.constants.d.mts +8 -0
  125. package/dist/types/pages/home/home.constants.d.ts +8 -0
  126. package/dist/{home-page.d.ts → types/pages/home/home.types.d.mts} +8 -18
  127. package/dist/{home-page.d.mts → types/pages/home/home.types.d.ts} +8 -18
  128. package/dist/types/pages/home/home.utils.d.mts +3 -0
  129. package/dist/types/pages/home/home.utils.d.ts +3 -0
  130. package/dist/types/pages/home/index.d.mts +6 -0
  131. package/dist/types/pages/home/index.d.ts +6 -0
  132. package/dist/types/pages/index.d.mts +3 -0
  133. package/dist/types/pages/index.d.ts +3 -0
  134. package/dist/types/pages/user-profile/components/activity-row.d.mts +10 -0
  135. package/dist/types/pages/user-profile/components/activity-row.d.ts +10 -0
  136. package/dist/types/pages/user-profile/components/balance-display.d.mts +12 -0
  137. package/dist/types/pages/user-profile/components/balance-display.d.ts +12 -0
  138. package/dist/types/pages/user-profile/components/balances-card.d.mts +12 -0
  139. package/dist/types/pages/user-profile/components/balances-card.d.ts +12 -0
  140. package/dist/types/pages/user-profile/components/default-avatar.d.mts +8 -0
  141. package/dist/types/pages/user-profile/components/default-avatar.d.ts +8 -0
  142. package/dist/types/pages/user-profile/components/empty-state.d.mts +10 -0
  143. package/dist/types/pages/user-profile/components/empty-state.d.ts +10 -0
  144. package/dist/types/pages/user-profile/components/position-row.d.mts +10 -0
  145. package/dist/types/pages/user-profile/components/position-row.d.ts +10 -0
  146. package/dist/types/pages/user-profile/components/positions-activity.d.mts +14 -0
  147. package/dist/types/pages/user-profile/components/positions-activity.d.ts +14 -0
  148. package/dist/types/pages/user-profile/components/user-info-card.d.mts +11 -0
  149. package/dist/types/pages/user-profile/components/user-info-card.d.ts +11 -0
  150. package/dist/types/pages/user-profile/index.d.mts +6 -0
  151. package/dist/types/pages/user-profile/index.d.ts +6 -0
  152. package/dist/types/pages/user-profile/user-profile.constants.d.mts +9 -0
  153. package/dist/types/pages/user-profile/user-profile.constants.d.ts +9 -0
  154. package/dist/{user-profile-page.d.ts → types/pages/user-profile/user-profile.types.d.mts} +12 -22
  155. package/dist/{user-profile-page.d.mts → types/pages/user-profile/user-profile.types.d.ts} +12 -22
  156. package/dist/types/primitives/badge/badge.constants.d.mts +4 -0
  157. package/dist/types/primitives/badge/badge.constants.d.ts +4 -0
  158. package/dist/types/primitives/badge/badge.types.d.mts +18 -0
  159. package/dist/types/primitives/badge/badge.types.d.ts +18 -0
  160. package/dist/types/primitives/badge/index.d.mts +7 -0
  161. package/dist/types/primitives/badge/index.d.ts +7 -0
  162. package/dist/types/primitives/button/button.constants.d.mts +6 -0
  163. package/dist/types/primitives/button/button.constants.d.ts +6 -0
  164. package/dist/types/primitives/button/button.types.d.mts +12 -0
  165. package/dist/types/primitives/button/button.types.d.ts +12 -0
  166. package/dist/types/primitives/button/index.d.mts +6 -0
  167. package/dist/types/primitives/button/index.d.ts +6 -0
  168. package/dist/types/primitives/card/card.types.d.mts +3 -0
  169. package/dist/types/primitives/card/card.types.d.ts +3 -0
  170. package/dist/types/primitives/card/index.d.mts +6 -0
  171. package/dist/types/primitives/card/index.d.ts +6 -0
  172. package/dist/types/primitives/chart/chart-type-switch.d.mts +10 -0
  173. package/dist/types/primitives/chart/chart-type-switch.d.ts +10 -0
  174. package/dist/{chart.d.mts → types/primitives/chart/index.d.mts} +14 -11
  175. package/dist/{chart.d.ts → types/primitives/chart/index.d.ts} +14 -11
  176. package/dist/types/primitives/hello-world.d.mts +4 -0
  177. package/dist/types/primitives/hello-world.d.ts +4 -0
  178. package/dist/types/primitives/icon/icon.constants.d.mts +2 -0
  179. package/dist/types/primitives/icon/icon.constants.d.ts +2 -0
  180. package/dist/types/primitives/icon/icon.types.d.mts +9 -0
  181. package/dist/types/primitives/icon/icon.types.d.ts +9 -0
  182. package/dist/types/primitives/icon/icon.utils.d.mts +2 -0
  183. package/dist/types/primitives/icon/icon.utils.d.ts +2 -0
  184. package/dist/types/primitives/icon/index.d.mts +53 -0
  185. package/dist/types/primitives/icon/index.d.ts +53 -0
  186. package/dist/types/primitives/icon/registry.d.mts +194 -0
  187. package/dist/types/primitives/icon/registry.d.ts +194 -0
  188. package/dist/types/primitives/icon/svg/apple.d.mts +5 -0
  189. package/dist/types/primitives/icon/svg/apple.d.ts +5 -0
  190. package/dist/types/primitives/icon/svg/arrow-trend-up.d.mts +5 -0
  191. package/dist/types/primitives/icon/svg/arrow-trend-up.d.ts +5 -0
  192. package/dist/types/primitives/icon/svg/arrows-to-dot.d.mts +5 -0
  193. package/dist/types/primitives/icon/svg/arrows-to-dot.d.ts +5 -0
  194. package/dist/types/primitives/icon/svg/bank.d.mts +5 -0
  195. package/dist/types/primitives/icon/svg/bank.d.ts +5 -0
  196. package/dist/types/primitives/icon/svg/best-prices.d.mts +5 -0
  197. package/dist/types/primitives/icon/svg/best-prices.d.ts +5 -0
  198. package/dist/types/primitives/icon/svg/bolt.d.mts +5 -0
  199. package/dist/types/primitives/icon/svg/bolt.d.ts +5 -0
  200. package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +5 -0
  201. package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +5 -0
  202. package/dist/types/primitives/icon/svg/chart-line.d.mts +5 -0
  203. package/dist/types/primitives/icon/svg/chart-line.d.ts +5 -0
  204. package/dist/types/primitives/icon/svg/check-badge.d.mts +5 -0
  205. package/dist/types/primitives/icon/svg/check-badge.d.ts +5 -0
  206. package/dist/types/primitives/icon/svg/check-circle.d.mts +5 -0
  207. package/dist/types/primitives/icon/svg/check-circle.d.ts +5 -0
  208. package/dist/types/primitives/icon/svg/chevron-down.d.mts +5 -0
  209. package/dist/types/primitives/icon/svg/chevron-down.d.ts +5 -0
  210. package/dist/types/primitives/icon/svg/chevron-left.d.mts +5 -0
  211. package/dist/types/primitives/icon/svg/chevron-left.d.ts +5 -0
  212. package/dist/types/primitives/icon/svg/chevron-right.d.mts +5 -0
  213. package/dist/types/primitives/icon/svg/chevron-right.d.ts +5 -0
  214. package/dist/types/primitives/icon/svg/chevron-up.d.mts +5 -0
  215. package/dist/types/primitives/icon/svg/chevron-up.d.ts +5 -0
  216. package/dist/types/primitives/icon/svg/close.d.mts +5 -0
  217. package/dist/types/primitives/icon/svg/close.d.ts +5 -0
  218. package/dist/types/primitives/icon/svg/copy.d.mts +5 -0
  219. package/dist/types/primitives/icon/svg/copy.d.ts +5 -0
  220. package/dist/types/primitives/icon/svg/create-account.d.mts +5 -0
  221. package/dist/types/primitives/icon/svg/create-account.d.ts +5 -0
  222. package/dist/types/primitives/icon/svg/credit-card.d.mts +5 -0
  223. package/dist/types/primitives/icon/svg/credit-card.d.ts +5 -0
  224. package/dist/types/primitives/icon/svg/disconnect.d.mts +5 -0
  225. package/dist/types/primitives/icon/svg/disconnect.d.ts +5 -0
  226. package/dist/types/primitives/icon/svg/discord.d.mts +5 -0
  227. package/dist/types/primitives/icon/svg/discord.d.ts +5 -0
  228. package/dist/types/primitives/icon/svg/document.d.mts +5 -0
  229. package/dist/types/primitives/icon/svg/document.d.ts +5 -0
  230. package/dist/types/primitives/icon/svg/dots-horizontal.d.mts +5 -0
  231. package/dist/types/primitives/icon/svg/dots-horizontal.d.ts +5 -0
  232. package/dist/types/primitives/icon/svg/download.d.mts +5 -0
  233. package/dist/types/primitives/icon/svg/download.d.ts +5 -0
  234. package/dist/types/primitives/icon/svg/email.d.mts +5 -0
  235. package/dist/types/primitives/icon/svg/email.d.ts +5 -0
  236. package/dist/types/primitives/icon/svg/error-filled.d.mts +5 -0
  237. package/dist/types/primitives/icon/svg/error-filled.d.ts +5 -0
  238. package/dist/types/primitives/icon/svg/ethereum.d.mts +5 -0
  239. package/dist/types/primitives/icon/svg/ethereum.d.ts +5 -0
  240. package/dist/types/primitives/icon/svg/external-link.d.mts +5 -0
  241. package/dist/types/primitives/icon/svg/external-link.d.ts +5 -0
  242. package/dist/types/primitives/icon/svg/google.d.mts +5 -0
  243. package/dist/types/primitives/icon/svg/google.d.ts +5 -0
  244. package/dist/types/primitives/icon/svg/info.d.mts +5 -0
  245. package/dist/types/primitives/icon/svg/info.d.ts +5 -0
  246. package/dist/types/primitives/icon/svg/link-accounts.d.mts +5 -0
  247. package/dist/types/primitives/icon/svg/link-accounts.d.ts +5 -0
  248. package/dist/types/primitives/icon/svg/pencil.d.mts +5 -0
  249. package/dist/types/primitives/icon/svg/pencil.d.ts +5 -0
  250. package/dist/types/primitives/icon/svg/play-square.d.mts +5 -0
  251. package/dist/types/primitives/icon/svg/play-square.d.ts +5 -0
  252. package/dist/types/primitives/icon/svg/profile.d.mts +5 -0
  253. package/dist/types/primitives/icon/svg/profile.d.ts +5 -0
  254. package/dist/types/primitives/icon/svg/revenue-alt.d.mts +5 -0
  255. package/dist/types/primitives/icon/svg/revenue-alt.d.ts +5 -0
  256. package/dist/types/primitives/icon/svg/search.d.mts +5 -0
  257. package/dist/types/primitives/icon/svg/search.d.ts +5 -0
  258. package/dist/types/primitives/icon/svg/shield-trust.d.mts +5 -0
  259. package/dist/types/primitives/icon/svg/shield-trust.d.ts +5 -0
  260. package/dist/types/primitives/icon/svg/solana.d.mts +5 -0
  261. package/dist/types/primitives/icon/svg/solana.d.ts +5 -0
  262. package/dist/types/primitives/icon/svg/stay-in-control.d.mts +5 -0
  263. package/dist/types/primitives/icon/svg/stay-in-control.d.ts +5 -0
  264. package/dist/types/primitives/icon/svg/telegram.d.mts +5 -0
  265. package/dist/types/primitives/icon/svg/telegram.d.ts +5 -0
  266. package/dist/types/primitives/icon/svg/triangle-down.d.mts +5 -0
  267. package/dist/types/primitives/icon/svg/triangle-down.d.ts +5 -0
  268. package/dist/types/primitives/icon/svg/triangle-up-filled.d.mts +5 -0
  269. package/dist/types/primitives/icon/svg/triangle-up-filled.d.ts +5 -0
  270. package/dist/types/primitives/icon/svg/triangle-up.d.mts +5 -0
  271. package/dist/types/primitives/icon/svg/triangle-up.d.ts +5 -0
  272. package/dist/types/primitives/icon/svg/twitter.d.mts +5 -0
  273. package/dist/types/primitives/icon/svg/twitter.d.ts +5 -0
  274. package/dist/types/primitives/icon/svg/upload.d.mts +5 -0
  275. package/dist/types/primitives/icon/svg/upload.d.ts +5 -0
  276. package/dist/types/primitives/icon/svg/wallet-avatar.d.mts +5 -0
  277. package/dist/types/primitives/icon/svg/wallet-avatar.d.ts +5 -0
  278. package/dist/types/primitives/icon/svg/wallet.d.mts +5 -0
  279. package/dist/types/primitives/icon/svg/wallet.d.ts +5 -0
  280. package/dist/types/primitives/icon/svg/warning-filled.d.mts +5 -0
  281. package/dist/types/primitives/icon/svg/warning-filled.d.ts +5 -0
  282. package/dist/types/primitives/icon/svg/warning.d.mts +5 -0
  283. package/dist/types/primitives/icon/svg/warning.d.ts +5 -0
  284. package/dist/types/primitives/icon/types.d.mts +5 -0
  285. package/dist/types/primitives/icon/types.d.ts +5 -0
  286. package/dist/types/primitives/index.d.mts +18 -0
  287. package/dist/types/primitives/index.d.ts +18 -0
  288. package/dist/types/primitives/inline-alert/index.d.mts +16 -0
  289. package/dist/types/primitives/inline-alert/index.d.ts +16 -0
  290. package/dist/types/primitives/loading-icon/index.d.mts +11 -0
  291. package/dist/types/primitives/loading-icon/index.d.ts +11 -0
  292. package/dist/types/primitives/modal/index.d.mts +10 -0
  293. package/dist/types/primitives/modal/index.d.ts +10 -0
  294. package/dist/types/primitives/modal/modal.types.d.mts +54 -0
  295. package/dist/types/primitives/modal/modal.types.d.ts +54 -0
  296. package/dist/{number-value.d.mts → types/primitives/number-value.d.mts} +3 -5
  297. package/dist/{number-value.d.ts → types/primitives/number-value.d.ts} +3 -5
  298. package/dist/types/primitives/search/index.d.mts +6 -0
  299. package/dist/types/primitives/search/index.d.ts +6 -0
  300. package/dist/types/primitives/search/search-empty-icon.d.mts +5 -0
  301. package/dist/types/primitives/search/search-empty-icon.d.ts +5 -0
  302. package/dist/types/primitives/search/search.types.d.mts +96 -0
  303. package/dist/types/primitives/search/search.types.d.ts +96 -0
  304. package/dist/{select.d.mts → types/primitives/select/index.d.mts} +3 -5
  305. package/dist/{select.d.ts → types/primitives/select/index.d.ts} +3 -5
  306. package/dist/types/primitives/skeleton/index.d.mts +7 -0
  307. package/dist/types/primitives/skeleton/index.d.ts +7 -0
  308. package/dist/types/primitives/skeleton/skeleton-block.d.mts +8 -0
  309. package/dist/types/primitives/skeleton/skeleton-block.d.ts +8 -0
  310. package/dist/{skeleton.d.mts → types/primitives/skeleton/skeleton.types.d.mts} +6 -9
  311. package/dist/{skeleton.d.ts → types/primitives/skeleton/skeleton.types.d.ts} +6 -9
  312. package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.mts +5 -0
  313. package/dist/types/primitives/skeleton/views/event-list-item-details-skeleton-view.d.ts +5 -0
  314. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +9 -0
  315. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +9 -0
  316. package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.mts +5 -0
  317. package/dist/types/primitives/skeleton/views/event-list-skeleton-view.d.ts +5 -0
  318. package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.mts +12 -0
  319. package/dist/types/primitives/skeleton/views/market-details-skeleton-view.d.ts +12 -0
  320. package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +5 -0
  321. package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +5 -0
  322. package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.mts +5 -0
  323. package/dist/types/primitives/skeleton/views/settlement-skeleton-view.d.ts +5 -0
  324. package/dist/{state-message.d.mts → types/primitives/state-message/index.d.mts} +2 -3
  325. package/dist/{state-message.d.ts → types/primitives/state-message/index.d.ts} +2 -3
  326. package/dist/{switch-button.d.mts → types/primitives/switch-button/index.d.mts} +4 -7
  327. package/dist/{switch-button.d.ts → types/primitives/switch-button/index.d.ts} +4 -7
  328. package/dist/types/primitives/tabs/index.d.mts +6 -0
  329. package/dist/types/primitives/tabs/index.d.ts +6 -0
  330. package/dist/types/primitives/tabs/tabs.types.d.mts +24 -0
  331. package/dist/types/primitives/tabs/tabs.types.d.ts +24 -0
  332. package/dist/types/primitives/tabs/tabs.utils.d.mts +14 -0
  333. package/dist/types/primitives/tabs/tabs.utils.d.ts +14 -0
  334. package/dist/types/primitives/typography/index.d.mts +7 -0
  335. package/dist/types/primitives/typography/index.d.ts +7 -0
  336. package/dist/types/primitives/typography/typography.constants.d.mts +3 -0
  337. package/dist/types/primitives/typography/typography.constants.d.ts +3 -0
  338. package/dist/types/primitives/typography/typography.types.d.mts +8 -0
  339. package/dist/types/primitives/typography/typography.types.d.ts +8 -0
  340. package/dist/types/primitives/venue-logo/index.d.mts +8 -0
  341. package/dist/types/primitives/venue-logo/index.d.ts +8 -0
  342. package/dist/types/primitives/venue-logo/logo-props.d.mts +10 -0
  343. package/dist/types/primitives/venue-logo/logo-props.d.ts +10 -0
  344. package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.mts +5 -0
  345. package/dist/types/primitives/venue-logo/svg/logo-kalshi.d.ts +5 -0
  346. package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +5 -0
  347. package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +5 -0
  348. package/dist/types/primitives/venue-logo/svg/logo-opinion.d.mts +5 -0
  349. package/dist/types/primitives/venue-logo/svg/logo-opinion.d.ts +5 -0
  350. package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.mts +5 -0
  351. package/dist/types/primitives/venue-logo/svg/logo-polymarket.d.ts +5 -0
  352. package/dist/types/primitives/venue-logo/svg/logo-probable.d.mts +5 -0
  353. package/dist/types/primitives/venue-logo/svg/logo-probable.d.ts +5 -0
  354. package/dist/types/primitives/venue-logo/venue-logo.constants.d.mts +9 -0
  355. package/dist/types/primitives/venue-logo/venue-logo.constants.d.ts +9 -0
  356. package/dist/types/primitives/venue-logo/venue-logo.types.d.mts +17 -0
  357. package/dist/types/primitives/venue-logo/venue-logo.types.d.ts +17 -0
  358. package/dist/types/profile/index.d.mts +6 -0
  359. package/dist/types/profile/index.d.ts +6 -0
  360. package/dist/types/profile/profile-modal.constants.d.mts +17 -0
  361. package/dist/types/profile/profile-modal.constants.d.ts +17 -0
  362. package/dist/{profile-modal.d.mts → types/profile/profile-modal.types.d.mts} +4 -11
  363. package/dist/{profile-modal.d.ts → types/profile/profile-modal.types.d.ts} +4 -11
  364. package/dist/types/profile/tabs/about-tab.d.mts +16 -0
  365. package/dist/types/profile/tabs/about-tab.d.ts +16 -0
  366. package/dist/types/profile/tabs/accounts-wallets-tab.d.mts +18 -0
  367. package/dist/types/profile/tabs/accounts-wallets-tab.d.ts +18 -0
  368. package/dist/types/shared/constants.d.mts +23 -0
  369. package/dist/types/shared/constants.d.ts +23 -0
  370. package/dist/types/shared/query-error.d.mts +2 -0
  371. package/dist/types/shared/query-error.d.ts +2 -0
  372. package/dist/types/shared/types.d.mts +1 -0
  373. package/dist/types/shared/types.d.ts +1 -0
  374. package/dist/types/shared/utils.d.mts +15 -0
  375. package/dist/types/shared/utils.d.ts +15 -0
  376. package/dist/types/trading/index.d.mts +4 -0
  377. package/dist/types/trading/index.d.ts +4 -0
  378. package/dist/{place-order.d.ts → types/trading/place-order/index.d.mts} +3 -7
  379. package/dist/{place-order.d.mts → types/trading/place-order/index.d.ts} +3 -7
  380. package/dist/{settlement.d.ts → types/trading/settlement/index.d.mts} +3 -7
  381. package/dist/{settlement.d.mts → types/trading/settlement/index.d.ts} +3 -7
  382. package/dist/{types-BImwqY4o.d.ts → types/trading/types.d.mts} +61 -64
  383. package/dist/{types-BImwqY4o.d.mts → types/trading/types.d.ts} +61 -64
  384. package/dist/types/trading/utils.d.mts +16 -0
  385. package/dist/types/trading/utils.d.ts +16 -0
  386. package/dist/types/withdraw/index.d.mts +6 -0
  387. package/dist/types/withdraw/index.d.ts +6 -0
  388. package/dist/types/withdraw/steps/kalshi-withdraw.d.mts +5 -0
  389. package/dist/types/withdraw/steps/kalshi-withdraw.d.ts +5 -0
  390. package/dist/types/withdraw/steps/venue-selection.d.mts +6 -0
  391. package/dist/types/withdraw/steps/venue-selection.d.ts +6 -0
  392. package/dist/types/withdraw/steps/withdraw-amount.d.mts +8 -0
  393. package/dist/types/withdraw/steps/withdraw-amount.d.ts +8 -0
  394. package/dist/types/withdraw/steps/withdraw-method.d.mts +7 -0
  395. package/dist/types/withdraw/steps/withdraw-method.d.ts +7 -0
  396. package/dist/types/withdraw/withdraw-modal.constants.d.mts +9 -0
  397. package/dist/types/withdraw/withdraw-modal.constants.d.ts +9 -0
  398. package/dist/{withdraw-modal.d.mts → types/withdraw/withdraw-modal.types.d.mts} +3 -10
  399. package/dist/{withdraw-modal.d.ts → types/withdraw/withdraw-modal.types.d.ts} +3 -10
  400. package/package.json +29 -291
  401. package/dist/badge.d.mts +0 -28
  402. package/dist/badge.d.ts +0 -28
  403. package/dist/badge.js +0 -110
  404. package/dist/badge.mjs +0 -9
  405. package/dist/button.d.mts +0 -20
  406. package/dist/button.d.ts +0 -20
  407. package/dist/button.js +0 -183
  408. package/dist/button.mjs +0 -8
  409. package/dist/card.d.mts +0 -10
  410. package/dist/card.d.ts +0 -10
  411. package/dist/card.js +0 -88
  412. package/dist/card.mjs +0 -7
  413. package/dist/chart.js +0 -438
  414. package/dist/chart.mjs +0 -8
  415. package/dist/chunk-34IRJYSU.mjs +0 -146
  416. package/dist/chunk-3QLOUBDJ.mjs +0 -483
  417. package/dist/chunk-3W7NBJLU.mjs +0 -371
  418. package/dist/chunk-4343LYSH.mjs +0 -45
  419. package/dist/chunk-4S3I6X7F.mjs +0 -855
  420. package/dist/chunk-4VUDTWH7.mjs +0 -42
  421. package/dist/chunk-5ADMXO3Y.mjs +0 -456
  422. package/dist/chunk-6JG6I5AY.mjs +0 -654
  423. package/dist/chunk-BNDFQPHF.mjs +0 -9
  424. package/dist/chunk-CTYJVVHJ.mjs +0 -334
  425. package/dist/chunk-DHBHKIJR.mjs +0 -1049
  426. package/dist/chunk-ERGNR6UQ.mjs +0 -67
  427. package/dist/chunk-FO263M3V.mjs +0 -10
  428. package/dist/chunk-FO2QCB4Z.mjs +0 -35
  429. package/dist/chunk-GFBF2J3Y.mjs +0 -328
  430. package/dist/chunk-GJ4U5NCE.mjs +0 -134
  431. package/dist/chunk-IGPNIM2B.mjs +0 -83
  432. package/dist/chunk-K6IJ4WBM.mjs +0 -67
  433. package/dist/chunk-KAGYJ4XT.mjs +0 -126
  434. package/dist/chunk-KIYMVWL4.mjs +0 -280
  435. package/dist/chunk-LCZKSITC.mjs +0 -162
  436. package/dist/chunk-M4RJHRFT.mjs +0 -445
  437. package/dist/chunk-MJHKBCXQ.mjs +0 -379
  438. package/dist/chunk-MKVGQ7AS.mjs +0 -168
  439. package/dist/chunk-NDG43KGL.mjs +0 -44
  440. package/dist/chunk-NH2G3POM.mjs +0 -470
  441. package/dist/chunk-OBCHURW5.mjs +0 -64
  442. package/dist/chunk-OJVTGNIF.mjs +0 -230
  443. package/dist/chunk-PORVP72S.mjs +0 -277
  444. package/dist/chunk-PZTHM6WG.mjs +0 -1340
  445. package/dist/chunk-Q6DGDBPV.mjs +0 -774
  446. package/dist/chunk-QLMVKLNJ.mjs +0 -669
  447. package/dist/chunk-S3H63TQ5.mjs +0 -537
  448. package/dist/chunk-T7TATHPD.mjs +0 -313
  449. package/dist/chunk-XUCS575S.mjs +0 -65
  450. package/dist/chunk-YJA5VQW6.mjs +0 -167
  451. package/dist/chunk-ZFMCCBP6.mjs +0 -25
  452. package/dist/connect-button.d.mts +0 -40
  453. package/dist/connect-button.d.ts +0 -40
  454. package/dist/connect-button.mjs +0 -14
  455. package/dist/deposit-modal.js +0 -2801
  456. package/dist/deposit-modal.mjs +0 -15
  457. package/dist/event-list-item-details.d.mts +0 -11
  458. package/dist/event-list-item-details.d.ts +0 -11
  459. package/dist/event-list-item-details.js +0 -3711
  460. package/dist/event-list-item-details.mjs +0 -23
  461. package/dist/event-list-item-details.types-CMbXOrT-.d.ts +0 -53
  462. package/dist/event-list-item-details.types-DekJKeMD.d.mts +0 -53
  463. package/dist/event-list-item.d.mts +0 -10
  464. package/dist/event-list-item.d.ts +0 -10
  465. package/dist/event-list-item.js +0 -2821
  466. package/dist/event-list-item.mjs +0 -20
  467. package/dist/event-list-item.types-Y6IeJ4e4.d.mts +0 -46
  468. package/dist/event-list-item.types-Y6IeJ4e4.d.ts +0 -46
  469. package/dist/event-list.d.mts +0 -9
  470. package/dist/event-list.d.ts +0 -9
  471. package/dist/event-list.js +0 -3802
  472. package/dist/event-list.mjs +0 -23
  473. package/dist/event-list.types-CkAAUqwW.d.mts +0 -13
  474. package/dist/event-list.types-CkAAUqwW.d.ts +0 -13
  475. package/dist/event-market-page.d.mts +0 -52
  476. package/dist/event-market-page.d.ts +0 -52
  477. package/dist/event-market-page.mjs +0 -30
  478. package/dist/hello-world.d.mts +0 -8
  479. package/dist/hello-world.d.ts +0 -8
  480. package/dist/hello-world.js +0 -92
  481. package/dist/hello-world.mjs +0 -8
  482. package/dist/home-page.js +0 -4066
  483. package/dist/home-page.mjs +0 -24
  484. package/dist/icon.d.mts +0 -193
  485. package/dist/icon.d.ts +0 -193
  486. package/dist/icon.js +0 -1465
  487. package/dist/loading-icon.d.mts +0 -14
  488. package/dist/loading-icon.d.ts +0 -14
  489. package/dist/loading-icon.js +0 -112
  490. package/dist/loading-icon.mjs +0 -8
  491. package/dist/market-details.d.mts +0 -73
  492. package/dist/market-details.d.ts +0 -73
  493. package/dist/market-details.mjs +0 -24
  494. package/dist/modal.d.mts +0 -66
  495. package/dist/modal.d.ts +0 -66
  496. package/dist/modal.js +0 -321
  497. package/dist/modal.mjs +0 -9
  498. package/dist/number-value.js +0 -67
  499. package/dist/number-value.mjs +0 -7
  500. package/dist/onboarding-modal.d.mts +0 -88
  501. package/dist/onboarding-modal.d.ts +0 -88
  502. package/dist/onboarding-modal.mjs +0 -24
  503. package/dist/place-order.mjs +0 -18
  504. package/dist/profile-modal.js +0 -2447
  505. package/dist/profile-modal.mjs +0 -14
  506. package/dist/registry-DfSCFAdC.d.mts +0 -178
  507. package/dist/registry-DfSCFAdC.d.ts +0 -178
  508. package/dist/search.d.mts +0 -51
  509. package/dist/search.d.ts +0 -51
  510. package/dist/search.js +0 -1957
  511. package/dist/search.mjs +0 -13
  512. package/dist/select.js +0 -1552
  513. package/dist/select.mjs +0 -11
  514. package/dist/settlement.js +0 -2445
  515. package/dist/settlement.mjs +0 -15
  516. package/dist/skeleton.js +0 -490
  517. package/dist/skeleton.mjs +0 -10
  518. package/dist/state-message.js +0 -1629
  519. package/dist/state-message.mjs +0 -14
  520. package/dist/switch-button.js +0 -191
  521. package/dist/switch-button.mjs +0 -7
  522. package/dist/tabs.d.mts +0 -31
  523. package/dist/tabs.d.ts +0 -31
  524. package/dist/tabs.js +0 -2078
  525. package/dist/tabs.mjs +0 -12
  526. package/dist/types-BVj9ky9P.d.mts +0 -3
  527. package/dist/types-BVj9ky9P.d.ts +0 -3
  528. package/dist/typography.d.mts +0 -18
  529. package/dist/typography.d.ts +0 -18
  530. package/dist/typography.js +0 -93
  531. package/dist/typography.mjs +0 -9
  532. package/dist/user-profile-page.js +0 -3081
  533. package/dist/user-profile-page.mjs +0 -15
  534. package/dist/venue-logo.d.mts +0 -13
  535. package/dist/venue-logo.d.ts +0 -13
  536. package/dist/venue-logo.js +0 -323
  537. package/dist/venue-logo.mjs +0 -10
  538. package/dist/venue-logo.types-CGUc22ly.d.mts +0 -19
  539. package/dist/venue-logo.types-Dqr39S1-.d.ts +0 -19
  540. package/dist/withdraw-modal.js +0 -2449
  541. package/dist/withdraw-modal.mjs +0 -14
@@ -0,0 +1,2736 @@
1
+ import {
2
+ Badge,
3
+ LineChart,
4
+ StateMessage,
5
+ SwitchButton,
6
+ Typography
7
+ } from "./chunk-ZYUJ7YEJ.mjs";
8
+ import {
9
+ Card,
10
+ MarketDetailsOderbookSkeleton,
11
+ Skeleton,
12
+ Tabs,
13
+ baseCardClassName,
14
+ detailsBaseCardClassName,
15
+ eventListItemDetailsTimeRanges,
16
+ fallbackLineColors,
17
+ getMarketDetailsTabs,
18
+ lineColorByVenue,
19
+ marketDetailsBaseCardClassName,
20
+ marketDetailsDefaultIsOpened,
21
+ orderBookRowLimitDefault
22
+ } from "./chunk-EERL6BZF.mjs";
23
+ import {
24
+ Button,
25
+ Icon,
26
+ VenueLogo,
27
+ __objRest,
28
+ __spreadProps,
29
+ __spreadValues,
30
+ cn,
31
+ getMotionClassName,
32
+ toDate
33
+ } from "./chunk-MUB7NYWZ.mjs";
34
+
35
+ // src/events/item/index.tsx
36
+ import dayjs from "dayjs";
37
+ import { useMemo } from "react";
38
+ import {
39
+ useEvent,
40
+ useLabels,
41
+ useSdkUiConfig
42
+ } from "@agg-market/hooks";
43
+
44
+ // src/shared/query-error.ts
45
+ var getErrorStatus = (error) => {
46
+ if (!error || typeof error !== "object")
47
+ return null;
48
+ const status = error.status;
49
+ return typeof status === "number" ? status : null;
50
+ };
51
+ var isErrorWithStatus = (error, status) => {
52
+ return getErrorStatus(error) === status;
53
+ };
54
+
55
+ // src/events/item/event-list-item.utils.ts
56
+ var resolveEventListItemEvent = (fetchedEvent) => {
57
+ if (!fetchedEvent)
58
+ return void 0;
59
+ const mergedVenueMarkets = fetchedEvent.markets.flatMap(
60
+ (market) => market.venueMarkets
61
+ );
62
+ if (mergedVenueMarkets.length === 0)
63
+ return void 0;
64
+ return fetchedEvent;
65
+ };
66
+ var normalizeProbability = (value) => {
67
+ if (typeof value !== "number" || !Number.isFinite(value))
68
+ return void 0;
69
+ if (value < 0)
70
+ return 0;
71
+ if (value > 1)
72
+ return 1;
73
+ return value;
74
+ };
75
+ var hasDateLabel = (outcome) => {
76
+ return !!toDate(outcome.label);
77
+ };
78
+ var sortOutcomes = (outcomes) => {
79
+ if (outcomes.length <= 1)
80
+ return outcomes;
81
+ const now = Date.now();
82
+ if (outcomes.some(hasDateLabel)) {
83
+ return [...outcomes].sort((a, b) => {
84
+ var _a, _b, _c, _d;
85
+ const aDate = (_b = (_a = toDate(a.label)) == null ? void 0 : _a.getTime()) != null ? _b : 0;
86
+ const bDate = (_d = (_c = toDate(b.label)) == null ? void 0 : _c.getTime()) != null ? _d : 0;
87
+ return Math.abs(aDate - now) - Math.abs(bDate - now);
88
+ });
89
+ }
90
+ return [...outcomes].sort((a, b) => {
91
+ var _a, _b;
92
+ const aPrice = (_a = normalizeProbability(a.price)) != null ? _a : 0;
93
+ const bPrice = (_b = normalizeProbability(b.price)) != null ? _b : 0;
94
+ return bPrice - aPrice;
95
+ });
96
+ };
97
+ var compareVisibleOutcomeRows = (left, right) => {
98
+ var _a, _b;
99
+ const leftDate = toDate(resolveOutcomeTitle(left.outcome));
100
+ const rightDate = toDate(resolveOutcomeTitle(right.outcome));
101
+ if (leftDate && rightDate) {
102
+ return leftDate.getTime() - rightDate.getTime();
103
+ }
104
+ const leftProbability = (_a = normalizeProbability(left.outcome.price)) != null ? _a : -1;
105
+ const rightProbability = (_b = normalizeProbability(right.outcome.price)) != null ? _b : -1;
106
+ return rightProbability - leftProbability;
107
+ };
108
+ var shouldReplaceVisibleOutcome = (current, next) => {
109
+ var _a, _b;
110
+ const currentVolume = typeof current.market.volume === "number" ? current.market.volume : -1;
111
+ const nextVolume = typeof next.market.volume === "number" ? next.market.volume : -1;
112
+ if (currentVolume !== nextVolume) {
113
+ return nextVolume > currentVolume;
114
+ }
115
+ const currentProbability = (_a = normalizeProbability(current.outcome.price)) != null ? _a : -1;
116
+ const nextProbability = (_b = normalizeProbability(next.outcome.price)) != null ? _b : -1;
117
+ return nextProbability > currentProbability;
118
+ };
119
+ var resolveVisibleOutcomes = (venueMarkets, maxOutcomes) => {
120
+ const visibleOutcomesByLabel = /* @__PURE__ */ new Map();
121
+ venueMarkets.forEach((market) => {
122
+ sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
123
+ const title = resolveOutcomeTitle(outcome);
124
+ const normalizedTitle = title.trim().toLowerCase();
125
+ const nextVisibleOutcome = {
126
+ venue: market.venue,
127
+ market,
128
+ outcome,
129
+ title
130
+ };
131
+ const currentVisibleOutcome = visibleOutcomesByLabel.get(normalizedTitle);
132
+ if (!currentVisibleOutcome || shouldReplaceVisibleOutcome(currentVisibleOutcome, nextVisibleOutcome)) {
133
+ visibleOutcomesByLabel.set(normalizedTitle, nextVisibleOutcome);
134
+ }
135
+ });
136
+ });
137
+ return [...visibleOutcomesByLabel.values()].sort(compareVisibleOutcomeRows).slice(0, Math.max(1, maxOutcomes));
138
+ };
139
+ var resolveOutcomeTitle = (outcome) => {
140
+ if (outcome.title && outcome.title.trim())
141
+ return outcome.title;
142
+ return outcome.label;
143
+ };
144
+ var selectPrimaryVenueMarket = (venueMarkets) => {
145
+ if (venueMarkets.length === 0)
146
+ return void 0;
147
+ if (venueMarkets.length === 1)
148
+ return venueMarkets[0];
149
+ return [...venueMarkets].sort((a, b) => {
150
+ const aVolume = typeof a.volume === "number" ? a.volume : -1;
151
+ const bVolume = typeof b.volume === "number" ? b.volume : -1;
152
+ return bVolume - aVolume;
153
+ })[0];
154
+ };
155
+ var resolveTileTitle = (event, primaryVenueMarket, titleOverride) => {
156
+ if (typeof titleOverride === "string" && titleOverride.trim()) {
157
+ return titleOverride;
158
+ }
159
+ if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.question) === "string" && primaryVenueMarket.question.trim()) {
160
+ return primaryVenueMarket.question;
161
+ }
162
+ return event.title;
163
+ };
164
+ var resolveTileImage = (event, primaryVenueMarket, imageOverride) => {
165
+ if (typeof imageOverride === "string" && imageOverride.trim()) {
166
+ return imageOverride;
167
+ }
168
+ if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.image) === "string" && primaryVenueMarket.image.trim()) {
169
+ return primaryVenueMarket.image;
170
+ }
171
+ if (typeof event.image === "string" && event.image.trim()) {
172
+ return event.image;
173
+ }
174
+ return void 0;
175
+ };
176
+ var formatCountLabel = (count, singular, plural) => {
177
+ return `${count} ${count === 1 ? singular : plural}`;
178
+ };
179
+ var getVenueSummary = (venueMarkets) => {
180
+ const uniqueVenues = Array.from(new Set(venueMarkets.map((market) => market.venue)));
181
+ return {
182
+ marketCount: venueMarkets.length,
183
+ venueCount: uniqueVenues.length,
184
+ singleVenue: uniqueVenues.length === 1 ? uniqueVenues[0] : void 0
185
+ };
186
+ };
187
+ var resolveVenueLabel = (venue, venueInfo, labels) => {
188
+ var _a, _b;
189
+ if (!venue)
190
+ return labels.eventItem.venueSingular;
191
+ return (_b = (_a = venueInfo == null ? void 0 : venueInfo[venue]) == null ? void 0 : _a.label) != null ? _b : labels.venues[venue];
192
+ };
193
+
194
+ // src/events/item/index.tsx
195
+ import { jsx, jsxs } from "react/jsx-runtime";
196
+ var EventListItemLoadingState = ({
197
+ classNames,
198
+ ariaLabel
199
+ }) => {
200
+ const labels = useLabels();
201
+ return /* @__PURE__ */ jsx(
202
+ Skeleton,
203
+ {
204
+ view: "event-list-item",
205
+ className: classNames == null ? void 0 : classNames.root,
206
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItem.loading
207
+ }
208
+ );
209
+ };
210
+ var EventListItemUnavailableState = ({
211
+ classNames,
212
+ ariaLabel
213
+ }) => {
214
+ const labels = useLabels();
215
+ return /* @__PURE__ */ jsx(
216
+ Card,
217
+ {
218
+ className: cn(baseCardClassName, classNames == null ? void 0 : classNames.root),
219
+ role: "status",
220
+ "aria-label": ariaLabel != null ? ariaLabel : labels.eventItem.unavailableAria,
221
+ children: /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
222
+ /* @__PURE__ */ jsx(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItem.unavailableTitle }),
223
+ /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItem.unavailableDescription })
224
+ ] })
225
+ }
226
+ );
227
+ };
228
+ var EventListItemNotFoundState = ({
229
+ classNames,
230
+ ariaLabel
231
+ }) => {
232
+ const labels = useLabels();
233
+ return /* @__PURE__ */ jsx(Card, { className: cn("w-full gap-0 overflow-hidden p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx(
234
+ StateMessage,
235
+ {
236
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
237
+ title: labels.eventItemDetails.notFoundTitle,
238
+ description: labels.eventItemDetails.notFoundDescription,
239
+ className: "min-h-[280px] md:min-h-[320px]"
240
+ }
241
+ ) });
242
+ };
243
+ var EventListItemContent = ({
244
+ event,
245
+ title,
246
+ image,
247
+ showVenueLogo = true,
248
+ maxOutcomes = 2,
249
+ classNames,
250
+ venueInfo,
251
+ arbitrageByOutcomeId,
252
+ onClick,
253
+ ariaLabel
254
+ }) => {
255
+ var _a;
256
+ const config = useSdkUiConfig();
257
+ const labels = useLabels();
258
+ const allVenueMarkets = useMemo(() => {
259
+ return event.markets.flatMap((market) => market.venueMarkets);
260
+ }, [event.markets]);
261
+ const primaryVenueMarket = useMemo(() => {
262
+ return selectPrimaryVenueMarket(allVenueMarkets);
263
+ }, [allVenueMarkets]);
264
+ const visibleOutcomes = useMemo(() => {
265
+ if (allVenueMarkets.length === 0)
266
+ return [];
267
+ return resolveVisibleOutcomes(allVenueMarkets, maxOutcomes);
268
+ }, [allVenueMarkets, maxOutcomes]);
269
+ const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
270
+ const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
271
+ const { marketCount, venueCount, singleVenue } = getVenueSummary(allVenueMarkets);
272
+ const venueLabel = resolveVenueLabel(singleVenue, venueInfo, labels);
273
+ const visibleVenueLogos = useMemo(() => {
274
+ return Array.from(new Set(allVenueMarkets.map((market) => market.venue))).slice(0, 4);
275
+ }, [allVenueMarkets]);
276
+ const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
277
+ const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
278
+ const handleKeyDown = (eventToHandle) => {
279
+ if (!onClick)
280
+ return;
281
+ if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
282
+ eventToHandle == null ? void 0 : eventToHandle.preventDefault();
283
+ onClick();
284
+ }
285
+ };
286
+ const renderArbitrage = (value) => {
287
+ if (value == null)
288
+ return null;
289
+ if (Math.abs(value) < config.arbitrageThreshold)
290
+ return null;
291
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1", "text-agg-success"), children: [
292
+ /* @__PURE__ */ jsx(Typography, { variant: "label-strong", className: "text-agg-success", children: config.formatPercent(value) }),
293
+ /* @__PURE__ */ jsx(
294
+ Icon,
295
+ {
296
+ name: "triangle-up",
297
+ size: "small",
298
+ title: labels.eventItem.arbitrage,
299
+ className: "size-2!"
300
+ }
301
+ )
302
+ ] });
303
+ };
304
+ return /* @__PURE__ */ jsxs(
305
+ Card,
306
+ {
307
+ className: cn(baseCardClassName, onClick && "cursor-pointer", classNames == null ? void 0 : classNames.root),
308
+ role: onClick ? "button" : void 0,
309
+ tabIndex: onClick ? 0 : void 0,
310
+ onClick,
311
+ onKeyDown: handleKeyDown,
312
+ "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
313
+ children: [
314
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", classNames == null ? void 0 : classNames.header), children: [
315
+ resolvedImage ? /* @__PURE__ */ jsx(
316
+ "img",
317
+ {
318
+ src: resolvedImage,
319
+ alt: "",
320
+ className: cn("h-10 w-10", "rounded-agg-lg object-cover")
321
+ }
322
+ ) : null,
323
+ /* @__PURE__ */ jsx(
324
+ Typography,
325
+ {
326
+ variant: "body-strong",
327
+ className: cn(
328
+ "min-w-0 text-agg-base font-agg-bold leading-agg-6 ",
329
+ "truncate text-wrap wrap-break-word line-clamp-2",
330
+ classNames == null ? void 0 : classNames.title
331
+ ),
332
+ children: resolvedTitle
333
+ }
334
+ )
335
+ ] }),
336
+ /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.outcomes), children: visibleOutcomes.map((visibleOutcome) => {
337
+ const probability = normalizeProbability(visibleOutcome.outcome.price);
338
+ const showBadge = typeof probability === "number";
339
+ const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[visibleOutcome.outcome.id];
340
+ const outcomeTitle = resolveOutcomeTitle(visibleOutcome.outcome);
341
+ const formattedTitle = dayjs(outcomeTitle).isValid() ? dayjs(outcomeTitle).format("MMMM D, YYYY") : outcomeTitle;
342
+ return /* @__PURE__ */ jsxs(
343
+ "div",
344
+ {
345
+ className: cn(
346
+ "flex flex-row gap-3 w-full items-center justify-between",
347
+ classNames == null ? void 0 : classNames.outcomeRow
348
+ ),
349
+ children: [
350
+ /* @__PURE__ */ jsx(
351
+ Typography,
352
+ {
353
+ variant: "body",
354
+ className: "min-w-0 truncate text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6",
355
+ children: formattedTitle
356
+ }
357
+ ),
358
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-3 items-center justify-end", children: [
359
+ renderArbitrage(arbitragePercent),
360
+ showBadge ? /* @__PURE__ */ jsx(
361
+ Badge,
362
+ {
363
+ text: config.formatPercent(probability),
364
+ prefix: showVenueLogo ? /* @__PURE__ */ jsx(VenueLogo, { venue: visibleOutcome.venue, size: "small" }) : void 0,
365
+ size: "large",
366
+ classNames: {
367
+ root: cn(
368
+ "h-9 min-w-[101px] justify-center px-4 text-agg-base leading-agg-6",
369
+ classNames == null ? void 0 : classNames.badge
370
+ )
371
+ }
372
+ }
373
+ ) : null
374
+ ] })
375
+ ]
376
+ },
377
+ `${visibleOutcome.market.id}-${visibleOutcome.outcome.id}`
378
+ );
379
+ }) }),
380
+ /* @__PURE__ */ jsxs(
381
+ "div",
382
+ {
383
+ className: cn(
384
+ "flex items-center justify-between gap-2",
385
+ "text-agg-muted-foreground",
386
+ classNames == null ? void 0 : classNames.footer
387
+ ),
388
+ children: [
389
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1", "text-agg-sm leading-agg-5"), children: [
390
+ /* @__PURE__ */ jsx("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
391
+ marketCount,
392
+ labels.eventItem.marketSingular,
393
+ labels.eventItem.marketPlural
394
+ ) }),
395
+ /* @__PURE__ */ jsx("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
396
+ singleVenue ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
397
+ showVenueLogo ? /* @__PURE__ */ jsx(
398
+ VenueLogo,
399
+ {
400
+ venue: singleVenue,
401
+ size: "small",
402
+ isMonochromatic: true,
403
+ className: "text-agg-muted-foreground!"
404
+ }
405
+ ) : null,
406
+ /* @__PURE__ */ jsx("span", { children: venueLabel })
407
+ ] }) : /* @__PURE__ */ jsx("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
408
+ venueCount,
409
+ labels.eventItem.venueSingular,
410
+ labels.eventItem.venuePlural
411
+ ) }),
412
+ showVenueLogo && !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ jsx("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ jsx(
413
+ VenueLogo,
414
+ {
415
+ venue,
416
+ size: "small",
417
+ isMonochromatic: true,
418
+ className: "text-agg-muted-foreground!"
419
+ },
420
+ venue
421
+ )) }) : null
422
+ ] }),
423
+ volumeLabel ? /* @__PURE__ */ jsx(Typography, { variant: "label", className: "text-agg-sm text-agg-muted-foreground", children: volumeLabel }) : null
424
+ ]
425
+ }
426
+ )
427
+ ]
428
+ }
429
+ );
430
+ };
431
+ var EventListItemByEventId = (_a) => {
432
+ var _b = _a, {
433
+ eventId
434
+ } = _b, rest = __objRest(_b, [
435
+ "eventId"
436
+ ]);
437
+ const {
438
+ event: fetchedEvent,
439
+ error,
440
+ isError,
441
+ isLoading
442
+ } = useEvent(eventId, {
443
+ enabled: !!eventId
444
+ });
445
+ const resolvedEvent = useMemo(() => {
446
+ return resolveEventListItemEvent(fetchedEvent);
447
+ }, [fetchedEvent]);
448
+ if (!eventId) {
449
+ return /* @__PURE__ */ jsx(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
450
+ }
451
+ if (isLoading) {
452
+ return /* @__PURE__ */ jsx(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
453
+ }
454
+ if (isErrorWithStatus(error, 404)) {
455
+ return /* @__PURE__ */ jsx(EventListItemNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
456
+ }
457
+ if (!fetchedEvent && !isError) {
458
+ return /* @__PURE__ */ jsx(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
459
+ }
460
+ if (!resolvedEvent) {
461
+ return /* @__PURE__ */ jsx(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
462
+ }
463
+ return /* @__PURE__ */ jsx(EventListItemContent, __spreadValues({ event: resolvedEvent }, rest));
464
+ };
465
+ var EventListItem = (props) => {
466
+ if (props.isLoading) {
467
+ return /* @__PURE__ */ jsx(EventListItemLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
468
+ }
469
+ if ("event" in props && props.event) {
470
+ const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
471
+ return /* @__PURE__ */ jsx(EventListItemContent, __spreadValues({ event }, rest));
472
+ }
473
+ return /* @__PURE__ */ jsx(EventListItemByEventId, __spreadValues({}, props));
474
+ };
475
+ EventListItem.displayName = "EventListItem";
476
+
477
+ // src/events/item-details/index.tsx
478
+ import { useEffect, useMemo as useMemo3, useState } from "react";
479
+ import { useEvent as useEvent2, useLabels as useLabels3, usePriceHistory, useSdkUiConfig as useSdkUiConfig2 } from "@agg-market/hooks";
480
+
481
+ // src/primitives/chart/chart-type-switch.tsx
482
+ import { useLabels as useLabels2 } from "@agg-market/hooks";
483
+ import { useMemo as useMemo2 } from "react";
484
+ import { jsx as jsx2 } from "react/jsx-runtime";
485
+ var ChartTypeSwitch = ({
486
+ value,
487
+ onValueChange,
488
+ className
489
+ }) => {
490
+ const labels = useLabels2();
491
+ const options = useMemo2(
492
+ () => [
493
+ {
494
+ value: "line",
495
+ iconName: "chart-line",
496
+ ariaLabel: labels.common.lineChartType
497
+ },
498
+ {
499
+ value: "candlestick",
500
+ iconName: "chart-candlestick",
501
+ ariaLabel: labels.common.candlestickChartType
502
+ }
503
+ ],
504
+ [labels]
505
+ );
506
+ const handleKeyDown = (event, index) => {
507
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") {
508
+ return;
509
+ }
510
+ event.preventDefault();
511
+ const direction = event.key === "ArrowRight" ? 1 : -1;
512
+ const nextIndex = (index + direction + options.length) % options.length;
513
+ const nextOption = options[nextIndex];
514
+ if (!nextOption || nextOption.value === value) {
515
+ return;
516
+ }
517
+ onValueChange(nextOption.value);
518
+ };
519
+ return /* @__PURE__ */ jsx2(
520
+ "div",
521
+ {
522
+ className: cn("inline-flex items-center gap-2", className),
523
+ role: "tablist",
524
+ "aria-label": labels.common.chartTypeSwitchAria,
525
+ children: options.map((option, index) => {
526
+ const isActive = option.value === value;
527
+ return /* @__PURE__ */ jsx2(
528
+ "button",
529
+ {
530
+ type: "button",
531
+ role: "tab",
532
+ "aria-selected": isActive,
533
+ "aria-label": option.ariaLabel,
534
+ tabIndex: isActive ? 0 : -1,
535
+ className: cn(
536
+ "cursor-pointer hover:text-agg-foreground",
537
+ "inline-flex size-5 items-center justify-center rounded-agg-sm bg-transparent p-0",
538
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-background",
539
+ "transition-colors duration-200 ease-in-out",
540
+ isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
541
+ ),
542
+ onClick: () => {
543
+ if (isActive) {
544
+ return;
545
+ }
546
+ onValueChange(option.value);
547
+ },
548
+ onKeyDown: (event) => {
549
+ handleKeyDown(event, index);
550
+ },
551
+ children: /* @__PURE__ */ jsx2(Icon, { name: option.iconName, color: "currentColor", className: "h-5 w-5" })
552
+ },
553
+ option.value
554
+ );
555
+ })
556
+ }
557
+ );
558
+ };
559
+ ChartTypeSwitch.displayName = "ChartTypeSwitch";
560
+
561
+ // src/events/item-details/event-list-item-details.utils.ts
562
+ import dayjs2 from "dayjs";
563
+ var normalizeLabel = (value) => {
564
+ return value.trim().toLowerCase();
565
+ };
566
+ var isDateLikeLabel = (value) => {
567
+ if (!value.trim())
568
+ return false;
569
+ return dayjs2(value).isValid();
570
+ };
571
+ var formatDateLabel = (value) => {
572
+ if (!isDateLikeLabel(value))
573
+ return value;
574
+ return dayjs2(value).format("MMM D, YYYY");
575
+ };
576
+ var getDefaultSelectedTimeRange = (value) => {
577
+ if (!value)
578
+ return "1M";
579
+ return value;
580
+ };
581
+ var getTimeWindowByRange = (range) => {
582
+ const endTs = dayjs2().unix();
583
+ if (range === "1H") {
584
+ return {
585
+ startTs: dayjs2.unix(endTs).subtract(1, "hour").unix(),
586
+ endTs,
587
+ intervalMinutes: 5
588
+ };
589
+ }
590
+ if (range === "6H") {
591
+ return {
592
+ startTs: dayjs2.unix(endTs).subtract(6, "hour").unix(),
593
+ endTs,
594
+ intervalMinutes: 15
595
+ };
596
+ }
597
+ if (range === "1D") {
598
+ return {
599
+ startTs: dayjs2.unix(endTs).subtract(1, "day").unix(),
600
+ endTs,
601
+ intervalMinutes: 30
602
+ };
603
+ }
604
+ if (range === "1W") {
605
+ return {
606
+ startTs: dayjs2.unix(endTs).subtract(7, "day").unix(),
607
+ endTs,
608
+ intervalMinutes: 60
609
+ };
610
+ }
611
+ if (range === "1M") {
612
+ return {
613
+ startTs: dayjs2.unix(endTs).subtract(1, "month").unix(),
614
+ endTs,
615
+ intervalMinutes: 240
616
+ };
617
+ }
618
+ return {
619
+ startTs: dayjs2.unix(endTs).subtract(6, "month").unix(),
620
+ endTs,
621
+ intervalMinutes: 720
622
+ };
623
+ };
624
+ var resolveOutcomeLabels = (venueMarkets) => {
625
+ var _a;
626
+ const primaryMarket = selectPrimaryVenueMarket(venueMarkets);
627
+ const initialLabels = ((_a = primaryMarket == null ? void 0 : primaryMarket.venueMarketOutcomes) != null ? _a : []).map(
628
+ (outcome) => resolveOutcomeTitle(outcome)
629
+ );
630
+ const labels = new Set(initialLabels);
631
+ venueMarkets.forEach((market) => {
632
+ sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
633
+ labels.add(resolveOutcomeTitle(outcome));
634
+ });
635
+ });
636
+ return [...labels];
637
+ };
638
+ var resolveDefaultOutcomeLabel = (outcomeLabels) => {
639
+ return outcomeLabels[0];
640
+ };
641
+ var matchOutcomeByLabel = (outcome, selectedOutcomeLabel) => {
642
+ const normalizedSelectedLabel = normalizeLabel(selectedOutcomeLabel);
643
+ const resolvedTitle = resolveOutcomeTitle(outcome);
644
+ return normalizeLabel(resolvedTitle) === normalizedSelectedLabel || normalizeLabel(outcome.label) === normalizedSelectedLabel;
645
+ };
646
+ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
647
+ return venueMarkets.map((market) => {
648
+ const matchedOutcome = sortOutcomes(market.venueMarketOutcomes).find((outcome) => {
649
+ return matchOutcomeByLabel(outcome, selectedOutcomeLabel);
650
+ });
651
+ if (!matchedOutcome)
652
+ return null;
653
+ return {
654
+ venue: market.venue,
655
+ market,
656
+ outcome: matchedOutcome
657
+ };
658
+ }).filter((item) => item != null);
659
+ };
660
+ var buildPriceHistoryGroups = (selectedOutcomes, fallbackMarketId) => {
661
+ const marketIdByVenue = /* @__PURE__ */ new Map();
662
+ selectedOutcomes.forEach(({ venue, market }) => {
663
+ var _a, _b;
664
+ const marketWithCanonicalId = market;
665
+ const canonicalMarketId = (_a = marketWithCanonicalId.marketId) != null ? _a : fallbackMarketId;
666
+ if (!canonicalMarketId)
667
+ return;
668
+ if (!marketIdByVenue.has(venue)) {
669
+ marketIdByVenue.set(venue, /* @__PURE__ */ new Set());
670
+ }
671
+ (_b = marketIdByVenue.get(venue)) == null ? void 0 : _b.add(canonicalMarketId);
672
+ });
673
+ return [...marketIdByVenue.entries()].map(([venue, marketIds]) => ({
674
+ venue,
675
+ venueMarketOutcomeIds: [...marketIds]
676
+ })).filter((group) => group.venueMarketOutcomeIds.length > 0);
677
+ };
678
+ var resolveSeriesColor = (venue, index) => {
679
+ var _a;
680
+ const colorFromVenue = lineColorByVenue[venue];
681
+ if (colorFromVenue)
682
+ return colorFromVenue;
683
+ return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
684
+ };
685
+
686
+ // src/events/item-details/index.tsx
687
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
688
+ var EventListItemDetailsLoadingState = ({
689
+ classNames,
690
+ ariaLabel
691
+ }) => {
692
+ const labels = useLabels3();
693
+ return /* @__PURE__ */ jsx3(
694
+ Skeleton,
695
+ {
696
+ view: "event-list-item-details",
697
+ className: classNames == null ? void 0 : classNames.root,
698
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.loading
699
+ }
700
+ );
701
+ };
702
+ var EventListItemDetailsUnavailableState = ({
703
+ classNames,
704
+ ariaLabel
705
+ }) => {
706
+ const labels = useLabels3();
707
+ return /* @__PURE__ */ jsx3(
708
+ Card,
709
+ {
710
+ className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
711
+ role: "status",
712
+ "aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.unavailableAria,
713
+ children: /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
714
+ /* @__PURE__ */ jsx3(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
715
+ /* @__PURE__ */ jsx3(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
716
+ ] })
717
+ }
718
+ );
719
+ };
720
+ var EventListItemDetailsNotFoundState = ({
721
+ classNames,
722
+ ariaLabel
723
+ }) => {
724
+ const labels = useLabels3();
725
+ return /* @__PURE__ */ jsx3(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx3(
726
+ StateMessage,
727
+ {
728
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
729
+ title: labels.eventItemDetails.notFoundTitle,
730
+ description: labels.eventItemDetails.notFoundDescription,
731
+ className: "min-h-[280px] md:min-h-[320px]"
732
+ }
733
+ ) });
734
+ };
735
+ var probabilityModeOrder = ["yes", "no"];
736
+ var clampProbability = (value) => {
737
+ if (value < 0)
738
+ return 0;
739
+ if (value > 1)
740
+ return 1;
741
+ return value;
742
+ };
743
+ var resolveAverageProbability = (values) => {
744
+ const validValues = values.filter((value) => value != null);
745
+ if (validValues.length === 0)
746
+ return void 0;
747
+ return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
748
+ };
749
+ var resolveOutcomeCandidateIds = (market, outcome) => {
750
+ var _a, _b;
751
+ const marketWithCanonicalId = market;
752
+ return [
753
+ outcome.id,
754
+ (_a = outcome.externalIdentifier) != null ? _a : void 0,
755
+ market.externalIdentifier,
756
+ (_b = marketWithCanonicalId.marketId) != null ? _b : void 0
757
+ ].filter((value) => typeof value === "string" && value.trim().length > 0);
758
+ };
759
+ var EventListItemDetailsGraphSection = ({
760
+ venueMarkets,
761
+ canonicalMarketId,
762
+ selectedOutcomeLabel,
763
+ onSelectedOutcomeLabelChange,
764
+ switchLabels,
765
+ isDateOutcomeMarket,
766
+ classNames,
767
+ showVenueLogo,
768
+ venueInfo,
769
+ formatPercent,
770
+ selectedTimeRange,
771
+ selectedChartType
772
+ }) => {
773
+ const labels = useLabels3();
774
+ const [selectedVenue, setSelectedVenue] = useState(null);
775
+ const [activeProbabilityMode, setActiveProbabilityMode] = useState("yes");
776
+ const probabilityModeConfigs = useMemo3(() => {
777
+ if (isDateOutcomeMarket) {
778
+ return {
779
+ yes: {
780
+ switchLabel: switchLabels[0],
781
+ sourceOutcomeLabel: selectedOutcomeLabel,
782
+ transformProbability: (value) => value
783
+ },
784
+ no: {
785
+ switchLabel: switchLabels[1],
786
+ sourceOutcomeLabel: selectedOutcomeLabel,
787
+ transformProbability: (value) => 1 - value
788
+ }
789
+ };
790
+ }
791
+ return {
792
+ yes: {
793
+ switchLabel: switchLabels[0],
794
+ sourceOutcomeLabel: switchLabels[0],
795
+ transformProbability: (value) => value
796
+ },
797
+ no: {
798
+ switchLabel: switchLabels[1],
799
+ sourceOutcomeLabel: switchLabels[1],
800
+ transformProbability: (value) => value
801
+ }
802
+ };
803
+ }, [isDateOutcomeMarket, selectedOutcomeLabel, switchLabels]);
804
+ const selectedOutcomesByMode = useMemo3(() => {
805
+ return {
806
+ yes: resolveOutcomesByVenue(venueMarkets, probabilityModeConfigs.yes.sourceOutcomeLabel),
807
+ no: resolveOutcomesByVenue(venueMarkets, probabilityModeConfigs.no.sourceOutcomeLabel)
808
+ };
809
+ }, [
810
+ probabilityModeConfigs.no.sourceOutcomeLabel,
811
+ probabilityModeConfigs.yes.sourceOutcomeLabel,
812
+ venueMarkets
813
+ ]);
814
+ useEffect(() => {
815
+ if (isDateOutcomeMarket) {
816
+ return;
817
+ }
818
+ const nextMode = selectedOutcomeLabel === probabilityModeConfigs.no.sourceOutcomeLabel ? "no" : "yes";
819
+ setActiveProbabilityMode(nextMode);
820
+ }, [isDateOutcomeMarket, probabilityModeConfigs.no.sourceOutcomeLabel, selectedOutcomeLabel]);
821
+ const normalizedVenueDataByMode = useMemo3(() => {
822
+ const buildModeData = (mode) => {
823
+ const modeConfig = probabilityModeConfigs[mode];
824
+ return selectedOutcomesByMode[mode].map((outcomeByVenue, index) => {
825
+ const rawProbability = normalizeProbability(outcomeByVenue.outcome.price);
826
+ const transformedProbability = rawProbability == null ? void 0 : clampProbability(modeConfig.transformProbability(rawProbability));
827
+ return {
828
+ venue: outcomeByVenue.venue,
829
+ venueLabel: resolveVenueLabel(outcomeByVenue.venue, venueInfo, labels),
830
+ market: outcomeByVenue.market,
831
+ outcome: outcomeByVenue.outcome,
832
+ probability: transformedProbability,
833
+ color: resolveSeriesColor(outcomeByVenue.venue, index)
834
+ };
835
+ });
836
+ };
837
+ return {
838
+ yes: buildModeData("yes"),
839
+ no: buildModeData("no")
840
+ };
841
+ }, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
842
+ const allOutcomesForHistory = useMemo3(() => {
843
+ const outcomeByModeAndId = /* @__PURE__ */ new Map();
844
+ probabilityModeOrder.forEach((mode) => {
845
+ selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
846
+ outcomeByModeAndId.set(
847
+ `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
848
+ outcomeByVenue
849
+ );
850
+ });
851
+ });
852
+ return [...outcomeByModeAndId.values()];
853
+ }, [selectedOutcomesByMode]);
854
+ const priceHistoryGroups = useMemo3(() => {
855
+ return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
856
+ }, [allOutcomesForHistory, canonicalMarketId]);
857
+ const timeWindow = useMemo3(() => {
858
+ return getTimeWindowByRange(selectedTimeRange);
859
+ }, [selectedTimeRange]);
860
+ const {
861
+ data: priceHistoryData,
862
+ isLoading: isPriceHistoryLoading,
863
+ error: priceHistoryError,
864
+ results: priceHistoryResults
865
+ } = usePriceHistory(__spreadProps(__spreadValues({
866
+ groups: priceHistoryGroups
867
+ }, timeWindow), {
868
+ enabled: priceHistoryGroups.length > 0
869
+ }));
870
+ const priceHistoryByVenue = useMemo3(() => {
871
+ const historyByVenue = /* @__PURE__ */ new Map();
872
+ if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
873
+ return historyByVenue;
874
+ }
875
+ priceHistoryData.forEach((historyItem) => {
876
+ const venue = historyItem.venue;
877
+ const venueHistory = historyByVenue.get(venue);
878
+ if (venueHistory) {
879
+ venueHistory.push(historyItem);
880
+ return;
881
+ }
882
+ historyByVenue.set(venue, [historyItem]);
883
+ });
884
+ return historyByVenue;
885
+ }, [priceHistoryData]);
886
+ const chartSeriesByMode = useMemo3(() => {
887
+ const buildSeries = (mode) => {
888
+ const modeConfig = probabilityModeConfigs[mode];
889
+ const chartSeries = [];
890
+ normalizedVenueDataByMode[mode].forEach((venueData) => {
891
+ var _a;
892
+ const venueHistory = priceHistoryByVenue.get(venueData.venue);
893
+ if (!(venueHistory == null ? void 0 : venueHistory.length))
894
+ return;
895
+ const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
896
+ const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
897
+ if (!matchingHistory)
898
+ return;
899
+ const points = matchingHistory.points.map((point) => {
900
+ const probability = normalizeProbability(point.price);
901
+ if (probability == null || !Number.isFinite(point.timestamp))
902
+ return null;
903
+ const open = normalizeProbability(point.open);
904
+ const high = normalizeProbability(point.high);
905
+ const low = normalizeProbability(point.low);
906
+ const close = normalizeProbability(point.close);
907
+ const transformedPoint = {
908
+ time: point.timestamp,
909
+ value: clampProbability(modeConfig.transformProbability(probability)) * 100,
910
+ open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
911
+ high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
912
+ low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
913
+ close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
914
+ };
915
+ return transformedPoint;
916
+ }).filter((point) => point != null);
917
+ if (points.length === 0)
918
+ return;
919
+ chartSeries.push({
920
+ id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
921
+ venue: venueData.venue,
922
+ color: venueData.color,
923
+ points,
924
+ lineWidth: 2,
925
+ lineStyle: "solid"
926
+ });
927
+ });
928
+ return chartSeries;
929
+ };
930
+ return {
931
+ yes: buildSeries("yes"),
932
+ no: buildSeries("no")
933
+ };
934
+ }, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
935
+ const visibleChartSeries = useMemo3(() => {
936
+ const modeSeries = chartSeriesByMode[activeProbabilityMode];
937
+ if (!selectedVenue)
938
+ return modeSeries;
939
+ return modeSeries.filter((seriesItem) => seriesItem.venue === selectedVenue);
940
+ }, [activeProbabilityMode, chartSeriesByMode, selectedVenue]);
941
+ const segmentedDisplayItems = useMemo3(() => {
942
+ return probabilityModeOrder.map((mode) => {
943
+ const averageProbability = resolveAverageProbability(
944
+ normalizedVenueDataByMode[mode].map((venueData) => venueData.probability)
945
+ );
946
+ const suffix = averageProbability == null ? "" : ` ${formatPercent(averageProbability)}`;
947
+ const switchLabel = probabilityModeConfigs[mode].switchLabel;
948
+ return {
949
+ mode,
950
+ display: `${switchLabel}${suffix}`
951
+ };
952
+ });
953
+ }, [formatPercent, normalizedVenueDataByMode, probabilityModeConfigs]);
954
+ const activeModeVenueData = normalizedVenueDataByMode[activeProbabilityMode];
955
+ useEffect(() => {
956
+ if (!selectedVenue) {
957
+ return;
958
+ }
959
+ if (activeModeVenueData.some((item) => item.venue === selectedVenue)) {
960
+ return;
961
+ }
962
+ setSelectedVenue(null);
963
+ }, [activeModeVenueData, selectedVenue]);
964
+ const handleProbabilityModeChange = (nextMode) => {
965
+ setActiveProbabilityMode(nextMode);
966
+ if (isDateOutcomeMarket) {
967
+ return;
968
+ }
969
+ onSelectedOutcomeLabelChange(probabilityModeConfigs[nextMode].sourceOutcomeLabel);
970
+ };
971
+ const handleVenueToggle = (venue) => {
972
+ setSelectedVenue((currentSelectedVenue) => {
973
+ if (currentSelectedVenue === venue)
974
+ return null;
975
+ return venue;
976
+ });
977
+ };
978
+ const handleRetryPriceHistory = () => {
979
+ void Promise.all(priceHistoryResults.map((result) => result.refetch()));
980
+ };
981
+ if (priceHistoryError) {
982
+ return /* @__PURE__ */ jsx3(
983
+ "div",
984
+ {
985
+ className: cn(
986
+ "w-full rounded-agg-xl border border-agg-separator bg-agg-secondary",
987
+ classNames == null ? void 0 : classNames.chart
988
+ ),
989
+ children: /* @__PURE__ */ jsx3(
990
+ StateMessage,
991
+ {
992
+ ariaLabel: labels.eventItemDetails.chartUnavailableAria,
993
+ tone: "warning",
994
+ title: labels.eventItemDetails.chartUnavailableTitle,
995
+ description: labels.eventItemDetails.chartUnavailableDescription,
996
+ actionLabel: labels.common.retry,
997
+ onAction: handleRetryPriceHistory,
998
+ className: "min-h-[300px] px-5 py-10 md:px-10"
999
+ }
1000
+ )
1001
+ }
1002
+ );
1003
+ }
1004
+ return /* @__PURE__ */ jsx3(
1005
+ LineChart,
1006
+ {
1007
+ classNames: { root: classNames == null ? void 0 : classNames.chart },
1008
+ series: visibleChartSeries,
1009
+ height: 300,
1010
+ isLoading: isPriceHistoryLoading,
1011
+ chartType: selectedChartType,
1012
+ showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
1013
+ renderSeriesControls: () => {
1014
+ return /* @__PURE__ */ jsxs2(
1015
+ "div",
1016
+ {
1017
+ className: cn("flex flex-row items-center justify-between gap-4", classNames == null ? void 0 : classNames.summary),
1018
+ children: [
1019
+ /* @__PURE__ */ jsx3(
1020
+ "div",
1021
+ {
1022
+ className: cn(
1023
+ "flex min-w-0 gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
1024
+ classNames == null ? void 0 : classNames.outcomeBadges
1025
+ ),
1026
+ children: activeModeVenueData.map((venueData) => {
1027
+ var _a;
1028
+ const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
1029
+ const isActiveVenue = selectedVenue === venueData.venue;
1030
+ return /* @__PURE__ */ jsx3(
1031
+ "button",
1032
+ {
1033
+ type: "button",
1034
+ "aria-label": `${venueData.venueLabel} ${text}`,
1035
+ "aria-pressed": isActiveVenue,
1036
+ className: cn(
1037
+ "rounded-agg-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover"
1038
+ ),
1039
+ children: /* @__PURE__ */ jsx3(
1040
+ Badge,
1041
+ {
1042
+ text,
1043
+ size: "large",
1044
+ prefix: showVenueLogo ? /* @__PURE__ */ jsx3(
1045
+ VenueLogo,
1046
+ {
1047
+ venue: venueData.venue,
1048
+ size: "small",
1049
+ title: (_a = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a.label
1050
+ }
1051
+ ) : void 0,
1052
+ classNames: {
1053
+ root: cn("h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6")
1054
+ },
1055
+ isActive: isActiveVenue,
1056
+ onClick: (e) => {
1057
+ e.preventDefault();
1058
+ e.stopPropagation();
1059
+ handleVenueToggle(venueData.venue);
1060
+ }
1061
+ }
1062
+ )
1063
+ },
1064
+ `${activeProbabilityMode}-${venueData.market.id}-${venueData.outcome.id}`
1065
+ );
1066
+ })
1067
+ }
1068
+ ),
1069
+ /* @__PURE__ */ jsx3(
1070
+ SwitchButton,
1071
+ {
1072
+ ariaLabel: labels.eventItemDetails.outcomeSelectorAria,
1073
+ className: cn("w-full md:w-fit", classNames == null ? void 0 : classNames.segmentedControl),
1074
+ value: activeProbabilityMode,
1075
+ onValueChange: handleProbabilityModeChange,
1076
+ options: segmentedDisplayItems.map((segmentedItem) => ({
1077
+ value: segmentedItem.mode,
1078
+ label: segmentedItem.display,
1079
+ ariaLabel: segmentedItem.display
1080
+ }))
1081
+ }
1082
+ )
1083
+ ]
1084
+ }
1085
+ );
1086
+ }
1087
+ }
1088
+ );
1089
+ };
1090
+ var EventListItemDetailsContent = ({
1091
+ event,
1092
+ title,
1093
+ image,
1094
+ showVenueLogo = true,
1095
+ classNames,
1096
+ venueInfo,
1097
+ detailsStats,
1098
+ ariaLabel,
1099
+ defaultTimeRange
1100
+ }) => {
1101
+ var _a, _b;
1102
+ const config = useSdkUiConfig2();
1103
+ const labels = useLabels3();
1104
+ const venueMarkets = useMemo3(() => {
1105
+ var _a2, _b2, _c;
1106
+ return (_c = (_b2 = (_a2 = event.markets) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.venueMarkets) != null ? _c : [];
1107
+ }, [event.markets]);
1108
+ const primaryVenueMarket = useMemo3(() => {
1109
+ return selectPrimaryVenueMarket(venueMarkets);
1110
+ }, [venueMarkets]);
1111
+ const outcomeLabels = useMemo3(() => {
1112
+ return resolveOutcomeLabels(venueMarkets);
1113
+ }, [venueMarkets]);
1114
+ const [selectedOutcomeLabel, setSelectedOutcomeLabel] = useState(() => {
1115
+ return resolveDefaultOutcomeLabel(outcomeLabels);
1116
+ });
1117
+ const [selectedTimeRange, setSelectedTimeRange] = useState(() => {
1118
+ return getDefaultSelectedTimeRange(defaultTimeRange);
1119
+ });
1120
+ const [selectedChartType, setSelectedChartType] = useState("line");
1121
+ useEffect(() => {
1122
+ setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
1123
+ }, [defaultTimeRange]);
1124
+ const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
1125
+ const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
1126
+ const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
1127
+ const outcomeSelectorLabels = outcomeLabels;
1128
+ const probabilityByLabel = useMemo3(() => {
1129
+ return new Map(
1130
+ outcomeLabels.map((label) => {
1131
+ const outcomesByVenue = resolveOutcomesByVenue(venueMarkets, label);
1132
+ const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
1133
+ if (probabilities.length === 0) {
1134
+ return [label, void 0];
1135
+ }
1136
+ const averageProbability = probabilities.reduce((sum, value) => sum + value, 0) / probabilities.length;
1137
+ return [label, averageProbability];
1138
+ })
1139
+ );
1140
+ }, [outcomeLabels, venueMarkets]);
1141
+ const mainOutcomeLabel = useMemo3(() => {
1142
+ if (outcomeLabels.length === 0)
1143
+ return void 0;
1144
+ return [...outcomeLabels].sort((left, right) => {
1145
+ var _a2, _b2;
1146
+ const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
1147
+ const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
1148
+ return rightProbability - leftProbability;
1149
+ })[0];
1150
+ }, [outcomeLabels, probabilityByLabel]);
1151
+ useEffect(() => {
1152
+ if (!outcomeLabels.length) {
1153
+ setSelectedOutcomeLabel(void 0);
1154
+ return;
1155
+ }
1156
+ if (selectedOutcomeLabel && outcomeLabels.includes(selectedOutcomeLabel)) {
1157
+ return;
1158
+ }
1159
+ const fallbackOutcomeLabel = isDateOutcomeMarket ? resolveDefaultOutcomeLabel(outcomeLabels) : mainOutcomeLabel != null ? mainOutcomeLabel : resolveDefaultOutcomeLabel(outcomeLabels);
1160
+ setSelectedOutcomeLabel(fallbackOutcomeLabel);
1161
+ }, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
1162
+ const switchLabels = useMemo3(() => {
1163
+ var _a2, _b2;
1164
+ if (isDateOutcomeMarket) {
1165
+ return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
1166
+ }
1167
+ const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
1168
+ var _a3, _b3;
1169
+ const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
1170
+ const rightProbability = (_b3 = probabilityByLabel.get(right)) != null ? _b3 : -1;
1171
+ return rightProbability - leftProbability;
1172
+ });
1173
+ const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
1174
+ const secondLabel = (_b2 = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b2 : firstLabel;
1175
+ return [firstLabel, secondLabel];
1176
+ }, [
1177
+ isDateOutcomeMarket,
1178
+ labels.eventItemDetails.no,
1179
+ labels.eventItemDetails.yes,
1180
+ outcomeLabels,
1181
+ probabilityByLabel
1182
+ ]);
1183
+ const volumeLabel = useMemo3(() => {
1184
+ var _a2;
1185
+ const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a2 = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a2 : void 0;
1186
+ if (typeof resolvedVolume !== "number")
1187
+ return "";
1188
+ return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
1189
+ }, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
1190
+ if (!primaryVenueMarket || !selectedOutcomeLabel) {
1191
+ return /* @__PURE__ */ jsx3(EventListItemDetailsUnavailableState, { classNames, ariaLabel });
1192
+ }
1193
+ return /* @__PURE__ */ jsxs2(
1194
+ Card,
1195
+ {
1196
+ className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
1197
+ "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
1198
+ children: [
1199
+ /* @__PURE__ */ jsxs2(
1200
+ "div",
1201
+ {
1202
+ className: cn(
1203
+ "flex flex-row gap-3 md:gap-4",
1204
+ "items-center justify-start",
1205
+ classNames == null ? void 0 : classNames.header
1206
+ ),
1207
+ children: [
1208
+ resolvedImage ? /* @__PURE__ */ jsx3(
1209
+ "img",
1210
+ {
1211
+ src: resolvedImage,
1212
+ alt: "",
1213
+ className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
1214
+ }
1215
+ ) : null,
1216
+ /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
1217
+ /* @__PURE__ */ jsx3(
1218
+ Typography,
1219
+ {
1220
+ variant: "body-strong",
1221
+ className: cn(
1222
+ "min-w-0 text-agg-base font-agg-bold! leading-agg-6 md:text-agg-2xl md:leading-agg-8",
1223
+ "truncate text-wrap wrap-break-word line-clamp-2",
1224
+ classNames == null ? void 0 : classNames.title
1225
+ ),
1226
+ children: resolvedTitle
1227
+ }
1228
+ ),
1229
+ outcomeSelectorLabels.length > 2 ? /* @__PURE__ */ jsx3(
1230
+ "div",
1231
+ {
1232
+ className: cn(
1233
+ "flex items-center gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
1234
+ classNames == null ? void 0 : classNames.headerPills
1235
+ ),
1236
+ children: outcomeSelectorLabels.map((outcomeSelectorLabel) => {
1237
+ const isActive = outcomeSelectorLabel === selectedOutcomeLabel;
1238
+ const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
1239
+ return /* @__PURE__ */ jsx3(
1240
+ Button,
1241
+ {
1242
+ size: "small",
1243
+ variant: "secondary",
1244
+ "aria-pressed": isActive,
1245
+ className: cn(
1246
+ "h-auto shrink-0 rounded-agg-full px-4 py-1.5 text-agg-sm leading-agg-5",
1247
+ "border-2",
1248
+ isActive ? "border-agg-primary bg-agg-secondary text-agg-foreground font-agg-bold" : "border-transparent bg-agg-secondary-hover text-agg-foreground font-agg-normal"
1249
+ ),
1250
+ onClick: () => setSelectedOutcomeLabel(outcomeSelectorLabel),
1251
+ children: displayLabel
1252
+ },
1253
+ outcomeSelectorLabel
1254
+ );
1255
+ })
1256
+ }
1257
+ ) : null
1258
+ ] })
1259
+ ]
1260
+ }
1261
+ ),
1262
+ detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ jsx3("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
1263
+ const deltaClassName = statItem.deltaTone === "positive" ? "text-agg-success!" : statItem.deltaTone === "negative" ? "text-agg-error!" : "text-agg-muted-foreground";
1264
+ return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-1", children: [
1265
+ /* @__PURE__ */ jsx3(Typography, { variant: "caption-caps", className: "text-agg-muted-foreground", children: statItem.label }),
1266
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-baseline gap-1", children: [
1267
+ /* @__PURE__ */ jsx3(
1268
+ Typography,
1269
+ {
1270
+ variant: "body",
1271
+ className: "text-agg-lg leading-agg-7 text-agg-foreground",
1272
+ children: statItem.value
1273
+ }
1274
+ ),
1275
+ statItem.delta ? /* @__PURE__ */ jsx3(Typography, { variant: "label", className: cn(deltaClassName), children: statItem.delta }) : null
1276
+ ] })
1277
+ ] }, `${statItem.label}-${statItem.value}`);
1278
+ }) }) : null,
1279
+ /* @__PURE__ */ jsx3(
1280
+ EventListItemDetailsGraphSection,
1281
+ {
1282
+ venueMarkets,
1283
+ canonicalMarketId: (_b = (_a = event.markets) == null ? void 0 : _a[0]) == null ? void 0 : _b.id,
1284
+ selectedOutcomeLabel,
1285
+ onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
1286
+ switchLabels,
1287
+ isDateOutcomeMarket,
1288
+ classNames,
1289
+ showVenueLogo,
1290
+ venueInfo,
1291
+ formatPercent: config.formatPercent,
1292
+ selectedTimeRange,
1293
+ selectedChartType
1294
+ }
1295
+ ),
1296
+ /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
1297
+ /* @__PURE__ */ jsx3(Typography, { variant: "label", className: "text-agg-muted-foreground", children: volumeLabel || "-" }),
1298
+ /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-wrap items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: [
1299
+ /* @__PURE__ */ jsx3(ChartTypeSwitch, { value: selectedChartType, onValueChange: setSelectedChartType }),
1300
+ /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
1301
+ eventListItemDetailsTimeRanges.map((timeRange) => {
1302
+ const isActive = timeRange === selectedTimeRange;
1303
+ return /* @__PURE__ */ jsx3(
1304
+ Button,
1305
+ {
1306
+ size: "small",
1307
+ variant: "tertiary",
1308
+ className: cn(
1309
+ "h-auto min-w-0 rounded-none px-0 py-0 text-agg-xs leading-agg-4 md:text-agg-sm md:leading-agg-5",
1310
+ "border-0 bg-transparent shadow-none",
1311
+ "hover:text-agg-foreground!",
1312
+ isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
1313
+ ),
1314
+ "aria-pressed": isActive,
1315
+ onClick: () => setSelectedTimeRange(timeRange),
1316
+ children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
1317
+ },
1318
+ timeRange
1319
+ );
1320
+ })
1321
+ ] })
1322
+ ] })
1323
+ ]
1324
+ }
1325
+ );
1326
+ };
1327
+ var EventListItemDetailsByEventId = (_a) => {
1328
+ var _b = _a, {
1329
+ eventId
1330
+ } = _b, rest = __objRest(_b, [
1331
+ "eventId"
1332
+ ]);
1333
+ const {
1334
+ event: fetchedEvent,
1335
+ error,
1336
+ isError,
1337
+ isLoading
1338
+ } = useEvent2(eventId, {
1339
+ enabled: !!eventId
1340
+ });
1341
+ const resolvedEvent = useMemo3(() => {
1342
+ return resolveEventListItemEvent(fetchedEvent);
1343
+ }, [fetchedEvent]);
1344
+ if (!eventId) {
1345
+ return /* @__PURE__ */ jsx3(
1346
+ EventListItemDetailsUnavailableState,
1347
+ {
1348
+ classNames: rest.classNames,
1349
+ ariaLabel: rest.ariaLabel
1350
+ }
1351
+ );
1352
+ }
1353
+ if (isLoading) {
1354
+ return /* @__PURE__ */ jsx3(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
1355
+ }
1356
+ if (isErrorWithStatus(error, 404)) {
1357
+ return /* @__PURE__ */ jsx3(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
1358
+ }
1359
+ if (!fetchedEvent && !isError) {
1360
+ return /* @__PURE__ */ jsx3(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
1361
+ }
1362
+ if (!resolvedEvent) {
1363
+ return /* @__PURE__ */ jsx3(
1364
+ EventListItemDetailsUnavailableState,
1365
+ {
1366
+ classNames: rest.classNames,
1367
+ ariaLabel: rest.ariaLabel
1368
+ }
1369
+ );
1370
+ }
1371
+ return /* @__PURE__ */ jsx3(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
1372
+ };
1373
+ var EventListItemDetails = (props) => {
1374
+ if (props.isLoading) {
1375
+ return /* @__PURE__ */ jsx3(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
1376
+ }
1377
+ if ("event" in props && props.event) {
1378
+ const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
1379
+ return /* @__PURE__ */ jsx3(EventListItemDetailsContent, __spreadValues({ event }, rest));
1380
+ }
1381
+ if ("eventId" in props && typeof props.eventId === "string") {
1382
+ const {
1383
+ title: titleOverride,
1384
+ image: imageOverride,
1385
+ showVenueLogo: showVenueLogoOverride,
1386
+ classNames,
1387
+ venueInfo,
1388
+ detailsStats,
1389
+ ariaLabel: ariaLabelOverride,
1390
+ defaultTimeRange: defaultTimeRangeOverride
1391
+ } = props;
1392
+ const byEventIdProps = {
1393
+ eventId: props.eventId,
1394
+ isLoading: false,
1395
+ title: titleOverride,
1396
+ image: imageOverride,
1397
+ showVenueLogo: showVenueLogoOverride,
1398
+ classNames,
1399
+ venueInfo,
1400
+ detailsStats,
1401
+ ariaLabel: ariaLabelOverride,
1402
+ defaultTimeRange: defaultTimeRangeOverride
1403
+ };
1404
+ return /* @__PURE__ */ jsx3(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
1405
+ }
1406
+ return /* @__PURE__ */ jsx3(
1407
+ EventListItemDetailsUnavailableState,
1408
+ {
1409
+ classNames: props.classNames,
1410
+ ariaLabel: props.ariaLabel
1411
+ }
1412
+ );
1413
+ };
1414
+ EventListItemDetails.displayName = "EventListItemDetails";
1415
+
1416
+ // src/events/market-details/index.tsx
1417
+ import { useEffect as useEffect2, useId, useMemo as useMemo4, useState as useState2 } from "react";
1418
+ import {
1419
+ useEvent as useEvent3,
1420
+ useLabels as useLabels4,
1421
+ useOrderBook,
1422
+ usePriceHistory as usePriceHistory2,
1423
+ useSdkUiConfig as useSdkUiConfig3
1424
+ } from "@agg-market/hooks";
1425
+
1426
+ // src/events/market-details/market-details.utils.ts
1427
+ import dayjs3 from "dayjs";
1428
+ import { z } from "zod";
1429
+ var MarketDetailsTabSchema = z.enum(["order-book", "graph", "other"]);
1430
+ var OrderBookLevelSchema = z.object({
1431
+ price: z.number().min(0).max(1),
1432
+ size: z.number().nonnegative()
1433
+ });
1434
+ var OrderBookRowSchema = z.object({
1435
+ id: z.string(),
1436
+ venue: z.enum(["kalshi", "polymarket"]),
1437
+ price: z.number().min(0).max(1),
1438
+ size: z.number().nonnegative(),
1439
+ total: z.number().nonnegative(),
1440
+ tone: z.enum(["positive", "negative"])
1441
+ });
1442
+ var normalizeLabel2 = (value) => {
1443
+ return value.trim().toLowerCase();
1444
+ };
1445
+ var hasBinaryLabels = (labels) => {
1446
+ const normalizedLabels = labels.map(normalizeLabel2);
1447
+ return normalizedLabels.includes("yes") && normalizedLabels.includes("no");
1448
+ };
1449
+ var resolveInitialTab = (defaultTab) => {
1450
+ const parsedTab = MarketDetailsTabSchema.safeParse(defaultTab);
1451
+ if (parsedTab.success)
1452
+ return parsedTab.data;
1453
+ return "order-book";
1454
+ };
1455
+ var resolveMarket = (event, marketId) => {
1456
+ if (!event.markets.length)
1457
+ return void 0;
1458
+ if (!marketId)
1459
+ return event.markets[0];
1460
+ return event.markets.find((market) => market.id === marketId);
1461
+ };
1462
+ var resolveDisplayOutcomeLabels = (labels) => {
1463
+ if (!hasBinaryLabels(labels))
1464
+ return labels;
1465
+ return ["Yes", "No"].filter(
1466
+ (label) => labels.some((value) => normalizeLabel2(value) === normalizeLabel2(label))
1467
+ );
1468
+ };
1469
+ var resolveInitialOutcomeLabel = (labels, defaultOutcomeLabel) => {
1470
+ var _a;
1471
+ if (labels.length === 0)
1472
+ return void 0;
1473
+ if (defaultOutcomeLabel) {
1474
+ const matchedLabel = labels.find(
1475
+ (label) => normalizeLabel2(label) === normalizeLabel2(defaultOutcomeLabel)
1476
+ );
1477
+ if (matchedLabel)
1478
+ return matchedLabel;
1479
+ }
1480
+ if (hasBinaryLabels(labels)) {
1481
+ return (_a = labels.find((label) => normalizeLabel2(label) === "yes")) != null ? _a : labels[0];
1482
+ }
1483
+ return labels[0];
1484
+ };
1485
+ var resolveAverageProbabilityByLabel = (venueMarkets, labels) => {
1486
+ return new Map(
1487
+ labels.map((label) => {
1488
+ const matchingOutcomes = resolveOutcomesByVenue(venueMarkets, label);
1489
+ const probabilities = matchingOutcomes.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
1490
+ if (!probabilities.length) {
1491
+ return [label, void 0];
1492
+ }
1493
+ const averageProbability = probabilities.reduce((sum, value) => sum + value, 0) / probabilities.length;
1494
+ return [label, averageProbability];
1495
+ })
1496
+ );
1497
+ };
1498
+ var formatProbabilityPercent = (value) => {
1499
+ if (value == null)
1500
+ return "-";
1501
+ return `${Math.round(value * 100)}%`;
1502
+ };
1503
+ var formatProbabilityCents = (value) => {
1504
+ if (value == null)
1505
+ return "-";
1506
+ const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
1507
+ return `${cents}\xA2`;
1508
+ };
1509
+ var resolveOutcomeTone = (label, index) => {
1510
+ const normalizedLabel = normalizeLabel2(label);
1511
+ if (normalizedLabel === "yes" || normalizedLabel === "up" || normalizedLabel === "buy") {
1512
+ return "positive";
1513
+ }
1514
+ if (normalizedLabel === "no" || normalizedLabel === "down" || normalizedLabel === "sell") {
1515
+ return "negative";
1516
+ }
1517
+ return index === 0 ? "positive" : "negative";
1518
+ };
1519
+ var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
1520
+ const labels = resolveDisplayOutcomeLabels(resolveOutcomeLabels(venueMarkets));
1521
+ const probabilityByLabel = resolveAverageProbabilityByLabel(venueMarkets, labels);
1522
+ return labels.slice(0, 2).map((label, index) => {
1523
+ var _a;
1524
+ return {
1525
+ label,
1526
+ probability: probabilityByLabel.get(label),
1527
+ tone: resolveOutcomeTone(label, index),
1528
+ isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : "")
1529
+ };
1530
+ });
1531
+ };
1532
+ var resolveSubtitle = ({
1533
+ venueMarkets,
1534
+ volume,
1535
+ formatCompactCurrency,
1536
+ labels
1537
+ }) => {
1538
+ const { venueCount } = getVenueSummary(venueMarkets);
1539
+ const parts = [
1540
+ `${venueCount} ${venueCount === 1 ? labels.marketDetails.meta.venueSingular : labels.marketDetails.meta.venuePlural}`
1541
+ ];
1542
+ if (typeof volume === "number") {
1543
+ parts.push(`${formatCompactCurrency(volume)} ${labels.marketDetails.meta.volumeSuffix}`);
1544
+ }
1545
+ return parts.join(" \xB7 ");
1546
+ };
1547
+ var resolveOrderBookRows = ({
1548
+ data,
1549
+ side
1550
+ }) => {
1551
+ if (!(data == null ? void 0 : data.length))
1552
+ return [];
1553
+ const tone = side === "asks" ? "negative" : "positive";
1554
+ const rows = data.flatMap((result) => {
1555
+ var _a;
1556
+ return ((_a = result.orderbook[side]) != null ? _a : []).flatMap(
1557
+ (level, index) => {
1558
+ const parsedLevel = OrderBookLevelSchema.safeParse(level);
1559
+ if (!parsedLevel.success)
1560
+ return [];
1561
+ const parsedRow = OrderBookRowSchema.safeParse({
1562
+ id: `${result.market.id}-${side}-${index}-${parsedLevel.data.price}`,
1563
+ venue: result.market.venue,
1564
+ price: parsedLevel.data.price,
1565
+ size: parsedLevel.data.size,
1566
+ total: parsedLevel.data.price * parsedLevel.data.size,
1567
+ tone
1568
+ });
1569
+ if (!parsedRow.success)
1570
+ return [];
1571
+ return [parsedRow.data];
1572
+ }
1573
+ );
1574
+ });
1575
+ const sortedRows = [...rows].sort((left, right) => {
1576
+ if (side === "asks")
1577
+ return left.price - right.price;
1578
+ return right.price - left.price;
1579
+ });
1580
+ const maxTotal = sortedRows.reduce((currentMax, row) => Math.max(currentMax, row.total), 0) || 1;
1581
+ return sortedRows.map((row) => __spreadProps(__spreadValues({}, row), {
1582
+ barScale: row.total / maxTotal
1583
+ }));
1584
+ };
1585
+ var resolveOtherTabRows = (market, labels) => {
1586
+ var _a;
1587
+ const rows = [];
1588
+ rows.push({
1589
+ label: labels.marketDetails.meta.status,
1590
+ value: (_a = market.status) != null ? _a : labels.marketDetails.meta.unknown
1591
+ });
1592
+ if (market.creationDate) {
1593
+ rows.push({
1594
+ label: labels.marketDetails.meta.created,
1595
+ value: dayjs3(market.creationDate).format("MMM D, YYYY")
1596
+ });
1597
+ }
1598
+ if (market.startDate) {
1599
+ rows.push({
1600
+ label: labels.marketDetails.meta.opens,
1601
+ value: dayjs3(market.startDate).format("MMM D, YYYY")
1602
+ });
1603
+ }
1604
+ if (market.endDate) {
1605
+ rows.push({
1606
+ label: labels.marketDetails.meta.closes,
1607
+ value: dayjs3(market.endDate).format("MMM D, YYYY")
1608
+ });
1609
+ }
1610
+ if (rows.length === 1) {
1611
+ rows.push({
1612
+ label: labels.marketDetails.meta.markets,
1613
+ value: `${market.venueMarkets.length}`
1614
+ });
1615
+ }
1616
+ return rows;
1617
+ };
1618
+ var buildMarketDetailsModel = ({
1619
+ event,
1620
+ marketId,
1621
+ title,
1622
+ image,
1623
+ formatCompactCurrency,
1624
+ labels
1625
+ }) => {
1626
+ var _a;
1627
+ const market = resolveMarket(event, marketId);
1628
+ if (!market)
1629
+ return void 0;
1630
+ const primaryVenueMarket = selectPrimaryVenueMarket(market.venueMarkets);
1631
+ if (!primaryVenueMarket)
1632
+ return void 0;
1633
+ const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
1634
+ const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
1635
+ const resolvedVolume = typeof market.volume === "number" ? market.volume : (_a = primaryVenueMarket.volume) != null ? _a : void 0;
1636
+ const subtitle = resolveSubtitle({
1637
+ venueMarkets: market.venueMarkets,
1638
+ volume: resolvedVolume,
1639
+ formatCompactCurrency,
1640
+ labels
1641
+ });
1642
+ const outcomeLabels = resolveDisplayOutcomeLabels(resolveOutcomeLabels(market.venueMarkets));
1643
+ const probabilityByLabel = resolveAverageProbabilityByLabel(market.venueMarkets, outcomeLabels);
1644
+ return {
1645
+ market,
1646
+ primaryVenueMarket,
1647
+ title: resolvedTitle,
1648
+ image: resolvedImage,
1649
+ subtitle,
1650
+ outcomeLabels,
1651
+ probabilityByLabel
1652
+ };
1653
+ };
1654
+
1655
+ // src/events/market-details/index.tsx
1656
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1657
+ var MarketDetailsLoadingState = ({
1658
+ isOpened = marketDetailsDefaultIsOpened,
1659
+ ariaLabel,
1660
+ classNames
1661
+ }) => {
1662
+ const labels = useLabels4();
1663
+ return /* @__PURE__ */ jsx4(
1664
+ Skeleton,
1665
+ {
1666
+ view: isOpened ? "market-details-detailed" : "market-details-minified",
1667
+ className: classNames == null ? void 0 : classNames.root,
1668
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.loading
1669
+ }
1670
+ );
1671
+ };
1672
+ var MarketDetailsUnavailableState = ({
1673
+ ariaLabel,
1674
+ classNames
1675
+ }) => {
1676
+ const labels = useLabels4();
1677
+ return /* @__PURE__ */ jsx4(
1678
+ Card,
1679
+ {
1680
+ className: cn(marketDetailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
1681
+ role: "status",
1682
+ "aria-label": ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
1683
+ children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 p-5", children: [
1684
+ /* @__PURE__ */ jsx4(Typography, { variant: "body-large-strong", children: labels.marketDetails.unavailableTitle }),
1685
+ /* @__PURE__ */ jsx4(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.marketDetails.unavailableDescription })
1686
+ ] })
1687
+ }
1688
+ );
1689
+ };
1690
+ var MarketDetailsNotFoundState = ({
1691
+ ariaLabel,
1692
+ classNames
1693
+ }) => {
1694
+ const labels = useLabels4();
1695
+ return /* @__PURE__ */ jsx4(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx4(
1696
+ StateMessage,
1697
+ {
1698
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
1699
+ title: labels.marketDetails.notFoundTitle,
1700
+ description: labels.marketDetails.notFoundDescription,
1701
+ className: "min-h-[280px] md:min-h-[320px]"
1702
+ }
1703
+ ) });
1704
+ };
1705
+ var OrderBookRows = ({
1706
+ rows,
1707
+ title,
1708
+ formatNumber,
1709
+ formatCurrency,
1710
+ visibleRows
1711
+ }) => {
1712
+ const labels = useLabels4();
1713
+ const isAsks = title === labels.marketDetails.asks;
1714
+ const priceClassName = isAsks ? "text-agg-orderbook-ask" : "text-agg-orderbook-bid";
1715
+ const barClassName = isAsks ? "bg-agg-orderbook-ask/10" : "bg-agg-orderbook-bid/10";
1716
+ const maxVisibleRows = Math.max(1, visibleRows);
1717
+ const orderBookRowHeightPx = 28;
1718
+ const orderBookDividerHeightPx = 1;
1719
+ const orderBookRowGapPx = 8;
1720
+ const orderBookVisibleHeightPx = maxVisibleRows * orderBookRowHeightPx + Math.max(0, maxVisibleRows - 1) * (orderBookDividerHeightPx + orderBookRowGapPx);
1721
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
1722
+ /* @__PURE__ */ jsx4(Typography, { variant: "caption-caps", children: title }),
1723
+ /* @__PURE__ */ jsx4(
1724
+ "div",
1725
+ {
1726
+ className: "overflow-y-auto pr-1 flex flex-col gap-2",
1727
+ style: { maxHeight: `${orderBookVisibleHeightPx}px` },
1728
+ role: "region",
1729
+ "aria-label": `${title} order book levels`,
1730
+ children: rows.map((row, index) => /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
1731
+ /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-[52px_1fr_1fr_52px] items-center gap-2 md:grid-cols-[88px_1fr_1fr_minmax(120px,220px)] md:gap-6", children: [
1732
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 md:gap-3", children: [
1733
+ /* @__PURE__ */ jsx4(VenueLogo, { venue: row.venue, size: "small" }),
1734
+ /* @__PURE__ */ jsx4(
1735
+ "span",
1736
+ {
1737
+ className: cn(
1738
+ "text-agg-xs font-agg-bold leading-agg-4 md:text-agg-sm md:leading-agg-5",
1739
+ priceClassName
1740
+ ),
1741
+ children: formatProbabilityCents(row.price)
1742
+ }
1743
+ )
1744
+ ] }),
1745
+ /* @__PURE__ */ jsx4("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatNumber(row.size) }),
1746
+ /* @__PURE__ */ jsx4("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatCurrency(row.total) }),
1747
+ /* @__PURE__ */ jsx4("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx4(
1748
+ "div",
1749
+ {
1750
+ "aria-hidden": "true",
1751
+ className: cn("h-2 rounded-agg-full", barClassName),
1752
+ style: {
1753
+ width: `${Math.max(20, Math.round(row.barScale * 100))}%`
1754
+ }
1755
+ }
1756
+ ) })
1757
+ ] }),
1758
+ index < rows.length - 1 ? /* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }) : null
1759
+ ] }, row.id))
1760
+ }
1761
+ )
1762
+ ] });
1763
+ };
1764
+ var getOutcomeButtonClassName = ({
1765
+ enableAnimations,
1766
+ isPositive,
1767
+ isActive
1768
+ }) => {
1769
+ const defaultStateClassName = isPositive ? "border-[#18c15c]/50 bg-[#18c15c]/5 text-agg-foreground hover:bg-[#18c15c]/10" : "border-[#e5455f]/50 bg-[#e5455f]/5 text-agg-foreground hover:bg-[#e5455f]/10";
1770
+ const activeStateClassName = isPositive ? "border-transparent bg-[#18c15c] text-agg-on-primary" : "border-transparent bg-[#e5455f] text-agg-on-primary";
1771
+ return cn(
1772
+ "h-auto min-h-10 flex-1 rounded-agg-full border px-4 py-1.5 text-agg-base leading-agg-6 shadow-none md:flex-none md:min-w-[168px]",
1773
+ getMotionClassName(enableAnimations, "transition-all duration-300 ease-in-out"),
1774
+ isActive ? activeStateClassName : defaultStateClassName,
1775
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover",
1776
+ "cursor-pointer disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
1777
+ isActive ? "font-agg-bold" : "font-agg-normal"
1778
+ );
1779
+ };
1780
+ var MarketDetailsContent = ({
1781
+ event,
1782
+ marketId,
1783
+ title,
1784
+ image,
1785
+ isOpened: defaultIsOpened = marketDetailsDefaultIsOpened,
1786
+ onOpenChange,
1787
+ defaultTab,
1788
+ defaultOutcomeLabel,
1789
+ defaultTimeRange = "1M",
1790
+ orderBookDepth = orderBookRowLimitDefault,
1791
+ ariaLabel,
1792
+ classNames,
1793
+ otherContent
1794
+ }) => {
1795
+ const config = useSdkUiConfig3();
1796
+ const labels = useLabels4();
1797
+ const detailsContentId = useId();
1798
+ const model = useMemo4(() => {
1799
+ return buildMarketDetailsModel({
1800
+ event,
1801
+ marketId,
1802
+ title,
1803
+ image,
1804
+ formatCompactCurrency: config.formatCompactCurrency,
1805
+ labels
1806
+ });
1807
+ }, [config.formatCompactCurrency, event, image, labels, marketId, title]);
1808
+ const resolvedMarket = useMemo4(() => {
1809
+ return resolveMarket(event, marketId);
1810
+ }, [event, marketId]);
1811
+ const marketDetailsTabs = useMemo4(() => {
1812
+ return getMarketDetailsTabs(labels);
1813
+ }, [labels]);
1814
+ const [selectedTab, setSelectedTab] = useState2(
1815
+ () => resolveInitialTab(defaultTab)
1816
+ );
1817
+ const [isOpened, setIsOpened] = useState2(defaultIsOpened);
1818
+ useEffect2(() => {
1819
+ setSelectedTab(resolveInitialTab(defaultTab));
1820
+ }, [defaultTab]);
1821
+ const [selectedTimeRange, setSelectedTimeRange] = useState2(defaultTimeRange);
1822
+ const [selectedChartType, setSelectedChartType] = useState2("line");
1823
+ useEffect2(() => {
1824
+ setSelectedTimeRange(defaultTimeRange);
1825
+ }, [defaultTimeRange]);
1826
+ const [selectedOutcomeLabel, setSelectedOutcomeLabel] = useState2(
1827
+ () => {
1828
+ var _a;
1829
+ return resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel);
1830
+ }
1831
+ );
1832
+ const [selectedGraphVenue, setSelectedGraphVenue] = useState2(null);
1833
+ useEffect2(() => {
1834
+ var _a;
1835
+ setSelectedOutcomeLabel(
1836
+ resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel)
1837
+ );
1838
+ }, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
1839
+ const headerOutcomeItems = useMemo4(() => {
1840
+ if (!model)
1841
+ return [];
1842
+ return resolveHeaderOutcomeItems(model.market.venueMarkets, selectedOutcomeLabel);
1843
+ }, [model, selectedOutcomeLabel]);
1844
+ const headlineProbability = useMemo4(() => {
1845
+ if (!model || !selectedOutcomeLabel)
1846
+ return void 0;
1847
+ return model.probabilityByLabel.get(selectedOutcomeLabel);
1848
+ }, [model, selectedOutcomeLabel]);
1849
+ const outcomesByLabel = useMemo4(() => {
1850
+ const outcomesByLabelMap = /* @__PURE__ */ new Map();
1851
+ if (!model) {
1852
+ return outcomesByLabelMap;
1853
+ }
1854
+ headerOutcomeItems.forEach((headerOutcomeItem) => {
1855
+ outcomesByLabelMap.set(
1856
+ headerOutcomeItem.label,
1857
+ resolveOutcomesByVenue(model.market.venueMarkets, headerOutcomeItem.label)
1858
+ );
1859
+ });
1860
+ return outcomesByLabelMap;
1861
+ }, [headerOutcomeItems, model]);
1862
+ const selectedOutcomesByVenue = useMemo4(() => {
1863
+ var _a;
1864
+ if (!selectedOutcomeLabel)
1865
+ return [];
1866
+ return (_a = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a : [];
1867
+ }, [outcomesByLabel, selectedOutcomeLabel]);
1868
+ const timeWindow = useMemo4(() => {
1869
+ return getTimeWindowByRange(selectedTimeRange);
1870
+ }, [selectedTimeRange]);
1871
+ const graphOutcomes = useMemo4(() => {
1872
+ const uniqueOutcomesByVenueAndId = /* @__PURE__ */ new Map();
1873
+ outcomesByLabel.forEach((outcomes) => {
1874
+ outcomes.forEach((outcomeByVenue) => {
1875
+ uniqueOutcomesByVenueAndId.set(
1876
+ `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
1877
+ outcomeByVenue
1878
+ );
1879
+ });
1880
+ });
1881
+ return [...uniqueOutcomesByVenueAndId.values()];
1882
+ }, [outcomesByLabel]);
1883
+ const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
1884
+ const priceHistoryGroups = useMemo4(() => {
1885
+ return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
1886
+ }, [canonicalMarketIdForHistory, graphOutcomes]);
1887
+ const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = usePriceHistory2(__spreadProps(__spreadValues({
1888
+ groups: priceHistoryGroups
1889
+ }, timeWindow), {
1890
+ enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
1891
+ }));
1892
+ const orderBookInputs = useMemo4(() => {
1893
+ return selectedOutcomesByVenue.map(({ market, outcome }) => ({
1894
+ market,
1895
+ outcome,
1896
+ liveUpdate: true
1897
+ }));
1898
+ }, [selectedOutcomesByVenue]);
1899
+ const {
1900
+ data: orderBookData,
1901
+ isLoading: isOrderBookLoading,
1902
+ error: orderBookError,
1903
+ results: orderBookResults
1904
+ } = useOrderBook({
1905
+ orderbooks: orderBookInputs,
1906
+ enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0
1907
+ });
1908
+ const askRows = useMemo4(() => {
1909
+ return resolveOrderBookRows({
1910
+ data: orderBookData,
1911
+ side: "asks"
1912
+ });
1913
+ }, [orderBookData]);
1914
+ const bidRows = useMemo4(() => {
1915
+ return resolveOrderBookRows({
1916
+ data: orderBookData,
1917
+ side: "bids"
1918
+ });
1919
+ }, [orderBookData]);
1920
+ const priceHistoryByVenue = useMemo4(() => {
1921
+ const historyByVenue = /* @__PURE__ */ new Map();
1922
+ if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
1923
+ return historyByVenue;
1924
+ }
1925
+ priceHistoryData.forEach((historyItem) => {
1926
+ const venue = historyItem.venue;
1927
+ const venueHistory = historyByVenue.get(venue);
1928
+ if (venueHistory) {
1929
+ venueHistory.push(historyItem);
1930
+ return;
1931
+ }
1932
+ historyByVenue.set(venue, [historyItem]);
1933
+ });
1934
+ return historyByVenue;
1935
+ }, [priceHistoryData]);
1936
+ const graphSeriesByOutcomeLabel = useMemo4(() => {
1937
+ const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
1938
+ const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
1939
+ var _a, _b;
1940
+ const marketWithCanonicalId = outcomeByVenue.market;
1941
+ return [
1942
+ outcomeByVenue.outcome.id,
1943
+ (_a = outcomeByVenue.outcome.externalIdentifier) != null ? _a : void 0,
1944
+ outcomeByVenue.market.externalIdentifier,
1945
+ (_b = marketWithCanonicalId.marketId) != null ? _b : void 0,
1946
+ canonicalMarketIdForHistory
1947
+ ].filter((value) => typeof value === "string" && value.trim().length > 0);
1948
+ };
1949
+ headerOutcomeItems.forEach((headerOutcomeItem) => {
1950
+ var _a;
1951
+ const outcomes = (_a = outcomesByLabel.get(headerOutcomeItem.label)) != null ? _a : [];
1952
+ const graphSeries2 = [];
1953
+ outcomes.forEach((outcomeByVenue, index) => {
1954
+ var _a2;
1955
+ const venueHistory = priceHistoryByVenue.get(outcomeByVenue.venue);
1956
+ if (!(venueHistory == null ? void 0 : venueHistory.length))
1957
+ return;
1958
+ const candidateIds = resolveOutcomeCandidateIds2(outcomeByVenue);
1959
+ const matchingHistory = (_a2 = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a2 : venueHistory.length === 1 ? venueHistory[0] : void 0;
1960
+ if (!matchingHistory)
1961
+ return;
1962
+ const points = matchingHistory.points.map((point) => ({
1963
+ time: point.timestamp,
1964
+ value: point.price * 100,
1965
+ open: point.open == null ? void 0 : point.open * 100,
1966
+ high: point.high == null ? void 0 : point.high * 100,
1967
+ low: point.low == null ? void 0 : point.low * 100,
1968
+ close: point.close == null ? void 0 : point.close * 100
1969
+ })).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
1970
+ if (points.length === 0)
1971
+ return;
1972
+ graphSeries2.push({
1973
+ id: `${headerOutcomeItem.label}-${outcomeByVenue.venue}-${matchingHistory.marketId}`,
1974
+ venue: outcomeByVenue.venue,
1975
+ color: resolveSeriesColor(outcomeByVenue.venue, index),
1976
+ points
1977
+ });
1978
+ });
1979
+ seriesByOutcomeLabel.set(headerOutcomeItem.label, graphSeries2);
1980
+ });
1981
+ return seriesByOutcomeLabel;
1982
+ }, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
1983
+ const graphSeries = useMemo4(() => {
1984
+ var _a;
1985
+ if (!selectedOutcomeLabel)
1986
+ return [];
1987
+ const seriesForOutcomeLabel = (_a = graphSeriesByOutcomeLabel.get(selectedOutcomeLabel)) != null ? _a : [];
1988
+ if (!selectedGraphVenue)
1989
+ return seriesForOutcomeLabel;
1990
+ return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
1991
+ }, [graphSeriesByOutcomeLabel, selectedGraphVenue, selectedOutcomeLabel]);
1992
+ const otherRows = useMemo4(() => {
1993
+ if (!model)
1994
+ return [];
1995
+ return resolveOtherTabRows(model.market, labels);
1996
+ }, [labels, model]);
1997
+ const isOrderBookNotFound = isErrorWithStatus(orderBookError, 404);
1998
+ const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
1999
+ const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (orderBookInputs.length === 0 || askRows.length === 0 && bidRows.length === 0);
2000
+ const handleOutcomeKeyDown = (eventToHandle) => {
2001
+ var _a;
2002
+ if ((eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowLeft" && (eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowRight") {
2003
+ return;
2004
+ }
2005
+ if (headerOutcomeItems.length <= 1)
2006
+ return;
2007
+ const activeIndex = headerOutcomeItems.findIndex((item) => {
2008
+ return item.label === selectedOutcomeLabel;
2009
+ });
2010
+ const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
2011
+ const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
2012
+ setSelectedOutcomeLabel((_a = headerOutcomeItems[nextIndex]) == null ? void 0 : _a.label);
2013
+ };
2014
+ const handleToggleExpanded = (event2) => {
2015
+ if (event2 && "key" in event2 && (event2 == null ? void 0 : event2.key) !== "Enter" && (event2 == null ? void 0 : event2.key) !== " ") {
2016
+ return;
2017
+ }
2018
+ event2 == null ? void 0 : event2.preventDefault();
2019
+ event2 == null ? void 0 : event2.stopPropagation();
2020
+ setIsOpened((prev) => {
2021
+ const next = !prev;
2022
+ onOpenChange == null ? void 0 : onOpenChange(next);
2023
+ return next;
2024
+ });
2025
+ };
2026
+ const handleGraphVenueToggle = (venue) => {
2027
+ setSelectedGraphVenue((currentVenue) => {
2028
+ if (currentVenue === venue)
2029
+ return null;
2030
+ return venue;
2031
+ });
2032
+ };
2033
+ const handleRetryOrderBook = () => {
2034
+ void Promise.all(orderBookResults.map((result) => result.refetch()));
2035
+ };
2036
+ useEffect2(() => {
2037
+ if (!selectedGraphVenue) {
2038
+ return;
2039
+ }
2040
+ if (selectedOutcomesByVenue.some((item) => item.venue === selectedGraphVenue)) {
2041
+ return;
2042
+ }
2043
+ setSelectedGraphVenue(null);
2044
+ }, [selectedGraphVenue, selectedOutcomesByVenue]);
2045
+ if (marketId && !resolvedMarket) {
2046
+ return /* @__PURE__ */ jsx4(MarketDetailsNotFoundState, { ariaLabel, classNames });
2047
+ }
2048
+ if (!model) {
2049
+ return /* @__PURE__ */ jsx4(MarketDetailsUnavailableState, { ariaLabel, classNames });
2050
+ }
2051
+ return /* @__PURE__ */ jsxs3(
2052
+ Card,
2053
+ {
2054
+ className: cn(
2055
+ "w-full rounded-agg-2xl text-left outline-none",
2056
+ marketDetailsBaseCardClassName,
2057
+ classNames == null ? void 0 : classNames.root
2058
+ ),
2059
+ children: [
2060
+ /* @__PURE__ */ jsxs3(
2061
+ "div",
2062
+ {
2063
+ className: cn(
2064
+ "cursor-pointer disabled:cursor-default",
2065
+ "flex flex-wrap flex-row items-center justify-between gap-3 px-5 py-4",
2066
+ isOpened && "pb-3",
2067
+ classNames == null ? void 0 : classNames.header
2068
+ ),
2069
+ "aria-expanded": isOpened,
2070
+ "aria-controls": detailsContentId,
2071
+ role: "button",
2072
+ tabIndex: 0,
2073
+ "aria-label": isOpened ? labels.marketDetails.toggleCloseDetailsAria(model.title) : labels.marketDetails.toggleOpenDetailsAria(model.title),
2074
+ onClick: handleToggleExpanded,
2075
+ onKeyDown: handleToggleExpanded,
2076
+ children: [
2077
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
2078
+ model.image ? /* @__PURE__ */ jsx4(
2079
+ "img",
2080
+ {
2081
+ src: model.image,
2082
+ alt: "",
2083
+ className: "size-12 rounded-agg-lg object-cover md:size-[60px]"
2084
+ }
2085
+ ) : null,
2086
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col", children: [
2087
+ /* @__PURE__ */ jsx4(Typography, { as: "h3", variant: "body-large-strong", className: "truncate", children: model.title }),
2088
+ /* @__PURE__ */ jsx4("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx4(Typography, { variant: "label", className: "truncate text-agg-muted-foreground", children: model.subtitle }) })
2089
+ ] })
2090
+ ] }),
2091
+ /* @__PURE__ */ jsx4(Typography, { as: "div", variant: "heading", className: "shrink-0", children: formatProbabilityPercent(headlineProbability) }),
2092
+ /* @__PURE__ */ jsx4(
2093
+ "div",
2094
+ {
2095
+ className: "flex gap-2",
2096
+ role: "tablist",
2097
+ "aria-label": labels.marketDetails.marketOutcomesAria,
2098
+ tabIndex: 0,
2099
+ onKeyDown: (e) => handleOutcomeKeyDown(e),
2100
+ children: headerOutcomeItems.map((item) => {
2101
+ const isPositive = item.tone === "positive";
2102
+ const isActiveOutcome = item.label === selectedOutcomeLabel;
2103
+ return /* @__PURE__ */ jsx4(
2104
+ "button",
2105
+ {
2106
+ type: "button",
2107
+ role: "tab",
2108
+ "aria-selected": isActiveOutcome,
2109
+ tabIndex: isActiveOutcome ? 0 : -1,
2110
+ className: getOutcomeButtonClassName({
2111
+ enableAnimations: config.enableAnimations,
2112
+ isPositive,
2113
+ isActive: isActiveOutcome
2114
+ }),
2115
+ onClick: (e) => {
2116
+ e.preventDefault();
2117
+ e.stopPropagation();
2118
+ setSelectedOutcomeLabel(item.label);
2119
+ },
2120
+ children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-2", children: [
2121
+ /* @__PURE__ */ jsx4(
2122
+ VenueLogo,
2123
+ {
2124
+ venue: isPositive ? "polymarket" : "probable",
2125
+ size: "small",
2126
+ color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
2127
+ }
2128
+ ),
2129
+ /* @__PURE__ */ jsx4(
2130
+ Typography,
2131
+ {
2132
+ variant: isActiveOutcome ? "body-strong" : "body",
2133
+ className: cn(
2134
+ "text-agg-base leading-agg-6",
2135
+ isActiveOutcome ? "text-agg-on-primary" : "text-agg-foreground"
2136
+ ),
2137
+ children: `${item.label} ${formatProbabilityCents(item.probability)}`
2138
+ }
2139
+ )
2140
+ ] })
2141
+ },
2142
+ item.label
2143
+ );
2144
+ })
2145
+ }
2146
+ )
2147
+ ]
2148
+ }
2149
+ ),
2150
+ /* @__PURE__ */ jsx4(
2151
+ "div",
2152
+ {
2153
+ id: detailsContentId,
2154
+ className: cn(
2155
+ "grid overflow-hidden",
2156
+ getMotionClassName(config.enableAnimations, "transition-all duration-500 ease-in-out"),
2157
+ isOpened ? "grid-rows-[1fr] opacity-100" : "pointer-events-none grid-rows-[0fr] opacity-0"
2158
+ ),
2159
+ "aria-hidden": !isOpened,
2160
+ children: /* @__PURE__ */ jsxs3("div", { className: "min-h-0", children: [
2161
+ /* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }),
2162
+ /* @__PURE__ */ jsxs3(
2163
+ "div",
2164
+ {
2165
+ className: cn(
2166
+ getMotionClassName(
2167
+ config.enableAnimations,
2168
+ "transition-all duration-500 ease-in-out"
2169
+ ),
2170
+ isOpened ? cn(
2171
+ "translate-y-0 opacity-100",
2172
+ getMotionClassName(config.enableAnimations, "delay-100")
2173
+ ) : "translate-y-5 opacity-0"
2174
+ ),
2175
+ children: [
2176
+ /* @__PURE__ */ jsx4("div", { className: cn("block", classNames == null ? void 0 : classNames.tabs), children: /* @__PURE__ */ jsx4(
2177
+ Tabs,
2178
+ {
2179
+ ariaLabel: labels.marketDetails.tabsAria,
2180
+ items: marketDetailsTabs,
2181
+ value: selectedTab === "other" ? "order-book" : selectedTab,
2182
+ onChange: (nextValue) => setSelectedTab(nextValue),
2183
+ variant: "underline",
2184
+ className: "w-full px-5"
2185
+ }
2186
+ ) }),
2187
+ /* @__PURE__ */ jsx4("div", { className: "h-px w-full bg-agg-separator" }),
2188
+ /* @__PURE__ */ jsxs3("div", { className: cn("p-5", classNames == null ? void 0 : classNames.content), children: [
2189
+ selectedTab === "order-book" ? /* @__PURE__ */ jsx4("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.orderBook), children: isOrderBookLoading ? /* @__PURE__ */ jsx4(MarketDetailsOderbookSkeleton, {}) : hasOrderBookError ? /* @__PURE__ */ jsx4(
2190
+ StateMessage,
2191
+ {
2192
+ ariaLabel: labels.marketDetails.orderBookUnavailableAria,
2193
+ tone: "warning",
2194
+ title: labels.marketDetails.orderBookUnavailableTitle,
2195
+ description: labels.marketDetails.orderBookUnavailableDescription,
2196
+ actionLabel: labels.common.retry,
2197
+ onAction: handleRetryOrderBook,
2198
+ className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
2199
+ }
2200
+ ) : hasNoOrderBook ? /* @__PURE__ */ jsx4(
2201
+ StateMessage,
2202
+ {
2203
+ ariaLabel: labels.marketDetails.orderBookEmptyAria,
2204
+ title: labels.marketDetails.orderBookEmptyTitle,
2205
+ description: labels.marketDetails.orderBookEmptyDescription,
2206
+ className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
2207
+ }
2208
+ ) : /* @__PURE__ */ jsxs3(Fragment, { children: [
2209
+ /* @__PURE__ */ jsx4(
2210
+ OrderBookRows,
2211
+ {
2212
+ rows: askRows,
2213
+ title: labels.marketDetails.asks,
2214
+ formatNumber: config.formatNumber,
2215
+ formatCurrency: config.formatCurrency,
2216
+ visibleRows: orderBookDepth
2217
+ }
2218
+ ),
2219
+ /* @__PURE__ */ jsx4(
2220
+ OrderBookRows,
2221
+ {
2222
+ rows: bidRows,
2223
+ title: labels.marketDetails.bids,
2224
+ formatNumber: config.formatNumber,
2225
+ formatCurrency: config.formatCurrency,
2226
+ visibleRows: orderBookDepth
2227
+ }
2228
+ )
2229
+ ] }) }) : null,
2230
+ selectedTab === "graph" ? /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
2231
+ /* @__PURE__ */ jsx4(
2232
+ LineChart,
2233
+ {
2234
+ series: graphSeries,
2235
+ height: 260,
2236
+ isLoading: isPriceHistoryLoading,
2237
+ chartType: selectedChartType,
2238
+ classNames: { root: "w-full" },
2239
+ showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
2240
+ renderSeriesControls: () => {
2241
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
2242
+ /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-2", children: selectedOutcomesByVenue.map((item) => {
2243
+ const probability = formatProbabilityPercent(item.outcome.price);
2244
+ const isActiveVenue = selectedGraphVenue === item.venue;
2245
+ return /* @__PURE__ */ jsxs3(
2246
+ "button",
2247
+ {
2248
+ type: "button",
2249
+ "aria-label": `${item.venue} ${probability}`,
2250
+ "aria-pressed": isActiveVenue,
2251
+ className: cn(
2252
+ "inline-flex items-center gap-2 rounded-agg-full border-2 px-4 py-2",
2253
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover",
2254
+ isActiveVenue ? "border-agg-primary bg-agg-secondary" : "border-transparent bg-agg-secondary-hover"
2255
+ ),
2256
+ onClick: (e) => {
2257
+ e.preventDefault();
2258
+ e.stopPropagation();
2259
+ handleGraphVenueToggle(item.venue);
2260
+ },
2261
+ children: [
2262
+ /* @__PURE__ */ jsx4(VenueLogo, { venue: item.venue, size: "small" }),
2263
+ /* @__PURE__ */ jsx4("span", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: probability })
2264
+ ]
2265
+ },
2266
+ `${item.market.id}-${item.outcome.id}`
2267
+ );
2268
+ }) }),
2269
+ /* @__PURE__ */ jsx4(
2270
+ SwitchButton,
2271
+ {
2272
+ ariaLabel: labels.marketDetails.outcomeSelectorAria,
2273
+ className: "shrink-0",
2274
+ value: selectedOutcomeLabel != null ? selectedOutcomeLabel : "",
2275
+ onValueChange: (nextValue) => setSelectedOutcomeLabel(nextValue),
2276
+ options: headerOutcomeItems.map((item) => ({
2277
+ value: item.label,
2278
+ label: `${item.label} ${formatProbabilityCents(item.probability)}`,
2279
+ ariaLabel: labels.marketDetails.showOutcomeAria(item.label)
2280
+ }))
2281
+ }
2282
+ )
2283
+ ] });
2284
+ }
2285
+ }
2286
+ ),
2287
+ /* @__PURE__ */ jsxs3(
2288
+ "div",
2289
+ {
2290
+ className: cn(
2291
+ "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-muted-foreground md:flex-row md:items-center md:justify-between",
2292
+ classNames == null ? void 0 : classNames.footer
2293
+ ),
2294
+ children: [
2295
+ /* @__PURE__ */ jsx4("span", { children: typeof model.market.volume === "number" ? `${config.formatCompactCurrency(model.market.volume)} ${labels.marketDetails.meta.volumeSuffix}` : labels.marketDetails.volumeUnavailable }),
2296
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-3 md:gap-4", children: [
2297
+ /* @__PURE__ */ jsx4(
2298
+ ChartTypeSwitch,
2299
+ {
2300
+ className: "shrink-0",
2301
+ value: selectedChartType,
2302
+ onValueChange: setSelectedChartType
2303
+ }
2304
+ ),
2305
+ /* @__PURE__ */ jsx4(
2306
+ "span",
2307
+ {
2308
+ "aria-hidden": "true",
2309
+ className: "hidden h-4 w-px bg-agg-separator md:block"
2310
+ }
2311
+ ),
2312
+ eventListItemDetailsTimeRanges.map((timeRange) => {
2313
+ const isActive = selectedTimeRange === timeRange;
2314
+ return /* @__PURE__ */ jsx4(
2315
+ "button",
2316
+ {
2317
+ type: "button",
2318
+ className: cn(
2319
+ "cursor-pointer text-agg-sm leading-agg-5",
2320
+ isActive ? "font-agg-bold text-agg-foreground" : "font-agg-normal text-agg-muted-foreground"
2321
+ ),
2322
+ "aria-pressed": isActive,
2323
+ onClick: (e) => {
2324
+ e.preventDefault();
2325
+ e.stopPropagation();
2326
+ setSelectedTimeRange(timeRange);
2327
+ },
2328
+ children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
2329
+ },
2330
+ timeRange
2331
+ );
2332
+ })
2333
+ ] })
2334
+ ]
2335
+ }
2336
+ )
2337
+ ] }) : null,
2338
+ selectedTab === "other" ? /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-4", children: otherContent != null ? otherContent : /* @__PURE__ */ jsx4("div", { className: "grid grid-cols-1 gap-3", children: otherRows.map((row) => /* @__PURE__ */ jsxs3(
2339
+ "div",
2340
+ {
2341
+ className: "flex items-center justify-between rounded-agg-xl bg-agg-secondary-hover px-4 py-3",
2342
+ children: [
2343
+ /* @__PURE__ */ jsx4(Typography, { variant: "label", className: "text-agg-muted-foreground", children: row.label }),
2344
+ /* @__PURE__ */ jsx4(Typography, { variant: "body", className: "text-right", children: row.value })
2345
+ ]
2346
+ },
2347
+ row.label
2348
+ )) }) }) : null
2349
+ ] })
2350
+ ]
2351
+ }
2352
+ )
2353
+ ] })
2354
+ }
2355
+ )
2356
+ ]
2357
+ }
2358
+ );
2359
+ };
2360
+ var MarketDetails = (props) => {
2361
+ var _a;
2362
+ const [uncontrolledIsOpened, setUncontrolledIsOpened] = useState2(
2363
+ (_a = props.defaultIsOpened) != null ? _a : marketDetailsDefaultIsOpened
2364
+ );
2365
+ useEffect2(() => {
2366
+ if (typeof props.isOpened !== "boolean")
2367
+ return;
2368
+ setUncontrolledIsOpened(props.isOpened);
2369
+ }, [props.isOpened]);
2370
+ const resolvedIsOpened = typeof props.isOpened === "boolean" ? props.isOpened : uncontrolledIsOpened;
2371
+ const handleOpenChange = (nextIsOpened) => {
2372
+ var _a2;
2373
+ if (typeof props.isOpened !== "boolean") {
2374
+ setUncontrolledIsOpened(nextIsOpened);
2375
+ }
2376
+ (_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, nextIsOpened);
2377
+ };
2378
+ const hasEventProp = "event" in props && !!props.event;
2379
+ const {
2380
+ event: fetchedEvent,
2381
+ error: eventError,
2382
+ isLoading: isFetchingEvent
2383
+ } = useEvent3(hasEventProp ? void 0 : props.eventId, {
2384
+ enabled: !props.isLoading && !hasEventProp && !!props.eventId
2385
+ });
2386
+ if (props.isLoading) {
2387
+ return /* @__PURE__ */ jsx4(
2388
+ MarketDetailsLoadingState,
2389
+ {
2390
+ isOpened: resolvedIsOpened,
2391
+ ariaLabel: props.ariaLabel,
2392
+ classNames: props.classNames
2393
+ }
2394
+ );
2395
+ }
2396
+ if ("event" in props && props.event) {
2397
+ return /* @__PURE__ */ jsx4(
2398
+ MarketDetailsContent,
2399
+ __spreadProps(__spreadValues({}, props), {
2400
+ isOpened: resolvedIsOpened,
2401
+ onOpenChange: handleOpenChange,
2402
+ event: props.event
2403
+ })
2404
+ );
2405
+ }
2406
+ if (isFetchingEvent) {
2407
+ return /* @__PURE__ */ jsx4(
2408
+ MarketDetailsLoadingState,
2409
+ {
2410
+ isOpened: resolvedIsOpened,
2411
+ ariaLabel: props.ariaLabel,
2412
+ classNames: props.classNames
2413
+ }
2414
+ );
2415
+ }
2416
+ if (!fetchedEvent) {
2417
+ if (isErrorWithStatus(eventError, 404)) {
2418
+ return /* @__PURE__ */ jsx4(MarketDetailsNotFoundState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
2419
+ }
2420
+ return /* @__PURE__ */ jsx4(MarketDetailsUnavailableState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
2421
+ }
2422
+ return /* @__PURE__ */ jsx4(
2423
+ MarketDetailsContent,
2424
+ __spreadProps(__spreadValues({}, props), {
2425
+ isOpened: resolvedIsOpened,
2426
+ onOpenChange: handleOpenChange,
2427
+ event: fetchedEvent
2428
+ })
2429
+ );
2430
+ };
2431
+ MarketDetails.displayName = "MarketDetails";
2432
+
2433
+ // src/events/list/index.tsx
2434
+ import { useCallback, useEffect as useEffect3, useMemo as useMemo5, useRef, useState as useState3 } from "react";
2435
+ import { useEvents, useLabels as useLabels5 } from "@agg-market/hooks";
2436
+
2437
+ // src/events/list/event-list.constants.ts
2438
+ var POLYMARKET_VENUE = "polymarket";
2439
+ var KALSHI_VENUE = "kalshi";
2440
+ var POLYMARKET_VENUE_LOGO = "polymarket";
2441
+ var KALSHI_VENUE_LOGO = "kalshi";
2442
+ var getDefaultEventListTabs = (labels) => {
2443
+ return [
2444
+ {
2445
+ value: "matched",
2446
+ label: labels.eventList.matchedTab,
2447
+ iconName: "arrows-to-dot"
2448
+ },
2449
+ {
2450
+ value: "polymarket",
2451
+ label: labels.venues.polymarket,
2452
+ venueLogo: POLYMARKET_VENUE_LOGO,
2453
+ venues: [POLYMARKET_VENUE]
2454
+ },
2455
+ {
2456
+ value: "kalshi",
2457
+ label: labels.venues.kalshi,
2458
+ venueLogo: KALSHI_VENUE_LOGO,
2459
+ venues: [KALSHI_VENUE]
2460
+ }
2461
+ ];
2462
+ };
2463
+
2464
+ // src/events/list/event-list.utils.ts
2465
+ var mapEventToEventListItemEvent = (event) => {
2466
+ const mergedVenueMarkets = event.markets.flatMap((m) => m.venueMarkets);
2467
+ if (mergedVenueMarkets.length === 0)
2468
+ return null;
2469
+ return event;
2470
+ };
2471
+ var filterEventsByTabValue = (events, _tabValue) => {
2472
+ return events;
2473
+ };
2474
+ var resolveTabVenus = (tab) => {
2475
+ if (!tab)
2476
+ return void 0;
2477
+ if (tab.venues && tab.venues.length > 0)
2478
+ return tab.venues;
2479
+ if (tab.value === "polymarket" || tab.value === "kalshi") {
2480
+ return [tab.value];
2481
+ }
2482
+ return void 0;
2483
+ };
2484
+
2485
+ // src/events/list/index.tsx
2486
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
2487
+ var renderTabIcon = (tab, isActive) => {
2488
+ if (tab.venueLogo) {
2489
+ return /* @__PURE__ */ jsx5(VenueLogo, { venue: tab.venueLogo, size: "small" });
2490
+ }
2491
+ if (!tab.iconName)
2492
+ return null;
2493
+ return /* @__PURE__ */ jsx5(
2494
+ Icon,
2495
+ {
2496
+ name: tab.iconName,
2497
+ size: "small",
2498
+ color: isActive ? "var(--agg-color-primary)" : "var(--agg-color-foreground)"
2499
+ }
2500
+ );
2501
+ };
2502
+ var TAB_MIN_WIDTH = 80;
2503
+ var TAB_HORIZONTAL_PADDING = 32;
2504
+ var TAB_ICON_AND_GAP_WIDTH = 24;
2505
+ var TAB_OUTER_BORDER_WIDTH = 2;
2506
+ var TAB_INNER_BORDER_WIDTH = 1;
2507
+ var measureTabLabelWidth = (label) => {
2508
+ if (typeof document === "undefined")
2509
+ return label.length * 9;
2510
+ const canvas = document.createElement("canvas");
2511
+ const context = canvas.getContext("2d");
2512
+ if (!context)
2513
+ return label.length * 9;
2514
+ context.font = "700 16px Inter";
2515
+ return context.measureText(label).width;
2516
+ };
2517
+ var estimateTabsWidth = (items) => {
2518
+ if (items.length === 0)
2519
+ return 0;
2520
+ const tabsWidth = items.reduce((sum, item) => {
2521
+ const textWidth = Math.ceil(measureTabLabelWidth(item.label));
2522
+ const iconWidth = item.icon ? TAB_ICON_AND_GAP_WIDTH : 0;
2523
+ const buttonWidth = Math.max(TAB_MIN_WIDTH, textWidth + iconWidth + TAB_HORIZONTAL_PADDING);
2524
+ return sum + buttonWidth;
2525
+ }, 0);
2526
+ return tabsWidth + TAB_OUTER_BORDER_WIDTH + (items.length - 1) * TAB_INNER_BORDER_WIDTH;
2527
+ };
2528
+ var EventList = ({
2529
+ title,
2530
+ maxItemsPerRow = 3,
2531
+ limit = 3,
2532
+ maxVisibleItems,
2533
+ showVenueLogo = true,
2534
+ search,
2535
+ categoryIds
2536
+ }) => {
2537
+ var _a, _b;
2538
+ const labels = useLabels5();
2539
+ const defaultEventListTabs = useMemo5(() => {
2540
+ return getDefaultEventListTabs(labels);
2541
+ }, [labels]);
2542
+ const [activeTabValue, setActiveTabValue] = useState3(
2543
+ (_b = (_a = defaultEventListTabs[0]) == null ? void 0 : _a.value) != null ? _b : "matched"
2544
+ );
2545
+ const [_shouldUseSelectOverflow, setShouldUseSelectOverflow] = useState3(false);
2546
+ const activeTab = useMemo5(() => {
2547
+ return defaultEventListTabs.find((tab) => tab.value === activeTabValue);
2548
+ }, [activeTabValue]);
2549
+ const venues = useMemo5(() => {
2550
+ return resolveTabVenus(activeTab);
2551
+ }, [activeTab]);
2552
+ const resolvedMaxVisibleItems = useMemo5(() => {
2553
+ if (!Number.isFinite(maxVisibleItems))
2554
+ return void 0;
2555
+ return Math.max(1, Math.floor(maxVisibleItems));
2556
+ }, [maxVisibleItems]);
2557
+ const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
2558
+ const shouldPaginate = resolvedMaxVisibleItems == null;
2559
+ const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = useEvents({
2560
+ venues,
2561
+ search,
2562
+ categoryIds,
2563
+ limit: requestLimit
2564
+ });
2565
+ const filteredEvents = useMemo5(() => {
2566
+ return filterEventsByTabValue(events, activeTabValue);
2567
+ }, [events, activeTabValue]);
2568
+ const tileEvents = useMemo5(() => {
2569
+ const normalizedEvents = filteredEvents.map((event) => mapEventToEventListItemEvent(event)).filter((event) => event != null);
2570
+ if (resolvedMaxVisibleItems == null)
2571
+ return normalizedEvents;
2572
+ return normalizedEvents.slice(0, resolvedMaxVisibleItems);
2573
+ }, [filteredEvents, resolvedMaxVisibleItems]);
2574
+ const tabsItems = useMemo5(() => {
2575
+ return defaultEventListTabs.map((tab) => {
2576
+ const isActive = tab.value === activeTabValue;
2577
+ return {
2578
+ value: tab.value,
2579
+ label: tab.label,
2580
+ icon: renderTabIcon(tab, isActive),
2581
+ disabled: tab.disabled
2582
+ };
2583
+ });
2584
+ }, [activeTabValue]);
2585
+ const headerRef = useRef(null);
2586
+ const titleRef = useRef(null);
2587
+ const updateTabsOverflowBehavior = useCallback(() => {
2588
+ if (typeof window === "undefined")
2589
+ return;
2590
+ const headerElement = headerRef.current;
2591
+ const titleElement = titleRef.current;
2592
+ if (!headerElement || !titleElement)
2593
+ return;
2594
+ const isDesktop = window.matchMedia("(min-width: 768px)").matches;
2595
+ if (!isDesktop) {
2596
+ setShouldUseSelectOverflow(false);
2597
+ return;
2598
+ }
2599
+ const headerStyles = window.getComputedStyle(headerElement);
2600
+ const rawGap = headerStyles.columnGap || headerStyles.gap || "0";
2601
+ const horizontalGap = Number.parseFloat(rawGap) || 0;
2602
+ const availableTabsWidth = headerElement.clientWidth - titleElement.getBoundingClientRect().width - horizontalGap;
2603
+ const estimatedTabsWidth = estimateTabsWidth(tabsItems);
2604
+ setShouldUseSelectOverflow(availableTabsWidth > 0 && estimatedTabsWidth > availableTabsWidth);
2605
+ }, [tabsItems]);
2606
+ useEffect3(() => {
2607
+ updateTabsOverflowBehavior();
2608
+ }, [updateTabsOverflowBehavior]);
2609
+ useEffect3(() => {
2610
+ if (typeof ResizeObserver === "undefined")
2611
+ return;
2612
+ const headerElement = headerRef.current;
2613
+ const titleElement = titleRef.current;
2614
+ if (!headerElement || !titleElement)
2615
+ return;
2616
+ const resizeObserver = new ResizeObserver(() => {
2617
+ updateTabsOverflowBehavior();
2618
+ });
2619
+ resizeObserver.observe(headerElement);
2620
+ resizeObserver.observe(titleElement);
2621
+ return () => {
2622
+ resizeObserver.disconnect();
2623
+ };
2624
+ }, [updateTabsOverflowBehavior]);
2625
+ const resolvedMaxItemsPerRow = Number.isFinite(maxItemsPerRow) ? Math.max(1, Math.floor(maxItemsPerRow)) : 1;
2626
+ const loadingPlaceholderCount = isFetchingNextPage ? Math.min(resolvedMaxItemsPerRow, resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : Infinity) : 0;
2627
+ const shouldRenderLoadingState = isLoading && tileEvents.length === 0;
2628
+ const loadMoreRef = useRef(null);
2629
+ useEffect3(() => {
2630
+ if (!shouldPaginate)
2631
+ return;
2632
+ if (!hasNextPage)
2633
+ return;
2634
+ const target = loadMoreRef.current;
2635
+ if (!target)
2636
+ return;
2637
+ const observer = new IntersectionObserver(
2638
+ (entries) => {
2639
+ const entry = entries[0];
2640
+ if (!(entry == null ? void 0 : entry.isIntersecting))
2641
+ return;
2642
+ if (isLoading || isFetchingNextPage || !hasNextPage)
2643
+ return;
2644
+ void fetchNextPage();
2645
+ },
2646
+ {
2647
+ rootMargin: "320px 0px"
2648
+ }
2649
+ );
2650
+ observer.observe(target);
2651
+ return () => {
2652
+ observer.disconnect();
2653
+ };
2654
+ }, [fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, shouldPaginate]);
2655
+ const gridStyle = {
2656
+ ["--agg-event-list-columns"]: String(resolvedMaxItemsPerRow)
2657
+ };
2658
+ const gridClassName = cn(
2659
+ "grid grid-cols-1 gap-5",
2660
+ "md:[grid-template-columns:repeat(var(--agg-event-list-columns),minmax(0,1fr))]"
2661
+ );
2662
+ if (shouldRenderLoadingState) {
2663
+ return /* @__PURE__ */ jsx5(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
2664
+ }
2665
+ return /* @__PURE__ */ jsxs4("section", { className: "flex w-full flex-col gap-5", children: [
2666
+ /* @__PURE__ */ jsxs4(
2667
+ "header",
2668
+ {
2669
+ ref: headerRef,
2670
+ className: "flex flex-col sm:flex-row w-full flex-nowrap items-start sm:items-center justify-between gap-2 sm:gap-4",
2671
+ children: [
2672
+ /* @__PURE__ */ jsx5("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ jsx5(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
2673
+ /* @__PURE__ */ jsx5(
2674
+ Tabs,
2675
+ {
2676
+ ariaLabel: labels.eventList.tabsAria(title),
2677
+ items: tabsItems,
2678
+ value: activeTabValue,
2679
+ onChange: setActiveTabValue
2680
+ }
2681
+ )
2682
+ ]
2683
+ }
2684
+ ),
2685
+ /* @__PURE__ */ jsxs4("div", { className: gridClassName, style: gridStyle, children: [
2686
+ tileEvents.map((event) => /* @__PURE__ */ jsx5(
2687
+ EventListItem,
2688
+ {
2689
+ event,
2690
+ showVenueLogo,
2691
+ classNames: {
2692
+ root: "w-full min-w-0 max-w-none"
2693
+ }
2694
+ },
2695
+ event.id
2696
+ )),
2697
+ Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ jsx5(
2698
+ EventListItem,
2699
+ {
2700
+ isLoading: true,
2701
+ classNames: {
2702
+ root: "w-full min-w-0 max-w-none"
2703
+ }
2704
+ },
2705
+ `loading-${index}`
2706
+ )),
2707
+ !isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */ jsx5(Card, { className: "col-span-full overflow-hidden shadow-none hover:shadow-none", children: /* @__PURE__ */ jsx5(
2708
+ StateMessage,
2709
+ {
2710
+ ariaLabel: labels.eventList.emptyAria,
2711
+ title: labels.eventList.emptyTitle,
2712
+ description: labels.eventList.emptyDescription,
2713
+ className: "min-h-[320px]"
2714
+ }
2715
+ ) }) : null,
2716
+ isError ? /* @__PURE__ */ jsx5(
2717
+ Typography,
2718
+ {
2719
+ variant: "body",
2720
+ className: "w-full col-span-full flex flex-col items-center justify-center h-32",
2721
+ children: labels.eventList.error
2722
+ }
2723
+ ) : null
2724
+ ] }),
2725
+ shouldPaginate && hasNextPage ? /* @__PURE__ */ jsx5("div", { ref: loadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
2726
+ ] });
2727
+ };
2728
+ EventList.displayName = "EventList";
2729
+
2730
+ export {
2731
+ isErrorWithStatus,
2732
+ EventListItem,
2733
+ EventListItemDetails,
2734
+ MarketDetails,
2735
+ EventList
2736
+ };