@agg-market/ui 9.0.0 → 11.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 (76) hide show
  1. package/dist/{chunk-6CRY27SQ.mjs → chunk-2KGE5AJQ.mjs} +670 -659
  2. package/dist/{chunk-N7U7QCSB.mjs → chunk-5FSWOXEG.mjs} +807 -358
  3. package/dist/{chunk-HJ4UPYM7.mjs → chunk-HMUMJUIL.mjs} +539 -405
  4. package/dist/{chunk-3G7C6WEC.mjs → chunk-IUJXJEDQ.mjs} +1340 -664
  5. package/dist/{chunk-3U4VHAP6.mjs → chunk-UONHGMFI.mjs} +12 -4
  6. package/dist/events.js +1267 -1035
  7. package/dist/events.mjs +6 -4
  8. package/dist/index.js +4443 -3205
  9. package/dist/index.mjs +18 -7
  10. package/dist/modals.js +1207 -379
  11. package/dist/modals.mjs +4 -2
  12. package/dist/pages.js +2942 -1689
  13. package/dist/pages.mjs +4 -4
  14. package/dist/primitives.js +1317 -657
  15. package/dist/primitives.mjs +5 -1
  16. package/dist/styles.css +1 -1
  17. package/dist/tailwind.css +1 -1
  18. package/dist/trading.js +274 -190
  19. package/dist/trading.mjs +2 -2
  20. package/dist/types/events/item/event-list-item.types.d.mts +1 -2
  21. package/dist/types/events/item/event-list-item.types.d.ts +1 -2
  22. package/dist/types/events/item-details/event-list-item-details.types.d.mts +1 -4
  23. package/dist/types/events/item-details/event-list-item-details.types.d.ts +1 -4
  24. package/dist/types/events/item-details/event-list-item-details.utils.d.mts +42 -3
  25. package/dist/types/events/item-details/event-list-item-details.utils.d.ts +42 -3
  26. package/dist/types/events/list/event-list.types.d.mts +3 -2
  27. package/dist/types/events/list/event-list.types.d.ts +3 -2
  28. package/dist/types/events/list/index.d.mts +1 -1
  29. package/dist/types/events/list/index.d.ts +1 -1
  30. package/dist/types/events/market-details/index.d.mts +7 -3
  31. package/dist/types/events/market-details/index.d.ts +7 -3
  32. package/dist/types/events/market-details/market-details.types.d.mts +30 -10
  33. package/dist/types/events/market-details/market-details.types.d.ts +30 -10
  34. package/dist/types/events/market-details/market-details.utils.d.mts +15 -10
  35. package/dist/types/events/market-details/market-details.utils.d.ts +15 -10
  36. package/dist/types/modals/index.d.mts +1 -0
  37. package/dist/types/modals/index.d.ts +1 -0
  38. package/dist/types/pages/event-market/event-market.types.d.mts +2 -0
  39. package/dist/types/pages/event-market/event-market.types.d.ts +2 -0
  40. package/dist/types/pages/home/home.constants.d.mts +1 -3
  41. package/dist/types/pages/home/home.constants.d.ts +1 -3
  42. package/dist/types/pages/home/home.types.d.mts +0 -2
  43. package/dist/types/pages/home/home.types.d.ts +0 -2
  44. package/dist/types/pages/home/home.utils.d.mts +4 -0
  45. package/dist/types/pages/home/home.utils.d.ts +4 -0
  46. package/dist/types/pages/home/index.d.mts +1 -1
  47. package/dist/types/pages/home/index.d.ts +1 -1
  48. package/dist/types/primitives/agg-logo/index.d.mts +6 -0
  49. package/dist/types/primitives/agg-logo/index.d.ts +6 -0
  50. package/dist/types/primitives/chart/index.d.mts +9 -1
  51. package/dist/types/primitives/chart/index.d.ts +9 -1
  52. package/dist/types/primitives/header/agg-logo.d.mts +2 -0
  53. package/dist/types/primitives/header/agg-logo.d.ts +2 -0
  54. package/dist/types/primitives/header/header.constants.d.mts +3 -0
  55. package/dist/types/primitives/header/header.constants.d.ts +3 -0
  56. package/dist/types/primitives/header/header.types.d.mts +28 -0
  57. package/dist/types/primitives/header/header.types.d.ts +28 -0
  58. package/dist/types/primitives/header/index.d.mts +7 -0
  59. package/dist/types/primitives/header/index.d.ts +7 -0
  60. package/dist/types/primitives/index.d.mts +2 -0
  61. package/dist/types/primitives/index.d.ts +2 -0
  62. package/dist/types/primitives/search/index.d.mts +1 -1
  63. package/dist/types/primitives/search/index.d.ts +1 -1
  64. package/dist/types/primitives/search/search.types.d.mts +9 -59
  65. package/dist/types/primitives/search/search.types.d.ts +9 -59
  66. package/dist/types/primitives/search/search.utils.d.mts +4 -0
  67. package/dist/types/primitives/search/search.utils.d.ts +4 -0
  68. package/dist/types/primitives/skeleton/skeleton.types.d.mts +1 -0
  69. package/dist/types/primitives/skeleton/skeleton.types.d.ts +1 -0
  70. package/dist/types/primitives/skeleton/views/search-skeleton-view.d.mts +5 -0
  71. package/dist/types/primitives/skeleton/views/search-skeleton-view.d.ts +5 -0
  72. package/dist/types/primitives/venue-logo/index.d.mts +1 -1
  73. package/dist/types/primitives/venue-logo/index.d.ts +1 -1
  74. package/dist/types/trading/types.d.mts +2 -2
  75. package/dist/types/trading/types.d.ts +2 -2
  76. package/package.json +4 -4
package/dist/events.js CHANGED
@@ -62,14 +62,15 @@ __export(events_exports, {
62
62
  EventList: () => EventList,
63
63
  EventListItem: () => EventListItem,
64
64
  EventListItemDetails: () => EventListItemDetails,
65
- MarketDetails: () => MarketDetails
65
+ MarketDetails: () => MarketDetails,
66
+ MarketDetailsList: () => MarketDetailsList
66
67
  });
67
68
  module.exports = __toCommonJS(events_exports);
68
69
 
69
70
  // src/events/item/index.tsx
70
71
  var import_dayjs2 = __toESM(require("dayjs"));
71
72
  var import_react6 = require("react");
72
- var import_hooks15 = require("@agg-market/hooks");
73
+ var import_hooks16 = require("@agg-market/hooks");
73
74
 
74
75
  // src/primitives/badge/index.tsx
75
76
  var import_hooks = require("@agg-market/hooks");
@@ -117,7 +118,9 @@ function Badge({
117
118
  onClick,
118
119
  isActive = false
119
120
  }) {
120
- const { enableAnimations } = (0, import_hooks.useSdkUiConfig)();
121
+ const {
122
+ features: { enableAnimations }
123
+ } = (0, import_hooks.useSdkUiConfig)();
121
124
  const resolvedText = `${text}`;
122
125
  const resolvedAriaLabel = resolvedText.length > 0 ? resolvedText : void 0;
123
126
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -138,9 +141,9 @@ function Badge({
138
141
  )
139
142
  }, onClick && { onClick }), {
140
143
  children: [
141
- prefix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
144
+ prefix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.prefix, "empty:hidden"), children: prefix }) : null,
142
145
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
143
- suffix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
146
+ suffix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.suffix, "empty:hidden"), children: suffix }) : null
144
147
  ]
145
148
  })
146
149
  );
@@ -152,7 +155,9 @@ var import_hooks2 = require("@agg-market/hooks");
152
155
  var import_jsx_runtime2 = require("react/jsx-runtime");
153
156
  var Card = (_a) => {
154
157
  var _b = _a, { className, onClick } = _b, props = __objRest(_b, ["className", "onClick"]);
155
- const { enableAnimations } = (0, import_hooks2.useSdkUiConfig)();
158
+ const {
159
+ features: { enableAnimations }
160
+ } = (0, import_hooks2.useSdkUiConfig)();
156
161
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
157
162
  "div",
158
163
  __spreadValues(__spreadValues({
@@ -1859,7 +1864,9 @@ var import_hooks5 = require("@agg-market/hooks");
1859
1864
  var import_hooks3 = require("@agg-market/hooks");
1860
1865
  var import_jsx_runtime53 = require("react/jsx-runtime");
1861
1866
  var SkeletonBlock = ({ className }) => {
1862
- const { enableAnimations } = (0, import_hooks3.useSdkUiConfig)();
1867
+ const {
1868
+ features: { enableAnimations }
1869
+ } = (0, import_hooks3.useSdkUiConfig)();
1863
1870
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1864
1871
  "div",
1865
1872
  {
@@ -2191,15 +2198,63 @@ var PlaceOrderSkeletonView = ({
2191
2198
  };
2192
2199
  PlaceOrderSkeletonView.displayName = "PlaceOrderSkeletonView";
2193
2200
 
2194
- // src/primitives/skeleton/views/settlement-skeleton-view.tsx
2201
+ // src/primitives/skeleton/views/search-skeleton-view.tsx
2195
2202
  var import_hooks8 = require("@agg-market/hooks");
2196
2203
  var import_jsx_runtime59 = require("react/jsx-runtime");
2204
+ var SearchSkeletonRow = () => {
2205
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex w-full items-center gap-6 px-5 py-4", children: [
2206
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-12 shrink-0 rounded-[8px]" }),
2207
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
2208
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-[320px] rounded-agg-sm" }),
2209
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
2210
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-4 w-[104px] rounded-agg-sm" }),
2211
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center gap-1", children: [
2212
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-[14px] rounded-[4px]" }),
2213
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-[14px] rounded-[4px]" })
2214
+ ] })
2215
+ ] })
2216
+ ] }),
2217
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex w-[200px] shrink-0 items-center gap-2", children: [
2218
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-4 rounded-[4px]" }),
2219
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
2220
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-6 w-10 rounded-agg-sm" }),
2221
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-4 w-[60px] rounded-agg-sm" })
2222
+ ] })
2223
+ ] }),
2224
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-5 rounded-[4px]" })
2225
+ ] });
2226
+ };
2227
+ var SearchSkeletonView = ({ className, ariaLabel }) => {
2228
+ const labels = (0, import_hooks8.useLabels)();
2229
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
2230
+ "div",
2231
+ {
2232
+ className: cn(
2233
+ "group/agg-search-skeleton",
2234
+ "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]",
2235
+ className
2236
+ ),
2237
+ role: "status",
2238
+ "aria-label": ariaLabel != null ? ariaLabel : labels.search.loadingResults,
2239
+ "aria-busy": true,
2240
+ children: [
2241
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "pt-2", children: Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: cn(index > 0 && "border-t border-agg-separator"), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SearchSkeletonRow, {}) }, index)) }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "border-t border-agg-separator px-5 py-5", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-5 w-[116px] rounded-agg-sm" }) })
2243
+ ]
2244
+ }
2245
+ );
2246
+ };
2247
+ SearchSkeletonView.displayName = "SearchSkeletonView";
2248
+
2249
+ // src/primitives/skeleton/views/settlement-skeleton-view.tsx
2250
+ var import_hooks9 = require("@agg-market/hooks");
2251
+ var import_jsx_runtime60 = require("react/jsx-runtime");
2197
2252
  var SettlementSkeletonView = ({
2198
2253
  className,
2199
2254
  ariaLabel
2200
2255
  }) => {
2201
- const labels = (0, import_hooks8.useLabels)();
2202
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
2256
+ const labels = (0, import_hooks9.useLabels)();
2257
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
2203
2258
  Card,
2204
2259
  {
2205
2260
  className: cn(
@@ -2211,26 +2266,26 @@ var SettlementSkeletonView = ({
2211
2266
  "aria-label": ariaLabel != null ? ariaLabel : labels.trading.settlementLoading,
2212
2267
  "aria-busy": true,
2213
2268
  children: [
2214
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
2215
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-4 w-[81px] rounded-agg-sm" }),
2216
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-[240px] rounded-agg-sm" })
2269
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
2270
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-4 w-[81px] rounded-agg-sm" }),
2271
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-5 w-full max-w-[240px] rounded-agg-sm" })
2217
2272
  ] }),
2218
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
2219
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
2220
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-col gap-2", children: [
2221
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[320px] rounded-agg-sm" }),
2222
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[280px] rounded-agg-sm" })
2273
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
2274
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-5 w-[200px] rounded-agg-sm" }),
2275
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-col gap-2", children: [
2276
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[320px] rounded-agg-sm" }),
2277
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-4 w-full max-w-[280px] rounded-agg-sm" })
2223
2278
  ] })
2224
2279
  ] }),
2225
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
2226
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
2227
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center gap-2", children: [
2228
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
2229
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-5 w-[100px] rounded-agg-sm" })
2280
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
2281
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex w-full flex-col gap-3", children: [
2282
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-2", children: [
2283
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
2284
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-5 w-[100px] rounded-agg-sm" })
2230
2285
  ] }),
2231
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center gap-2", children: [
2232
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
2233
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SkeletonBlock, { className: "h-5 w-[60px] rounded-agg-sm" })
2286
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-2", children: [
2287
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" }),
2288
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SkeletonBlock, { className: "h-5 w-[60px] rounded-agg-sm" })
2234
2289
  ] })
2235
2290
  ] })
2236
2291
  ]
@@ -2247,36 +2302,40 @@ var skeletonViews = {
2247
2302
  marketDetailsDetailed: "market-details-detailed",
2248
2303
  eventList: "event-list",
2249
2304
  settlement: "settlement",
2250
- placeOrder: "place-order"
2305
+ placeOrder: "place-order",
2306
+ search: "search"
2251
2307
  };
2252
2308
 
2253
2309
  // src/primitives/skeleton/index.tsx
2254
- var import_jsx_runtime60 = require("react/jsx-runtime");
2310
+ var import_jsx_runtime61 = require("react/jsx-runtime");
2255
2311
  var Skeleton = ({ view, className, ariaLabel }) => {
2256
2312
  if (view === skeletonViews.eventListItem) {
2257
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EventListItemSkeletonView, { className, ariaLabel, isStandalone: true });
2313
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventListItemSkeletonView, { className, ariaLabel, isStandalone: true });
2258
2314
  }
2259
2315
  if (view === skeletonViews.eventListItemDetails) {
2260
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EventListItemDetailsSkeletonView, { className, ariaLabel });
2316
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventListItemDetailsSkeletonView, { className, ariaLabel });
2261
2317
  }
2262
2318
  if (view === skeletonViews.marketDetailsMinified) {
2263
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MarketDetailsSkeletonView, { className, ariaLabel, isDetailed: false });
2319
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(MarketDetailsSkeletonView, { className, ariaLabel, isDetailed: false });
2264
2320
  }
2265
2321
  if (view === skeletonViews.marketDetailsDetailed) {
2266
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(MarketDetailsSkeletonView, { className, ariaLabel, isDetailed: true });
2322
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(MarketDetailsSkeletonView, { className, ariaLabel, isDetailed: true });
2267
2323
  }
2268
2324
  if (view === skeletonViews.settlement) {
2269
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SettlementSkeletonView, { className, ariaLabel });
2325
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SettlementSkeletonView, { className, ariaLabel });
2270
2326
  }
2271
2327
  if (view === skeletonViews.placeOrder) {
2272
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(PlaceOrderSkeletonView, { className, ariaLabel });
2328
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(PlaceOrderSkeletonView, { className, ariaLabel });
2329
+ }
2330
+ if (view === skeletonViews.search) {
2331
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SearchSkeletonView, { className, ariaLabel });
2273
2332
  }
2274
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EventListSkeletonView, { className, ariaLabel });
2333
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventListSkeletonView, { className, ariaLabel });
2275
2334
  };
2276
2335
  Skeleton.displayName = "Skeleton";
2277
2336
 
2278
2337
  // src/primitives/button/index.tsx
2279
- var import_hooks9 = require("@agg-market/hooks");
2338
+ var import_hooks10 = require("@agg-market/hooks");
2280
2339
 
2281
2340
  // src/primitives/button/button.constants.ts
2282
2341
  var sizeClasses = {
@@ -2323,7 +2382,7 @@ var baseButtonClasses = cn(
2323
2382
  );
2324
2383
 
2325
2384
  // src/primitives/button/index.tsx
2326
- var import_jsx_runtime61 = require("react/jsx-runtime");
2385
+ var import_jsx_runtime62 = require("react/jsx-runtime");
2327
2386
  var Button = (_a) => {
2328
2387
  var _b = _a, {
2329
2388
  children,
@@ -2348,9 +2407,11 @@ var Button = (_a) => {
2348
2407
  "className",
2349
2408
  "aria-label"
2350
2409
  ]);
2351
- const { enableAnimations } = (0, import_hooks9.useSdkUiConfig)();
2410
+ const {
2411
+ features: { enableAnimations }
2412
+ } = (0, import_hooks10.useSdkUiConfig)();
2352
2413
  const isDisabled = disabled || isLoading;
2353
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
2414
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2354
2415
  "button",
2355
2416
  __spreadProps(__spreadValues({
2356
2417
  type,
@@ -2367,7 +2428,7 @@ var Button = (_a) => {
2367
2428
  "aria-busy": isLoading,
2368
2429
  "aria-label": ariaLabel
2369
2430
  }, other), {
2370
- children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
2431
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2371
2432
  "span",
2372
2433
  {
2373
2434
  className: cn(
@@ -2377,9 +2438,9 @@ var Button = (_a) => {
2377
2438
  ),
2378
2439
  "aria-hidden": "true"
2379
2440
  }
2380
- ) : /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
2441
+ ) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
2381
2442
  prefix != null ? prefix : null,
2382
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { children }),
2443
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children }),
2383
2444
  suffix != null ? suffix : null
2384
2445
  ] })
2385
2446
  })
@@ -2388,10 +2449,10 @@ var Button = (_a) => {
2388
2449
  Button.displayName = "Button";
2389
2450
 
2390
2451
  // src/primitives/search/search-empty-icon.tsx
2391
- var import_jsx_runtime62 = require("react/jsx-runtime");
2452
+ var import_jsx_runtime63 = require("react/jsx-runtime");
2392
2453
  var SearchEmptyIcon = (_a) => {
2393
2454
  var _b = _a, { title, className } = _b, props = __objRest(_b, ["title", "className"]);
2394
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
2455
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
2395
2456
  "svg",
2396
2457
  __spreadProps(__spreadValues(__spreadValues({
2397
2458
  viewBox: "0 0 40 40",
@@ -2400,9 +2461,9 @@ var SearchEmptyIcon = (_a) => {
2400
2461
  className
2401
2462
  }, getIconA11yProps(title)), props), {
2402
2463
  children: [
2403
- title ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("title", { children: title }) : null,
2404
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("circle", { cx: "19.9987", cy: "20.0013", r: "9.2", stroke: "currentColor", strokeWidth: "1.6" }),
2405
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2464
+ title ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("title", { children: title }) : null,
2465
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("circle", { cx: "19.9987", cy: "20.0013", r: "9.2", stroke: "currentColor", strokeWidth: "1.6" }),
2466
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
2406
2467
  "ellipse",
2407
2468
  {
2408
2469
  cx: "19.9987",
@@ -2440,14 +2501,14 @@ var typographyVariantClasses = {
2440
2501
  };
2441
2502
 
2442
2503
  // src/primitives/typography/index.tsx
2443
- var import_jsx_runtime63 = require("react/jsx-runtime");
2504
+ var import_jsx_runtime64 = require("react/jsx-runtime");
2444
2505
  var Typography = ({
2445
2506
  as: Component = "p",
2446
2507
  variant = "body",
2447
2508
  className,
2448
2509
  children
2449
2510
  }) => {
2450
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
2511
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
2451
2512
  Component,
2452
2513
  {
2453
2514
  className: cn(
@@ -2463,7 +2524,7 @@ var Typography = ({
2463
2524
  Typography.displayName = "Typography";
2464
2525
 
2465
2526
  // src/primitives/state-message/index.tsx
2466
- var import_jsx_runtime64 = require("react/jsx-runtime");
2527
+ var import_jsx_runtime65 = require("react/jsx-runtime");
2467
2528
  var iconClassName = "h-9 w-9 text-agg-muted-foreground";
2468
2529
  var StateMessage = ({
2469
2530
  ariaLabel,
@@ -2474,8 +2535,8 @@ var StateMessage = ({
2474
2535
  onAction,
2475
2536
  className
2476
2537
  }) => {
2477
- const icon = tone === "warning" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(WarningIcon, { className: iconClassName, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SearchEmptyIcon, { className: iconClassName, "aria-hidden": true });
2478
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
2538
+ const icon = tone === "warning" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(WarningIcon, { className: iconClassName, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SearchEmptyIcon, { className: iconClassName, "aria-hidden": true });
2539
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
2479
2540
  "div",
2480
2541
  {
2481
2542
  className: cn(
@@ -2485,20 +2546,24 @@ var StateMessage = ({
2485
2546
  role: "status",
2486
2547
  "aria-live": "polite",
2487
2548
  "aria-label": ariaLabel,
2488
- children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex max-w-[360px] flex-col items-center gap-6", children: [
2549
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col items-center gap-6", children: [
2489
2550
  icon,
2490
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
2491
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Typography, { variant: "body-large-strong", children: title }),
2492
- description ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Typography, { variant: "body", className: "whitespace-pre-line text-agg-muted-foreground", children: description }) : null
2551
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
2552
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Typography, { variant: "body-large-strong", children: title }),
2553
+ description ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Typography, { variant: "body", className: "whitespace-pre-line text-agg-muted-foreground", children: description }) : null
2493
2554
  ] }),
2494
- actionLabel && onAction ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
2555
+ actionLabel && onAction ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
2495
2556
  Button,
2496
2557
  {
2497
2558
  variant: "tertiary",
2498
2559
  size: "large",
2499
2560
  className: "text-agg-base leading-agg-6",
2500
2561
  "aria-label": actionLabel,
2501
- onClick: onAction,
2562
+ onClick: (e) => {
2563
+ e.stopPropagation();
2564
+ e.preventDefault();
2565
+ onAction == null ? void 0 : onAction();
2566
+ },
2502
2567
  children: actionLabel
2503
2568
  }
2504
2569
  ) : null
@@ -2509,7 +2574,7 @@ var StateMessage = ({
2509
2574
  StateMessage.displayName = "StateMessage";
2510
2575
 
2511
2576
  // src/primitives/venue-logo/index.tsx
2512
- var import_hooks10 = require("@agg-market/hooks");
2577
+ var import_hooks11 = require("@agg-market/hooks");
2513
2578
 
2514
2579
  // src/primitives/remote-image/index.tsx
2515
2580
  var import_react = require("react");
@@ -2521,7 +2586,7 @@ var skeletonClasses = "h-full w-full rounded-agg-lg";
2521
2586
  var placeholderClasses = "flex h-full w-full items-center justify-center bg-agg-secondary-hover rounded-agg-lg";
2522
2587
 
2523
2588
  // src/primitives/remote-image/index.tsx
2524
- var import_jsx_runtime65 = require("react/jsx-runtime");
2589
+ var import_jsx_runtime66 = require("react/jsx-runtime");
2525
2590
  var isValidSrc = (src) => typeof src === "string" && src.length > 0;
2526
2591
  var RemoteImage = ({
2527
2592
  src,
@@ -2552,7 +2617,7 @@ var RemoteImage = ({
2552
2617
  setStatus("error");
2553
2618
  };
2554
2619
  const sizeStyle = width !== void 0 || height !== void 0 ? { width: width != null ? width : void 0, height: height != null ? height : void 0 } : void 0;
2555
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
2620
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
2556
2621
  "div",
2557
2622
  {
2558
2623
  className: cn(containerClasses, classNames == null ? void 0 : classNames.root, className),
@@ -2569,17 +2634,17 @@ var RemoteImage = ({
2569
2634
  "aria-label": ariaLabel,
2570
2635
  title,
2571
2636
  children: [
2572
- status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SkeletonBlock, { className: cn(skeletonClasses, classNames == null ? void 0 : classNames.placeholder) }),
2573
- status === "error" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
2637
+ status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SkeletonBlock, { className: cn(skeletonClasses, classNames == null ? void 0 : classNames.placeholder) }),
2638
+ status === "error" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
2574
2639
  "div",
2575
2640
  {
2576
2641
  className: cn(placeholderClasses, classNames == null ? void 0 : classNames.placeholder),
2577
2642
  "aria-hidden": true,
2578
2643
  "aria-errormessage": "Image failed to load",
2579
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon, { name: "image", size: "medium", className: "text-agg-muted-foreground" })
2644
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Icon, { name: "image", size: "medium", className: "text-agg-muted-foreground" })
2580
2645
  }
2581
2646
  ),
2582
- isValidSrc(src) && status !== "error" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
2647
+ isValidSrc(src) && status !== "error" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
2583
2648
  "img",
2584
2649
  {
2585
2650
  src,
@@ -2612,7 +2677,7 @@ var resolveLogoPrimaryColor = ({
2612
2677
  };
2613
2678
 
2614
2679
  // src/primitives/venue-logo/svg/logo-kalshi.tsx
2615
- var import_jsx_runtime66 = require("react/jsx-runtime");
2680
+ var import_jsx_runtime67 = require("react/jsx-runtime");
2616
2681
  var KALSHI_GREEN = "#18C590";
2617
2682
  var LogoKalshiIcon = (_a) => {
2618
2683
  var _b = _a, {
@@ -2631,7 +2696,7 @@ var LogoKalshiIcon = (_a) => {
2631
2696
  isColor,
2632
2697
  color
2633
2698
  });
2634
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
2699
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
2635
2700
  "svg",
2636
2701
  __spreadProps(__spreadValues(__spreadValues({
2637
2702
  viewBox: "0 0 100 100",
@@ -2639,8 +2704,8 @@ var LogoKalshiIcon = (_a) => {
2639
2704
  fill: "none"
2640
2705
  }, getIconA11yProps(title)), props), {
2641
2706
  children: [
2642
- title ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("title", { children: title }) : null,
2643
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
2707
+ title ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("title", { children: title }) : null,
2708
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2644
2709
  "path",
2645
2710
  {
2646
2711
  d: "M54.9798 47.579L79.4249 85.9995H58.2273L38.2531 52.9344V85.9995H20.4189V13.9995H38.2531V45.4356L59.6547 13.9995H78.7119L54.9798 47.579Z",
@@ -2654,7 +2719,7 @@ var LogoKalshiIcon = (_a) => {
2654
2719
  LogoKalshiIcon.displayName = "LogoKalshiIcon";
2655
2720
 
2656
2721
  // src/primitives/venue-logo/svg/logo-limitless.tsx
2657
- var import_jsx_runtime67 = require("react/jsx-runtime");
2722
+ var import_jsx_runtime68 = require("react/jsx-runtime");
2658
2723
  var LIMITLESS_BLACK = "#000000";
2659
2724
  var LogoLimitlessIcon = (_a) => {
2660
2725
  var _b = _a, {
@@ -2673,7 +2738,7 @@ var LogoLimitlessIcon = (_a) => {
2673
2738
  isColor,
2674
2739
  color
2675
2740
  });
2676
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
2741
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
2677
2742
  "svg",
2678
2743
  __spreadProps(__spreadValues(__spreadValues({
2679
2744
  viewBox: "0 0 44 32",
@@ -2681,8 +2746,8 @@ var LogoLimitlessIcon = (_a) => {
2681
2746
  fill: "none"
2682
2747
  }, getIconA11yProps(title)), props), {
2683
2748
  children: [
2684
- title ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("title", { children: title }) : null,
2685
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2749
+ title ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("title", { children: title }) : null,
2750
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2686
2751
  "path",
2687
2752
  {
2688
2753
  fill: primaryColor,
@@ -2691,7 +2756,7 @@ var LogoLimitlessIcon = (_a) => {
2691
2756
  clipRule: "evenodd"
2692
2757
  }
2693
2758
  ),
2694
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2759
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2695
2760
  "path",
2696
2761
  {
2697
2762
  fill: primaryColor,
@@ -2700,7 +2765,7 @@ var LogoLimitlessIcon = (_a) => {
2700
2765
  clipRule: "evenodd"
2701
2766
  }
2702
2767
  ),
2703
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2768
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2704
2769
  "path",
2705
2770
  {
2706
2771
  fill: primaryColor,
@@ -2709,7 +2774,7 @@ var LogoLimitlessIcon = (_a) => {
2709
2774
  clipRule: "evenodd"
2710
2775
  }
2711
2776
  ),
2712
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2777
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2713
2778
  "path",
2714
2779
  {
2715
2780
  fill: primaryColor,
@@ -2718,7 +2783,7 @@ var LogoLimitlessIcon = (_a) => {
2718
2783
  clipRule: "evenodd"
2719
2784
  }
2720
2785
  ),
2721
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
2786
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2722
2787
  "path",
2723
2788
  {
2724
2789
  fill: primaryColor,
@@ -2734,7 +2799,7 @@ var LogoLimitlessIcon = (_a) => {
2734
2799
  LogoLimitlessIcon.displayName = "LogoLimitlessIcon";
2735
2800
 
2736
2801
  // src/primitives/venue-logo/svg/logo-opinion.tsx
2737
- var import_jsx_runtime68 = require("react/jsx-runtime");
2802
+ var import_jsx_runtime69 = require("react/jsx-runtime");
2738
2803
  var OPINION_BLACK = "#000000";
2739
2804
  var LogoOpinionIcon = (_a) => {
2740
2805
  var _b = _a, {
@@ -2753,7 +2818,7 @@ var LogoOpinionIcon = (_a) => {
2753
2818
  isColor,
2754
2819
  color
2755
2820
  });
2756
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
2821
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
2757
2822
  "svg",
2758
2823
  __spreadProps(__spreadValues(__spreadValues({
2759
2824
  viewBox: "0 0 100 100",
@@ -2761,8 +2826,8 @@ var LogoOpinionIcon = (_a) => {
2761
2826
  fill: "none"
2762
2827
  }, getIconA11yProps(title)), props), {
2763
2828
  children: [
2764
- title ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("title", { children: title }) : null,
2765
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
2829
+ title ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("title", { children: title }) : null,
2830
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
2766
2831
  "path",
2767
2832
  {
2768
2833
  d: "M51.8239 68.4603L56.9659 68.0094L58.8049 89.0576C61.1459 88.5314 63.4349 87.7952 65.6437 86.8578V68.1879H71.9955V83.4385C74.6496 81.6828 77.0863 79.619 79.2548 77.2898L80.0716 67.958L85.516 68.433C88.6185 62.4381 90.156 55.7558 89.9858 49.0072C89.8154 42.2584 87.9429 35.6623 84.542 29.8316L84.3394 32.1494L77.9876 31.5927L78.8042 22.2668C76.7468 20.1288 74.4594 18.225 71.9835 16.5902V31.9164H65.6317V13.1739C62.9224 12.0205 60.0929 11.173 57.1957 10.6473L59.0317 31.6441L53.8897 32.0949L51.9599 10.0482C51.3128 10.0179 50.6593 9.99976 50.006 9.99976C47.4581 9.99976 44.9161 10.2419 42.414 10.723L46.0438 31.3899L42.1297 32.0798L38.5304 11.6701C35.1755 12.6725 31.9677 14.1143 28.9905 15.9578L33.0435 31.0873L29.9705 31.9134L26.2018 17.8369C23.2938 19.9923 20.6902 22.5308 18.4615 25.3835L20.4246 30.7787L18.1833 31.5956L16.7707 27.7134C14.5111 31.0771 12.7772 34.7657 11.6287 38.652L12.2639 38.4221L20.4306 60.8471L18.1893 61.6641L10.8877 41.5963C9.21542 49.4012 9.91256 57.528 12.8896 64.9338C15.8667 72.3395 20.9879 78.6865 27.5961 83.1601L23.8031 68.9989L26.8762 68.1728L31.5162 85.4991C34.6952 87.1593 38.0844 88.3808 41.5914 89.1303L38.0132 68.7296L41.9301 68.0397L45.7684 89.8262C47.1811 89.9757 48.6007 90.0505 50.0212 90.0502C51.2583 90.0502 52.4863 89.9926 53.6963 89.8807L51.8239 68.4603ZM80.1017 37.8985L86.4385 38.4524L84.3605 62.2299L78.0087 61.6761L80.1017 37.8985ZM65.6528 38.1315H72.0046V61.9969H65.6528V38.1315ZM56.975 37.9501L59.053 61.7277L53.911 62.1785L51.8299 38.4009L56.975 37.9501ZM29.9976 62.003L23.8243 38.9486L26.8974 38.1255L33.0707 61.1649L29.9976 62.003ZM42.157 62.1603L38.0132 38.658L41.9301 37.9683L46.0709 61.4674L42.157 62.1603Z",
@@ -2776,7 +2841,7 @@ var LogoOpinionIcon = (_a) => {
2776
2841
  LogoOpinionIcon.displayName = "LogoOpinionIcon";
2777
2842
 
2778
2843
  // src/primitives/venue-logo/svg/logo-polymarket.tsx
2779
- var import_jsx_runtime69 = require("react/jsx-runtime");
2844
+ var import_jsx_runtime70 = require("react/jsx-runtime");
2780
2845
  var POLYMARKET_BLUE = "#2E5CFF";
2781
2846
  var LogoPolymarketIcon = (_a) => {
2782
2847
  var _b = _a, {
@@ -2795,7 +2860,7 @@ var LogoPolymarketIcon = (_a) => {
2795
2860
  isColor,
2796
2861
  color
2797
2862
  });
2798
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
2863
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
2799
2864
  "svg",
2800
2865
  __spreadProps(__spreadValues(__spreadValues({
2801
2866
  viewBox: "0 0 100 100",
@@ -2803,8 +2868,8 @@ var LogoPolymarketIcon = (_a) => {
2803
2868
  fill: "none"
2804
2869
  }, getIconA11yProps(title)), props), {
2805
2870
  children: [
2806
- title ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("title", { children: title }) : null,
2807
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
2871
+ title ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("title", { children: title }) : null,
2872
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
2808
2873
  "path",
2809
2874
  {
2810
2875
  d: "M81.0904 84.2882C81.0904 87.9246 81.0904 89.7428 79.901 90.644C78.7119 91.5456 76.9613 91.0542 73.4603 90.0717L17.1975 74.2838C15.0881 73.6919 14.0332 73.3959 13.4233 72.5913C12.8135 71.7866 12.8135 70.6911 12.8135 68.5002V31.4998C12.8135 29.309 12.8135 28.2134 13.4233 27.4088C14.0332 26.6042 15.0881 26.3081 17.1975 25.7163L73.4603 9.92806C76.9613 8.94572 78.7119 8.45448 79.901 9.35587C81.0904 10.2573 81.0904 12.0755 81.0904 15.7119V84.2882ZM26.8451 69.1363L73.4308 82.2104V56.0637L26.8451 69.1363ZM20.4723 63.0711L67.0487 50L20.4723 36.929V63.0711ZM26.8446 30.8638L73.4308 43.9366V17.7896L26.8446 30.8638Z",
@@ -2818,7 +2883,7 @@ var LogoPolymarketIcon = (_a) => {
2818
2883
  LogoPolymarketIcon.displayName = "LogoPolymarketIcon";
2819
2884
 
2820
2885
  // src/primitives/venue-logo/svg/logo-probable.tsx
2821
- var import_jsx_runtime70 = require("react/jsx-runtime");
2886
+ var import_jsx_runtime71 = require("react/jsx-runtime");
2822
2887
  var PROBABLE_ORANGE = "#F05923";
2823
2888
  var LogoProbableIcon = (_a) => {
2824
2889
  var _b = _a, {
@@ -2837,7 +2902,7 @@ var LogoProbableIcon = (_a) => {
2837
2902
  isColor,
2838
2903
  color
2839
2904
  });
2840
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
2905
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
2841
2906
  "svg",
2842
2907
  __spreadProps(__spreadValues(__spreadValues({
2843
2908
  viewBox: "0 0 100 100",
@@ -2845,16 +2910,16 @@ var LogoProbableIcon = (_a) => {
2845
2910
  fill: "none"
2846
2911
  }, getIconA11yProps(title)), props), {
2847
2912
  children: [
2848
- title ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("title", { children: title }) : null,
2849
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
2913
+ title ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("title", { children: title }) : null,
2914
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
2850
2915
  "path",
2851
2916
  {
2852
2917
  d: "M75.625 59.3489C75.6247 53.7323 71.0719 49.1792 65.4551 49.179H33.9209C28.3039 49.179 23.7503 53.7321 23.75 59.3489C23.75 64.9659 28.3038 69.5198 33.9209 69.5198H65.4551C71.0719 69.5195 75.625 64.9658 75.625 59.3489ZM90.625 59.3489C90.625 73.2501 79.3562 84.5195 65.4551 84.5198H33.9209C20.0196 84.5198 8.75 73.2502 8.75 59.3489C8.75026 45.4477 20.0198 34.179 33.9209 34.179H65.4551C79.3559 34.1792 90.6247 45.4478 90.625 59.3489Z",
2853
2918
  fill: primaryColor
2854
2919
  }
2855
2920
  ),
2856
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { d: "M90.9329 15.4546V30.4546H8.90234V15.4546H90.9329Z", fill: primaryColor }),
2857
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
2921
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M90.9329 15.4546V30.4546H8.90234V15.4546H90.9329Z", fill: primaryColor }),
2922
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
2858
2923
  "path",
2859
2924
  {
2860
2925
  d: "M64.5742 51.3496C68.9894 51.3496 72.5742 54.9344 72.5742 59.3496C72.5742 63.7648 68.9894 67.3496 64.5742 67.3496C60.159 67.3496 56.5742 63.7648 56.5742 59.3496C56.5742 54.9344 60.159 51.3496 64.5742 51.3496Z",
@@ -2898,7 +2963,7 @@ var sizeClasses2 = {
2898
2963
  };
2899
2964
 
2900
2965
  // src/primitives/venue-logo/index.tsx
2901
- var import_jsx_runtime71 = require("react/jsx-runtime");
2966
+ var import_jsx_runtime72 = require("react/jsx-runtime");
2902
2967
  var VenueLogo = ({
2903
2968
  venue,
2904
2969
  variant = "icon",
@@ -2911,11 +2976,16 @@ var VenueLogo = ({
2911
2976
  title
2912
2977
  }) => {
2913
2978
  var _a;
2914
- const labels = (0, import_hooks10.useLabels)();
2979
+ const {
2980
+ features: { showVenueLogo }
2981
+ } = (0, import_hooks11.useAggUiConfig)();
2982
+ const labels = (0, import_hooks11.useLabels)();
2915
2983
  const sizeClass = sizeClasses2[size];
2916
2984
  const resolvedLabel = (_a = ariaLabel != null ? ariaLabel : labels.venues[venue]) != null ? _a : venueLogoLabels[venue];
2985
+ if (!showVenueLogo)
2986
+ return null;
2917
2987
  if (variant === "logo") {
2918
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
2988
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2919
2989
  RemoteImage,
2920
2990
  {
2921
2991
  src: venueLogoUrlRegistry[venue],
@@ -2927,7 +2997,7 @@ var VenueLogo = ({
2927
2997
  }
2928
2998
  const Component = venueLogoRegistry[venue];
2929
2999
  const resolvedIsColor = isMonochromatic ? false : isColor;
2930
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3000
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
2931
3001
  Component,
2932
3002
  {
2933
3003
  className: cn("group/agg-venue-logo", "shrink-0", sizeClass, className),
@@ -2953,8 +3023,8 @@ var isErrorWithStatus = (error, status) => {
2953
3023
 
2954
3024
  // src/primitives/switch-button/index.tsx
2955
3025
  var import_react2 = require("react");
2956
- var import_hooks11 = require("@agg-market/hooks");
2957
- var import_jsx_runtime72 = require("react/jsx-runtime");
3026
+ var import_hooks12 = require("@agg-market/hooks");
3027
+ var import_jsx_runtime73 = require("react/jsx-runtime");
2958
3028
  var resolveActiveIndex = (options, value) => {
2959
3029
  const activeIndex = options.findIndex((option) => option.value === value);
2960
3030
  if (activeIndex >= 0)
@@ -2981,7 +3051,9 @@ var SwitchButton = ({
2981
3051
  ariaLabel,
2982
3052
  className
2983
3053
  }) => {
2984
- const { enableAnimations } = (0, import_hooks11.useSdkUiConfig)();
3054
+ const {
3055
+ features: { enableAnimations }
3056
+ } = (0, import_hooks12.useSdkUiConfig)();
2985
3057
  const activeIndex = (0, import_react2.useMemo)(() => {
2986
3058
  return resolveActiveIndex(options, value);
2987
3059
  }, [options, value]);
@@ -3023,17 +3095,17 @@ var SwitchButton = ({
3023
3095
  }
3024
3096
  onValueChange(nextOption.value);
3025
3097
  };
3026
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
3098
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3027
3099
  "div",
3028
3100
  {
3029
3101
  className: cn(
3030
- "group/agg-switch",
3102
+ "group/agg-switch min-w-fit",
3031
3103
  "inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
3032
3104
  getMotionClassName(enableAnimations, "transition-background duration-200 ease-in-out"),
3033
3105
  "cursor-pointer hover:bg-agg-tertiary",
3034
3106
  className
3035
3107
  ),
3036
- children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
3108
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
3037
3109
  "div",
3038
3110
  {
3039
3111
  className: "relative grid min-w-0 flex-1 items-center",
@@ -3043,7 +3115,7 @@ var SwitchButton = ({
3043
3115
  role: "tablist",
3044
3116
  "aria-label": ariaLabel,
3045
3117
  children: [
3046
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
3118
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3047
3119
  "span",
3048
3120
  {
3049
3121
  className: cn(
@@ -3063,7 +3135,7 @@ var SwitchButton = ({
3063
3135
  options.map((option, optionIndex) => {
3064
3136
  var _a;
3065
3137
  const isActive = optionIndex === activeIndex;
3066
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
3138
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3067
3139
  "button",
3068
3140
  {
3069
3141
  type: "button",
@@ -3073,6 +3145,7 @@ var SwitchButton = ({
3073
3145
  tabIndex: isActive ? 0 : -1,
3074
3146
  disabled: option.disabled,
3075
3147
  className: cn(
3148
+ "whitespace-nowrap",
3076
3149
  "relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground",
3077
3150
  getMotionClassName(
3078
3151
  enableAnimations,
@@ -3107,10 +3180,10 @@ SwitchButton.displayName = "SwitchButton";
3107
3180
 
3108
3181
  // src/primitives/chart/index.tsx
3109
3182
  var import_dayjs = __toESM(require("dayjs"));
3110
- var import_hooks12 = require("@agg-market/hooks");
3183
+ var import_hooks13 = require("@agg-market/hooks");
3111
3184
  var import_react3 = require("react");
3112
3185
  var import_liveline = require("liveline");
3113
- var import_jsx_runtime73 = require("react/jsx-runtime");
3186
+ var import_jsx_runtime74 = require("react/jsx-runtime");
3114
3187
  var normalizeSeries = (series) => {
3115
3188
  return series.map((seriesItem) => {
3116
3189
  const pointsByTime = /* @__PURE__ */ new Map();
@@ -3235,7 +3308,7 @@ var renderDefaultSeriesControls = ({
3235
3308
  seriesSwitchAriaLabel,
3236
3309
  formatSeriesOptionAriaLabel
3237
3310
  }) => {
3238
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3311
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3239
3312
  SwitchButton,
3240
3313
  {
3241
3314
  ariaLabel: seriesSwitchAriaLabel,
@@ -3269,11 +3342,15 @@ var LineChart = ({
3269
3342
  liveCandle: liveForming,
3270
3343
  lineData,
3271
3344
  lineValue,
3272
- live = false
3345
+ live
3273
3346
  }) => {
3274
3347
  var _a, _b;
3275
- const labels = (0, import_hooks12.useLabels)();
3276
- const { theme } = (0, import_hooks12.useSdkUiConfig)();
3348
+ const labels = (0, import_hooks13.useLabels)();
3349
+ const {
3350
+ general: { theme },
3351
+ features: { enableGradients, enableLiveUpdates }
3352
+ } = (0, import_hooks13.useSdkUiConfig)();
3353
+ const isLive = enableLiveUpdates && (live != null ? live : true);
3277
3354
  const normalizedSeries = (0, import_react3.useMemo)(() => {
3278
3355
  return normalizeSeries(series);
3279
3356
  }, [series]);
@@ -3296,7 +3373,19 @@ var LineChart = ({
3296
3373
  if (!primarySeries) {
3297
3374
  return [];
3298
3375
  }
3299
- return toLivelinePoints(primarySeries.points);
3376
+ const points = toLivelinePoints(primarySeries.points);
3377
+ if (points.length < 3) {
3378
+ return [
3379
+ ...points,
3380
+ ...points.map((point) => __spreadProps(__spreadValues({}, point), {
3381
+ time: point.time + 1500
3382
+ })),
3383
+ ...points.map((point) => __spreadProps(__spreadValues({}, point), {
3384
+ time: point.time + 3e3
3385
+ }))
3386
+ ];
3387
+ }
3388
+ return points;
3300
3389
  }, [primarySeries]);
3301
3390
  const primaryCandles = (0, import_react3.useMemo)(() => {
3302
3391
  if (!primarySeries) {
@@ -3330,7 +3419,7 @@ var LineChart = ({
3330
3419
  const timeFormatter = (0, import_react3.useMemo)(() => {
3331
3420
  return resolveTimeFormatter(windowSeconds);
3332
3421
  }, [windowSeconds]);
3333
- const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
3422
+ const seriesControls = showSeriesControls ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
3334
3423
  series: normalizedSeries,
3335
3424
  activeSeriesId,
3336
3425
  handleSeriesChange
@@ -3342,9 +3431,9 @@ var LineChart = ({
3342
3431
  seriesSwitchAriaLabel: labels.common.lineChartSeriesSwitchAria,
3343
3432
  formatSeriesOptionAriaLabel: labels.common.lineChartSeriesOptionAria
3344
3433
  }) : null : null;
3345
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: cn("group/agg-chart", "w-full", classNames == null ? void 0 : classNames.root), style: { width }, children: [
3346
- !isLoading && seriesControls ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: cn("mb-3", classNames == null ? void 0 : classNames.controls), children: seriesControls }) : null,
3347
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3434
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: cn("group/agg-chart", "w-full", classNames == null ? void 0 : classNames.root), style: { width }, children: [
3435
+ !isLoading && seriesControls ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: cn("mb-3", classNames == null ? void 0 : classNames.controls), children: seriesControls }) : null,
3436
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3348
3437
  "div",
3349
3438
  {
3350
3439
  className: cn(
@@ -3354,7 +3443,7 @@ var LineChart = ({
3354
3443
  style: { height },
3355
3444
  role: "img",
3356
3445
  "aria-label": chartType === "candlestick" ? labels.common.candlestickChartAria : labels.common.lineChartAria,
3357
- children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3446
+ children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3358
3447
  import_liveline.Liveline,
3359
3448
  {
3360
3449
  className: cn("h-full w-full agg-livechart", classNames == null ? void 0 : classNames.liveline),
@@ -3363,9 +3452,10 @@ var LineChart = ({
3363
3452
  series: livelineSeries,
3364
3453
  color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
3365
3454
  theme: livelineTheme,
3455
+ fill: enableGradients,
3366
3456
  grid: true,
3367
- momentum: live,
3368
- pulse: live,
3457
+ momentum: isLive,
3458
+ pulse: isLive,
3369
3459
  window: windowSeconds,
3370
3460
  mode: chartType === "candlestick" ? "candle" : "line",
3371
3461
  candles: chartType === "candlestick" ? primaryCandles : void 0,
@@ -3377,11 +3467,12 @@ var LineChart = ({
3377
3467
  formatTime: timeFormatter,
3378
3468
  padding: {
3379
3469
  top: 12,
3380
- right: 80,
3470
+ right: 28,
3381
3471
  bottom: 28,
3382
3472
  left: 12
3383
3473
  },
3384
- loading: isLoading
3474
+ loading: isLoading,
3475
+ lineWidth: 1
3385
3476
  }
3386
3477
  )
3387
3478
  }
@@ -3392,8 +3483,8 @@ LineChart.displayName = "LineChart";
3392
3483
 
3393
3484
  // src/primitives/select/index.tsx
3394
3485
  var import_react4 = require("react");
3395
- var import_hooks13 = require("@agg-market/hooks");
3396
- var import_jsx_runtime74 = require("react/jsx-runtime");
3486
+ var import_hooks14 = require("@agg-market/hooks");
3487
+ var import_jsx_runtime75 = require("react/jsx-runtime");
3397
3488
  var Select = ({
3398
3489
  items,
3399
3490
  value,
@@ -3403,8 +3494,10 @@ var Select = ({
3403
3494
  disabled = false
3404
3495
  }) => {
3405
3496
  var _a;
3406
- const labels = (0, import_hooks13.useLabels)();
3407
- const { enableAnimations } = (0, import_hooks13.useSdkUiConfig)();
3497
+ const labels = (0, import_hooks14.useLabels)();
3498
+ const {
3499
+ features: { enableAnimations }
3500
+ } = (0, import_hooks14.useSdkUiConfig)();
3408
3501
  const hasEnabledItems = items.some((item) => !item.disabled);
3409
3502
  const hasAnyIcon = items.some((item) => item.iconUrl);
3410
3503
  const [isOpen, setIsOpen] = (0, import_react4.useState)(false);
@@ -3434,8 +3527,8 @@ var Select = ({
3434
3527
  const isDisabled = disabled || !hasEnabledItems;
3435
3528
  const selectedItem = items.find((item) => item.value === value);
3436
3529
  if (!hasAnyIcon) {
3437
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("label", { className: cn("group/agg-select", "relative inline-flex w-full", className), children: [
3438
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3530
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("label", { className: cn("group/agg-select", "relative inline-flex w-full", className), children: [
3531
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
3439
3532
  "select",
3440
3533
  {
3441
3534
  "aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
@@ -3451,19 +3544,19 @@ var Select = ({
3451
3544
  disabled: isDisabled,
3452
3545
  value,
3453
3546
  onChange: (event) => onChange(event.target.value),
3454
- children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))
3547
+ children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))
3455
3548
  }
3456
3549
  ),
3457
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) })
3550
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) })
3458
3551
  ] });
3459
3552
  }
3460
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
3553
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
3461
3554
  "div",
3462
3555
  {
3463
3556
  ref: containerRef,
3464
3557
  className: cn("group/agg-select", "relative inline-flex w-full", className),
3465
3558
  children: [
3466
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
3559
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
3467
3560
  "button",
3468
3561
  {
3469
3562
  type: "button",
@@ -3483,7 +3576,7 @@ var Select = ({
3483
3576
  ),
3484
3577
  onClick: () => setIsOpen((prev) => !prev),
3485
3578
  children: [
3486
- (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3579
+ (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
3487
3580
  RemoteImage,
3488
3581
  {
3489
3582
  src: selectedItem.iconUrl,
@@ -3491,12 +3584,12 @@ var Select = ({
3491
3584
  className: "h-4 w-4 shrink-0 rounded-sm object-contain"
3492
3585
  }
3493
3586
  ) : null,
3494
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
3587
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
3495
3588
  ]
3496
3589
  }
3497
3590
  ),
3498
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) }),
3499
- isOpen ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3591
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) }),
3592
+ isOpen ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
3500
3593
  "div",
3501
3594
  {
3502
3595
  role: "listbox",
@@ -3504,7 +3597,7 @@ var Select = ({
3504
3597
  className: "absolute top-full left-0 z-50 mt-1 w-full overflow-hidden rounded-agg-md border border-agg-separator bg-agg-secondary shadow-lg",
3505
3598
  children: items.map((item) => {
3506
3599
  const isSelected = item.value === value;
3507
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
3600
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
3508
3601
  "button",
3509
3602
  {
3510
3603
  type: "button",
@@ -3524,7 +3617,7 @@ var Select = ({
3524
3617
  }
3525
3618
  },
3526
3619
  children: [
3527
- item.iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3620
+ item.iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
3528
3621
  RemoteImage,
3529
3622
  {
3530
3623
  src: item.iconUrl,
@@ -3532,7 +3625,7 @@ var Select = ({
3532
3625
  className: "h-4 w-4 shrink-0 rounded-sm object-contain"
3533
3626
  }
3534
3627
  ) : null,
3535
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "truncate", children: item.label })
3628
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "truncate", children: item.label })
3536
3629
  ]
3537
3630
  },
3538
3631
  item.value
@@ -3546,65 +3639,201 @@ var Select = ({
3546
3639
  };
3547
3640
  Select.displayName = "Select";
3548
3641
 
3549
- // src/primitives/tabs/index.tsx
3550
- var import_react5 = require("react");
3551
- var import_hooks14 = require("@agg-market/hooks");
3552
-
3553
- // src/primitives/tabs/tabs.utils.ts
3554
- var findNextEnabledIndex = (items, startIndex, direction) => {
3555
- var _a;
3556
- if (items.length === 0)
3557
- return -1;
3558
- for (let step = 1; step <= items.length; step += 1) {
3559
- const nextIndex = (startIndex + direction * step + items.length) % items.length;
3560
- if (!((_a = items[nextIndex]) == null ? void 0 : _a.disabled))
3561
- return nextIndex;
3642
+ // src/events/item/event-list-item.utils.ts
3643
+ var resolveEventListItemEvent = (fetchedEvent) => {
3644
+ if (!fetchedEvent)
3645
+ return void 0;
3646
+ if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
3647
+ return void 0;
3648
+ return fetchedEvent;
3649
+ };
3650
+ var normalizeProbability = (value) => {
3651
+ if (typeof value !== "number" || !Number.isFinite(value))
3652
+ return void 0;
3653
+ if (value < 0)
3654
+ return 0;
3655
+ if (value > 1)
3656
+ return 1;
3657
+ return value;
3658
+ };
3659
+ var hasDateLabel = (outcome) => {
3660
+ return !!toDate(outcome.label);
3661
+ };
3662
+ var sortOutcomes = (outcomes) => {
3663
+ if (outcomes.length <= 1)
3664
+ return outcomes;
3665
+ const now = Date.now();
3666
+ if (outcomes.some(hasDateLabel)) {
3667
+ return [...outcomes].sort((a, b) => {
3668
+ var _a, _b, _c, _d;
3669
+ const aDate = (_b = (_a = toDate(a.label)) == null ? void 0 : _a.getTime()) != null ? _b : 0;
3670
+ const bDate = (_d = (_c = toDate(b.label)) == null ? void 0 : _c.getTime()) != null ? _d : 0;
3671
+ return Math.abs(aDate - now) - Math.abs(bDate - now);
3672
+ });
3562
3673
  }
3563
- return -1;
3674
+ return [...outcomes].sort((a, b) => {
3675
+ var _a, _b;
3676
+ const aPrice = (_a = normalizeProbability(a.price)) != null ? _a : 0;
3677
+ const bPrice = (_b = normalizeProbability(b.price)) != null ? _b : 0;
3678
+ return bPrice - aPrice;
3679
+ });
3564
3680
  };
3565
- var findEdgeEnabledIndex = (items, direction) => {
3566
- var _a;
3567
- if (direction === 1) {
3568
- return items.findIndex((item) => !item.disabled);
3681
+ var compareVisibleOutcomeRows = (left, right) => {
3682
+ var _a, _b;
3683
+ const leftDate = toDate(resolveOutcomeTitle(left.outcome));
3684
+ const rightDate = toDate(resolveOutcomeTitle(right.outcome));
3685
+ if (leftDate && rightDate) {
3686
+ return leftDate.getTime() - rightDate.getTime();
3569
3687
  }
3570
- for (let index = items.length - 1; index >= 0; index -= 1) {
3571
- if (!((_a = items[index]) == null ? void 0 : _a.disabled))
3572
- return index;
3688
+ const leftProbability = (_a = normalizeProbability(left.outcome.price)) != null ? _a : -1;
3689
+ const rightProbability = (_b = normalizeProbability(right.outcome.price)) != null ? _b : -1;
3690
+ return rightProbability - leftProbability;
3691
+ };
3692
+ var shouldReplaceVisibleOutcome = (current, next) => {
3693
+ var _a, _b;
3694
+ const currentVolume = typeof current.market.volume === "number" ? current.market.volume : -1;
3695
+ const nextVolume = typeof next.market.volume === "number" ? next.market.volume : -1;
3696
+ if (currentVolume !== nextVolume) {
3697
+ return nextVolume > currentVolume;
3573
3698
  }
3574
- return -1;
3699
+ const currentProbability = (_a = normalizeProbability(current.outcome.price)) != null ? _a : -1;
3700
+ const nextProbability = (_b = normalizeProbability(next.outcome.price)) != null ? _b : -1;
3701
+ return nextProbability > currentProbability;
3575
3702
  };
3576
-
3577
- // src/primitives/tabs/index.tsx
3578
- var import_jsx_runtime75 = require("react/jsx-runtime");
3579
- var mobileTabsMediaQuery = "(max-width: 512px)";
3580
- var getTabButtonClassName = ({
3581
- enableAnimations,
3582
- isBarVariant,
3583
- isActive,
3584
- isDisabled,
3585
- size
3586
- }) => {
3587
- const isSmall = size === "s";
3588
- return cn(
3589
- "cursor-pointer disabled:cursor-not-allowed",
3590
- "relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
3591
- isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
3592
- getMotionClassName(
3593
- enableAnimations,
3594
- "transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
3595
- ),
3596
- isBarVariant ? cn(
3597
- "min-w-20 overflow-hidden border-r border-agg-separator last:border-r-0",
3598
- isSmall ? "px-3 text-agg-sm leading-agg-5" : "px-4 text-agg-base leading-agg-6"
3599
- ) : cn(isSmall ? "px-4 text-agg-sm leading-agg-5" : "px-5 text-agg-base leading-agg-6"),
3600
- isBarVariant && isActive && "font-agg-bold text-agg-primary",
3601
- isBarVariant && !isActive && "font-agg-normal text-agg-foreground",
3602
- !isBarVariant && isActive && "font-agg-bold text-agg-primary",
3603
- !isBarVariant && !isActive && "font-agg-normal text-agg-foreground",
3604
- isDisabled && "cursor-not-allowed opacity-60"
3605
- );
3703
+ var resolveVisibleOutcomes = (venueMarkets, maxOutcomes) => {
3704
+ const visibleOutcomesByLabel = /* @__PURE__ */ new Map();
3705
+ venueMarkets.forEach((market) => {
3706
+ sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
3707
+ const title = resolveOutcomeTitle(outcome);
3708
+ const normalizedTitle = title.trim().toLowerCase();
3709
+ const nextVisibleOutcome = {
3710
+ venue: market.venue,
3711
+ market,
3712
+ outcome,
3713
+ title
3714
+ };
3715
+ const currentVisibleOutcome = visibleOutcomesByLabel.get(normalizedTitle);
3716
+ if (!currentVisibleOutcome || shouldReplaceVisibleOutcome(currentVisibleOutcome, nextVisibleOutcome)) {
3717
+ visibleOutcomesByLabel.set(normalizedTitle, nextVisibleOutcome);
3718
+ }
3719
+ });
3720
+ });
3721
+ return [...visibleOutcomesByLabel.values()].sort(compareVisibleOutcomeRows).slice(0, Math.max(1, maxOutcomes));
3606
3722
  };
3607
- var Tabs = ({
3723
+ var resolveOutcomeTitle = (outcome) => {
3724
+ if (outcome.title && outcome.title.trim())
3725
+ return outcome.title;
3726
+ return outcome.label;
3727
+ };
3728
+ var selectPrimaryVenueMarket = (venueMarkets) => {
3729
+ if (venueMarkets.length === 0)
3730
+ return void 0;
3731
+ if (venueMarkets.length === 1)
3732
+ return venueMarkets[0];
3733
+ return [...venueMarkets].sort((a, b) => {
3734
+ const aVolume = typeof a.volume === "number" ? a.volume : -1;
3735
+ const bVolume = typeof b.volume === "number" ? b.volume : -1;
3736
+ return bVolume - aVolume;
3737
+ })[0];
3738
+ };
3739
+ var resolveTileTitle = (event, primaryVenueMarket, titleOverride) => {
3740
+ if (typeof titleOverride === "string" && titleOverride.trim()) {
3741
+ return titleOverride;
3742
+ }
3743
+ if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.question) === "string" && primaryVenueMarket.question.trim()) {
3744
+ return primaryVenueMarket.question;
3745
+ }
3746
+ return event.title;
3747
+ };
3748
+ var resolveTileImage = (event, primaryVenueMarket, imageOverride) => {
3749
+ if (typeof imageOverride === "string" && imageOverride.trim()) {
3750
+ return imageOverride;
3751
+ }
3752
+ if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.image) === "string" && primaryVenueMarket.image.trim()) {
3753
+ return primaryVenueMarket.image;
3754
+ }
3755
+ if (typeof event.image === "string" && event.image.trim()) {
3756
+ return event.image;
3757
+ }
3758
+ return void 0;
3759
+ };
3760
+ var formatCountLabel = (count, singular, plural) => {
3761
+ return `${count} ${count === 1 ? singular : plural}`;
3762
+ };
3763
+ var getVenueSummary = (venueMarkets) => {
3764
+ const uniqueVenues = Array.from(new Set(venueMarkets.map((market) => market.venue)));
3765
+ return {
3766
+ marketCount: venueMarkets.length,
3767
+ venueCount: uniqueVenues.length,
3768
+ singleVenue: uniqueVenues.length === 1 ? uniqueVenues[0] : void 0
3769
+ };
3770
+ };
3771
+ var resolveVenueLabel = (venue, venueInfo, labels) => {
3772
+ var _a, _b;
3773
+ if (!venue)
3774
+ return labels.eventItem.venueSingular;
3775
+ return (_b = (_a = venueInfo == null ? void 0 : venueInfo[venue]) == null ? void 0 : _a.label) != null ? _b : labels.venues[venue];
3776
+ };
3777
+
3778
+ // src/primitives/tabs/index.tsx
3779
+ var import_react5 = require("react");
3780
+ var import_hooks15 = require("@agg-market/hooks");
3781
+
3782
+ // src/primitives/tabs/tabs.utils.ts
3783
+ var findNextEnabledIndex = (items, startIndex, direction) => {
3784
+ var _a;
3785
+ if (items.length === 0)
3786
+ return -1;
3787
+ for (let step = 1; step <= items.length; step += 1) {
3788
+ const nextIndex = (startIndex + direction * step + items.length) % items.length;
3789
+ if (!((_a = items[nextIndex]) == null ? void 0 : _a.disabled))
3790
+ return nextIndex;
3791
+ }
3792
+ return -1;
3793
+ };
3794
+ var findEdgeEnabledIndex = (items, direction) => {
3795
+ var _a;
3796
+ if (direction === 1) {
3797
+ return items.findIndex((item) => !item.disabled);
3798
+ }
3799
+ for (let index = items.length - 1; index >= 0; index -= 1) {
3800
+ if (!((_a = items[index]) == null ? void 0 : _a.disabled))
3801
+ return index;
3802
+ }
3803
+ return -1;
3804
+ };
3805
+
3806
+ // src/primitives/tabs/index.tsx
3807
+ var import_jsx_runtime76 = require("react/jsx-runtime");
3808
+ var mobileTabsMediaQuery = "(max-width: 512px)";
3809
+ var getTabButtonClassName = ({
3810
+ enableAnimations,
3811
+ isBarVariant,
3812
+ isActive,
3813
+ isDisabled,
3814
+ size
3815
+ }) => {
3816
+ const isSmall = size === "s";
3817
+ return cn(
3818
+ "cursor-pointer disabled:cursor-not-allowed",
3819
+ "relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
3820
+ isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-agg-bold",
3821
+ getMotionClassName(
3822
+ enableAnimations,
3823
+ "transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
3824
+ ),
3825
+ isBarVariant ? cn(
3826
+ "min-w-20 overflow-hidden border-r border-agg-separator last:border-r-0",
3827
+ isSmall ? "px-3 text-agg-sm leading-agg-5" : "px-4 text-agg-base leading-agg-6"
3828
+ ) : cn(isSmall ? "px-4 text-agg-sm leading-agg-5" : "px-5 text-agg-base leading-agg-6"),
3829
+ isBarVariant && isActive && "font-agg-bold text-agg-primary",
3830
+ isBarVariant && !isActive && "font-agg-normal text-agg-foreground",
3831
+ !isBarVariant && isActive && "font-agg-bold text-agg-primary",
3832
+ !isBarVariant && !isActive && "font-agg-normal text-agg-foreground",
3833
+ isDisabled && "cursor-not-allowed opacity-60"
3834
+ );
3835
+ };
3836
+ var Tabs = ({
3608
3837
  items,
3609
3838
  value,
3610
3839
  onChange,
@@ -3615,8 +3844,10 @@ var Tabs = ({
3615
3844
  className,
3616
3845
  classNames
3617
3846
  }) => {
3618
- const labels = (0, import_hooks14.useLabels)();
3619
- const { enableAnimations } = (0, import_hooks14.useSdkUiConfig)();
3847
+ const labels = (0, import_hooks15.useLabels)();
3848
+ const {
3849
+ features: { enableAnimations }
3850
+ } = (0, import_hooks15.useSdkUiConfig)();
3620
3851
  const buttonRefs = (0, import_react5.useRef)([]);
3621
3852
  const dragStateRef = (0, import_react5.useRef)({
3622
3853
  isPointerDown: false,
@@ -3932,7 +4163,7 @@ var Tabs = ({
3932
4163
  });
3933
4164
  }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
3934
4165
  if (shouldUseOverflowSelect) {
3935
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: cn("w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
4166
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: cn("w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
3936
4167
  Select,
3937
4168
  {
3938
4169
  ariaLabel,
@@ -3944,7 +4175,7 @@ var Tabs = ({
3944
4175
  }
3945
4176
  ) });
3946
4177
  }
3947
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
4178
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
3948
4179
  "div",
3949
4180
  {
3950
4181
  className: cn(
@@ -3955,7 +4186,7 @@ var Tabs = ({
3955
4186
  classNames == null ? void 0 : classNames.root
3956
4187
  ),
3957
4188
  children: [
3958
- /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
4189
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
3959
4190
  "div",
3960
4191
  {
3961
4192
  ref: tabListRef,
@@ -3971,7 +4202,7 @@ var Tabs = ({
3971
4202
  children: [
3972
4203
  renderedItems.map((item, index) => {
3973
4204
  const isActive = item.value === value;
3974
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
4205
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
3975
4206
  "button",
3976
4207
  {
3977
4208
  ref: (buttonElement) => {
@@ -4000,7 +4231,7 @@ var Tabs = ({
4000
4231
  shouldUseOverflowScroll && !isBarVariant && "snap-start"
4001
4232
  ),
4002
4233
  children: [
4003
- isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_jsx_runtime75.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
4234
+ isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4004
4235
  "span",
4005
4236
  {
4006
4237
  "aria-hidden": true,
@@ -4014,14 +4245,23 @@ var Tabs = ({
4014
4245
  )
4015
4246
  }
4016
4247
  ) }) : null,
4017
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
4018
- /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase", children: item.label })
4248
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center empty:hidden", children: item.icon }) : null,
4249
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4250
+ "span",
4251
+ {
4252
+ className: cn(
4253
+ "relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase"
4254
+ ),
4255
+ "data-text": item.label,
4256
+ children: item.label
4257
+ }
4258
+ )
4019
4259
  ]
4020
4260
  },
4021
4261
  item.value
4022
4262
  );
4023
4263
  }),
4024
- !isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
4264
+ !isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4025
4265
  "span",
4026
4266
  {
4027
4267
  "aria-hidden": true,
@@ -4039,24 +4279,24 @@ var Tabs = ({
4039
4279
  ]
4040
4280
  }
4041
4281
  ),
4042
- shouldUseOverflowScroll && !isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
4043
- /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
4282
+ shouldUseOverflowScroll && !isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
4283
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4044
4284
  "span",
4045
4285
  {
4046
4286
  "aria-hidden": true,
4047
4287
  className: cn(
4048
- "pointer-events-none absolute top-0 bottom-0 left-8 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
4288
+ "pointer-events-none absolute top-0 bottom-0 left-0 z-10 w-12 md:w-18 bg-linear-to-r from-agg-secondary via-agg-secondary to-transparent",
4049
4289
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
4050
4290
  scrollAffordanceState.showStart ? "opacity-100" : "opacity-0"
4051
4291
  )
4052
4292
  }
4053
4293
  ),
4054
- /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
4294
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4055
4295
  "span",
4056
4296
  {
4057
4297
  "aria-hidden": true,
4058
4298
  className: cn(
4059
- "pointer-events-none absolute top-0 right-8 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
4299
+ "pointer-events-none absolute top-0 right-0 bottom-0 z-10 w-12 md:w-18 bg-linear-to-l from-agg-secondary via-agg-secondary to-transparent",
4060
4300
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
4061
4301
  scrollAffordanceState.showEnd ? "opacity-100" : "opacity-0"
4062
4302
  )
@@ -4069,150 +4309,14 @@ var Tabs = ({
4069
4309
  };
4070
4310
  Tabs.displayName = "Tabs";
4071
4311
 
4072
- // src/events/item/event-list-item.utils.ts
4073
- var resolveEventListItemEvent = (fetchedEvent) => {
4074
- if (!fetchedEvent)
4075
- return void 0;
4076
- if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
4077
- return void 0;
4078
- return fetchedEvent;
4079
- };
4080
- var normalizeProbability = (value) => {
4081
- if (typeof value !== "number" || !Number.isFinite(value))
4082
- return void 0;
4083
- if (value < 0)
4084
- return 0;
4085
- if (value > 1)
4086
- return 1;
4087
- return value;
4088
- };
4089
- var hasDateLabel = (outcome) => {
4090
- return !!toDate(outcome.label);
4091
- };
4092
- var sortOutcomes = (outcomes) => {
4093
- if (outcomes.length <= 1)
4094
- return outcomes;
4095
- const now = Date.now();
4096
- if (outcomes.some(hasDateLabel)) {
4097
- return [...outcomes].sort((a, b) => {
4098
- var _a, _b, _c, _d;
4099
- const aDate = (_b = (_a = toDate(a.label)) == null ? void 0 : _a.getTime()) != null ? _b : 0;
4100
- const bDate = (_d = (_c = toDate(b.label)) == null ? void 0 : _c.getTime()) != null ? _d : 0;
4101
- return Math.abs(aDate - now) - Math.abs(bDate - now);
4102
- });
4103
- }
4104
- return [...outcomes].sort((a, b) => {
4105
- var _a, _b;
4106
- const aPrice = (_a = normalizeProbability(a.price)) != null ? _a : 0;
4107
- const bPrice = (_b = normalizeProbability(b.price)) != null ? _b : 0;
4108
- return bPrice - aPrice;
4109
- });
4110
- };
4111
- var compareVisibleOutcomeRows = (left, right) => {
4112
- var _a, _b;
4113
- const leftDate = toDate(resolveOutcomeTitle(left.outcome));
4114
- const rightDate = toDate(resolveOutcomeTitle(right.outcome));
4115
- if (leftDate && rightDate) {
4116
- return leftDate.getTime() - rightDate.getTime();
4117
- }
4118
- const leftProbability = (_a = normalizeProbability(left.outcome.price)) != null ? _a : -1;
4119
- const rightProbability = (_b = normalizeProbability(right.outcome.price)) != null ? _b : -1;
4120
- return rightProbability - leftProbability;
4121
- };
4122
- var shouldReplaceVisibleOutcome = (current, next) => {
4123
- var _a, _b;
4124
- const currentVolume = typeof current.market.volume === "number" ? current.market.volume : -1;
4125
- const nextVolume = typeof next.market.volume === "number" ? next.market.volume : -1;
4126
- if (currentVolume !== nextVolume) {
4127
- return nextVolume > currentVolume;
4128
- }
4129
- const currentProbability = (_a = normalizeProbability(current.outcome.price)) != null ? _a : -1;
4130
- const nextProbability = (_b = normalizeProbability(next.outcome.price)) != null ? _b : -1;
4131
- return nextProbability > currentProbability;
4132
- };
4133
- var resolveVisibleOutcomes = (venueMarkets, maxOutcomes) => {
4134
- const visibleOutcomesByLabel = /* @__PURE__ */ new Map();
4135
- venueMarkets.forEach((market) => {
4136
- sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
4137
- const title = resolveOutcomeTitle(outcome);
4138
- const normalizedTitle = title.trim().toLowerCase();
4139
- const nextVisibleOutcome = {
4140
- venue: market.venue,
4141
- market,
4142
- outcome,
4143
- title
4144
- };
4145
- const currentVisibleOutcome = visibleOutcomesByLabel.get(normalizedTitle);
4146
- if (!currentVisibleOutcome || shouldReplaceVisibleOutcome(currentVisibleOutcome, nextVisibleOutcome)) {
4147
- visibleOutcomesByLabel.set(normalizedTitle, nextVisibleOutcome);
4148
- }
4149
- });
4150
- });
4151
- return [...visibleOutcomesByLabel.values()].sort(compareVisibleOutcomeRows).slice(0, Math.max(1, maxOutcomes));
4152
- };
4153
- var resolveOutcomeTitle = (outcome) => {
4154
- if (outcome.title && outcome.title.trim())
4155
- return outcome.title;
4156
- return outcome.label;
4157
- };
4158
- var selectPrimaryVenueMarket = (venueMarkets) => {
4159
- if (venueMarkets.length === 0)
4160
- return void 0;
4161
- if (venueMarkets.length === 1)
4162
- return venueMarkets[0];
4163
- return [...venueMarkets].sort((a, b) => {
4164
- const aVolume = typeof a.volume === "number" ? a.volume : -1;
4165
- const bVolume = typeof b.volume === "number" ? b.volume : -1;
4166
- return bVolume - aVolume;
4167
- })[0];
4168
- };
4169
- var resolveTileTitle = (event, primaryVenueMarket, titleOverride) => {
4170
- if (typeof titleOverride === "string" && titleOverride.trim()) {
4171
- return titleOverride;
4172
- }
4173
- if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.question) === "string" && primaryVenueMarket.question.trim()) {
4174
- return primaryVenueMarket.question;
4175
- }
4176
- return event.title;
4177
- };
4178
- var resolveTileImage = (event, primaryVenueMarket, imageOverride) => {
4179
- if (typeof imageOverride === "string" && imageOverride.trim()) {
4180
- return imageOverride;
4181
- }
4182
- if (typeof (primaryVenueMarket == null ? void 0 : primaryVenueMarket.image) === "string" && primaryVenueMarket.image.trim()) {
4183
- return primaryVenueMarket.image;
4184
- }
4185
- if (typeof event.image === "string" && event.image.trim()) {
4186
- return event.image;
4187
- }
4188
- return void 0;
4189
- };
4190
- var formatCountLabel = (count, singular, plural) => {
4191
- return `${count} ${count === 1 ? singular : plural}`;
4192
- };
4193
- var getVenueSummary = (venueMarkets) => {
4194
- const uniqueVenues = Array.from(new Set(venueMarkets.map((market) => market.venue)));
4195
- return {
4196
- marketCount: venueMarkets.length,
4197
- venueCount: uniqueVenues.length,
4198
- singleVenue: uniqueVenues.length === 1 ? uniqueVenues[0] : void 0
4199
- };
4200
- };
4201
- var resolveVenueLabel = (venue, venueInfo, labels) => {
4202
- var _a, _b;
4203
- if (!venue)
4204
- return labels.eventItem.venueSingular;
4205
- return (_b = (_a = venueInfo == null ? void 0 : venueInfo[venue]) == null ? void 0 : _a.label) != null ? _b : labels.venues[venue];
4206
- };
4207
-
4208
4312
  // src/events/item/index.tsx
4209
- var import_jsx_runtime76 = require("react/jsx-runtime");
4313
+ var import_jsx_runtime77 = require("react/jsx-runtime");
4210
4314
  var EventListItemLoadingState = ({
4211
4315
  classNames,
4212
4316
  ariaLabel
4213
4317
  }) => {
4214
- const labels = (0, import_hooks15.useLabels)();
4215
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4318
+ const labels = (0, import_hooks16.useLabels)();
4319
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4216
4320
  Skeleton,
4217
4321
  {
4218
4322
  view: "event-list-item",
@@ -4225,16 +4329,16 @@ var EventListItemUnavailableState = ({
4225
4329
  classNames,
4226
4330
  ariaLabel
4227
4331
  }) => {
4228
- const labels = (0, import_hooks15.useLabels)();
4229
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4332
+ const labels = (0, import_hooks16.useLabels)();
4333
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4230
4334
  Card,
4231
4335
  {
4232
4336
  className: cn(baseCardClassName, classNames == null ? void 0 : classNames.root),
4233
4337
  role: "status",
4234
4338
  "aria-label": ariaLabel != null ? ariaLabel : labels.eventItem.unavailableAria,
4235
- children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
4236
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItem.unavailableTitle }),
4237
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItem.unavailableDescription })
4339
+ children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
4340
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItem.unavailableTitle }),
4341
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItem.unavailableDescription })
4238
4342
  ] })
4239
4343
  }
4240
4344
  );
@@ -4243,8 +4347,8 @@ var EventListItemNotFoundState = ({
4243
4347
  classNames,
4244
4348
  ariaLabel
4245
4349
  }) => {
4246
- const labels = (0, import_hooks15.useLabels)();
4247
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Card, { className: cn("w-full gap-0 overflow-hidden p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4350
+ const labels = (0, import_hooks16.useLabels)();
4351
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card, { className: cn("w-full gap-0 overflow-hidden p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4248
4352
  StateMessage,
4249
4353
  {
4250
4354
  ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
@@ -4258,7 +4362,6 @@ var EventListItemContent = ({
4258
4362
  event,
4259
4363
  title,
4260
4364
  image,
4261
- showVenueLogo = true,
4262
4365
  maxOutcomes = 2,
4263
4366
  classNames,
4264
4367
  venueInfo,
@@ -4267,8 +4370,8 @@ var EventListItemContent = ({
4267
4370
  ariaLabel
4268
4371
  }) => {
4269
4372
  var _a;
4270
- const config = (0, import_hooks15.useSdkUiConfig)();
4271
- const labels = (0, import_hooks15.useLabels)();
4373
+ const config = (0, import_hooks16.useSdkUiConfig)();
4374
+ const labels = (0, import_hooks16.useLabels)();
4272
4375
  const allVenueMarkets = (0, import_react6.useMemo)(() => {
4273
4376
  return event.venueMarkets;
4274
4377
  }, [event.venueMarkets]);
@@ -4288,23 +4391,23 @@ var EventListItemContent = ({
4288
4391
  return Array.from(new Set(allVenueMarkets.map((market) => market.venue))).slice(0, 4);
4289
4392
  }, [allVenueMarkets]);
4290
4393
  const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
4291
- const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
4394
+ const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
4292
4395
  const handleKeyDown = (eventToHandle) => {
4293
4396
  if (!onClick)
4294
4397
  return;
4295
4398
  if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
4296
4399
  eventToHandle == null ? void 0 : eventToHandle.preventDefault();
4297
- onClick();
4400
+ onClick == null ? void 0 : onClick(event);
4298
4401
  }
4299
4402
  };
4300
4403
  const renderArbitrage = (value) => {
4301
4404
  if (value == null)
4302
4405
  return null;
4303
- if (Math.abs(value) < config.arbitrageThreshold)
4406
+ if (Math.abs(value) < config.market.arbitrageThreshold)
4304
4407
  return null;
4305
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-success"), children: [
4306
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Typography, { variant: "label-strong", className: "text-agg-success", children: config.formatPercent(value) }),
4307
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4408
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-success"), children: [
4409
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "label-strong", className: "text-agg-success", children: config.formatting.formatPercent(value) }),
4410
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4308
4411
  Icon,
4309
4412
  {
4310
4413
  name: "triangle-up",
@@ -4315,18 +4418,18 @@ var EventListItemContent = ({
4315
4418
  )
4316
4419
  ] });
4317
4420
  };
4318
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
4421
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4319
4422
  Card,
4320
4423
  {
4321
4424
  className: cn(baseCardClassName, onClick && "cursor-pointer", classNames == null ? void 0 : classNames.root),
4322
4425
  role: onClick ? "button" : void 0,
4323
4426
  tabIndex: onClick ? 0 : void 0,
4324
- onClick,
4427
+ onClick: () => onClick == null ? void 0 : onClick(event),
4325
4428
  onKeyDown: handleKeyDown,
4326
4429
  "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
4327
4430
  children: [
4328
- /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cn("flex items-center gap-3", classNames == null ? void 0 : classNames.header), children: [
4329
- resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4431
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex items-center gap-3", classNames == null ? void 0 : classNames.header), children: [
4432
+ resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4330
4433
  RemoteImage,
4331
4434
  {
4332
4435
  src: resolvedImage,
@@ -4334,7 +4437,7 @@ var EventListItemContent = ({
4334
4437
  className: cn("h-10 w-10", "rounded-agg-lg object-cover")
4335
4438
  }
4336
4439
  ) : null,
4337
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4440
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4338
4441
  Typography,
4339
4442
  {
4340
4443
  variant: "body-strong",
@@ -4347,13 +4450,13 @@ var EventListItemContent = ({
4347
4450
  }
4348
4451
  )
4349
4452
  ] }),
4350
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.outcomes), children: visibleOutcomes.map((visibleOutcome) => {
4453
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.outcomes), children: visibleOutcomes.map((visibleOutcome) => {
4351
4454
  const probability = normalizeProbability(visibleOutcome.outcome.price);
4352
4455
  const showBadge = typeof probability === "number";
4353
4456
  const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[visibleOutcome.outcome.id];
4354
4457
  const outcomeTitle = resolveOutcomeTitle(visibleOutcome.outcome);
4355
4458
  const formattedTitle = (0, import_dayjs2.default)(outcomeTitle).isValid() ? (0, import_dayjs2.default)(outcomeTitle).format("MMMM D, YYYY") : outcomeTitle;
4356
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
4459
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4357
4460
  "div",
4358
4461
  {
4359
4462
  className: cn(
@@ -4361,7 +4464,7 @@ var EventListItemContent = ({
4361
4464
  classNames == null ? void 0 : classNames.outcomeRow
4362
4465
  ),
4363
4466
  children: [
4364
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4467
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4365
4468
  Typography,
4366
4469
  {
4367
4470
  variant: "body",
@@ -4369,13 +4472,13 @@ var EventListItemContent = ({
4369
4472
  children: formattedTitle
4370
4473
  }
4371
4474
  ),
4372
- /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex flex-row gap-3 items-center justify-end", children: [
4475
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-row gap-3 items-center justify-end", children: [
4373
4476
  renderArbitrage(arbitragePercent),
4374
- showBadge ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4477
+ showBadge ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4375
4478
  Badge,
4376
4479
  {
4377
- text: config.formatPercent(probability),
4378
- prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }) : void 0,
4480
+ text: config.formatting.formatPercent(probability),
4481
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }),
4379
4482
  size: "large",
4380
4483
  classNames: {
4381
4484
  root: cn(
@@ -4391,7 +4494,7 @@ var EventListItemContent = ({
4391
4494
  `${visibleOutcome.market.id}-${visibleOutcome.outcome.id}`
4392
4495
  );
4393
4496
  }) }),
4394
- /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
4497
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4395
4498
  "div",
4396
4499
  {
4397
4500
  className: cn(
@@ -4400,15 +4503,15 @@ var EventListItemContent = ({
4400
4503
  classNames == null ? void 0 : classNames.footer
4401
4504
  ),
4402
4505
  children: [
4403
- /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-sm leading-agg-5"), children: [
4404
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4506
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-sm leading-agg-5"), children: [
4507
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4405
4508
  marketCount,
4406
4509
  labels.eventItem.marketSingular,
4407
4510
  labels.eventItem.marketPlural
4408
4511
  ) }),
4409
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
4410
- singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
4411
- showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4512
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
4513
+ singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
4514
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4412
4515
  VenueLogo,
4413
4516
  {
4414
4517
  venue: singleVenue,
@@ -4416,14 +4519,14 @@ var EventListItemContent = ({
4416
4519
  isMonochromatic: true,
4417
4520
  className: "text-agg-muted-foreground!"
4418
4521
  }
4419
- ) : null,
4420
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: venueLabel })
4421
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4522
+ ),
4523
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: venueLabel })
4524
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4422
4525
  venueCount,
4423
4526
  labels.eventItem.venueSingular,
4424
4527
  labels.eventItem.venuePlural
4425
4528
  ) }),
4426
- showVenueLogo && !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4529
+ !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4427
4530
  VenueLogo,
4428
4531
  {
4429
4532
  venue,
@@ -4434,7 +4537,7 @@ var EventListItemContent = ({
4434
4537
  venue
4435
4538
  )) }) : null
4436
4539
  ] }),
4437
- volumeLabel ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Typography, { variant: "label", className: "text-agg-sm text-agg-muted-foreground", children: volumeLabel }) : null
4540
+ volumeLabel ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "label", className: "text-agg-sm text-agg-muted-foreground", children: volumeLabel }) : null
4438
4541
  ]
4439
4542
  }
4440
4543
  )
@@ -4453,7 +4556,7 @@ var EventListItemByEventId = (_a) => {
4453
4556
  error,
4454
4557
  isError,
4455
4558
  isLoading
4456
- } = (0, import_hooks15.useVenueEvent)({
4559
+ } = (0, import_hooks16.useVenueEvent)({
4457
4560
  eventId: eventId != null ? eventId : "",
4458
4561
  enabled: !!eventId
4459
4562
  });
@@ -4461,48 +4564,48 @@ var EventListItemByEventId = (_a) => {
4461
4564
  return resolveEventListItemEvent(fetchedEvent);
4462
4565
  }, [fetchedEvent]);
4463
4566
  if (!eventId) {
4464
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4567
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4465
4568
  }
4466
4569
  if (isLoading) {
4467
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4570
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4468
4571
  }
4469
4572
  if (isErrorWithStatus(error, 404)) {
4470
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4573
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4471
4574
  }
4472
4575
  if (!fetchedEvent && !isError) {
4473
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4576
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4474
4577
  }
4475
4578
  if (!resolvedEvent) {
4476
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4579
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4477
4580
  }
4478
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemContent, __spreadValues({ event: resolvedEvent }, rest));
4581
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemContent, __spreadValues({ event: resolvedEvent }, rest));
4479
4582
  };
4480
4583
  var EventListItem = (props) => {
4481
4584
  if (props.isLoading) {
4482
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
4585
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
4483
4586
  }
4484
4587
  if ("event" in props && props.event) {
4485
4588
  const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
4486
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemContent, __spreadValues({ event }, rest));
4589
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemContent, __spreadValues({ event }, rest));
4487
4590
  }
4488
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventListItemByEventId, __spreadValues({}, props));
4591
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemByEventId, __spreadValues({}, props));
4489
4592
  };
4490
4593
  EventListItem.displayName = "EventListItem";
4491
4594
 
4492
4595
  // src/events/item-details/index.tsx
4493
4596
  var import_react8 = require("react");
4494
- var import_hooks17 = require("@agg-market/hooks");
4597
+ var import_hooks18 = require("@agg-market/hooks");
4495
4598
 
4496
4599
  // src/primitives/chart/chart-type-switch.tsx
4497
- var import_hooks16 = require("@agg-market/hooks");
4600
+ var import_hooks17 = require("@agg-market/hooks");
4498
4601
  var import_react7 = require("react");
4499
- var import_jsx_runtime77 = require("react/jsx-runtime");
4602
+ var import_jsx_runtime78 = require("react/jsx-runtime");
4500
4603
  var ChartTypeSwitch = ({
4501
4604
  value,
4502
4605
  onValueChange,
4503
4606
  className
4504
4607
  }) => {
4505
- const labels = (0, import_hooks16.useLabels)();
4608
+ const labels = (0, import_hooks17.useLabels)();
4506
4609
  const options = (0, import_react7.useMemo)(
4507
4610
  () => [
4508
4611
  {
@@ -4531,7 +4634,7 @@ var ChartTypeSwitch = ({
4531
4634
  }
4532
4635
  onValueChange(nextOption.value);
4533
4636
  };
4534
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4637
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4535
4638
  "div",
4536
4639
  {
4537
4640
  className: cn("inline-flex items-center gap-2", className),
@@ -4539,7 +4642,7 @@ var ChartTypeSwitch = ({
4539
4642
  "aria-label": labels.common.chartTypeSwitchAria,
4540
4643
  children: options.map((option, index) => {
4541
4644
  const isActive = option.value === value;
4542
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4645
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4543
4646
  "button",
4544
4647
  {
4545
4648
  type: "button",
@@ -4554,7 +4657,9 @@ var ChartTypeSwitch = ({
4554
4657
  "transition-colors duration-200 ease-in-out",
4555
4658
  isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
4556
4659
  ),
4557
- onClick: () => {
4660
+ onClick: (e) => {
4661
+ e.stopPropagation();
4662
+ e.preventDefault();
4558
4663
  if (isActive) {
4559
4664
  return;
4560
4665
  }
@@ -4563,7 +4668,7 @@ var ChartTypeSwitch = ({
4563
4668
  onKeyDown: (event) => {
4564
4669
  handleKeyDown(event, index);
4565
4670
  },
4566
- children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Icon, { name: option.iconName, color: "currentColor", className: "h-5 w-5" })
4671
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Icon, { name: option.iconName, color: "currentColor", className: "h-5 w-5" })
4567
4672
  },
4568
4673
  option.value
4569
4674
  );
@@ -4583,14 +4688,9 @@ var isDateLikeLabel = (value) => {
4583
4688
  return false;
4584
4689
  return (0, import_dayjs3.default)(value).isValid();
4585
4690
  };
4586
- var formatDateLabel = (value) => {
4587
- if (!isDateLikeLabel(value))
4588
- return value;
4589
- return (0, import_dayjs3.default)(value).format("MMM D, YYYY");
4590
- };
4591
- var getDefaultSelectedTimeRange = (value) => {
4691
+ var getDefaultSelectedTimeRange = (value, fallback = "1D") => {
4592
4692
  if (!value)
4593
- return "1M";
4693
+ return fallback;
4594
4694
  return value;
4595
4695
  };
4596
4696
  var getTimeWindowByRange = (range) => {
@@ -4672,24 +4772,6 @@ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
4672
4772
  };
4673
4773
  }).filter((item) => item != null);
4674
4774
  };
4675
- var buildPriceHistoryGroups = (selectedOutcomes, fallbackMarketId) => {
4676
- const marketIdByVenue = /* @__PURE__ */ new Map();
4677
- selectedOutcomes.forEach(({ venue, market }) => {
4678
- var _a, _b;
4679
- const marketWithCanonicalId = market;
4680
- const canonicalMarketId = (_a = marketWithCanonicalId.marketId) != null ? _a : fallbackMarketId;
4681
- if (!canonicalMarketId)
4682
- return;
4683
- if (!marketIdByVenue.has(venue)) {
4684
- marketIdByVenue.set(venue, /* @__PURE__ */ new Set());
4685
- }
4686
- (_b = marketIdByVenue.get(venue)) == null ? void 0 : _b.add(canonicalMarketId);
4687
- });
4688
- return [...marketIdByVenue.entries()].map(([venue, marketIds]) => ({
4689
- venue,
4690
- venueMarketOutcomeIds: [...marketIds]
4691
- })).filter((group) => group.venueMarketOutcomeIds.length > 0);
4692
- };
4693
4775
  var resolveSeriesColor = (venue, index) => {
4694
4776
  var _a;
4695
4777
  const colorFromVenue = lineColorByVenue[venue];
@@ -4697,15 +4779,107 @@ var resolveSeriesColor = (venue, index) => {
4697
4779
  return colorFromVenue;
4698
4780
  return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
4699
4781
  };
4782
+ var toNonEmptyString = (value) => {
4783
+ if (typeof value !== "string")
4784
+ return void 0;
4785
+ const trimmedValue = value.trim();
4786
+ return trimmedValue ? trimmedValue : void 0;
4787
+ };
4788
+ var resolveCanonicalMarketId = (venueMarkets, fallbackMarketId) => {
4789
+ var _a;
4790
+ const uniqueMarketIds = Array.from(
4791
+ new Set(venueMarkets.map((market) => toNonEmptyString(market.marketId)).filter(Boolean))
4792
+ );
4793
+ if (uniqueMarketIds.length === 1) {
4794
+ return uniqueMarketIds[0];
4795
+ }
4796
+ return (_a = toNonEmptyString(fallbackMarketId)) != null ? _a : uniqueMarketIds[0];
4797
+ };
4798
+ var toChartDisplayValue = (value, transformProbability) => {
4799
+ if (value == null || !Number.isFinite(value))
4800
+ return void 0;
4801
+ return transformProbability(value) * 100;
4802
+ };
4803
+ var marketChartCandleToLineChartPoint = (candle, transformProbability) => {
4804
+ var _a, _b, _c, _d;
4805
+ const open = (_a = toChartDisplayValue(candle.open, transformProbability)) != null ? _a : 0;
4806
+ const high = (_b = toChartDisplayValue(candle.high, transformProbability)) != null ? _b : open;
4807
+ const low = (_c = toChartDisplayValue(candle.low, transformProbability)) != null ? _c : open;
4808
+ const close = (_d = toChartDisplayValue(candle.close, transformProbability)) != null ? _d : open;
4809
+ return {
4810
+ time: candle.time,
4811
+ value: close,
4812
+ open,
4813
+ high,
4814
+ low,
4815
+ close
4816
+ };
4817
+ };
4818
+ var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
4819
+ var _a, _b, _c, _d;
4820
+ const point = marketChartCandleToLineChartPoint(candle, transformProbability);
4821
+ return {
4822
+ time: point.time,
4823
+ open: (_a = point.open) != null ? _a : point.value,
4824
+ high: (_b = point.high) != null ? _b : point.value,
4825
+ low: (_c = point.low) != null ? _c : point.value,
4826
+ close: (_d = point.close) != null ? _d : point.value,
4827
+ v: candle.volume
4828
+ };
4829
+ };
4830
+ var resolveMarketChartVenueSeries = ({
4831
+ chartData,
4832
+ transformProbability
4833
+ }) => {
4834
+ if (!chartData)
4835
+ return [];
4836
+ return Object.entries(chartData.venues).map(([venue, venueData]) => ({
4837
+ venue,
4838
+ points: venueData.candles.map(
4839
+ (candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
4840
+ )
4841
+ })).filter((item) => item.points.length > 0);
4842
+ };
4843
+ var resolveMarketChartLiveState = ({
4844
+ chartData,
4845
+ selectedVenue,
4846
+ transformProbability
4847
+ }) => {
4848
+ var _a, _b;
4849
+ if (!chartData) {
4850
+ return {
4851
+ liveCandle: null,
4852
+ lineValue: void 0,
4853
+ live: false
4854
+ };
4855
+ }
4856
+ const venueEntries = selectedVenue ? Object.entries(chartData.venues).filter(([venue]) => venue === selectedVenue) : Object.entries(chartData.venues);
4857
+ if (venueEntries.length === 0) {
4858
+ return {
4859
+ liveCandle: null,
4860
+ lineValue: void 0,
4861
+ live: false
4862
+ };
4863
+ }
4864
+ const singleVenueView = selectedVenue != null || venueEntries.length === 1;
4865
+ const liveCandleEntry = singleVenueView ? venueEntries.find(([, venueData]) => venueData.liveCandle != null) : null;
4866
+ const primaryLineValue = (_b = (_a = venueEntries[0]) == null ? void 0 : _a[1]) == null ? void 0 : _b.lineValue;
4867
+ const lineValue = primaryLineValue != null ? toChartDisplayValue(primaryLineValue, transformProbability) : void 0;
4868
+ return {
4869
+ liveCandle: (liveCandleEntry == null ? void 0 : liveCandleEntry[1].liveCandle) ? marketChartCandleToScaledCandlePoint(liveCandleEntry[1].liveCandle, transformProbability) : null,
4870
+ lineValue,
4871
+ live: liveCandleEntry != null
4872
+ };
4873
+ };
4700
4874
 
4701
4875
  // src/events/item-details/index.tsx
4702
- var import_jsx_runtime78 = require("react/jsx-runtime");
4876
+ var import_jsx_runtime79 = require("react/jsx-runtime");
4703
4877
  var EventListItemDetailsLoadingState = ({
4704
4878
  classNames,
4705
4879
  ariaLabel
4706
4880
  }) => {
4707
- const labels = (0, import_hooks17.useLabels)();
4708
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4881
+ const labels = (0, import_hooks18.useLabels)();
4882
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4709
4883
  Skeleton,
4710
4884
  {
4711
4885
  view: "event-list-item-details",
@@ -4718,16 +4892,16 @@ var EventListItemDetailsUnavailableState = ({
4718
4892
  classNames,
4719
4893
  ariaLabel
4720
4894
  }) => {
4721
- const labels = (0, import_hooks17.useLabels)();
4722
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4895
+ const labels = (0, import_hooks18.useLabels)();
4896
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4723
4897
  Card,
4724
4898
  {
4725
4899
  className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
4726
4900
  role: "status",
4727
4901
  "aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.unavailableAria,
4728
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
4729
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
4730
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
4902
+ children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
4903
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
4904
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
4731
4905
  ] })
4732
4906
  }
4733
4907
  );
@@ -4736,8 +4910,8 @@ var EventListItemDetailsNotFoundState = ({
4736
4910
  classNames,
4737
4911
  ariaLabel
4738
4912
  }) => {
4739
- const labels = (0, import_hooks17.useLabels)();
4740
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4913
+ const labels = (0, import_hooks18.useLabels)();
4914
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4741
4915
  StateMessage,
4742
4916
  {
4743
4917
  ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
@@ -4761,31 +4935,25 @@ var resolveAverageProbability = (values) => {
4761
4935
  return void 0;
4762
4936
  return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
4763
4937
  };
4764
- var resolveOutcomeCandidateIds = (market, outcome) => {
4765
- var _a, _b;
4766
- const marketWithCanonicalId = market;
4767
- return [
4768
- outcome.id,
4769
- (_a = outcome.externalIdentifier) != null ? _a : void 0,
4770
- market.externalIdentifier,
4771
- (_b = marketWithCanonicalId.marketId) != null ? _b : void 0
4772
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
4773
- };
4774
4938
  var EventListItemDetailsGraphSection = ({
4775
4939
  venueMarkets,
4776
- canonicalMarketId,
4777
4940
  selectedOutcomeLabel,
4778
4941
  onSelectedOutcomeLabelChange,
4779
4942
  switchLabels,
4780
4943
  isDateOutcomeMarket,
4781
4944
  classNames,
4782
- showVenueLogo,
4783
4945
  venueInfo,
4784
4946
  formatPercent,
4785
4947
  selectedTimeRange,
4786
- selectedChartType
4948
+ selectedChartType,
4949
+ selectedOutcome: _selectedOutcome,
4950
+ selectedMarket
4787
4951
  }) => {
4788
- const labels = (0, import_hooks17.useLabels)();
4952
+ var _a, _b;
4953
+ const labels = (0, import_hooks18.useLabels)();
4954
+ const {
4955
+ features: { enableLiveUpdates }
4956
+ } = (0, import_hooks18.useSdkUiConfig)();
4789
4957
  const [selectedVenue, setSelectedVenue] = (0, import_react8.useState)(null);
4790
4958
  const [activeProbabilityMode, setActiveProbabilityMode] = (0, import_react8.useState)("yes");
4791
4959
  const probabilityModeConfigs = (0, import_react8.useMemo)(() => {
@@ -4854,105 +5022,71 @@ var EventListItemDetailsGraphSection = ({
4854
5022
  no: buildModeData("no")
4855
5023
  };
4856
5024
  }, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
4857
- const allOutcomesForHistory = (0, import_react8.useMemo)(() => {
4858
- const outcomeByModeAndId = /* @__PURE__ */ new Map();
4859
- probabilityModeOrder.forEach((mode) => {
4860
- selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
4861
- outcomeByModeAndId.set(
4862
- `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
4863
- outcomeByVenue
4864
- );
4865
- });
4866
- });
4867
- return [...outcomeByModeAndId.values()];
4868
- }, [selectedOutcomesByMode]);
4869
- const priceHistoryGroups = (0, import_react8.useMemo)(() => {
4870
- return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
4871
- }, [allOutcomesForHistory, canonicalMarketId]);
4872
5025
  const timeWindow = (0, import_react8.useMemo)(() => {
4873
5026
  return getTimeWindowByRange(selectedTimeRange);
4874
- }, [selectedTimeRange]);
4875
- const {
4876
- data: priceHistoryData,
4877
- isLoading: isPriceHistoryLoading,
4878
- error: priceHistoryError,
4879
- results: priceHistoryResults
4880
- } = (0, import_hooks17.usePriceHistory)(__spreadProps(__spreadValues({
4881
- groups: priceHistoryGroups
4882
- }, timeWindow), {
4883
- enabled: priceHistoryGroups.length > 0
4884
- }));
4885
- const priceHistoryByVenue = (0, import_react8.useMemo)(() => {
4886
- const historyByVenue = /* @__PURE__ */ new Map();
4887
- if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
4888
- return historyByVenue;
4889
- }
4890
- priceHistoryData.forEach((historyItem) => {
4891
- const venue = historyItem.venue;
4892
- const venueHistory = historyByVenue.get(venue);
4893
- if (venueHistory) {
4894
- venueHistory.push(historyItem);
4895
- return;
4896
- }
4897
- historyByVenue.set(venue, [historyItem]);
4898
- });
4899
- return historyByVenue;
4900
- }, [priceHistoryData]);
4901
- const chartSeriesByMode = (0, import_react8.useMemo)(() => {
4902
- const buildSeries = (mode) => {
4903
- const modeConfig = probabilityModeConfigs[mode];
4904
- const chartSeries = [];
4905
- normalizedVenueDataByMode[mode].forEach((venueData) => {
4906
- var _a;
4907
- const venueHistory = priceHistoryByVenue.get(venueData.venue);
4908
- if (!(venueHistory == null ? void 0 : venueHistory.length))
4909
- return;
4910
- const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
4911
- const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
4912
- if (!matchingHistory)
4913
- return;
4914
- const points = matchingHistory.points.map((point) => {
4915
- const probability = normalizeProbability(point.price);
4916
- if (probability == null || !Number.isFinite(point.timestamp))
4917
- return null;
4918
- const open = normalizeProbability(point.open);
4919
- const high = normalizeProbability(point.high);
4920
- const low = normalizeProbability(point.low);
4921
- const close = normalizeProbability(point.close);
4922
- const transformedPoint = {
4923
- time: point.timestamp,
4924
- value: clampProbability(modeConfig.transformProbability(probability)) * 100,
4925
- open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
4926
- high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
4927
- low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
4928
- close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
4929
- };
4930
- return transformedPoint;
4931
- }).filter((point) => point != null);
4932
- if (points.length === 0)
4933
- return;
4934
- chartSeries.push({
4935
- id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
4936
- venue: venueData.venue,
4937
- color: venueData.color,
4938
- points,
4939
- lineWidth: 2,
4940
- lineStyle: "solid"
4941
- });
4942
- });
4943
- return chartSeries;
4944
- };
4945
- return {
4946
- yes: buildSeries("yes"),
4947
- no: buildSeries("no")
4948
- };
4949
- }, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
5027
+ }, [selectedTimeRange]);
5028
+ const activeOutcomes = selectedOutcomesByMode[activeProbabilityMode];
5029
+ const activeCanonicalMarketId = (0, import_react8.useMemo)(() => {
5030
+ return resolveCanonicalMarketId(activeOutcomes.map((item) => item.market));
5031
+ }, [activeOutcomes]);
5032
+ const venueMarketIds = (0, import_react8.useMemo)(() => {
5033
+ return activeOutcomes.map((item) => item.market.id);
5034
+ }, [activeOutcomes]);
5035
+ const {
5036
+ data: marketChartData,
5037
+ isLoading: isMarketChartLoading,
5038
+ error: marketChartError,
5039
+ refetch: refetchMarketChart
5040
+ } = (0, import_hooks18.useMarketChart)({
5041
+ marketId: (_a = selectedMarket == null ? void 0 : selectedMarket.id) != null ? _a : null,
5042
+ venueMarketIds,
5043
+ interval: (0, import_hooks18.timeRangeToInterval)(selectedTimeRange),
5044
+ startTs: timeWindow.startTs * 1e3,
5045
+ endTs: timeWindow.endTs * 1e3,
5046
+ enabled: !!(selectedMarket == null ? void 0 : selectedMarket.id),
5047
+ live: enableLiveUpdates
5048
+ });
4950
5049
  const visibleChartSeries = (0, import_react8.useMemo)(() => {
4951
- const modeSeries = chartSeriesByMode[activeProbabilityMode];
5050
+ const transformProbability = probabilityModeConfigs[activeProbabilityMode].transformProbability;
5051
+ const colorByVenue = new Map(
5052
+ normalizedVenueDataByMode[activeProbabilityMode].map((venueData) => [
5053
+ venueData.venue,
5054
+ venueData.color
5055
+ ])
5056
+ );
5057
+ const series = resolveMarketChartVenueSeries({
5058
+ chartData: marketChartData,
5059
+ transformProbability
5060
+ }).map((seriesItem) => {
5061
+ var _a2;
5062
+ const resolvedVenue = seriesItem.venue;
5063
+ return {
5064
+ id: `${activeProbabilityMode}-${resolvedVenue}-${activeCanonicalMarketId != null ? activeCanonicalMarketId : "chart"}`,
5065
+ venue: resolvedVenue,
5066
+ color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
5067
+ points: seriesItem.points,
5068
+ lineWidth: 2,
5069
+ lineStyle: "solid"
5070
+ };
5071
+ });
4952
5072
  if (!selectedVenue)
4953
- return modeSeries;
4954
- return modeSeries.filter((seriesItem) => seriesItem.venue === selectedVenue);
4955
- }, [activeProbabilityMode, chartSeriesByMode, selectedVenue]);
5073
+ return series;
5074
+ return series.filter((seriesItem) => seriesItem.venue === selectedVenue);
5075
+ }, [
5076
+ activeCanonicalMarketId,
5077
+ activeProbabilityMode,
5078
+ marketChartData,
5079
+ normalizedVenueDataByMode,
5080
+ probabilityModeConfigs,
5081
+ selectedVenue
5082
+ ]);
5083
+ const chartLiveState = (0, import_react8.useMemo)(() => {
5084
+ return resolveMarketChartLiveState({
5085
+ chartData: marketChartData,
5086
+ selectedVenue,
5087
+ transformProbability: probabilityModeConfigs[activeProbabilityMode].transformProbability
5088
+ });
5089
+ }, [activeProbabilityMode, marketChartData, probabilityModeConfigs, selectedVenue]);
4956
5090
  const segmentedDisplayItems = (0, import_react8.useMemo)(() => {
4957
5091
  return probabilityModeOrder.map((mode) => {
4958
5092
  const averageProbability = resolveAverageProbability(
@@ -4990,48 +5124,41 @@ var EventListItemDetailsGraphSection = ({
4990
5124
  return venue;
4991
5125
  });
4992
5126
  };
4993
- const handleRetryPriceHistory = () => {
4994
- void Promise.all(priceHistoryResults.map((result) => result.refetch()));
5127
+ const handleRetryMarketChart = () => {
5128
+ void refetchMarketChart();
4995
5129
  };
4996
- if (priceHistoryError) {
4997
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4998
- "div",
5130
+ if (marketChartError) {
5131
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: cn("w-full", classNames == null ? void 0 : classNames.chart), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5132
+ StateMessage,
4999
5133
  {
5000
- className: cn(
5001
- "w-full rounded-agg-xl border border-agg-separator bg-agg-secondary",
5002
- classNames == null ? void 0 : classNames.chart
5003
- ),
5004
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5005
- StateMessage,
5006
- {
5007
- ariaLabel: labels.eventItemDetails.chartUnavailableAria,
5008
- tone: "warning",
5009
- title: labels.eventItemDetails.chartUnavailableTitle,
5010
- description: labels.eventItemDetails.chartUnavailableDescription,
5011
- actionLabel: labels.common.retry,
5012
- onAction: handleRetryPriceHistory,
5013
- className: "min-h-[300px] px-5 py-10 md:px-10"
5014
- }
5015
- )
5134
+ tone: "warning",
5135
+ ariaLabel: labels.eventItemDetails.chartUnavailableAria,
5136
+ title: labels.eventItemDetails.chartUnavailableTitle,
5137
+ description: labels.eventItemDetails.chartUnavailableDescription,
5138
+ actionLabel: labels.common.retry,
5139
+ onAction: handleRetryMarketChart,
5140
+ className: "min-h-[300px] px-5 py-10 md:px-10"
5016
5141
  }
5017
- );
5142
+ ) });
5018
5143
  }
5019
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5144
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5020
5145
  LineChart,
5021
5146
  {
5022
5147
  classNames: { root: classNames == null ? void 0 : classNames.chart },
5023
5148
  series: visibleChartSeries,
5024
5149
  height: 300,
5025
- isLoading: isPriceHistoryLoading,
5150
+ isLoading: isMarketChartLoading,
5026
5151
  chartType: selectedChartType,
5152
+ liveCandle: selectedChartType === "candlestick" ? (_b = chartLiveState.liveCandle) != null ? _b : void 0 : void 0,
5153
+ lineValue: chartLiveState.lineValue,
5027
5154
  showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
5028
5155
  renderSeriesControls: () => {
5029
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
5156
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
5030
5157
  "div",
5031
5158
  {
5032
5159
  className: cn("flex flex-row items-center justify-between gap-4", classNames == null ? void 0 : classNames.summary),
5033
5160
  children: [
5034
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5161
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5035
5162
  "div",
5036
5163
  {
5037
5164
  className: cn(
@@ -5039,10 +5166,10 @@ var EventListItemDetailsGraphSection = ({
5039
5166
  classNames == null ? void 0 : classNames.outcomeBadges
5040
5167
  ),
5041
5168
  children: activeModeVenueData.map((venueData) => {
5042
- var _a;
5169
+ var _a2;
5043
5170
  const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
5044
5171
  const isActiveVenue = selectedVenue === venueData.venue;
5045
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5172
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5046
5173
  "button",
5047
5174
  {
5048
5175
  type: "button",
@@ -5051,19 +5178,19 @@ var EventListItemDetailsGraphSection = ({
5051
5178
  className: cn(
5052
5179
  "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"
5053
5180
  ),
5054
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5181
+ children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5055
5182
  Badge,
5056
5183
  {
5057
5184
  text,
5058
5185
  size: "large",
5059
- prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5186
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5060
5187
  VenueLogo,
5061
5188
  {
5062
5189
  venue: venueData.venue,
5063
5190
  size: "small",
5064
- title: (_a = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a.label
5191
+ title: (_a2 = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a2.label
5065
5192
  }
5066
- ) : void 0,
5193
+ ),
5067
5194
  classNames: {
5068
5195
  root: cn("h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6")
5069
5196
  },
@@ -5081,7 +5208,7 @@ var EventListItemDetailsGraphSection = ({
5081
5208
  })
5082
5209
  }
5083
5210
  ),
5084
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5211
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5085
5212
  SwitchButton,
5086
5213
  {
5087
5214
  ariaLabel: labels.eventItemDetails.outcomeSelectorAria,
@@ -5104,45 +5231,55 @@ var EventListItemDetailsGraphSection = ({
5104
5231
  };
5105
5232
  var EventListItemDetailsContent = ({
5106
5233
  event,
5107
- title,
5108
- image,
5109
- showVenueLogo = true,
5110
5234
  classNames,
5111
5235
  venueInfo,
5112
5236
  detailsStats,
5113
5237
  ariaLabel,
5114
- defaultTimeRange
5238
+ defaultTimeRange,
5239
+ onClick
5115
5240
  }) => {
5116
- const config = (0, import_hooks17.useSdkUiConfig)();
5117
- const labels = (0, import_hooks17.useLabels)();
5241
+ var _a;
5242
+ const config = (0, import_hooks18.useSdkUiConfig)();
5243
+ const labels = (0, import_hooks18.useLabels)();
5118
5244
  const venueMarkets = (0, import_react8.useMemo)(() => {
5119
- var _a;
5120
- return (_a = event.venueMarkets) != null ? _a : [];
5245
+ var _a2;
5246
+ return (_a2 = event.venueMarkets) != null ? _a2 : [];
5121
5247
  }, [event.venueMarkets]);
5248
+ const [selectedMarket, setSelectedMarket] = (0, import_react8.useState)(venueMarkets[0]);
5249
+ const [selectedOutcome] = (0, import_react8.useState)(
5250
+ (_a = selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes.find(
5251
+ (outcome) => outcome.winner
5252
+ )) != null ? _a : selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes[0]
5253
+ );
5122
5254
  const primaryVenueMarket = (0, import_react8.useMemo)(() => {
5123
5255
  return selectPrimaryVenueMarket(venueMarkets);
5124
5256
  }, [venueMarkets]);
5257
+ const filteredVenueMarkets = (0, import_react8.useMemo)(() => {
5258
+ if (!selectedMarket)
5259
+ return venueMarkets;
5260
+ return venueMarkets.filter(
5261
+ (vm) => vm.question === (selectedMarket == null ? void 0 : selectedMarket.question)
5262
+ );
5263
+ }, [venueMarkets, selectedMarket]);
5125
5264
  const outcomeLabels = (0, import_react8.useMemo)(() => {
5126
- return resolveOutcomeLabels(venueMarkets);
5127
- }, [venueMarkets]);
5265
+ return resolveOutcomeLabels(filteredVenueMarkets);
5266
+ }, [filteredVenueMarkets]);
5128
5267
  const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react8.useState)(() => {
5129
5268
  return resolveDefaultOutcomeLabel(outcomeLabels);
5130
5269
  });
5270
+ const configTimeRange = config.chart.defaultChartTimeRange;
5131
5271
  const [selectedTimeRange, setSelectedTimeRange] = (0, import_react8.useState)(() => {
5132
- return getDefaultSelectedTimeRange(defaultTimeRange);
5272
+ return getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange);
5133
5273
  });
5134
5274
  const [selectedChartType, setSelectedChartType] = (0, import_react8.useState)("line");
5135
5275
  (0, import_react8.useEffect)(() => {
5136
- setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
5137
- }, [defaultTimeRange]);
5138
- const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
5139
- const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
5276
+ setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange));
5277
+ }, [defaultTimeRange, configTimeRange]);
5140
5278
  const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
5141
- const outcomeSelectorLabels = outcomeLabels;
5142
5279
  const probabilityByLabel = (0, import_react8.useMemo)(() => {
5143
5280
  return new Map(
5144
5281
  outcomeLabels.map((label) => {
5145
- const outcomesByVenue = resolveOutcomesByVenue(venueMarkets, label);
5282
+ const outcomesByVenue = resolveOutcomesByVenue(filteredVenueMarkets, label);
5146
5283
  const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
5147
5284
  if (probabilities.length === 0) {
5148
5285
  return [label, void 0];
@@ -5151,13 +5288,13 @@ var EventListItemDetailsContent = ({
5151
5288
  return [label, averageProbability];
5152
5289
  })
5153
5290
  );
5154
- }, [outcomeLabels, venueMarkets]);
5291
+ }, [outcomeLabels, filteredVenueMarkets]);
5155
5292
  const mainOutcomeLabel = (0, import_react8.useMemo)(() => {
5156
5293
  if (outcomeLabels.length === 0)
5157
5294
  return void 0;
5158
5295
  return [...outcomeLabels].sort((left, right) => {
5159
- var _a, _b;
5160
- const leftProbability = (_a = probabilityByLabel.get(left)) != null ? _a : -1;
5296
+ var _a2, _b;
5297
+ const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
5161
5298
  const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
5162
5299
  return rightProbability - leftProbability;
5163
5300
  })[0];
@@ -5174,17 +5311,17 @@ var EventListItemDetailsContent = ({
5174
5311
  setSelectedOutcomeLabel(fallbackOutcomeLabel);
5175
5312
  }, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
5176
5313
  const switchLabels = (0, import_react8.useMemo)(() => {
5177
- var _a, _b;
5314
+ var _a2, _b;
5178
5315
  if (isDateOutcomeMarket) {
5179
5316
  return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
5180
5317
  }
5181
5318
  const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
5182
- var _a2, _b2;
5183
- const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
5319
+ var _a3, _b2;
5320
+ const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
5184
5321
  const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
5185
5322
  return rightProbability - leftProbability;
5186
5323
  });
5187
- const firstLabel = (_a = sortedOutcomeLabels[0]) != null ? _a : labels.eventItemDetails.yes;
5324
+ const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
5188
5325
  const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
5189
5326
  return [firstLabel, secondLabel];
5190
5327
  }, [
@@ -5195,40 +5332,50 @@ var EventListItemDetailsContent = ({
5195
5332
  probabilityByLabel
5196
5333
  ]);
5197
5334
  const volumeLabel = (0, import_react8.useMemo)(() => {
5198
- var _a;
5199
- const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
5335
+ var _a2;
5336
+ const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a2 = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a2 : void 0;
5200
5337
  if (typeof resolvedVolume !== "number")
5201
5338
  return "";
5202
- return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
5339
+ return `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
5203
5340
  }, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
5204
5341
  if (!primaryVenueMarket || !selectedOutcomeLabel) {
5205
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsUnavailableState, { classNames, ariaLabel });
5342
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5343
+ EventListItemDetailsUnavailableState,
5344
+ {
5345
+ classNames,
5346
+ ariaLabel: ariaLabel != null ? ariaLabel : event.title
5347
+ }
5348
+ );
5206
5349
  }
5207
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
5350
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
5208
5351
  Card,
5209
5352
  {
5210
5353
  className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
5211
- "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
5354
+ "aria-label": ariaLabel != null ? ariaLabel : event.title,
5355
+ onClick: () => {
5356
+ onClick == null ? void 0 : onClick(event);
5357
+ },
5212
5358
  children: [
5213
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
5359
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
5214
5360
  "div",
5215
5361
  {
5216
5362
  className: cn(
5217
5363
  "flex flex-row gap-3 md:gap-4",
5218
- "items-center justify-start",
5364
+ venueMarkets.length > 1 ? "items-start" : "items-center",
5365
+ "justify-start",
5219
5366
  classNames == null ? void 0 : classNames.header
5220
5367
  ),
5221
5368
  children: [
5222
- resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5369
+ event.image ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5223
5370
  RemoteImage,
5224
5371
  {
5225
- src: resolvedImage,
5372
+ src: event.image,
5226
5373
  alt: "",
5227
5374
  className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
5228
5375
  }
5229
5376
  ) : null,
5230
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
5231
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5377
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
5378
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5232
5379
  Typography,
5233
5380
  {
5234
5381
  variant: "body-strong",
@@ -5237,20 +5384,19 @@ var EventListItemDetailsContent = ({
5237
5384
  "truncate text-wrap wrap-break-word line-clamp-2",
5238
5385
  classNames == null ? void 0 : classNames.title
5239
5386
  ),
5240
- children: resolvedTitle
5387
+ children: event.title
5241
5388
  }
5242
5389
  ),
5243
- outcomeSelectorLabels.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5390
+ venueMarkets.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5244
5391
  "div",
5245
5392
  {
5246
5393
  className: cn(
5247
- "flex items-center gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
5394
+ "flex flex-row flex-nowrap items-center gap-2 overflow-x-auto pb-1 md:pb-0",
5248
5395
  classNames == null ? void 0 : classNames.headerPills
5249
5396
  ),
5250
- children: outcomeSelectorLabels.map((outcomeSelectorLabel) => {
5251
- const isActive = outcomeSelectorLabel === selectedOutcomeLabel;
5252
- const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
5253
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5397
+ children: venueMarkets.map((venueMarket) => {
5398
+ const isActive = (selectedMarket == null ? void 0 : selectedMarket.id) === venueMarket.id;
5399
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5254
5400
  Button,
5255
5401
  {
5256
5402
  size: "small",
@@ -5261,10 +5407,14 @@ var EventListItemDetailsContent = ({
5261
5407
  "border-2",
5262
5408
  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"
5263
5409
  ),
5264
- onClick: () => setSelectedOutcomeLabel(outcomeSelectorLabel),
5265
- children: displayLabel
5410
+ onClick: (e) => {
5411
+ e.stopPropagation();
5412
+ e.preventDefault();
5413
+ setSelectedMarket(venueMarket);
5414
+ },
5415
+ children: venueMarket.question
5266
5416
  },
5267
- outcomeSelectorLabel
5417
+ venueMarket.id
5268
5418
  );
5269
5419
  })
5270
5420
  }
@@ -5273,12 +5423,12 @@ var EventListItemDetailsContent = ({
5273
5423
  ]
5274
5424
  }
5275
5425
  ),
5276
- detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
5426
+ detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
5277
5427
  const deltaClassName = statItem.deltaTone === "positive" ? "text-agg-success!" : statItem.deltaTone === "negative" ? "text-agg-error!" : "text-agg-muted-foreground";
5278
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-col gap-1", children: [
5279
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "caption-caps", className: "text-agg-muted-foreground", children: statItem.label }),
5280
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-baseline gap-1", children: [
5281
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5428
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-1", children: [
5429
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "caption-caps", className: "text-agg-muted-foreground", children: statItem.label }),
5430
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-baseline gap-1", children: [
5431
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5282
5432
  Typography,
5283
5433
  {
5284
5434
  variant: "body",
@@ -5286,35 +5436,35 @@ var EventListItemDetailsContent = ({
5286
5436
  children: statItem.value
5287
5437
  }
5288
5438
  ),
5289
- statItem.delta ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "label", className: cn(deltaClassName), children: statItem.delta }) : null
5439
+ statItem.delta ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "label", className: cn(deltaClassName), children: statItem.delta }) : null
5290
5440
  ] })
5291
5441
  ] }, `${statItem.label}-${statItem.value}`);
5292
5442
  }) }) : null,
5293
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5443
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5294
5444
  EventListItemDetailsGraphSection,
5295
5445
  {
5296
- venueMarkets,
5297
- canonicalMarketId: event.id,
5446
+ selectedOutcome,
5447
+ selectedMarket,
5448
+ venueMarkets: filteredVenueMarkets,
5298
5449
  selectedOutcomeLabel,
5299
5450
  onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
5300
5451
  switchLabels,
5301
5452
  isDateOutcomeMarket,
5302
5453
  classNames,
5303
- showVenueLogo,
5304
5454
  venueInfo,
5305
- formatPercent: config.formatPercent,
5455
+ formatPercent: config.formatting.formatPercent,
5306
5456
  selectedTimeRange,
5307
5457
  selectedChartType
5308
5458
  }
5309
5459
  ),
5310
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
5311
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: volumeLabel || "-" }),
5312
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex flex-wrap items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: [
5313
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ChartTypeSwitch, { value: selectedChartType, onValueChange: setSelectedChartType }),
5314
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
5460
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
5461
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: volumeLabel || "-" }),
5462
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("flex flex-wrap items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: [
5463
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ChartTypeSwitch, { value: selectedChartType, onValueChange: setSelectedChartType }),
5464
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
5315
5465
  eventListItemDetailsTimeRanges.map((timeRange) => {
5316
5466
  const isActive = timeRange === selectedTimeRange;
5317
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5467
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5318
5468
  Button,
5319
5469
  {
5320
5470
  size: "small",
@@ -5326,7 +5476,11 @@ var EventListItemDetailsContent = ({
5326
5476
  isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
5327
5477
  ),
5328
5478
  "aria-pressed": isActive,
5329
- onClick: () => setSelectedTimeRange(timeRange),
5479
+ onClick: (e) => {
5480
+ e.stopPropagation();
5481
+ e.preventDefault();
5482
+ setSelectedTimeRange(timeRange);
5483
+ },
5330
5484
  children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
5331
5485
  },
5332
5486
  timeRange
@@ -5344,20 +5498,21 @@ var EventListItemDetailsByEventId = (_a) => {
5344
5498
  } = _b, rest = __objRest(_b, [
5345
5499
  "eventId"
5346
5500
  ]);
5501
+ const resolvedEventId = eventId != null ? eventId : "";
5347
5502
  const {
5348
5503
  event: fetchedEvent,
5349
5504
  error,
5350
5505
  isError,
5351
5506
  isLoading
5352
- } = (0, import_hooks17.useVenueEvent)({
5353
- eventId: eventId != null ? eventId : "",
5354
- enabled: !!eventId
5507
+ } = (0, import_hooks18.useVenueEvent)({
5508
+ eventId: resolvedEventId,
5509
+ enabled: !!resolvedEventId
5355
5510
  });
5356
5511
  const resolvedEvent = (0, import_react8.useMemo)(() => {
5357
5512
  return resolveEventListItemEvent(fetchedEvent);
5358
5513
  }, [fetchedEvent]);
5359
- if (!eventId) {
5360
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5514
+ if (!resolvedEventId) {
5515
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5361
5516
  EventListItemDetailsUnavailableState,
5362
5517
  {
5363
5518
  classNames: rest.classNames,
@@ -5366,16 +5521,16 @@ var EventListItemDetailsByEventId = (_a) => {
5366
5521
  );
5367
5522
  }
5368
5523
  if (isLoading) {
5369
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
5524
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
5370
5525
  }
5371
5526
  if (isErrorWithStatus(error, 404)) {
5372
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
5527
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
5373
5528
  }
5374
5529
  if (!fetchedEvent && !isError) {
5375
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
5530
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
5376
5531
  }
5377
5532
  if (!resolvedEvent) {
5378
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5533
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5379
5534
  EventListItemDetailsUnavailableState,
5380
5535
  {
5381
5536
  classNames: rest.classNames,
@@ -5383,42 +5538,38 @@ var EventListItemDetailsByEventId = (_a) => {
5383
5538
  }
5384
5539
  );
5385
5540
  }
5386
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
5541
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
5387
5542
  };
5388
5543
  var EventListItemDetails = (props) => {
5389
5544
  if (props.isLoading) {
5390
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
5545
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
5391
5546
  }
5392
5547
  if ("event" in props && props.event) {
5393
5548
  const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
5394
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsContent, __spreadValues({ event }, rest));
5549
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsContent, __spreadValues({ event }, rest));
5395
5550
  }
5396
5551
  if ("eventId" in props && typeof props.eventId === "string") {
5397
5552
  const {
5398
- title: titleOverride,
5399
- image: imageOverride,
5400
- showVenueLogo: showVenueLogoOverride,
5401
5553
  classNames,
5402
5554
  venueInfo,
5403
5555
  detailsStats,
5404
5556
  ariaLabel: ariaLabelOverride,
5405
- defaultTimeRange: defaultTimeRangeOverride
5557
+ defaultTimeRange: defaultTimeRangeOverride,
5558
+ onClick
5406
5559
  } = props;
5407
5560
  const byEventIdProps = {
5408
5561
  eventId: props.eventId,
5409
5562
  isLoading: false,
5410
- title: titleOverride,
5411
- image: imageOverride,
5412
- showVenueLogo: showVenueLogoOverride,
5413
5563
  classNames,
5414
5564
  venueInfo,
5415
5565
  detailsStats,
5416
5566
  ariaLabel: ariaLabelOverride,
5417
- defaultTimeRange: defaultTimeRangeOverride
5567
+ defaultTimeRange: defaultTimeRangeOverride,
5568
+ onClick
5418
5569
  };
5419
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
5570
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
5420
5571
  }
5421
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5572
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5422
5573
  EventListItemDetailsUnavailableState,
5423
5574
  {
5424
5575
  classNames: props.classNames,
@@ -5430,7 +5581,7 @@ EventListItemDetails.displayName = "EventListItemDetails";
5430
5581
 
5431
5582
  // src/events/market-details/index.tsx
5432
5583
  var import_react9 = require("react");
5433
- var import_hooks18 = require("@agg-market/hooks");
5584
+ var import_hooks19 = require("@agg-market/hooks");
5434
5585
 
5435
5586
  // src/events/market-details/market-details.utils.ts
5436
5587
  var import_dayjs4 = __toESM(require("dayjs"));
@@ -5461,24 +5612,29 @@ var resolveInitialTab = (defaultTab) => {
5461
5612
  return parsedTab.data;
5462
5613
  return "order-book";
5463
5614
  };
5464
- var resolveMarket = (event, marketId) => {
5465
- var _a, _b, _c, _d, _e;
5466
- if (!event.venueMarkets || event.venueMarkets.length === 0)
5615
+ var resolveMarketFromVenueMarkets = (venueMarkets, marketId) => {
5616
+ var _a, _b;
5617
+ if (!venueMarkets || venueMarkets.length === 0)
5467
5618
  return void 0;
5468
5619
  if (!marketId) {
5620
+ const primary = selectPrimaryVenueMarket(venueMarkets);
5621
+ const totalVolume2 = venueMarkets.reduce((sum, vm) => {
5622
+ return sum + (typeof vm.volume === "number" ? vm.volume : 0);
5623
+ }, 0);
5469
5624
  return {
5470
- id: event.id,
5471
- venueMarkets: event.venueMarkets,
5472
- volume: event.volume,
5473
- status: event.status,
5474
- startDate: event.startDate,
5475
- endDate: event.endDate,
5476
- creationDate: event.creationDate,
5477
- question: event.title
5625
+ id: (_a = primary == null ? void 0 : primary.id) != null ? _a : venueMarkets[0].id,
5626
+ venueMarkets,
5627
+ volume: totalVolume2 || (primary == null ? void 0 : primary.volume),
5628
+ status: primary == null ? void 0 : primary.status,
5629
+ startDate: primary == null ? void 0 : primary.startDate,
5630
+ endDate: primary == null ? void 0 : primary.endDate,
5631
+ creationDate: primary == null ? void 0 : primary.creationDate,
5632
+ question: (_b = primary == null ? void 0 : primary.question) != null ? _b : venueMarkets[0].question
5478
5633
  };
5479
5634
  }
5480
- const venueMarkets = event.venueMarkets;
5481
- const matchedVenueMarket = venueMarkets.find((vm) => vm.id === marketId);
5635
+ const matchedVenueMarket = venueMarkets.find(
5636
+ (vm) => vm.id === marketId || vm.externalIdentifier === marketId
5637
+ );
5482
5638
  if (!matchedVenueMarket)
5483
5639
  return void 0;
5484
5640
  const siblingVenueMarkets = venueMarkets.filter(
@@ -5491,11 +5647,11 @@ var resolveMarket = (event, marketId) => {
5491
5647
  id: matchedVenueMarket.id,
5492
5648
  venueMarkets: siblingVenueMarkets,
5493
5649
  volume: totalVolume || matchedVenueMarket.volume,
5494
- status: (_a = matchedVenueMarket.status) != null ? _a : event.status,
5495
- startDate: (_b = matchedVenueMarket.startDate) != null ? _b : event.startDate,
5496
- endDate: (_c = matchedVenueMarket.endDate) != null ? _c : event.endDate,
5497
- creationDate: (_d = matchedVenueMarket.creationDate) != null ? _d : event.creationDate,
5498
- question: (_e = matchedVenueMarket.question) != null ? _e : event.title
5650
+ status: matchedVenueMarket.status,
5651
+ startDate: matchedVenueMarket.startDate,
5652
+ endDate: matchedVenueMarket.endDate,
5653
+ creationDate: matchedVenueMarket.creationDate,
5654
+ question: matchedVenueMarket.question
5499
5655
  };
5500
5656
  };
5501
5657
  var resolveDisplayOutcomeLabels = (labels) => {
@@ -5505,6 +5661,21 @@ var resolveDisplayOutcomeLabels = (labels) => {
5505
5661
  (label) => labels.some((value) => normalizeLabel2(value) === normalizeLabel2(label))
5506
5662
  );
5507
5663
  };
5664
+ var resolveMarketDetailsOutcomeLabels = (venueMarkets) => {
5665
+ var _a;
5666
+ const primaryMarket = selectPrimaryVenueMarket(venueMarkets);
5667
+ const initialLabels = ((_a = primaryMarket == null ? void 0 : primaryMarket.venueMarketOutcomes) != null ? _a : []).map((outcome) => outcome.label.trim()).filter(Boolean);
5668
+ const labels = new Set(initialLabels);
5669
+ venueMarkets.forEach((market) => {
5670
+ sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
5671
+ const label = outcome.label.trim();
5672
+ if (!label)
5673
+ return;
5674
+ labels.add(label);
5675
+ });
5676
+ });
5677
+ return [...labels];
5678
+ };
5508
5679
  var resolveInitialOutcomeLabel = (labels, defaultOutcomeLabel) => {
5509
5680
  var _a;
5510
5681
  if (labels.length === 0)
@@ -5556,7 +5727,7 @@ var resolveOutcomeTone = (label, index) => {
5556
5727
  return index === 0 ? "positive" : "negative";
5557
5728
  };
5558
5729
  var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
5559
- const labels = resolveDisplayOutcomeLabels(resolveOutcomeLabels(venueMarkets));
5730
+ const labels = resolveDisplayOutcomeLabels(resolveMarketDetailsOutcomeLabels(venueMarkets));
5560
5731
  const probabilityByLabel = resolveAverageProbabilityByLabel(venueMarkets, labels);
5561
5732
  return labels.slice(0, 2).map((label, index) => {
5562
5733
  var _a;
@@ -5564,7 +5735,8 @@ var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
5564
5735
  label,
5565
5736
  probability: probabilityByLabel.get(label),
5566
5737
  tone: resolveOutcomeTone(label, index),
5567
- isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : "")
5738
+ isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : ""),
5739
+ venue: venueMarkets[0].venue
5568
5740
  };
5569
5741
  });
5570
5742
  };
@@ -5655,30 +5827,32 @@ var resolveOtherTabRows = (market, labels) => {
5655
5827
  return rows;
5656
5828
  };
5657
5829
  var buildMarketDetailsModel = ({
5658
- event,
5830
+ venueMarkets,
5659
5831
  marketId,
5660
5832
  title,
5661
5833
  image,
5662
5834
  formatCompactCurrency,
5663
5835
  labels
5664
5836
  }) => {
5665
- var _a;
5666
- const market = resolveMarket(event, marketId);
5837
+ var _a, _b;
5838
+ const market = resolveMarketFromVenueMarkets(venueMarkets, marketId);
5667
5839
  if (!market)
5668
5840
  return void 0;
5669
5841
  const primaryVenueMarket = selectPrimaryVenueMarket(market.venueMarkets);
5670
5842
  if (!primaryVenueMarket)
5671
5843
  return void 0;
5672
- const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
5673
- const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
5674
- const resolvedVolume = typeof market.volume === "number" ? market.volume : (_a = primaryVenueMarket.volume) != null ? _a : void 0;
5844
+ const resolvedTitle = (title == null ? void 0 : title.trim()) || primaryVenueMarket.question || market.question;
5845
+ const resolvedImage = (_a = typeof image === "string" && image.trim() ? image : void 0) != null ? _a : typeof primaryVenueMarket.image === "string" && primaryVenueMarket.image.trim() ? primaryVenueMarket.image : void 0;
5846
+ const resolvedVolume = typeof market.volume === "number" ? market.volume : (_b = primaryVenueMarket.volume) != null ? _b : void 0;
5675
5847
  const subtitle = resolveSubtitle({
5676
5848
  venueMarkets: market.venueMarkets,
5677
5849
  volume: resolvedVolume,
5678
5850
  formatCompactCurrency,
5679
5851
  labels
5680
5852
  });
5681
- const outcomeLabels = resolveDisplayOutcomeLabels(resolveOutcomeLabels(market.venueMarkets));
5853
+ const outcomeLabels = resolveDisplayOutcomeLabels(
5854
+ resolveMarketDetailsOutcomeLabels(market.venueMarkets)
5855
+ );
5682
5856
  const probabilityByLabel = resolveAverageProbabilityByLabel(market.venueMarkets, outcomeLabels);
5683
5857
  return {
5684
5858
  market,
@@ -5692,14 +5866,14 @@ var buildMarketDetailsModel = ({
5692
5866
  };
5693
5867
 
5694
5868
  // src/events/market-details/index.tsx
5695
- var import_jsx_runtime79 = require("react/jsx-runtime");
5869
+ var import_jsx_runtime80 = require("react/jsx-runtime");
5696
5870
  var MarketDetailsLoadingState = ({
5697
5871
  isOpened = marketDetailsDefaultIsOpened,
5698
5872
  ariaLabel,
5699
5873
  classNames
5700
5874
  }) => {
5701
- const labels = (0, import_hooks18.useLabels)();
5702
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5875
+ const labels = (0, import_hooks19.useLabels)();
5876
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5703
5877
  Skeleton,
5704
5878
  {
5705
5879
  view: isOpened ? "market-details-detailed" : "market-details-minified",
@@ -5712,16 +5886,16 @@ var MarketDetailsUnavailableState = ({
5712
5886
  ariaLabel,
5713
5887
  classNames
5714
5888
  }) => {
5715
- const labels = (0, import_hooks18.useLabels)();
5716
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5889
+ const labels = (0, import_hooks19.useLabels)();
5890
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5717
5891
  Card,
5718
5892
  {
5719
5893
  className: cn(marketDetailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
5720
5894
  role: "status",
5721
5895
  "aria-label": ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
5722
- children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-1 p-5", children: [
5723
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.unavailableTitle }),
5724
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.marketDetails.unavailableDescription })
5896
+ children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col gap-1 p-5", children: [
5897
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.unavailableTitle }),
5898
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.marketDetails.unavailableDescription })
5725
5899
  ] })
5726
5900
  }
5727
5901
  );
@@ -5730,8 +5904,8 @@ var MarketDetailsNotFoundState = ({
5730
5904
  ariaLabel,
5731
5905
  classNames
5732
5906
  }) => {
5733
- const labels = (0, import_hooks18.useLabels)();
5734
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5907
+ const labels = (0, import_hooks19.useLabels)();
5908
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5735
5909
  StateMessage,
5736
5910
  {
5737
5911
  ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
@@ -5748,7 +5922,7 @@ var OrderBookRows = ({
5748
5922
  formatCurrency,
5749
5923
  visibleRows
5750
5924
  }) => {
5751
- const labels = (0, import_hooks18.useLabels)();
5925
+ const labels = (0, import_hooks19.useLabels)();
5752
5926
  const isAsks = title === labels.marketDetails.asks;
5753
5927
  const priceClassName = isAsks ? "text-agg-orderbook-ask" : "text-agg-orderbook-bid";
5754
5928
  const barClassName = isAsks ? "bg-agg-orderbook-ask/10" : "bg-agg-orderbook-bid/10";
@@ -5757,20 +5931,20 @@ var OrderBookRows = ({
5757
5931
  const orderBookDividerHeightPx = 1;
5758
5932
  const orderBookRowGapPx = 8;
5759
5933
  const orderBookVisibleHeightPx = maxVisibleRows * orderBookRowHeightPx + Math.max(0, maxVisibleRows - 1) * (orderBookDividerHeightPx + orderBookRowGapPx);
5760
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-2", children: [
5761
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "caption-caps", children: title }),
5762
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5934
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col gap-2", children: [
5935
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { variant: "caption-caps", children: title }),
5936
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5763
5937
  "div",
5764
5938
  {
5765
5939
  className: "overflow-y-auto pr-1 flex flex-col gap-2",
5766
5940
  style: { maxHeight: `${orderBookVisibleHeightPx}px` },
5767
5941
  role: "region",
5768
5942
  "aria-label": `${title} order book levels`,
5769
- children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-2", children: [
5770
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("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: [
5771
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-1 md:gap-3", children: [
5772
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(VenueLogo, { venue: row.venue, size: "small" }),
5773
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5943
+ children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col gap-2", children: [
5944
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("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: [
5945
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center gap-1 md:gap-3", children: [
5946
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(VenueLogo, { venue: row.venue, size: "small" }),
5947
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5774
5948
  "span",
5775
5949
  {
5776
5950
  className: cn(
@@ -5781,9 +5955,9 @@ var OrderBookRows = ({
5781
5955
  }
5782
5956
  )
5783
5957
  ] }),
5784
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("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) }),
5785
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("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) }),
5786
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5958
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("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) }),
5959
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("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) }),
5960
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5787
5961
  "div",
5788
5962
  {
5789
5963
  "aria-hidden": "true",
@@ -5794,7 +5968,7 @@ var OrderBookRows = ({
5794
5968
  }
5795
5969
  ) })
5796
5970
  ] }),
5797
- index < rows.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null
5971
+ index < rows.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null
5798
5972
  ] }, row.id))
5799
5973
  }
5800
5974
  )
@@ -5808,7 +5982,7 @@ var getOutcomeButtonClassName = ({
5808
5982
  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";
5809
5983
  const activeStateClassName = isPositive ? "border-transparent bg-[#18c15c] text-agg-on-primary" : "border-transparent bg-[#e5455f] text-agg-on-primary";
5810
5984
  return cn(
5811
- "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]",
5985
+ "h-auto 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]",
5812
5986
  getMotionClassName(enableAnimations, "transition-all duration-300 ease-in-out"),
5813
5987
  isActive ? activeStateClassName : defaultStateClassName,
5814
5988
  "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",
@@ -5817,63 +5991,67 @@ var getOutcomeButtonClassName = ({
5817
5991
  );
5818
5992
  };
5819
5993
  var MarketDetailsContent = ({
5820
- event,
5994
+ venueMarkets,
5821
5995
  marketId,
5822
5996
  title,
5823
5997
  image,
5824
- isOpened: defaultIsOpened = marketDetailsDefaultIsOpened,
5998
+ isOpened: controlledIsOpened = marketDetailsDefaultIsOpened,
5825
5999
  onOpenChange,
5826
6000
  defaultTab,
5827
6001
  defaultOutcomeLabel,
5828
- defaultTimeRange = "1M",
6002
+ defaultTimeRange,
5829
6003
  orderBookDepth = orderBookRowLimitDefault,
5830
6004
  ariaLabel,
5831
6005
  classNames,
5832
- otherContent,
5833
- liveUpdate = false
6006
+ otherContent
5834
6007
  }) => {
5835
- const config = (0, import_hooks18.useSdkUiConfig)();
5836
- const labels = (0, import_hooks18.useLabels)();
6008
+ var _a, _b, _c, _d;
6009
+ const config = (0, import_hooks19.useSdkUiConfig)();
6010
+ const labels = (0, import_hooks19.useLabels)();
5837
6011
  const detailsContentId = (0, import_react9.useId)();
5838
6012
  const model = (0, import_react9.useMemo)(() => {
5839
6013
  return buildMarketDetailsModel({
5840
- event,
6014
+ venueMarkets,
5841
6015
  marketId,
5842
6016
  title,
5843
6017
  image,
5844
- formatCompactCurrency: config.formatCompactCurrency,
6018
+ formatCompactCurrency: config.formatting.formatCompactCurrency,
5845
6019
  labels
5846
6020
  });
5847
- }, [config.formatCompactCurrency, event, image, labels, marketId, title]);
6021
+ }, [config.formatting.formatCompactCurrency, venueMarkets, image, labels, marketId, title]);
5848
6022
  const resolvedMarket = (0, import_react9.useMemo)(() => {
5849
- return resolveMarket(event, marketId);
5850
- }, [event, marketId]);
6023
+ return resolveMarketFromVenueMarkets(venueMarkets, marketId);
6024
+ }, [venueMarkets, marketId]);
5851
6025
  const marketDetailsTabs = (0, import_react9.useMemo)(() => {
5852
6026
  return getMarketDetailsTabs(labels);
5853
6027
  }, [labels]);
5854
6028
  const [selectedTab, setSelectedTab] = (0, import_react9.useState)(
5855
6029
  () => resolveInitialTab(defaultTab)
5856
6030
  );
5857
- const [isOpened, setIsOpened] = (0, import_react9.useState)(defaultIsOpened);
6031
+ const [isOpened, setIsOpened] = (0, import_react9.useState)(controlledIsOpened);
5858
6032
  (0, import_react9.useEffect)(() => {
5859
6033
  setSelectedTab(resolveInitialTab(defaultTab));
5860
6034
  }, [defaultTab]);
5861
- const [selectedTimeRange, setSelectedTimeRange] = (0, import_react9.useState)(defaultTimeRange);
6035
+ (0, import_react9.useEffect)(() => {
6036
+ setIsOpened(controlledIsOpened);
6037
+ }, [controlledIsOpened]);
6038
+ const resolvedDefaultTimeRange = (_a = defaultTimeRange != null ? defaultTimeRange : config.chart.defaultChartTimeRange) != null ? _a : "1D";
6039
+ const [selectedTimeRange, setSelectedTimeRange] = (0, import_react9.useState)(resolvedDefaultTimeRange);
5862
6040
  const [selectedChartType, setSelectedChartType] = (0, import_react9.useState)("line");
5863
6041
  (0, import_react9.useEffect)(() => {
5864
- setSelectedTimeRange(defaultTimeRange);
5865
- }, [defaultTimeRange]);
6042
+ setSelectedTimeRange(resolvedDefaultTimeRange);
6043
+ }, [resolvedDefaultTimeRange]);
5866
6044
  const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react9.useState)(
5867
6045
  () => {
5868
- var _a;
5869
- return resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel);
6046
+ var _a2;
6047
+ return resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel);
5870
6048
  }
5871
6049
  );
5872
6050
  const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react9.useState)(null);
5873
6051
  (0, import_react9.useEffect)(() => {
5874
- var _a;
6052
+ var _a2;
5875
6053
  setSelectedOutcomeLabel(
5876
- resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel)
6054
+ resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel)
5877
6055
  );
5878
6056
  }, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
5879
6057
  const headerOutcomeItems = (0, import_react9.useMemo)(() => {
@@ -5900,52 +6078,66 @@ var MarketDetailsContent = ({
5900
6078
  return outcomesByLabelMap;
5901
6079
  }, [headerOutcomeItems, model]);
5902
6080
  const selectedOutcomesByVenue = (0, import_react9.useMemo)(() => {
5903
- var _a;
6081
+ var _a2;
5904
6082
  if (!selectedOutcomeLabel)
5905
6083
  return [];
5906
- return (_a = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a : [];
6084
+ return (_a2 = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a2 : [];
5907
6085
  }, [outcomesByLabel, selectedOutcomeLabel]);
6086
+ const chartEnabled = isOpened && selectedTab === "graph";
6087
+ const orderBookEnabled = isOpened && selectedTab === "order-book";
5908
6088
  const timeWindow = (0, import_react9.useMemo)(() => {
5909
6089
  return getTimeWindowByRange(selectedTimeRange);
5910
6090
  }, [selectedTimeRange]);
5911
- const graphOutcomes = (0, import_react9.useMemo)(() => {
5912
- const uniqueOutcomesByVenueAndId = /* @__PURE__ */ new Map();
5913
- outcomesByLabel.forEach((outcomes) => {
5914
- outcomes.forEach((outcomeByVenue) => {
5915
- uniqueOutcomesByVenueAndId.set(
5916
- `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
5917
- outcomeByVenue
5918
- );
5919
- });
5920
- });
5921
- return [...uniqueOutcomesByVenueAndId.values()];
5922
- }, [outcomesByLabel]);
5923
- const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
5924
- const priceHistoryGroups = (0, import_react9.useMemo)(() => {
5925
- return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
5926
- }, [canonicalMarketIdForHistory, graphOutcomes]);
5927
- const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = (0, import_hooks18.usePriceHistory)(__spreadProps(__spreadValues({
5928
- groups: priceHistoryGroups
5929
- }, timeWindow), {
5930
- enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
5931
- }));
5932
- const orderBookInputs = (0, import_react9.useMemo)(() => {
5933
- return selectedOutcomesByVenue.map(({ market, outcome }) => ({
5934
- market,
5935
- outcome,
5936
- liveUpdate
5937
- }));
5938
- }, [selectedOutcomesByVenue, liveUpdate]);
6091
+ const primaryVenueMarketId = (_c = (_b = selectedOutcomesByVenue[0]) == null ? void 0 : _b.market.id) != null ? _c : null;
6092
+ const venueMarketIds = (0, import_react9.useMemo)(() => {
6093
+ return selectedOutcomesByVenue.map((item) => item.market.id);
6094
+ }, [selectedOutcomesByVenue]);
6095
+ const {
6096
+ data: marketChartData,
6097
+ isLoading: isMarketChartLoading,
6098
+ error: marketChartError,
6099
+ refetch: refetchMarketChart
6100
+ } = (0, import_hooks19.useMarketChart)({
6101
+ marketId: primaryVenueMarketId,
6102
+ venueMarketIds,
6103
+ interval: (0, import_hooks19.timeRangeToInterval)(selectedTimeRange),
6104
+ startTs: timeWindow.startTs * 1e3,
6105
+ endTs: timeWindow.endTs * 1e3,
6106
+ enabled: chartEnabled && !!primaryVenueMarketId
6107
+ });
5939
6108
  const {
5940
- data: orderBookData,
6109
+ data: marketOrderbookData,
5941
6110
  isLoading: isOrderBookLoading,
5942
6111
  error: orderBookError,
5943
- results: orderBookResults
5944
- } = (0, import_hooks18.useOrderBook)({
5945
- orderbooks: orderBookInputs,
5946
- enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0,
5947
- canonicalMarketId: liveUpdate ? canonicalMarketIdForHistory : void 0
6112
+ refetch: refetchOrderBook
6113
+ } = (0, import_hooks19.useMarketOrderbook)({
6114
+ marketId: primaryVenueMarketId,
6115
+ enabled: orderBookEnabled && !!primaryVenueMarketId,
6116
+ venueOutcomes: selectedOutcomesByVenue.map((item) => ({
6117
+ venue: item.market.venue,
6118
+ venueMarketOutcomeId: item.outcome.id
6119
+ }))
5948
6120
  });
6121
+ const orderBookData = (0, import_react9.useMemo)(() => {
6122
+ if (!marketOrderbookData)
6123
+ return void 0;
6124
+ const results = selectedOutcomesByVenue.flatMap(({ market, outcome }) => {
6125
+ const venueOrderbook = marketOrderbookData.venueOrderbooks[market.venue];
6126
+ if (!venueOrderbook)
6127
+ return [];
6128
+ return [
6129
+ {
6130
+ market,
6131
+ outcome,
6132
+ orderbook: {
6133
+ bids: venueOrderbook.bids,
6134
+ asks: venueOrderbook.asks
6135
+ }
6136
+ }
6137
+ ];
6138
+ });
6139
+ return results.length === selectedOutcomesByVenue.length ? results : void 0;
6140
+ }, [marketOrderbookData, selectedOutcomesByVenue]);
5949
6141
  const askRows = (0, import_react9.useMemo)(() => {
5950
6142
  return resolveOrderBookRows({
5951
6143
  data: orderBookData,
@@ -5958,78 +6150,43 @@ var MarketDetailsContent = ({
5958
6150
  side: "bids"
5959
6151
  });
5960
6152
  }, [orderBookData]);
5961
- const priceHistoryByVenue = (0, import_react9.useMemo)(() => {
5962
- const historyByVenue = /* @__PURE__ */ new Map();
5963
- if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
5964
- return historyByVenue;
5965
- }
5966
- priceHistoryData.forEach((historyItem) => {
5967
- const venue = historyItem.venue;
5968
- const venueHistory = historyByVenue.get(venue);
5969
- if (venueHistory) {
5970
- venueHistory.push(historyItem);
5971
- return;
5972
- }
5973
- historyByVenue.set(venue, [historyItem]);
5974
- });
5975
- return historyByVenue;
5976
- }, [priceHistoryData]);
5977
- const graphSeriesByOutcomeLabel = (0, import_react9.useMemo)(() => {
5978
- const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
5979
- const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
5980
- var _a, _b;
5981
- const marketWithCanonicalId = outcomeByVenue.market;
5982
- return [
5983
- outcomeByVenue.outcome.id,
5984
- (_a = outcomeByVenue.outcome.externalIdentifier) != null ? _a : void 0,
5985
- outcomeByVenue.market.externalIdentifier,
5986
- (_b = marketWithCanonicalId.marketId) != null ? _b : void 0,
5987
- canonicalMarketIdForHistory
5988
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
5989
- };
5990
- headerOutcomeItems.forEach((headerOutcomeItem) => {
5991
- var _a;
5992
- const outcomes = (_a = outcomesByLabel.get(headerOutcomeItem.label)) != null ? _a : [];
5993
- const graphSeries2 = [];
5994
- outcomes.forEach((outcomeByVenue, index) => {
5995
- var _a2;
5996
- const venueHistory = priceHistoryByVenue.get(outcomeByVenue.venue);
5997
- if (!(venueHistory == null ? void 0 : venueHistory.length))
5998
- return;
5999
- const candidateIds = resolveOutcomeCandidateIds2(outcomeByVenue);
6000
- const matchingHistory = (_a2 = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a2 : venueHistory.length === 1 ? venueHistory[0] : void 0;
6001
- if (!matchingHistory)
6002
- return;
6003
- const points = matchingHistory.points.map((point) => ({
6004
- time: point.timestamp,
6005
- value: point.price * 100,
6006
- open: point.open == null ? void 0 : point.open * 100,
6007
- high: point.high == null ? void 0 : point.high * 100,
6008
- low: point.low == null ? void 0 : point.low * 100,
6009
- close: point.close == null ? void 0 : point.close * 100
6010
- })).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
6011
- if (points.length === 0)
6012
- return;
6013
- graphSeries2.push({
6014
- id: `${headerOutcomeItem.label}-${outcomeByVenue.venue}-${matchingHistory.marketId}`,
6015
- venue: outcomeByVenue.venue,
6016
- color: resolveSeriesColor(outcomeByVenue.venue, index),
6017
- points
6018
- });
6019
- });
6020
- seriesByOutcomeLabel.set(headerOutcomeItem.label, graphSeries2);
6021
- });
6022
- return seriesByOutcomeLabel;
6023
- }, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
6024
6153
  const graphSeries = (0, import_react9.useMemo)(() => {
6025
- var _a;
6026
- if (!selectedOutcomeLabel)
6027
- return [];
6028
- const seriesForOutcomeLabel = (_a = graphSeriesByOutcomeLabel.get(selectedOutcomeLabel)) != null ? _a : [];
6154
+ const colorByVenue = new Map(
6155
+ selectedOutcomesByVenue.map((item, index) => [
6156
+ item.venue,
6157
+ resolveSeriesColor(item.venue, index)
6158
+ ])
6159
+ );
6160
+ const seriesForOutcomeLabel = resolveMarketChartVenueSeries({
6161
+ chartData: marketChartData,
6162
+ transformProbability: (value) => value
6163
+ }).map((seriesItem) => {
6164
+ var _a2;
6165
+ const resolvedVenue = seriesItem.venue;
6166
+ return {
6167
+ id: `${selectedOutcomeLabel != null ? selectedOutcomeLabel : "graph"}-${resolvedVenue}-${primaryVenueMarketId != null ? primaryVenueMarketId : "chart"}`,
6168
+ venue: resolvedVenue,
6169
+ color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
6170
+ points: seriesItem.points
6171
+ };
6172
+ });
6029
6173
  if (!selectedGraphVenue)
6030
6174
  return seriesForOutcomeLabel;
6031
6175
  return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
6032
- }, [graphSeriesByOutcomeLabel, selectedGraphVenue, selectedOutcomeLabel]);
6176
+ }, [
6177
+ primaryVenueMarketId,
6178
+ marketChartData,
6179
+ selectedGraphVenue,
6180
+ selectedOutcomeLabel,
6181
+ selectedOutcomesByVenue
6182
+ ]);
6183
+ const graphLiveState = (0, import_react9.useMemo)(() => {
6184
+ return resolveMarketChartLiveState({
6185
+ chartData: marketChartData,
6186
+ selectedVenue: selectedGraphVenue,
6187
+ transformProbability: (value) => value
6188
+ });
6189
+ }, [marketChartData, selectedGraphVenue]);
6033
6190
  const otherRows = (0, import_react9.useMemo)(() => {
6034
6191
  if (!model)
6035
6192
  return [];
@@ -6037,9 +6194,10 @@ var MarketDetailsContent = ({
6037
6194
  }, [labels, model]);
6038
6195
  const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
6039
6196
  const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
6040
- const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (orderBookInputs.length === 0 || askRows.length === 0 && bidRows.length === 0);
6197
+ const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (selectedOutcomesByVenue.length === 0 || askRows.length === 0 && bidRows.length === 0);
6198
+ const hasChartError = !!marketChartError;
6041
6199
  const handleOutcomeKeyDown = (eventToHandle) => {
6042
- var _a;
6200
+ var _a2;
6043
6201
  if ((eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowLeft" && (eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowRight") {
6044
6202
  return;
6045
6203
  }
@@ -6050,19 +6208,17 @@ var MarketDetailsContent = ({
6050
6208
  });
6051
6209
  const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
6052
6210
  const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
6053
- setSelectedOutcomeLabel((_a = headerOutcomeItems[nextIndex]) == null ? void 0 : _a.label);
6211
+ setSelectedOutcomeLabel((_a2 = headerOutcomeItems[nextIndex]) == null ? void 0 : _a2.label);
6054
6212
  };
6055
- const handleToggleExpanded = (event2) => {
6056
- if (event2 && "key" in event2 && (event2 == null ? void 0 : event2.key) !== "Enter" && (event2 == null ? void 0 : event2.key) !== " ") {
6213
+ const handleToggleExpanded = (event) => {
6214
+ if (!marketId)
6215
+ return;
6216
+ if (event && "key" in event && (event == null ? void 0 : event.key) !== "Enter" && (event == null ? void 0 : event.key) !== " ") {
6057
6217
  return;
6058
6218
  }
6059
- event2 == null ? void 0 : event2.preventDefault();
6060
- event2 == null ? void 0 : event2.stopPropagation();
6061
- setIsOpened((prev) => {
6062
- const next = !prev;
6063
- onOpenChange == null ? void 0 : onOpenChange(next);
6064
- return next;
6065
- });
6219
+ event == null ? void 0 : event.preventDefault();
6220
+ event == null ? void 0 : event.stopPropagation();
6221
+ onOpenChange == null ? void 0 : onOpenChange(marketId);
6066
6222
  };
6067
6223
  const handleGraphVenueToggle = (venue) => {
6068
6224
  setSelectedGraphVenue((currentVenue) => {
@@ -6072,7 +6228,10 @@ var MarketDetailsContent = ({
6072
6228
  });
6073
6229
  };
6074
6230
  const handleRetryOrderBook = () => {
6075
- void Promise.all(orderBookResults.map((result) => result.refetch()));
6231
+ void refetchOrderBook();
6232
+ };
6233
+ const handleRetryMarketChart = () => {
6234
+ void refetchMarketChart();
6076
6235
  };
6077
6236
  (0, import_react9.useEffect)(() => {
6078
6237
  if (!selectedGraphVenue) {
@@ -6084,12 +6243,12 @@ var MarketDetailsContent = ({
6084
6243
  setSelectedGraphVenue(null);
6085
6244
  }, [selectedGraphVenue, selectedOutcomesByVenue]);
6086
6245
  if (marketId && !resolvedMarket) {
6087
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsNotFoundState, { ariaLabel, classNames });
6246
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MarketDetailsNotFoundState, { ariaLabel, classNames });
6088
6247
  }
6089
6248
  if (!model) {
6090
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsUnavailableState, { ariaLabel, classNames });
6249
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MarketDetailsUnavailableState, { ariaLabel, classNames });
6091
6250
  }
6092
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6251
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6093
6252
  Card,
6094
6253
  {
6095
6254
  className: cn(
@@ -6098,12 +6257,12 @@ var MarketDetailsContent = ({
6098
6257
  classNames == null ? void 0 : classNames.root
6099
6258
  ),
6100
6259
  children: [
6101
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6260
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6102
6261
  "div",
6103
6262
  {
6104
6263
  className: cn(
6105
6264
  "cursor-pointer disabled:cursor-default",
6106
- "flex flex-wrap flex-row items-center justify-between gap-3 px-5 py-4",
6265
+ "flex flex-nowrap flex-row items-center justify-between gap-3 px-5 py-4",
6107
6266
  isOpened && "pb-3",
6108
6267
  classNames == null ? void 0 : classNames.header
6109
6268
  ),
@@ -6115,8 +6274,8 @@ var MarketDetailsContent = ({
6115
6274
  onClick: handleToggleExpanded,
6116
6275
  onKeyDown: handleToggleExpanded,
6117
6276
  children: [
6118
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
6119
- model.image ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6277
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
6278
+ model.image ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6120
6279
  RemoteImage,
6121
6280
  {
6122
6281
  src: model.image,
@@ -6124,97 +6283,102 @@ var MarketDetailsContent = ({
6124
6283
  className: "size-12 rounded-agg-lg object-cover md:size-[60px]"
6125
6284
  }
6126
6285
  ) : null,
6127
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
6128
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { as: "h3", variant: "body-large-strong", className: "truncate", children: model.title }),
6129
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "label", className: "truncate text-agg-muted-foreground", children: model.subtitle }) })
6286
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
6287
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { as: "h3", variant: "body-large-strong", className: "truncate", children: model.title }),
6288
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { variant: "label", className: "truncate text-agg-muted-foreground", children: model.subtitle }) })
6130
6289
  ] })
6131
6290
  ] }),
6132
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { as: "div", variant: "heading", className: "shrink-0", children: formatProbabilityPercent(headlineProbability) }),
6133
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6134
- "div",
6135
- {
6136
- className: "flex gap-2",
6137
- role: "tablist",
6138
- "aria-label": labels.marketDetails.marketOutcomesAria,
6139
- tabIndex: 0,
6140
- onKeyDown: (e) => handleOutcomeKeyDown(e),
6141
- children: headerOutcomeItems.map((item) => {
6142
- const isPositive = item.tone === "positive";
6143
- const isActiveOutcome = item.label === selectedOutcomeLabel;
6144
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6145
- "button",
6146
- {
6147
- type: "button",
6148
- role: "tab",
6149
- "aria-selected": isActiveOutcome,
6150
- tabIndex: isActiveOutcome ? 0 : -1,
6151
- className: getOutcomeButtonClassName({
6152
- enableAnimations: config.enableAnimations,
6153
- isPositive,
6154
- isActive: isActiveOutcome
6155
- }),
6156
- onClick: (e) => {
6157
- e.preventDefault();
6158
- e.stopPropagation();
6159
- setSelectedOutcomeLabel(item.label);
6291
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex shrink-0 items-center gap-3", children: [
6292
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { as: "div", variant: "heading", className: "shrink-0", children: formatProbabilityPercent(headlineProbability) }),
6293
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6294
+ "div",
6295
+ {
6296
+ className: "flex shrink-0 gap-2",
6297
+ role: "tablist",
6298
+ "aria-label": labels.marketDetails.marketOutcomesAria,
6299
+ tabIndex: 0,
6300
+ onKeyDown: (e) => handleOutcomeKeyDown(e),
6301
+ children: headerOutcomeItems.map((item) => {
6302
+ const isPositive = item.tone === "positive";
6303
+ const isActiveOutcome = item.label === selectedOutcomeLabel;
6304
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6305
+ "button",
6306
+ {
6307
+ type: "button",
6308
+ role: "tab",
6309
+ "aria-selected": isActiveOutcome,
6310
+ tabIndex: isActiveOutcome ? 0 : -1,
6311
+ className: getOutcomeButtonClassName({
6312
+ enableAnimations: config.features.enableAnimations,
6313
+ isPositive,
6314
+ isActive: isActiveOutcome
6315
+ }),
6316
+ onClick: (e) => {
6317
+ e.preventDefault();
6318
+ e.stopPropagation();
6319
+ setSelectedOutcomeLabel(item.label);
6320
+ },
6321
+ children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "inline-flex items-center gap-2", children: [
6322
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6323
+ VenueLogo,
6324
+ {
6325
+ venue: item.venue,
6326
+ size: "small",
6327
+ color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
6328
+ }
6329
+ ),
6330
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6331
+ Typography,
6332
+ {
6333
+ variant: isActiveOutcome ? "body-strong" : "body",
6334
+ className: cn(
6335
+ "text-agg-base leading-agg-6",
6336
+ isActiveOutcome ? "text-agg-on-primary" : "text-agg-foreground"
6337
+ ),
6338
+ children: `${item.label} ${formatProbabilityCents(item.probability)}`
6339
+ }
6340
+ )
6341
+ ] })
6160
6342
  },
6161
- children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { className: "inline-flex items-center gap-2", children: [
6162
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6163
- VenueLogo,
6164
- {
6165
- venue: isPositive ? "polymarket" : "probable",
6166
- size: "small",
6167
- color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
6168
- }
6169
- ),
6170
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6171
- Typography,
6172
- {
6173
- variant: isActiveOutcome ? "body-strong" : "body",
6174
- className: cn(
6175
- "text-agg-base leading-agg-6",
6176
- isActiveOutcome ? "text-agg-on-primary" : "text-agg-foreground"
6177
- ),
6178
- children: `${item.label} ${formatProbabilityCents(item.probability)}`
6179
- }
6180
- )
6181
- ] })
6182
- },
6183
- item.label
6184
- );
6185
- })
6186
- }
6187
- )
6343
+ item.label
6344
+ );
6345
+ })
6346
+ }
6347
+ )
6348
+ ] })
6188
6349
  ]
6189
6350
  }
6190
6351
  ),
6191
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6352
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6192
6353
  "div",
6193
6354
  {
6194
6355
  id: detailsContentId,
6195
6356
  className: cn(
6196
6357
  "grid overflow-hidden",
6197
- getMotionClassName(config.enableAnimations, "transition-all duration-500 ease-in-out"),
6358
+ getMotionClassName(
6359
+ config.features.enableAnimations,
6360
+ "transition-all duration-500 ease-in-out"
6361
+ ),
6198
6362
  isOpened ? "grid-rows-[1fr] opacity-100" : "pointer-events-none grid-rows-[0fr] opacity-0"
6199
6363
  ),
6200
6364
  "aria-hidden": !isOpened,
6201
- children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "min-h-0", children: [
6202
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6203
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6365
+ children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "min-h-0", children: [
6366
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6367
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6204
6368
  "div",
6205
6369
  {
6206
6370
  className: cn(
6207
6371
  getMotionClassName(
6208
- config.enableAnimations,
6372
+ config.features.enableAnimations,
6209
6373
  "transition-all duration-500 ease-in-out"
6210
6374
  ),
6211
6375
  isOpened ? cn(
6212
6376
  "translate-y-0 opacity-100",
6213
- getMotionClassName(config.enableAnimations, "delay-100")
6377
+ getMotionClassName(config.features.enableAnimations, "delay-100")
6214
6378
  ) : "translate-y-5 opacity-0"
6215
6379
  ),
6216
6380
  children: [
6217
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: cn("block", classNames == null ? void 0 : classNames.tabs), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6381
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("block", classNames == null ? void 0 : classNames.tabs), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6218
6382
  Tabs,
6219
6383
  {
6220
6384
  ariaLabel: labels.marketDetails.tabsAria,
@@ -6225,9 +6389,9 @@ var MarketDetailsContent = ({
6225
6389
  className: "w-full px-5"
6226
6390
  }
6227
6391
  ) }),
6228
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6229
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("p-5", classNames == null ? void 0 : classNames.content), children: [
6230
- selectedTab === "order-book" ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.orderBook), children: isOrderBookLoading ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsOderbookSkeleton, {}) : hasOrderBookError ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6392
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6393
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: cn("p-5", classNames == null ? void 0 : classNames.content), children: [
6394
+ selectedTab === "order-book" ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.orderBook), children: isOrderBookLoading ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MarketDetailsOderbookSkeleton, {}) : hasOrderBookError ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6231
6395
  StateMessage,
6232
6396
  {
6233
6397
  ariaLabel: labels.marketDetails.orderBookUnavailableAria,
@@ -6238,7 +6402,7 @@ var MarketDetailsContent = ({
6238
6402
  onAction: handleRetryOrderBook,
6239
6403
  className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
6240
6404
  }
6241
- ) : hasNoOrderBook ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6405
+ ) : hasNoOrderBook ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6242
6406
  StateMessage,
6243
6407
  {
6244
6408
  ariaLabel: labels.marketDetails.orderBookEmptyAria,
@@ -6246,44 +6410,57 @@ var MarketDetailsContent = ({
6246
6410
  description: labels.marketDetails.orderBookEmptyDescription,
6247
6411
  className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
6248
6412
  }
6249
- ) : /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
6250
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6413
+ ) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
6414
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6251
6415
  OrderBookRows,
6252
6416
  {
6253
6417
  rows: askRows,
6254
6418
  title: labels.marketDetails.asks,
6255
- formatNumber: config.formatNumber,
6256
- formatCurrency: config.formatCurrency,
6419
+ formatNumber: config.formatting.formatNumber,
6420
+ formatCurrency: config.formatting.formatCurrency,
6257
6421
  visibleRows: orderBookDepth
6258
6422
  }
6259
6423
  ),
6260
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6424
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6261
6425
  OrderBookRows,
6262
6426
  {
6263
6427
  rows: bidRows,
6264
6428
  title: labels.marketDetails.bids,
6265
- formatNumber: config.formatNumber,
6266
- formatCurrency: config.formatCurrency,
6429
+ formatNumber: config.formatting.formatNumber,
6430
+ formatCurrency: config.formatting.formatCurrency,
6267
6431
  visibleRows: orderBookDepth
6268
6432
  }
6269
6433
  )
6270
6434
  ] }) }) : null,
6271
- selectedTab === "graph" ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
6272
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6435
+ selectedTab === "graph" ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
6436
+ hasChartError ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6437
+ StateMessage,
6438
+ {
6439
+ ariaLabel: labels.marketDetails.chartUnavailableAria,
6440
+ tone: "warning",
6441
+ title: labels.marketDetails.chartUnavailableTitle,
6442
+ description: labels.marketDetails.chartUnavailableDescription,
6443
+ actionLabel: labels.common.retry,
6444
+ onAction: handleRetryMarketChart,
6445
+ className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
6446
+ }
6447
+ ) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6273
6448
  LineChart,
6274
6449
  {
6275
6450
  series: graphSeries,
6276
6451
  height: 260,
6277
- isLoading: isPriceHistoryLoading,
6452
+ isLoading: isMarketChartLoading,
6278
6453
  chartType: selectedChartType,
6454
+ liveCandle: selectedChartType === "candlestick" ? (_d = graphLiveState.liveCandle) != null ? _d : void 0 : void 0,
6455
+ lineValue: graphLiveState.lineValue,
6279
6456
  classNames: { root: "w-full" },
6280
6457
  showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
6281
6458
  renderSeriesControls: () => {
6282
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
6283
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex flex-wrap gap-2", children: selectedOutcomesByVenue.map((item) => {
6459
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
6460
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex flex-wrap gap-2", children: selectedOutcomesByVenue.map((item) => {
6284
6461
  const probability = formatProbabilityPercent(item.outcome.price);
6285
6462
  const isActiveVenue = selectedGraphVenue === item.venue;
6286
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6463
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6287
6464
  "button",
6288
6465
  {
6289
6466
  type: "button",
@@ -6300,14 +6477,14 @@ var MarketDetailsContent = ({
6300
6477
  handleGraphVenueToggle(item.venue);
6301
6478
  },
6302
6479
  children: [
6303
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(VenueLogo, { venue: item.venue, size: "small" }),
6304
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: probability })
6480
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(VenueLogo, { venue: item.venue, size: "small" }),
6481
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: probability })
6305
6482
  ]
6306
6483
  },
6307
6484
  `${item.market.id}-${item.outcome.id}`
6308
6485
  );
6309
6486
  }) }),
6310
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6487
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6311
6488
  SwitchButton,
6312
6489
  {
6313
6490
  ariaLabel: labels.marketDetails.outcomeSelectorAria,
@@ -6325,7 +6502,7 @@ var MarketDetailsContent = ({
6325
6502
  }
6326
6503
  }
6327
6504
  ),
6328
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6505
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6329
6506
  "div",
6330
6507
  {
6331
6508
  className: cn(
@@ -6333,9 +6510,9 @@ var MarketDetailsContent = ({
6333
6510
  classNames == null ? void 0 : classNames.footer
6334
6511
  ),
6335
6512
  children: [
6336
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { children: typeof model.market.volume === "number" ? `${config.formatCompactCurrency(model.market.volume)} ${labels.marketDetails.meta.volumeSuffix}` : labels.marketDetails.volumeUnavailable }),
6337
- /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-wrap items-center gap-3 md:gap-4", children: [
6338
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6513
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { children: typeof model.market.volume === "number" ? `${config.formatting.formatCompactCurrency(model.market.volume)} ${labels.marketDetails.meta.volumeSuffix}` : labels.marketDetails.volumeUnavailable }),
6514
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex flex-wrap items-center gap-3 md:gap-4", children: [
6515
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6339
6516
  ChartTypeSwitch,
6340
6517
  {
6341
6518
  className: "shrink-0",
@@ -6343,7 +6520,7 @@ var MarketDetailsContent = ({
6343
6520
  onValueChange: setSelectedChartType
6344
6521
  }
6345
6522
  ),
6346
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6523
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6347
6524
  "span",
6348
6525
  {
6349
6526
  "aria-hidden": "true",
@@ -6352,7 +6529,7 @@ var MarketDetailsContent = ({
6352
6529
  ),
6353
6530
  eventListItemDetailsTimeRanges.map((timeRange) => {
6354
6531
  const isActive = selectedTimeRange === timeRange;
6355
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6532
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6356
6533
  "button",
6357
6534
  {
6358
6535
  type: "button",
@@ -6376,13 +6553,13 @@ var MarketDetailsContent = ({
6376
6553
  }
6377
6554
  )
6378
6555
  ] }) : null,
6379
- selectedTab === "other" ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "flex flex-col gap-4", children: otherContent != null ? otherContent : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "grid grid-cols-1 gap-3", children: otherRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
6556
+ selectedTab === "other" ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "flex flex-col gap-4", children: otherContent != null ? otherContent : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "grid grid-cols-1 gap-3", children: otherRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6380
6557
  "div",
6381
6558
  {
6382
6559
  className: "flex items-center justify-between rounded-agg-xl bg-agg-secondary-hover px-4 py-3",
6383
6560
  children: [
6384
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: row.label }),
6385
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { variant: "body", className: "text-right", children: row.value })
6561
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: row.label }),
6562
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { variant: "body", className: "text-right", children: row.value })
6386
6563
  ]
6387
6564
  },
6388
6565
  row.label
@@ -6398,89 +6575,131 @@ var MarketDetailsContent = ({
6398
6575
  }
6399
6576
  );
6400
6577
  };
6401
- var MarketDetails = (props) => {
6402
- var _a, _b;
6403
- const [uncontrolledIsOpened, setUncontrolledIsOpened] = (0, import_react9.useState)(
6404
- (_a = props.defaultIsOpened) != null ? _a : marketDetailsDefaultIsOpened
6405
- );
6406
- (0, import_react9.useEffect)(() => {
6407
- if (typeof props.isOpened !== "boolean")
6408
- return;
6409
- setUncontrolledIsOpened(props.isOpened);
6410
- }, [props.isOpened]);
6411
- const resolvedIsOpened = typeof props.isOpened === "boolean" ? props.isOpened : uncontrolledIsOpened;
6412
- const handleOpenChange = (nextIsOpened) => {
6413
- var _a2;
6414
- if (typeof props.isOpened !== "boolean") {
6415
- setUncontrolledIsOpened(nextIsOpened);
6416
- }
6417
- (_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, nextIsOpened);
6418
- };
6419
- const hasEventProp = "event" in props && !!props.event;
6420
- const {
6421
- event: fetchedEvent,
6422
- error: eventError,
6423
- isLoading: isFetchingEvent
6424
- } = (0, import_hooks18.useVenueEvent)({
6425
- eventId: hasEventProp ? "" : (_b = props.eventId) != null ? _b : "",
6426
- enabled: !props.isLoading && !hasEventProp && !!props.eventId
6427
- });
6578
+ var MarketDetails = (_a) => {
6579
+ var _b = _a, { isOpened } = _b, props = __objRest(_b, ["isOpened"]);
6428
6580
  if (props.isLoading) {
6429
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6581
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6430
6582
  MarketDetailsLoadingState,
6431
6583
  {
6432
- isOpened: resolvedIsOpened,
6584
+ isOpened,
6433
6585
  ariaLabel: props.ariaLabel,
6434
6586
  classNames: props.classNames
6435
6587
  }
6436
6588
  );
6437
6589
  }
6438
- if ("event" in props && props.event) {
6439
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6590
+ if ("venueMarkets" in props && props.venueMarkets) {
6591
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6440
6592
  MarketDetailsContent,
6441
6593
  __spreadProps(__spreadValues({}, props), {
6442
- isOpened: resolvedIsOpened,
6443
- onOpenChange: handleOpenChange,
6444
- event: props.event
6594
+ isOpened,
6595
+ onOpenChange: props.onOpenChange,
6596
+ venueMarkets: props.venueMarkets
6445
6597
  })
6446
6598
  );
6447
6599
  }
6448
- if (isFetchingEvent) {
6449
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6450
- MarketDetailsLoadingState,
6600
+ const { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames } = props;
6601
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MarketDetailsUnavailableState, { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames });
6602
+ };
6603
+ MarketDetails.displayName = "MarketDetails";
6604
+ var resolveInitialExpandedId = (markets) => {
6605
+ var _a, _b;
6606
+ if (!markets.length)
6607
+ return null;
6608
+ return (_b = (_a = markets[0]) == null ? void 0 : _a.id) != null ? _b : null;
6609
+ };
6610
+ var MarketDetailsList = ({
6611
+ eventId,
6612
+ onExpandedMarketChange,
6613
+ defaultTab,
6614
+ defaultTimeRange,
6615
+ classNames,
6616
+ ariaLabel
6617
+ }) => {
6618
+ const labels = (0, import_hooks19.useLabels)();
6619
+ const resolvedEventId = eventId || "";
6620
+ const { markets, isLoading, error } = (0, import_hooks19.useVenueMarkets)({
6621
+ venueEventId: resolvedEventId,
6622
+ enabled: !!resolvedEventId
6623
+ });
6624
+ const [expandedMarketId, setExpandedMarketId] = (0, import_react9.useState)(
6625
+ () => resolveInitialExpandedId(markets)
6626
+ );
6627
+ (0, import_react9.useEffect)(() => {
6628
+ setExpandedMarketId((current) => {
6629
+ if (current && markets.some((m) => m.id === current))
6630
+ return current;
6631
+ return resolveInitialExpandedId(markets);
6632
+ });
6633
+ }, [markets]);
6634
+ const handleToggle = (marketId) => {
6635
+ if (marketId === expandedMarketId) {
6636
+ onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(null);
6637
+ setExpandedMarketId(null);
6638
+ return;
6639
+ }
6640
+ onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
6641
+ setExpandedMarketId(marketId);
6642
+ };
6643
+ if (isLoading) {
6644
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: [
6645
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MarketDetailsLoadingState, { isOpened: true, classNames: { root: classNames == null ? void 0 : classNames.item } }),
6646
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MarketDetailsLoadingState, { isOpened: false, classNames: { root: classNames == null ? void 0 : classNames.item } })
6647
+ ] });
6648
+ }
6649
+ if (error) {
6650
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6651
+ StateMessage,
6451
6652
  {
6452
- isOpened: resolvedIsOpened,
6453
- ariaLabel: props.ariaLabel,
6454
- classNames: props.classNames
6653
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
6654
+ title: labels.marketDetails.unavailableTitle,
6655
+ description: labels.marketDetails.unavailableDescription,
6656
+ className: "min-h-[280px] md:min-h-[320px]"
6455
6657
  }
6456
- );
6658
+ ) });
6457
6659
  }
6458
- if (!fetchedEvent) {
6459
- if (isErrorWithStatus(eventError, 404)) {
6460
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsNotFoundState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
6461
- }
6462
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsUnavailableState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
6660
+ if (markets.length === 0) {
6661
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6662
+ StateMessage,
6663
+ {
6664
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
6665
+ title: labels.marketDetails.notFoundTitle,
6666
+ description: labels.marketDetails.notFoundDescription,
6667
+ className: "min-h-[280px] md:min-h-[320px]"
6668
+ }
6669
+ ) });
6463
6670
  }
6464
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
6465
- MarketDetailsContent,
6466
- __spreadProps(__spreadValues({}, props), {
6467
- isOpened: resolvedIsOpened,
6468
- onOpenChange: handleOpenChange,
6469
- event: fetchedEvent
6470
- })
6471
- );
6671
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: markets.map((market) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6672
+ MarketDetails,
6673
+ {
6674
+ marketId: market.id,
6675
+ venueMarkets: [market],
6676
+ isOpened: expandedMarketId === market.id,
6677
+ onOpenChange: (marketId) => {
6678
+ handleToggle(marketId);
6679
+ },
6680
+ defaultTab,
6681
+ defaultTimeRange,
6682
+ ariaLabel: market.question,
6683
+ classNames: { root: classNames == null ? void 0 : classNames.item }
6684
+ },
6685
+ market.id
6686
+ )) });
6472
6687
  };
6473
- MarketDetails.displayName = "MarketDetails";
6688
+ MarketDetailsList.displayName = "MarketDetailsList";
6474
6689
 
6475
6690
  // src/events/list/index.tsx
6476
6691
  var import_react10 = require("react");
6477
- var import_hooks19 = require("@agg-market/hooks");
6692
+ var import_hooks20 = require("@agg-market/hooks");
6478
6693
 
6479
6694
  // src/events/list/event-list.constants.ts
6480
6695
  var POLYMARKET_VENUE = "polymarket";
6481
6696
  var KALSHI_VENUE = "kalshi";
6697
+ var OPINION_VENUE = "opinion";
6698
+ var PROBABLE_VENUE = "probable";
6482
6699
  var POLYMARKET_VENUE_LOGO = "polymarket";
6483
6700
  var KALSHI_VENUE_LOGO = "kalshi";
6701
+ var OPINION_VENUE_LOGO = "opinion";
6702
+ var PROBABLE_VENUE_LOGO = "probable";
6484
6703
  var getDefaultEventListTabs = (labels) => {
6485
6704
  return [
6486
6705
  {
@@ -6499,6 +6718,18 @@ var getDefaultEventListTabs = (labels) => {
6499
6718
  label: labels.venues.kalshi,
6500
6719
  venueLogo: KALSHI_VENUE_LOGO,
6501
6720
  venues: [KALSHI_VENUE]
6721
+ },
6722
+ {
6723
+ value: "opinion",
6724
+ label: labels.venues.opinion,
6725
+ venueLogo: OPINION_VENUE_LOGO,
6726
+ venues: [OPINION_VENUE]
6727
+ },
6728
+ {
6729
+ value: "probable",
6730
+ label: labels.venues.probable,
6731
+ venueLogo: PROBABLE_VENUE_LOGO,
6732
+ venues: [PROBABLE_VENUE]
6502
6733
  }
6503
6734
  ];
6504
6735
  };
@@ -6517,21 +6748,21 @@ var resolveTabVenus = (tab) => {
6517
6748
  return void 0;
6518
6749
  if (tab.venues && tab.venues.length > 0)
6519
6750
  return tab.venues;
6520
- if (tab.value === "polymarket" || tab.value === "kalshi") {
6751
+ if (tab.value === "polymarket" || tab.value === "kalshi" || tab.value === "opinion" || tab.value === "probable") {
6521
6752
  return [tab.value];
6522
6753
  }
6523
6754
  return void 0;
6524
6755
  };
6525
6756
 
6526
6757
  // src/events/list/index.tsx
6527
- var import_jsx_runtime80 = require("react/jsx-runtime");
6758
+ var import_jsx_runtime81 = require("react/jsx-runtime");
6528
6759
  var renderTabIcon = (tab, isActive) => {
6529
6760
  if (tab.venueLogo) {
6530
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
6761
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
6531
6762
  }
6532
6763
  if (!tab.iconName)
6533
6764
  return null;
6534
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6765
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6535
6766
  Icon,
6536
6767
  {
6537
6768
  name: tab.iconName,
@@ -6569,14 +6800,14 @@ var estimateTabsWidth = (items) => {
6569
6800
  var EventList = ({
6570
6801
  title,
6571
6802
  maxItemsPerRow = 3,
6572
- limit = 3,
6803
+ limit = 9,
6573
6804
  maxVisibleItems,
6574
- showVenueLogo = true,
6575
6805
  search,
6576
- categoryIds
6806
+ categoryIds,
6807
+ onClick
6577
6808
  }) => {
6578
6809
  var _a, _b;
6579
- const labels = (0, import_hooks19.useLabels)();
6810
+ const labels = (0, import_hooks20.useLabels)();
6580
6811
  const defaultEventListTabs = (0, import_react10.useMemo)(() => {
6581
6812
  return getDefaultEventListTabs(labels);
6582
6813
  }, [labels]);
@@ -6597,7 +6828,8 @@ var EventList = ({
6597
6828
  }, [maxVisibleItems]);
6598
6829
  const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
6599
6830
  const shouldPaginate = resolvedMaxVisibleItems == null;
6600
- const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks19.useVenueEvents)({
6831
+ const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks20.useVenueEvents)({
6832
+ queryKeyScope: "event-list",
6601
6833
  venues,
6602
6834
  search,
6603
6835
  categoryIds,
@@ -6701,17 +6933,17 @@ var EventList = ({
6701
6933
  "md:[grid-template-columns:repeat(var(--agg-event-list-columns),minmax(0,1fr))]"
6702
6934
  );
6703
6935
  if (shouldRenderLoadingState) {
6704
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
6936
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
6705
6937
  }
6706
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "flex w-full flex-col gap-5", children: [
6707
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
6938
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("section", { className: "flex w-full flex-col gap-5", children: [
6939
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
6708
6940
  "header",
6709
6941
  {
6710
6942
  ref: headerRef,
6711
6943
  className: "flex flex-col sm:flex-row w-full flex-nowrap items-start sm:items-center justify-between gap-2 sm:gap-4",
6712
6944
  children: [
6713
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
6714
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6945
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
6946
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6715
6947
  Tabs,
6716
6948
  {
6717
6949
  ariaLabel: labels.eventList.tabsAria(title),
@@ -6723,19 +6955,19 @@ var EventList = ({
6723
6955
  ]
6724
6956
  }
6725
6957
  ),
6726
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: gridClassName, style: gridStyle, children: [
6727
- tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6958
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: gridClassName, style: gridStyle, children: [
6959
+ tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6728
6960
  EventListItem,
6729
6961
  {
6730
6962
  event,
6731
- showVenueLogo,
6732
6963
  classNames: {
6733
6964
  root: "w-full min-w-0 max-w-none"
6734
- }
6965
+ },
6966
+ onClick
6735
6967
  },
6736
6968
  event.id
6737
6969
  )),
6738
- Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6970
+ Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6739
6971
  EventListItem,
6740
6972
  {
6741
6973
  isLoading: true,
@@ -6745,16 +6977,15 @@ var EventList = ({
6745
6977
  },
6746
6978
  `loading-${index}`
6747
6979
  )),
6748
- !isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card, { className: "col-span-full overflow-hidden shadow-none hover:shadow-none", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6980
+ !isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Card, { className: "col-span-full overflow-hidden shadow-none hover:shadow-none p-0! border-none! bg-transparent!", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6749
6981
  StateMessage,
6750
6982
  {
6751
6983
  ariaLabel: labels.eventList.emptyAria,
6752
6984
  title: labels.eventList.emptyTitle,
6753
- description: labels.eventList.emptyDescription,
6754
- className: "min-h-[320px]"
6985
+ description: labels.eventList.emptyDescription
6755
6986
  }
6756
6987
  ) }) : null,
6757
- isError ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
6988
+ isError ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6758
6989
  Typography,
6759
6990
  {
6760
6991
  variant: "body",
@@ -6763,7 +6994,7 @@ var EventList = ({
6763
6994
  }
6764
6995
  ) : null
6765
6996
  ] }),
6766
- shouldPaginate && hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ref: loadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
6997
+ shouldPaginate && hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { ref: loadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
6767
6998
  ] });
6768
6999
  };
6769
7000
  EventList.displayName = "EventList";
@@ -6772,5 +7003,6 @@ EventList.displayName = "EventList";
6772
7003
  EventList,
6773
7004
  EventListItem,
6774
7005
  EventListItemDetails,
6775
- MarketDetails
7006
+ MarketDetails,
7007
+ MarketDetailsList
6776
7008
  });