@agg-build/ui 2.4.3 → 2.4.5

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 (38) hide show
  1. package/dist/{chunk-GLVLCXIM.mjs → chunk-CXSIXL7M.mjs} +29 -35
  2. package/dist/{chunk-PHAEFHBM.mjs → chunk-GWRFSQQK.mjs} +70 -17
  3. package/dist/{chunk-PHRYWSNV.mjs → chunk-I4X5UNCT.mjs} +307 -240
  4. package/dist/{chunk-3PSIO77N.mjs → chunk-JVRTJQPZ.mjs} +1 -1
  5. package/dist/{chunk-QDNG5UKJ.mjs → chunk-P5CVJQPW.mjs} +288 -291
  6. package/dist/{chunk-WZ55ERDO.mjs → chunk-PTNFXXOV.mjs} +50 -11
  7. package/dist/{chunk-STL4ZHLP.mjs → chunk-UH3DUTMG.mjs} +140 -115
  8. package/dist/events.js +440 -305
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +840 -666
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +333 -297
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +558 -381
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +50 -11
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +2597 -2384
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/item-details/event-list-item-details.constants.d.mts +1 -1
  23. package/dist/types/events/item-details/event-list-item-details.constants.d.ts +1 -1
  24. package/dist/types/events/item-details/settlement-summary.d.mts +1 -1
  25. package/dist/types/events/item-details/settlement-summary.d.ts +1 -1
  26. package/dist/types/onboarding/index.d.mts +1 -1
  27. package/dist/types/onboarding/index.d.ts +1 -1
  28. package/dist/types/onboarding/steps/connect-accounts.d.mts +1 -1
  29. package/dist/types/onboarding/steps/connect-accounts.d.ts +1 -1
  30. package/dist/types/primitives/icon/icon.constants.d.mts +1 -0
  31. package/dist/types/primitives/icon/icon.constants.d.ts +1 -0
  32. package/dist/types/shared/use-horizontal-scroll-state.d.mts +3 -0
  33. package/dist/types/shared/use-horizontal-scroll-state.d.ts +3 -0
  34. package/dist/types/trading/place-order/index.place-order.utils.d.mts +1 -0
  35. package/dist/types/trading/place-order/index.place-order.utils.d.ts +1 -0
  36. package/dist/types/trading/settlement/index.d.mts +1 -1
  37. package/dist/types/trading/settlement/index.d.ts +1 -1
  38. package/package.json +2 -2
package/dist/pages.js CHANGED
@@ -99,7 +99,7 @@ module.exports = __toCommonJS(pages_exports);
99
99
 
100
100
  // src/pages/home/index.tsx
101
101
  var import_hooks62 = require("@agg-build/hooks");
102
- var import_sdk18 = require("@agg-build/sdk");
102
+ var import_sdk19 = require("@agg-build/sdk");
103
103
  var import_react42 = require("react");
104
104
 
105
105
  // src/events/item/index.tsx
@@ -1659,6 +1659,12 @@ var iconSizeClasses = {
1659
1659
  medium: "h-6 w-6",
1660
1660
  large: "h-8 w-8"
1661
1661
  };
1662
+ var iconSizePixels = {
1663
+ xs: 12,
1664
+ small: 16,
1665
+ medium: 24,
1666
+ large: 32
1667
+ };
1662
1668
 
1663
1669
  // src/primitives/search/search-empty-icon.tsx
1664
1670
  var import_jsx_runtime40 = require("react/jsx-runtime");
@@ -3260,6 +3266,8 @@ var Icon = (_a) => {
3260
3266
  __spreadValues({
3261
3267
  color,
3262
3268
  className: cn("group/agg-icon", resolvedClassName),
3269
+ width: iconSizePixels[size],
3270
+ height: iconSizePixels[size],
3263
3271
  style: resolvedStyle
3264
3272
  }, props)
3265
3273
  );
@@ -5011,7 +5019,7 @@ EventListSkeletonView.displayName = "EventListSkeletonView";
5011
5019
  var import_hooks13 = require("@agg-build/hooks");
5012
5020
 
5013
5021
  // src/events/item-details/event-list-item-details.constants.ts
5014
- var detailsBaseCardClassName = "w-full gap-6 p-5 md:gap-8";
5022
+ var detailsBaseCardClassName = "w-full gap-6 p-4 md:p-5 md:gap-8";
5015
5023
 
5016
5024
  // src/primitives/skeleton/views/event-list-item-details-skeleton-view.tsx
5017
5025
  var import_jsx_runtime98 = require("react/jsx-runtime");
@@ -8209,14 +8217,23 @@ var import_react11 = require("react");
8209
8217
  var import_react10 = require("react");
8210
8218
  var useHorizontalScrollState = () => {
8211
8219
  const containerRef = (0, import_react10.useRef)(null);
8220
+ const [hasOverflow, setHasOverflow] = (0, import_react10.useState)(false);
8221
+ const [isAtStart, setIsAtStart] = (0, import_react10.useState)(true);
8222
+ const [isAtEnd, setIsAtEnd] = (0, import_react10.useState)(true);
8212
8223
  const [canScrollLeft, setCanScrollLeft] = (0, import_react10.useState)(false);
8213
8224
  const [canScrollRight, setCanScrollRight] = (0, import_react10.useState)(false);
8214
8225
  const update = (0, import_react10.useCallback)(() => {
8215
8226
  const el = containerRef.current;
8216
8227
  if (!el) return;
8217
- const maxScroll = el.scrollWidth - el.clientWidth;
8218
- setCanScrollLeft(el.scrollLeft > 4);
8219
- setCanScrollRight(maxScroll - el.scrollLeft > 4);
8228
+ const epsilon = 2;
8229
+ const nextHasOverflow = el.scrollWidth > el.clientWidth + epsilon;
8230
+ const nextIsAtStart = el.scrollLeft <= epsilon;
8231
+ const nextIsAtEnd = el.scrollLeft + el.clientWidth >= el.scrollWidth - epsilon;
8232
+ setHasOverflow(nextHasOverflow);
8233
+ setIsAtStart(nextIsAtStart);
8234
+ setIsAtEnd(nextIsAtEnd);
8235
+ setCanScrollLeft(nextHasOverflow && !nextIsAtStart);
8236
+ setCanScrollRight(nextHasOverflow && !nextIsAtEnd);
8220
8237
  }, []);
8221
8238
  (0, import_react10.useEffect)(() => {
8222
8239
  const el = containerRef.current;
@@ -8232,7 +8249,15 @@ var useHorizontalScrollState = () => {
8232
8249
  ro.observe(el);
8233
8250
  return () => ro.disconnect();
8234
8251
  }, [update]);
8235
- return { containerRef, canScrollLeft, canScrollRight, update };
8252
+ return {
8253
+ containerRef,
8254
+ hasOverflow,
8255
+ isAtStart,
8256
+ isAtEnd,
8257
+ canScrollLeft,
8258
+ canScrollRight,
8259
+ update
8260
+ };
8236
8261
  };
8237
8262
 
8238
8263
  // src/primitives/tabs/tabs.constants.ts
@@ -8327,6 +8352,9 @@ var Tabs = ({
8327
8352
  });
8328
8353
  const {
8329
8354
  containerRef: tabListRef,
8355
+ hasOverflow,
8356
+ isAtStart,
8357
+ isAtEnd,
8330
8358
  canScrollLeft,
8331
8359
  canScrollRight,
8332
8360
  update: updateScrollState
@@ -8415,7 +8443,7 @@ var Tabs = ({
8415
8443
  "overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
8416
8444
  getMotionClassName(enableAnimations, "scroll-smooth")
8417
8445
  ) : "overflow-x-auto",
8418
- isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-15 border-b border-agg-separator -mb-[1px]",
8446
+ isBarVariant ? "items-start rounded-agg-lg border border-agg-separator p-1.5" : "h-14 md:h-15 border-b border-agg-separator -mb-[1px]",
8419
8447
  shouldUseOverflowScroll && "select-none",
8420
8448
  shouldUseOverflowScroll && !isBarVariant && "snap-x snap-mandatory",
8421
8449
  shouldUseOverflowScroll && (isDraggingTabs ? "cursor-grabbing" : "cursor-grab")
@@ -8573,7 +8601,10 @@ var Tabs = ({
8573
8601
  left: Math.max(0, nextScrollLeft),
8574
8602
  behavior: getScrollBehavior(enableAnimations)
8575
8603
  });
8576
- }, [enableAnimations, renderedItems, shouldUseOverflowScroll, value]);
8604
+ requestAnimationFrame(() => {
8605
+ updateScrollState();
8606
+ });
8607
+ }, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
8577
8608
  if (shouldUseOverflowSelect) {
8578
8609
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: cn("group/agg-tabs w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8579
8610
  Select,
@@ -8612,6 +8643,13 @@ var Tabs = ({
8612
8643
  onPointerUp: handleEndTabListDrag,
8613
8644
  onWheel: handleTabListWheel,
8614
8645
  children: [
8646
+ shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
8647
+ "span",
8648
+ {
8649
+ "aria-hidden": true,
8650
+ className: "agg-tab-scroll-start-spacer h-full w-4 shrink-0 snap-start"
8651
+ }
8652
+ ) : null,
8615
8653
  renderedItems.map((item, index) => {
8616
8654
  var _a;
8617
8655
  const isActive = item.value === value;
@@ -8646,6 +8684,7 @@ var Tabs = ({
8646
8684
  isDisabled: !!item.disabled,
8647
8685
  size
8648
8686
  }),
8687
+ !isBarVariant && (size === "s" ? "px-3 md:px-4" : "h-14 px-3 md:h-15 md:px-4"),
8649
8688
  shouldUseOverflowScroll && !isBarVariant && "snap-start",
8650
8689
  classNames == null ? void 0 : classNames.tabTrigger
8651
8690
  ),
@@ -8695,9 +8734,9 @@ var Tabs = ({
8695
8734
  "aria-hidden": true,
8696
8735
  className: cn(
8697
8736
  "agg-tab-scroll-start",
8698
- "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",
8737
+ "pointer-events-none absolute inset-y-0 left-0 z-10 w-6 md:w-[60px] bg-linear-to-r from-agg-secondary to-transparent",
8699
8738
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
8700
- canScrollLeft ? "opacity-100" : "opacity-0"
8739
+ hasOverflow && canScrollLeft && !isAtStart ? "opacity-100" : "opacity-0"
8701
8740
  )
8702
8741
  }
8703
8742
  ),
@@ -8707,9 +8746,9 @@ var Tabs = ({
8707
8746
  "aria-hidden": true,
8708
8747
  className: cn(
8709
8748
  "agg-tab-scroll-end",
8710
- "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",
8749
+ "pointer-events-none absolute inset-y-0 right-0 z-10 w-6 md:w-[60px] bg-linear-to-l from-agg-secondary to-transparent",
8711
8750
  getMotionClassName(enableAnimations, "transition-opacity duration-200"),
8712
- canScrollRight ? "opacity-100" : "opacity-0"
8751
+ hasOverflow && canScrollRight && !isAtEnd ? "opacity-100" : "opacity-0"
8713
8752
  )
8714
8753
  }
8715
8754
  )
@@ -9121,8 +9160,85 @@ var EventListItemNotFoundState = ({
9121
9160
  );
9122
9161
  };
9123
9162
  var OUTCOMES_SCROLL_LOAD_THRESHOLD_PX = 16;
9163
+ var OUTCOMES_SCROLL_STATE_EPSILON_PX = 1;
9164
+ var OUTCOMES_SCROLL_MASK_HEIGHT_PX = 24;
9124
9165
  var MARKET_ID_QUERY_PARAM = "marketId";
9125
9166
  var OUTCOME_ID_QUERY_PARAM = "outcomeId";
9167
+ var OUTCOME_ROW_SELECTOR = ".agg-outcome-row";
9168
+ var DEFAULT_OUTCOMES_SCROLL_STATE = {
9169
+ hasOverflow: false,
9170
+ isAtTop: true,
9171
+ isAtBottom: true,
9172
+ remainingMarkets: 0
9173
+ };
9174
+ var areOutcomesScrollStatesEqual = (left, right) => {
9175
+ return left.hasOverflow === right.hasOverflow && left.isAtTop === right.isAtTop && left.isAtBottom === right.isAtBottom && left.remainingMarkets === right.remainingMarkets;
9176
+ };
9177
+ var useOutcomesScrollState = ({
9178
+ totalMarketCount,
9179
+ onReachScrollThreshold
9180
+ }) => {
9181
+ const containerRef = (0, import_react14.useRef)(null);
9182
+ const frameRef = (0, import_react14.useRef)(null);
9183
+ const scrollStateRef = (0, import_react14.useRef)(DEFAULT_OUTCOMES_SCROLL_STATE);
9184
+ const [scrollState, setScrollState] = (0, import_react14.useState)(
9185
+ DEFAULT_OUTCOMES_SCROLL_STATE
9186
+ );
9187
+ const measureScrollState = (0, import_react14.useCallback)(() => {
9188
+ frameRef.current = null;
9189
+ const element = containerRef.current;
9190
+ if (!element) return;
9191
+ const { clientHeight, scrollHeight, scrollTop } = element;
9192
+ const hasOverflow = scrollHeight > clientHeight + OUTCOMES_SCROLL_STATE_EPSILON_PX;
9193
+ const isAtTop = scrollTop <= OUTCOMES_SCROLL_STATE_EPSILON_PX;
9194
+ const isAtBottom = !hasOverflow || scrollTop + clientHeight >= scrollHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX;
9195
+ const loadedRows = Array.from(element.querySelectorAll(OUTCOME_ROW_SELECTOR));
9196
+ const visibleMarketCount = loadedRows.reduce((count, row) => {
9197
+ return count + (row.offsetTop < clientHeight - OUTCOMES_SCROLL_STATE_EPSILON_PX ? 1 : 0);
9198
+ }, 0);
9199
+ const remainingMarkets = hasOverflow ? Math.max(0, totalMarketCount - visibleMarketCount) : 0;
9200
+ const nextScrollState = {
9201
+ hasOverflow,
9202
+ isAtTop,
9203
+ isAtBottom,
9204
+ remainingMarkets
9205
+ };
9206
+ if (!areOutcomesScrollStatesEqual(scrollStateRef.current, nextScrollState)) {
9207
+ scrollStateRef.current = nextScrollState;
9208
+ setScrollState(nextScrollState);
9209
+ }
9210
+ const distanceToBottom = scrollHeight - scrollTop - clientHeight;
9211
+ if (distanceToBottom <= OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) {
9212
+ onReachScrollThreshold == null ? void 0 : onReachScrollThreshold();
9213
+ }
9214
+ }, [onReachScrollThreshold, totalMarketCount]);
9215
+ const updateScrollState = (0, import_react14.useCallback)(() => {
9216
+ if (frameRef.current != null) return;
9217
+ frameRef.current = window.requestAnimationFrame(measureScrollState);
9218
+ }, [measureScrollState]);
9219
+ (0, import_react14.useEffect)(() => {
9220
+ const element = containerRef.current;
9221
+ if (!element) return;
9222
+ element.addEventListener("scroll", updateScrollState, { passive: true });
9223
+ let resizeObserver = null;
9224
+ if (typeof ResizeObserver !== "undefined") {
9225
+ resizeObserver = new ResizeObserver(() => {
9226
+ updateScrollState();
9227
+ });
9228
+ resizeObserver.observe(element);
9229
+ }
9230
+ updateScrollState();
9231
+ return () => {
9232
+ element.removeEventListener("scroll", updateScrollState);
9233
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
9234
+ if (frameRef.current != null) {
9235
+ window.cancelAnimationFrame(frameRef.current);
9236
+ frameRef.current = null;
9237
+ }
9238
+ };
9239
+ }, [updateScrollState]);
9240
+ return { containerRef, scrollState, updateScrollState };
9241
+ };
9126
9242
  var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
9127
9243
  const outcomeMidpointsByOutcomeId = /* @__PURE__ */ new Map();
9128
9244
  const addOutcomeMidpoints = (value) => {
@@ -9289,6 +9405,31 @@ var EventListItemContent = ({
9289
9405
  const matchedCountLabel = labels.eventItem.matchedCount(
9290
9406
  Math.max(resolvedVenueCount, visibleFooterVenues.length)
9291
9407
  );
9408
+ const handleOutcomesScrollThreshold = (0, import_react14.useCallback)(() => {
9409
+ if (!shouldEnableLazyMarketLoading) return;
9410
+ if (!isLazyMarketsQueryEnabled) {
9411
+ setIsLazyMarketsQueryEnabled(true);
9412
+ return;
9413
+ }
9414
+ if (!hasNextLazyMarketsPage) return;
9415
+ if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
9416
+ void fetchNextLazyMarketsPage();
9417
+ }, [
9418
+ fetchNextLazyMarketsPage,
9419
+ hasNextLazyMarketsPage,
9420
+ isFetchingNextLazyMarketsPage,
9421
+ isLazyMarketsQueryEnabled,
9422
+ isLoadingLazyMarkets,
9423
+ shouldEnableLazyMarketLoading
9424
+ ]);
9425
+ const {
9426
+ containerRef: outcomesContainerRef,
9427
+ scrollState: outcomesScrollState,
9428
+ updateScrollState
9429
+ } = useOutcomesScrollState({
9430
+ totalMarketCount: resolvedMarketCount,
9431
+ onReachScrollThreshold: handleOutcomesScrollThreshold
9432
+ });
9292
9433
  const shouldUseNativeLinkNavigation3 = (eventToHandle) => {
9293
9434
  return eventToHandle.metaKey || eventToHandle.ctrlKey || eventToHandle.shiftKey || eventToHandle.altKey || eventToHandle.button === 1;
9294
9435
  };
@@ -9340,29 +9481,9 @@ var EventListItemContent = ({
9340
9481
  onEventClick == null ? void 0 : onEventClick(event);
9341
9482
  }
9342
9483
  };
9343
- const handleOutcomesScroll = (0, import_react14.useCallback)(
9344
- (eventToHandle) => {
9345
- if (!shouldEnableLazyMarketLoading) return;
9346
- const element = eventToHandle.currentTarget;
9347
- const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight;
9348
- if (distanceToBottom > OUTCOMES_SCROLL_LOAD_THRESHOLD_PX) return;
9349
- if (!isLazyMarketsQueryEnabled) {
9350
- setIsLazyMarketsQueryEnabled(true);
9351
- return;
9352
- }
9353
- if (!hasNextLazyMarketsPage) return;
9354
- if (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage) return;
9355
- void fetchNextLazyMarketsPage();
9356
- },
9357
- [
9358
- fetchNextLazyMarketsPage,
9359
- hasNextLazyMarketsPage,
9360
- isFetchingNextLazyMarketsPage,
9361
- isLazyMarketsQueryEnabled,
9362
- isLoadingLazyMarkets,
9363
- shouldEnableLazyMarketLoading
9364
- ]
9365
- );
9484
+ (0, import_react14.useEffect)(() => {
9485
+ updateScrollState();
9486
+ }, [comparison.rows.length, shouldRenderLoadingOutcomeRow, updateScrollState]);
9366
9487
  const renderArbitrage = (value) => {
9367
9488
  if (value == null) return null;
9368
9489
  if (Math.abs(value) < config.market.arbitrageThreshold) return null;
@@ -9547,69 +9668,94 @@ var EventListItemContent = ({
9547
9668
  ) }) : null
9548
9669
  ] }) })
9549
9670
  ] }),
9550
- /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9551
- "div",
9552
- {
9553
- className: cn(
9554
- "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9555
- classNames == null ? void 0 : classNames.outcomes
9556
- ),
9557
- onScroll: handleOutcomesScroll,
9558
- children: [
9559
- comparison.rows.map((row) => {
9560
- var _a2;
9561
- const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
9562
- const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
9563
- const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
9564
- const priceGapSource = arbReturn == null ? "percent" : "fraction";
9565
- return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9566
- "div",
9567
- {
9568
- className: cn(
9569
- "agg-outcome-row",
9570
- "flex h-10 w-full flex-row items-center justify-between gap-3",
9571
- classNames == null ? void 0 : classNames.outcomeRow
9572
- ),
9573
- children: [
9574
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-1 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9575
- Typography,
9576
- {
9577
- variant: "body",
9578
- className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
9579
- children: row.label
9580
- }
9581
- ) }),
9582
- /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
9583
- renderArbitrage(arbitragePercent),
9584
- renderPriceGapPill(priceGapPercent, priceGapSource),
9585
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
9586
- (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
9587
- ) })
9588
- ] })
9589
- ]
9590
- },
9591
- row.id
9592
- );
9593
- }),
9594
- shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
9595
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9596
- "div",
9597
- {
9598
- "aria-hidden": "true",
9599
- className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
9600
- }
9601
- ),
9602
- /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9603
- "div",
9604
- {
9605
- "aria-hidden": "true",
9606
- className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
9607
- }
9608
- )
9609
- ] }) : null
9610
- ]
9611
- }
9612
- ),
9671
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "relative w-full", children: [
9672
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9673
+ "div",
9674
+ {
9675
+ ref: outcomesContainerRef,
9676
+ className: cn(
9677
+ "agg-outcomes flex max-h-[76px] flex-col gap-4 overflow-y-auto rounded-agg-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9678
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
9679
+ classNames == null ? void 0 : classNames.outcomes
9680
+ ),
9681
+ "aria-label": labels.marketDetails.marketOutcomesAria,
9682
+ tabIndex: 0,
9683
+ children: [
9684
+ comparison.rows.map((row) => {
9685
+ var _a2;
9686
+ const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
9687
+ const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
9688
+ const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
9689
+ const priceGapSource = arbReturn == null ? "percent" : "fraction";
9690
+ return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9691
+ "div",
9692
+ {
9693
+ className: cn(
9694
+ "agg-outcome-row",
9695
+ "flex h-10 w-full flex-row items-center justify-between gap-3",
9696
+ classNames == null ? void 0 : classNames.outcomeRow
9697
+ ),
9698
+ children: [
9699
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-1 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9700
+ Typography,
9701
+ {
9702
+ variant: "body",
9703
+ className: "agg-outcome-label min-w-0 truncate text-agg-xs leading-agg-5 md:text-agg-base md:leading-agg-6",
9704
+ children: row.label
9705
+ }
9706
+ ) }),
9707
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
9708
+ renderArbitrage(arbitragePercent),
9709
+ renderPriceGapPill(priceGapPercent, priceGapSource),
9710
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
9711
+ (price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
9712
+ ) })
9713
+ ] })
9714
+ ]
9715
+ },
9716
+ row.id
9717
+ );
9718
+ }),
9719
+ shouldRenderLoadingOutcomeRow ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "agg-outcome-row-loading flex w-full items-center justify-between gap-3", children: [
9720
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9721
+ "div",
9722
+ {
9723
+ "aria-hidden": "true",
9724
+ className: "bg-agg-separator animate-pulse h-5 rounded-agg-sm w-[200px]"
9725
+ }
9726
+ ),
9727
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9728
+ "div",
9729
+ {
9730
+ "aria-hidden": "true",
9731
+ className: "bg-agg-separator animate-pulse h-9 w-[100px] rounded-agg-full"
9732
+ }
9733
+ )
9734
+ ] }) : null
9735
+ ]
9736
+ }
9737
+ ),
9738
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9739
+ "div",
9740
+ {
9741
+ className: cn(
9742
+ "agg-outcomes-scroll-gradient-top pointer-events-none absolute inset-x-0 top-0 z-10 bg-gradient-to-b from-agg-secondary to-transparent transition-opacity duration-150",
9743
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtTop ? "opacity-100" : "opacity-0"
9744
+ ),
9745
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
9746
+ }
9747
+ ),
9748
+ /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9749
+ "div",
9750
+ {
9751
+ className: cn(
9752
+ "agg-outcomes-scroll-gradient-bottom pointer-events-none absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-agg-secondary to-transparent transition-opacity duration-150",
9753
+ outcomesScrollState.hasOverflow && !outcomesScrollState.isAtBottom ? "opacity-100" : "opacity-0"
9754
+ ),
9755
+ style: { height: OUTCOMES_SCROLL_MASK_HEIGHT_PX }
9756
+ }
9757
+ )
9758
+ ] }),
9613
9759
  /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
9614
9760
  "div",
9615
9761
  {
@@ -9627,6 +9773,14 @@ var EventListItemContent = ({
9627
9773
  "agg-event-meta flex min-w-0 flex-1 items-center gap-2 text-agg-sm leading-agg-5 truncate"
9628
9774
  ),
9629
9775
  children: [
9776
+ outcomesScrollState.remainingMarkets > 0 ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
9777
+ Typography,
9778
+ {
9779
+ variant: "body",
9780
+ className: "agg-event-remaining-markets shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground",
9781
+ children: labels.eventItem.remainingMarkets(outcomesScrollState.remainingMarkets)
9782
+ }
9783
+ ) : null,
9630
9784
  shouldShowMatchedVenueSummary ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "agg-event-matched-badge rounded-agg-full bg-agg-primary/10 px-2 py-[3px] text-agg-2xs font-agg-bold uppercase leading-agg-14 text-agg-primary", children: matchedCountLabel }) : null,
9631
9785
  singleFooterVenue ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("span", { className: "agg-event-single-venue flex min-w-0 items-center gap-1 overflow-hidden", children: [
9632
9786
  /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
@@ -9721,7 +9875,7 @@ EventListItemV2.displayName = "EventListItemV2";
9721
9875
 
9722
9876
  // src/events/list/index.tsx
9723
9877
  var import_hooks37 = require("@agg-build/hooks");
9724
- var import_sdk13 = require("@agg-build/sdk");
9878
+ var import_sdk14 = require("@agg-build/sdk");
9725
9879
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
9726
9880
  var import_react17 = require("react");
9727
9881
 
@@ -9844,6 +9998,7 @@ CategorySidebar.displayName = "CategorySidebar";
9844
9998
 
9845
9999
  // src/events/list/event-list-tabs.tsx
9846
10000
  var import_hooks36 = require("@agg-build/hooks");
10001
+ var import_sdk13 = require("@agg-build/sdk");
9847
10002
  var import_react16 = require("react");
9848
10003
 
9849
10004
  // src/events/list/event-list.constants.ts
@@ -9868,12 +10023,6 @@ var getDefaultEventListTabs = (labels) => {
9868
10023
  venueLogo: import_sdk12.Venue.polymarket,
9869
10024
  venues: [import_sdk12.Venue.polymarket]
9870
10025
  },
9871
- {
9872
- value: import_sdk12.Venue.kalshi,
9873
- label: labels.venues.kalshi,
9874
- venueLogo: import_sdk12.Venue.kalshi,
9875
- venues: [import_sdk12.Venue.kalshi]
9876
- },
9877
10026
  {
9878
10027
  value: import_sdk12.Venue.limitless,
9879
10028
  label: labels.venues.limitless,
@@ -9937,6 +10086,7 @@ var useEventListTabs = (tabs) => {
9937
10086
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
9938
10087
  return baseTabs.flatMap((tab) => {
9939
10088
  if (!tab.venueLogo) return [tab];
10089
+ if (!(0, import_sdk13.isVenueActive)(tab.venueLogo)) return [];
9940
10090
  const availabilityState = (0, import_hooks36.getVenueAvailabilityState)({
9941
10091
  venueId: tab.venueLogo,
9942
10092
  disabledVenues,
@@ -10129,7 +10279,7 @@ var EventList = ({
10129
10279
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
10130
10280
  const resolvedTabs = useEventListTabs();
10131
10281
  const visibleVenues = (0, import_react17.useMemo)(
10132
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks37.getVisibleVenueIdsByConfig)(import_sdk13.VENUES, disabledVenues),
10282
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks37.getVisibleVenueIdsByConfig)(import_sdk14.VENUES, disabledVenues),
10133
10283
  [disabledVenues]
10134
10284
  );
10135
10285
  const [activeTabValue, setActiveTabValue] = (0, import_react17.useState)(
@@ -10705,7 +10855,7 @@ ChartTypeSwitch.displayName = "ChartTypeSwitch";
10705
10855
  var import_hooks39 = require("@agg-build/hooks");
10706
10856
 
10707
10857
  // src/events/market-details/market-details.utils.ts
10708
- var import_sdk15 = require("@agg-build/sdk");
10858
+ var import_sdk16 = require("@agg-build/sdk");
10709
10859
  var import_dayjs5 = __toESM(require("dayjs"));
10710
10860
 
10711
10861
  // src/events/item-details/event-list-item-details.utils.ts
@@ -11051,7 +11201,7 @@ var resolveMarketChartLiveState = ({
11051
11201
  };
11052
11202
 
11053
11203
  // src/events/orderbook/orderbook.utils.ts
11054
- var import_sdk14 = require("@agg-build/sdk");
11204
+ var import_sdk15 = require("@agg-build/sdk");
11055
11205
  var formatProbabilityCents = (value) => {
11056
11206
  if (value == null) return "-";
11057
11207
  const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
@@ -11107,7 +11257,7 @@ var hasBinaryLabels = (labels) => {
11107
11257
  return normalizedLabels.includes("yes") && normalizedLabels.includes("no");
11108
11258
  };
11109
11259
  var resolveInitialTab = (defaultTab) => {
11110
- const parsedTab = (0, import_sdk15.safeParse)(defaultTab, isMarketDetailsTab);
11260
+ const parsedTab = (0, import_sdk16.safeParse)(defaultTab, isMarketDetailsTab);
11111
11261
  if (parsedTab.success) return parsedTab.data;
11112
11262
  return "order-book";
11113
11263
  };
@@ -12482,13 +12632,6 @@ var parseSettlementBlocks = (input) => {
12482
12632
  }
12483
12633
  return blocks;
12484
12634
  };
12485
- var getFirstSettlementParagraph = (input) => {
12486
- if (!input) return "";
12487
- const blocks = parseSettlementBlocks(input);
12488
- const firstParagraph = blocks.find((block) => block.kind === "paragraph");
12489
- if (!firstParagraph || firstParagraph.kind !== "paragraph") return "";
12490
- return firstParagraph.lines.join(" ").trim();
12491
- };
12492
12635
  var normalizeSettlementForCompare = (input) => {
12493
12636
  return stripHtmlFragments(input).replace(/\s+/g, " ").trim().toLowerCase();
12494
12637
  };
@@ -12724,7 +12867,13 @@ var mergePerVenueValues = (current, next) => {
12724
12867
  };
12725
12868
  var prepareSettlementDifferences = (differences) => {
12726
12869
  const byCanonicalKey = /* @__PURE__ */ new Map();
12727
- for (const [originalIndex, difference] of (differences != null ? differences : []).entries()) {
12870
+ for (const [originalIndex, rawDifference] of (differences != null ? differences : []).entries()) {
12871
+ const title2 = rawDifference.title.trim();
12872
+ const perVenue = Object.fromEntries(
12873
+ Object.entries(rawDifference.perVenue).map(([venue, value]) => [venue.trim(), value.trim()]).filter(([venue, value]) => venue.length > 0 && value.length > 0)
12874
+ );
12875
+ if (!title2 || Object.keys(perVenue).length === 0) continue;
12876
+ const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
12728
12877
  const canonicalKey = resolveCanonicalDifferenceKey(difference);
12729
12878
  if (hasEqualNormalizedDateValues(difference, canonicalKey)) continue;
12730
12879
  const existing = byCanonicalKey.get(canonicalKey);
@@ -12779,17 +12928,76 @@ var resolveDifferenceIconClassName = (canonicalKey) => {
12779
12928
  return "fi-rr-info";
12780
12929
  };
12781
12930
  var buildSettlementVenueRules = ({
12782
- eventBlock,
12783
12931
  marketBlock,
12784
12932
  primaryRulesBlock,
12933
+ settlementVenues,
12785
12934
  settlementVenueRules
12786
12935
  }) => {
12787
- if (settlementVenueRules) return settlementVenueRules;
12788
- const content = [marketBlock == null ? void 0 : marketBlock.content, primaryRulesBlock == null ? void 0 : primaryRulesBlock.content, eventBlock == null ? void 0 : eventBlock.content].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n\n");
12789
- return content ? [{ venue: "polymarket", content }] : [];
12936
+ var _a, _b;
12937
+ if (settlementVenueRules) {
12938
+ const rulesByVenue = /* @__PURE__ */ new Map();
12939
+ for (const rule of settlementVenueRules) {
12940
+ const venue2 = rule.venue.trim();
12941
+ const content2 = rule.content.trim();
12942
+ if (!venue2 || !content2) continue;
12943
+ const venueRules = (_a = rulesByVenue.get(venue2)) != null ? _a : [];
12944
+ if (!venueRules.includes(content2)) venueRules.push(content2);
12945
+ rulesByVenue.set(venue2, venueRules);
12946
+ }
12947
+ return Array.from(rulesByVenue, ([venue2, contents]) => ({
12948
+ venue: venue2,
12949
+ content: contents.join("\n\n")
12950
+ }));
12951
+ }
12952
+ const content = [marketBlock == null ? void 0 : marketBlock.content, primaryRulesBlock == null ? void 0 : primaryRulesBlock.content].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n\n");
12953
+ const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
12954
+ return content && venue ? [{ venue, content }] : [];
12790
12955
  };
12791
- var getSettlementHeaderClassName = () => {
12792
- return "flex items-center justify-between gap-4";
12956
+ var isDuplicatedByVenueRules = (content, venueRules) => {
12957
+ const normalizedContent = normalizeSettlementForCompare(content);
12958
+ if (!normalizedContent) return false;
12959
+ return venueRules.some((rule) => {
12960
+ const normalizedRule = normalizeSettlementForCompare(rule.content);
12961
+ return normalizedRule.includes(normalizedContent);
12962
+ });
12963
+ };
12964
+ var SettlementVenueRules = ({
12965
+ rules,
12966
+ labels
12967
+ }) => {
12968
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-venue-rules flex w-full flex-col items-start gap-4", children: [
12969
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
12970
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
12971
+ const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
12972
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
12973
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-colors marker:hidden", children: [
12974
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12975
+ VenueLogo,
12976
+ {
12977
+ venue: rule.venue,
12978
+ size: "small",
12979
+ className: "size-4",
12980
+ ariaLabel: venueLabel
12981
+ }
12982
+ ),
12983
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-colors", children: venueLabel }),
12984
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12985
+ "i",
12986
+ {
12987
+ className: cn(
12988
+ "fi fi-rr-angle-small-down text-[14px]!",
12989
+ "group-open/agg-settlement-rule:rotate-180",
12990
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-rule:text-agg-muted-foreground transition-[colors,transform]"
12991
+ ),
12992
+ style: { fontSize: 14 },
12993
+ "aria-hidden": "true"
12994
+ }
12995
+ )
12996
+ ] }),
12997
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: rule.content }) })
12998
+ ] }, rule.venue);
12999
+ }) })
13000
+ ] });
12793
13001
  };
12794
13002
  var Settlement = ({
12795
13003
  className,
@@ -12823,13 +13031,20 @@ var Settlement = ({
12823
13031
  const primaryRulesBlock = (_c = blocks.find((block) => block.key === "primaryRules")) != null ? _c : null;
12824
13032
  const venueRuleBlocks = (0, import_react21.useMemo)(
12825
13033
  () => buildSettlementVenueRules({
12826
- eventBlock,
12827
13034
  marketBlock,
12828
13035
  primaryRulesBlock,
13036
+ settlementVenues,
12829
13037
  settlementVenueRules
12830
13038
  }),
12831
- [eventBlock, marketBlock, primaryRulesBlock, settlementVenueRules]
12832
- );
13039
+ [marketBlock, primaryRulesBlock, settlementVenues, settlementVenueRules]
13040
+ );
13041
+ const hasSettlementDifferences = settlementDifferences.length > 0;
13042
+ const hasVenueSettlementRules = venueRuleBlocks.length > 0;
13043
+ const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
13044
+ const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
13045
+ const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
13046
+ const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
13047
+ const hasSettlementContent = hasSettlementDifferences || hasVenueSettlementRules || hasStandaloneSettlementText;
12833
13048
  const defaultOpenDifferenceKey = (_e = (_d = settlementDifferences[0]) == null ? void 0 : _d.canonicalKey) != null ? _e : null;
12834
13049
  const [openDifferenceKeys, setOpenDifferenceKeys] = (0, import_react21.useState)(
12835
13050
  () => defaultOpenDifferenceKey ? [defaultOpenDifferenceKey] : []
@@ -12852,25 +13067,51 @@ var Settlement = ({
12852
13067
  }
12853
13068
  );
12854
13069
  }
13070
+ if (!hasSettlementContent) return null;
12855
13071
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
12856
- if (settlementDifferences.length > 0) {
12857
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
12858
- Card,
12859
- {
12860
- id,
12861
- className: cn(
12862
- "group/agg-settlement-card",
12863
- "flex w-full flex-col items-start gap-4 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none sm:gap-5",
12864
- className
12865
- ),
12866
- children: [
12867
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-header flex w-full flex-col items-start gap-1 text-agg-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4", children: [
12868
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
12869
- question ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-question min-w-0 text-agg-sm font-agg-normal leading-agg-5 sm:max-w-[314px] sm:truncate", children: question }) : null
12870
- ] }),
12871
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
13072
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13073
+ Card,
13074
+ {
13075
+ id,
13076
+ className: cn(
13077
+ "group/agg-settlement-card",
13078
+ "flex w-full flex-col items-start gap-4 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none sm:gap-5",
13079
+ className
13080
+ ),
13081
+ children: [
13082
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-header flex w-full flex-col items-start gap-1 text-agg-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4", children: [
13083
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "shrink-0 text-agg-xs font-agg-bold leading-agg-4 uppercase", children: resolvedSectionLabel }),
13084
+ question ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-question min-w-0 text-agg-sm font-agg-normal leading-agg-5 sm:max-w-[314px] sm:truncate", children: question }) : null
13085
+ ] }),
13086
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-sections flex w-full flex-col items-start gap-5", children: [
13087
+ hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "w-full", children: [
13088
+ standaloneEventBlock || standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13089
+ "div",
13090
+ {
13091
+ className: "agg-settlement-section agg-settlement-section-description",
13092
+ "data-source": "description",
13093
+ children: [
13094
+ standaloneEventBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: standaloneEventBlock.content }) }) : null,
13095
+ standaloneEventBlock && standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
13096
+ standaloneMarketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: standaloneMarketBlock.content }) }) : null
13097
+ ]
13098
+ }
13099
+ ) : null,
13100
+ standalonePrimaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13101
+ "div",
13102
+ {
13103
+ className: "agg-settlement-section agg-settlement-section-primaryRules",
13104
+ "data-source": "primaryRules",
13105
+ children: [
13106
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-section-label text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground mb-2", children: labels.trading.settlementPrimaryRulesLabel }),
13107
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: standalonePrimaryRulesBlock.content })
13108
+ ]
13109
+ }
13110
+ ) : null
13111
+ ] }) : null,
13112
+ hasSettlementDifferences ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-differences flex w-full flex-col items-start gap-5", children: [
12872
13113
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-center gap-2", children: [
12873
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Key differences" }),
13114
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementDifferencesTitle }),
12874
13115
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
12875
13116
  ] }),
12876
13117
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "flex w-full flex-col items-start gap-5", children: settlementDifferences.map((difference) => {
@@ -12886,7 +13127,7 @@ var Settlement = ({
12886
13127
  "button",
12887
13128
  {
12888
13129
  type: "button",
12889
- className: "flex w-full cursor-pointer items-start gap-2 text-left",
13130
+ className: "flex w-full cursor-pointer items-center gap-2 text-left group/agg-settlement-difference",
12890
13131
  "aria-expanded": isExpanded,
12891
13132
  onClick: () => handleToggleDifference(difference.canonicalKey),
12892
13133
  children: [
@@ -12901,12 +13142,16 @@ var Settlement = ({
12901
13142
  "aria-hidden": "true"
12902
13143
  }
12903
13144
  ),
12904
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "min-w-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground break-words [overflow-wrap:anywhere]", children: difference.title }),
13145
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "min-w-0 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground group-hover/agg-settlement-difference:text-agg-muted-foreground transition-colors break-words [overflow-wrap:anywhere]", children: difference.title }),
12905
13146
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12906
- Icon,
13147
+ "i",
12907
13148
  {
12908
- name: isExpanded ? "chevron-up" : "chevron-down",
12909
- className: "size-4! mt-0.5 shrink-0 text-agg-foreground",
13149
+ className: cn(
13150
+ "fi fi-rr-angle-small-down text-[14px]!",
13151
+ isExpanded && "rotate-180",
13152
+ "size-3.5! shrink-0 text-agg-foreground group-hover/agg-settlement-difference:text-agg-muted-foreground transition-[colors,transform]"
13153
+ ),
13154
+ style: { fontSize: 14 },
12910
13155
  "aria-hidden": "true"
12911
13156
  }
12912
13157
  )
@@ -12935,80 +13180,12 @@ var Settlement = ({
12935
13180
  },
12936
13181
  difference.canonicalKey
12937
13182
  );
12938
- }) }),
12939
- venueRuleBlocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
12940
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
12941
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Full rules by venue" }),
12942
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: venueRuleBlocks.map((rule) => {
12943
- const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
12944
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("details", { className: "group/agg-settlement-rule w-full", children: [
12945
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground marker:hidden", children: [
12946
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12947
- VenueLogo,
12948
- {
12949
- venue: rule.venue,
12950
- size: "small",
12951
- className: "size-4",
12952
- ariaLabel: venueLabel
12953
- }
12954
- ),
12955
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { children: venueLabel }),
12956
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
12957
- Icon,
12958
- {
12959
- name: "chevron-down",
12960
- className: "size-4! shrink-0 text-agg-foreground transition-transform group-open/agg-settlement-rule:rotate-180",
12961
- "aria-hidden": "true"
12962
- }
12963
- )
12964
- ] }),
12965
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: rule.content }) })
12966
- ] }, rule.venue);
12967
- }) })
12968
- ] }) : null
12969
- ] })
12970
- ]
12971
- }
12972
- );
12973
- }
12974
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
12975
- Card,
12976
- {
12977
- id,
12978
- className: cn(
12979
- "group/agg-settlement-card",
12980
- "flex flex-col w-full gap-5 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5 shadow-none hover:shadow-none",
12981
- className
12982
- ),
12983
- children: [
12984
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: cn("agg-settlement-header", getSettlementHeaderClassName()), children: [
12985
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
12986
- question ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-question text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question }) : null
12987
- ] }),
12988
- blocks.length === 0 && settlementDifferences.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-empty text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "agg-settlement-sections flex flex-col gap-4", children: [
12989
- eventBlock || marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
12990
- "div",
12991
- {
12992
- className: "agg-settlement-section agg-settlement-section-description",
12993
- "data-source": "description",
12994
- children: [
12995
- eventBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "eventDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: eventBlock.content }) }) : null,
12996
- eventBlock && marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("hr", { className: "agg-settlement-divider my-4 border-0 border-t border-agg-separator" }) : null,
12997
- marketBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "data-source": "marketDescription", children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: marketBlock.content }) }) : null
12998
- ]
12999
- }
13000
- ) : null,
13001
- primaryRulesBlock ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
13002
- "div",
13003
- {
13004
- className: "agg-settlement-section agg-settlement-section-primaryRules",
13005
- "data-source": "primaryRules",
13006
- children: [
13007
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "agg-settlement-section-label text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground mb-2", children: labels.trading.settlementPrimaryRulesLabel }),
13008
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementTextRenderer, { content: primaryRulesBlock.content })
13009
- ]
13010
- }
13011
- ) : null
13183
+ }) })
13184
+ ] }) : null,
13185
+ hasVenueSettlementRules ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [
13186
+ hasSettlementDifferences || hasStandaloneSettlementText ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null,
13187
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(SettlementVenueRules, { rules: venueRuleBlocks, labels })
13188
+ ] }) : null
13012
13189
  ] })
13013
13190
  ]
13014
13191
  }
@@ -13019,18 +13196,16 @@ Settlement.displayName = "Settlement";
13019
13196
  // src/events/item-details/settlement-summary.tsx
13020
13197
  var import_jsx_runtime135 = require("react/jsx-runtime");
13021
13198
  var SettlementSummary = ({
13022
- content,
13023
13199
  settlementDiff,
13024
13200
  settlementSectionId = SETTLEMENT_SECTION_ID,
13025
13201
  className
13026
13202
  }) => {
13027
13203
  const labels = (0, import_hooks45.useLabels)();
13028
- const firstParagraph = (0, import_react22.useMemo)(() => getFirstSettlementParagraph(content), [content]);
13029
13204
  const settlementDifferences = (0, import_react22.useMemo)(
13030
13205
  () => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
13031
13206
  [settlementDiff == null ? void 0 : settlementDiff.differences]
13032
13207
  );
13033
- if (!firstParagraph && settlementDifferences.length === 0) return null;
13208
+ if (settlementDifferences.length === 0) return null;
13034
13209
  const handleReadFullDetails = (event) => {
13035
13210
  event.preventDefault();
13036
13211
  event.stopPropagation();
@@ -13039,20 +13214,6 @@ var SettlementSummary = ({
13039
13214
  if (!target) return;
13040
13215
  target.scrollIntoView({ behavior: "smooth", block: "start" });
13041
13216
  };
13042
- const handleDifferencePillClick = (event, canonicalKey) => {
13043
- event.preventDefault();
13044
- event.stopPropagation();
13045
- if (typeof document === "undefined") return;
13046
- const target = document.getElementById(
13047
- getSettlementDifferenceId(settlementSectionId, canonicalKey)
13048
- );
13049
- if (!target) return;
13050
- const trigger = target.querySelector("button[aria-expanded]");
13051
- if ((trigger == null ? void 0 : trigger.getAttribute("aria-expanded")) === "false") {
13052
- trigger.click();
13053
- }
13054
- target.scrollIntoView({ behavior: "smooth", block: "start" });
13055
- };
13056
13217
  const actionButton = /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13057
13218
  "button",
13058
13219
  {
@@ -13067,85 +13228,59 @@ var SettlementSummary = ({
13067
13228
  onClick: handleReadFullDetails,
13068
13229
  children: [
13069
13230
  /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { children: labels.settlementSummary.readFullDetails }),
13070
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Icon, { name: "chevron-down", className: "size-[14px]", "aria-hidden": "true" })
13231
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
13232
+ "i",
13233
+ {
13234
+ className: "fi fi-rr-arrow-small-down size-3.5!",
13235
+ "aria-hidden": "true",
13236
+ style: { fontSize: 14 }
13237
+ }
13238
+ )
13071
13239
  ]
13072
13240
  }
13073
13241
  );
13074
- if (settlementDifferences.length > 0) {
13075
- const visibleDifferences = settlementDifferences.slice(0, 2);
13076
- const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
13077
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13078
- "div",
13079
- {
13080
- className: cn(
13081
- "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
13082
- className
13083
- ),
13084
- children: [
13085
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
13086
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
13087
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
13088
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
13089
- ] }),
13090
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
13091
- visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13092
- "button",
13093
- {
13094
- type: "button",
13095
- className: cn(
13096
- "flex h-6 max-w-full shrink-0 cursor-pointer items-center gap-2 rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground sm:max-w-[220px]",
13097
- "hover:opacity-80",
13098
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
13099
- ),
13100
- onClick: (event) => handleDifferencePillClick(event, difference.canonicalKey),
13101
- children: [
13102
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
13103
- "i",
13104
- {
13105
- className: cn(
13106
- "fi",
13107
- resolveDifferenceIconClassName(difference.canonicalKey),
13108
- "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
13109
- ),
13110
- "aria-hidden": "true"
13111
- }
13112
- ),
13113
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
13114
- ]
13115
- },
13116
- difference.canonicalKey
13117
- )),
13118
- hiddenDifferenceCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("span", { className: "flex h-6 shrink-0 items-center rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground", children: [
13119
- "+",
13120
- hiddenDifferenceCount
13121
- ] }) : null
13122
- ] })
13123
- ] }),
13124
- actionButton
13125
- ]
13126
- }
13127
- );
13128
- }
13242
+ const visibleDifferences = settlementDifferences.slice(0, 2);
13243
+ const hiddenDifferenceCount = settlementDifferences.length - visibleDifferences.length;
13129
13244
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13130
13245
  "div",
13131
13246
  {
13132
13247
  className: cn(
13133
- "agg-settlement-summary flex w-full items-center justify-between gap-4",
13248
+ "agg-settlement-summary flex w-full flex-wrap items-start justify-between gap-x-4 gap-y-2",
13134
13249
  className
13135
13250
  ),
13136
13251
  children: [
13137
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-row flex min-w-0 flex-1 items-center gap-5", children: [
13138
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }) }),
13139
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
13140
- "p",
13141
- {
13142
- className: cn(
13143
- "agg-settlement-summary-text",
13144
- "min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
13145
- ),
13146
- children: firstParagraph
13147
- }
13148
- )
13252
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex min-w-[240px] flex-1 flex-wrap items-center gap-x-5 gap-y-3", children: [
13253
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-heading flex shrink-0 items-center gap-2", children: [
13254
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: labels.settlementSummary.title }),
13255
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-agg-full bg-agg-primary text-[10px] font-agg-bold leading-[14px] text-agg-on-primary", children: settlementDifferences.length })
13256
+ ] }),
13257
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-settlement-summary-pills flex min-w-[240px] flex-1 flex-wrap items-center gap-2", children: [
13258
+ visibleDifferences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
13259
+ "span",
13260
+ {
13261
+ className: "flex h-6 max-w-full shrink-0 items-center gap-2 rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground sm:max-w-[220px]",
13262
+ children: [
13263
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
13264
+ "i",
13265
+ {
13266
+ className: cn(
13267
+ "fi",
13268
+ resolveDifferenceIconClassName(difference.canonicalKey),
13269
+ "inline-flex size-3 shrink-0 items-center justify-center text-[12px] leading-none text-agg-muted-foreground"
13270
+ ),
13271
+ "aria-hidden": "true"
13272
+ }
13273
+ ),
13274
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "min-w-0 truncate", children: difference.title })
13275
+ ]
13276
+ },
13277
+ difference.canonicalKey
13278
+ )),
13279
+ hiddenDifferenceCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("span", { className: "flex h-6 shrink-0 items-center rounded-agg-full bg-agg-secondary-hover px-3 py-1 text-agg-xs font-agg-normal leading-agg-4 text-agg-foreground", children: [
13280
+ "+",
13281
+ hiddenDifferenceCount
13282
+ ] }) : null
13283
+ ] })
13149
13284
  ] }),
13150
13285
  actionButton
13151
13286
  ]
@@ -15791,7 +15926,7 @@ var MarketDetailsContent = ({
15791
15926
  value: selectedTab === "other" ? "order-book" : selectedTab,
15792
15927
  onChange: (nextValue) => setSelectedTab(nextValue),
15793
15928
  variant: "underline",
15794
- className: "agg-market-tabs w-full px-5"
15929
+ className: "agg-market-tabs flex! w-full px-5"
15795
15930
  }
15796
15931
  ) }),
15797
15932
  /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("div", { className: "h-px w-full bg-agg-separator" })
@@ -16160,9 +16295,9 @@ var MarketDetailsList = ({
16160
16295
  MarketDetailsList.displayName = "MarketDetailsList";
16161
16296
 
16162
16297
  // src/trading/types.ts
16163
- var import_sdk16 = require("@agg-build/sdk");
16164
- var isVenue = (0, import_sdk16.enumGuard)(import_sdk16.Venue);
16165
- var parseVenue = (v) => (0, import_sdk16.safeParse)(v, isVenue);
16298
+ var import_sdk17 = require("@agg-build/sdk");
16299
+ var isVenue = (0, import_sdk17.enumGuard)(import_sdk17.Venue);
16300
+ var parseVenue = (v) => (0, import_sdk17.safeParse)(v, isVenue);
16166
16301
 
16167
16302
  // src/trading/settlement/settlement-details.tsx
16168
16303
  var import_hooks50 = require("@agg-build/hooks");
@@ -16170,33 +16305,57 @@ var import_jsx_runtime142 = require("react/jsx-runtime");
16170
16305
  var hasContent = (value) => {
16171
16306
  return typeof value === "string" && value.trim().length > 0;
16172
16307
  };
16308
+ var buildVenueSettlementRules = (venueMarkets) => {
16309
+ var _a;
16310
+ const contentByVenue = /* @__PURE__ */ new Map();
16311
+ for (const venueMarket of venueMarkets) {
16312
+ const content = [venueMarket.description, venueMarket.rulesPrimary, venueMarket.rulesSecondary].filter(hasContent).map((value) => value.trim());
16313
+ if (content.length === 0) continue;
16314
+ const venueContent = (_a = contentByVenue.get(venueMarket.venue)) != null ? _a : [];
16315
+ for (const value of content) {
16316
+ if (!venueContent.includes(value)) venueContent.push(value);
16317
+ }
16318
+ contentByVenue.set(venueMarket.venue, venueContent);
16319
+ }
16320
+ return Array.from(contentByVenue, ([venue, content]) => ({
16321
+ venue,
16322
+ content: content.join("\n\n")
16323
+ }));
16324
+ };
16173
16325
  var SettlementDetails = ({ className }) => {
16174
- var _a, _b, _c, _d, _e, _f, _g, _h;
16326
+ var _a, _b, _c, _d, _e, _f;
16175
16327
  const tradingContext = (0, import_hooks50.useEventTradingContext)();
16176
16328
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
16177
16329
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
16178
16330
  if (!selectedEvent) return null;
16179
- if (!selectedMarket) return null;
16331
+ const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks50.resolveDefaultTradingMarket)(selectedEvent);
16332
+ if (!activeMarket) return null;
16333
+ const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
16334
+ const activeMarketCluster = normalizeVenueMarketCluster(
16335
+ selectedEvent.venueMarkets,
16336
+ activeMarket.id
16337
+ );
16338
+ const activeMarketIds = new Set(activeMarketCluster.map((market) => market.id));
16339
+ const orderedActiveMarketCluster = allVenueMarkets.filter(
16340
+ (market) => activeMarketIds.has(market.id)
16341
+ );
16180
16342
  const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
16181
- const marketDescription = (_d = selectedMarket.description) != null ? _d : null;
16182
- const primaryRules = (_e = selectedMarket.rulesPrimary) != null ? _e : null;
16343
+ const marketDescription = (_d = activeMarket.description) != null ? _d : null;
16344
+ const primaryRules = (_e = activeMarket.rulesPrimary) != null ? _e : null;
16183
16345
  const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
16184
16346
  const settlementVenues = Array.from(
16185
- new Set(selectedEvent.venueMarkets.map((market) => market.venue))
16186
- );
16187
- const selectedMarketRuleContent = [
16188
- selectedMarket.description,
16189
- selectedMarket.rulesPrimary,
16190
- selectedMarket.rulesSecondary
16191
- ].filter(hasContent).join("\n\n");
16192
- const settlementVenueRules = selectedMarketRuleContent ? [{ venue: selectedMarket.venue, content: selectedMarketRuleContent }] : [];
16193
- if (!hasContent(eventDescription) && !hasContent(marketDescription) && !hasContent(primaryRules) && ((_g = settlementDiff == null ? void 0 : settlementDiff.differences.length) != null ? _g : 0) === 0) {
16347
+ new Set(orderedActiveMarketCluster.map((market) => market.venue))
16348
+ );
16349
+ const settlementVenueRules = buildVenueSettlementRules(orderedActiveMarketCluster);
16350
+ const hasSettlementDifferences = prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences).length > 0;
16351
+ const hasVenueSettlementRules = settlementVenueRules.length > 0;
16352
+ if (!hasContent(eventDescription) && !hasVenueSettlementRules && !hasSettlementDifferences) {
16194
16353
  return null;
16195
16354
  }
16196
16355
  return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "agg-settlement-list flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "agg-settlement-list-item", children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
16197
16356
  Settlement,
16198
16357
  {
16199
- question: (_h = selectedMarket.question) != null ? _h : selectedEvent.title,
16358
+ question: selectedEvent.title,
16200
16359
  eventDescription,
16201
16360
  marketDescription,
16202
16361
  primaryRules,
@@ -16745,7 +16904,7 @@ var enableExecutionDebugInBrowser = (initial) => {
16745
16904
  };
16746
16905
 
16747
16906
  // src/trading/place-order/index.place-order.execution-steps.ts
16748
- var import_sdk17 = require("@agg-build/sdk");
16907
+ var import_sdk18 = require("@agg-build/sdk");
16749
16908
  var WAIT_STEP_TYPES = /* @__PURE__ */ new Set(["_wait", "wait"]);
16750
16909
  var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
16751
16910
  "check-balance",
@@ -16756,14 +16915,14 @@ var CHECKING_BALANCE_STEP_TYPES = /* @__PURE__ */ new Set([
16756
16915
  var VENUE_BUY_SELL_REGEX = /^(?:buy|sell)-([a-z]+)$/;
16757
16916
  var VENUE_FINALIZE_REGEX = /^([a-z]+)-finalize$/;
16758
16917
  var VENUE_NAME_MAP = {
16759
- kalshi: import_sdk17.Venue.kalshi,
16760
- polymarket: import_sdk17.Venue.polymarket,
16761
- limitless: import_sdk17.Venue.limitless,
16762
- opinion: import_sdk17.Venue.opinion,
16763
- predict: import_sdk17.Venue.predict,
16764
- probable: import_sdk17.Venue.probable,
16765
- myriad: import_sdk17.Venue.myriad,
16766
- hyperliquid: import_sdk17.Venue.hyperliquid
16918
+ kalshi: import_sdk18.Venue.kalshi,
16919
+ polymarket: import_sdk18.Venue.polymarket,
16920
+ limitless: import_sdk18.Venue.limitless,
16921
+ opinion: import_sdk18.Venue.opinion,
16922
+ predict: import_sdk18.Venue.predict,
16923
+ probable: import_sdk18.Venue.probable,
16924
+ myriad: import_sdk18.Venue.myriad,
16925
+ hyperliquid: import_sdk18.Venue.hyperliquid
16767
16926
  };
16768
16927
  var parseVenueName = (raw) => VENUE_NAME_MAP[raw];
16769
16928
  var NON_VENUE_FINALIZE_PREFIXES = /* @__PURE__ */ new Set(["bridge"]);
@@ -16944,6 +17103,10 @@ var extractGeoBlockedVenues = (warnings) => {
16944
17103
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
16945
17104
  );
16946
17105
  };
17106
+ var hasLowLiquidityWarning = (warnings) => {
17107
+ if (!(warnings == null ? void 0 : warnings.length)) return false;
17108
+ return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
17109
+ };
16947
17110
  var getPlaceOrderContainerClassName = () => {
16948
17111
  return PLACE_ORDER_CONTAINER_CLASS_NAME;
16949
17112
  };
@@ -19910,6 +20073,7 @@ var PlaceOrder = ({
19910
20073
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
19911
20074
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
19912
20075
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
20076
+ const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
19913
20077
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
19914
20078
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isBelowMinimum || isQuoteLoading || !selectedRouteCard || !selectedRouteCard.quoteData.quoteId || selectedRouteGeoBlocked || !isAuthenticated || quoteStatus !== void 0;
19915
20079
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading);
@@ -20716,6 +20880,25 @@ var PlaceOrder = ({
20716
20880
  children: actionLabel
20717
20881
  }
20718
20882
  ),
20883
+ shouldShowLowLiquidityWarning ? /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
20884
+ "div",
20885
+ {
20886
+ className: "agg-order-low-liquidity-warning flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
20887
+ role: "status",
20888
+ children: [
20889
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
20890
+ Icon,
20891
+ {
20892
+ name: "warning-filled",
20893
+ size: "small",
20894
+ className: "h-4! w-4! shrink-0 text-agg-warning",
20895
+ "aria-hidden": "true"
20896
+ }
20897
+ ),
20898
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: tradingLabels.lowLiquidityWarning })
20899
+ ]
20900
+ }
20901
+ ) : null,
20719
20902
  !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown ? /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
20720
20903
  /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
20721
20904
  Icon,
@@ -23464,7 +23647,7 @@ var HomeSearchResults = ({
23464
23647
  const eventListTabs = useEventListTabs();
23465
23648
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
23466
23649
  const visibleVenues = (0, import_react42.useMemo)(
23467
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks62.getVisibleVenueIdsByConfig)(import_sdk18.VENUES, disabledVenues),
23650
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks62.getVisibleVenueIdsByConfig)(import_sdk19.VENUES, disabledVenues),
23468
23651
  [disabledVenues]
23469
23652
  );
23470
23653
  const activeVenueTab = (0, import_react42.useMemo)(() => {
@@ -23951,7 +24134,7 @@ HomePage.displayName = "HomePage";
23951
24134
 
23952
24135
  // src/pages/user-profile/index.tsx
23953
24136
  var import_hooks68 = require("@agg-build/hooks");
23954
- var import_sdk20 = require("@agg-build/sdk");
24137
+ var import_sdk21 = require("@agg-build/sdk");
23955
24138
  var import_react44 = require("react");
23956
24139
 
23957
24140
  // src/pages/user-profile/chain-display.ts
@@ -24190,17 +24373,17 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
24190
24373
 
24191
24374
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
24192
24375
  var import_hooks64 = require("@agg-build/hooks");
24193
- var import_sdk19 = require("@agg-build/sdk");
24376
+ var import_sdk20 = require("@agg-build/sdk");
24194
24377
  var import_jsx_runtime156 = require("react/jsx-runtime");
24195
24378
  var CLAIM_VENUE_LABELS = {
24196
- [import_sdk19.Venue.kalshi]: "Kalshi",
24197
- [import_sdk19.Venue.polymarket]: "Polymarket",
24198
- [import_sdk19.Venue.limitless]: "Limitless",
24199
- [import_sdk19.Venue.opinion]: "Opinion",
24200
- [import_sdk19.Venue.predict]: "Predict",
24201
- [import_sdk19.Venue.probable]: "Probable",
24202
- [import_sdk19.Venue.myriad]: "Myriad",
24203
- [import_sdk19.Venue.hyperliquid]: "Hyperliquid"
24379
+ [import_sdk20.Venue.kalshi]: "Kalshi",
24380
+ [import_sdk20.Venue.polymarket]: "Polymarket",
24381
+ [import_sdk20.Venue.limitless]: "Limitless",
24382
+ [import_sdk20.Venue.opinion]: "Opinion",
24383
+ [import_sdk20.Venue.predict]: "Predict",
24384
+ [import_sdk20.Venue.probable]: "Probable",
24385
+ [import_sdk20.Venue.myriad]: "Myriad",
24386
+ [import_sdk20.Venue.hyperliquid]: "Hyperliquid"
24204
24387
  };
24205
24388
  var ClaimActivityBreakdownModal = ({
24206
24389
  activity,
@@ -25107,10 +25290,6 @@ EmptyState.displayName = "EmptyState";
25107
25290
  // src/pages/user-profile/components/position-row.tsx
25108
25291
  var import_hooks65 = require("@agg-build/hooks");
25109
25292
  var import_jsx_runtime159 = require("react/jsx-runtime");
25110
- var floorToTwoDecimals = (value) => {
25111
- if (!Number.isFinite(value) || value <= 0) return 0;
25112
- return Math.trunc(value * 100) / 100;
25113
- };
25114
25293
  var shouldUseNativeLinkNavigation2 = (event) => {
25115
25294
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
25116
25295
  };
@@ -25123,32 +25302,21 @@ var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime1
25123
25302
  var ResolutionPill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
25124
25303
  var VenueShares = ({
25125
25304
  model,
25126
- totalSharesLabel,
25127
25305
  className,
25128
25306
  keyPrefix
25129
25307
  }) => {
25130
- if (!totalSharesLabel && model.venueShareBreakdown.length === 0) return null;
25131
- return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { className: cn(className, "gap-2"), children: [
25132
- model.venueShareBreakdown.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "flex items-center gap-1", children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
25133
- Tooltip,
25134
- {
25135
- content: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { children: row.sharesLabel }),
25136
- "aria-label": `${row.venue} shares`,
25137
- side: "top",
25138
- children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
25139
- "span",
25140
- {
25141
- tabIndex: 0,
25142
- className: "cursor-help rounded-agg-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
25143
- "aria-label": `${row.venue} shares`,
25144
- children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
25145
- }
25146
- )
25147
- },
25148
- `${keyPrefix}-${row.venue}-${String(index)}`
25149
- )) }) : null,
25150
- totalSharesLabel ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: totalSharesLabel }) : null
25151
- ] });
25308
+ if (model.venueShareBreakdown.length === 0) return null;
25309
+ return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
25310
+ "div",
25311
+ {
25312
+ className: "flex min-w-0 max-w-full items-center gap-1",
25313
+ children: [
25314
+ /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
25315
+ /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
25316
+ ]
25317
+ },
25318
+ `${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
25319
+ )) });
25152
25320
  };
25153
25321
  var StatusBadge = ({
25154
25322
  status,
@@ -25265,7 +25433,6 @@ var PositionRow = ({
25265
25433
  finalPrefix: labels.finalPrefix
25266
25434
  });
25267
25435
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
25268
- const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
25269
25436
  const handleClaim = (event) => {
25270
25437
  event.preventDefault();
25271
25438
  event.stopPropagation();
@@ -25326,7 +25493,6 @@ var PositionRow = ({
25326
25493
  VenueShares,
25327
25494
  {
25328
25495
  model,
25329
- totalSharesLabel,
25330
25496
  keyPrefix: "desktop",
25331
25497
  className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
25332
25498
  }
@@ -25341,7 +25507,6 @@ var PositionRow = ({
25341
25507
  VenueShares,
25342
25508
  {
25343
25509
  model,
25344
- totalSharesLabel,
25345
25510
  keyPrefix: "mobile",
25346
25511
  className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
25347
25512
  }
@@ -26536,10 +26701,10 @@ var toRedeemTransactions = (item) => {
26536
26701
  });
26537
26702
  };
26538
26703
  var POSITION_ROW_VENUE_ORDER = [
26539
- import_sdk20.Venue.polymarket,
26540
- import_sdk20.Venue.kalshi,
26541
- import_sdk20.Venue.opinion,
26542
- import_sdk20.Venue.limitless
26704
+ import_sdk21.Venue.polymarket,
26705
+ import_sdk21.Venue.kalshi,
26706
+ import_sdk21.Venue.opinion,
26707
+ import_sdk21.Venue.limitless
26543
26708
  ];
26544
26709
  function venueBreakdownSortKey(venue) {
26545
26710
  const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
@@ -26553,7 +26718,19 @@ function buildVenueShareBreakdown(outcome) {
26553
26718
  if (breakdown.length === 0) {
26554
26719
  return [];
26555
26720
  }
26556
- const sorted = [...breakdown].sort(
26721
+ const aggregatedByVenue = breakdown.reduce(
26722
+ (acc, row) => {
26723
+ const existing = acc.get(row.venue);
26724
+ if (existing) {
26725
+ existing.size += row.size;
26726
+ return acc;
26727
+ }
26728
+ acc.set(row.venue, { venue: row.venue, size: row.size });
26729
+ return acc;
26730
+ },
26731
+ /* @__PURE__ */ new Map()
26732
+ );
26733
+ const sorted = [...aggregatedByVenue.values()].sort(
26557
26734
  (a, b) => venueBreakdownSortKey(a.venue) - venueBreakdownSortKey(b.venue)
26558
26735
  );
26559
26736
  return sorted.map((row) => ({