@agg-build/ui 4.17.2 → 4.18.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 (105) hide show
  1. package/dist/{chunk-7E4UXCEX.mjs → chunk-2OBJ7DYT.mjs} +1227 -534
  2. package/dist/{chunk-RZLM3M5R.mjs → chunk-2UPO6G3S.mjs} +1251 -2578
  3. package/dist/{chunk-3Y2GCNVL.mjs → chunk-FTWJRLJQ.mjs} +753 -3835
  4. package/dist/chunk-HFL3CEWG.mjs +3482 -0
  5. package/dist/{chunk-TK62UB5F.mjs → chunk-JJ3VVCEP.mjs} +6 -13
  6. package/dist/{chunk-B5ALKYD5.mjs → chunk-NRPS2D3Q.mjs} +176 -17
  7. package/dist/{chunk-BBDFSTIA.mjs → chunk-WIGSRHUG.mjs} +1532 -741
  8. package/dist/chunk-WSZYDOZN.mjs +2040 -0
  9. package/dist/{chunk-JI5KV4QI.mjs → chunk-ZNOAKSPT.mjs} +8 -10
  10. package/dist/event-market-GX24AP2H.mjs +21 -0
  11. package/dist/events.js +2960 -1523
  12. package/dist/events.mjs +6 -4
  13. package/dist/index.js +36423 -31013
  14. package/dist/index.mjs +34 -22
  15. package/dist/modals.js +1763 -1456
  16. package/dist/modals.mjs +5 -3
  17. package/dist/pages.js +34153 -28313
  18. package/dist/pages.mjs +17 -8
  19. package/dist/primitives.js +1552 -786
  20. package/dist/primitives.mjs +1 -1
  21. package/dist/styles.css +1 -1
  22. package/dist/tailwind.css +1 -1
  23. package/dist/trading.js +2559 -1499
  24. package/dist/trading.mjs +4 -4
  25. package/dist/types/events/item-details/event-chart-window.d.mts +9 -0
  26. package/dist/types/events/item-details/event-chart-window.d.ts +9 -0
  27. package/dist/types/events/item-details/event-list-item-details.types.d.mts +7 -0
  28. package/dist/types/events/item-details/event-list-item-details.types.d.ts +7 -0
  29. package/dist/types/events/item-details/event-markets-chart.d.mts +12 -0
  30. package/dist/types/events/item-details/event-markets-chart.d.ts +12 -0
  31. package/dist/types/events/item-details/event-markets-chart.utils.d.mts +23 -0
  32. package/dist/types/events/item-details/event-markets-chart.utils.d.ts +23 -0
  33. package/dist/types/events/list/event-list.constants.d.mts +2 -0
  34. package/dist/types/events/list/event-list.constants.d.ts +2 -0
  35. package/dist/types/events/market-details/use-visible-market-streams.d.mts +7 -0
  36. package/dist/types/events/market-details/use-visible-market-streams.d.ts +7 -0
  37. package/dist/types/events/shared/chart-source-caption.d.mts +4 -0
  38. package/dist/types/events/shared/chart-source-caption.d.ts +4 -0
  39. package/dist/types/events/shared/chart-venue-selection.d.mts +11 -0
  40. package/dist/types/events/shared/chart-venue-selection.d.ts +11 -0
  41. package/dist/types/events/shared/use-chart-orderbook.d.mts +23 -0
  42. package/dist/types/events/shared/use-chart-orderbook.d.ts +23 -0
  43. package/dist/types/onboarding/index.d.mts +1 -0
  44. package/dist/types/onboarding/index.d.ts +1 -0
  45. package/dist/types/onboarding/steps/connect-prophetx-modal.d.mts +12 -0
  46. package/dist/types/onboarding/steps/connect-prophetx-modal.d.ts +12 -0
  47. package/dist/types/pages/event-market/event-market.types.d.mts +5 -0
  48. package/dist/types/pages/event-market/event-market.types.d.ts +5 -0
  49. package/dist/types/pages/event-market/event-open-orders.d.mts +50 -0
  50. package/dist/types/pages/event-market/event-open-orders.d.ts +50 -0
  51. package/dist/types/pages/event-market/index.d.mts +3 -0
  52. package/dist/types/pages/event-market/index.d.ts +3 -0
  53. package/dist/types/pages/event-market/sports-event-market-page.d.mts +1 -1
  54. package/dist/types/pages/event-market/sports-event-market-page.d.ts +1 -1
  55. package/dist/types/pages/event-market/use-event-open-orders.d.mts +27 -0
  56. package/dist/types/pages/event-market/use-event-open-orders.d.ts +27 -0
  57. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -0
  58. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -0
  59. package/dist/types/pages/user-profile/components/betdex-account-activity.d.mts +4 -0
  60. package/dist/types/pages/user-profile/components/betdex-account-activity.d.ts +4 -0
  61. package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +2 -0
  62. package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +2 -0
  63. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +7 -0
  64. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +7 -0
  65. package/dist/types/pages/user-profile/components/open-order-row.d.mts +8 -1
  66. package/dist/types/pages/user-profile/components/open-order-row.d.ts +8 -1
  67. package/dist/types/pages/user-profile/cost-basis-display.d.mts +29 -0
  68. package/dist/types/pages/user-profile/cost-basis-display.d.ts +29 -0
  69. package/dist/types/pages/user-profile/user-profile.types.d.mts +5 -0
  70. package/dist/types/pages/user-profile/user-profile.types.d.ts +5 -0
  71. package/dist/types/primitives/chart/chart.constants.d.mts +7 -0
  72. package/dist/types/primitives/chart/chart.constants.d.ts +7 -0
  73. package/dist/types/primitives/chart/chart.types.d.mts +24 -2
  74. package/dist/types/primitives/chart/chart.types.d.ts +24 -2
  75. package/dist/types/primitives/chart/index.d.mts +2 -2
  76. package/dist/types/primitives/chart/index.d.ts +2 -2
  77. package/dist/types/primitives/chart/probability-chart.d.mts +22 -0
  78. package/dist/types/primitives/chart/probability-chart.d.ts +22 -0
  79. package/dist/types/primitives/chart/probability-chart.utils.d.mts +12 -0
  80. package/dist/types/primitives/chart/probability-chart.utils.d.ts +12 -0
  81. package/dist/types/primitives/chart/probability-live-tail.d.mts +16 -0
  82. package/dist/types/primitives/chart/probability-live-tail.d.ts +16 -0
  83. package/dist/types/primitives/remote-image/index.d.mts +1 -1
  84. package/dist/types/primitives/remote-image/index.d.ts +1 -1
  85. package/dist/types/primitives/remote-image/remote-image.types.d.mts +6 -0
  86. package/dist/types/primitives/remote-image/remote-image.types.d.ts +6 -0
  87. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.mts +6 -0
  88. package/dist/types/primitives/skeleton/views/event-list-item-skeleton-view.d.ts +6 -0
  89. package/dist/types/primitives/venue-logo/svg/logo-betdex.d.mts +12 -0
  90. package/dist/types/primitives/venue-logo/svg/logo-betdex.d.ts +12 -0
  91. package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.mts +7 -0
  92. package/dist/types/primitives/venue-logo/svg/logo-tiprun.d.ts +7 -0
  93. package/dist/types/shared/open-orders.d.mts +63 -0
  94. package/dist/types/shared/open-orders.d.ts +63 -0
  95. package/dist/types/shared/use-open-order-cancellation.d.mts +18 -0
  96. package/dist/types/shared/use-open-order-cancellation.d.ts +18 -0
  97. package/dist/types/trading/manage-betdex-account-modal.d.mts +5 -0
  98. package/dist/types/trading/manage-betdex-account-modal.d.ts +5 -0
  99. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +2 -0
  100. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +2 -0
  101. package/dist/types/trading/place-order/index.place-order.types.d.mts +5 -0
  102. package/dist/types/trading/place-order/index.place-order.types.d.ts +5 -0
  103. package/dist/types/trading/place-order/index.place-order.utils.d.mts +6 -1
  104. package/dist/types/trading/place-order/index.place-order.utils.d.ts +6 -1
  105. package/package.json +3 -3
@@ -9,13 +9,14 @@ import {
9
9
  getTradingVenueLabel,
10
10
  prepareSettlementDifferences,
11
11
  resolveOrderEligibilityMessage
12
- } from "./chunk-TK62UB5F.mjs";
12
+ } from "./chunk-JJ3VVCEP.mjs";
13
13
  import {
14
14
  ConnectKalshiModal,
15
+ ConnectProphetxModal,
15
16
  GeoBlockBanner,
16
17
  SharedKycModal,
17
18
  subscribeAggDepositNotification
18
- } from "./chunk-B5ALKYD5.mjs";
19
+ } from "./chunk-NRPS2D3Q.mjs";
19
20
  import {
20
21
  AGG_TERMS_OF_SERVICE_URL,
21
22
  Button,
@@ -23,14 +24,25 @@ import {
23
24
  Card,
24
25
  CloseIcon,
25
26
  CurrencyInput,
27
+ DEFAULT_SLIPPAGE_VALUE,
28
+ HIGH_SLIPPAGE_THRESHOLD,
26
29
  Icon,
27
30
  InlineAlert,
28
31
  LoadingIcon,
32
+ MIN_BUY_ORDER_AMOUNT,
33
+ MIN_SELL_ORDER_SHARES,
29
34
  Modal,
35
+ PLACE_ORDER_CONTAINER_CLASS_NAME,
36
+ PLACE_ORDER_DEFAULT_AMOUNT,
37
+ PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID,
38
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
39
+ PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES,
40
+ PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT,
30
41
  PlaceOrderRouteCardSkeleton,
31
42
  RemoteImage,
32
43
  Select,
33
44
  Skeleton,
45
+ SkeletonBlock,
34
46
  Tooltip,
35
47
  Typography,
36
48
  VenueLogo,
@@ -48,7 +60,7 @@ import {
48
60
  resolveResolvedOutcomeLabel,
49
61
  skeletonViews,
50
62
  useOptionalToast
51
- } from "./chunk-BBDFSTIA.mjs";
63
+ } from "./chunk-WIGSRHUG.mjs";
52
64
 
53
65
  // src/trading/types.ts
54
66
  import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
@@ -59,9 +71,12 @@ var parseAmount = (v) => safeParse(v, isFiniteNonNeg);
59
71
  // src/trading/settlement/settlement-details.tsx
60
72
  import {
61
73
  resolveDefaultTradingMarket,
62
- useEventTradingContext
74
+ useEventTradingContext,
75
+ useSettlementDetailsData,
76
+ useLabels,
77
+ useVisibleIds
63
78
  } from "@agg-build/hooks";
64
- import { jsx } from "react/jsx-runtime";
79
+ import { jsx, jsxs } from "react/jsx-runtime";
65
80
  var hasContent = (value) => {
66
81
  return typeof value === "string" && value.trim().length > 0;
67
82
  };
@@ -83,13 +98,83 @@ var buildVenueSettlementRules = (venueMarkets) => {
83
98
  }));
84
99
  };
85
100
  var SettlementDetails = ({ className }) => {
86
- var _a, _b, _c, _d, _e, _f;
101
+ var _a, _b;
87
102
  const tradingContext = useEventTradingContext();
88
103
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
89
104
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
90
105
  if (!selectedEvent) return null;
91
106
  const activeMarket = selectedMarket != null ? selectedMarket : resolveDefaultTradingMarket(selectedEvent);
92
107
  if (!activeMarket) return null;
108
+ const event = selectedEvent;
109
+ const market = activeMarket;
110
+ if (event.detailsDeferred || market.detailsDeferred)
111
+ return /* @__PURE__ */ jsx(
112
+ DeferredSettlementDetails,
113
+ {
114
+ event,
115
+ market,
116
+ className
117
+ },
118
+ `${event.id}:${market.id}`
119
+ );
120
+ return /* @__PURE__ */ jsx(SettlementDetailsContent, { event, market, className });
121
+ };
122
+ var DeferredSettlementDetails = ({
123
+ event,
124
+ market,
125
+ className
126
+ }) => {
127
+ var _a, _b, _c, _d;
128
+ const labels = useLabels();
129
+ const { visibleIds, register } = useVisibleIds({ rootMargin: "200px" });
130
+ const visible = typeof IntersectionObserver === "undefined" || visibleIds.has(market.id);
131
+ const needsEvent = event.detailsDeferred === true;
132
+ const needsMarket = market.detailsDeferred === true;
133
+ const { eventQuery, marketQuery } = useSettlementDetailsData({
134
+ eventId: event.id,
135
+ market,
136
+ enabled: visible,
137
+ needsEvent,
138
+ needsMarket
139
+ });
140
+ const failed = needsEvent && eventQuery.isError || needsMarket && marketQuery.isError;
141
+ const pending = needsEvent && !eventQuery.data || needsMarket && !marketQuery.data;
142
+ const selectedEvent = __spreadProps(__spreadValues(__spreadValues({}, event), eventQuery.data), {
143
+ venueMarkets: (_b = (_a = marketQuery.data) == null ? void 0 : _a.markets) != null ? _b : event.venueMarkets
144
+ });
145
+ const selectedMarket = (_d = (_c = marketQuery.data) == null ? void 0 : _c.selected) != null ? _d : market;
146
+ return /* @__PURE__ */ jsxs("div", { ref: register(market.id), className: "agg-settlement-details-deferred", children: [
147
+ failed ? /* @__PURE__ */ jsxs("div", { role: "alert", className: "flex flex-col gap-3 text-agg-muted-foreground", children: [
148
+ /* @__PURE__ */ jsx("p", { children: labels.trading.settlementDetailsLoadError }),
149
+ /* @__PURE__ */ jsx(
150
+ Button,
151
+ {
152
+ variant: "secondary",
153
+ isLoading: eventQuery.isFetching || marketQuery.isFetching,
154
+ onClick: () => {
155
+ if (needsEvent) void eventQuery.refetch();
156
+ if (needsMarket) void marketQuery.refetch();
157
+ },
158
+ children: labels.common.retry
159
+ }
160
+ )
161
+ ] }) : pending ? /* @__PURE__ */ jsx(Settlement, { question: event.title, isLoading: true, className }) : null,
162
+ (!pending || failed) && /* @__PURE__ */ jsx(
163
+ SettlementDetailsContent,
164
+ {
165
+ event: selectedEvent,
166
+ market: selectedMarket,
167
+ className
168
+ }
169
+ )
170
+ ] });
171
+ };
172
+ var SettlementDetailsContent = ({
173
+ event: selectedEvent,
174
+ market: activeMarket,
175
+ className
176
+ }) => {
177
+ var _a, _b, _c, _d;
93
178
  const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
94
179
  const activeMarketCluster = normalizeVenueMarketCluster(
95
180
  selectedEvent.venueMarkets,
@@ -99,10 +184,10 @@ var SettlementDetails = ({ className }) => {
99
184
  const orderedActiveMarketCluster = allVenueMarkets.filter(
100
185
  (market) => activeMarketIds.has(market.id)
101
186
  );
102
- const eventDescription = (_c = selectedEvent.description) != null ? _c : null;
103
- const marketDescription = (_d = activeMarket.description) != null ? _d : null;
104
- const primaryRules = (_e = activeMarket.rulesPrimary) != null ? _e : null;
105
- const settlementDiff = (_f = selectedEvent.settlementDiff) != null ? _f : null;
187
+ const eventDescription = (_a = selectedEvent.description) != null ? _a : null;
188
+ const marketDescription = (_b = activeMarket.description) != null ? _b : null;
189
+ const primaryRules = (_c = activeMarket.rulesPrimary) != null ? _c : null;
190
+ const settlementDiff = (_d = selectedEvent.settlementDiff) != null ? _d : null;
106
191
  const settlementVenues = Array.from(
107
192
  new Set(orderedActiveMarketCluster.map((market) => market.venue))
108
193
  );
@@ -148,7 +233,8 @@ import {
148
233
  useExecutionPositions,
149
234
  useExecutionProgress,
150
235
  useGeoBlock,
151
- useLabels as useLabels2,
236
+ useHostedVenueAccount as useHostedVenueAccount2,
237
+ useLabels as useLabels7,
152
238
  useLimitOrderVenueQuotes,
153
239
  useLiveBestPrices,
154
240
  useLiveOutcomePrices,
@@ -165,14 +251,14 @@ import {
165
251
  import {
166
252
  adjustLimitPriceRawToTick,
167
253
  LIMIT_PRICE_RAW_SCALE as LIMIT_ORDER_RAW_SCALE,
168
- Venue as Venue4
254
+ Venue as Venue5
169
255
  } from "@agg-build/sdk";
170
256
  import NumberFlow from "@number-flow/react";
171
257
  import * as Popover from "@radix-ui/react-popover";
172
258
  import dayjs from "dayjs";
173
259
  import timezone from "dayjs/plugin/timezone";
174
260
  import utc from "dayjs/plugin/utc";
175
- import { Fragment as Fragment2, useCallback as useCallback3, useEffect as useEffect4, useId, useMemo, useRef as useRef4, useState as useState3 } from "react";
261
+ import { Fragment as Fragment3, useCallback as useCallback3, useEffect as useEffect4, useId, useMemo, useRef as useRef4, useState as useState6 } from "react";
176
262
 
177
263
  // src/kyc/shared-kyc.ts
178
264
  import { Venue as Venue2 } from "@agg-build/sdk";
@@ -386,7 +472,7 @@ import {
386
472
  useUserActivity
387
473
  } from "@agg-build/hooks";
388
474
  import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2 } from "react";
389
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
475
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
390
476
  function AggNotificationEventsProvider({
391
477
  children,
392
478
  enabled = true,
@@ -396,7 +482,7 @@ function AggNotificationEventsProvider({
396
482
  if (!aggClient) {
397
483
  return /* @__PURE__ */ jsx2(Fragment, { children });
398
484
  }
399
- return /* @__PURE__ */ jsxs(Fragment, { children: [
485
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
400
486
  /* @__PURE__ */ jsx2(AggNotificationEventsBridge, { enabled, depositActivityLimit }),
401
487
  children
402
488
  ] });
@@ -743,14 +829,14 @@ var requestAggWithdrawModalOpen = () => {
743
829
  };
744
830
 
745
831
  // src/trading/fund-kalshi-modal.tsx
746
- import { useLabels } from "@agg-build/hooks";
832
+ import { useLabels as useLabels2 } from "@agg-build/hooks";
747
833
  import { Venue as Venue3 } from "@agg-build/sdk";
748
834
  import * as Dialog from "@radix-ui/react-dialog";
749
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
835
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
750
836
  var FundKalshiModal = ({ open, onOpenChange }) => {
751
- const labels = useLabels();
837
+ const labels = useLabels2();
752
838
  const modalLabels = labels.trading.fundKalshiModal;
753
- return /* @__PURE__ */ jsx3(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(
839
+ return /* @__PURE__ */ jsx3(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(
754
840
  Modal.Container,
755
841
  {
756
842
  maxWidth: "600px",
@@ -765,16 +851,16 @@ var FundKalshiModal = ({ open, onOpenChange }) => {
765
851
  children: /* @__PURE__ */ jsx3(Icon, { name: "close", size: "medium" })
766
852
  }
767
853
  ),
768
- /* @__PURE__ */ jsx3(Modal.Body, { classNames: { root: "!px-5 !py-12 sm:!px-10" }, children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-8 text-center", children: [
854
+ /* @__PURE__ */ jsx3(Modal.Body, { classNames: { root: "!px-5 !py-12 sm:!px-10" }, children: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-8 text-center", children: [
769
855
  /* @__PURE__ */ jsx3(VenueLogo, { venue: Venue3.kalshi, variant: "logo", size: "large", className: "size-[60px]" }),
770
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-4", children: [
856
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-4", children: [
771
857
  /* @__PURE__ */ jsx3(Dialog.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: modalLabels.title }),
772
858
  /* @__PURE__ */ jsx3(Dialog.Description, { className: "max-w-[520px] text-agg-base leading-agg-6 text-agg-foreground", children: modalLabels.description })
773
859
  ] }),
774
- /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4 text-left", children: [
860
+ /* @__PURE__ */ jsxs3("div", { className: "flex w-full flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4 text-left", children: [
775
861
  /* @__PURE__ */ jsx3("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: modalLabels.howItWorks }),
776
- /* @__PURE__ */ jsxs2("ol", { className: "list-decimal space-y-0 pl-5 text-agg-sm leading-agg-5 text-agg-foreground", children: [
777
- /* @__PURE__ */ jsxs2("li", { children: [
862
+ /* @__PURE__ */ jsxs3("ol", { className: "list-decimal space-y-0 pl-5 text-agg-sm leading-agg-5 text-agg-foreground", children: [
863
+ /* @__PURE__ */ jsxs3("li", { children: [
778
864
  modalLabels.firstStepPrefix,
779
865
  " ",
780
866
  /* @__PURE__ */ jsx3(
@@ -793,7 +879,7 @@ var FundKalshiModal = ({ open, onOpenChange }) => {
793
879
  modalLabels.remainingSteps.map((step) => /* @__PURE__ */ jsx3("li", { children: step }, step))
794
880
  ] })
795
881
  ] }),
796
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center justify-center gap-3", children: [
882
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center justify-center gap-3", children: [
797
883
  /* @__PURE__ */ jsx3(Button, { variant: "secondary", size: "large", onClick: () => onOpenChange(false), children: modalLabels.doItLater }),
798
884
  /* @__PURE__ */ jsx3(
799
885
  Button,
@@ -813,22 +899,399 @@ var FundKalshiModal = ({ open, onOpenChange }) => {
813
899
  };
814
900
  FundKalshiModal.displayName = "FundKalshiModal";
815
901
 
816
- // src/trading/place-order/index.place-order.constants.ts
817
- var PLACE_ORDER_DEFAULT_AMOUNT = 20;
818
- var MIN_BUY_ORDER_AMOUNT = 1;
819
- var MIN_SELL_ORDER_SHARES = 1;
820
- var DEFAULT_SLIPPAGE_VALUE = "0.5";
821
- var HIGH_SLIPPAGE_THRESHOLD = 10;
822
- var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
823
- var PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID = "live-maximize-payout";
824
- var PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME = "bg-transparent text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal text-agg-foreground outline-none";
825
- var PLACE_ORDER_CONTAINER_CLASS_NAME = "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-none hover:shadow-none";
826
- var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
827
- activeNegative: "border-agg-error/50 bg-agg-error/15 font-agg-bold text-agg-error",
828
- activePositive: "border-agg-success/50 bg-agg-success/15 font-agg-bold text-agg-success",
829
- base: "flex h-11 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
830
- inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
831
- };
902
+ // src/trading/manage-betdex-account-modal.tsx
903
+ import { useLabels as useLabels6 } from "@agg-build/hooks";
904
+ import * as Dialog2 from "@radix-ui/react-dialog";
905
+
906
+ // src/pages/user-profile/components/betdex-account-card.tsx
907
+ import { useState as useState4 } from "react";
908
+ import { useHostedVenueAccount, useLabels as useLabels5 } from "@agg-build/hooks";
909
+ import { Venue as Venue4 } from "@agg-build/sdk";
910
+
911
+ // src/pages/user-profile/components/betdex-account-transfers.tsx
912
+ import { useState as useState2 } from "react";
913
+ import { useHostedVenueTransfers, useLabels as useLabels3 } from "@agg-build/hooks";
914
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
915
+ function hostedWithdrawalRaw(value) {
916
+ var _a;
917
+ const match = /^([0-9]{1,26})(?:\.([0-9]{1,6}))?$/.exec(value.trim());
918
+ if (!match) return null;
919
+ const raw = BigInt(match[1]) * BigInt(1e6) + BigInt(((_a = match[2]) != null ? _a : "").padEnd(6, "0"));
920
+ return raw > BigInt(0) ? raw.toString() : null;
921
+ }
922
+ var amountText = (raw) => {
923
+ const value = BigInt(raw);
924
+ const fraction = (value % BigInt(1e6)).toString().padStart(6, "0").replace(/0+$/, "");
925
+ return (value / BigInt(1e6)).toString() + (fraction ? "." + fraction : "");
926
+ };
927
+ function BetdexAccountTransfers({
928
+ accountId,
929
+ environment,
930
+ availableRaw,
931
+ canDeposit
932
+ }) {
933
+ const labels = useLabels3().userProfile.hostedBetdex;
934
+ const transfer = useHostedVenueTransfers(accountId, environment);
935
+ const [showWithdraw, setShowWithdraw] = useState2(false);
936
+ const [amount2, setAmount] = useState2("");
937
+ const [destination, setDestination] = useState2("");
938
+ const [actionError, setActionError] = useState2(false);
939
+ const raw = hostedWithdrawalRaw(amount2);
940
+ const withinBalance = raw !== null && (availableRaw === void 0 || BigInt(raw) <= BigInt(availableRaw));
941
+ const validDestination = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(destination.trim());
942
+ const result = transfer.withdrawal.data;
943
+ const terminal = (result == null ? void 0 : result.status) === "confirmed" || (result == null ? void 0 : result.status) === "failed";
944
+ const run = (work) => {
945
+ setActionError(false);
946
+ void work().catch(() => setActionError(true));
947
+ };
948
+ if (!transfer.isAvailable) return null;
949
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-3 border-t border-agg-separator pt-3", children: [
950
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap gap-2", children: [
951
+ canDeposit ? /* @__PURE__ */ jsx4(
952
+ Button,
953
+ {
954
+ type: "button",
955
+ variant: "secondary",
956
+ size: "small",
957
+ "aria-label": labels.deposit,
958
+ isLoading: transfer.deposit.isPending,
959
+ disabled: transfer.deposit.isPending,
960
+ onClick: () => run(() => transfer.deposit.mutateAsync()),
961
+ children: labels.deposit
962
+ }
963
+ ) : null,
964
+ /* @__PURE__ */ jsx4(
965
+ Button,
966
+ {
967
+ type: "button",
968
+ variant: "secondary",
969
+ size: "small",
970
+ "aria-expanded": showWithdraw || !!transfer.request,
971
+ onClick: () => setShowWithdraw((value) => !value),
972
+ children: labels.withdraw
973
+ }
974
+ )
975
+ ] }),
976
+ transfer.deposit.data ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-2 agg-type-caption", children: [
977
+ /* @__PURE__ */ jsx4("p", { className: "text-agg-muted-foreground", children: labels.depositInstructions[environment] }),
978
+ /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1 text-agg-muted-foreground", children: [
979
+ labels.depositAddress,
980
+ /* @__PURE__ */ jsx4(
981
+ "input",
982
+ {
983
+ readOnly: true,
984
+ value: transfer.deposit.data.address,
985
+ onFocus: (event) => event.currentTarget.select(),
986
+ className: "w-full rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
987
+ }
988
+ )
989
+ ] })
990
+ ] }) : null,
991
+ transfer.deposit.isError || transfer.withdrawal.isError || transfer.storageError || actionError ? /* @__PURE__ */ jsx4("p", { role: "alert", className: "agg-type-caption text-agg-error", children: labels.transferUnavailable }) : null,
992
+ transfer.request ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-2 agg-type-caption", children: [
993
+ /* @__PURE__ */ jsxs4("p", { children: [
994
+ labels.withdrawalAmount,
995
+ ": ",
996
+ amountText(transfer.request.amountRaw)
997
+ ] }),
998
+ /* @__PURE__ */ jsxs4("p", { className: "break-all", children: [
999
+ labels.withdrawalDestination,
1000
+ ": ",
1001
+ transfer.request.destinationAddress
1002
+ ] }),
1003
+ /* @__PURE__ */ jsx4("p", { role: "status", children: result ? labels.withdrawalStatuses[result.status] : labels.withdrawalUnknown }),
1004
+ terminal ? /* @__PURE__ */ jsx4(
1005
+ Button,
1006
+ {
1007
+ type: "button",
1008
+ variant: "tertiary",
1009
+ size: "small",
1010
+ onClick: () => {
1011
+ transfer.clear();
1012
+ setAmount("");
1013
+ setDestination("");
1014
+ setActionError(false);
1015
+ setShowWithdraw(false);
1016
+ },
1017
+ children: labels.withdrawalNew
1018
+ }
1019
+ ) : /* @__PURE__ */ jsx4(
1020
+ Button,
1021
+ {
1022
+ type: "button",
1023
+ variant: "tertiary",
1024
+ size: "small",
1025
+ "aria-label": result ? labels.withdrawalCheck : labels.withdrawalRetry,
1026
+ isLoading: transfer.withdrawal.isPending,
1027
+ disabled: transfer.withdrawal.isPending,
1028
+ onClick: () => run(transfer.check),
1029
+ children: result ? labels.withdrawalCheck : labels.withdrawalRetry
1030
+ }
1031
+ )
1032
+ ] }) : showWithdraw ? /* @__PURE__ */ jsxs4(
1033
+ "form",
1034
+ {
1035
+ className: "flex flex-col gap-3",
1036
+ onSubmit: (event) => {
1037
+ event.preventDefault();
1038
+ if (!raw || !withinBalance || !validDestination || !transfer.ready) return;
1039
+ run(() => transfer.submit(raw, destination.trim()));
1040
+ },
1041
+ children: [
1042
+ /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground", children: [
1043
+ labels.withdrawalAmount,
1044
+ /* @__PURE__ */ jsx4(
1045
+ "input",
1046
+ {
1047
+ inputMode: "decimal",
1048
+ autoComplete: "off",
1049
+ value: amount2,
1050
+ onChange: (event) => setAmount(event.target.value),
1051
+ className: "rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
1052
+ }
1053
+ )
1054
+ ] }),
1055
+ /* @__PURE__ */ jsxs4("label", { className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground", children: [
1056
+ labels.withdrawalDestination,
1057
+ /* @__PURE__ */ jsx4(
1058
+ "input",
1059
+ {
1060
+ autoComplete: "off",
1061
+ spellCheck: false,
1062
+ value: destination,
1063
+ onChange: (event) => setDestination(event.target.value),
1064
+ className: "rounded-agg-md border border-agg-separator bg-agg-primary p-2 text-agg-foreground"
1065
+ }
1066
+ )
1067
+ ] }),
1068
+ /* @__PURE__ */ jsx4(
1069
+ Button,
1070
+ {
1071
+ type: "submit",
1072
+ variant: "primary",
1073
+ size: "small",
1074
+ "aria-label": labels.withdrawalSubmit,
1075
+ disabled: !withinBalance || !validDestination || !transfer.ready || transfer.withdrawal.isPending,
1076
+ isLoading: transfer.withdrawal.isPending,
1077
+ children: labels.withdrawalSubmit
1078
+ }
1079
+ )
1080
+ ]
1081
+ }
1082
+ ) : null
1083
+ ] });
1084
+ }
1085
+
1086
+ // src/pages/user-profile/components/betdex-account-activity.tsx
1087
+ import { useState as useState3 } from "react";
1088
+ import { useHostedVenueActivity, useLabels as useLabels4 } from "@agg-build/hooks";
1089
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1090
+ function amount(raw) {
1091
+ const negative = raw.startsWith("-");
1092
+ const digits = (negative ? raw.slice(1) : raw).padStart(19, "0");
1093
+ const fraction = digits.slice(-18).replace(/0+$/, "");
1094
+ return `${negative ? "-" : "+"}${digits.slice(0, -18)}${fraction ? `.${fraction}` : ""}`;
1095
+ }
1096
+ function BetdexAccountActivity({
1097
+ accountId,
1098
+ environment
1099
+ }) {
1100
+ const labels = useLabels4().userProfile.hostedBetdex;
1101
+ const [page, setPage] = useState3(0);
1102
+ const { activity, isAvailable } = useHostedVenueActivity("betdex", page);
1103
+ if (!isAvailable) return null;
1104
+ const data = activity.data;
1105
+ const valid = (data == null ? void 0 : data.accountId) === accountId && data.environment === environment && data.page === page;
1106
+ const unavailable = activity.isError || !!data && !valid;
1107
+ return /* @__PURE__ */ jsxs5(
1108
+ "section",
1109
+ {
1110
+ "aria-label": labels.activityTitle,
1111
+ className: "flex flex-col gap-3 border-t border-agg-separator pt-3",
1112
+ children: [
1113
+ /* @__PURE__ */ jsx5("h4", { className: "agg-type-label text-agg-foreground", children: labels.activityTitle }),
1114
+ /* @__PURE__ */ jsx5("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.activityDescription }),
1115
+ activity.isPending ? /* @__PURE__ */ jsx5(SkeletonBlock, { className: "h-16 w-full" }) : null,
1116
+ unavailable ? /* @__PURE__ */ jsx5("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.activityUnavailable }) : null,
1117
+ valid && !unavailable ? data.items.length ? /* @__PURE__ */ jsx5("ul", { className: "flex flex-col gap-3 agg-type-caption", children: data.items.map((item) => /* @__PURE__ */ jsxs5("li", { className: "flex flex-col gap-1", children: [
1118
+ /* @__PURE__ */ jsxs5("div", { className: "flex justify-between gap-3 text-agg-foreground", children: [
1119
+ /* @__PURE__ */ jsx5("span", { children: labels.activityCodes[item.code] }),
1120
+ /* @__PURE__ */ jsxs5("span", { className: "break-all tabular-nums", children: [
1121
+ amount(item.amountRaw),
1122
+ " ",
1123
+ data.asset
1124
+ ] })
1125
+ ] }),
1126
+ /* @__PURE__ */ jsx5("time", { dateTime: item.createdAt, className: "text-agg-muted-foreground", children: new Date(item.createdAt).toLocaleString() })
1127
+ ] }, item.id)) }) : /* @__PURE__ */ jsx5("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.activityEmpty }) : null,
1128
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap gap-2", children: [
1129
+ /* @__PURE__ */ jsx5(
1130
+ Button,
1131
+ {
1132
+ type: "button",
1133
+ variant: "tertiary",
1134
+ size: "small",
1135
+ disabled: activity.isFetching || page === 0,
1136
+ onClick: () => setPage((value) => Math.max(0, value - 1)),
1137
+ children: labels.activityPrevious
1138
+ }
1139
+ ),
1140
+ /* @__PURE__ */ jsx5(
1141
+ Button,
1142
+ {
1143
+ type: "button",
1144
+ variant: "tertiary",
1145
+ size: "small",
1146
+ disabled: activity.isFetching || unavailable || !valid || data.nextPage === null,
1147
+ onClick: () => {
1148
+ if (valid && data.nextPage !== null) setPage(data.nextPage);
1149
+ },
1150
+ children: labels.activityNext
1151
+ }
1152
+ ),
1153
+ /* @__PURE__ */ jsx5(
1154
+ Button,
1155
+ {
1156
+ type: "button",
1157
+ variant: "tertiary",
1158
+ size: "small",
1159
+ disabled: activity.isFetching,
1160
+ onClick: () => {
1161
+ void activity.refetch();
1162
+ },
1163
+ children: labels.activityRefresh
1164
+ }
1165
+ )
1166
+ ] })
1167
+ ]
1168
+ }
1169
+ );
1170
+ }
1171
+
1172
+ // src/pages/user-profile/components/betdex-account-card.tsx
1173
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1174
+ function BetdexAccountCard() {
1175
+ var _a;
1176
+ const [showActivity, setShowActivity] = useState4(false);
1177
+ const labels = useLabels5().userProfile.hostedBetdex;
1178
+ const { account, provision, isAvailable } = useHostedVenueAccount("betdex");
1179
+ const data = account.data;
1180
+ if (!isAvailable || (data == null ? void 0 : data.status) === "disabled") return null;
1181
+ const pending = provision.isPending || (data == null ? void 0 : data.status) === "provisioning";
1182
+ const canCreate = (data == null ? void 0 : data.status) === "not_created" && data.provisioningEnabled;
1183
+ const rawLabel = (raw) => formatUsd(Number(raw) / 1e6);
1184
+ return /* @__PURE__ */ jsxs6(
1185
+ "section",
1186
+ {
1187
+ "aria-label": labels.title,
1188
+ className: "flex flex-col gap-3 rounded-agg-xl border border-agg-separator bg-agg-secondary p-5",
1189
+ children: [
1190
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1191
+ /* @__PURE__ */ jsx6(VenueLogo, { venue: Venue4.betdex, size: "small", className: "size-4" }),
1192
+ /* @__PURE__ */ jsx6("h3", { className: "agg-type-label text-agg-foreground", children: labels.title })
1193
+ ] }),
1194
+ /* @__PURE__ */ jsx6("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.description }),
1195
+ (data == null ? void 0 : data.environment) === "sandbox" ? /* @__PURE__ */ jsx6("p", { className: "agg-type-caption text-agg-warning", children: labels.sandbox }) : null,
1196
+ account.isPending ? /* @__PURE__ */ jsx6(SkeletonBlock, { className: "h-10 w-full" }) : null,
1197
+ (data == null ? void 0 : data.status) === "active" && data.balanceStatus === "available" && data.balance && !account.isError ? /* @__PURE__ */ jsx6("dl", { className: "flex flex-col gap-2 agg-type-caption", children: [
1198
+ [labels.total, data.balance.totalRaw],
1199
+ [labels.available, data.balance.availableRaw],
1200
+ [labels.reserved, data.balance.unmatchedExposureRaw]
1201
+ ].map(([label, raw]) => /* @__PURE__ */ jsxs6("div", { className: "flex justify-between gap-3", children: [
1202
+ /* @__PURE__ */ jsx6("dt", { className: "text-agg-muted-foreground", children: label }),
1203
+ /* @__PURE__ */ jsx6("dd", { className: "text-agg-foreground", children: rawLabel(raw) })
1204
+ ] }, label)) }) : null,
1205
+ pending ? /* @__PURE__ */ jsx6("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.provisioning }) : null,
1206
+ (data == null ? void 0 : data.status) === "suspended" ? /* @__PURE__ */ jsx6("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.suspended }) : null,
1207
+ account.isError || (data == null ? void 0 : data.status) === "unavailable" || (data == null ? void 0 : data.balanceStatus) === "unavailable" ? /* @__PURE__ */ jsx6("p", { role: "status", className: "agg-type-caption text-agg-muted-foreground", children: labels.unavailable }) : null,
1208
+ (data == null ? void 0 : data.status) === "not_created" && !data.provisioningEnabled ? /* @__PURE__ */ jsx6("p", { className: "agg-type-caption text-agg-muted-foreground", children: labels.provisioningUnavailable }) : null,
1209
+ provision.isError ? /* @__PURE__ */ jsx6("p", { role: "alert", className: "agg-type-caption text-agg-error", children: labels.creationFailed }) : null,
1210
+ canCreate || (data == null ? void 0 : data.status) === "provisioning" ? /* @__PURE__ */ jsx6(
1211
+ Button,
1212
+ {
1213
+ type: "button",
1214
+ "aria-label": (data == null ? void 0 : data.status) === "provisioning" ? labels.checkSetup : labels.createAccount,
1215
+ variant: "secondary",
1216
+ size: "small",
1217
+ isLoading: provision.isPending,
1218
+ disabled: provision.isPending || account.isError,
1219
+ onClick: () => provision.mutate(),
1220
+ children: (data == null ? void 0 : data.status) === "provisioning" ? labels.checkSetup : labels.createAccount
1221
+ }
1222
+ ) : null,
1223
+ /* @__PURE__ */ jsx6(
1224
+ Button,
1225
+ {
1226
+ type: "button",
1227
+ variant: "tertiary",
1228
+ size: "small",
1229
+ disabled: account.isFetching || provision.isPending,
1230
+ onClick: () => {
1231
+ void account.refetch();
1232
+ },
1233
+ children: labels.refresh
1234
+ }
1235
+ ),
1236
+ (data == null ? void 0 : data.accountId) && data.environment && ["active", "suspended"].includes(data.status) ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1237
+ /* @__PURE__ */ jsx6(
1238
+ BetdexAccountTransfers,
1239
+ {
1240
+ accountId: data.accountId,
1241
+ environment: data.environment,
1242
+ availableRaw: data.balanceStatus === "available" ? (_a = data.balance) == null ? void 0 : _a.availableRaw : void 0,
1243
+ canDeposit: data.status === "active"
1244
+ },
1245
+ `transfers:${data.accountId}:${data.environment}`
1246
+ ),
1247
+ /* @__PURE__ */ jsx6(
1248
+ Button,
1249
+ {
1250
+ type: "button",
1251
+ variant: "tertiary",
1252
+ size: "small",
1253
+ "aria-expanded": showActivity,
1254
+ onClick: () => setShowActivity((shown) => !shown),
1255
+ children: showActivity ? labels.hideActivity : labels.showActivity
1256
+ }
1257
+ ),
1258
+ showActivity ? /* @__PURE__ */ jsx6(
1259
+ BetdexAccountActivity,
1260
+ {
1261
+ accountId: data.accountId,
1262
+ environment: data.environment
1263
+ },
1264
+ `${data.accountId}:${data.environment}`
1265
+ ) : null
1266
+ ] }) : null
1267
+ ]
1268
+ }
1269
+ );
1270
+ }
1271
+
1272
+ // src/trading/manage-betdex-account-modal.tsx
1273
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1274
+ function ManageBetdexAccountModal({
1275
+ open,
1276
+ onOpenChange
1277
+ }) {
1278
+ const labels = useLabels6();
1279
+ return /* @__PURE__ */ jsx7(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs7(Modal.Container, { maxWidth: "600px", "aria-label": labels.trading.manageBetdexAccount, children: [
1280
+ /* @__PURE__ */ jsx7(
1281
+ Dialog2.Close,
1282
+ {
1283
+ "aria-label": labels.common.close,
1284
+ className: "absolute right-4 top-4 z-10 flex size-11 cursor-pointer items-center justify-center rounded-agg-full text-agg-muted-foreground hover:bg-agg-quaternary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
1285
+ children: /* @__PURE__ */ jsx7(Icon, { name: "close", size: "medium" })
1286
+ }
1287
+ ),
1288
+ /* @__PURE__ */ jsxs7(Modal.Body, { classNames: { root: "!px-5 !py-16" }, children: [
1289
+ /* @__PURE__ */ jsx7(Dialog2.Title, { className: "sr-only", children: labels.trading.manageBetdexAccount }),
1290
+ /* @__PURE__ */ jsx7(Dialog2.Description, { className: "sr-only", children: labels.userProfile.hostedBetdex.description }),
1291
+ open ? /* @__PURE__ */ jsx7(BetdexAccountCard, {}) : null
1292
+ ] })
1293
+ ] }) });
1294
+ }
832
1295
 
833
1296
  // src/trading/place-order/index.place-order.execution-debug.ts
834
1297
  var REDACTED = "[redacted]";
@@ -1124,6 +1587,29 @@ var formatChainIdLabel = (chainId) => {
1124
1587
  // src/trading/place-order/index.place-order.utils.ts
1125
1588
  var ATOMIC_UNITS = 1e6;
1126
1589
  var ATOMIC_UNITS_BIGINT = BigInt(ATOMIC_UNITS);
1590
+ var getPlaceOrderBalanceCacheKey = (balances) => {
1591
+ var _c;
1592
+ const ordered = (rows) => rows.sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)));
1593
+ return JSON.stringify({
1594
+ cash: ordered(
1595
+ balances.cash.map((_a) => {
1596
+ var _b = _a, { chains } = _b, token = __objRest(_b, ["chains"]);
1597
+ return __spreadProps(__spreadValues({}, token), {
1598
+ chains: ordered(chains.map((_a2) => {
1599
+ var _b2 = _a2, { lastSyncedAt: _observedAt } = _b2, chain = __objRest(_b2, ["lastSyncedAt"]);
1600
+ return chain;
1601
+ }))
1602
+ });
1603
+ })
1604
+ ),
1605
+ venueCash: ordered(
1606
+ ((_c = balances.venueCash) != null ? _c : []).map((_d) => {
1607
+ var _e = _d, { updatedAt: _observedAt } = _e, cash = __objRest(_e, ["updatedAt"]);
1608
+ return cash;
1609
+ })
1610
+ )
1611
+ });
1612
+ };
1127
1613
  var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
1128
1614
  minimumFractionDigits: 0,
1129
1615
  maximumFractionDigits: 1
@@ -1200,6 +1686,7 @@ var resolveSellableSharesByVenue = ({
1200
1686
  for (const outcome of (_e = (_d = group.venueMarket) == null ? void 0 : _d.venueMarketOutcomes) != null ? _e : []) {
1201
1687
  if (normalizeOutcomeName(outcome.label) !== normalizedSelectedOutcomeLabel) continue;
1202
1688
  for (const breakdown of (_f = outcome.venueBreakdown) != null ? _f : []) {
1689
+ if (breakdown.executionBackend === "direct" && breakdown.venue === "prophetx") continue;
1203
1690
  const matchesMarketId = selectedMarketIdSet.size === 0 || selectedMarketIdSet.has(group.targetMarketId) || selectedMarketIdSet.has(breakdown.venueMarketId);
1204
1691
  if (!matchesMarketId) continue;
1205
1692
  const size = Number.isFinite(breakdown.size) ? breakdown.size : 0;
@@ -1354,7 +1841,10 @@ var mapQuoteDataToRoutingRows = (quoteData, tradeSide = "buy") => {
1354
1841
  amount: tradeSide === "sell" && fill.outAmount != null ? Number(fill.outAmount) / 1e6 : tradeSide === "buy" && fill.inAmount != null ? Number(fill.inAmount) / 1e6 : fill.venueQty * fill.avgPrice
1355
1842
  }, tradeSide === "sell" ? { minimumFractionDigits: 2, maximumFractionDigits: 2 } : {}));
1356
1843
  const allocationSharesLabel = `${formatFlooredShareAmount(fill.venueQty, 2)} shares`;
1357
- const requiresSharedKyc = venueRequiresSharedKyc({ venue: fill.venue });
1844
+ const requiresSharedKyc = venueRequiresSharedKyc({
1845
+ venue: fill.venue,
1846
+ requiresKyc: fill.executionBackend === "direct" ? false : void 0
1847
+ });
1358
1848
  return __spreadProps(__spreadValues({
1359
1849
  venue: fill.venue,
1360
1850
  label: tradeSide === "sell" ? allocationSharesLabel : allocationValueLabel,
@@ -1487,7 +1977,7 @@ var isQuoteBelowVenueMinimum = (quoteData) => {
1487
1977
  return typeof quoteData.error === "string" && quoteData.error.startsWith("Trade below ");
1488
1978
  };
1489
1979
  var resolvePlaceOrderQuoteStatus = ({
1490
- amount,
1980
+ amount: amount2,
1491
1981
  labels,
1492
1982
  quoteData,
1493
1983
  selectedMarket,
@@ -1568,7 +2058,7 @@ var resolvePlaceOrderQuoteStatus = ({
1568
2058
  placement: "above-action"
1569
2059
  };
1570
2060
  }
1571
- if (quoteData.totalFilled === 0 && amount > 0) {
2061
+ if (quoteData.totalFilled === 0 && amount2 > 0) {
1572
2062
  return {
1573
2063
  tone: "error",
1574
2064
  message: labels.insufficientLiquidity,
@@ -1595,7 +2085,10 @@ var buildLiveRouteCards = ({
1595
2085
  const parsedPrimaryVenue = parseVenue(primaryVenue);
1596
2086
  const isSplit = quoteData.fills.length > 1;
1597
2087
  const primaryRequiresSharedKyc = quoteData.fills.some(
1598
- (fill) => venueRequiresSharedKyc({ venue: fill.venue })
2088
+ (fill) => venueRequiresSharedKyc({
2089
+ venue: fill.venue,
2090
+ requiresKyc: fill.executionBackend === "direct" ? false : void 0
2091
+ })
1599
2092
  );
1600
2093
  const averageExecutionPrice = (_b = getPlaceOrderAverageExecutionPrice(quoteData)) != null ? _b : void 0;
1601
2094
  const primaryWinnerVenue = quoteData.fills.length === 1 ? primaryVenue : void 0;
@@ -1660,7 +2153,10 @@ var buildLiveRouteCards = ({
1660
2153
  maximumFractionDigits: 2
1661
2154
  }),
1662
2155
  venue,
1663
- requiresSharedKyc: venueRequiresSharedKyc({ venue: sq.venue }),
2156
+ requiresSharedKyc: venueRequiresSharedKyc({
2157
+ venue: sq.venue,
2158
+ requiresKyc: sq.fills.some((fill) => fill.executionBackend === "direct") ? false : void 0
2159
+ }),
1664
2160
  isUnavailable: true
1665
2161
  };
1666
2162
  }
@@ -1699,7 +2195,10 @@ var buildLiveRouteCards = ({
1699
2195
  maximumFractionDigits: 2
1700
2196
  }),
1701
2197
  venue,
1702
- requiresSharedKyc: venueRequiresSharedKyc({ venue: sq.venue })
2198
+ requiresSharedKyc: venueRequiresSharedKyc({
2199
+ venue: sq.venue,
2200
+ requiresKyc: sq.fills.some((fill) => fill.executionBackend === "direct") ? false : void 0
2201
+ })
1703
2202
  };
1704
2203
  });
1705
2204
  const unavailableCards = ((_e = quoteData.venueSoloQuotes) != null ? _e : []).filter((sq) => sq.status === "unavailable" || sq.unavailableReason === "venue_unavailable").map((sq) => {
@@ -1723,7 +2222,10 @@ var buildLiveRouteCards = ({
1723
2222
  }) : ""
1724
2223
  }, hasPreview && isFiniteNonNegativePrice(sq.avgPrice) ? { executionPrice: sq.avgPrice } : {}), {
1725
2224
  venue,
1726
- requiresSharedKyc: venueRequiresSharedKyc({ venue: sq.venue }),
2225
+ requiresSharedKyc: venueRequiresSharedKyc({
2226
+ venue: sq.venue,
2227
+ requiresKyc: sq.fills.some((fill) => fill.executionBackend === "direct") ? false : void 0
2228
+ }),
1727
2229
  isUnavailable: true
1728
2230
  });
1729
2231
  });
@@ -2710,7 +3212,7 @@ var normalizeIdentity = (value) => {
2710
3212
  var _a;
2711
3213
  return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
2712
3214
  };
2713
- var formatTokenAmount = (amount) => amount.toLocaleString("en-US", {
3215
+ var formatTokenAmount = (amount2) => amount2.toLocaleString("en-US", {
2714
3216
  maximumFractionDigits: 2,
2715
3217
  minimumFractionDigits: 0
2716
3218
  });
@@ -2781,6 +3283,7 @@ var deriveBridgeDefinitions = ({
2781
3283
  })) : [];
2782
3284
  const definitions = allocations.flatMap((allocation) => {
2783
3285
  var _a2;
3286
+ if (allocation.custodyKind === "VENUE_ACCOUNT") return [];
2784
3287
  const destinationChainId = (_a2 = findDestinationChainId({ allocation, bridgeSteps })) != null ? _a2 : fallbackDestinationChainId;
2785
3288
  if (!destinationChainId) return [];
2786
3289
  if (normalizeIdentity(destinationChainId) === normalizeIdentity(allocation.sourceChainId)) {
@@ -2825,10 +3328,10 @@ var resolveActualFillPresentation = ({
2825
3328
  );
2826
3329
  if (filledEvents.length === 0) return { amount: fallbackAmount, price: fallbackPrice };
2827
3330
  const actualAmounts = filledEvents.map((event) => parseRawUsd(event.filledAmountRaw));
2828
- if (actualAmounts.some((amount2) => amount2 === null)) {
3331
+ if (actualAmounts.some((amount3) => amount3 === null)) {
2829
3332
  return { amount: fallbackAmount, price: fallbackPrice };
2830
3333
  }
2831
- const amount = actualAmounts.reduce((total, value) => total + value, 0);
3334
+ const amount2 = actualAmounts.reduce((total, value) => total + value, 0);
2832
3335
  const weightedPriceTotal = filledEvents.reduce((total, event, index) => {
2833
3336
  var _a;
2834
3337
  const executionPrice = Number(event.executionPriceRaw);
@@ -2836,8 +3339,8 @@ var resolveActualFillPresentation = ({
2836
3339
  return total + price * ((_a = actualAmounts[index]) != null ? _a : 0);
2837
3340
  }, 0);
2838
3341
  return {
2839
- amount,
2840
- price: amount > 0 ? weightedPriceTotal / amount : fallbackPrice
3342
+ amount: amount2,
3343
+ price: amount2 > 0 ? weightedPriceTotal / amount2 : fallbackPrice
2841
3344
  };
2842
3345
  };
2843
3346
  var resolveBackendStepStatus = (status) => {
@@ -2869,12 +3372,12 @@ var resolveOrderPresentation = ({
2869
3372
  const actualShares = parseRawUsd(order.actualSharesRaw);
2870
3373
  const filledAmount = parseRawUsd(order.filledAmountRaw);
2871
3374
  const fallbackAmount = fallbackFill ? tradeSide === "buy" ? fallbackFill.inAmount != null ? Number(fallbackFill.inAmount) / 1e6 : fallbackFill.venueQty * fallbackFill.avgPrice : fallbackFill.venueQty : 0;
2872
- const amount = tradeSide === "buy" ? filledAmount != null ? filledAmount : (fallbackFill == null ? void 0 : fallbackFill.inAmount) != null ? fallbackAmount : quotedShares != null && quotedPrice > 0 ? quotedShares * quotedPrice : fallbackAmount : (_b = actualShares != null ? actualShares : quotedShares) != null ? _b : fallbackAmount;
3375
+ const amount2 = tradeSide === "buy" ? filledAmount != null ? filledAmount : (fallbackFill == null ? void 0 : fallbackFill.inAmount) != null ? fallbackAmount : quotedShares != null && quotedPrice > 0 ? quotedShares * quotedPrice : fallbackAmount : (_b = actualShares != null ? actualShares : quotedShares) != null ? _b : fallbackAmount;
2873
3376
  return {
2874
3377
  venue,
2875
3378
  venueLabel,
2876
3379
  priceLabel: price > 0 ? getTradingRoutePriceLabel(price) : "\u2014",
2877
- amountLabel: tradeSide === "buy" ? formatUsd(amount) : labels.executionShares(formatTokenAmount(amount))
3380
+ amountLabel: tradeSide === "buy" ? formatUsd(amount2) : labels.executionShares(formatTokenAmount(amount2))
2878
3381
  };
2879
3382
  };
2880
3383
  var resolveBackendStepFallbackLabels = ({
@@ -2903,16 +3406,16 @@ var resolveBackendStepFallbackLabels = ({
2903
3406
  completedLabel: labels.bridgeComplete
2904
3407
  };
2905
3408
  }
2906
- const { amount, tokenSymbol, fromChain, toChain } = step.bridge;
3409
+ const { amount: amount2, tokenSymbol, fromChain, toChain } = step.bridge;
2907
3410
  if (fromChain === toChain) {
2908
3411
  return {
2909
- pendingLabel: labels.depositingFunds(amount, tokenSymbol, toChain),
2910
- completedLabel: labels.fundsDeposited(amount, tokenSymbol, toChain)
3412
+ pendingLabel: labels.depositingFunds(amount2, tokenSymbol, toChain),
3413
+ completedLabel: labels.fundsDeposited(amount2, tokenSymbol, toChain)
2911
3414
  };
2912
3415
  }
2913
3416
  return {
2914
- pendingLabel: labels.bridgingFunds(amount, fromChain, toChain, tokenSymbol),
2915
- completedLabel: labels.fundsBridged(amount, fromChain, toChain, tokenSymbol)
3417
+ pendingLabel: labels.bridgingFunds(amount2, fromChain, toChain, tokenSymbol),
3418
+ completedLabel: labels.fundsBridged(amount2, fromChain, toChain, tokenSymbol)
2916
3419
  };
2917
3420
  }
2918
3421
  return {
@@ -3101,12 +3604,12 @@ var deriveExecutionOrderGroups = ({
3101
3604
  ...bridgeDefinitions.map((bridge, bridgeIndex) => {
3102
3605
  const sourceChain = formatExecutionChainLabel(bridge.sourceChainId);
3103
3606
  const destinationChain = formatExecutionChainLabel(bridge.destinationChainId);
3104
- const amount = formatTokenAmount(bridge.amount);
3607
+ const amount2 = formatTokenAmount(bridge.amount);
3105
3608
  return {
3106
3609
  id: `${groupId}-bridge-${bridgeIndex}`,
3107
3610
  kind: "bridge",
3108
- pendingLabel: labels.bridgingFunds(amount, sourceChain, destinationChain),
3109
- completedLabel: labels.fundsBridged(amount, sourceChain, destinationChain),
3611
+ pendingLabel: labels.bridgingFunds(amount2, sourceChain, destinationChain),
3612
+ completedLabel: labels.fundsBridged(amount2, sourceChain, destinationChain),
3110
3613
  realStatus: bridgeStatus
3111
3614
  };
3112
3615
  }),
@@ -3220,17 +3723,17 @@ var calculateExecutionProgress = ({
3220
3723
  };
3221
3724
 
3222
3725
  // src/trading/place-order/index.place-order.execution-view.tsx
3223
- import { useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
3224
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
3726
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
3727
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3225
3728
  var PlaceOrderExecutionHeader = ({
3226
3729
  className,
3227
3730
  eventDateLabel,
3228
3731
  eventImage,
3229
3732
  eventTitle
3230
3733
  }) => {
3231
- return /* @__PURE__ */ jsxs3("div", { className: cn("agg-order-execution-header flex flex-col gap-2", className), children: [
3232
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
3233
- /* @__PURE__ */ jsx4(
3734
+ return /* @__PURE__ */ jsxs8("div", { className: cn("agg-order-execution-header flex flex-col gap-2", className), children: [
3735
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
3736
+ /* @__PURE__ */ jsx8(
3234
3737
  RemoteImage,
3235
3738
  {
3236
3739
  src: eventImage != null ? eventImage : null,
@@ -3238,15 +3741,15 @@ var PlaceOrderExecutionHeader = ({
3238
3741
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
3239
3742
  }
3240
3743
  ),
3241
- /* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: eventTitle })
3744
+ /* @__PURE__ */ jsx8("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: eventTitle })
3242
3745
  ] }),
3243
- eventDateLabel ? /* @__PURE__ */ jsx4("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
3746
+ eventDateLabel ? /* @__PURE__ */ jsx8("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
3244
3747
  ] });
3245
3748
  };
3246
3749
  var PROGRESS_TWEEN_MS = 700;
3247
3750
  var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
3248
3751
  var useTweenedProgress = (target, enabled) => {
3249
- const [value, setValue] = useState2(target);
3752
+ const [value, setValue] = useState5(target);
3250
3753
  const valueRef = useRef3(target);
3251
3754
  useEffect3(() => {
3252
3755
  const from = valueRef.current;
@@ -3278,12 +3781,12 @@ var ExecutionProgressBar = ({
3278
3781
  const clamped = Math.max(0, Math.min(100, progress));
3279
3782
  const displayed = useTweenedProgress(clamped, enableAnimations);
3280
3783
  const isRunning = clamped < 100;
3281
- return /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
3282
- /* @__PURE__ */ jsxs3("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
3784
+ return /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
3785
+ /* @__PURE__ */ jsxs8("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
3283
3786
  displayed,
3284
3787
  "%"
3285
3788
  ] }),
3286
- /* @__PURE__ */ jsx4(
3789
+ /* @__PURE__ */ jsx8(
3287
3790
  "div",
3288
3791
  {
3289
3792
  role: "progressbar",
@@ -3292,7 +3795,7 @@ var ExecutionProgressBar = ({
3292
3795
  "aria-valuemax": 100,
3293
3796
  "aria-valuenow": clamped,
3294
3797
  className: "relative h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator",
3295
- children: /* @__PURE__ */ jsx4(
3798
+ children: /* @__PURE__ */ jsx8(
3296
3799
  "div",
3297
3800
  {
3298
3801
  className: cn(
@@ -3303,7 +3806,7 @@ var ExecutionProgressBar = ({
3303
3806
  )
3304
3807
  ),
3305
3808
  style: { width: `${clamped}%` },
3306
- children: isRunning ? /* @__PURE__ */ jsx4(
3809
+ children: isRunning ? /* @__PURE__ */ jsx8(
3307
3810
  "span",
3308
3811
  {
3309
3812
  "aria-hidden": "true",
@@ -3327,7 +3830,7 @@ var ExecutionStepIndicator = ({
3327
3830
  step
3328
3831
  }) => {
3329
3832
  if (step.status === "done") {
3330
- return /* @__PURE__ */ jsx4(
3833
+ return /* @__PURE__ */ jsx8(
3331
3834
  Icon,
3332
3835
  {
3333
3836
  name: "check-circle",
@@ -3338,7 +3841,7 @@ var ExecutionStepIndicator = ({
3338
3841
  );
3339
3842
  }
3340
3843
  if (step.status === "loading") {
3341
- return /* @__PURE__ */ jsx4("span", { className: "inline-flex h-3 w-3 shrink-0 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
3844
+ return /* @__PURE__ */ jsx8("span", { className: "inline-flex h-3 w-3 shrink-0 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
3342
3845
  "span",
3343
3846
  {
3344
3847
  className: cn(
@@ -3349,7 +3852,7 @@ var ExecutionStepIndicator = ({
3349
3852
  ) });
3350
3853
  }
3351
3854
  if (step.status === "failed") {
3352
- return /* @__PURE__ */ jsx4(
3855
+ return /* @__PURE__ */ jsx8(
3353
3856
  Icon,
3354
3857
  {
3355
3858
  name: "error-filled",
@@ -3360,7 +3863,7 @@ var ExecutionStepIndicator = ({
3360
3863
  );
3361
3864
  }
3362
3865
  if (step.status === "warning") {
3363
- return /* @__PURE__ */ jsx4(
3866
+ return /* @__PURE__ */ jsx8(
3364
3867
  Icon,
3365
3868
  {
3366
3869
  name: "warning-filled",
@@ -3370,7 +3873,7 @@ var ExecutionStepIndicator = ({
3370
3873
  }
3371
3874
  );
3372
3875
  }
3373
- return /* @__PURE__ */ jsx4(
3876
+ return /* @__PURE__ */ jsx8(
3374
3877
  "span",
3375
3878
  {
3376
3879
  className: "h-3 w-3 shrink-0 rounded-full border border-dashed border-agg-separator",
@@ -3383,47 +3886,50 @@ var PlaceOrderExecutionGroups = ({
3383
3886
  groups,
3384
3887
  labels
3385
3888
  }) => {
3386
- return /* @__PURE__ */ jsx4("div", { className: "agg-order-execution-groups flex flex-col gap-5", children: groups.map((group) => /* @__PURE__ */ jsxs3(
3387
- "section",
3388
- {
3389
- className: "agg-order-execution-group flex flex-col gap-3",
3390
- "aria-label": labels.venueOrder(group.venueLabel),
3391
- children: [
3392
- /* @__PURE__ */ jsxs3("div", { className: "flex min-h-5 items-center justify-between gap-3 text-agg-sm leading-agg-5", children: [
3393
- /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2 text-agg-foreground", children: [
3394
- group.venue ? /* @__PURE__ */ jsx4(
3395
- VenueLogo,
3396
- {
3397
- venue: group.venue,
3398
- size: "small",
3399
- ariaLabel: group.venueLabel,
3400
- className: "h-3.5 w-3.5 shrink-0"
3401
- }
3402
- ) : null,
3403
- /* @__PURE__ */ jsx4("h3", { className: "truncate font-agg-normal", children: labels.venueOrder(group.venueLabel) })
3889
+ return /* @__PURE__ */ jsx8("div", { className: "agg-order-execution-groups flex flex-col gap-5", children: groups.map((group) => {
3890
+ var _a, _b;
3891
+ return /* @__PURE__ */ jsxs8(
3892
+ "section",
3893
+ {
3894
+ className: "agg-order-execution-group flex flex-col gap-3",
3895
+ "aria-label": (_a = group.title) != null ? _a : labels.venueOrder(group.venueLabel),
3896
+ children: [
3897
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-h-5 items-center justify-between gap-3 text-agg-sm leading-agg-5", children: [
3898
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-2 text-agg-foreground", children: [
3899
+ group.venue ? /* @__PURE__ */ jsx8(
3900
+ VenueLogo,
3901
+ {
3902
+ venue: group.venue,
3903
+ size: "small",
3904
+ ariaLabel: group.venueLabel,
3905
+ className: "h-3.5 w-3.5 shrink-0"
3906
+ }
3907
+ ) : null,
3908
+ /* @__PURE__ */ jsx8("h3", { className: "truncate font-agg-normal", children: (_b = group.title) != null ? _b : labels.venueOrder(group.venueLabel) })
3909
+ ] }),
3910
+ /* @__PURE__ */ jsxs8("div", { className: "flex shrink-0 items-center gap-2", children: [
3911
+ /* @__PURE__ */ jsx8("span", { className: "text-agg-muted-foreground", children: group.priceLabel }),
3912
+ /* @__PURE__ */ jsx8("span", { className: "text-agg-foreground", children: group.amountLabel })
3913
+ ] })
3404
3914
  ] }),
3405
- /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-2", children: [
3406
- /* @__PURE__ */ jsx4("span", { className: "text-agg-muted-foreground", children: group.priceLabel }),
3407
- /* @__PURE__ */ jsx4("span", { className: "text-agg-foreground", children: group.amountLabel })
3408
- ] })
3409
- ] }),
3410
- /* @__PURE__ */ jsx4("div", { className: "flex flex-col gap-3 pl-[22px]", children: group.steps.map((step) => /* @__PURE__ */ jsxs3(
3411
- "div",
3412
- {
3413
- className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
3414
- "data-kind": step.kind,
3415
- "data-status": step.status,
3416
- children: [
3417
- /* @__PURE__ */ jsx4(ExecutionStepIndicator, { enableAnimations, step }),
3418
- /* @__PURE__ */ jsx4("p", { className: "min-w-0 flex-1", children: step.status === "done" ? step.completedLabel : step.pendingLabel })
3419
- ]
3420
- },
3421
- step.id
3422
- )) })
3423
- ]
3424
- },
3425
- group.id
3426
- )) });
3915
+ /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-3 pl-[22px]", children: group.steps.map((step) => /* @__PURE__ */ jsxs8(
3916
+ "div",
3917
+ {
3918
+ className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
3919
+ "data-kind": step.kind,
3920
+ "data-status": step.status,
3921
+ children: [
3922
+ /* @__PURE__ */ jsx8(ExecutionStepIndicator, { enableAnimations, step }),
3923
+ /* @__PURE__ */ jsx8("p", { className: "min-w-0 flex-1", children: step.status === "done" ? step.completedLabel : step.pendingLabel })
3924
+ ]
3925
+ },
3926
+ step.id
3927
+ )) })
3928
+ ]
3929
+ },
3930
+ group.id
3931
+ );
3932
+ }) });
3427
3933
  };
3428
3934
  var PlaceOrderExecutionView = ({
3429
3935
  className,
@@ -3437,7 +3943,7 @@ var PlaceOrderExecutionView = ({
3437
3943
  progress,
3438
3944
  settlementHint
3439
3945
  }) => {
3440
- return /* @__PURE__ */ jsx4(
3946
+ return /* @__PURE__ */ jsx8(
3441
3947
  Card,
3442
3948
  {
3443
3949
  className: cn(
@@ -3446,8 +3952,8 @@ var PlaceOrderExecutionView = ({
3446
3952
  classNames == null ? void 0 : classNames.root,
3447
3953
  className
3448
3954
  ),
3449
- children: /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
3450
- /* @__PURE__ */ jsx4(
3955
+ children: /* @__PURE__ */ jsxs8("div", { className: cn("flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
3956
+ /* @__PURE__ */ jsx8(
3451
3957
  PlaceOrderExecutionHeader,
3452
3958
  {
3453
3959
  className: classNames == null ? void 0 : classNames.header,
@@ -3456,8 +3962,8 @@ var PlaceOrderExecutionView = ({
3456
3962
  eventTitle
3457
3963
  }
3458
3964
  ),
3459
- /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
3460
- /* @__PURE__ */ jsx4(
3965
+ /* @__PURE__ */ jsxs8("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
3966
+ /* @__PURE__ */ jsx8(
3461
3967
  ExecutionProgressBar,
3462
3968
  {
3463
3969
  enableAnimations,
@@ -3465,7 +3971,7 @@ var PlaceOrderExecutionView = ({
3465
3971
  progress
3466
3972
  }
3467
3973
  ),
3468
- /* @__PURE__ */ jsx4(
3974
+ /* @__PURE__ */ jsx8(
3469
3975
  PlaceOrderExecutionGroups,
3470
3976
  {
3471
3977
  enableAnimations,
@@ -3473,7 +3979,7 @@ var PlaceOrderExecutionView = ({
3473
3979
  labels
3474
3980
  }
3475
3981
  ),
3476
- settlementHint ? /* @__PURE__ */ jsx4("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: settlementHint }) : null
3982
+ settlementHint ? /* @__PURE__ */ jsx8("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: settlementHint }) : null
3477
3983
  ] })
3478
3984
  ] })
3479
3985
  }
@@ -3482,7 +3988,7 @@ var PlaceOrderExecutionView = ({
3482
3988
  PlaceOrderExecutionView.displayName = "PlaceOrderExecutionView";
3483
3989
 
3484
3990
  // src/trading/place-order/index.place-order.failure.tsx
3485
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
3991
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3486
3992
  var resolveFailureActionHandler = ({
3487
3993
  action,
3488
3994
  onDone,
@@ -3495,12 +4001,12 @@ var resolveFailureActionHandler = ({
3495
4001
  };
3496
4002
  var renderPartialFailureStep = (step) => {
3497
4003
  const isWarningStep = step.tone === "warning" || step.tone === "error";
3498
- return /* @__PURE__ */ jsxs4(
4004
+ return /* @__PURE__ */ jsxs9(
3499
4005
  "div",
3500
4006
  {
3501
4007
  className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
3502
4008
  children: [
3503
- /* @__PURE__ */ jsx5(
4009
+ /* @__PURE__ */ jsx9(
3504
4010
  Icon,
3505
4011
  {
3506
4012
  name: isWarningStep ? "warning-filled" : "check-circle",
@@ -3509,8 +4015,8 @@ var renderPartialFailureStep = (step) => {
3509
4015
  "aria-hidden": "true"
3510
4016
  }
3511
4017
  ),
3512
- /* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1", children: step.label }),
3513
- step.venue ? /* @__PURE__ */ jsx5(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
4018
+ /* @__PURE__ */ jsx9("p", { className: "min-w-0 flex-1", children: step.label }),
4019
+ step.venue ? /* @__PURE__ */ jsx9(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
3514
4020
  ]
3515
4021
  },
3516
4022
  step.id
@@ -3529,10 +4035,10 @@ var PlaceOrderFailureView = ({
3529
4035
  const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
3530
4036
  const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
3531
4037
  if (shouldShowPartialFailureLayout) {
3532
- return /* @__PURE__ */ jsx5(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
3533
- /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
3534
- /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
3535
- /* @__PURE__ */ jsx5(
4038
+ return /* @__PURE__ */ jsx9(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs9("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
4039
+ /* @__PURE__ */ jsxs9("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
4040
+ /* @__PURE__ */ jsxs9("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
4041
+ /* @__PURE__ */ jsx9(
3536
4042
  RemoteImage,
3537
4043
  {
3538
4044
  src: (_a = summary.eventImage) != null ? _a : null,
@@ -3540,19 +4046,19 @@ var PlaceOrderFailureView = ({
3540
4046
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
3541
4047
  }
3542
4048
  ),
3543
- /* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
4049
+ /* @__PURE__ */ jsx9("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
3544
4050
  ] }),
3545
- summary.eventSubtitle ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
4051
+ summary.eventSubtitle ? /* @__PURE__ */ jsx9("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
3546
4052
  ] }),
3547
- /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4", children: ((_b = summary.executionGroups) == null ? void 0 : _b.length) ? /* @__PURE__ */ jsx5(
4053
+ /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-4", children: ((_b = summary.executionGroups) == null ? void 0 : _b.length) ? /* @__PURE__ */ jsx9(
3548
4054
  PlaceOrderExecutionGroups,
3549
4055
  {
3550
4056
  enableAnimations: false,
3551
4057
  groups: summary.executionGroups,
3552
4058
  labels: tradingLabels
3553
4059
  }
3554
- ) : failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
3555
- summary.errorMessage ? /* @__PURE__ */ jsx5(
4060
+ ) : failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
4061
+ summary.errorMessage ? /* @__PURE__ */ jsx9(
3556
4062
  InlineAlert,
3557
4063
  {
3558
4064
  tone: "error",
@@ -3560,20 +4066,20 @@ var PlaceOrderFailureView = ({
3560
4066
  message: tradingLabels.orderFailureDescription(summary.errorMessage)
3561
4067
  }
3562
4068
  ) : null,
3563
- summary.result ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-4", children: [
3564
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
3565
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-col", children: [
3566
- /* @__PURE__ */ jsx5("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPartiallyFilled }),
3567
- /* @__PURE__ */ jsx5("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.result.averagePriceLabel) })
4069
+ summary.result ? /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-4", children: [
4070
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between gap-4", children: [
4071
+ /* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 flex-col", children: [
4072
+ /* @__PURE__ */ jsx9("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPartiallyFilled }),
4073
+ /* @__PURE__ */ jsx9("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.result.averagePriceLabel) })
3568
4074
  ] }),
3569
- /* @__PURE__ */ jsx5("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: summary.result.filledAmountLabel })
4075
+ /* @__PURE__ */ jsx9("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: summary.result.filledAmountLabel })
3570
4076
  ] }),
3571
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-4", children: [
3572
- /* @__PURE__ */ jsx5("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
3573
- /* @__PURE__ */ jsx5("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: summary.result.payoutLabel })
4077
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between gap-4", children: [
4078
+ /* @__PURE__ */ jsx9("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
4079
+ /* @__PURE__ */ jsx9("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: summary.result.payoutLabel })
3574
4080
  ] })
3575
4081
  ] }) : null,
3576
- /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx5(
4082
+ /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx9(
3577
4083
  Button,
3578
4084
  {
3579
4085
  variant: action.variant === "retry" ? "primary" : "secondary",
@@ -3587,10 +4093,10 @@ var PlaceOrderFailureView = ({
3587
4093
  )) })
3588
4094
  ] }) });
3589
4095
  }
3590
- return /* @__PURE__ */ jsx5(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
3591
- /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
3592
- /* @__PURE__ */ jsxs4("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
3593
- /* @__PURE__ */ jsx5(
4096
+ return /* @__PURE__ */ jsx9(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ jsxs9("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
4097
+ /* @__PURE__ */ jsxs9("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
4098
+ /* @__PURE__ */ jsxs9("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
4099
+ /* @__PURE__ */ jsx9(
3594
4100
  RemoteImage,
3595
4101
  {
3596
4102
  src: (_c = summary.eventImage) != null ? _c : null,
@@ -3598,11 +4104,11 @@ var PlaceOrderFailureView = ({
3598
4104
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
3599
4105
  }
3600
4106
  ),
3601
- /* @__PURE__ */ jsx5("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
4107
+ /* @__PURE__ */ jsx9("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
3602
4108
  ] }),
3603
- summary.eventSubtitle ? /* @__PURE__ */ jsx5("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
4109
+ summary.eventSubtitle ? /* @__PURE__ */ jsx9("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
3604
4110
  ] }),
3605
- ((_d = summary.executionGroups) == null ? void 0 : _d.length) ? /* @__PURE__ */ jsx5(
4111
+ ((_d = summary.executionGroups) == null ? void 0 : _d.length) ? /* @__PURE__ */ jsx9(
3606
4112
  PlaceOrderExecutionGroups,
3607
4113
  {
3608
4114
  enableAnimations: false,
@@ -3610,7 +4116,7 @@ var PlaceOrderFailureView = ({
3610
4116
  labels: tradingLabels
3611
4117
  }
3612
4118
  ) : null,
3613
- /* @__PURE__ */ jsx5(
4119
+ /* @__PURE__ */ jsx9(
3614
4120
  InlineAlert,
3615
4121
  {
3616
4122
  tone: "error",
@@ -3619,7 +4125,7 @@ var PlaceOrderFailureView = ({
3619
4125
  message: tradingLabels.orderFailureDescription((_e = summary.errorMessage) != null ? _e : "")
3620
4126
  }
3621
4127
  ),
3622
- /* @__PURE__ */ jsx5("div", { className: "agg-order-failure-actions flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx5(
4128
+ /* @__PURE__ */ jsx9("div", { className: "agg-order-failure-actions flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ jsx9(
3623
4129
  Button,
3624
4130
  {
3625
4131
  variant: action.variant === "retry" ? "primary" : "secondary",
@@ -3636,7 +4142,7 @@ var PlaceOrderFailureView = ({
3636
4142
  PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
3637
4143
 
3638
4144
  // src/trading/place-order/index.place-order.success.tsx
3639
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
4145
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3640
4146
  var resolveBuyPayoutLabel = (shares) => {
3641
4147
  if (!shares) return "$0";
3642
4148
  return shares.startsWith("$") ? shares : `$${shares}`;
@@ -3648,13 +4154,16 @@ var PlaceOrderSuccessView = ({
3648
4154
  onDone,
3649
4155
  onShare: _onShare
3650
4156
  }) => {
3651
- var _a, _b, _c, _d, _e;
4157
+ var _a, _b, _c, _d, _e, _f;
3652
4158
  const resolvedTradeSide = (_a = summary.tradeSide) != null ? _a : "buy";
3653
4159
  const resolvedAmountLabel = (_b = summary.amountLabel) != null ? _b : resolvedTradeSide === "sell" ? summary.shares : summary.estimatedCost;
3654
4160
  const resolvedPayoutLabel = (_c = summary.toWinLabel) != null ? _c : resolvedTradeSide === "sell" ? summary.estimatedCost : resolveBuyPayoutLabel(summary.shares);
3655
- const potentialReturnLabel = summary.potentialReturnLabel ? tradingLabels.potentialReturnBetter(summary.potentialReturnLabel) : null;
3656
- const legacyExecutionSteps = ((_d = summary.executionStepGroups) != null ? _d : []).flat();
3657
- return /* @__PURE__ */ jsx6(
4161
+ const isLimitOrder = summary.orderType === "limit";
4162
+ const potentialReturnLabel = summary.potentialReturnLabel && !isLimitOrder ? tradingLabels.potentialReturnBetter(summary.potentialReturnLabel) : null;
4163
+ const amountTitle = isLimitOrder ? tradingLabels.orderAmount : summary.resultState === "partial" ? tradingLabels.orderPartiallyFilled : tradingLabels.orderFullyFilled;
4164
+ const amountSubtitle = isLimitOrder ? tradingLabels.orderLimitPrice((_d = summary.limitPriceLabel) != null ? _d : summary.avgPrice) : tradingLabels.orderAveragePrice(summary.avgPrice);
4165
+ const legacyExecutionSteps = ((_e = summary.executionStepGroups) != null ? _e : []).flat();
4166
+ return /* @__PURE__ */ jsx10(
3658
4167
  Card,
3659
4168
  {
3660
4169
  className: cn(
@@ -3663,8 +4172,8 @@ var PlaceOrderSuccessView = ({
3663
4172
  "border-0 ring-1 ring-inset ring-agg-separator",
3664
4173
  className
3665
4174
  ),
3666
- children: /* @__PURE__ */ jsxs5("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
3667
- summary.eventTitle ? /* @__PURE__ */ jsx6(
4175
+ children: /* @__PURE__ */ jsxs10("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
4176
+ summary.eventTitle ? /* @__PURE__ */ jsx10(
3668
4177
  PlaceOrderExecutionHeader,
3669
4178
  {
3670
4179
  eventDateLabel: summary.eventDateLabel,
@@ -3672,19 +4181,19 @@ var PlaceOrderSuccessView = ({
3672
4181
  eventTitle: summary.eventTitle
3673
4182
  }
3674
4183
  ) : null,
3675
- ((_e = summary.executionGroups) == null ? void 0 : _e.length) ? /* @__PURE__ */ jsx6(
4184
+ ((_f = summary.executionGroups) == null ? void 0 : _f.length) ? /* @__PURE__ */ jsx10(
3676
4185
  PlaceOrderExecutionGroups,
3677
4186
  {
3678
4187
  enableAnimations: false,
3679
4188
  groups: summary.executionGroups,
3680
4189
  labels: tradingLabels
3681
4190
  }
3682
- ) : legacyExecutionSteps.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-3 pl-[22px]", children: legacyExecutionSteps.map((step) => /* @__PURE__ */ jsxs5(
4191
+ ) : legacyExecutionSteps.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-3 pl-[22px]", children: legacyExecutionSteps.map((step) => /* @__PURE__ */ jsxs10(
3683
4192
  "div",
3684
4193
  {
3685
4194
  className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
3686
4195
  children: [
3687
- /* @__PURE__ */ jsx6(
4196
+ /* @__PURE__ */ jsx10(
3688
4197
  Icon,
3689
4198
  {
3690
4199
  name: step.tone === "warning" || step.tone === "error" ? "warning-filled" : "check-circle",
@@ -3696,28 +4205,28 @@ var PlaceOrderSuccessView = ({
3696
4205
  "aria-hidden": "true"
3697
4206
  }
3698
4207
  ),
3699
- /* @__PURE__ */ jsx6("p", { className: "min-w-0 flex-1", children: step.label })
4208
+ /* @__PURE__ */ jsx10("p", { className: "min-w-0 flex-1", children: step.label })
3700
4209
  ]
3701
4210
  },
3702
4211
  step.id
3703
4212
  )) }) : null,
3704
- /* @__PURE__ */ jsxs5("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
3705
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
3706
- /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col", children: [
3707
- /* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: summary.resultState === "partial" ? tradingLabels.orderPartiallyFilled : tradingLabels.orderFullyFilled }),
3708
- /* @__PURE__ */ jsx6("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.avgPrice) })
4213
+ /* @__PURE__ */ jsxs10("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
4214
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-4", children: [
4215
+ /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col", children: [
4216
+ /* @__PURE__ */ jsx10("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: amountTitle }),
4217
+ /* @__PURE__ */ jsx10("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: amountSubtitle })
3709
4218
  ] }),
3710
- /* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
4219
+ /* @__PURE__ */ jsx10("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
3711
4220
  ] }),
3712
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
3713
- /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
3714
- /* @__PURE__ */ jsx6("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
3715
- potentialReturnLabel ? /* @__PURE__ */ jsx6("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
4221
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-4", children: [
4222
+ /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
4223
+ /* @__PURE__ */ jsx10("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
4224
+ potentialReturnLabel ? /* @__PURE__ */ jsx10("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
3716
4225
  ] }),
3717
- /* @__PURE__ */ jsx6("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
4226
+ /* @__PURE__ */ jsx10("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
3718
4227
  ] })
3719
4228
  ] }),
3720
- /* @__PURE__ */ jsx6(
4229
+ /* @__PURE__ */ jsx10(
3721
4230
  Button,
3722
4231
  {
3723
4232
  variant: "secondary",
@@ -3735,7 +4244,7 @@ var PlaceOrderSuccessView = ({
3735
4244
  PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
3736
4245
 
3737
4246
  // src/trading/place-order/index.tsx
3738
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
4247
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3739
4248
  var SELL_SHARE_INPUT_DECIMALS = 6;
3740
4249
  var SELL_SHARE_DISPLAY_DECIMALS = 2;
3741
4250
  var resolvePlaceOrderPortalContainer = (triggerElement) => {
@@ -3760,12 +4269,12 @@ var toLimitPriceRaw = (value) => {
3760
4269
  return Math.round(clampedValue * Number(LIMIT_ORDER_RAW_SCALE)).toString();
3761
4270
  };
3762
4271
  var toLimitSizeRaw = ({
3763
- amount,
4272
+ amount: amount2,
3764
4273
  limitPriceRaw,
3765
4274
  side
3766
4275
  }) => {
3767
- if (side === "sell") return toRaw6(amount);
3768
- const spendRaw = BigInt(toRaw6(amount));
4276
+ if (side === "sell") return toRaw6(amount2);
4277
+ const spendRaw = BigInt(toRaw6(amount2));
3769
4278
  const priceRaw = BigInt(limitPriceRaw);
3770
4279
  return ceilDiv(spendRaw * LIMIT_ORDER_RAW_SCALE, priceRaw).toString();
3771
4280
  };
@@ -3778,14 +4287,41 @@ var formatLimitPriceLabel = (value) => {
3778
4287
  var formatLimitPriceRawLabel = (value) => {
3779
4288
  return formatLimitPriceLabel(Number(BigInt(value)) / Number(LIMIT_ORDER_RAW_SCALE));
3780
4289
  };
4290
+ var LIMIT_ORDER_SUBMITTING_PROGRESS = 10;
4291
+ var buildLimitOrderExecutionGroup = ({
4292
+ venue,
4293
+ priceLabel,
4294
+ amountLabel,
4295
+ status,
4296
+ labels
4297
+ }) => {
4298
+ const venueLabel = getTradingVenueLabel(venue);
4299
+ return {
4300
+ id: `limit-order-${venue}`,
4301
+ venue,
4302
+ venueLabel,
4303
+ title: labels.limitVenueOrder(venueLabel),
4304
+ priceLabel,
4305
+ amountLabel,
4306
+ steps: [
4307
+ {
4308
+ id: "limit-order-submit",
4309
+ kind: "submit",
4310
+ pendingLabel: labels.limitOrderSubmitting,
4311
+ completedLabel: labels.limitOrderSubmitted,
4312
+ status
4313
+ }
4314
+ ]
4315
+ };
4316
+ };
3781
4317
  var getLimitOrderToWinValue = ({
3782
- amount,
4318
+ amount: amount2,
3783
4319
  limitPriceRaw,
3784
4320
  side
3785
4321
  }) => {
3786
4322
  const priceRaw = BigInt(limitPriceRaw);
3787
4323
  if (priceRaw <= BigInt(0) || priceRaw >= LIMIT_ORDER_RAW_SCALE) return 0;
3788
- const sizeRaw = BigInt(toLimitSizeRaw({ amount, limitPriceRaw, side }));
4324
+ const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side }));
3789
4325
  if (side === "buy") return Number(sizeRaw) / Number(LIMIT_ORDER_RAW_SCALE);
3790
4326
  return Number(ceilDiv(priceRaw * sizeRaw, LIMIT_ORDER_RAW_SCALE)) / Number(LIMIT_ORDER_RAW_SCALE);
3791
4327
  };
@@ -3853,18 +4389,18 @@ var PlaceOrderSlippageControl = ({
3853
4389
  minimumValue: slippageMinimumValue
3854
4390
  }) => {
3855
4391
  var _a, _b;
3856
- const labels = useLabels2();
4392
+ const labels = useLabels7();
3857
4393
  const containerRef = useRef4(null);
3858
4394
  const triggerRef = useRef4(null);
3859
4395
  const inputRef = useRef4(null);
3860
4396
  const warningId = useId();
3861
4397
  const defaultValue = finalizePercentageValue(slippageDefaultValue);
3862
4398
  const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
3863
- const [draftValue, setDraftValue] = useState3(committedValue);
3864
- const [isEditing, setIsEditing] = useState3(
4399
+ const [draftValue, setDraftValue] = useState6(committedValue);
4400
+ const [isEditing, setIsEditing] = useState6(
3865
4401
  () => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
3866
4402
  );
3867
- const [shouldFocusInput, setShouldFocusInput] = useState3(false);
4403
+ const [shouldFocusInput, setShouldFocusInput] = useState6(false);
3868
4404
  useEffect4(() => {
3869
4405
  setDraftValue(committedValue);
3870
4406
  if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
@@ -3951,8 +4487,8 @@ var PlaceOrderSlippageControl = ({
3951
4487
  if (!isEditing) return;
3952
4488
  handleCommitDraft(false);
3953
4489
  };
3954
- return /* @__PURE__ */ jsxs6("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
3955
- /* @__PURE__ */ jsxs6(
4490
+ return /* @__PURE__ */ jsxs11("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
4491
+ /* @__PURE__ */ jsxs11(
3956
4492
  "button",
3957
4493
  {
3958
4494
  ref: triggerRef,
@@ -3970,8 +4506,8 @@ var PlaceOrderSlippageControl = ({
3970
4506
  ),
3971
4507
  onClick: handleToggleEditing,
3972
4508
  children: [
3973
- /* @__PURE__ */ jsx7("span", { className: "agg-slippage-label", children: collapsedLabel }),
3974
- /* @__PURE__ */ jsx7(
4509
+ /* @__PURE__ */ jsx11("span", { className: "agg-slippage-label", children: collapsedLabel }),
4510
+ /* @__PURE__ */ jsx11(
3975
4511
  Icon,
3976
4512
  {
3977
4513
  name: isEditing ? "chevron-up" : "pencil",
@@ -3983,7 +4519,7 @@ var PlaceOrderSlippageControl = ({
3983
4519
  ]
3984
4520
  }
3985
4521
  ),
3986
- /* @__PURE__ */ jsx7(
4522
+ /* @__PURE__ */ jsx11(
3987
4523
  "div",
3988
4524
  {
3989
4525
  "aria-hidden": !isEditing,
@@ -3997,10 +4533,10 @@ var PlaceOrderSlippageControl = ({
3997
4533
  "transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
3998
4534
  )
3999
4535
  ),
4000
- children: /* @__PURE__ */ jsx7("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs6("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
4001
- /* @__PURE__ */ jsxs6("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
4002
- /* @__PURE__ */ jsxs6("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
4003
- /* @__PURE__ */ jsx7(
4536
+ children: /* @__PURE__ */ jsx11("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs11("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
4537
+ /* @__PURE__ */ jsxs11("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
4538
+ /* @__PURE__ */ jsxs11("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
4539
+ /* @__PURE__ */ jsx11(
4004
4540
  "input",
4005
4541
  {
4006
4542
  ref: inputRef,
@@ -4015,7 +4551,7 @@ var PlaceOrderSlippageControl = ({
4015
4551
  onKeyDown: handleInputKeyDown
4016
4552
  }
4017
4553
  ),
4018
- /* @__PURE__ */ jsx7(
4554
+ /* @__PURE__ */ jsx11(
4019
4555
  "button",
4020
4556
  {
4021
4557
  type: "button",
@@ -4033,8 +4569,8 @@ var PlaceOrderSlippageControl = ({
4033
4569
  }
4034
4570
  )
4035
4571
  ] }),
4036
- /* @__PURE__ */ jsx7("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
4037
- /* @__PURE__ */ jsx7(
4572
+ /* @__PURE__ */ jsx11("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
4573
+ /* @__PURE__ */ jsx11(
4038
4574
  "div",
4039
4575
  {
4040
4576
  className: "agg-slippage-suffix flex w-9 items-center justify-center bg-agg-secondary-hover text-agg-sm leading-agg-5 text-agg-muted-foreground",
@@ -4043,7 +4579,7 @@ var PlaceOrderSlippageControl = ({
4043
4579
  }
4044
4580
  )
4045
4581
  ] }),
4046
- /* @__PURE__ */ jsx7(
4582
+ /* @__PURE__ */ jsx11(
4047
4583
  "div",
4048
4584
  {
4049
4585
  "aria-hidden": !resolvedWarningMessage,
@@ -4057,13 +4593,13 @@ var PlaceOrderSlippageControl = ({
4057
4593
  "transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
4058
4594
  )
4059
4595
  ),
4060
- children: /* @__PURE__ */ jsx7("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs6(
4596
+ children: /* @__PURE__ */ jsx11("div", { className: "min-h-0", children: /* @__PURE__ */ jsxs11(
4061
4597
  "div",
4062
4598
  {
4063
4599
  id: warningId,
4064
4600
  className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
4065
4601
  children: [
4066
- /* @__PURE__ */ jsx7(
4602
+ /* @__PURE__ */ jsx11(
4067
4603
  Icon,
4068
4604
  {
4069
4605
  name: "warning-filled",
@@ -4072,7 +4608,7 @@ var PlaceOrderSlippageControl = ({
4072
4608
  color: "currentColor"
4073
4609
  }
4074
4610
  ),
4075
- /* @__PURE__ */ jsx7("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
4611
+ /* @__PURE__ */ jsx11("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
4076
4612
  ]
4077
4613
  }
4078
4614
  ) })
@@ -4092,9 +4628,9 @@ var renderCardHeader = ({
4092
4628
  onClose
4093
4629
  }) => {
4094
4630
  if (!headerTitle) return null;
4095
- return /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
4096
- /* @__PURE__ */ jsxs6("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
4097
- /* @__PURE__ */ jsx7(
4631
+ return /* @__PURE__ */ jsxs11("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
4632
+ /* @__PURE__ */ jsxs11("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
4633
+ /* @__PURE__ */ jsx11(
4098
4634
  RemoteImage,
4099
4635
  {
4100
4636
  src: headerImage,
@@ -4102,19 +4638,19 @@ var renderCardHeader = ({
4102
4638
  className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
4103
4639
  }
4104
4640
  ),
4105
- /* @__PURE__ */ jsx7("p", { className: "agg-order-market-title min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: headerTitle }),
4106
- onClose ? /* @__PURE__ */ jsx7(
4641
+ /* @__PURE__ */ jsx11("p", { className: "agg-order-market-title min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: headerTitle }),
4642
+ onClose ? /* @__PURE__ */ jsx11(
4107
4643
  "button",
4108
4644
  {
4109
4645
  type: "button",
4110
4646
  className: "agg-order-close -mr-1 -mt-1 hidden shrink-0 cursor-pointer items-center justify-center p-1 text-agg-muted-foreground hover:text-agg-foreground sm:flex",
4111
4647
  "aria-label": "Close",
4112
4648
  onClick: onClose,
4113
- children: /* @__PURE__ */ jsx7(CloseIcon, { className: "h-5 w-5" })
4649
+ children: /* @__PURE__ */ jsx11(CloseIcon, { className: "h-5 w-5" })
4114
4650
  }
4115
4651
  ) : null
4116
4652
  ] }),
4117
- headerSubtitle ? /* @__PURE__ */ jsx7("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
4653
+ headerSubtitle ? /* @__PURE__ */ jsx11("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
4118
4654
  ] });
4119
4655
  };
4120
4656
  var PlaceOrderResolvedView = ({
@@ -4127,7 +4663,7 @@ var PlaceOrderResolvedView = ({
4127
4663
  showResolvingState = false
4128
4664
  }) => {
4129
4665
  var _a, _b;
4130
- const labels = useLabels2();
4666
+ const labels = useLabels7();
4131
4667
  const tradingLabels = labels.trading;
4132
4668
  const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
4133
4669
  const isResolvingMarket = showResolvingState && !tradingState.winningOutcome;
@@ -4136,7 +4672,7 @@ var PlaceOrderResolvedView = ({
4136
4672
  return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
4137
4673
  })() : "";
4138
4674
  if (isResolvingMarket) {
4139
- return /* @__PURE__ */ jsx7(
4675
+ return /* @__PURE__ */ jsx11(
4140
4676
  Card,
4141
4677
  {
4142
4678
  className: cn(
@@ -4147,7 +4683,7 @@ var PlaceOrderResolvedView = ({
4147
4683
  ),
4148
4684
  role: "status",
4149
4685
  "aria-label": labels.marketDetails.resolvingTitle,
4150
- children: /* @__PURE__ */ jsxs6(
4686
+ children: /* @__PURE__ */ jsxs11(
4151
4687
  "div",
4152
4688
  {
4153
4689
  className: cn(
@@ -4155,12 +4691,12 @@ var PlaceOrderResolvedView = ({
4155
4691
  classNames == null ? void 0 : classNames.body
4156
4692
  ),
4157
4693
  children: [
4158
- /* @__PURE__ */ jsx7("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ jsx7(LoadingIcon, { variant: "prominent" }) }),
4159
- /* @__PURE__ */ jsxs6("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
4160
- /* @__PURE__ */ jsx7(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
4161
- resolvingSubtitle ? /* @__PURE__ */ jsx7(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
4694
+ /* @__PURE__ */ jsx11("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ jsx11(LoadingIcon, { variant: "prominent" }) }),
4695
+ /* @__PURE__ */ jsxs11("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
4696
+ /* @__PURE__ */ jsx11(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
4697
+ resolvingSubtitle ? /* @__PURE__ */ jsx11(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
4162
4698
  ] }),
4163
- /* @__PURE__ */ jsx7(
4699
+ /* @__PURE__ */ jsx11(
4164
4700
  Typography,
4165
4701
  {
4166
4702
  variant: "label",
@@ -4174,7 +4710,7 @@ var PlaceOrderResolvedView = ({
4174
4710
  }
4175
4711
  );
4176
4712
  }
4177
- return /* @__PURE__ */ jsx7(
4713
+ return /* @__PURE__ */ jsx11(
4178
4714
  Card,
4179
4715
  {
4180
4716
  className: cn(
@@ -4183,19 +4719,19 @@ var PlaceOrderResolvedView = ({
4183
4719
  classNames == null ? void 0 : classNames.root,
4184
4720
  className
4185
4721
  ),
4186
- children: /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
4187
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-6 p-8", children: [
4188
- /* @__PURE__ */ jsx7(
4722
+ children: /* @__PURE__ */ jsxs11("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
4723
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-6 p-8", children: [
4724
+ /* @__PURE__ */ jsx11(
4189
4725
  "div",
4190
4726
  {
4191
4727
  className: cn(
4192
4728
  "flex h-15 w-15 items-center justify-center rounded-full",
4193
4729
  "bg-agg-primary/15"
4194
4730
  ),
4195
- children: /* @__PURE__ */ jsx7(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
4731
+ children: /* @__PURE__ */ jsx11(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
4196
4732
  }
4197
4733
  ),
4198
- /* @__PURE__ */ jsxs6(
4734
+ /* @__PURE__ */ jsxs11(
4199
4735
  "div",
4200
4736
  {
4201
4737
  className: cn(
@@ -4203,8 +4739,8 @@ var PlaceOrderResolvedView = ({
4203
4739
  classNames == null ? void 0 : classNames.content
4204
4740
  ),
4205
4741
  children: [
4206
- tradingState.market ? /* @__PURE__ */ jsx7(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
4207
- tradingState.winningOutcome ? /* @__PURE__ */ jsx7(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
4742
+ tradingState.market ? /* @__PURE__ */ jsx11(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
4743
+ tradingState.winningOutcome ? /* @__PURE__ */ jsx11(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
4208
4744
  shouldUseRawResolvedPlaceOrderOutcomeLabel(
4209
4745
  tradingState.market,
4210
4746
  tradingState.winningOutcome
@@ -4218,25 +4754,25 @@ var PlaceOrderResolvedView = ({
4218
4754
  }
4219
4755
  )
4220
4756
  ] }),
4221
- resolvedClaim ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
4222
- /* @__PURE__ */ jsx7("div", { className: "h-px w-full bg-agg-separator" }),
4223
- /* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col gap-5 p-6", children: [
4224
- /* @__PURE__ */ jsx7(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
4225
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
4226
- resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
4227
- /* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedResolutionDateLabel }),
4228
- /* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
4757
+ resolvedClaim ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
4758
+ /* @__PURE__ */ jsx11("div", { className: "h-px w-full bg-agg-separator" }),
4759
+ /* @__PURE__ */ jsxs11("div", { className: "flex w-full flex-col gap-5 p-6", children: [
4760
+ /* @__PURE__ */ jsx11(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
4761
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
4762
+ resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-4", children: [
4763
+ /* @__PURE__ */ jsx11("span", { children: tradingLabels.resolvedResolutionDateLabel }),
4764
+ /* @__PURE__ */ jsx11("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
4229
4765
  ] }) : null,
4230
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
4231
- /* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedSharesLabel }),
4232
- /* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
4766
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-4", children: [
4767
+ /* @__PURE__ */ jsx11("span", { children: tradingLabels.resolvedSharesLabel }),
4768
+ /* @__PURE__ */ jsx11("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
4233
4769
  ] }),
4234
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-4", children: [
4235
- /* @__PURE__ */ jsx7("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
4236
- /* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
4770
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-4", children: [
4771
+ /* @__PURE__ */ jsx11("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
4772
+ /* @__PURE__ */ jsx11("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
4237
4773
  ] })
4238
4774
  ] }),
4239
- resolvedClaim.onClaim ? /* @__PURE__ */ jsx7(
4775
+ resolvedClaim.onClaim ? /* @__PURE__ */ jsx11(
4240
4776
  Button,
4241
4777
  {
4242
4778
  size: "large",
@@ -4258,21 +4794,21 @@ var renderRouteBreakdownRow = (row, sharedKycStatus, tradingLabels) => {
4258
4794
  const venueLabel = getTradingVenueLabel(row.venue);
4259
4795
  const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
4260
4796
  const showSharedKycRequirement = row.requiresSharedKyc === true && sharedKycStatus !== void 0 && sharedKycStatus !== "verified";
4261
- return /* @__PURE__ */ jsxs6(
4797
+ return /* @__PURE__ */ jsxs11(
4262
4798
  "div",
4263
4799
  {
4264
4800
  className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
4265
4801
  children: [
4266
- /* @__PURE__ */ jsxs6("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
4267
- /* @__PURE__ */ jsx7(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
4268
- /* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-col", children: [
4269
- /* @__PURE__ */ jsx7("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label }),
4270
- showSharedKycRequirement ? /* @__PURE__ */ jsx7("p", { className: "text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.sharedKyc.required }) : null
4802
+ /* @__PURE__ */ jsxs11("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
4803
+ /* @__PURE__ */ jsx11(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
4804
+ /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-col", children: [
4805
+ /* @__PURE__ */ jsx11("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label }),
4806
+ showSharedKycRequirement ? /* @__PURE__ */ jsx11("p", { className: "text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.sharedKyc.required }) : null
4271
4807
  ] })
4272
4808
  ] }),
4273
- /* @__PURE__ */ jsxs6("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
4274
- /* @__PURE__ */ jsx7("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
4275
- /* @__PURE__ */ jsx7("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
4809
+ /* @__PURE__ */ jsxs11("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
4810
+ /* @__PURE__ */ jsx11("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
4811
+ /* @__PURE__ */ jsx11("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
4276
4812
  ] })
4277
4813
  ]
4278
4814
  },
@@ -4305,7 +4841,7 @@ var renderRouteCard = ({
4305
4841
  const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
4306
4842
  const displayedHint = showKalshiRequirement ? tradingLabels.requiresKalshiAccount : showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
4307
4843
  const ariaLabel = [card.label, displayedHint, card.value].filter(Boolean).join(" ");
4308
- return /* @__PURE__ */ jsx7(
4844
+ return /* @__PURE__ */ jsx11(
4309
4845
  "button",
4310
4846
  {
4311
4847
  type: "button",
@@ -4324,10 +4860,10 @@ var renderRouteCard = ({
4324
4860
  isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-linear-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover"
4325
4861
  ),
4326
4862
  onClick: () => onSelect(card.id),
4327
- children: /* @__PURE__ */ jsxs6("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
4328
- /* @__PURE__ */ jsxs6("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
4329
- /* @__PURE__ */ jsxs6("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
4330
- card.kind === "split" ? /* @__PURE__ */ jsx7(
4863
+ children: /* @__PURE__ */ jsxs11("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
4864
+ /* @__PURE__ */ jsxs11("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
4865
+ /* @__PURE__ */ jsxs11("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
4866
+ card.kind === "split" ? /* @__PURE__ */ jsx11(
4331
4867
  Icon,
4332
4868
  {
4333
4869
  name: "sparkles-filled",
@@ -4338,7 +4874,7 @@ var renderRouteCard = ({
4338
4874
  ),
4339
4875
  "aria-hidden": "true"
4340
4876
  }
4341
- ) : card.venue ? /* @__PURE__ */ jsx7(
4877
+ ) : card.venue ? /* @__PURE__ */ jsx11(
4342
4878
  VenueLogo,
4343
4879
  {
4344
4880
  venue: card.venue,
@@ -4346,10 +4882,10 @@ var renderRouteCard = ({
4346
4882
  ariaLabel: getTradingVenueLabel(card.venue)
4347
4883
  }
4348
4884
  ) : null,
4349
- /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1 min-w-0", children: [
4350
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
4351
- /* @__PURE__ */ jsx7("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
4352
- card.isUnavailable ? /* @__PURE__ */ jsx7(
4885
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1 min-w-0", children: [
4886
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5", children: [
4887
+ /* @__PURE__ */ jsx11("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
4888
+ card.isUnavailable ? /* @__PURE__ */ jsx11(
4353
4889
  Icon,
4354
4890
  {
4355
4891
  name: "lock",
@@ -4357,7 +4893,7 @@ var renderRouteCard = ({
4357
4893
  className: "shrink-0 text-agg-muted-foreground",
4358
4894
  "aria-hidden": "true"
4359
4895
  }
4360
- ) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ jsx7(
4896
+ ) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ jsx11(
4361
4897
  Icon,
4362
4898
  {
4363
4899
  name: "warning",
@@ -4365,7 +4901,7 @@ var renderRouteCard = ({
4365
4901
  className: "shrink-0 text-agg-muted-foreground",
4366
4902
  "aria-hidden": "true"
4367
4903
  }
4368
- ) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx7(
4904
+ ) : card.kind === "split" && isSelected ? /* @__PURE__ */ jsx11(
4369
4905
  Icon,
4370
4906
  {
4371
4907
  name: showSplitDetails ? "chevron-up" : "chevron-down",
@@ -4375,10 +4911,10 @@ var renderRouteCard = ({
4375
4911
  }
4376
4912
  ) : null
4377
4913
  ] }),
4378
- card.hint ? /* @__PURE__ */ jsx7("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: displayedHint }) : null
4914
+ card.hint ? /* @__PURE__ */ jsx11("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: displayedHint }) : null
4379
4915
  ] })
4380
4916
  ] }),
4381
- /* @__PURE__ */ jsx7(
4917
+ /* @__PURE__ */ jsx11(
4382
4918
  "p",
4383
4919
  {
4384
4920
  className: cn(
@@ -4390,9 +4926,9 @@ var renderRouteCard = ({
4390
4926
  }
4391
4927
  )
4392
4928
  ] }),
4393
- showSplitDetails ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
4394
- /* @__PURE__ */ jsx7("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: (_b = card.description) != null ? _b : tradingLabels.splitOrderDescription }),
4395
- /* @__PURE__ */ jsx7("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_c = card.rows) == null ? void 0 : _c.map(
4929
+ showSplitDetails ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
4930
+ /* @__PURE__ */ jsx11("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: (_b = card.description) != null ? _b : tradingLabels.splitOrderDescription }),
4931
+ /* @__PURE__ */ jsx11("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_c = card.rows) == null ? void 0 : _c.map(
4396
4932
  (row) => renderRouteBreakdownRow(row, sharedKycStatus, tradingLabels)
4397
4933
  ) })
4398
4934
  ] }) : null
@@ -4425,14 +4961,14 @@ var PlaceOrder = ({
4425
4961
  showResolvingState = false,
4426
4962
  midpointsResult
4427
4963
  }) => {
4428
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da;
4964
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha;
4429
4965
  const {
4430
4966
  enableDebug: isExecutionDebugEnabled,
4431
4967
  features: { enableAnimations, showFeesBreakdown, showLimitOrders: limitOrdersFeature },
4432
4968
  formatting: { formatPrice },
4433
4969
  general: { locale }
4434
4970
  } = useSdkUiConfig();
4435
- const labels = useLabels2();
4971
+ const labels = useLabels7();
4436
4972
  const tradingLabels = labels.trading;
4437
4973
  const toastCtx = useOptionalToast();
4438
4974
  const { isTradingBlocked } = useGeoBlock();
@@ -4523,19 +5059,29 @@ var PlaceOrder = ({
4523
5059
  }, 0);
4524
5060
  }, [paperBalancesQuery.balances]);
4525
5061
  const liveAvailableBalance = (_i = liveBalanceState.availableBalance) != null ? _i : liveBalanceState.totalBalance;
4526
- const totalBalance = isPaperMode ? paperTotalBalance : liveAvailableBalance;
4527
- const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
4528
5062
  const executeManaged = useExecuteManaged();
4529
5063
  const placeLimitOrder = usePlaceLimitOrder();
4530
5064
  const aggClient = useAggClient();
4531
5065
  const queryClient = useQueryClient();
4532
- const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig();
5066
+ const { disabledVenues, isLoading: isAppConfigLoading, prophetxExecutionMode } = useAppConfig();
5067
+ const isProphetxDirect = !isPaperMode && prophetxExecutionMode === "direct";
5068
+ const canConnectProphetx = getVenueAvailabilityState({
5069
+ venueId: Venue5.prophetx,
5070
+ disabledVenues,
5071
+ isConfigLoading: isAppConfigLoading
5072
+ }) !== "hidden";
5073
+ const { data: prophetxKeyStatus, refetch: refetchProphetxKeyStatus } = useVenueKeyStatus(
5074
+ Venue5.prophetx,
5075
+ isAuthenticated && !isPaperMode
5076
+ );
5077
+ const [isConnectProphetxModalOpen, setIsConnectProphetxModalOpen] = useState6(false);
4533
5078
  const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = useVenueKeyStatus(
4534
- Venue4.kalshi,
5079
+ Venue5.kalshi,
4535
5080
  isAuthenticated
4536
5081
  );
4537
- const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = useState3(false);
4538
- const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = useState3(false);
5082
+ const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = useState6(false);
5083
+ const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = useState6(false);
5084
+ const [isBetdexAccountModalOpen, setIsBetdexAccountModalOpen] = useState6(false);
4539
5085
  const livePrices = useLiveOutcomePrices(
4540
5086
  scopedSelectedMarket ? [scopedSelectedMarket] : void 0
4541
5087
  );
@@ -4551,32 +5097,32 @@ var PlaceOrder = ({
4551
5097
  () => mergeBestPricesPreferringLive(clusterBestPricesRest, wsBestPrices),
4552
5098
  [clusterBestPricesRest, wsBestPrices]
4553
5099
  );
4554
- const [internalTab, setInternalTab] = useState3("buy");
4555
- const [executionType, setExecutionType] = useState3("market");
4556
- const [selectedLimitVenue, setSelectedLimitVenue] = useState3(null);
4557
- const [limitPrice, setLimitPrice] = useState3(0.5);
4558
- const [limitPriceInputValue, setLimitPriceInputValue] = useState3(formatLimitPriceInputValue(0.5));
4559
- const [limitPriceInputError, setLimitPriceInputError] = useState3(null);
4560
- const [limitExpirationType, setLimitExpirationType] = useState3("GTC");
4561
- const [limitExpirationDate, setLimitExpirationDate] = useState3(void 0);
4562
- const [limitExpirationTime, setLimitExpirationTime] = useState3("17:00");
4563
- const [limitExpirationDraftDate, setLimitExpirationDraftDate] = useState3();
4564
- const [limitExpirationDraftTime, setLimitExpirationDraftTime] = useState3("17:00");
4565
- const [limitExpirationPickerView, setLimitExpirationPickerView] = useState3("options");
4566
- const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = useState3(false);
4567
- const [internalAmount, setInternalAmount] = useState3(PLACE_ORDER_DEFAULT_AMOUNT);
4568
- const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState3(null);
4569
- const [internalSlippage] = useState3(DEFAULT_SLIPPAGE_VALUE);
4570
- const [isRoutesExpanded, setIsRoutesExpanded] = useState3(false);
4571
- const [selectedRouteCardId, setSelectedRouteCardId] = useState3(null);
4572
- const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = useState3(
5100
+ const [internalTab, setInternalTab] = useState6("buy");
5101
+ const [executionType, setExecutionType] = useState6("market");
5102
+ const [selectedLimitVenue, setSelectedLimitVenue] = useState6(null);
5103
+ const [limitPrice, setLimitPrice] = useState6(0.5);
5104
+ const [limitPriceInputValue, setLimitPriceInputValue] = useState6(formatLimitPriceInputValue(0.5));
5105
+ const [limitPriceInputError, setLimitPriceInputError] = useState6(null);
5106
+ const [limitExpirationType, setLimitExpirationType] = useState6("GTC");
5107
+ const [limitExpirationDate, setLimitExpirationDate] = useState6(void 0);
5108
+ const [limitExpirationTime, setLimitExpirationTime] = useState6("17:00");
5109
+ const [limitExpirationDraftDate, setLimitExpirationDraftDate] = useState6();
5110
+ const [limitExpirationDraftTime, setLimitExpirationDraftTime] = useState6("17:00");
5111
+ const [limitExpirationPickerView, setLimitExpirationPickerView] = useState6("options");
5112
+ const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = useState6(false);
5113
+ const [internalAmount, setInternalAmount] = useState6(PLACE_ORDER_DEFAULT_AMOUNT);
5114
+ const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = useState6(null);
5115
+ const [internalSlippage] = useState6(DEFAULT_SLIPPAGE_VALUE);
5116
+ const [isRoutesExpanded, setIsRoutesExpanded] = useState6(false);
5117
+ const [selectedRouteCardId, setSelectedRouteCardId] = useState6(null);
5118
+ const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = useState6(
4573
5119
  null
4574
5120
  );
4575
- const [isSplitDetailOpen, setIsSplitDetailOpen] = useState3(false);
4576
- const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = useState3(null);
4577
- const [submissionFeedback, setSubmissionFeedback] = useState3(null);
4578
- const [submissionProgressState, setSubmissionProgressState] = useState3(null);
4579
- const [isBeforeActionPending, setIsBeforeActionPending] = useState3(false);
5121
+ const [isSplitDetailOpen, setIsSplitDetailOpen] = useState6(false);
5122
+ const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = useState6(null);
5123
+ const [submissionFeedback, setSubmissionFeedback] = useState6(null);
5124
+ const [submissionProgressState, setSubmissionProgressState] = useState6(null);
5125
+ const [isBeforeActionPending, setIsBeforeActionPending] = useState6(false);
4580
5126
  const outcomes = useMemo(
4581
5127
  () => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
4582
5128
  [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
@@ -4660,13 +5206,14 @@ var PlaceOrder = ({
4660
5206
  );
4661
5207
  const visibleLimitVenueOptions = useMemo(() => {
4662
5208
  return limitVenueOptions.filter((option) => {
5209
+ if (option.venue === Venue5.prophetx && (!isProphetxDirect || isSell)) return false;
4663
5210
  return getVenueAvailabilityState({
4664
5211
  venueId: option.venue,
4665
5212
  disabledVenues,
4666
5213
  isConfigLoading: isAppConfigLoading
4667
5214
  }) !== "hidden";
4668
5215
  });
4669
- }, [disabledVenues, isAppConfigLoading, limitVenueOptions]);
5216
+ }, [disabledVenues, isAppConfigLoading, limitVenueOptions, isProphetxDirect, isSell]);
4670
5217
  const {
4671
5218
  positions: executionPositions,
4672
5219
  dataUpdatedAt: executionPositionsUpdatedAt,
@@ -4783,10 +5330,9 @@ var PlaceOrder = ({
4783
5330
  compareVenues: true,
4784
5331
  tradeSide: isSell ? "sell" : "buy",
4785
5332
  mode: isPaperMode ? "paper" : void 0,
4786
- balanceCacheScope: {
4787
- accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
4788
- balanceVersion: isPaperMode ? paperBalancesQuery.dataUpdatedAt : liveBalanceState.dataUpdatedAt
4789
- },
5333
+ balanceCacheScope: __spreadValues({
5334
+ accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null
5335
+ }, isPaperMode ? { balanceVersion: paperBalancesQuery.dataUpdatedAt } : { balanceKey: getPlaceOrderBalanceCacheKey(liveBalanceState.managedBalances) }),
4790
5336
  enabled: isSmartRouteEnabled
4791
5337
  }, isSell ? {
4792
5338
  sellCacheScope: {
@@ -5060,24 +5606,64 @@ var PlaceOrder = ({
5060
5606
  }, [executionType, internalTab, scopedSelectedOutcomeId]);
5061
5607
  const orderedRouteCards = routeCards;
5062
5608
  const selectedRouteCard = (_E = (_D = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _D : orderedRouteCards[0]) != null ? _E : null;
5609
+ const hasDirectProphetxQuote = (_F = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.some(
5610
+ (fill) => fill.venue === Venue5.prophetx && fill.executionBackend === "direct"
5611
+ )) != null ? _F : false;
5063
5612
  const selectedSharedKycVenue = useMemo(() => {
5064
5613
  var _a2, _b2;
5065
5614
  const candidateVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_b2 = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.find(
5066
- (fill) => venueRequiresSharedKyc({ venue: fill.venue })
5615
+ (fill) => venueRequiresSharedKyc({
5616
+ venue: fill.venue,
5617
+ requiresKyc: fill.executionBackend === "direct" ? false : void 0
5618
+ })
5067
5619
  )) == null ? void 0 : _a2.venue) != null ? _b2 : selectedRouteCard == null ? void 0 : selectedRouteCard.venue;
5620
+ if (candidateVenue === Venue5.prophetx && (isProphetxDirect || hasDirectProphetxQuote) && (!isSell || !sellableSharesByVenue.get(Venue5.prophetx)))
5621
+ return null;
5068
5622
  if (!venueRequiresSharedKyc({ venue: candidateVenue })) return null;
5069
5623
  const parsedVenue = parseVenue(candidateVenue);
5070
5624
  return parsedVenue.success ? parsedVenue.data : null;
5071
- }, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard]);
5625
+ }, [
5626
+ isLimitOrder,
5627
+ selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue,
5628
+ selectedRouteCard,
5629
+ isProphetxDirect,
5630
+ hasDirectProphetxQuote,
5631
+ isSell,
5632
+ sellableSharesByVenue
5633
+ ]);
5072
5634
  const needsSharedKycVerification = !isPaperMode && isAuthenticated && sharedKyc !== void 0 && selectedSharedKycVenue !== null && sharedKyc.status !== "verified";
5073
5635
  const isKalshiRoute = useMemo(() => {
5074
- if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue4.kalshi;
5636
+ if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue5.kalshi;
5075
5637
  if (selectedRouteCard) {
5076
5638
  return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
5077
5639
  }
5078
5640
  return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
5079
5641
  }, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
5080
- const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_F = liveBalanceState.kalshiBalance) != null ? _F : 0 : liveAvailableBalance;
5642
+ const isProphetxDirectRoute = !isPaperMode && (isProphetxDirect || hasDirectProphetxQuote) && (!isSell || !sellableSharesByVenue.get(Venue5.prophetx)) && (isLimitOrder ? (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue5.prophetx : selectedRouteCard ? selectedRouteCard.venue === Venue5.prophetx || selectedRouteCard.quoteData.fills.some((fill) => fill.venue === Venue5.prophetx) : (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === Venue5.prophetx);
5643
+ const prophetxBalance = (_H = (_G = liveBalanceState.venueCashBalances) == null ? void 0 : _G[Venue5.prophetx]) != null ? _H : 0;
5644
+ const needsProphetxConnection = !isPaperMode && isAuthenticated && canConnectProphetx && isProphetxDirectRoute && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.connected);
5645
+ useEffect4(() => {
5646
+ if ((selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === Venue5.prophetx) {
5647
+ setLimitExpirationType("GTC");
5648
+ setIsLimitExpirationPickerOpen(false);
5649
+ }
5650
+ }, [selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue]);
5651
+ const selectedRouteFills = (_I = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _I : [];
5652
+ const fallbackRouteVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_J = selectedRouteCard == null ? void 0 : selectedRouteCard.venue) != null ? _J : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue;
5653
+ const isBetdexRoute = isLimitOrder || selectedRouteFills.length === 0 ? fallbackRouteVenue === Venue5.betdex : selectedRouteFills.some((fill) => fill.venue === Venue5.betdex);
5654
+ const isBetdexOnlyRoute = isBetdexRoute && (isLimitOrder || selectedRouteFills.every((fill) => fill.venue === Venue5.betdex));
5655
+ const { account: betdexAccount, isAvailable: isBetdexAccountAvailable } = useHostedVenueAccount2(
5656
+ "betdex",
5657
+ !isPaperMode && isBetdexRoute
5658
+ );
5659
+ const betdexAccountData = betdexAccount.data;
5660
+ const betdexBalance = isBetdexAccountAvailable && !betdexAccount.isError && (betdexAccountData == null ? void 0 : betdexAccountData.status) === "active" && betdexAccountData.balanceStatus === "available" ? betdexAccountData.balance : null;
5661
+ const betdexAvailableAmount = betdexBalance ? Number(betdexBalance.availableRaw) / __pow(10, betdexBalance.decimals) : NaN;
5662
+ const betdexAvailableBalance = Number.isFinite(betdexAvailableAmount) && betdexAvailableAmount >= 0 ? betdexAvailableAmount : null;
5663
+ const totalBalance = isPaperMode ? paperTotalBalance : isProphetxDirectRoute ? prophetxBalance : isBetdexOnlyRoute ? betdexAvailableBalance != null ? betdexAvailableBalance : 0 : liveAvailableBalance;
5664
+ const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : isBetdexOnlyRoute ? betdexAccount.isLoading : liveBalanceState.isLoading || isBetdexRoute && betdexAccount.isLoading;
5665
+ const displayedBalance = isPaperMode ? paperTotalBalance : isProphetxDirectRoute ? prophetxBalance : isBetdexOnlyRoute ? betdexAvailableBalance != null ? betdexAvailableBalance : 0 : isKalshiRoute ? (_K = liveBalanceState.kalshiBalance) != null ? _K : 0 : liveAvailableBalance;
5666
+ const betdexBalanceLabel = betdexAvailableBalance === null ? tradingLabels.betdexBalanceUnavailable : tradingLabels.betdexBalance(formatUsd(betdexAvailableBalance));
5081
5667
  const needsKalshiConnection = isKalshiDisconnected && isKalshiRoute;
5082
5668
  const handleVerifyKalshi = useCallback3(
5083
5669
  (credentials) => __async(null, null, function* () {
@@ -5085,7 +5671,7 @@ var PlaceOrder = ({
5085
5671
  yield onConnectKalshi(credentials);
5086
5672
  } else {
5087
5673
  yield aggClient.upsertVenueKey({
5088
- venue: Venue4.kalshi,
5674
+ venue: Venue5.kalshi,
5089
5675
  credentials: {
5090
5676
  keyId: credentials.apiKeyId,
5091
5677
  privateKey: credentials.privateKey
@@ -5129,24 +5715,25 @@ var PlaceOrder = ({
5129
5715
  ]
5130
5716
  );
5131
5717
  const executionProgress = useExecutionProgress({
5132
- orderIds: (_G = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _G : null,
5133
- quoteId: (_H = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _H : null,
5718
+ orderIds: (_L = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _L : null,
5719
+ quoteId: (_M = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _M : null,
5134
5720
  mode: isPaperMode ? "paper" : void 0,
5135
- enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_I = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _I.length)
5721
+ enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_N = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _N.length)
5136
5722
  });
5137
5723
  const executionProgressFloorRef = useRef4({
5138
5724
  quoteId: null,
5139
5725
  value: 0
5140
5726
  });
5141
- const selectedOutcomeLabel = (_L = (_K = (_J = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _J.label) != null ? _K : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _L : "";
5142
- const headerImage = (_N = (_M = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _M : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _N : null;
5143
- const headerTitle = (_P = (_O = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _O : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _P : "";
5144
- const headerSubtitle = (_Q = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
5145
- const executionDateSource = (_R = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _R : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
5727
+ const selectedOutcomeLabel = (_Q = (_P = (_O = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _O.label) != null ? _P : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _Q : "";
5728
+ const headerImage = (_S = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _R : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _S : null;
5729
+ const headerTitle = (_U = (_T = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _T : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _U : "";
5730
+ const headerSubtitle = (_V = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _V : "";
5731
+ const executionDateSource = (_W = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _W : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
5146
5732
  const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
5147
- const executionQuoteData = (_T = (_S = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _S : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _T : null;
5733
+ const executionQuoteData = (_Y = (_X = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _X : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _Y : null;
5148
5734
  const executionOrderGroups = useMemo(() => {
5149
5735
  var _a2, _b2, _c2;
5736
+ if (submissionProgressState == null ? void 0 : submissionProgressState.limitOrderGroup) return [submissionProgressState.limitOrderGroup];
5150
5737
  if (!executionQuoteData) return [];
5151
5738
  return deriveExecutionOrderGroups({
5152
5739
  quoteData: executionQuoteData,
@@ -5165,7 +5752,8 @@ var PlaceOrder = ({
5165
5752
  executionProgress.terminalOrderEvents,
5166
5753
  executionQuoteData,
5167
5754
  internalTab,
5168
- (_U = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _U.length,
5755
+ submissionProgressState == null ? void 0 : submissionProgressState.limitOrderGroup,
5756
+ (_Z = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _Z.length,
5169
5757
  tradingLabels
5170
5758
  ]);
5171
5759
  const executionProgressPercent = useMemo(() => {
@@ -5517,21 +6105,29 @@ var PlaceOrder = ({
5517
6105
  queryClient,
5518
6106
  submissionProgressState
5519
6107
  ]);
5520
- const activeQuoteData = isLimitOrder ? null : (_V = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _V : scopedSmartRouteData;
6108
+ const activeQuoteData = isLimitOrder ? null : (__ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? __ : scopedSmartRouteData;
5521
6109
  const visibleMarketRouteCards = displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? displayedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : displayedRouteCards;
5522
6110
  const hasEnteredAmount = internalAmount > 0;
5523
6111
  const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (isSell && isQuoteInputEditing || smartRoute.isLoading || !isSell && smartRoute.isFetching || isSell && venueSellQuotes.isLoading);
5524
6112
  const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
5525
- const selectedRouteFills = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _W : [];
5526
- const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === Venue4.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === Venue4.kalshi));
5527
- const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== Venue4.kalshi);
5528
- const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue4.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
5529
- const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== Venue4.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
6113
+ const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === Venue5.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === Venue5.kalshi));
6114
+ const isOnchainOnlyRoute = !isKalshiRoute && !isBetdexRoute && !isProphetxDirectRoute;
6115
+ const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue5.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
6116
+ const betdexRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue5.betdex).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
6117
+ const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter(
6118
+ (fill) => fill.venue !== Venue5.kalshi && fill.venue !== Venue5.betdex && !(fill.venue === Venue5.prophetx && (isProphetxDirect || fill.executionBackend === "direct"))
6119
+ ).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
5530
6120
  const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
5531
- const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
5532
- const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_X = liveBalanceState.kalshiBalance) != null ? _X : 0);
6121
+ const resolvedBetdexRequiredAmount = isBetdexOnlyRoute ? internalAmount : betdexRequiredAmount;
6122
+ const resolvedOnchainRequiredAmount = isOnchainOnlyRoute ? internalAmount : onchainRequiredAmount;
6123
+ const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_$ = liveBalanceState.kalshiBalance) != null ? _$ : 0);
6124
+ const isBetdexBalanceInsufficient = !isPaperMode && isBetdexRoute && betdexAvailableBalance !== null && resolvedBetdexRequiredAmount > betdexAvailableBalance;
6125
+ const isBetdexBalanceUnavailable = !isPaperMode && !isSell && isAuthenticated && isBetdexRoute && betdexAvailableBalance === null;
6126
+ const needsBetdexAccount = !isSell && isAuthenticated && !betdexAccount.isLoading && (isBetdexBalanceUnavailable || hasEnteredAmount && isBetdexBalanceInsufficient);
5533
6127
  const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
5534
- const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
6128
+ const prophetxRequiredAmount = !isProphetxDirectRoute || isSell ? 0 : selectedRouteFills.length ? selectedRouteFills.filter((fill) => fill.venue === Venue5.prophetx).reduce((sum, fill) => sum + fill.venueQty * fill.avgPrice, 0) : internalAmount;
6129
+ const isProphetxBalanceInsufficient = !isPaperMode && !isBalanceLoading && prophetxRequiredAmount > prophetxBalance;
6130
+ const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > (isProphetxDirectRoute ? prophetxBalance : totalBalance) : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isProphetxBalanceInsufficient || isBetdexBalanceInsufficient || isOnchainBalanceInsufficient);
5535
6131
  const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
5536
6132
  const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
5537
6133
  const insufficientBalanceDetails = isQuoteInsufficientBalance && (activeQuoteData == null ? void 0 : activeQuoteData.error) && activeQuoteData.error !== tradingLabels.insufficientBalance ? activeQuoteData.error : null;
@@ -5665,7 +6261,7 @@ var PlaceOrder = ({
5665
6261
  const averagePrice = selectedRouteCard.executionPrice;
5666
6262
  return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
5667
6263
  }, [selectedRouteCard, tradingLabels]);
5668
- const displayedToWinValue = (_Y = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _Y : 0;
6264
+ const displayedToWinValue = (_aa = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _aa : 0;
5669
6265
  const originalLimitPriceRaw = useMemo(() => toLimitPriceRaw(limitPrice), [limitPrice]);
5670
6266
  const limitPriceAdjustmentByVenue = useMemo(() => {
5671
6267
  var _a2;
@@ -5694,7 +6290,7 @@ var PlaceOrder = ({
5694
6290
  return adjustments;
5695
6291
  }, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
5696
6292
  const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
5697
- const selectedLimitPriceRaw = (_Z = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _Z : originalLimitPriceRaw;
6293
+ const selectedLimitPriceRaw = (_ba = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _ba : originalLimitPriceRaw;
5698
6294
  const limitPriceAdjustmentMessage = useMemo(() => {
5699
6295
  if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
5700
6296
  return "";
@@ -5737,8 +6333,8 @@ var PlaceOrder = ({
5737
6333
  side: internalTab,
5738
6334
  limitPriceRaw,
5739
6335
  sizeRaw,
5740
- timeInForce: limitExpirationType === "GTC" ? "GTC" : "GTD"
5741
- }, expiresAt ? { expiresAt } : {});
6336
+ timeInForce: selectedLimitVenueOption.venue === Venue5.prophetx || limitExpirationType === "GTC" ? "GTC" : "GTD"
6337
+ }, expiresAt && selectedLimitVenueOption.venue !== Venue5.prophetx ? { expiresAt } : {});
5742
6338
  }, [
5743
6339
  internalAmount,
5744
6340
  internalTab,
@@ -5868,7 +6464,7 @@ var PlaceOrder = ({
5868
6464
  if (totalFees == null) return null;
5869
6465
  return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
5870
6466
  }, [activeFeeBreakdown]);
5871
- const appFeeValue = (__ = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? __ : 0;
6467
+ const appFeeValue = (_ca = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? _ca : 0;
5872
6468
  const feeBreakdownRows = useMemo(() => {
5873
6469
  var _a2;
5874
6470
  if (!activeFeeBreakdown) return [];
@@ -5918,14 +6514,14 @@ var PlaceOrder = ({
5918
6514
  }, [activeFeeBreakdown, appFeeValue, tradingLabels]);
5919
6515
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
5920
6516
  const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
5921
- const selectedLimitRouteCard = selectedLimitRouteCardId ? (_$ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _$ : null : null;
5922
- const selectedRouteGeoBlocked = isLimitOrder ? (_aa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _aa : false : (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ba : false;
6517
+ const selectedLimitRouteCard = selectedLimitRouteCardId ? (_da = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _da : null : null;
6518
+ const selectedRouteGeoBlocked = isLimitOrder ? (_ea = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _ea : false : (_fa = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _fa : false;
5923
6519
  const geoBlockedVenuesFromWarnings = useMemo(
5924
6520
  () => {
5925
6521
  var _a2;
5926
6522
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
5927
6523
  },
5928
- [(_ca = smartRoute.data) == null ? void 0 : _ca.warnings]
6524
+ [(_ga = smartRoute.data) == null ? void 0 : _ga.warnings]
5929
6525
  );
5930
6526
  const isPrimaryVenueGeoBlocked = useMemo(() => {
5931
6527
  var _a2, _b2;
@@ -5935,7 +6531,7 @@ var PlaceOrder = ({
5935
6531
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
5936
6532
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
5937
6533
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
5938
- const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
6534
+ const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBetdexBalanceUnavailable || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
5939
6535
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
5940
6536
  const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
5941
6537
  const handleReturnToOrderForm = useCallback3(() => {
@@ -6096,30 +6692,43 @@ var PlaceOrder = ({
6096
6692
  payload: submissionLimitOrderPayload
6097
6693
  });
6098
6694
  }
6099
- const response = yield placeLimitOrder.mutateAsync(submissionLimitOrderPayload);
6100
- const limitPriceLabel = formatLimitPriceRawLabel(response.limitPriceRaw);
6101
6695
  const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(LIMIT_ORDER_RAW_SCALE);
6102
6696
  const sizeLabel = size.toLocaleString("en-US", {
6103
6697
  minimumFractionDigits: 2,
6104
6698
  maximumFractionDigits: 2
6105
6699
  });
6106
- const estimatedCost = internalTab === "buy" ? formatUsd(
6700
+ const notionalLabel = formatUsd(
6107
6701
  Number(
6108
6702
  ceilDiv(
6109
6703
  BigInt(submissionLimitOrderPayload.limitPriceRaw) * BigInt(submissionLimitOrderPayload.sizeRaw),
6110
6704
  LIMIT_ORDER_RAW_SCALE
6111
6705
  )
6112
6706
  ) / Number(LIMIT_ORDER_RAW_SCALE)
6113
- ) : sizeLabel;
6707
+ );
6708
+ const estimatedCost = internalTab === "buy" ? notionalLabel : sizeLabel;
6709
+ const orderAmountLabel = internalTab === "buy" ? notionalLabel : tradingLabels.executionShares(sizeLabel);
6710
+ const payoutLabel = internalTab === "buy" ? formatUsd(size) : notionalLabel;
6711
+ const limitOrderGroup = buildLimitOrderExecutionGroup({
6712
+ venue: submissionLimitOrderPayload.venue,
6713
+ priceLabel: formatLimitPriceRawLabel(submissionLimitOrderPayload.limitPriceRaw),
6714
+ amountLabel: orderAmountLabel,
6715
+ status: "loading",
6716
+ labels: tradingLabels
6717
+ });
6718
+ setSubmissionProgressState({ phase: "submitting", limitOrderGroup });
6719
+ const response = yield placeLimitOrder.mutateAsync(submissionLimitOrderPayload);
6720
+ const limitPriceLabel = formatLimitPriceRawLabel(response.limitPriceRaw);
6114
6721
  const eventTitle = (_b2 = (_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _a2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _b2 : "";
6115
6722
  const eventDateSource = (_c2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _c2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
6116
- const responseVenue = Venue4[response.venue];
6723
+ const responseVenue = Venue5[response.venue];
6117
6724
  setSubmissionProgressState({
6118
6725
  orderId: response.orderId,
6119
6726
  orderIds: [response.orderId],
6120
6727
  executionVenue: responseVenue,
6121
6728
  phase: "success",
6122
6729
  summary: {
6730
+ orderType: "limit",
6731
+ limitPriceLabel,
6123
6732
  tradeSide: internalTab,
6124
6733
  shares: sizeLabel,
6125
6734
  avgPrice: limitPriceLabel,
@@ -6129,18 +6738,17 @@ var PlaceOrder = ({
6129
6738
  eventDateLabel: eventDateSource ? getTradingDateLabel(eventDateSource) : "",
6130
6739
  eventImage: headerImage,
6131
6740
  actionLabel: internalTab === "buy" ? (_e2 = (_d2 = tradingLabels.boughtOutcomeAtPrice) == null ? void 0 : _d2.call(tradingLabels, selectedOutcomeLabel, limitPriceLabel)) != null ? _e2 : `Bought ${selectedOutcomeLabel} at ${limitPriceLabel}` : (_g2 = (_f2 = tradingLabels.soldOutcomeAtPrice) == null ? void 0 : _f2.call(tradingLabels, selectedOutcomeLabel, limitPriceLabel)) != null ? _g2 : `Sold ${selectedOutcomeLabel} at ${limitPriceLabel}`,
6132
- amountLabel: internalTab === "sell" ? sizeLabel : estimatedCost,
6133
- toWinLabel: internalTab === "sell" ? estimatedCost : sizeLabel,
6741
+ amountLabel: orderAmountLabel,
6742
+ toWinLabel: payoutLabel,
6134
6743
  potentialReturnLabel: void 0,
6135
- executionStepGroups: [
6136
- [
6137
- {
6138
- id: "limit-order-placed",
6139
- label: tradingLabels.limitOrderPlacedDescription,
6140
- tone: "complete",
6141
- venue: responseVenue
6142
- }
6143
- ]
6744
+ executionGroups: [
6745
+ buildLimitOrderExecutionGroup({
6746
+ venue: responseVenue,
6747
+ priceLabel: limitPriceLabel,
6748
+ amountLabel: orderAmountLabel,
6749
+ status: "done",
6750
+ labels: tradingLabels
6751
+ })
6144
6752
  ]
6145
6753
  }
6146
6754
  });
@@ -6346,7 +6954,7 @@ var PlaceOrder = ({
6346
6954
  ]);
6347
6955
  const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
6348
6956
  if (isLoading) {
6349
- return /* @__PURE__ */ jsx7(
6957
+ return /* @__PURE__ */ jsx11(
6350
6958
  Skeleton,
6351
6959
  {
6352
6960
  ariaLabel: labels.common.loading,
@@ -6357,7 +6965,7 @@ var PlaceOrder = ({
6357
6965
  }
6358
6966
  if (submissionProgressState) {
6359
6967
  if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
6360
- return /* @__PURE__ */ jsx7(
6968
+ return /* @__PURE__ */ jsx11(
6361
6969
  PlaceOrderSuccessView,
6362
6970
  {
6363
6971
  className: resolvedStatusClassName,
@@ -6369,7 +6977,7 @@ var PlaceOrder = ({
6369
6977
  );
6370
6978
  }
6371
6979
  if (submissionProgressState.phase === "failed") {
6372
- return /* @__PURE__ */ jsx7(
6980
+ return /* @__PURE__ */ jsx11(
6373
6981
  PlaceOrderFailureView,
6374
6982
  {
6375
6983
  className: resolvedStatusClassName,
@@ -6382,7 +6990,7 @@ var PlaceOrder = ({
6382
6990
  }
6383
6991
  );
6384
6992
  }
6385
- return /* @__PURE__ */ jsx7(
6993
+ return /* @__PURE__ */ jsx11(
6386
6994
  PlaceOrderExecutionView,
6387
6995
  {
6388
6996
  className,
@@ -6393,7 +7001,7 @@ var PlaceOrder = ({
6393
7001
  eventTitle: headerTitle,
6394
7002
  groups: executionOrderGroups,
6395
7003
  labels: tradingLabels,
6396
- progress: executionProgressPercent,
7004
+ progress: submissionProgressState.limitOrderGroup ? LIMIT_ORDER_SUBMITTING_PROGRESS : executionProgressPercent,
6397
7005
  settlementHint: submissionProgressState.phase === "executing" ? submissionProgressState.errorMessage : void 0
6398
7006
  }
6399
7007
  );
@@ -6517,11 +7125,15 @@ var PlaceOrder = ({
6517
7125
  setIsLimitExpirationPickerOpen(false);
6518
7126
  };
6519
7127
  const handleDepositRequiredClick = () => {
6520
- if (!isInsufficientBalance) return;
7128
+ if (!isInsufficientBalance && !needsBetdexAccount) return;
6521
7129
  if (isKalshiBalanceInsufficient) {
6522
7130
  setIsFundKalshiModalOpen(true);
6523
7131
  return;
6524
7132
  }
7133
+ if (needsBetdexAccount) {
7134
+ setIsBetdexAccountModalOpen(true);
7135
+ return;
7136
+ }
6525
7137
  requestAggDepositModalOpen();
6526
7138
  };
6527
7139
  const handleTabKeyDown = (event, currentTab) => {
@@ -6594,18 +7206,23 @@ var PlaceOrder = ({
6594
7206
  fallbackMessage: tradingLabels.orderFailed,
6595
7207
  labels: tradingLabels
6596
7208
  });
6597
- setSubmissionProgressState({
7209
+ setSubmissionProgressState((prev) => ({
6598
7210
  phase: "failed",
6599
- errorMessage
6600
- });
7211
+ errorMessage,
7212
+ limitOrderGroup: (prev == null ? void 0 : prev.limitOrderGroup) ? __spreadProps(__spreadValues({}, prev.limitOrderGroup), {
7213
+ steps: prev.limitOrderGroup.steps.map((step) => __spreadProps(__spreadValues({}, step), {
7214
+ status: "failed"
7215
+ }))
7216
+ }) : void 0
7217
+ }));
6601
7218
  }
6602
7219
  });
6603
7220
  if (isEndedWithoutKnownWinner || !orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
6604
- return /* @__PURE__ */ jsx7(
7221
+ return /* @__PURE__ */ jsx11(
6605
7222
  PlaceOrderResolvedView,
6606
7223
  {
6607
7224
  tradingState: resolvedReadOnlyTradingState,
6608
- resolutionTimestamp: (_da = resolvedEventTradingState.resolvesAt) != null ? _da : resolvedReadOnlyTradingState.resolvesAt,
7225
+ resolutionTimestamp: (_ha = resolvedEventTradingState.resolvesAt) != null ? _ha : resolvedReadOnlyTradingState.resolvesAt,
6609
7226
  resolvedClaim,
6610
7227
  classNames,
6611
7228
  className,
@@ -6614,8 +7231,8 @@ var PlaceOrder = ({
6614
7231
  }
6615
7232
  );
6616
7233
  }
6617
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
6618
- /* @__PURE__ */ jsxs6(
7234
+ return /* @__PURE__ */ jsxs11(Fragment3, { children: [
7235
+ /* @__PURE__ */ jsxs11(
6619
7236
  Card,
6620
7237
  {
6621
7238
  className: cn(
@@ -6632,20 +7249,20 @@ var PlaceOrder = ({
6632
7249
  headerTitle,
6633
7250
  onClose
6634
7251
  }),
6635
- /* @__PURE__ */ jsxs6("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
6636
- /* @__PURE__ */ jsxs6(
7252
+ /* @__PURE__ */ jsxs11("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
7253
+ /* @__PURE__ */ jsxs11(
6637
7254
  "div",
6638
7255
  {
6639
7256
  className: "agg-order-tabs flex items-end border-b border-agg-separator",
6640
7257
  role: "tablist",
6641
7258
  "aria-label": labels.common.tabsAria,
6642
7259
  children: [
6643
- /* @__PURE__ */ jsx7("div", { className: "flex min-w-0 flex-1 items-end", children: [
7260
+ /* @__PURE__ */ jsx11("div", { className: "flex min-w-0 flex-1 items-end", children: [
6644
7261
  { value: "buy", label: tradingLabels.buy, ref: buyTabRef },
6645
7262
  { value: "sell", label: tradingLabels.sell, ref: sellTabRef }
6646
7263
  ].map((tabItem) => {
6647
7264
  const isActive = internalTab === tabItem.value;
6648
- return /* @__PURE__ */ jsxs6(
7265
+ return /* @__PURE__ */ jsxs11(
6649
7266
  "button",
6650
7267
  {
6651
7268
  ref: tabItem.ref,
@@ -6669,7 +7286,7 @@ var PlaceOrder = ({
6669
7286
  onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
6670
7287
  children: [
6671
7288
  tabItem.label,
6672
- /* @__PURE__ */ jsx7(
7289
+ /* @__PURE__ */ jsx11(
6673
7290
  "span",
6674
7291
  {
6675
7292
  "aria-hidden": "true",
@@ -6689,7 +7306,7 @@ var PlaceOrder = ({
6689
7306
  tabItem.value
6690
7307
  );
6691
7308
  }) }),
6692
- showLimitOrders ? /* @__PURE__ */ jsx7(
7309
+ showLimitOrders ? /* @__PURE__ */ jsx11(
6693
7310
  Select,
6694
7311
  {
6695
7312
  ariaLabel: tradingLabels.orderTypeAria,
@@ -6710,8 +7327,8 @@ var PlaceOrder = ({
6710
7327
  ]
6711
7328
  }
6712
7329
  ),
6713
- /* @__PURE__ */ jsxs6("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
6714
- outcomes.length >= 2 ? /* @__PURE__ */ jsx7("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
7330
+ /* @__PURE__ */ jsxs11("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
7331
+ outcomes.length >= 2 ? /* @__PURE__ */ jsx11("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
6715
7332
  var _a2, _b2, _c2;
6716
7333
  const price = getDisplayOutcomePrice({
6717
7334
  outcomeId: outcome.id,
@@ -6725,7 +7342,7 @@ var PlaceOrder = ({
6725
7342
  const isActive = outcome.id === scopedSelectedOutcomeId;
6726
7343
  const isPositive = resolveIsPositiveOutcome(outcome, index);
6727
7344
  const isPriceLoading = clusterMidpointResult.isLoading && price == null;
6728
- return /* @__PURE__ */ jsxs6(
7345
+ return /* @__PURE__ */ jsxs11(
6729
7346
  "button",
6730
7347
  {
6731
7348
  "data-id": outcome.id,
@@ -6745,7 +7362,7 @@ var PlaceOrder = ({
6745
7362
  disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
6746
7363
  onClick: () => handleOutcomeChange(outcome.id),
6747
7364
  children: [
6748
- /* @__PURE__ */ jsx7(
7365
+ /* @__PURE__ */ jsx11(
6749
7366
  Typography,
6750
7367
  {
6751
7368
  as: "span",
@@ -6754,7 +7371,7 @@ var PlaceOrder = ({
6754
7371
  children: (_c2 = outcome.title) != null ? _c2 : outcome.label
6755
7372
  }
6756
7373
  ),
6757
- isPriceLoading ? /* @__PURE__ */ jsx7(
7374
+ isPriceLoading ? /* @__PURE__ */ jsx11(
6758
7375
  "span",
6759
7376
  {
6760
7377
  "aria-hidden": "true",
@@ -6763,18 +7380,18 @@ var PlaceOrder = ({
6763
7380
  "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
6764
7381
  )
6765
7382
  }
6766
- ) : /* @__PURE__ */ jsx7(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
7383
+ ) : /* @__PURE__ */ jsx11(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
6767
7384
  ]
6768
7385
  },
6769
7386
  outcome.id
6770
7387
  );
6771
7388
  }) }) : null,
6772
- isLimitOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
6773
- /* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
6774
- /* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
6775
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
6776
- /* @__PURE__ */ jsxs6("label", { className: "relative flex items-center", children: [
6777
- /* @__PURE__ */ jsx7(
7389
+ isLimitOrder ? /* @__PURE__ */ jsxs11("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
7390
+ /* @__PURE__ */ jsx11("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
7391
+ /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
7392
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
7393
+ /* @__PURE__ */ jsxs11("label", { className: "relative flex items-center", children: [
7394
+ /* @__PURE__ */ jsx11(
6778
7395
  "input",
6779
7396
  {
6780
7397
  type: "text",
@@ -6791,40 +7408,40 @@ var PlaceOrder = ({
6791
7408
  )
6792
7409
  }
6793
7410
  ),
6794
- /* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
7411
+ /* @__PURE__ */ jsx11("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
6795
7412
  ] }),
6796
- /* @__PURE__ */ jsx7(
7413
+ /* @__PURE__ */ jsx11(
6797
7414
  "button",
6798
7415
  {
6799
7416
  type: "button",
6800
7417
  className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
6801
7418
  "aria-label": tradingLabels.limitPriceDecreaseAria,
6802
7419
  onClick: () => handleLimitPriceStep("decrease"),
6803
- children: /* @__PURE__ */ jsx7(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
7420
+ children: /* @__PURE__ */ jsx11(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
6804
7421
  }
6805
7422
  ),
6806
- /* @__PURE__ */ jsx7(
7423
+ /* @__PURE__ */ jsx11(
6807
7424
  "button",
6808
7425
  {
6809
7426
  type: "button",
6810
7427
  className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
6811
7428
  "aria-label": tradingLabels.limitPriceIncreaseAria,
6812
7429
  onClick: () => handleLimitPriceStep("increase"),
6813
- children: /* @__PURE__ */ jsx7(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
7430
+ children: /* @__PURE__ */ jsx11(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
6814
7431
  }
6815
7432
  )
6816
7433
  ] }),
6817
- limitPriceInputError ? /* @__PURE__ */ jsx7("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
7434
+ limitPriceInputError ? /* @__PURE__ */ jsx11("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
6818
7435
  ] })
6819
7436
  ] }) : null,
6820
- isLimitOrder && limitPriceAdjustmentMessage ? /* @__PURE__ */ jsxs6(
7437
+ isLimitOrder && limitPriceAdjustmentMessage ? /* @__PURE__ */ jsxs11(
6821
7438
  "div",
6822
7439
  {
6823
7440
  className: "agg-limit-price-adjustment flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
6824
7441
  role: "status",
6825
7442
  "aria-live": "polite",
6826
7443
  children: [
6827
- /* @__PURE__ */ jsx7(
7444
+ /* @__PURE__ */ jsx11(
6828
7445
  Icon,
6829
7446
  {
6830
7447
  name: "warning-filled",
@@ -6833,16 +7450,16 @@ var PlaceOrder = ({
6833
7450
  "aria-hidden": "true"
6834
7451
  }
6835
7452
  ),
6836
- /* @__PURE__ */ jsx7("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: limitPriceAdjustmentMessage })
7453
+ /* @__PURE__ */ jsx11("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: limitPriceAdjustmentMessage })
6837
7454
  ]
6838
7455
  }
6839
7456
  ) : null,
6840
- /* @__PURE__ */ jsxs6("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
6841
- /* @__PURE__ */ jsxs6("div", { className: "agg-order-amount-meta flex flex-col", children: [
6842
- /* @__PURE__ */ jsx7("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
6843
- isAuthenticated ? isSell ? /* @__PURE__ */ jsx7("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx7(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
6844
- /* @__PURE__ */ jsx7("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
6845
- displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx7(
7457
+ /* @__PURE__ */ jsxs11("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
7458
+ /* @__PURE__ */ jsxs11("div", { className: "agg-order-amount-meta flex flex-col", children: [
7459
+ /* @__PURE__ */ jsx11("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
7460
+ isAuthenticated ? isSell ? /* @__PURE__ */ jsx11("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
7461
+ /* @__PURE__ */ jsx11("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
7462
+ displayedCurrentSellableShares > 0 ? /* @__PURE__ */ jsx11(
6846
7463
  "button",
6847
7464
  {
6848
7465
  type: "button",
@@ -6858,9 +7475,12 @@ var PlaceOrder = ({
6858
7475
  children: tradingLabels.maxShares
6859
7476
  }
6860
7477
  ) : null
6861
- ] }) }) : /* @__PURE__ */ jsx7("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ jsx7(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
7478
+ ] }) }) : /* @__PURE__ */ jsx11("div", { className: "agg-balance-value flex flex-col items-end gap-1 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "small" }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
7479
+ /* @__PURE__ */ jsx11("span", { children: !isPaperMode && isBetdexOnlyRoute ? betdexBalanceLabel : tradingLabels.balance(formatUsd(displayedBalance)) }),
7480
+ !isPaperMode && isBetdexRoute && !isBetdexOnlyRoute ? /* @__PURE__ */ jsx11("span", { children: betdexBalanceLabel }) : null
7481
+ ] }) }) : null
6862
7482
  ] }),
6863
- /* @__PURE__ */ jsx7(
7483
+ /* @__PURE__ */ jsx11(
6864
7484
  CurrencyInput,
6865
7485
  {
6866
7486
  value: internalAmount,
@@ -6882,57 +7502,67 @@ var PlaceOrder = ({
6882
7502
  }
6883
7503
  )
6884
7504
  ] }),
6885
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
6886
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
6887
- /* @__PURE__ */ jsx7(
6888
- Typography,
6889
- {
6890
- variant: "text-sm",
6891
- className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
6892
- children: tradingLabels.estimatedFees
6893
- }
6894
- ),
6895
- feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx7(
6896
- Tooltip,
6897
- {
6898
- "aria-label": tradingLabels.estimatedFeesTooltipAria,
6899
- classNames: {
6900
- content: cn(
6901
- "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
6902
- "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
6903
- ),
6904
- icon: "h-3 w-3 text-agg-muted-foreground",
6905
- trigger: "h-3 w-3 text-agg-muted-foreground"
6906
- },
6907
- content: /* @__PURE__ */ jsx7("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs6(
6908
- "div",
6909
- {
6910
- className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
6911
- children: [
6912
- /* @__PURE__ */ jsx7("span", { children: row.label }),
6913
- row.kind === "badge" ? /* @__PURE__ */ jsx7(
6914
- "span",
6915
- {
6916
- className: cn(
6917
- "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
6918
- "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
6919
- "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
6920
- ),
6921
- children: row.badgeLabel
6922
- }
6923
- ) : /* @__PURE__ */ jsx7("span", { className: "text-right", children: row.value })
6924
- ]
7505
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
7506
+ /* @__PURE__ */ jsxs11("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
7507
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5", children: [
7508
+ /* @__PURE__ */ jsx11(
7509
+ Typography,
7510
+ {
7511
+ variant: "text-sm",
7512
+ className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
7513
+ children: tradingLabels.estimatedFees
7514
+ }
7515
+ ),
7516
+ feeBreakdownRows.length > 0 ? /* @__PURE__ */ jsx11(
7517
+ Tooltip,
7518
+ {
7519
+ "aria-label": tradingLabels.estimatedFeesTooltipAria,
7520
+ classNames: {
7521
+ content: cn(
7522
+ "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
7523
+ "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
7524
+ ),
7525
+ icon: "h-3 w-3 text-agg-muted-foreground",
7526
+ trigger: "h-3 w-3 text-agg-muted-foreground"
6925
7527
  },
6926
- row.label
6927
- )) })
6928
- }
6929
- ) : null
7528
+ content: /* @__PURE__ */ jsx11("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ jsxs11(
7529
+ "div",
7530
+ {
7531
+ className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
7532
+ children: [
7533
+ /* @__PURE__ */ jsx11("span", { children: row.label }),
7534
+ row.kind === "badge" ? /* @__PURE__ */ jsx11(
7535
+ "span",
7536
+ {
7537
+ className: cn(
7538
+ "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
7539
+ "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
7540
+ "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
7541
+ ),
7542
+ children: row.badgeLabel
7543
+ }
7544
+ ) : /* @__PURE__ */ jsx11("span", { className: "text-right", children: row.value })
7545
+ ]
7546
+ },
7547
+ row.label
7548
+ )) })
7549
+ }
7550
+ ) : null
7551
+ ] }),
7552
+ /* @__PURE__ */ jsx11("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
6930
7553
  ] }),
6931
- /* @__PURE__ */ jsx7("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
7554
+ (activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === Venue5.betdex)) ? /* @__PURE__ */ jsx11(
7555
+ Typography,
7556
+ {
7557
+ variant: "text-sm",
7558
+ className: "agg-order-settlement-fee-notice text-agg-muted-foreground",
7559
+ children: tradingLabels.betdexSettlementFeeNotice
7560
+ }
7561
+ ) : null
6932
7562
  ] }) : null,
6933
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && executionReserveValue ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-reserve-section flex items-center justify-between gap-4", children: [
6934
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1.5", children: [
6935
- /* @__PURE__ */ jsx7(
7563
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && executionReserveValue ? /* @__PURE__ */ jsxs11("div", { className: "agg-order-reserve-section flex items-center justify-between gap-4", children: [
7564
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5", children: [
7565
+ /* @__PURE__ */ jsx11(
6936
7566
  Typography,
6937
7567
  {
6938
7568
  variant: "text-sm",
@@ -6940,7 +7570,7 @@ var PlaceOrder = ({
6940
7570
  children: tradingLabels.executionReserve
6941
7571
  }
6942
7572
  ),
6943
- /* @__PURE__ */ jsx7(
7573
+ /* @__PURE__ */ jsx11(
6944
7574
  Tooltip,
6945
7575
  {
6946
7576
  "aria-label": tradingLabels.executionReserveTooltipAria,
@@ -6953,18 +7583,18 @@ var PlaceOrder = ({
6953
7583
  }
6954
7584
  )
6955
7585
  ] }),
6956
- /* @__PURE__ */ jsx7("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: executionReserveValue })
7586
+ /* @__PURE__ */ jsx11("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: executionReserveValue })
6957
7587
  ] }) : null
6958
7588
  ] }),
6959
- shouldShowSmartRouting ? /* @__PURE__ */ jsxs6(
7589
+ shouldShowSmartRouting ? /* @__PURE__ */ jsxs11(
6960
7590
  "div",
6961
7591
  {
6962
7592
  className: "agg-route-panel flex flex-col gap-3",
6963
7593
  "aria-busy": !isLimitOrder && isQuoteLoading,
6964
7594
  children: [
6965
- /* @__PURE__ */ jsxs6("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
6966
- /* @__PURE__ */ jsx7("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
6967
- shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs6(
7595
+ /* @__PURE__ */ jsxs11("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
7596
+ /* @__PURE__ */ jsx11("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
7597
+ shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ jsxs11(
6968
7598
  "button",
6969
7599
  {
6970
7600
  type: "button",
@@ -6972,8 +7602,8 @@ var PlaceOrder = ({
6972
7602
  "aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
6973
7603
  onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
6974
7604
  children: [
6975
- /* @__PURE__ */ jsx7("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
6976
- /* @__PURE__ */ jsx7(
7605
+ /* @__PURE__ */ jsx11("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
7606
+ /* @__PURE__ */ jsx11(
6977
7607
  Icon,
6978
7608
  {
6979
7609
  name: "chevron-down",
@@ -6986,11 +7616,11 @@ var PlaceOrder = ({
6986
7616
  }
6987
7617
  ) : null
6988
7618
  ] }),
6989
- /* @__PURE__ */ jsx7("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading && activeRouteCards.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
6990
- /* @__PURE__ */ jsx7(PlaceOrderRouteCardSkeleton, {}),
6991
- /* @__PURE__ */ jsx7(PlaceOrderRouteCardSkeleton, {})
7619
+ /* @__PURE__ */ jsx11("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading && activeRouteCards.length === 0 ? /* @__PURE__ */ jsxs11("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
7620
+ /* @__PURE__ */ jsx11(PlaceOrderRouteCardSkeleton, {}),
7621
+ /* @__PURE__ */ jsx11(PlaceOrderRouteCardSkeleton, {})
6992
7622
  ] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
6993
- return /* @__PURE__ */ jsx7(Fragment2, { children: renderRouteCard({
7623
+ return /* @__PURE__ */ jsx11(Fragment3, { children: renderRouteCard({
6994
7624
  card,
6995
7625
  enableAnimations,
6996
7626
  isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
@@ -7004,15 +7634,15 @@ var PlaceOrder = ({
7004
7634
  ]
7005
7635
  }
7006
7636
  ) : null,
7007
- isLimitOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-limit-expiration-section flex items-center justify-between gap-4", children: [
7008
- /* @__PURE__ */ jsx7("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.expiration }),
7009
- /* @__PURE__ */ jsxs6(
7637
+ isLimitOrder && (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) !== Venue5.prophetx ? /* @__PURE__ */ jsxs11("div", { className: "agg-limit-expiration-section flex items-center justify-between gap-4", children: [
7638
+ /* @__PURE__ */ jsx11("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.expiration }),
7639
+ /* @__PURE__ */ jsxs11(
7010
7640
  Popover.Root,
7011
7641
  {
7012
7642
  open: isLimitExpirationPickerOpen,
7013
7643
  onOpenChange: handleLimitExpirationPickerOpenChange,
7014
7644
  children: [
7015
- /* @__PURE__ */ jsx7(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
7645
+ /* @__PURE__ */ jsx11(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
7016
7646
  "button",
7017
7647
  {
7018
7648
  ref: expirationTriggerRef,
@@ -7020,10 +7650,10 @@ var PlaceOrder = ({
7020
7650
  className: "flex min-w-0 cursor-pointer items-center justify-end gap-2 text-right text-agg-base leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
7021
7651
  "aria-label": tradingLabels.expirationMenuAria,
7022
7652
  children: [
7023
- /* @__PURE__ */ jsx7("span", { className: "min-w-0 truncate", children: limitExpirationType === "GTC" ? tradingLabels.expirationGoodTilCanceled : limitExpirationType === "FIVE_MINUTES" ? tradingLabels.expirationFiveMinutes : limitExpirationType === "ONE_HOUR" ? tradingLabels.expirationOneHour : limitExpirationType === "END_OF_DAY" ? tradingLabels.expirationEndOfDay : resolvedCustomExpirationDate ? dayjs(resolvedCustomExpirationDate).format(
7653
+ /* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate", children: limitExpirationType === "GTC" ? tradingLabels.expirationGoodTilCanceled : limitExpirationType === "FIVE_MINUTES" ? tradingLabels.expirationFiveMinutes : limitExpirationType === "ONE_HOUR" ? tradingLabels.expirationOneHour : limitExpirationType === "END_OF_DAY" ? tradingLabels.expirationEndOfDay : resolvedCustomExpirationDate ? dayjs(resolvedCustomExpirationDate).format(
7024
7654
  "MMM D, YYYY [at] HH:mm"
7025
7655
  ) : tradingLabels.expirationCustom }),
7026
- /* @__PURE__ */ jsx7(
7656
+ /* @__PURE__ */ jsx11(
7027
7657
  Icon,
7028
7658
  {
7029
7659
  name: isLimitExpirationPickerOpen ? "chevron-up" : "chevron-down",
@@ -7035,11 +7665,11 @@ var PlaceOrder = ({
7035
7665
  ]
7036
7666
  }
7037
7667
  ) }),
7038
- /* @__PURE__ */ jsx7(
7668
+ /* @__PURE__ */ jsx11(
7039
7669
  Popover.Portal,
7040
7670
  {
7041
7671
  container: resolvePlaceOrderPortalContainer(expirationTriggerRef.current),
7042
- children: /* @__PURE__ */ jsx7(
7672
+ children: /* @__PURE__ */ jsx11(
7043
7673
  Popover.Content,
7044
7674
  {
7045
7675
  align: "end",
@@ -7048,14 +7678,14 @@ var PlaceOrder = ({
7048
7678
  role: "dialog",
7049
7679
  "aria-label": tradingLabels.expirationMenuAria,
7050
7680
  className: "z-50 max-h-[calc(100dvh-2rem)] w-[min(312px,calc(100vw-2rem))] overflow-y-auto rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-[0_8px_16px_rgba(0,0,0,0.20)]",
7051
- children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 p-4", children: [
7052
- /* @__PURE__ */ jsx7(
7681
+ children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-3 p-4", children: [
7682
+ /* @__PURE__ */ jsx11(
7053
7683
  Button,
7054
7684
  {
7055
7685
  variant: "tertiary",
7056
7686
  size: "small",
7057
7687
  className: "w-fit px-0",
7058
- prefix: /* @__PURE__ */ jsx7(
7688
+ prefix: /* @__PURE__ */ jsx11(
7059
7689
  Icon,
7060
7690
  {
7061
7691
  name: "chevron-left",
@@ -7068,7 +7698,7 @@ var PlaceOrder = ({
7068
7698
  children: tradingLabels.expirationOptions
7069
7699
  }
7070
7700
  ),
7071
- /* @__PURE__ */ jsx7(
7701
+ /* @__PURE__ */ jsx11(
7072
7702
  Calendar,
7073
7703
  {
7074
7704
  mode: "single",
@@ -7083,9 +7713,9 @@ var PlaceOrder = ({
7083
7713
  }
7084
7714
  }
7085
7715
  ),
7086
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-4", children: [
7087
- /* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 flex-col gap-0.5", children: [
7088
- /* @__PURE__ */ jsx7(
7716
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4", children: [
7717
+ /* @__PURE__ */ jsxs11("div", { className: "flex shrink-0 flex-col gap-0.5", children: [
7718
+ /* @__PURE__ */ jsx11(
7089
7719
  "label",
7090
7720
  {
7091
7721
  htmlFor: expirationTimeInputId,
@@ -7093,9 +7723,9 @@ var PlaceOrder = ({
7093
7723
  children: tradingLabels.expirationStartTime
7094
7724
  }
7095
7725
  ),
7096
- /* @__PURE__ */ jsx7("span", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.expirationStartTimeHint })
7726
+ /* @__PURE__ */ jsx11("span", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.expirationStartTimeHint })
7097
7727
  ] }),
7098
- /* @__PURE__ */ jsx7(
7728
+ /* @__PURE__ */ jsx11(
7099
7729
  "input",
7100
7730
  {
7101
7731
  id: expirationTimeInputId,
@@ -7106,8 +7736,8 @@ var PlaceOrder = ({
7106
7736
  }
7107
7737
  )
7108
7738
  ] }),
7109
- /* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
7110
- /* @__PURE__ */ jsx7(
7739
+ /* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
7740
+ /* @__PURE__ */ jsx11(
7111
7741
  Button,
7112
7742
  {
7113
7743
  variant: "secondary",
@@ -7117,13 +7747,13 @@ var PlaceOrder = ({
7117
7747
  children: tradingLabels.expirationCancel
7118
7748
  }
7119
7749
  ),
7120
- /* @__PURE__ */ jsx7(
7750
+ /* @__PURE__ */ jsx11(
7121
7751
  Button,
7122
7752
  {
7123
7753
  size: "small",
7124
7754
  className: "min-w-0 flex-1",
7125
7755
  disabled: !isLimitExpirationDraftValid,
7126
- prefix: /* @__PURE__ */ jsx7(
7756
+ prefix: /* @__PURE__ */ jsx11(
7127
7757
  Icon,
7128
7758
  {
7129
7759
  name: "success-check",
@@ -7137,7 +7767,7 @@ var PlaceOrder = ({
7137
7767
  }
7138
7768
  )
7139
7769
  ] })
7140
- ] }) : /* @__PURE__ */ jsx7(
7770
+ ] }) : /* @__PURE__ */ jsx11(
7141
7771
  "div",
7142
7772
  {
7143
7773
  role: "radiogroup",
@@ -7155,7 +7785,7 @@ var PlaceOrder = ({
7155
7785
  { value: "ONE_HOUR", label: tradingLabels.expirationOneHour },
7156
7786
  { value: "END_OF_DAY", label: tradingLabels.expirationEndOfDay },
7157
7787
  { value: "CUSTOM", label: tradingLabels.expirationCustom }
7158
- ].map((item, optionIndex) => /* @__PURE__ */ jsxs6(
7788
+ ].map((item, optionIndex) => /* @__PURE__ */ jsxs11(
7159
7789
  "button",
7160
7790
  {
7161
7791
  ref: (element) => {
@@ -7172,14 +7802,14 @@ var PlaceOrder = ({
7172
7802
  onClick: () => handleLimitExpirationTypeChange(item.value),
7173
7803
  onKeyDown: (event) => handleLimitExpirationOptionKeyDown(event, optionIndex),
7174
7804
  children: [
7175
- limitExpirationType === item.value ? /* @__PURE__ */ jsx7(
7805
+ limitExpirationType === item.value ? /* @__PURE__ */ jsx11(
7176
7806
  "span",
7177
7807
  {
7178
7808
  className: "absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
7179
7809
  "aria-hidden": true
7180
7810
  }
7181
7811
  ) : null,
7182
- /* @__PURE__ */ jsx7("span", { className: "truncate", children: item.label })
7812
+ /* @__PURE__ */ jsx11("span", { className: "truncate", children: item.label })
7183
7813
  ]
7184
7814
  },
7185
7815
  item.value
@@ -7194,12 +7824,12 @@ var PlaceOrder = ({
7194
7824
  }
7195
7825
  )
7196
7826
  ] }) : null,
7197
- hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
7198
- /* @__PURE__ */ jsxs6("div", { className: "agg-order-summary-meta flex flex-col", children: [
7199
- /* @__PURE__ */ jsx7("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
7200
- /* @__PURE__ */ jsx7("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
7827
+ hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ jsxs11("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
7828
+ /* @__PURE__ */ jsxs11("div", { className: "agg-order-summary-meta flex flex-col", children: [
7829
+ /* @__PURE__ */ jsx11("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
7830
+ /* @__PURE__ */ jsx11("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
7201
7831
  ] }),
7202
- /* @__PURE__ */ jsx7(
7832
+ /* @__PURE__ */ jsx11(
7203
7833
  NumberFlow,
7204
7834
  {
7205
7835
  value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
@@ -7214,7 +7844,7 @@ var PlaceOrder = ({
7214
7844
  }
7215
7845
  )
7216
7846
  ] }) : null,
7217
- /* @__PURE__ */ jsxs6(
7847
+ /* @__PURE__ */ jsxs11(
7218
7848
  "div",
7219
7849
  {
7220
7850
  className: cn(
@@ -7222,17 +7852,17 @@ var PlaceOrder = ({
7222
7852
  classNames == null ? void 0 : classNames.footer
7223
7853
  ),
7224
7854
  children: [
7225
- !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs6("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
7226
- submissionFeedback ? /* @__PURE__ */ jsx7(
7855
+ !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsxs11("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
7856
+ submissionFeedback ? /* @__PURE__ */ jsx11(
7227
7857
  InlineAlert,
7228
7858
  {
7229
7859
  tone: submissionFeedback.tone,
7230
7860
  message: submissionFeedback.message
7231
7861
  }
7232
7862
  ) : null,
7233
- !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx7(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
7234
- !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx7(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
7235
- !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx7(
7863
+ !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ jsx11(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
7864
+ !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ jsx11(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
7865
+ !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ jsx11(
7236
7866
  InlineAlert,
7237
7867
  {
7238
7868
  tone: "error",
@@ -7244,14 +7874,14 @@ var PlaceOrder = ({
7244
7874
  }
7245
7875
  ) : null
7246
7876
  ] }) : null,
7247
- !submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsSharedKycVerification && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ jsxs6(
7877
+ !submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsSharedKycVerification && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ jsxs11(
7248
7878
  "div",
7249
7879
  {
7250
7880
  className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
7251
7881
  role: "status",
7252
7882
  "aria-live": "polite",
7253
7883
  children: [
7254
- /* @__PURE__ */ jsx7(
7884
+ /* @__PURE__ */ jsx11(
7255
7885
  Icon,
7256
7886
  {
7257
7887
  name: "warning-filled",
@@ -7260,8 +7890,8 @@ var PlaceOrder = ({
7260
7890
  "aria-hidden": "true"
7261
7891
  }
7262
7892
  ),
7263
- /* @__PURE__ */ jsx7("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance }),
7264
- insufficientBalanceDetails ? /* @__PURE__ */ jsx7(
7893
+ /* @__PURE__ */ jsx11("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance }),
7894
+ insufficientBalanceDetails ? /* @__PURE__ */ jsx11(
7265
7895
  Tooltip,
7266
7896
  {
7267
7897
  "aria-label": tradingLabels.insufficientBalanceDetails,
@@ -7277,7 +7907,7 @@ var PlaceOrder = ({
7277
7907
  ]
7278
7908
  }
7279
7909
  ) : null,
7280
- !submissionFeedback && !shouldShowGeoBlockBanner && needsSharedKycVerification ? /* @__PURE__ */ jsx7(
7910
+ !submissionFeedback && !shouldShowGeoBlockBanner && needsSharedKycVerification ? /* @__PURE__ */ jsx11(
7281
7911
  Button,
7282
7912
  {
7283
7913
  size: "large",
@@ -7291,7 +7921,24 @@ var PlaceOrder = ({
7291
7921
  },
7292
7922
  children: sharedKyc.status === "loading" ? tradingLabels.sharedKyc.checkingStatus : tradingLabels.sharedKyc.completeToTrade
7293
7923
  }
7294
- ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */ jsx7(
7924
+ ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsProphetxConnection ? /* @__PURE__ */ jsx11(
7925
+ Button,
7926
+ {
7927
+ size: "large",
7928
+ className: "h-12 w-full",
7929
+ onClick: () => setIsConnectProphetxModalOpen(true),
7930
+ children: tradingLabels.connectProphetx
7931
+ }
7932
+ ) : !submissionFeedback && isProphetxDirectRoute && isSell ? /* @__PURE__ */ jsx11(Button, { size: "large", className: "h-12 w-full", disabled: true, children: tradingLabels.prophetxSettlementNotice }) : !submissionFeedback && !shouldShowGeoBlockBanner && isProphetxBalanceInsufficient ? /* @__PURE__ */ jsx11(
7933
+ "a",
7934
+ {
7935
+ className: "flex h-12 w-full items-center justify-center rounded-agg-md bg-agg-primary text-agg-on-primary",
7936
+ href: "https://www.prophetx.co",
7937
+ target: "_blank",
7938
+ rel: "noopener noreferrer",
7939
+ children: tradingLabels.prophetxFundingNotice
7940
+ }
7941
+ ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */ jsx11(
7295
7942
  Button,
7296
7943
  {
7297
7944
  size: "large",
@@ -7301,17 +7948,17 @@ var PlaceOrder = ({
7301
7948
  onClick: () => setIsConnectKalshiModalOpen(true),
7302
7949
  children: tradingLabels.connectKalshi
7303
7950
  }
7304
- ) : !submissionFeedback && !shouldShowGeoBlockBanner && isInsufficientBalance ? /* @__PURE__ */ jsx7(
7951
+ ) : !submissionFeedback && !shouldShowGeoBlockBanner && (isInsufficientBalance || needsBetdexAccount) ? /* @__PURE__ */ jsx11(
7305
7952
  Button,
7306
7953
  {
7307
7954
  size: "large",
7308
7955
  variant: "primary",
7309
7956
  className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
7310
- "aria-label": isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : tradingLabels.deposit,
7957
+ "aria-label": isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : needsBetdexAccount ? tradingLabels.manageBetdexAccount : tradingLabels.deposit,
7311
7958
  onClick: handleDepositRequiredClick,
7312
- children: isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : tradingLabels.deposit
7959
+ children: isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : needsBetdexAccount ? tradingLabels.manageBetdexAccount : tradingLabels.deposit
7313
7960
  }
7314
- ) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ jsx7(
7961
+ ) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ jsx11(
7315
7962
  Button,
7316
7963
  {
7317
7964
  size: "large",
@@ -7320,7 +7967,7 @@ var PlaceOrder = ({
7320
7967
  disabled: true,
7321
7968
  "aria-live": "polite",
7322
7969
  "aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
7323
- prefix: /* @__PURE__ */ jsx7(
7970
+ prefix: /* @__PURE__ */ jsx11(
7324
7971
  "span",
7325
7972
  {
7326
7973
  className: cn(
@@ -7332,7 +7979,7 @@ var PlaceOrder = ({
7332
7979
  ),
7333
7980
  children: routeLoadingMessage
7334
7981
  }
7335
- ) : !isAuthenticated ? /* @__PURE__ */ jsx7(
7982
+ ) : !isAuthenticated ? /* @__PURE__ */ jsx11(
7336
7983
  Button,
7337
7984
  {
7338
7985
  size: "large",
@@ -7343,7 +7990,7 @@ var PlaceOrder = ({
7343
7990
  onClick: requestAggAuthChooserOpen,
7344
7991
  children: tradingLabels.signInToTrade
7345
7992
  }
7346
- ) : /* @__PURE__ */ jsx7(
7993
+ ) : /* @__PURE__ */ jsx11(
7347
7994
  Button,
7348
7995
  {
7349
7996
  size: "large",
@@ -7358,8 +8005,8 @@ var PlaceOrder = ({
7358
8005
  children: actionLabel
7359
8006
  }
7360
8007
  ),
7361
- !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ jsxs6("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: [
7362
- /* @__PURE__ */ jsx7(
8008
+ !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ jsxs11("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: [
8009
+ /* @__PURE__ */ jsx11(
7363
8010
  Icon,
7364
8011
  {
7365
8012
  name: "shield-trust",
@@ -7368,10 +8015,10 @@ var PlaceOrder = ({
7368
8015
  "aria-hidden": "true"
7369
8016
  }
7370
8017
  ),
7371
- /* @__PURE__ */ jsx7(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
8018
+ /* @__PURE__ */ jsx11(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
7372
8019
  ] }) : null,
7373
- shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
7374
- !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx7("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
8020
+ shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx11(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
8021
+ !shouldShowGeoBlockBanner ? /* @__PURE__ */ jsx11("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
7375
8022
  ]
7376
8023
  }
7377
8024
  )
@@ -7379,7 +8026,7 @@ var PlaceOrder = ({
7379
8026
  ]
7380
8027
  }
7381
8028
  ),
7382
- /* @__PURE__ */ jsx7(
8029
+ /* @__PURE__ */ jsx11(
7383
8030
  SharedKycModal,
7384
8031
  {
7385
8032
  open: sharedKycFlow.isModalOpen,
@@ -7393,7 +8040,45 @@ var PlaceOrder = ({
7393
8040
  }
7394
8041
  }
7395
8042
  ),
7396
- /* @__PURE__ */ jsx7(
8043
+ isAuthenticated && !isPaperMode && ((prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) || (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory)) ? /* @__PURE__ */ jsx11(
8044
+ "button",
8045
+ {
8046
+ type: "button",
8047
+ className: "cursor-pointer text-agg-sm text-agg-primary underline",
8048
+ onClick: () => setIsConnectProphetxModalOpen(true),
8049
+ children: tradingLabels.manageProphetx
8050
+ }
8051
+ ) : null,
8052
+ isAuthenticated && isProphetxDirect && canConnectProphetx && !needsProphetxConnection && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.connected) && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory) ? /* @__PURE__ */ jsx11(
8053
+ "button",
8054
+ {
8055
+ type: "button",
8056
+ className: "cursor-pointer text-agg-sm text-agg-primary underline",
8057
+ onClick: () => setIsConnectProphetxModalOpen(true),
8058
+ children: tradingLabels.connectProphetx
8059
+ }
8060
+ ) : null,
8061
+ /* @__PURE__ */ jsx11(
8062
+ ConnectProphetxModal,
8063
+ {
8064
+ allowExistingConnection: Boolean(
8065
+ (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) || (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory)
8066
+ ),
8067
+ onDisconnect: (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) ? () => __async(null, null, function* () {
8068
+ yield aggClient.deleteVenueKey(Venue5.prophetx);
8069
+ yield refetchProphetxKeyStatus();
8070
+ yield queryClient.invalidateQueries({ queryKey: ["agg"] });
8071
+ }) : void 0,
8072
+ open: isConnectProphetxModalOpen,
8073
+ onOpenChange: setIsConnectProphetxModalOpen,
8074
+ onVerify: (credentials) => __async(null, null, function* () {
8075
+ yield aggClient.upsertVenueKey({ venue: Venue5.prophetx, credentials });
8076
+ yield refetchProphetxKeyStatus();
8077
+ yield queryClient.invalidateQueries({ queryKey: ["agg"] });
8078
+ })
8079
+ }
8080
+ ),
8081
+ /* @__PURE__ */ jsx11(
7397
8082
  ConnectKalshiModal,
7398
8083
  {
7399
8084
  open: isConnectKalshiModalOpen,
@@ -7401,7 +8086,14 @@ var PlaceOrder = ({
7401
8086
  onVerify: handleVerifyKalshi
7402
8087
  }
7403
8088
  ),
7404
- /* @__PURE__ */ jsx7(FundKalshiModal, { open: isFundKalshiModalOpen, onOpenChange: setIsFundKalshiModalOpen })
8089
+ /* @__PURE__ */ jsx11(FundKalshiModal, { open: isFundKalshiModalOpen, onOpenChange: setIsFundKalshiModalOpen }),
8090
+ /* @__PURE__ */ jsx11(
8091
+ ManageBetdexAccountModal,
8092
+ {
8093
+ open: isBetdexAccountModalOpen,
8094
+ onOpenChange: setIsBetdexAccountModalOpen
8095
+ }
8096
+ )
7405
8097
  ] });
7406
8098
  };
7407
8099
  PlaceOrder.displayName = "PlaceOrder";
@@ -7412,28 +8104,28 @@ import {
7412
8104
  invalidateBalanceQueries as invalidateBalanceQueries2,
7413
8105
  invalidatePositionQueries as invalidatePositionQueries2,
7414
8106
  invalidateUserActivityQueries,
7415
- useLabels as useLabels3,
8107
+ useLabels as useLabels8,
7416
8108
  useQueryClient as useQueryClient2,
7417
8109
  useRedeem,
7418
8110
  useRedeemLifecycles
7419
8111
  } from "@agg-build/hooks";
7420
- import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef5, useState as useState4 } from "react";
8112
+ import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef5, useState as useState7 } from "react";
7421
8113
  var toClaimError = (err) => {
7422
8114
  if (err instanceof Error) return err;
7423
8115
  return new Error(String(err));
7424
8116
  };
7425
8117
  function useClaimWinnings(options = {}) {
7426
8118
  const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
7427
- const labels = useLabels3();
8119
+ const labels = useLabels8();
7428
8120
  const claimNotificationLabels = labels.notifications.claim;
7429
8121
  const toastCtx = useOptionalToast();
7430
8122
  const queryClient = useQueryClient2();
7431
8123
  const redeemMutation = useRedeem();
7432
- const [activeRedeems, setActiveRedeems] = useState4({});
8124
+ const [activeRedeems, setActiveRedeems] = useState7({});
7433
8125
  const activeClaimKeysRef = useRef5(/* @__PURE__ */ new Set());
7434
8126
  const pendingClaimToastIdsRef = useRef5({});
7435
8127
  const submittedClaimToastKeysRef = useRef5(/* @__PURE__ */ new Set());
7436
- const [submittingClaimKeys, setSubmittingClaimKeys] = useState4({});
8128
+ const [submittingClaimKeys, setSubmittingClaimKeys] = useState7({});
7437
8129
  const lifecycleInputs = useMemo2(
7438
8130
  () => Object.values(activeRedeems),
7439
8131
  [activeRedeems]
@@ -7731,17 +8423,18 @@ function useResolvedMarketClaim(options = {}) {
7731
8423
 
7732
8424
  export {
7733
8425
  AggNotificationEventsProvider,
8426
+ DEPOSIT_MODAL_OPEN_EVENT,
8427
+ WITHDRAW_MODAL_OPEN_EVENT,
8428
+ requestAggDepositModalOpen,
8429
+ requestAggWithdrawModalOpen,
7734
8430
  parseVenue,
7735
8431
  parseAmount,
7736
8432
  SettlementDetails,
7737
8433
  venueRequiresSharedKyc,
7738
8434
  createAggClientSharedKycInitiator,
7739
8435
  useSharedKycFlow,
7740
- DEPOSIT_MODAL_OPEN_EVENT,
7741
- WITHDRAW_MODAL_OPEN_EVENT,
7742
- requestAggDepositModalOpen,
7743
- requestAggWithdrawModalOpen,
7744
8436
  FundKalshiModal,
8437
+ BetdexAccountCard,
7745
8438
  formatChainIdLabel,
7746
8439
  PlaceOrderExecutionHeader,
7747
8440
  PlaceOrderExecutionGroups,