@agg-build/ui 2.8.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/{chunk-AKLGQ6AB.mjs → chunk-JTSLZARU.mjs} +50 -250
  2. package/dist/{chunk-2QCNDFNC.mjs → chunk-R362GNI2.mjs} +1120 -400
  3. package/dist/{chunk-R5S2QOYL.mjs → chunk-XIDQ2A6W.mjs} +152 -59
  4. package/dist/index.js +1764 -1155
  5. package/dist/index.mjs +5 -3
  6. package/dist/modals.js +391 -845
  7. package/dist/modals.mjs +1 -1
  8. package/dist/pages.js +1724 -916
  9. package/dist/pages.mjs +4 -2
  10. package/dist/styles.css +1 -1
  11. package/dist/tailwind.css +1 -1
  12. package/dist/trading.js +567 -472
  13. package/dist/trading.mjs +1 -1
  14. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -1
  15. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -1
  16. package/dist/types/pages/user-profile/components/manage-balances-modal.d.mts +8 -0
  17. package/dist/types/pages/user-profile/components/manage-balances-modal.d.ts +8 -0
  18. package/dist/types/pages/user-profile/index.d.mts +1 -0
  19. package/dist/types/pages/user-profile/index.d.ts +1 -0
  20. package/dist/types/profile/profile-modal.constants.d.mts +1 -2
  21. package/dist/types/profile/profile-modal.constants.d.ts +1 -2
  22. package/dist/types/trading/place-order/index.place-order.constants.d.mts +1 -0
  23. package/dist/types/trading/place-order/index.place-order.constants.d.ts +1 -0
  24. package/dist/types/trading/place-order/index.place-order.types.d.mts +4 -0
  25. package/dist/types/trading/place-order/index.place-order.types.d.ts +4 -0
  26. package/dist/types/trading/place-order/index.place-order.utils.d.mts +7 -3
  27. package/dist/types/trading/place-order/index.place-order.utils.d.ts +7 -3
  28. package/package.json +3 -3
  29. package/dist/types/profile/tabs/balance-management-tab.d.mts +0 -3
  30. package/dist/types/profile/tabs/balance-management-tab.d.ts +0 -3
package/dist/pages.js CHANGED
@@ -85,6 +85,7 @@ __export(pages_exports, {
85
85
  DEPOSIT_MODAL_OPEN_EVENT: () => DEPOSIT_MODAL_OPEN_EVENT,
86
86
  EventMarketPage: () => EventMarketPage,
87
87
  HomePage: () => HomePage,
88
+ ManageBalancesModal: () => ManageBalancesModal,
88
89
  USER_PROFILE_TAB_ACTIVITY: () => USER_PROFILE_TAB_ACTIVITY,
89
90
  USER_PROFILE_TAB_OPEN_ORDERS: () => USER_PROFILE_TAB_OPEN_ORDERS,
90
91
  USER_PROFILE_TAB_POSITIONS: () => USER_PROFILE_TAB_POSITIONS,
@@ -16640,9 +16641,101 @@ var GeoBlockBanner = ({
16640
16641
  };
16641
16642
  GeoBlockBanner.displayName = "GeoBlockBanner";
16642
16643
 
16644
+ // src/notifications/agg-notification-events-provider.tsx
16645
+ var import_hooks53 = require("@agg-build/hooks");
16646
+ var import_react28 = require("react");
16647
+ var import_jsx_runtime148 = require("react/jsx-runtime");
16648
+ var firedOrderNotificationKeys = /* @__PURE__ */ new Set();
16649
+ var MICRO_UNITS_SCALE = 1e6;
16650
+ var formatScaledMicroAmount = (value) => {
16651
+ if (!value) return void 0;
16652
+ if (value.includes(".")) {
16653
+ const parsed = Number(value);
16654
+ if (!Number.isFinite(parsed)) return void 0;
16655
+ return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
16656
+ }
16657
+ try {
16658
+ const raw = BigInt(value);
16659
+ const whole = raw / BigInt(MICRO_UNITS_SCALE);
16660
+ const remainder = raw % BigInt(MICRO_UNITS_SCALE);
16661
+ const parsed = Number(whole) + Number(remainder) / MICRO_UNITS_SCALE;
16662
+ return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
16663
+ } catch (e) {
16664
+ const parsed = Number(value);
16665
+ if (!Number.isFinite(parsed)) return void 0;
16666
+ return (parsed / MICRO_UNITS_SCALE).toLocaleString("en-US", { maximumFractionDigits: 2 });
16667
+ }
16668
+ };
16669
+ var formatPriceCents = (value) => {
16670
+ if (!value) return void 0;
16671
+ const parsed = Number(value);
16672
+ if (!Number.isFinite(parsed)) return void 0;
16673
+ const cents = parsed * 100;
16674
+ const display2 = cents.toLocaleString("en-US", {
16675
+ minimumFractionDigits: 0,
16676
+ maximumFractionDigits: 1
16677
+ });
16678
+ return `${display2}\xA2`;
16679
+ };
16680
+ var formatSharesLabel = (raw) => {
16681
+ const formatted = formatScaledMicroAmount(raw);
16682
+ if (!formatted) return void 0;
16683
+ return `${formatted} shares`;
16684
+ };
16685
+ var capitalize = (value) => {
16686
+ if (!value) return void 0;
16687
+ return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
16688
+ };
16689
+ var venueLabelFor = (venueKey, labels) => {
16690
+ var _a;
16691
+ if (!venueKey) return void 0;
16692
+ const normalized = venueKey.toLowerCase();
16693
+ const lookup = labels.venues;
16694
+ return (_a = lookup[normalized]) != null ? _a : capitalize(venueKey);
16695
+ };
16696
+ function handleOrderEvent({ event, labels, fireOnce }) {
16697
+ var _a, _b;
16698
+ const venueLabel = venueLabelFor(event.venue, labels);
16699
+ const amountLabel = formatSharesLabel((_a = event.actualSharesRaw) != null ? _a : event.filledAmountRaw);
16700
+ const priceLabel = formatPriceCents((_b = event.executionPriceRaw) != null ? _b : event.quotedPriceRaw);
16701
+ const fireOrderOnce = (key, tone, title2, message, detail) => {
16702
+ if (firedOrderNotificationKeys.has(key)) return;
16703
+ firedOrderNotificationKeys.add(key);
16704
+ fireOnce(key, tone, title2, message, detail);
16705
+ };
16706
+ if (event.event === "filled") {
16707
+ fireOrderOnce(
16708
+ `order:${event.orderId}:filled`,
16709
+ "success",
16710
+ labels.notifications.order.filledTitle,
16711
+ labels.notifications.order.filledMessage({ venueLabel, amountLabel, priceLabel })
16712
+ );
16713
+ return;
16714
+ }
16715
+ if (event.event === "partial_fill") {
16716
+ fireOrderOnce(
16717
+ `order:${event.orderId}:partial_fill`,
16718
+ "warning",
16719
+ labels.notifications.order.partialFilledTitle,
16720
+ labels.notifications.order.partialFilledMessage({ venueLabel, amountLabel, priceLabel })
16721
+ );
16722
+ return;
16723
+ }
16724
+ if (event.event === "failed") {
16725
+ fireOrderOnce(
16726
+ `order:${event.orderId}:failed`,
16727
+ "error",
16728
+ labels.notifications.order.failedTitle,
16729
+ labels.notifications.order.failedMessage(event.errorReason),
16730
+ venueLabel
16731
+ );
16732
+ }
16733
+ }
16734
+ var CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS = 2 * 60 * 1e3;
16735
+
16643
16736
  // src/onboarding/index.tsx
16644
- var import_react32 = require("react");
16645
- var import_hooks58 = require("@agg-build/hooks");
16737
+ var import_react33 = require("react");
16738
+ var import_hooks59 = require("@agg-build/hooks");
16646
16739
  var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
16647
16740
 
16648
16741
  // src/onboarding/onboarding-modal.constants.ts
@@ -16665,30 +16758,30 @@ var ONCHAIN_VENUES = [
16665
16758
  ].filter(import_sdk18.isVenueActive);
16666
16759
 
16667
16760
  // src/onboarding/steps/how-it-works.tsx
16668
- var import_react28 = require("react");
16669
- var import_hooks53 = require("@agg-build/hooks");
16670
- var import_jsx_runtime148 = require("react/jsx-runtime");
16761
+ var import_react29 = require("react");
16762
+ var import_hooks54 = require("@agg-build/hooks");
16763
+ var import_jsx_runtime149 = require("react/jsx-runtime");
16671
16764
  var defaultIcons = {
16672
- createAccount: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
16673
- linkAccounts: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
16674
- bestPrices: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
16675
- stayInControl: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
16765
+ createAccount: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
16766
+ linkAccounts: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
16767
+ bestPrices: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
16768
+ stayInControl: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
16676
16769
  };
16677
16770
  var HowItWorksStep = ({ onContinue, icons }) => {
16678
- const labels = (0, import_hooks53.useLabels)();
16679
- const scrollRef = (0, import_react28.useRef)(null);
16680
- const [showTopGradient, setShowTopGradient] = (0, import_react28.useState)(false);
16681
- const [showBottomGradient, setShowBottomGradient] = (0, import_react28.useState)(true);
16682
- const handleScroll = (0, import_react28.useCallback)(() => {
16771
+ const labels = (0, import_hooks54.useLabels)();
16772
+ const scrollRef = (0, import_react29.useRef)(null);
16773
+ const [showTopGradient, setShowTopGradient] = (0, import_react29.useState)(false);
16774
+ const [showBottomGradient, setShowBottomGradient] = (0, import_react29.useState)(true);
16775
+ const handleScroll = (0, import_react29.useCallback)(() => {
16683
16776
  const el = scrollRef.current;
16684
16777
  if (!el) return;
16685
16778
  setShowTopGradient(el.scrollTop > 0);
16686
16779
  setShowBottomGradient(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
16687
16780
  }, []);
16688
- return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
16689
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
16690
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
16691
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
16781
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
16782
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
16783
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
16784
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16692
16785
  "div",
16693
16786
  {
16694
16787
  ref: scrollRef,
@@ -16698,7 +16791,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
16698
16791
  var _a;
16699
16792
  const icon = (_a = icons == null ? void 0 : icons[featureKey]) != null ? _a : defaultIcons[featureKey];
16700
16793
  const feature = labels.onboarding.howItWorks.features[featureKey];
16701
- return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
16794
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
16702
16795
  "div",
16703
16796
  {
16704
16797
  className: cn(
@@ -16707,11 +16800,11 @@ var HowItWorksStep = ({ onContinue, icons }) => {
16707
16800
  "bg-agg-secondary-hover"
16708
16801
  ),
16709
16802
  children: [
16710
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
16711
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
16712
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
16803
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
16804
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
16805
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
16713
16806
  ] }),
16714
- icon ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
16807
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
16715
16808
  ]
16716
16809
  },
16717
16810
  featureKey
@@ -16719,7 +16812,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
16719
16812
  })
16720
16813
  }
16721
16814
  ),
16722
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
16815
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16723
16816
  "div",
16724
16817
  {
16725
16818
  className: cn(
@@ -16730,7 +16823,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
16730
16823
  )
16731
16824
  }
16732
16825
  ),
16733
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
16826
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16734
16827
  "div",
16735
16828
  {
16736
16829
  className: cn(
@@ -16742,26 +16835,26 @@ var HowItWorksStep = ({ onContinue, icons }) => {
16742
16835
  }
16743
16836
  )
16744
16837
  ] }),
16745
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
16838
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
16746
16839
  ] });
16747
16840
  };
16748
16841
  HowItWorksStep.displayName = "HowItWorksStep";
16749
16842
 
16750
16843
  // src/onboarding/steps/profile-setup.tsx
16751
- var import_react29 = require("react");
16752
- var import_hooks54 = require("@agg-build/hooks");
16753
- var import_jsx_runtime149 = require("react/jsx-runtime");
16844
+ var import_react30 = require("react");
16845
+ var import_hooks55 = require("@agg-build/hooks");
16846
+ var import_jsx_runtime150 = require("react/jsx-runtime");
16754
16847
  var ProfileSetupStep = ({ onContinue }) => {
16755
- const labels = (0, import_hooks54.useLabels)();
16756
- const [username, setUsername] = (0, import_react29.useState)("");
16757
- const [avatarFile, setAvatarFile] = (0, import_react29.useState)();
16758
- const [avatarPreview, setAvatarPreview] = (0, import_react29.useState)();
16759
- const fileInputRef = (0, import_react29.useRef)(null);
16760
- const handleAvatarClick = (0, import_react29.useCallback)(() => {
16848
+ const labels = (0, import_hooks55.useLabels)();
16849
+ const [username, setUsername] = (0, import_react30.useState)("");
16850
+ const [avatarFile, setAvatarFile] = (0, import_react30.useState)();
16851
+ const [avatarPreview, setAvatarPreview] = (0, import_react30.useState)();
16852
+ const fileInputRef = (0, import_react30.useRef)(null);
16853
+ const handleAvatarClick = (0, import_react30.useCallback)(() => {
16761
16854
  var _a;
16762
16855
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
16763
16856
  }, []);
16764
- const handleFileChange = (0, import_react29.useCallback)((e) => {
16857
+ const handleFileChange = (0, import_react30.useCallback)((e) => {
16765
16858
  var _a;
16766
16859
  const file = (_a = e.target.files) == null ? void 0 : _a[0];
16767
16860
  if (!file) return;
@@ -16773,18 +16866,18 @@ var ProfileSetupStep = ({ onContinue }) => {
16773
16866
  };
16774
16867
  reader.readAsDataURL(file);
16775
16868
  }, []);
16776
- const handleContinue = (0, import_react29.useCallback)(() => {
16869
+ const handleContinue = (0, import_react30.useCallback)(() => {
16777
16870
  onContinue({
16778
16871
  username,
16779
16872
  avatarFile,
16780
16873
  avatarPreview
16781
16874
  });
16782
16875
  }, [username, avatarFile, avatarPreview, onContinue]);
16783
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col gap-7", children: [
16784
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
16785
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col gap-5 items-center w-full", children: [
16786
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex justify-center", children: [
16787
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
16876
+ return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-7", children: [
16877
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
16878
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-5 items-center w-full", children: [
16879
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex justify-center", children: [
16880
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(
16788
16881
  "button",
16789
16882
  {
16790
16883
  type: "button",
@@ -16800,13 +16893,13 @@ var ProfileSetupStep = ({ onContinue }) => {
16800
16893
  ),
16801
16894
  "aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
16802
16895
  children: [
16803
- !avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16896
+ !avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16804
16897
  "svg",
16805
16898
  {
16806
16899
  "aria-hidden": true,
16807
16900
  viewBox: "0 0 80 80",
16808
16901
  className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
16809
- children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16902
+ children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16810
16903
  "circle",
16811
16904
  {
16812
16905
  cx: "40",
@@ -16820,18 +16913,18 @@ var ProfileSetupStep = ({ onContinue }) => {
16820
16913
  )
16821
16914
  }
16822
16915
  ) : null,
16823
- avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16916
+ avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16824
16917
  RemoteImage,
16825
16918
  {
16826
16919
  src: avatarPreview,
16827
16920
  alt: labels.onboarding.profileSetup.profilePreviewAlt,
16828
16921
  className: "h-full w-full object-cover"
16829
16922
  }
16830
- ) : /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
16923
+ ) : /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
16831
16924
  ]
16832
16925
  }
16833
16926
  ),
16834
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16927
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16835
16928
  "input",
16836
16929
  {
16837
16930
  ref: fileInputRef,
@@ -16843,8 +16936,8 @@ var ProfileSetupStep = ({ onContinue }) => {
16843
16936
  }
16844
16937
  )
16845
16938
  ] }),
16846
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex flex-col gap-2 w-full", children: [
16847
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16939
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-2 w-full", children: [
16940
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16848
16941
  "label",
16849
16942
  {
16850
16943
  htmlFor: "onboarding-username",
@@ -16852,7 +16945,7 @@ var ProfileSetupStep = ({ onContinue }) => {
16852
16945
  children: labels.onboarding.profileSetup.usernameLabel
16853
16946
  }
16854
16947
  ),
16855
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16948
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16856
16949
  "input",
16857
16950
  {
16858
16951
  id: "onboarding-username",
@@ -16876,16 +16969,16 @@ var ProfileSetupStep = ({ onContinue }) => {
16876
16969
  )
16877
16970
  ] })
16878
16971
  ] }),
16879
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
16972
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
16880
16973
  ] });
16881
16974
  };
16882
16975
  ProfileSetupStep.displayName = "ProfileSetupStep";
16883
16976
 
16884
16977
  // src/onboarding/steps/connect-accounts.tsx
16885
- var import_hooks55 = require("@agg-build/hooks");
16886
- var import_jsx_runtime150 = require("react/jsx-runtime");
16978
+ var import_hooks56 = require("@agg-build/hooks");
16979
+ var import_jsx_runtime151 = require("react/jsx-runtime");
16887
16980
  var OnchainVenueLogos = () => {
16888
- return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
16981
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
16889
16982
  };
16890
16983
  var VenueCard = ({
16891
16984
  logos,
@@ -16896,8 +16989,8 @@ var VenueCard = ({
16896
16989
  onConnect,
16897
16990
  connected = false
16898
16991
  }) => {
16899
- const labels = (0, import_hooks55.useLabels)();
16900
- const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
16992
+ const labels = (0, import_hooks56.useLabels)();
16993
+ const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16901
16994
  Button,
16902
16995
  {
16903
16996
  variant: "tertiary",
@@ -16907,18 +17000,18 @@ var VenueCard = ({
16907
17000
  children: labels.onboarding.connectAccounts.connect
16908
17001
  }
16909
17002
  );
16910
- const mobileAction = connected ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
17003
+ const mobileAction = connected ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16911
17004
  Button,
16912
17005
  {
16913
17006
  variant: "tertiary",
16914
17007
  size: "medium",
16915
17008
  className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
16916
17009
  onClick: onConnect,
16917
- suffix: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(ChevronRightIcon, { className: "h-4 w-4" }),
17010
+ suffix: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ChevronRightIcon, { className: "h-4 w-4" }),
16918
17011
  children: labels.onboarding.connectAccounts.connectAccount
16919
17012
  }
16920
17013
  );
16921
- return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(
17014
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
16922
17015
  "div",
16923
17016
  {
16924
17017
  className: cn(
@@ -16926,23 +17019,23 @@ var VenueCard = ({
16926
17019
  connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"
16927
17020
  ),
16928
17021
  children: [
16929
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "hidden sm:flex items-center justify-between", children: [
16930
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex items-center gap-5", children: [
16931
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "shrink-0", children: logos }),
16932
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-[2px]", children: [
16933
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title2 }),
16934
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-sm text-agg-foreground", children: description })
17022
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "hidden sm:flex items-center justify-between", children: [
17023
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-5", children: [
17024
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "shrink-0", children: logos }),
17025
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-[2px]", children: [
17026
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title2 }),
17027
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-sm text-agg-foreground", children: description })
16935
17028
  ] })
16936
17029
  ] }),
16937
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "shrink-0", children: action })
17030
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "shrink-0", children: action })
16938
17031
  ] }),
16939
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-3 sm:hidden", children: [
16940
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-3", children: [
16941
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "shrink-0", children: logos }),
16942
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title2 })
17032
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-3 sm:hidden", children: [
17033
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-3", children: [
17034
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "shrink-0", children: logos }),
17035
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title2 })
16943
17036
  ] }),
16944
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col items-start gap-2", children: [
16945
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
17037
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col items-start gap-2", children: [
17038
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
16946
17039
  mobileAction
16947
17040
  ] })
16948
17041
  ] })
@@ -16955,14 +17048,14 @@ var ConnectAccountsStep = ({
16955
17048
  onContinue,
16956
17049
  connectedOnchain = false
16957
17050
  }) => {
16958
- const labels = (0, import_hooks55.useLabels)();
17051
+ const labels = (0, import_hooks56.useLabels)();
16959
17052
  const canContinue = connectedOnchain;
16960
- return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-6", children: [
16961
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
16962
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
17053
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-6", children: [
17054
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
17055
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16963
17056
  VenueCard,
16964
17057
  {
16965
- logos: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(OnchainVenueLogos, {}),
17058
+ logos: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(OnchainVenueLogos, {}),
16966
17059
  title: labels.onboarding.connectAccounts.onchainTitle,
16967
17060
  mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
16968
17061
  ONCHAIN_VENUES.length - 1
@@ -16973,7 +17066,7 @@ var ConnectAccountsStep = ({
16973
17066
  connected: connectedOnchain
16974
17067
  }
16975
17068
  ) }),
16976
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
17069
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16977
17070
  Button,
16978
17071
  {
16979
17072
  variant: "primary",
@@ -16989,22 +17082,22 @@ var ConnectAccountsStep = ({
16989
17082
  ConnectAccountsStep.displayName = "ConnectAccountsStep";
16990
17083
 
16991
17084
  // src/onboarding/steps/connect-onchain-modal.tsx
16992
- var import_react30 = require("react");
16993
- var import_hooks56 = require("@agg-build/hooks");
17085
+ var import_react31 = require("react");
17086
+ var import_hooks57 = require("@agg-build/hooks");
16994
17087
  var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
16995
- var import_jsx_runtime151 = require("react/jsx-runtime");
17088
+ var import_jsx_runtime152 = require("react/jsx-runtime");
16996
17089
  var ConnectOnchainModal = ({
16997
17090
  open,
16998
17091
  onOpenChange,
16999
17092
  onConnect
17000
17093
  }) => {
17001
- const labels = (0, import_hooks56.useLabels)();
17002
- const [connecting, setConnecting] = (0, import_react30.useState)(false);
17003
- const [error, setError] = (0, import_react30.useState)();
17004
- const handleCancel = (0, import_react30.useCallback)(() => {
17094
+ const labels = (0, import_hooks57.useLabels)();
17095
+ const [connecting, setConnecting] = (0, import_react31.useState)(false);
17096
+ const [error, setError] = (0, import_react31.useState)();
17097
+ const handleCancel = (0, import_react31.useCallback)(() => {
17005
17098
  onOpenChange(false);
17006
17099
  }, [onOpenChange]);
17007
- const handleConnect = (0, import_react30.useCallback)(() => __async(null, null, function* () {
17100
+ const handleConnect = (0, import_react31.useCallback)(() => __async(null, null, function* () {
17008
17101
  if (connecting) return;
17009
17102
  setConnecting(true);
17010
17103
  setError(void 0);
@@ -17019,7 +17112,7 @@ var ConnectOnchainModal = ({
17019
17112
  setConnecting(false);
17020
17113
  }
17021
17114
  }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
17022
- const handleOpenChange = (0, import_react30.useCallback)(
17115
+ const handleOpenChange = (0, import_react31.useCallback)(
17023
17116
  (value) => {
17024
17117
  if (value) {
17025
17118
  setError(void 0);
@@ -17029,15 +17122,15 @@ var ConnectOnchainModal = ({
17029
17122
  },
17030
17123
  [onOpenChange]
17031
17124
  );
17032
- return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
17125
+ return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17033
17126
  Modal.Container,
17034
17127
  {
17035
17128
  maxWidth: "600px",
17036
17129
  "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
17037
17130
  classNames: { container: "!rounded-agg-lg" },
17038
17131
  children: [
17039
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Dialog3.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
17040
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17132
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Dialog3.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
17133
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17041
17134
  Modal.Header,
17042
17135
  {
17043
17136
  hideClose: false,
@@ -17048,26 +17141,26 @@ var ConnectOnchainModal = ({
17048
17141
  }
17049
17142
  }
17050
17143
  ),
17051
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
17052
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
17053
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
17054
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
17144
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
17145
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
17146
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
17147
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
17055
17148
  ] }),
17056
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
17057
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
17058
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
17059
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
17060
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(VenueLogo, { venue, size: "medium" }),
17061
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
17149
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
17150
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
17151
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
17152
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
17153
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VenueLogo, { venue, size: "medium" }),
17154
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
17062
17155
  ] }, venue)) })
17063
17156
  ] }),
17064
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
17065
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
17066
- error ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-2", children: [
17067
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
17068
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
17157
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
17158
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
17159
+ error ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-2", children: [
17160
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
17161
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
17069
17162
  ] }) : null,
17070
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17163
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17071
17164
  Button,
17072
17165
  {
17073
17166
  variant: "primary",
@@ -17078,7 +17171,7 @@ var ConnectOnchainModal = ({
17078
17171
  }
17079
17172
  )
17080
17173
  ] }),
17081
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17174
+ /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17082
17175
  Button,
17083
17176
  {
17084
17177
  variant: "tertiary",
@@ -17097,12 +17190,12 @@ var ConnectOnchainModal = ({
17097
17190
  ConnectOnchainModal.displayName = "ConnectOnchainModal";
17098
17191
 
17099
17192
  // src/onboarding/steps/connect-kalshi-modal.tsx
17100
- var import_hooks57 = require("@agg-build/hooks");
17193
+ var import_hooks58 = require("@agg-build/hooks");
17101
17194
  var import_sdk19 = require("@agg-build/sdk");
17102
17195
  var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
17103
- var import_react31 = require("react");
17196
+ var import_react32 = require("react");
17104
17197
  var import_zod = require("zod");
17105
- var import_jsx_runtime152 = require("react/jsx-runtime");
17198
+ var import_jsx_runtime153 = require("react/jsx-runtime");
17106
17199
  var kalshiCredentialsSchema = import_zod.z.object({
17107
17200
  apiKeyId: import_zod.z.string().trim().min(1),
17108
17201
  privateKey: import_zod.z.string().trim().min(1)
@@ -17124,25 +17217,25 @@ var ConnectKalshiModal = ({
17124
17217
  onOpenChange,
17125
17218
  onVerify
17126
17219
  }) => {
17127
- const labels = (0, import_hooks57.useLabels)();
17128
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks57.useAppConfig)();
17129
- const apiKeyInputRef = (0, import_react31.useRef)(null);
17130
- const errorId = (0, import_react31.useId)();
17131
- const [apiKeyId, setApiKeyId] = (0, import_react31.useState)("");
17132
- const [privateKey, setPrivateKey] = (0, import_react31.useState)("");
17133
- const [isVerifying, setIsVerifying] = (0, import_react31.useState)(false);
17134
- const [isConnected, setIsConnected] = (0, import_react31.useState)(false);
17135
- const [error, setError] = (0, import_react31.useState)();
17136
- const availabilityState = (0, import_hooks57.getVenueAvailabilityState)({
17220
+ const labels = (0, import_hooks58.useLabels)();
17221
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks58.useAppConfig)();
17222
+ const apiKeyInputRef = (0, import_react32.useRef)(null);
17223
+ const errorId = (0, import_react32.useId)();
17224
+ const [apiKeyId, setApiKeyId] = (0, import_react32.useState)("");
17225
+ const [privateKey, setPrivateKey] = (0, import_react32.useState)("");
17226
+ const [isVerifying, setIsVerifying] = (0, import_react32.useState)(false);
17227
+ const [isConnected, setIsConnected] = (0, import_react32.useState)(false);
17228
+ const [error, setError] = (0, import_react32.useState)();
17229
+ const availabilityState = (0, import_hooks58.getVenueAvailabilityState)({
17137
17230
  venueId: import_sdk19.Venue.kalshi,
17138
17231
  disabledVenues,
17139
17232
  isConfigLoading: isAppConfigLoading
17140
17233
  });
17141
- const parsedCredentials = (0, import_react31.useMemo)(
17234
+ const parsedCredentials = (0, import_react32.useMemo)(
17142
17235
  () => kalshiCredentialsSchema.safeParse({ apiKeyId, privateKey }),
17143
17236
  [apiKeyId, privateKey]
17144
17237
  );
17145
- (0, import_react31.useEffect)(() => {
17238
+ (0, import_react32.useEffect)(() => {
17146
17239
  if (!open) return;
17147
17240
  setApiKeyId("");
17148
17241
  setPrivateKey("");
@@ -17155,14 +17248,14 @@ var ConnectKalshiModal = ({
17155
17248
  });
17156
17249
  return () => window.cancelAnimationFrame(animationFrame);
17157
17250
  }, [open]);
17158
- const handleOpenChange = (0, import_react31.useCallback)(
17251
+ const handleOpenChange = (0, import_react32.useCallback)(
17159
17252
  (nextOpen) => {
17160
17253
  if (isVerifying && !nextOpen) return;
17161
17254
  onOpenChange(nextOpen);
17162
17255
  },
17163
17256
  [isVerifying, onOpenChange]
17164
17257
  );
17165
- const handleVerify = (0, import_react31.useCallback)(() => __async(null, null, function* () {
17258
+ const handleVerify = (0, import_react32.useCallback)(() => __async(null, null, function* () {
17166
17259
  if (!parsedCredentials.success || isVerifying || isConnected) return;
17167
17260
  const credentials = parsedCredentials.data;
17168
17261
  setIsVerifying(true);
@@ -17189,7 +17282,7 @@ var ConnectKalshiModal = ({
17189
17282
  onVerify,
17190
17283
  parsedCredentials
17191
17284
  ]);
17192
- const handleSubmit = (0, import_react31.useCallback)(
17285
+ const handleSubmit = (0, import_react32.useCallback)(
17193
17286
  (event) => {
17194
17287
  event.preventDefault();
17195
17288
  void handleVerify();
@@ -17197,30 +17290,30 @@ var ConnectKalshiModal = ({
17197
17290
  [handleVerify]
17198
17291
  );
17199
17292
  if (availabilityState === "hidden") return null;
17200
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17293
+ return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
17201
17294
  Modal.Container,
17202
17295
  {
17203
17296
  maxWidth: "600px",
17204
17297
  "aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
17205
17298
  classNames: { container: "!rounded-agg-2xl" },
17206
17299
  children: [
17207
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex h-[60px] shrink-0 items-center justify-end px-8", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17300
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "flex h-[60px] shrink-0 items-center justify-end px-8", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17208
17301
  Dialog4.Close,
17209
17302
  {
17210
17303
  "aria-label": labels.common.close,
17211
17304
  className: "flex size-10 cursor-pointer items-center justify-center rounded-agg-full text-agg-secondary transition-colors hover:bg-agg-quaternary hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent disabled:cursor-default disabled:opacity-50",
17212
17305
  disabled: isVerifying,
17213
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "close", size: "medium" })
17306
+ children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { name: "close", size: "medium" })
17214
17307
  }
17215
17308
  ) }),
17216
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Modal.Body, { classNames: { root: "!px-5 !pb-12 !pt-0 sm:!px-10" }, children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17309
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Modal.Body, { classNames: { root: "!px-5 !pb-12 !pt-0 sm:!px-10" }, children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
17217
17310
  "div",
17218
17311
  {
17219
17312
  className: "flex flex-col items-center gap-8 pb-3 text-center",
17220
17313
  role: "status",
17221
17314
  "aria-live": "polite",
17222
17315
  children: [
17223
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17316
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17224
17317
  Icon,
17225
17318
  {
17226
17319
  name: "success-check",
@@ -17228,11 +17321,11 @@ var ConnectKalshiModal = ({
17228
17321
  "aria-hidden": "true"
17229
17322
  }
17230
17323
  ) }),
17231
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
17232
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Dialog4.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
17233
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Dialog4.Description, { className: "max-w-[480px] text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
17324
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
17325
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Dialog4.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
17326
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Dialog4.Description, { className: "max-w-[480px] text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
17234
17327
  ] }),
17235
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17328
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17236
17329
  Button,
17237
17330
  {
17238
17331
  variant: "primary",
@@ -17244,27 +17337,27 @@ var ConnectKalshiModal = ({
17244
17337
  )
17245
17338
  ]
17246
17339
  }
17247
- ) : /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("form", { className: "flex flex-col items-center gap-8", onSubmit: handleSubmit, children: [
17248
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VenueLogo, { venue: import_sdk19.Venue.kalshi, variant: "logo", size: "large", className: "size-[60px]" }),
17249
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col items-center gap-4 text-center", children: [
17250
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Dialog4.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
17251
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Dialog4.Description, { className: "max-w-[520px] text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
17340
+ ) : /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("form", { className: "flex flex-col items-center gap-8", onSubmit: handleSubmit, children: [
17341
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(VenueLogo, { venue: import_sdk19.Venue.kalshi, variant: "logo", size: "large", className: "size-[60px]" }),
17342
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col items-center gap-4 text-center", children: [
17343
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Dialog4.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
17344
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Dialog4.Description, { className: "max-w-[520px] text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
17252
17345
  ] }),
17253
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
17254
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
17255
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-1", children: [
17256
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
17257
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
17346
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
17347
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
17348
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col gap-1", children: [
17349
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
17350
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
17258
17351
  ] }),
17259
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
17260
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
17261
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("p", { children: [
17352
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
17353
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
17354
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("p", { children: [
17262
17355
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
17263
17356
  " ",
17264
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
17357
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
17265
17358
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
17266
17359
  " ",
17267
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17360
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17268
17361
  "a",
17269
17362
  {
17270
17363
  href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
@@ -17275,34 +17368,34 @@ var ConnectKalshiModal = ({
17275
17368
  }
17276
17369
  )
17277
17370
  ] }),
17278
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("p", { children: [
17371
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("p", { children: [
17279
17372
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
17280
17373
  " ",
17281
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
17374
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
17282
17375
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
17283
17376
  ] }),
17284
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("p", { children: [
17377
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("p", { children: [
17285
17378
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
17286
17379
  " ",
17287
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
17380
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
17288
17381
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
17289
17382
  ] }),
17290
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
17383
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
17291
17384
  ] }),
17292
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
17385
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
17293
17386
  labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
17294
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("br", {}),
17387
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("br", {}),
17295
17388
  labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
17296
17389
  ] })
17297
17390
  ] }),
17298
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
17299
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-1", children: [
17300
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
17301
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
17391
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
17392
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col gap-1", children: [
17393
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
17394
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
17302
17395
  ] }),
17303
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
17304
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-2", children: [
17305
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17396
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
17397
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col gap-2", children: [
17398
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17306
17399
  "label",
17307
17400
  {
17308
17401
  htmlFor: "kalshi-api-key-id",
@@ -17310,7 +17403,7 @@ var ConnectKalshiModal = ({
17310
17403
  children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
17311
17404
  }
17312
17405
  ),
17313
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17406
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17314
17407
  "input",
17315
17408
  {
17316
17409
  ref: apiKeyInputRef,
@@ -17332,8 +17425,8 @@ var ConnectKalshiModal = ({
17332
17425
  }
17333
17426
  )
17334
17427
  ] }),
17335
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-2", children: [
17336
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17428
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col gap-2", children: [
17429
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17337
17430
  "label",
17338
17431
  {
17339
17432
  htmlFor: "kalshi-private-key",
@@ -17341,7 +17434,7 @@ var ConnectKalshiModal = ({
17341
17434
  children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
17342
17435
  }
17343
17436
  ),
17344
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17437
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17345
17438
  "textarea",
17346
17439
  {
17347
17440
  id: "kalshi-private-key",
@@ -17364,22 +17457,22 @@ var ConnectKalshiModal = ({
17364
17457
  ] })
17365
17458
  ] })
17366
17459
  ] }),
17367
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
17368
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
17369
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-3", children: [
17370
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
17371
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "document", size: "small", className: "size-4 text-agg-primary" }),
17460
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
17461
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
17462
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex items-center gap-3", children: [
17463
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
17464
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { name: "document", size: "small", className: "size-4 text-agg-primary" }),
17372
17465
  labels.onboarding.connectKalshiModal.help.docsLinkLabel
17373
17466
  ] }),
17374
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
17375
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
17376
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "play-square", size: "small", className: "size-4 text-agg-primary" }),
17467
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
17468
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
17469
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { name: "play-square", size: "small", className: "size-4 text-agg-primary" }),
17377
17470
  labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
17378
17471
  ] })
17379
17472
  ] })
17380
17473
  ] }),
17381
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
17382
- error ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17474
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
17475
+ error ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
17383
17476
  "div",
17384
17477
  {
17385
17478
  id: errorId,
@@ -17387,13 +17480,13 @@ var ConnectKalshiModal = ({
17387
17480
  role: "alert",
17388
17481
  "aria-live": "assertive",
17389
17482
  children: [
17390
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
17391
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
17483
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
17484
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
17392
17485
  ]
17393
17486
  }
17394
17487
  ) : null,
17395
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
17396
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17488
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
17489
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17397
17490
  Button,
17398
17491
  {
17399
17492
  variant: "secondary",
@@ -17403,7 +17496,7 @@ var ConnectKalshiModal = ({
17403
17496
  children: labels.onboarding.connectKalshiModal.actions.cancel
17404
17497
  }
17405
17498
  ),
17406
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17499
+ /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17407
17500
  Button,
17408
17501
  {
17409
17502
  type: "submit",
@@ -17424,7 +17517,7 @@ var ConnectKalshiModal = ({
17424
17517
  ConnectKalshiModal.displayName = "ConnectKalshiModal";
17425
17518
 
17426
17519
  // src/onboarding/index.tsx
17427
- var import_jsx_runtime153 = require("react/jsx-runtime");
17520
+ var import_jsx_runtime154 = require("react/jsx-runtime");
17428
17521
  var OnboardingModal = ({
17429
17522
  open,
17430
17523
  onOpenChange,
@@ -17435,55 +17528,55 @@ var OnboardingModal = ({
17435
17528
  connectedOnchain = false
17436
17529
  }) => {
17437
17530
  var _a;
17438
- const labels = (0, import_hooks58.useLabels)();
17439
- const [step, setStep] = (0, import_react32.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
17531
+ const labels = (0, import_hooks59.useLabels)();
17532
+ const [step, setStep] = (0, import_react33.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
17440
17533
  const stepLabels = {
17441
17534
  [ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
17442
17535
  [ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
17443
17536
  [ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
17444
17537
  };
17445
17538
  const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
17446
- const [onchainModalOpen, setOnchainModalOpen] = (0, import_react32.useState)(false);
17447
- const [onchainConnected, setOnchainConnected] = (0, import_react32.useState)(false);
17448
- (0, import_react32.useEffect)(() => {
17539
+ const [onchainModalOpen, setOnchainModalOpen] = (0, import_react33.useState)(false);
17540
+ const [onchainConnected, setOnchainConnected] = (0, import_react33.useState)(false);
17541
+ (0, import_react33.useEffect)(() => {
17449
17542
  if (open) {
17450
17543
  setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
17451
17544
  setOnchainConnected(false);
17452
17545
  }
17453
17546
  }, [open]);
17454
- const handleHowItWorksContinue = (0, import_react32.useCallback)(() => {
17547
+ const handleHowItWorksContinue = (0, import_react33.useCallback)(() => {
17455
17548
  setStep(ONBOARDING_STEPS.PROFILE_SETUP);
17456
17549
  }, []);
17457
- const handleProfileContinue = (0, import_react32.useCallback)(
17550
+ const handleProfileContinue = (0, import_react33.useCallback)(
17458
17551
  (data) => {
17459
17552
  onProfileSubmit == null ? void 0 : onProfileSubmit(data);
17460
17553
  setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
17461
17554
  },
17462
17555
  [onProfileSubmit]
17463
17556
  );
17464
- const handleConnectContinue = (0, import_react32.useCallback)(() => {
17557
+ const handleConnectContinue = (0, import_react33.useCallback)(() => {
17465
17558
  onComplete == null ? void 0 : onComplete();
17466
17559
  }, [onComplete]);
17467
- const handleOpenOnchainModal = (0, import_react32.useCallback)(() => {
17560
+ const handleOpenOnchainModal = (0, import_react33.useCallback)(() => {
17468
17561
  setOnchainModalOpen(true);
17469
17562
  }, []);
17470
- const handleOnchainConnect = (0, import_react32.useCallback)(() => __async(null, null, function* () {
17563
+ const handleOnchainConnect = (0, import_react33.useCallback)(() => __async(null, null, function* () {
17471
17564
  yield onConnectOnchain == null ? void 0 : onConnectOnchain();
17472
17565
  setOnchainConnected(true);
17473
17566
  }), [onConnectOnchain]);
17474
- return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(import_jsx_runtime153.Fragment, { children: [
17475
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
17567
+ return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(import_jsx_runtime154.Fragment, { children: [
17568
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
17476
17569
  Modal.Container,
17477
17570
  {
17478
17571
  maxWidth: "600px",
17479
17572
  "aria-label": resolvedTitle,
17480
17573
  classNames: { container: "!rounded-agg-lg" },
17481
17574
  children: [
17482
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Dialog5.Title, { className: "sr-only", children: resolvedTitle }),
17483
- /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
17484
- step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
17485
- step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(ProfileSetupStep, { onContinue: handleProfileContinue }),
17486
- step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17575
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Dialog5.Title, { className: "sr-only", children: resolvedTitle }),
17576
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
17577
+ step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
17578
+ step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(ProfileSetupStep, { onContinue: handleProfileContinue }),
17579
+ step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
17487
17580
  ConnectAccountsStep,
17488
17581
  {
17489
17582
  onConnectOnchain: handleOpenOnchainModal,
@@ -17495,7 +17588,7 @@ var OnboardingModal = ({
17495
17588
  ]
17496
17589
  }
17497
17590
  ) }),
17498
- /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
17591
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
17499
17592
  ConnectOnchainModal,
17500
17593
  {
17501
17594
  open: onchainModalOpen,
@@ -17507,98 +17600,6 @@ var OnboardingModal = ({
17507
17600
  };
17508
17601
  OnboardingModal.displayName = "OnboardingModal";
17509
17602
 
17510
- // src/notifications/agg-notification-events-provider.tsx
17511
- var import_hooks59 = require("@agg-build/hooks");
17512
- var import_react33 = require("react");
17513
- var import_jsx_runtime154 = require("react/jsx-runtime");
17514
- var firedOrderNotificationKeys = /* @__PURE__ */ new Set();
17515
- var MICRO_UNITS_SCALE = 1e6;
17516
- var formatScaledMicroAmount = (value) => {
17517
- if (!value) return void 0;
17518
- if (value.includes(".")) {
17519
- const parsed = Number(value);
17520
- if (!Number.isFinite(parsed)) return void 0;
17521
- return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
17522
- }
17523
- try {
17524
- const raw = BigInt(value);
17525
- const whole = raw / BigInt(MICRO_UNITS_SCALE);
17526
- const remainder = raw % BigInt(MICRO_UNITS_SCALE);
17527
- const parsed = Number(whole) + Number(remainder) / MICRO_UNITS_SCALE;
17528
- return parsed.toLocaleString("en-US", { maximumFractionDigits: 2 });
17529
- } catch (e) {
17530
- const parsed = Number(value);
17531
- if (!Number.isFinite(parsed)) return void 0;
17532
- return (parsed / MICRO_UNITS_SCALE).toLocaleString("en-US", { maximumFractionDigits: 2 });
17533
- }
17534
- };
17535
- var formatPriceCents = (value) => {
17536
- if (!value) return void 0;
17537
- const parsed = Number(value);
17538
- if (!Number.isFinite(parsed)) return void 0;
17539
- const cents = parsed * 100;
17540
- const display2 = cents.toLocaleString("en-US", {
17541
- minimumFractionDigits: 0,
17542
- maximumFractionDigits: 1
17543
- });
17544
- return `${display2}\xA2`;
17545
- };
17546
- var formatSharesLabel = (raw) => {
17547
- const formatted = formatScaledMicroAmount(raw);
17548
- if (!formatted) return void 0;
17549
- return `${formatted} shares`;
17550
- };
17551
- var capitalize = (value) => {
17552
- if (!value) return void 0;
17553
- return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
17554
- };
17555
- var venueLabelFor = (venueKey, labels) => {
17556
- var _a;
17557
- if (!venueKey) return void 0;
17558
- const normalized = venueKey.toLowerCase();
17559
- const lookup = labels.venues;
17560
- return (_a = lookup[normalized]) != null ? _a : capitalize(venueKey);
17561
- };
17562
- function handleOrderEvent({ event, labels, fireOnce }) {
17563
- var _a, _b;
17564
- const venueLabel = venueLabelFor(event.venue, labels);
17565
- const amountLabel = formatSharesLabel((_a = event.actualSharesRaw) != null ? _a : event.filledAmountRaw);
17566
- const priceLabel = formatPriceCents((_b = event.executionPriceRaw) != null ? _b : event.quotedPriceRaw);
17567
- const fireOrderOnce = (key, tone, title2, message, detail) => {
17568
- if (firedOrderNotificationKeys.has(key)) return;
17569
- firedOrderNotificationKeys.add(key);
17570
- fireOnce(key, tone, title2, message, detail);
17571
- };
17572
- if (event.event === "filled") {
17573
- fireOrderOnce(
17574
- `order:${event.orderId}:filled`,
17575
- "success",
17576
- labels.notifications.order.filledTitle,
17577
- labels.notifications.order.filledMessage({ venueLabel, amountLabel, priceLabel })
17578
- );
17579
- return;
17580
- }
17581
- if (event.event === "partial_fill") {
17582
- fireOrderOnce(
17583
- `order:${event.orderId}:partial_fill`,
17584
- "warning",
17585
- labels.notifications.order.partialFilledTitle,
17586
- labels.notifications.order.partialFilledMessage({ venueLabel, amountLabel, priceLabel })
17587
- );
17588
- return;
17589
- }
17590
- if (event.event === "failed") {
17591
- fireOrderOnce(
17592
- `order:${event.orderId}:failed`,
17593
- "error",
17594
- labels.notifications.order.failedTitle,
17595
- labels.notifications.order.failedMessage(event.errorReason),
17596
- venueLabel
17597
- );
17598
- }
17599
- }
17600
- var CLIENT_DEPOSIT_ACTIVITY_SUPPRESSION_MS = 2 * 60 * 1e3;
17601
-
17602
17603
  // src/shared/deposit-modal-events.ts
17603
17604
  var DEPOSIT_MODAL_OPEN_EVENT = "agg-deposit:open-modal";
17604
17605
  var WITHDRAW_MODAL_OPEN_EVENT = "agg-withdraw:open-modal";
@@ -17689,6 +17690,7 @@ var MIN_SELL_ORDER_SHARES = 1;
17689
17690
  var DEFAULT_SLIPPAGE_VALUE = "0.5";
17690
17691
  var HIGH_SLIPPAGE_THRESHOLD = 10;
17691
17692
  var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
17693
+ var PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID = "live-maximize-payout";
17692
17694
  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";
17693
17695
  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";
17694
17696
  var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
@@ -18163,20 +18165,43 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
18163
18165
  maximumFractionDigits: 1
18164
18166
  });
18165
18167
  var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
18166
- var normalizeOutcomeName = (value) => {
18167
- var _a;
18168
- return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
18169
- };
18170
- var findMatchingVenueOutcome = (market, selectedOutcome) => {
18171
- var _a, _b;
18172
- const selectedNames = new Set(
18173
- [selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
18174
- );
18175
- return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
18176
- const normalizedLabel = normalizeOutcomeName(outcome.label);
18177
- return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
18178
- })) != null ? _b : null;
18179
- };
18168
+ var floorToDecimals = (value, decimals) => {
18169
+ if (!Number.isFinite(value) || value <= 0) return 0;
18170
+ const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
18171
+ const [whole = "0", fraction = ""] = coefficient.split(".");
18172
+ const exponent = Number(exponentText);
18173
+ const digits = `${whole}${fraction}`;
18174
+ const decimalIndex = whole.length + exponent;
18175
+ const normalized = decimalIndex <= 0 ? `0.${"0".repeat(-decimalIndex)}${digits}` : decimalIndex >= digits.length ? `${digits}${"0".repeat(decimalIndex - digits.length)}` : `${digits.slice(0, decimalIndex)}.${digits.slice(decimalIndex)}`;
18176
+ const [normalizedWhole = "0", normalizedFraction = ""] = normalized.split(".");
18177
+ const truncatedFraction = normalizedFraction.slice(0, decimals);
18178
+ return Number(
18179
+ truncatedFraction.length > 0 ? `${normalizedWhole}.${truncatedFraction}` : normalizedWhole
18180
+ );
18181
+ };
18182
+ var formatFlooredShareAmount = (value, decimals) => {
18183
+ const flooredValue = floorToDecimals(value, decimals);
18184
+ if (flooredValue <= 0) return "0";
18185
+ const formattedValue = flooredValue.toLocaleString("en-US", {
18186
+ minimumFractionDigits: 0,
18187
+ maximumFractionDigits: decimals
18188
+ });
18189
+ return formattedValue.replace(/(\.\d*?[1-9])0+$/u, "$1").replace(/\.0+$/u, "");
18190
+ };
18191
+ var normalizeOutcomeName = (value) => {
18192
+ var _a;
18193
+ return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
18194
+ };
18195
+ var findMatchingVenueOutcome = (market, selectedOutcome) => {
18196
+ var _a, _b;
18197
+ const selectedNames = new Set(
18198
+ [selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
18199
+ );
18200
+ return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
18201
+ const normalizedLabel = normalizeOutcomeName(outcome.label);
18202
+ return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
18203
+ })) != null ? _b : null;
18204
+ };
18180
18205
  var buildLimitOrderVenueOptions = ({
18181
18206
  currentPrices,
18182
18207
  livePrices,
@@ -18312,18 +18337,24 @@ var mapVenueMarketOutcomesToPlaceOrderOutcomes = (venueMarketOutcomes) => {
18312
18337
  };
18313
18338
  });
18314
18339
  };
18315
- var mapQuoteDataToRoutingRows = (quoteData) => {
18340
+ var mapQuoteDataToRoutingRows = (quoteData, tradeSide = "buy") => {
18316
18341
  if (!(quoteData == null ? void 0 : quoteData.fills.length)) return [];
18317
- return quoteData.fills.map((fill) => ({
18318
- venue: fill.venue,
18319
- label: getTradingValueLabel({ amount: fill.venueQty * fill.avgPrice }),
18320
- priceLabel: getTradingRoutePriceLabel(fill.avgPrice),
18321
- resultLabel: getTradingValueLabel({
18322
- amount: fill.venueQty,
18323
- minimumFractionDigits: 2,
18324
- maximumFractionDigits: 2
18325
- })
18326
- }));
18342
+ return quoteData.fills.map((fill) => {
18343
+ const allocationValueLabel = getTradingValueLabel(__spreadValues({
18344
+ amount: fill.venueQty * fill.avgPrice
18345
+ }, tradeSide === "sell" ? { minimumFractionDigits: 2, maximumFractionDigits: 2 } : {}));
18346
+ const allocationSharesLabel = `${formatFlooredShareAmount(fill.venueQty, 2)} shares`;
18347
+ return {
18348
+ venue: fill.venue,
18349
+ label: tradeSide === "sell" ? allocationSharesLabel : allocationValueLabel,
18350
+ priceLabel: getTradingRoutePriceLabel(fill.avgPrice),
18351
+ resultLabel: tradeSide === "sell" ? allocationValueLabel : getTradingValueLabel({
18352
+ amount: fill.venueQty,
18353
+ minimumFractionDigits: 2,
18354
+ maximumFractionDigits: 2
18355
+ })
18356
+ };
18357
+ });
18327
18358
  };
18328
18359
  var deriveAggregateOrderStatus = (orderIds, terminalEvents) => {
18329
18360
  if (!orderIds.length) return "pending";
@@ -18502,7 +18533,8 @@ var buildLiveRouteCards = ({
18502
18533
  ),
18503
18534
  numericValue: tradeSide === "sell" ? quoteData.rawExecCost : quoteData.totalFilled,
18504
18535
  quoteData,
18505
- rows: mapQuoteDataToRoutingRows(quoteData),
18536
+ rows: mapQuoteDataToRoutingRows(quoteData, tradeSide),
18537
+ description: labels.splitOrderDescription,
18506
18538
  value: primaryResult.value,
18507
18539
  venue: isSplit ? void 0 : parsedPrimaryVenue.success ? parsedPrimaryVenue.data : void 0
18508
18540
  } : null;
@@ -18636,6 +18668,9 @@ var clampSellSharesToAvailability = (requestedSellShares, availableShares) => {
18636
18668
  requestedAtomicShares < availableAtomicShares ? requestedAtomicShares : availableAtomicShares
18637
18669
  );
18638
18670
  };
18671
+ var hasInsufficientVenueInventory = (requestedSellShares, availableShares) => {
18672
+ return sellSharesToAtomicUnits(requestedSellShares) > sellSharesToAtomicUnits(availableShares);
18673
+ };
18639
18674
  var getRemainingVenueSellShares = (availableShares, filledShares) => {
18640
18675
  const availableAtomicShares = sellSharesToAtomicUnits(availableShares);
18641
18676
  const filledAtomicShares = sellSharesToAtomicUnits(filledShares);
@@ -18672,12 +18707,37 @@ var buildVenueSellQuoteRequests = ({
18672
18707
  };
18673
18708
  var buildLiveSellRouteCards = ({
18674
18709
  labels,
18710
+ requestedSellShares,
18675
18711
  smartQuoteData,
18676
18712
  venueQuotes,
18677
18713
  eventVenues = [],
18678
18714
  geoBlockedVenues
18679
18715
  }) => {
18680
18716
  var _a;
18717
+ const availabilityRequests = buildVenueSellQuoteRequests({
18718
+ quoteData: smartQuoteData,
18719
+ requestedSellShares
18720
+ });
18721
+ const availabilityRequestByVenue = new Map(
18722
+ availabilityRequests.map((request) => [request.venue, request])
18723
+ );
18724
+ const decorateVenueCard = (card, request) => {
18725
+ if (card.kind !== "venue" || !card.venue || !request) return card;
18726
+ const executionPrice = card.quoteData.totalFilled > 0 ? card.quoteData.rawExecCost / card.quoteData.totalFilled : void 0;
18727
+ const insufficientInventory = hasInsufficientVenueInventory(
18728
+ requestedSellShares,
18729
+ request.availableShares
18730
+ );
18731
+ const sharesLabel = labels.shares(floorToDecimals(request.availableShares, 2));
18732
+ const priceLabel = executionPrice == null ? "\u2014" : getTradingRoutePriceLabel(executionPrice);
18733
+ return __spreadProps(__spreadValues({}, card), {
18734
+ availableShares: request.availableShares,
18735
+ executionPrice,
18736
+ hint: card.isUnavailable ? card.hint : insufficientInventory ? labels.insufficientVenueInventory(sharesLabel, priceLabel) : labels.venueInventory(sharesLabel, priceLabel),
18737
+ id: `live-solo-${card.venue}`,
18738
+ insufficientInventory
18739
+ });
18740
+ };
18681
18741
  const smartRouteCards = smartQuoteData ? buildLiveRouteCards({
18682
18742
  labels,
18683
18743
  quoteData: __spreadProps(__spreadValues({}, smartQuoteData), {
@@ -18686,12 +18746,25 @@ var buildLiveSellRouteCards = ({
18686
18746
  tradeSide: "sell",
18687
18747
  eventVenues,
18688
18748
  geoBlockedVenues
18749
+ }).map((card) => {
18750
+ if (card.kind === "split") {
18751
+ return __spreadProps(__spreadValues({}, card), {
18752
+ description: labels.maximizePayoutDescription,
18753
+ id: PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID,
18754
+ label: labels.maximizePayout
18755
+ });
18756
+ }
18757
+ return decorateVenueCard(
18758
+ card,
18759
+ card.venue ? availabilityRequestByVenue.get(card.venue) : void 0
18760
+ );
18689
18761
  }) : [];
18690
18762
  const smartRouteVenue = (smartQuoteData == null ? void 0 : smartQuoteData.status) === "ok" && smartQuoteData.fills.length === 1 ? parseVenue((_a = smartQuoteData.fills[0]) == null ? void 0 : _a.venue) : null;
18691
18763
  const independentVenueCards = /* @__PURE__ */ new Map();
18692
18764
  for (const venueQuote of venueQuotes) {
18693
18765
  const quoteData = venueQuote.quoteData;
18694
- if (!(quoteData == null ? void 0 : quoteData.quoteId) || quoteData.status !== "ok" || quoteData.fills.length === 0 || quoteData.fills.some((fill) => fill.venue !== venueQuote.venue) || (smartRouteVenue == null ? void 0 : smartRouteVenue.success) && smartRouteVenue.data === venueQuote.venue) {
18766
+ const { venue } = venueQuote.request;
18767
+ if (!(quoteData == null ? void 0 : quoteData.quoteId) || quoteData.status !== "ok" || quoteData.fills.length === 0 || quoteData.fills.some((fill) => fill.venue !== venue) || (smartRouteVenue == null ? void 0 : smartRouteVenue.success) && smartRouteVenue.data === venue) {
18695
18768
  continue;
18696
18769
  }
18697
18770
  const [venueCard] = buildLiveRouteCards({
@@ -18702,17 +18775,17 @@ var buildLiveSellRouteCards = ({
18702
18775
  tradeSide: "sell",
18703
18776
  geoBlockedVenues
18704
18777
  });
18705
- if (!venueCard || venueCard.kind !== "venue" || venueCard.venue !== venueQuote.venue) {
18778
+ if (!venueCard || venueCard.kind !== "venue" || venueCard.venue !== venue) {
18706
18779
  continue;
18707
18780
  }
18708
- independentVenueCards.set(venueQuote.venue, __spreadProps(__spreadValues({}, venueCard), {
18709
- id: `live-solo-${venueQuote.venue}`
18710
- }));
18781
+ independentVenueCards.set(venue, decorateVenueCard(venueCard, venueQuote.request));
18711
18782
  }
18712
18783
  const deduplicatedSmartRouteCards = smartRouteCards.filter(
18713
18784
  (card) => !card.venue || !independentVenueCards.has(card.venue)
18714
18785
  );
18715
18786
  return [...deduplicatedSmartRouteCards, ...independentVenueCards.values()].sort((left, right) => {
18787
+ if (left.id === PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID) return -1;
18788
+ if (right.id === PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID) return 1;
18716
18789
  if (!!left.isUnavailable !== !!right.isUnavailable) {
18717
18790
  return left.isUnavailable ? 1 : -1;
18718
18791
  }
@@ -19773,29 +19846,6 @@ PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
19773
19846
  var import_jsx_runtime158 = require("react/jsx-runtime");
19774
19847
  var SELL_SHARE_INPUT_DECIMALS = 6;
19775
19848
  var SELL_SHARE_DISPLAY_DECIMALS = 2;
19776
- var floorToDecimals = (value, decimals) => {
19777
- if (!Number.isFinite(value) || value <= 0) return 0;
19778
- const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
19779
- const [whole = "0", fraction = ""] = coefficient.split(".");
19780
- const exponent = Number(exponentText);
19781
- const digits = `${whole}${fraction}`;
19782
- const decimalIndex = whole.length + exponent;
19783
- const normalized = decimalIndex <= 0 ? `0.${"0".repeat(-decimalIndex)}${digits}` : decimalIndex >= digits.length ? `${digits}${"0".repeat(decimalIndex - digits.length)}` : `${digits.slice(0, decimalIndex)}.${digits.slice(decimalIndex)}`;
19784
- const [normalizedWhole = "0", normalizedFraction = ""] = normalized.split(".");
19785
- const truncatedFraction = normalizedFraction.slice(0, decimals);
19786
- return Number(
19787
- truncatedFraction.length > 0 ? `${normalizedWhole}.${truncatedFraction}` : normalizedWhole
19788
- );
19789
- };
19790
- var formatFlooredShareAmount = (value, decimals) => {
19791
- const flooredValue = floorToDecimals(value, decimals);
19792
- if (flooredValue <= 0) return "0";
19793
- const formattedValue = flooredValue.toLocaleString("en-US", {
19794
- minimumFractionDigits: 0,
19795
- maximumFractionDigits: decimals
19796
- });
19797
- return formattedValue.replace(/(\.\d*?[1-9])0+$/u, "$1").replace(/\.0+$/u, "");
19798
- };
19799
19849
  var resolvePlaceOrderPortalContainer = (triggerElement) => {
19800
19850
  var _a;
19801
19851
  return (_a = triggerElement == null ? void 0 : triggerElement.closest(".agg-modal-center")) != null ? _a : void 0;
@@ -20353,7 +20403,7 @@ var renderRouteCard = ({
20353
20403
  onSelect,
20354
20404
  tradingLabels
20355
20405
  }) => {
20356
- var _a, _b;
20406
+ var _a, _b, _c;
20357
20407
  const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
20358
20408
  const ariaLabel = [card.label, card.hint, card.value].filter(Boolean).join(" ");
20359
20409
  return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
@@ -20408,6 +20458,14 @@ var renderRouteCard = ({
20408
20458
  className: "shrink-0 text-agg-muted-foreground",
20409
20459
  "aria-hidden": "true"
20410
20460
  }
20461
+ ) : card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
20462
+ Icon,
20463
+ {
20464
+ name: "warning",
20465
+ size: "xs",
20466
+ className: "shrink-0 text-agg-muted-foreground",
20467
+ "aria-hidden": "true"
20468
+ }
20411
20469
  ) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
20412
20470
  Icon,
20413
20471
  {
@@ -20434,8 +20492,8 @@ var renderRouteCard = ({
20434
20492
  )
20435
20493
  ] }),
20436
20494
  showSplitDetails ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
20437
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.splitOrderDescription }),
20438
- /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_b = card.rows) == null ? void 0 : _b.map((row) => renderRouteBreakdownRow(row)) })
20495
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: (_b = card.description) != null ? _b : tradingLabels.splitOrderDescription }),
20496
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_c = card.rows) == null ? void 0 : _c.map((row) => renderRouteBreakdownRow(row)) })
20439
20497
  ] }) : null
20440
20498
  ] })
20441
20499
  }
@@ -21042,9 +21100,10 @@ var PlaceOrder = ({
21042
21100
  eventVenues,
21043
21101
  geoBlockedVenues: inheritedBuyGeoBlockedVenues,
21044
21102
  labels: tradingLabels,
21103
+ requestedSellShares: debouncedAmount,
21045
21104
  smartQuoteData: smartRoute.data,
21046
21105
  venueQuotes: venueSellQuotes.quotes.map((venueQuote) => ({
21047
- venue: venueQuote.request.venue,
21106
+ request: venueQuote.request,
21048
21107
  quoteData: venueQuote.data
21049
21108
  }))
21050
21109
  });
@@ -21056,6 +21115,7 @@ var PlaceOrder = ({
21056
21115
  tradeSide: "buy"
21057
21116
  }) : [];
21058
21117
  }, [
21118
+ debouncedAmount,
21059
21119
  smartRoute.data,
21060
21120
  tradingLabels,
21061
21121
  inheritedBuyGeoBlockedVenues,
@@ -21063,16 +21123,19 @@ var PlaceOrder = ({
21063
21123
  scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
21064
21124
  venueSellQuotes.quotes
21065
21125
  ]);
21126
+ const isSellQuoteTransitioning = isSell && (isQuoteInputEditing || smartRoute.isLoading || smartRoute.isFetching || venueSellQuotes.isLoading || venueSellQuotes.isFetching);
21066
21127
  const resolvedSelectedRouteCardId = (0, import_react36.useMemo)(() => {
21067
21128
  var _a2;
21068
- if (routeCards.length === 0) return null;
21069
21129
  if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
21070
21130
  return selectedRouteCardId;
21071
21131
  }
21132
+ if (selectedRouteCardId && isSellQuoteTransitioning) return selectedRouteCardId;
21133
+ if (routeCards.length === 0) return null;
21072
21134
  return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
21073
- }, [routeCards, selectedRouteCardId, isSell, (_x = smartRoute.data) == null ? void 0 : _x.status]);
21135
+ }, [isSell, isSellQuoteTransitioning, routeCards, selectedRouteCardId, (_x = smartRoute.data) == null ? void 0 : _x.status]);
21074
21136
  (0, import_react36.useEffect)(() => {
21075
21137
  if (routeCards.length === 0) {
21138
+ if (isSellQuoteTransitioning) return;
21076
21139
  setSelectedRouteCardId(null);
21077
21140
  setIsRoutesExpanded(false);
21078
21141
  setIsSplitDetailOpen(false);
@@ -21081,7 +21144,12 @@ var PlaceOrder = ({
21081
21144
  if (resolvedSelectedRouteCardId !== selectedRouteCardId) {
21082
21145
  setSelectedRouteCardId(resolvedSelectedRouteCardId);
21083
21146
  }
21084
- }, [resolvedSelectedRouteCardId, routeCards.length, selectedRouteCardId]);
21147
+ }, [
21148
+ isSellQuoteTransitioning,
21149
+ resolvedSelectedRouteCardId,
21150
+ routeCards.length,
21151
+ selectedRouteCardId
21152
+ ]);
21085
21153
  const isSubmissionLocked = submissionProgressState != null;
21086
21154
  const isSubmissionLockedRef = (0, import_react36.useRef)(isSubmissionLocked);
21087
21155
  isSubmissionLockedRef.current = isSubmissionLocked;
@@ -21111,6 +21179,11 @@ var PlaceOrder = ({
21111
21179
  (0, import_react36.useEffect)(() => {
21112
21180
  setSelectedLimitVenue(null);
21113
21181
  }, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
21182
+ (0, import_react36.useEffect)(() => {
21183
+ setSelectedRouteCardId(null);
21184
+ setIsRoutesExpanded(false);
21185
+ setIsSplitDetailOpen(false);
21186
+ }, [executionType, internalTab, scopedSelectedOutcomeId]);
21114
21187
  const orderedRouteCards = routeCards;
21115
21188
  const selectedRouteCard = (_z = (_y = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _y : orderedRouteCards[0]) != null ? _z : null;
21116
21189
  const isKalshiRoute = (0, import_react36.useMemo)(() => {
@@ -21159,16 +21232,33 @@ var PlaceOrder = ({
21159
21232
  const verifyKalshiConnectionLabel = (_G = (_F = (_E = (_D = labels.onboarding) == null ? void 0 : _D.connectKalshiModal) == null ? void 0 : _E.actions) == null ? void 0 : _F.verifyConnection) != null ? _G : tradingLabels.kycRequired;
21160
21233
  const handleRouteCardSelect = (0, import_react36.useCallback)(
21161
21234
  (cardId) => {
21235
+ const card = routeCards.find((routeCard) => routeCard.id === cardId);
21236
+ if (!card || card.isUnavailable) return;
21162
21237
  if (cardId === resolvedSelectedRouteCardId) {
21163
- const card = routeCards.find((c) => c.id === cardId);
21164
21238
  if ((card == null ? void 0 : card.kind) === "split") {
21165
21239
  setIsSplitDetailOpen((prev) => !prev);
21166
21240
  return;
21167
21241
  }
21168
21242
  }
21169
21243
  setSelectedRouteCardId(cardId);
21244
+ setIsSplitDetailOpen(false);
21245
+ if (!isSell || card.kind !== "venue" || !card.insufficientInventory || card.availableShares == null) {
21246
+ return;
21247
+ }
21248
+ const clampedAmount = clampSellSharesToAvailability(internalAmount, card.availableShares);
21249
+ if (clampedAmount === internalAmount) return;
21250
+ setInternalAmount(clampedAmount);
21251
+ setSellFilledForOutcomeId(scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : null);
21252
+ onAmountChange == null ? void 0 : onAmountChange(clampedAmount);
21170
21253
  },
21171
- [resolvedSelectedRouteCardId, routeCards]
21254
+ [
21255
+ internalAmount,
21256
+ isSell,
21257
+ onAmountChange,
21258
+ resolvedSelectedRouteCardId,
21259
+ routeCards,
21260
+ scopedSelectedOutcomeId
21261
+ ]
21172
21262
  );
21173
21263
  const executionProgress = (0, import_hooks61.useExecutionProgress)({
21174
21264
  orderIds: (_H = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _H : null,
@@ -21480,7 +21570,7 @@ var PlaceOrder = ({
21480
21570
  const activeQuoteData = isLimitOrder ? null : (_T = (_S = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _S : smartRoute.data) != null ? _T : null;
21481
21571
  const visibleMarketRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
21482
21572
  const hasEnteredAmount = internalAmount > 0;
21483
- const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
21573
+ const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (isSell && isQuoteInputEditing || smartRoute.isLoading || !isSell && smartRoute.isFetching || isSell && venueSellQuotes.isLoading);
21484
21574
  const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
21485
21575
  const selectedRouteFills = (_U = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _U : [];
21486
21576
  const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk22.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk22.Venue.kalshi));
@@ -21494,6 +21584,7 @@ var PlaceOrder = ({
21494
21584
  const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
21495
21585
  const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
21496
21586
  const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
21587
+ const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
21497
21588
  const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
21498
21589
  const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
21499
21590
  const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
@@ -21575,13 +21666,10 @@ var PlaceOrder = ({
21575
21666
  tradingLabels
21576
21667
  ]);
21577
21668
  const displayedToWinHint = (0, import_react36.useMemo)(() => {
21578
- var _a2, _b2, _c2, _d2;
21669
+ var _a2;
21579
21670
  if (!selectedRouteCard) return "";
21580
- if (selectedRouteCard.isUnavailable) {
21581
- const avgPrice = (_c2 = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.avgPrice;
21582
- return avgPrice != null ? tradingLabels.averagePrice(avgPrice) : "";
21583
- }
21584
- return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
21671
+ const averagePrice = selectedRouteCard.quoteData.totalFilled > 0 ? selectedRouteCard.quoteData.rawExecCost / selectedRouteCard.quoteData.totalFilled : (_a2 = selectedRouteCard.quoteData.fills[0]) == null ? void 0 : _a2.avgPrice;
21672
+ return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
21585
21673
  }, [selectedRouteCard, tradingLabels]);
21586
21674
  const displayedToWinValue = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _W : 0;
21587
21675
  const limitOrderPayload = (0, import_react36.useMemo)(() => {
@@ -21779,7 +21867,7 @@ var PlaceOrder = ({
21779
21867
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
21780
21868
  const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
21781
21869
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
21782
- const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
21870
+ 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;
21783
21871
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
21784
21872
  const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
21785
21873
  const handleReturnToOrderForm = (0, import_react36.useCallback)(() => {
@@ -22119,16 +22207,20 @@ var PlaceOrder = ({
22119
22207
  }
22120
22208
  const refreshedCards = selectedVenueQuote ? buildLiveSellRouteCards({
22121
22209
  labels: tradingLabels,
22210
+ requestedSellShares: retryAmount,
22122
22211
  smartQuoteData: null,
22123
22212
  venueQuotes: [
22124
22213
  {
22125
- venue: selectedVenueQuote.request.venue,
22214
+ request: __spreadProps(__spreadValues({}, selectedVenueQuote.request), {
22215
+ sellShares: retryAmount
22216
+ }),
22126
22217
  quoteData: refetchedQuoteData
22127
22218
  }
22128
22219
  ]
22129
22220
  }) : isSell ? buildLiveSellRouteCards({
22130
22221
  eventVenues: scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue),
22131
22222
  labels: tradingLabels,
22223
+ requestedSellShares: retryAmount,
22132
22224
  smartQuoteData: refetchedQuoteData,
22133
22225
  venueQuotes: []
22134
22226
  }) : buildLiveRouteCards({
@@ -22261,6 +22353,8 @@ var PlaceOrder = ({
22261
22353
  const handleFillSellableShares = () => {
22262
22354
  if (!isSell) return;
22263
22355
  if (maxSellableShares <= 0) return;
22356
+ setSelectedRouteCardId(PLACE_ORDER_MAXIMIZE_PAYOUT_ROUTE_ID);
22357
+ setIsSplitDetailOpen(false);
22264
22358
  handleAmountChange(maxSellableShares);
22265
22359
  };
22266
22360
  const handleExecutionTypeChange = (nextType) => {
@@ -26543,10 +26637,10 @@ var HomePage = ({
26543
26637
  HomePage.displayName = "HomePage";
26544
26638
 
26545
26639
  // src/pages/user-profile/index.tsx
26546
- var import_hooks76 = require("@agg-build/hooks");
26547
- var import_sdk25 = require("@agg-build/sdk");
26640
+ var import_hooks77 = require("@agg-build/hooks");
26641
+ var import_sdk26 = require("@agg-build/sdk");
26548
26642
  var import_dayjs9 = __toESM(require("dayjs"));
26549
- var import_react48 = require("react");
26643
+ var import_react49 = require("react");
26550
26644
 
26551
26645
  // src/pages/user-profile/chain-display.ts
26552
26646
  var CHAIN_ID_TO_LABEL = {
@@ -26623,7 +26717,9 @@ var AvailableBalanceCard = ({
26623
26717
  reservedValueLabel,
26624
26718
  chains,
26625
26719
  isLoading = false,
26626
- className
26720
+ className,
26721
+ onManage,
26722
+ manageButtonRef
26627
26723
  }) => {
26628
26724
  const labels = (0, import_hooks70.useLabels)();
26629
26725
  const balanceLabels = labels.userProfile.balance;
@@ -26638,28 +26734,23 @@ var AvailableBalanceCard = ({
26638
26734
  className
26639
26735
  ),
26640
26736
  children: [
26641
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-2", children: [
26642
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
26643
- "svg",
26737
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: [
26738
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-2", children: [
26739
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "wallet", size: "small", className: "size-4 text-agg-muted-foreground" }),
26740
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
26741
+ ] }),
26742
+ onManage ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
26743
+ "button",
26644
26744
  {
26645
- xmlns: "http://www.w3.org/2000/svg",
26646
- width: "16",
26647
- height: "16",
26648
- viewBox: "0 0 16 16",
26649
- fill: "none",
26650
- "aria-hidden": "true",
26651
- focusable: "false",
26652
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
26653
- "path",
26654
- {
26655
- d: "M14 4.00065H3.33333C2.76067 4.00065 2.21867 3.75265 1.84333 3.33465C2.21 2.92532 2.74267 2.66732 3.33333 2.66732H15.3333C15.702 2.66732 16 2.36865 16 2.00065C16 1.63265 15.702 1.33398 15.3333 1.33398H3.33333C1.49267 1.33398 0 2.82665 0 4.66732V11.334C0 13.1747 1.49267 14.6673 3.33333 14.6673H14C15.1047 14.6673 16 13.772 16 12.6673V6.00065C16 4.89598 15.1047 4.00065 14 4.00065ZM14.6667 12.6673C14.6667 13.0347 14.368 13.334 14 13.334H3.33333C2.23067 13.334 1.33333 12.4367 1.33333 11.334V4.66598C1.90267 5.09198 2.60267 5.33398 3.33333 5.33398H14C14.368 5.33398 14.6667 5.63332 14.6667 6.00065V12.6673ZM13.3333 9.33399C13.3333 9.70199 13.0347 10.0007 12.6667 10.0007C12.2987 10.0007 12 9.70199 12 9.33399C12 8.96599 12.2987 8.66732 12.6667 8.66732C13.0347 8.66732 13.3333 8.96599 13.3333 9.33399Z",
26656
- fill: "#9D9FAF"
26657
- }
26658
- )
26745
+ ref: manageButtonRef,
26746
+ type: "button",
26747
+ "aria-haspopup": "dialog",
26748
+ className: "cursor-pointer rounded-agg-sm font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-primary outline-none hover:text-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover",
26749
+ onClick: onManage,
26750
+ children: balanceLabels.manage
26659
26751
  }
26660
- ),
26661
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
26662
- ] }) }),
26752
+ ) : null
26753
+ ] }),
26663
26754
  /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
26664
26755
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
26665
26756
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
@@ -26774,147 +26865,853 @@ var AvailableBalanceCard = ({
26774
26865
  ]
26775
26866
  }
26776
26867
  )
26777
- }
26778
- )
26779
- ] }),
26780
- !isLoading && reservedValueLabel ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "font-agg-sans text-agg-xs leading-agg-4 text-agg-muted-foreground", children: balanceLabels.reservedForOpenOrders(reservedValueLabel) }) : null
26868
+ }
26869
+ )
26870
+ ] }),
26871
+ !isLoading && reservedValueLabel ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "font-agg-sans text-agg-xs leading-agg-4 text-agg-muted-foreground", children: balanceLabels.reservedForOpenOrders(reservedValueLabel) }) : null
26872
+ ]
26873
+ }
26874
+ );
26875
+ };
26876
+ AvailableBalanceCard.displayName = "AvailableBalanceCard";
26877
+
26878
+ // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
26879
+ var import_hooks71 = require("@agg-build/hooks");
26880
+ var import_sdk24 = require("@agg-build/sdk");
26881
+ var import_jsx_runtime167 = require("react/jsx-runtime");
26882
+ var CLAIM_VENUE_LABELS = {
26883
+ [import_sdk24.Venue.kalshi]: "Kalshi",
26884
+ [import_sdk24.Venue.polymarket]: "Polymarket",
26885
+ [import_sdk24.Venue.limitless]: "Limitless",
26886
+ [import_sdk24.Venue.opinion]: "Opinion",
26887
+ [import_sdk24.Venue.predict]: "Predict",
26888
+ [import_sdk24.Venue.probable]: "Probable",
26889
+ [import_sdk24.Venue.myriad]: "Myriad",
26890
+ [import_sdk24.Venue.hyperliquid]: "Hyperliquid"
26891
+ };
26892
+ var ClaimActivityBreakdownModal = ({
26893
+ activity,
26894
+ onOpenChange,
26895
+ onTransactionSelect
26896
+ }) => {
26897
+ var _a;
26898
+ const labels = (0, import_hooks71.useLabels)();
26899
+ return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26900
+ Modal,
26901
+ {
26902
+ open: activity !== null,
26903
+ onOpenChange,
26904
+ "aria-label": labels.userProfile.activity.claimBreakdownModalAriaLabel,
26905
+ children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
26906
+ Modal.Container,
26907
+ {
26908
+ maxWidth: "600px",
26909
+ "aria-label": labels.userProfile.activity.claimBreakdownModalAriaLabel,
26910
+ children: [
26911
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26912
+ Modal.Header,
26913
+ {
26914
+ title: (_a = activity == null ? void 0 : activity.title) != null ? _a : "",
26915
+ classNames: {
26916
+ root: "border-b-0!",
26917
+ container: "px-4 py-4 sm:px-8 sm:pt-7 sm:pb-3",
26918
+ title: "text-2xl leading-8"
26919
+ }
26920
+ }
26921
+ ),
26922
+ activity ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(Modal.Body, { classNames: { root: "px-4 pt-0 pb-4 sm:px-8 sm:pt-0 sm:pb-7" }, children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex flex-col gap-6", children: [
26923
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
26924
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-1.5 text-agg-sm leading-5 text-agg-foreground", children: activity.outcomeLabel }),
26925
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "min-w-0 flex-1 text-agg-sm leading-5 text-agg-foreground", children: activity.marketTitle })
26926
+ ] }),
26927
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("div", { className: "flex flex-col", children: activity.transactions.map((transaction, index) => {
26928
+ var _a2;
26929
+ const isInteractive = Boolean(transaction.txHash && transaction.chainId);
26930
+ return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { children: [
26931
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
26932
+ "button",
26933
+ {
26934
+ type: "button",
26935
+ className: [
26936
+ "flex w-full items-center justify-between gap-6 rounded-agg-lg px-3 py-2 text-left transition-colors",
26937
+ "bg-transparent hover:bg-agg-secondary-hover",
26938
+ isInteractive ? "cursor-pointer" : "cursor-default"
26939
+ ].join(" "),
26940
+ "aria-label": labels.userProfile.activity.claimBreakdownTransactionLinkAria(
26941
+ transaction.venue
26942
+ ),
26943
+ disabled: !isInteractive,
26944
+ onClick: () => {
26945
+ if (!isInteractive) return;
26946
+ onTransactionSelect(transaction);
26947
+ },
26948
+ children: [
26949
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "min-w-0 flex flex-1 flex-col gap-2", children: [
26950
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex items-center gap-2", children: [
26951
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26952
+ VenueLogo,
26953
+ {
26954
+ venue: transaction.venue,
26955
+ size: "small",
26956
+ className: "shrink-0"
26957
+ }
26958
+ ),
26959
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "text-agg-sm leading-5 text-agg-foreground", children: (_a2 = CLAIM_VENUE_LABELS[transaction.venue]) != null ? _a2 : transaction.venue })
26960
+ ] }),
26961
+ transaction.hasError && transaction.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26962
+ Tooltip,
26963
+ {
26964
+ size: "medium",
26965
+ content: transaction.errorMessage,
26966
+ sideOffset: 4,
26967
+ children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex items-center gap-2 text-agg-error!", children: [
26968
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26969
+ Icon,
26970
+ {
26971
+ name: "circle-xmark",
26972
+ size: "small",
26973
+ className: "size-3! text-agg-error!"
26974
+ }
26975
+ ),
26976
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "truncate text-agg-sm leading-5 text-agg-error!", children: transaction.errorMessage })
26977
+ ] })
26978
+ }
26979
+ ) : /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "text-agg-sm leading-5 text-agg-muted-foreground", children: transaction.transactionLabel })
26980
+ ] }),
26981
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex shrink-0 items-center gap-3", children: [
26982
+ /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "text-agg-sm font-agg-bold leading-5 text-agg-foreground", children: transaction.amountLabel }),
26983
+ isInteractive ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26984
+ Icon,
26985
+ {
26986
+ name: "external-link",
26987
+ size: "small",
26988
+ className: "text-agg-muted-foreground"
26989
+ }
26990
+ ) : null
26991
+ ] })
26992
+ ]
26993
+ }
26994
+ ),
26995
+ index < activity.transactions.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("div", { className: "my-1 h-px w-full bg-agg-separator", "aria-hidden": true }) : null
26996
+ ] }, transaction.id);
26997
+ }) })
26998
+ ] }) }) : null
26999
+ ]
27000
+ }
27001
+ )
27002
+ }
27003
+ );
27004
+ };
27005
+
27006
+ // src/pages/user-profile/components/manage-balances-modal.tsx
27007
+ var import_hooks72 = require("@agg-build/hooks");
27008
+ var import_sdk25 = require("@agg-build/sdk");
27009
+ var Dialog8 = __toESM(require("@radix-ui/react-dialog"));
27010
+ var import_react47 = require("react");
27011
+ var import_zod2 = require("zod");
27012
+ var import_jsx_runtime168 = require("react/jsx-runtime");
27013
+ var USDC_DECIMALS = 6;
27014
+ var EDITABLE_AMOUNT_PATTERN = /^\d*(?:\.\d{0,6})?$/;
27015
+ var FINAL_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
27016
+ var NETWORK_PRESENTATION = {
27017
+ 137: { name: "Polygon", order: 0, venues: [import_sdk25.Venue.polymarket] },
27018
+ 56: { name: "BNB", order: 1, venues: [import_sdk25.Venue.limitless, import_sdk25.Venue.myriad] },
27019
+ 792703809: { name: "Solana", order: 2, venues: [import_sdk25.Venue.kalshi] },
27020
+ 1337: { name: "Hyperliquid", order: 3, venues: [import_sdk25.Venue.hyperliquid] },
27021
+ 42161: { name: "Arbitrum", order: 4, venues: [] },
27022
+ 8453: { name: "Base", order: 5, venues: [] },
27023
+ 1: { name: "Ethereum", order: 6, venues: [] }
27024
+ };
27025
+ var VENUE_LABELS = {
27026
+ [import_sdk25.Venue.kalshi]: "Kalshi",
27027
+ [import_sdk25.Venue.limitless]: "Limitless",
27028
+ [import_sdk25.Venue.opinion]: "Opinion",
27029
+ [import_sdk25.Venue.polymarket]: "Polymarket",
27030
+ [import_sdk25.Venue.predict]: "Predict",
27031
+ [import_sdk25.Venue.probable]: "Probable",
27032
+ [import_sdk25.Venue.myriad]: "Myriad",
27033
+ [import_sdk25.Venue.hyperliquid]: "Hyperliquid"
27034
+ };
27035
+ var amountSchema = import_zod2.z.string().min(1).regex(FINAL_AMOUNT_PATTERN);
27036
+ var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
27037
+ const parsed = amountSchema.safeParse(value.trim());
27038
+ if (!parsed.success) return null;
27039
+ const [whole = "0", fraction = ""] = parsed.data.split(".");
27040
+ const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
27041
+ const normalizedWhole = whole.replace(/^0+(?=\d)/, "") || "0";
27042
+ return BigInt(`${normalizedWhole}${paddedFraction}`).toString();
27043
+ };
27044
+ var rawToDecimal = (rawValue, decimals = USDC_DECIMALS) => {
27045
+ const normalizedRaw = rawValue.replace(/^0+(?=\d)/, "") || "0";
27046
+ const paddedRaw = normalizedRaw.padStart(decimals + 1, "0");
27047
+ const whole = paddedRaw.slice(0, -decimals);
27048
+ const fraction = paddedRaw.slice(-decimals).replace(/0+$/, "");
27049
+ return fraction ? `${whole}.${fraction}` : whole;
27050
+ };
27051
+ var getInitialDraft = (policy) => {
27052
+ if ((policy == null ? void 0 : policy.status) !== "enabled") return { minimum: "0", refillTo: "0" };
27053
+ return {
27054
+ minimum: rawToDecimal(policy.minimumRaw),
27055
+ refillTo: rawToDecimal(policy.refillAmountRaw)
27056
+ };
27057
+ };
27058
+ var areDraftsEqual = (current, initial) => {
27059
+ const currentMinimumRaw = decimalToRaw(current.minimum);
27060
+ const currentRefillToRaw = decimalToRaw(current.refillTo);
27061
+ const initialMinimumRaw = decimalToRaw(initial.minimum);
27062
+ const initialRefillToRaw = decimalToRaw(initial.refillTo);
27063
+ return currentMinimumRaw !== null && currentRefillToRaw !== null && currentMinimumRaw === initialMinimumRaw && currentRefillToRaw === initialRefillToRaw;
27064
+ };
27065
+ var getPolicyMaximumRaw = (policy) => {
27066
+ if (!(policy == null ? void 0 : policy.dailyCapRaw) || !policy.maxFeeRaw) return null;
27067
+ const dailyCapRaw = BigInt(policy.dailyCapRaw);
27068
+ const maximumFeeRaw = BigInt(policy.maxFeeRaw);
27069
+ if (dailyCapRaw <= maximumFeeRaw) return "0";
27070
+ return (dailyCapRaw - maximumFeeRaw).toString();
27071
+ };
27072
+ var getApiFieldErrors = (error) => {
27073
+ var _a;
27074
+ if (!(error instanceof Error)) return [];
27075
+ return (_a = error.errors) != null ? _a : [];
27076
+ };
27077
+ var getApiErrorMessage = (error, fallback) => {
27078
+ if (!(error instanceof Error) || !error.message.trim()) return fallback;
27079
+ return error.message;
27080
+ };
27081
+ var ManageBalancesModal = ({
27082
+ open,
27083
+ onOpenChange
27084
+ }) => {
27085
+ const labels = (0, import_hooks72.useLabels)();
27086
+ const refillLabels = labels.balanceRefill;
27087
+ const balanceState = (0, import_hooks72.useAggBalance)();
27088
+ const depositAddressesQuery = (0, import_hooks72.useDepositAddresses)({ enabled: open });
27089
+ const policiesQuery = (0, import_hooks72.useBalanceRefillPolicies)({ enabled: open });
27090
+ const toastContext = useOptionalToast();
27091
+ const descriptionId = (0, import_react47.useId)();
27092
+ const savingRef = (0, import_react47.useRef)(false);
27093
+ const [expandedChainIds, setExpandedChainIds] = (0, import_react47.useState)(/* @__PURE__ */ new Set());
27094
+ const [resetChainIds, setResetChainIds] = (0, import_react47.useState)(/* @__PURE__ */ new Set());
27095
+ const [drafts, setDrafts] = (0, import_react47.useState)({});
27096
+ const [initialDrafts, setInitialDrafts] = (0, import_react47.useState)({});
27097
+ const [submissionErrors, setSubmissionErrors] = (0, import_react47.useState)({});
27098
+ const [isInitialized, setIsInitialized] = (0, import_react47.useState)(false);
27099
+ const [isSaving, setIsSaving] = (0, import_react47.useState)(false);
27100
+ const networks = (0, import_react47.useMemo)(() => {
27101
+ var _a, _b, _c;
27102
+ const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
27103
+ const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
27104
+ return supportedChains.flatMap((chain) => {
27105
+ var _a2, _b2;
27106
+ const usdcToken = chain.tokens.find((token) => token.symbol.toUpperCase() === "USDC");
27107
+ if (!usdcToken) return [];
27108
+ const presentation = NETWORK_PRESENTATION[chain.chainId];
27109
+ const chainBalance = availableBalanceBreakdown.find(
27110
+ (balance) => balance.key === String(chain.chainId)
27111
+ );
27112
+ return [
27113
+ {
27114
+ chainId: chain.chainId,
27115
+ name: (_a2 = presentation == null ? void 0 : presentation.name) != null ? _a2 : chain.name,
27116
+ balance: chainBalance == null ? void 0 : chainBalance.balance,
27117
+ policy: policiesQuery.policies.find(
27118
+ (policy) => policy.targetChainId === chain.chainId && policy.targetTokenSymbol.toUpperCase() === "USDC"
27119
+ ),
27120
+ venues: (_b2 = presentation == null ? void 0 : presentation.venues) != null ? _b2 : []
27121
+ }
27122
+ ];
27123
+ }).sort((left, right) => {
27124
+ var _a2, _b2, _c2, _d;
27125
+ const leftOrder = (_b2 = (_a2 = NETWORK_PRESENTATION[left.chainId]) == null ? void 0 : _a2.order) != null ? _b2 : Number.MAX_SAFE_INTEGER;
27126
+ const rightOrder = (_d = (_c2 = NETWORK_PRESENTATION[right.chainId]) == null ? void 0 : _c2.order) != null ? _d : Number.MAX_SAFE_INTEGER;
27127
+ if (leftOrder !== rightOrder) return leftOrder - rightOrder;
27128
+ return left.name.localeCompare(right.name);
27129
+ });
27130
+ }, [
27131
+ balanceState.availableBalanceBreakdown,
27132
+ balanceState.balanceBreakdown,
27133
+ depositAddressesQuery.supportedChains,
27134
+ policiesQuery.policies
27135
+ ]);
27136
+ const isLoading = depositAddressesQuery.isLoading || policiesQuery.isLoading || balanceState.isLoading || open && !depositAddressesQuery.isReady && !depositAddressesQuery.isError && !depositAddressesQuery.isTimedOut;
27137
+ const hasDepositAddressesLoadError = !depositAddressesQuery.isReady && (depositAddressesQuery.isError || depositAddressesQuery.isTimedOut);
27138
+ const hasPoliciesLoadError = policiesQuery.isError && policiesQuery.data === void 0;
27139
+ const loadError = hasDepositAddressesLoadError ? depositAddressesQuery.error : hasPoliciesLoadError ? policiesQuery.error : balanceState.error;
27140
+ const hasLoadError = hasDepositAddressesLoadError || hasPoliciesLoadError || Boolean(balanceState.error);
27141
+ (0, import_react47.useEffect)(() => {
27142
+ if (open) return;
27143
+ setExpandedChainIds(/* @__PURE__ */ new Set());
27144
+ setResetChainIds(/* @__PURE__ */ new Set());
27145
+ setDrafts({});
27146
+ setInitialDrafts({});
27147
+ setSubmissionErrors({});
27148
+ setIsInitialized(false);
27149
+ setIsSaving(false);
27150
+ savingRef.current = false;
27151
+ }, [open]);
27152
+ (0, import_react47.useEffect)(() => {
27153
+ if (!open || isLoading || hasLoadError || isInitialized) return;
27154
+ const nextDrafts = Object.fromEntries(
27155
+ networks.map((network) => [network.chainId, getInitialDraft(network.policy)])
27156
+ );
27157
+ setDrafts(nextDrafts);
27158
+ setInitialDrafts(nextDrafts);
27159
+ setIsInitialized(true);
27160
+ }, [hasLoadError, isInitialized, isLoading, networks, open]);
27161
+ const validateDraft = (0, import_react47.useCallback)(
27162
+ (network, draft) => {
27163
+ const errors = {};
27164
+ const minimum = draft.minimum.trim();
27165
+ const refillTo = draft.refillTo.trim();
27166
+ if (!minimum) {
27167
+ errors.minimum = refillLabels.requiredError;
27168
+ } else if (!FINAL_AMOUNT_PATTERN.test(minimum)) {
27169
+ errors.minimum = refillLabels.precisionError;
27170
+ }
27171
+ if (!refillTo) {
27172
+ errors.refillTo = refillLabels.requiredError;
27173
+ } else if (!FINAL_AMOUNT_PATTERN.test(refillTo)) {
27174
+ errors.refillTo = refillLabels.precisionError;
27175
+ }
27176
+ const minimumRaw = decimalToRaw(minimum);
27177
+ const refillToRaw = decimalToRaw(refillTo);
27178
+ if (minimumRaw === "0") errors.minimum = refillLabels.positiveError;
27179
+ if (refillToRaw === "0") errors.refillTo = refillLabels.positiveError;
27180
+ if (minimumRaw !== null && refillToRaw !== null && BigInt(refillToRaw) < BigInt(minimumRaw)) {
27181
+ errors.refillTo = refillLabels.relationshipError;
27182
+ }
27183
+ const maximumRaw = getPolicyMaximumRaw(network.policy);
27184
+ if (maximumRaw !== null) {
27185
+ const maximumLabel = rawToDecimal(maximumRaw);
27186
+ if (minimumRaw !== null && BigInt(minimumRaw) > BigInt(maximumRaw)) {
27187
+ errors.minimum = refillLabels.maximumError(maximumLabel);
27188
+ }
27189
+ if (refillToRaw !== null && BigInt(refillToRaw) > BigInt(maximumRaw)) {
27190
+ errors.refillTo = refillLabels.maximumError(maximumLabel);
27191
+ }
27192
+ }
27193
+ return errors;
27194
+ },
27195
+ [refillLabels]
27196
+ );
27197
+ const dirtyNetworks = (0, import_react47.useMemo)(
27198
+ () => networks.filter((network) => {
27199
+ if (network.venues.length === 0) return false;
27200
+ if (resetChainIds.has(network.chainId)) return true;
27201
+ const draft = drafts[network.chainId];
27202
+ const initialDraft = initialDrafts[network.chainId];
27203
+ if (!draft || !initialDraft) return false;
27204
+ return !areDraftsEqual(draft, initialDraft);
27205
+ }),
27206
+ [drafts, initialDrafts, networks, resetChainIds]
27207
+ );
27208
+ const validationErrors = (0, import_react47.useMemo)(
27209
+ () => Object.fromEntries(
27210
+ dirtyNetworks.map((network) => {
27211
+ var _a;
27212
+ return [
27213
+ network.chainId,
27214
+ resetChainIds.has(network.chainId) ? {} : validateDraft(network, (_a = drafts[network.chainId]) != null ? _a : getInitialDraft(network.policy))
27215
+ ];
27216
+ })
27217
+ ),
27218
+ [dirtyNetworks, drafts, resetChainIds, validateDraft]
27219
+ );
27220
+ const hasValidationErrors = Object.values(validationErrors).some(
27221
+ (errors) => errors.minimum || errors.refillTo || errors.general
27222
+ );
27223
+ const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
27224
+ const handleOpenChange = (0, import_react47.useCallback)(
27225
+ (nextOpen) => {
27226
+ if (isSaving && !nextOpen) return;
27227
+ onOpenChange(nextOpen);
27228
+ },
27229
+ [isSaving, onOpenChange]
27230
+ );
27231
+ const handleToggleNetwork = (0, import_react47.useCallback)((chainId, canManageBalance) => {
27232
+ if (!canManageBalance) return;
27233
+ setExpandedChainIds((current) => {
27234
+ const next = new Set(current);
27235
+ if (next.has(chainId)) next.delete(chainId);
27236
+ else next.add(chainId);
27237
+ return next;
27238
+ });
27239
+ }, []);
27240
+ const handleDraftChange = (0, import_react47.useCallback)(
27241
+ (chainId, field, value) => {
27242
+ if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
27243
+ setDrafts((current) => {
27244
+ var _a;
27245
+ const currentDraft = (_a = current[chainId]) != null ? _a : { minimum: "0", refillTo: "0" };
27246
+ const nextDraft = __spreadProps(__spreadValues({}, currentDraft), { [field]: value });
27247
+ if (field === "minimum") {
27248
+ const minimumRaw = decimalToRaw(value);
27249
+ const refillToRaw = decimalToRaw(currentDraft.refillTo);
27250
+ if (minimumRaw !== null && refillToRaw !== null && BigInt(minimumRaw) > BigInt(refillToRaw)) {
27251
+ nextDraft.refillTo = value;
27252
+ }
27253
+ }
27254
+ return __spreadProps(__spreadValues({}, current), { [chainId]: nextDraft });
27255
+ });
27256
+ setResetChainIds((current) => {
27257
+ if (!current.has(chainId)) return current;
27258
+ const next = new Set(current);
27259
+ next.delete(chainId);
27260
+ return next;
27261
+ });
27262
+ setSubmissionErrors((current) => {
27263
+ if (!current[chainId]) return current;
27264
+ return __spreadProps(__spreadValues({}, current), { [chainId]: {} });
27265
+ });
27266
+ },
27267
+ []
27268
+ );
27269
+ const handleResetNetwork = (0, import_react47.useCallback)((network) => {
27270
+ setDrafts((current) => __spreadProps(__spreadValues({}, current), {
27271
+ [network.chainId]: { minimum: "0", refillTo: "0" }
27272
+ }));
27273
+ setResetChainIds((current) => {
27274
+ var _a;
27275
+ const next = new Set(current);
27276
+ if (((_a = network.policy) == null ? void 0 : _a.status) === "enabled") next.add(network.chainId);
27277
+ else next.delete(network.chainId);
27278
+ return next;
27279
+ });
27280
+ setSubmissionErrors((current) => {
27281
+ if (!current[network.chainId]) return current;
27282
+ return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
27283
+ });
27284
+ }, []);
27285
+ const handleAmountBlur = (0, import_react47.useCallback)((chainId, field) => {
27286
+ setDrafts((current) => {
27287
+ const currentDraft = current[chainId];
27288
+ if (!currentDraft) return current;
27289
+ const rawValue = decimalToRaw(currentDraft[field]);
27290
+ if (rawValue === null) return current;
27291
+ return __spreadProps(__spreadValues({}, current), {
27292
+ [chainId]: __spreadProps(__spreadValues({}, currentDraft), { [field]: rawToDecimal(rawValue) })
27293
+ });
27294
+ });
27295
+ }, []);
27296
+ const handleRetry = (0, import_react47.useCallback)(() => {
27297
+ void depositAddressesQuery.refetch();
27298
+ void policiesQuery.refetch();
27299
+ balanceState.refetch();
27300
+ }, [balanceState, depositAddressesQuery, policiesQuery]);
27301
+ const handleSave = (0, import_react47.useCallback)(() => __async(null, null, function* () {
27302
+ if (savingRef.current || isSaveDisabled) return;
27303
+ savingRef.current = true;
27304
+ setIsSaving(true);
27305
+ setSubmissionErrors({});
27306
+ const nextInitialDrafts = __spreadValues({}, initialDrafts);
27307
+ const nextResetChainIds = new Set(resetChainIds);
27308
+ let failureCount = 0;
27309
+ yield Promise.all(
27310
+ dirtyNetworks.map((network) => __async(null, null, function* () {
27311
+ const draft = drafts[network.chainId];
27312
+ if (!draft) return;
27313
+ try {
27314
+ const isResetting = resetChainIds.has(network.chainId);
27315
+ const minimumRaw = decimalToRaw(draft.minimum);
27316
+ const refillAmountRaw = decimalToRaw(draft.refillTo);
27317
+ let savedPolicy;
27318
+ if (isResetting) {
27319
+ if (!network.policy) return;
27320
+ savedPolicy = yield policiesQuery.updatePolicy.mutateAsync({
27321
+ policyId: network.policy.id,
27322
+ params: { status: "paused" }
27323
+ });
27324
+ } else {
27325
+ if (minimumRaw === null || refillAmountRaw === null) return;
27326
+ savedPolicy = network.policy ? yield policiesQuery.updatePolicy.mutateAsync({
27327
+ policyId: network.policy.id,
27328
+ params: { minimumRaw, refillAmountRaw, status: "enabled" }
27329
+ }) : yield policiesQuery.createPolicy.mutateAsync({
27330
+ targetChainId: network.chainId,
27331
+ targetTokenSymbol: "USDC",
27332
+ minimumRaw,
27333
+ refillAmountRaw
27334
+ });
27335
+ }
27336
+ nextInitialDrafts[network.chainId] = getInitialDraft(savedPolicy);
27337
+ nextResetChainIds.delete(network.chainId);
27338
+ } catch (error) {
27339
+ failureCount += 1;
27340
+ const fieldErrors = getApiFieldErrors(error);
27341
+ const nextErrors = {};
27342
+ fieldErrors.forEach((fieldError) => {
27343
+ if (!fieldError.message) return;
27344
+ if (fieldError.field === "minimumRaw") nextErrors.minimum = fieldError.message;
27345
+ else if (fieldError.field === "refillAmountRaw") {
27346
+ nextErrors.refillTo = fieldError.message;
27347
+ } else nextErrors.general = fieldError.message;
27348
+ });
27349
+ if (!nextErrors.minimum && !nextErrors.refillTo && !nextErrors.general) {
27350
+ nextErrors.general = getApiErrorMessage(error, refillLabels.saveError);
27351
+ }
27352
+ setSubmissionErrors((current) => __spreadProps(__spreadValues({}, current), {
27353
+ [network.chainId]: nextErrors
27354
+ }));
27355
+ }
27356
+ }))
27357
+ );
27358
+ setInitialDrafts(nextInitialDrafts);
27359
+ setResetChainIds(nextResetChainIds);
27360
+ if (failureCount === 0) {
27361
+ yield policiesQuery.refetch();
27362
+ toastContext == null ? void 0 : toastContext.toast(refillLabels.saved, { tone: "success" });
27363
+ } else {
27364
+ toastContext == null ? void 0 : toastContext.toast(refillLabels.saveError, { tone: "error" });
27365
+ }
27366
+ savingRef.current = false;
27367
+ setIsSaving(false);
27368
+ }), [
27369
+ dirtyNetworks,
27370
+ drafts,
27371
+ initialDrafts,
27372
+ isSaveDisabled,
27373
+ policiesQuery,
27374
+ refillLabels,
27375
+ resetChainIds,
27376
+ toastContext
27377
+ ]);
27378
+ return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27379
+ Modal.Container,
27380
+ {
27381
+ maxWidth: "600px",
27382
+ "aria-label": refillLabels.manageTitle,
27383
+ classNames: {
27384
+ container: "max-h-[calc(100%-2rem)] border-0 ring-1 ring-inset ring-agg-separator md:max-h-[calc(100%-2rem)]"
27385
+ },
27386
+ children: [
27387
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27388
+ Modal.Header,
27389
+ {
27390
+ title: refillLabels.manageTitle,
27391
+ subtitle: refillLabels.manageDescription,
27392
+ hideBorder: true,
27393
+ classNames: {
27394
+ root: "static min-h-0 shrink-0",
27395
+ container: "relative items-start! px-8! pt-7! pb-0!",
27396
+ title: "text-agg-2xl leading-agg-8",
27397
+ titleContainer: "flex max-w-none! flex-col gap-2",
27398
+ subtitle: "text-agg-sm! leading-agg-5! text-agg-foreground!",
27399
+ close: "absolute top-7 right-8"
27400
+ }
27401
+ }
27402
+ ),
27403
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(Dialog8.Description, { className: "sr-only", children: refillLabels.manageDescription }),
27404
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(Modal.Body, { classNames: { root: "min-h-0 px-8! pt-6! pb-0!" }, children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { role: "status", "aria-label": refillLabels.modalLoading, className: "h-[448px]", children: Array.from({ length: 7 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27405
+ "div",
27406
+ {
27407
+ className: "flex h-16 items-center gap-3 border-b border-agg-separator last:border-b-0",
27408
+ children: [
27409
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SkeletonBlock, { className: "size-4 shrink-0 rounded-[4px]" }),
27410
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SkeletonBlock, { className: "h-5 w-20 rounded-agg-sm" }),
27411
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SkeletonBlock, { className: "h-6 w-20 rounded-agg-full" }),
27412
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SkeletonBlock, { className: "ml-auto h-4 w-20 rounded-agg-sm" }),
27413
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SkeletonBlock, { className: "h-5 w-12 rounded-agg-sm" }),
27414
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(SkeletonBlock, { className: "size-4 rounded-agg-sm" })
27415
+ ]
27416
+ },
27417
+ index
27418
+ )) }) : hasLoadError ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27419
+ StateMessage,
27420
+ {
27421
+ icon: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(Icon, { name: "error-filled" }),
27422
+ title: refillLabels.modalLoadError,
27423
+ description: getApiErrorMessage(loadError, refillLabels.modalLoadError),
27424
+ onAction: handleRetry,
27425
+ classNames: { root: "h-[448px] min-h-[448px]" }
27426
+ }
27427
+ ) : networks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27428
+ StateMessage,
27429
+ {
27430
+ icon: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(Icon, { name: "search-empty" }),
27431
+ title: refillLabels.modalEmptyTitle,
27432
+ description: refillLabels.modalEmptyDescription,
27433
+ classNames: { root: "h-[448px] min-h-[448px]" }
27434
+ }
27435
+ ) : /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex flex-col", role: "list", children: networks.map((network, networkIndex) => {
27436
+ var _a, _b, _c, _d, _e;
27437
+ const canManageBalance = network.venues.length > 0;
27438
+ const isExpanded = canManageBalance && expandedChainIds.has(network.chainId);
27439
+ const isLastNetwork = networkIndex === networks.length - 1;
27440
+ const isPendingReset = resetChainIds.has(network.chainId);
27441
+ const draft = (_a = drafts[network.chainId]) != null ? _a : getInitialDraft(network.policy);
27442
+ const initialDraft = (_b = initialDrafts[network.chainId]) != null ? _b : getInitialDraft(network.policy);
27443
+ const isDirty = isPendingReset || !areDraftsEqual(draft, initialDraft);
27444
+ const rowValidationErrors = isDirty ? (_c = validationErrors[network.chainId]) != null ? _c : {} : {};
27445
+ const rowSubmissionErrors = (_d = submissionErrors[network.chainId]) != null ? _d : {};
27446
+ const rowErrors = __spreadValues(__spreadValues({}, rowValidationErrors), rowSubmissionErrors);
27447
+ const isDraftValid = !rowValidationErrors.minimum && !rowValidationErrors.refillTo && !rowValidationErrors.general;
27448
+ const hasConfiguredAutoRefill = ((_e = network.policy) == null ? void 0 : _e.status) === "enabled" && !areDraftsEqual(initialDraft, { minimum: "0", refillTo: "0" });
27449
+ const hasDraftAutoRefill = isDirty && !isPendingReset && isDraftValid;
27450
+ const hasAutoRefill = !isPendingReset && (hasConfiguredAutoRefill || hasDraftAutoRefill);
27451
+ const minimumInputId = `${descriptionId}-${network.chainId}-minimum`;
27452
+ const refillToInputId = `${descriptionId}-${network.chainId}-refill-to`;
27453
+ const minimumErrorId = `${minimumInputId}-error`;
27454
+ const refillToErrorId = `${refillToInputId}-error`;
27455
+ const formattedBalance = network.balance === void 0 ? "$\u2014" : formatUsd(network.balance);
27456
+ return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27457
+ "div",
27458
+ {
27459
+ role: "listitem",
27460
+ className: cn(
27461
+ networkIndex > 0 && "pt-5",
27462
+ !isLastNetwork && "border-b border-agg-separator pb-5"
27463
+ ),
27464
+ children: [
27465
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27466
+ "button",
27467
+ {
27468
+ type: "button",
27469
+ "aria-expanded": isExpanded,
27470
+ "aria-controls": `${descriptionId}-${network.chainId}-settings`,
27471
+ "aria-label": isExpanded ? refillLabels.collapseNetwork(network.name) : refillLabels.expandNetwork(network.name),
27472
+ disabled: isSaving || !canManageBalance,
27473
+ className: cn(
27474
+ "group flex w-full cursor-pointer items-center gap-3 rounded-agg-sm text-left outline-none disabled:cursor-not-allowed focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-agg-primary-hover",
27475
+ canManageBalance ? "h-6" : "h-5"
27476
+ ),
27477
+ onClick: () => handleToggleNetwork(network.chainId, canManageBalance),
27478
+ children: [
27479
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
27480
+ chainIconUrl(network.name, String(network.chainId)) ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27481
+ "img",
27482
+ {
27483
+ src: chainIconUrl(network.name, String(network.chainId)),
27484
+ alt: "",
27485
+ "aria-hidden": "true",
27486
+ className: "size-4 shrink-0 rounded-[4px] object-contain"
27487
+ }
27488
+ ) : /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[8px] text-agg-muted-foreground", children: network.name.slice(0, 2).toUpperCase() }),
27489
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "truncate text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: network.name })
27490
+ ] }),
27491
+ network.venues.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "hidden min-w-0 items-center gap-2 min-[440px]:flex", children: network.venues.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27492
+ "span",
27493
+ {
27494
+ className: "flex h-6 shrink-0 items-center gap-1 rounded-agg-full bg-agg-secondary-hover px-3 text-agg-xs leading-agg-4 text-agg-foreground",
27495
+ children: [
27496
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(VenueLogo, { venue, size: "small", className: "size-3" }),
27497
+ VENUE_LABELS[venue]
27498
+ ]
27499
+ },
27500
+ venue
27501
+ )) }) : null,
27502
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("span", { className: "ml-auto flex shrink-0 items-center gap-4", children: [
27503
+ canManageBalance ? /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27504
+ "span",
27505
+ {
27506
+ className: cn(
27507
+ "hidden shrink-0 items-center gap-1.5 text-agg-xs leading-agg-4 min-[520px]:flex",
27508
+ hasAutoRefill ? "text-agg-foreground" : "text-agg-muted-foreground"
27509
+ ),
27510
+ children: [
27511
+ hasAutoRefill ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27512
+ Icon,
27513
+ {
27514
+ name: "success-check",
27515
+ size: "small",
27516
+ className: "size-2! text-agg-foreground"
27517
+ }
27518
+ ) : null,
27519
+ hasAutoRefill ? refillLabels.autoRefill : refillLabels.noAutoRefill
27520
+ ]
27521
+ }
27522
+ ) : null,
27523
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27524
+ "span",
27525
+ {
27526
+ title: formattedBalance,
27527
+ className: "w-[60px] shrink-0 truncate text-right text-agg-sm leading-agg-5 font-agg-bold tabular-nums text-agg-foreground",
27528
+ children: formattedBalance
27529
+ }
27530
+ ),
27531
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27532
+ Icon,
27533
+ {
27534
+ name: isExpanded ? "chevron-up" : "chevron-down",
27535
+ size: "small",
27536
+ className: cn(
27537
+ "size-4 shrink-0 text-agg-muted-foreground",
27538
+ canManageBalance ? "group-hover:text-agg-foreground" : "opacity-50"
27539
+ )
27540
+ }
27541
+ )
27542
+ ] })
27543
+ ]
27544
+ }
27545
+ ),
27546
+ isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { id: `${descriptionId}-${network.chainId}-settings`, className: "mt-4", children: [
27547
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2", children: [
27548
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-[174px] shrink-0 items-start gap-2", children: [
27549
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27550
+ "label",
27551
+ {
27552
+ htmlFor: minimumInputId,
27553
+ className: "flex h-8 w-[26px] shrink-0 items-center text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground",
27554
+ children: refillLabels.minimumShortLabel
27555
+ }
27556
+ ),
27557
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "w-[140px]", children: [
27558
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27559
+ "div",
27560
+ {
27561
+ className: cn(
27562
+ "flex h-8 items-center gap-2 rounded-agg-sm border bg-agg-secondary focus-within:ring-1 focus-within:ring-inset",
27563
+ rowErrors.minimum ? "border-agg-error focus-within:ring-agg-error" : "border-agg-separator focus-within:border-agg-primary focus-within:ring-agg-primary"
27564
+ ),
27565
+ children: [
27566
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27567
+ "input",
27568
+ {
27569
+ id: minimumInputId,
27570
+ type: "text",
27571
+ inputMode: "decimal",
27572
+ autoComplete: "off",
27573
+ value: draft.minimum,
27574
+ disabled: isSaving,
27575
+ "aria-invalid": Boolean(rowErrors.minimum),
27576
+ "aria-describedby": rowErrors.minimum ? minimumErrorId : void 0,
27577
+ className: "h-full min-w-0 flex-1 rounded-l-agg-sm border-0 bg-transparent pr-0 pl-3 text-agg-sm leading-agg-5 text-agg-foreground outline-none disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
27578
+ onChange: (event) => handleDraftChange(
27579
+ network.chainId,
27580
+ "minimum",
27581
+ event.target.value
27582
+ ),
27583
+ onBlur: () => handleAmountBlur(network.chainId, "minimum")
27584
+ }
27585
+ ),
27586
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "shrink-0 pr-3 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: refillLabels.unitLabel })
27587
+ ]
27588
+ }
27589
+ ),
27590
+ rowErrors.minimum ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27591
+ "p",
27592
+ {
27593
+ id: minimumErrorId,
27594
+ role: "alert",
27595
+ className: "mt-1 text-agg-xs leading-agg-4 text-agg-error",
27596
+ children: rowErrors.minimum
27597
+ }
27598
+ ) : null
27599
+ ] })
27600
+ ] }),
27601
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-[200px] shrink-0 items-start gap-2", children: [
27602
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27603
+ "label",
27604
+ {
27605
+ htmlFor: refillToInputId,
27606
+ className: "flex h-8 w-[52px] shrink-0 items-center text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground",
27607
+ children: refillLabels.refillToLabel
27608
+ }
27609
+ ),
27610
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "w-[140px]", children: [
27611
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27612
+ "div",
27613
+ {
27614
+ className: cn(
27615
+ "flex h-8 items-center gap-2 rounded-agg-sm border bg-agg-secondary focus-within:ring-1 focus-within:ring-inset",
27616
+ rowErrors.refillTo ? "border-agg-error focus-within:ring-agg-error" : "border-agg-separator focus-within:border-agg-primary focus-within:ring-agg-primary"
27617
+ ),
27618
+ children: [
27619
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27620
+ "input",
27621
+ {
27622
+ id: refillToInputId,
27623
+ type: "text",
27624
+ inputMode: "decimal",
27625
+ autoComplete: "off",
27626
+ value: draft.refillTo,
27627
+ disabled: isSaving,
27628
+ "aria-invalid": Boolean(rowErrors.refillTo),
27629
+ "aria-describedby": rowErrors.refillTo ? refillToErrorId : void 0,
27630
+ className: "h-full min-w-0 flex-1 rounded-l-agg-sm border-0 bg-transparent pr-0 pl-3 text-agg-sm leading-agg-5 text-agg-foreground outline-none disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
27631
+ onChange: (event) => handleDraftChange(
27632
+ network.chainId,
27633
+ "refillTo",
27634
+ event.target.value
27635
+ ),
27636
+ onBlur: () => handleAmountBlur(network.chainId, "refillTo")
27637
+ }
27638
+ ),
27639
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "shrink-0 pr-3 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: refillLabels.unitLabel })
27640
+ ]
27641
+ }
27642
+ ),
27643
+ rowErrors.refillTo ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27644
+ "p",
27645
+ {
27646
+ id: refillToErrorId,
27647
+ role: "alert",
27648
+ className: "mt-1 text-agg-xs leading-agg-4 text-agg-error",
27649
+ children: rowErrors.refillTo
27650
+ }
27651
+ ) : null
27652
+ ] })
27653
+ ] }),
27654
+ hasAutoRefill ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27655
+ "button",
27656
+ {
27657
+ type: "button",
27658
+ disabled: isSaving,
27659
+ className: "shrink-0 mt-1.5 cursor-pointer text-agg-sm leading-agg-5 font-agg-bold text-agg-primary outline-none hover:text-agg-primary-hover focus-visible:ring-2 focus-visible:ring-agg-primary-hover disabled:cursor-not-allowed disabled:opacity-60",
27660
+ onClick: () => handleResetNetwork(network),
27661
+ children: refillLabels.resetAction
27662
+ }
27663
+ ) : null
27664
+ ] }),
27665
+ rowErrors.general ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("p", { role: "alert", className: "mt-2 text-agg-xs leading-agg-4 text-agg-error", children: rowErrors.general }) : null
27666
+ ] }) : null
27667
+ ]
27668
+ },
27669
+ network.chainId
27670
+ );
27671
+ }) }) }),
27672
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27673
+ Modal.Footer,
27674
+ {
27675
+ hideBorder: true,
27676
+ classNames: {
27677
+ root: "h-[92px]! shrink-0 items-start! gap-3 px-8! pt-6! pb-7!"
27678
+ },
27679
+ children: [
27680
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27681
+ Button,
27682
+ {
27683
+ variant: "secondary",
27684
+ size: "large",
27685
+ className: "min-w-0 flex-1 md:w-[120px] md:flex-none",
27686
+ disabled: isSaving,
27687
+ onClick: () => handleOpenChange(false),
27688
+ children: refillLabels.cancelAction
27689
+ }
27690
+ ),
27691
+ /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27692
+ Button,
27693
+ {
27694
+ size: "large",
27695
+ className: "min-w-0 flex-1 md:w-[158px] md:flex-none",
27696
+ isLoading: isSaving,
27697
+ disabled: isSaveDisabled,
27698
+ "aria-label": refillLabels.saveChangesAction,
27699
+ onClick: () => void handleSave(),
27700
+ children: refillLabels.saveChangesAction
27701
+ }
27702
+ )
27703
+ ]
27704
+ }
27705
+ )
26781
27706
  ]
26782
27707
  }
26783
- );
26784
- };
26785
- AvailableBalanceCard.displayName = "AvailableBalanceCard";
26786
-
26787
- // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
26788
- var import_hooks71 = require("@agg-build/hooks");
26789
- var import_sdk24 = require("@agg-build/sdk");
26790
- var import_jsx_runtime167 = require("react/jsx-runtime");
26791
- var CLAIM_VENUE_LABELS = {
26792
- [import_sdk24.Venue.kalshi]: "Kalshi",
26793
- [import_sdk24.Venue.polymarket]: "Polymarket",
26794
- [import_sdk24.Venue.limitless]: "Limitless",
26795
- [import_sdk24.Venue.opinion]: "Opinion",
26796
- [import_sdk24.Venue.predict]: "Predict",
26797
- [import_sdk24.Venue.probable]: "Probable",
26798
- [import_sdk24.Venue.myriad]: "Myriad",
26799
- [import_sdk24.Venue.hyperliquid]: "Hyperliquid"
26800
- };
26801
- var ClaimActivityBreakdownModal = ({
26802
- activity,
26803
- onOpenChange,
26804
- onTransactionSelect
26805
- }) => {
26806
- var _a;
26807
- const labels = (0, import_hooks71.useLabels)();
26808
- return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26809
- Modal,
26810
- {
26811
- open: activity !== null,
26812
- onOpenChange,
26813
- "aria-label": labels.userProfile.activity.claimBreakdownModalAriaLabel,
26814
- children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
26815
- Modal.Container,
26816
- {
26817
- maxWidth: "600px",
26818
- "aria-label": labels.userProfile.activity.claimBreakdownModalAriaLabel,
26819
- children: [
26820
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26821
- Modal.Header,
26822
- {
26823
- title: (_a = activity == null ? void 0 : activity.title) != null ? _a : "",
26824
- classNames: {
26825
- root: "border-b-0!",
26826
- container: "px-4 py-4 sm:px-8 sm:pt-7 sm:pb-3",
26827
- title: "text-2xl leading-8"
26828
- }
26829
- }
26830
- ),
26831
- activity ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(Modal.Body, { classNames: { root: "px-4 pt-0 pb-4 sm:px-8 sm:pt-0 sm:pb-7" }, children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex flex-col gap-6", children: [
26832
- /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
26833
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-1.5 text-agg-sm leading-5 text-agg-foreground", children: activity.outcomeLabel }),
26834
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "min-w-0 flex-1 text-agg-sm leading-5 text-agg-foreground", children: activity.marketTitle })
26835
- ] }),
26836
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("div", { className: "flex flex-col", children: activity.transactions.map((transaction, index) => {
26837
- var _a2;
26838
- const isInteractive = Boolean(transaction.txHash && transaction.chainId);
26839
- return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { children: [
26840
- /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
26841
- "button",
26842
- {
26843
- type: "button",
26844
- className: [
26845
- "flex w-full items-center justify-between gap-6 rounded-agg-lg px-3 py-2 text-left transition-colors",
26846
- "bg-transparent hover:bg-agg-secondary-hover",
26847
- isInteractive ? "cursor-pointer" : "cursor-default"
26848
- ].join(" "),
26849
- "aria-label": labels.userProfile.activity.claimBreakdownTransactionLinkAria(
26850
- transaction.venue
26851
- ),
26852
- disabled: !isInteractive,
26853
- onClick: () => {
26854
- if (!isInteractive) return;
26855
- onTransactionSelect(transaction);
26856
- },
26857
- children: [
26858
- /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "min-w-0 flex flex-1 flex-col gap-2", children: [
26859
- /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex items-center gap-2", children: [
26860
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26861
- VenueLogo,
26862
- {
26863
- venue: transaction.venue,
26864
- size: "small",
26865
- className: "shrink-0"
26866
- }
26867
- ),
26868
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "text-agg-sm leading-5 text-agg-foreground", children: (_a2 = CLAIM_VENUE_LABELS[transaction.venue]) != null ? _a2 : transaction.venue })
26869
- ] }),
26870
- transaction.hasError && transaction.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26871
- Tooltip,
26872
- {
26873
- size: "medium",
26874
- content: transaction.errorMessage,
26875
- sideOffset: 4,
26876
- children: /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex items-center gap-2 text-agg-error!", children: [
26877
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26878
- Icon,
26879
- {
26880
- name: "circle-xmark",
26881
- size: "small",
26882
- className: "size-3! text-agg-error!"
26883
- }
26884
- ),
26885
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "truncate text-agg-sm leading-5 text-agg-error!", children: transaction.errorMessage })
26886
- ] })
26887
- }
26888
- ) : /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "text-agg-sm leading-5 text-agg-muted-foreground", children: transaction.transactionLabel })
26889
- ] }),
26890
- /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "flex shrink-0 items-center gap-3", children: [
26891
- /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("p", { className: "text-agg-sm font-agg-bold leading-5 text-agg-foreground", children: transaction.amountLabel }),
26892
- isInteractive ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
26893
- Icon,
26894
- {
26895
- name: "external-link",
26896
- size: "small",
26897
- className: "text-agg-muted-foreground"
26898
- }
26899
- ) : null
26900
- ] })
26901
- ]
26902
- }
26903
- ),
26904
- index < activity.transactions.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("div", { className: "my-1 h-px w-full bg-agg-separator", "aria-hidden": true }) : null
26905
- ] }, transaction.id);
26906
- }) })
26907
- ] }) }) : null
26908
- ]
26909
- }
26910
- )
26911
- }
26912
- );
27708
+ ) });
26913
27709
  };
27710
+ ManageBalancesModal.displayName = "ManageBalancesModal";
26914
27711
 
26915
27712
  // src/pages/user-profile/components/positions-activity.tsx
26916
- var import_hooks74 = require("@agg-build/hooks");
26917
- var import_react47 = require("react");
27713
+ var import_hooks75 = require("@agg-build/hooks");
27714
+ var import_react48 = require("react");
26918
27715
 
26919
27716
  // src/pages/user-profile/user-profile.constants.ts
26920
27717
  var USER_PROFILE_TAB_POSITIONS = "positions";
@@ -27114,7 +27911,7 @@ var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}
27114
27911
  };
27115
27912
 
27116
27913
  // src/pages/user-profile/components/activity-row.tsx
27117
- var import_jsx_runtime168 = require("react/jsx-runtime");
27914
+ var import_jsx_runtime169 = require("react/jsx-runtime");
27118
27915
  var shouldOpenInNewTab = (activity) => {
27119
27916
  return activity.kind === "redeem" || activity.kind === "deposit" || activity.kind === "withdrawal";
27120
27917
  };
@@ -27131,7 +27928,7 @@ var RowWrapper = ({
27131
27928
  }) => {
27132
27929
  if (href) {
27133
27930
  const opensInNewTab = target === "_blank";
27134
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27931
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27135
27932
  "a",
27136
27933
  {
27137
27934
  href,
@@ -27147,7 +27944,7 @@ var RowWrapper = ({
27147
27944
  }
27148
27945
  );
27149
27946
  }
27150
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("button", { type: "button", className, onClick, children });
27947
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("button", { type: "button", className, onClick, children });
27151
27948
  };
27152
27949
  var TRANSFER_ICON = {
27153
27950
  withdrawal: "upload",
@@ -27182,7 +27979,7 @@ var AmountTimeStack = ({
27182
27979
  timeLabel,
27183
27980
  tone,
27184
27981
  mobile
27185
- }) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
27982
+ }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
27186
27983
  "div",
27187
27984
  {
27188
27985
  className: cn(
@@ -27190,7 +27987,7 @@ var AmountTimeStack = ({
27190
27987
  mobile ? "sm:hidden" : "hidden sm:flex sm:w-[120px] sm:shrink-0"
27191
27988
  ),
27192
27989
  children: [
27193
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
27990
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27194
27991
  "p",
27195
27992
  {
27196
27993
  className: cn(
@@ -27201,7 +27998,7 @@ var AmountTimeStack = ({
27201
27998
  children: amountLabel
27202
27999
  }
27203
28000
  ),
27204
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28001
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27205
28002
  "p",
27206
28003
  {
27207
28004
  className: cn(
@@ -27218,9 +28015,9 @@ var AmountTimeStack = ({
27218
28015
  var TradeTypeCell = ({
27219
28016
  activity,
27220
28017
  tone
27221
- }) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
27222
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
27223
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28018
+ }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
28019
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
28020
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27224
28021
  "p",
27225
28022
  {
27226
28023
  className: cn(
@@ -27235,8 +28032,8 @@ var TradeTypeCell = ({
27235
28032
  var TransferTypeCell = ({
27236
28033
  activity,
27237
28034
  tone
27238
- }) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
27239
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28035
+ }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
28036
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27240
28037
  Icon,
27241
28038
  {
27242
28039
  name: TRANSFER_ICON[activity.kind],
@@ -27247,7 +28044,7 @@ var TransferTypeCell = ({
27247
28044
  )
27248
28045
  }
27249
28046
  ),
27250
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28047
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27251
28048
  "p",
27252
28049
  {
27253
28050
  className: cn(
@@ -27262,8 +28059,8 @@ var TransferTypeCell = ({
27262
28059
  var RedeemTypeCell = ({
27263
28060
  activity,
27264
28061
  tone
27265
- }) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
27266
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28062
+ }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
28063
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27267
28064
  Icon,
27268
28065
  {
27269
28066
  name: "gift-bonus",
@@ -27274,7 +28071,7 @@ var RedeemTypeCell = ({
27274
28071
  )
27275
28072
  }
27276
28073
  ),
27277
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28074
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27278
28075
  "p",
27279
28076
  {
27280
28077
  className: cn(
@@ -27291,7 +28088,7 @@ var OutcomeBadge = ({
27291
28088
  tone
27292
28089
  }) => {
27293
28090
  if (!label2) return null;
27294
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28091
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27295
28092
  "span",
27296
28093
  {
27297
28094
  className: cn(
@@ -27305,9 +28102,9 @@ var OutcomeBadge = ({
27305
28102
  var TradeOutcomeShares = ({
27306
28103
  activity,
27307
28104
  tone
27308
- }) => /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(import_jsx_runtime168.Fragment, { children: [
27309
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(OutcomeBadge, { label: activity.outcomeLabel, tone }),
27310
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28105
+ }) => /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(import_jsx_runtime169.Fragment, { children: [
28106
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(OutcomeBadge, { label: activity.outcomeLabel, tone }),
28107
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27311
28108
  "span",
27312
28109
  {
27313
28110
  className: cn(
@@ -27328,7 +28125,7 @@ var RedeemRow = ({
27328
28125
  const statusVisual = getStatusVisual(activity);
27329
28126
  const activityStatus = resolveActivityStatus(activity);
27330
28127
  const shouldShowInlineStatus = activityStatus === "pending";
27331
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28128
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27332
28129
  RowWrapper,
27333
28130
  {
27334
28131
  className,
@@ -27336,7 +28133,7 @@ var RedeemRow = ({
27336
28133
  target: href ? "_blank" : void 0,
27337
28134
  rel: href ? "noopener noreferrer" : void 0,
27338
28135
  onClick,
27339
- children: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
28136
+ children: /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
27340
28137
  "div",
27341
28138
  {
27342
28139
  className: cn(
@@ -27345,10 +28142,10 @@ var RedeemRow = ({
27345
28142
  ),
27346
28143
  "data-status": activityStatus,
27347
28144
  children: [
27348
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(RedeemTypeCell, { activity, tone }),
27349
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
27350
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex items-center gap-2", children: [
27351
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28145
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(RedeemTypeCell, { activity, tone }),
28146
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
28147
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex items-center gap-2", children: [
28148
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27352
28149
  Icon,
27353
28150
  {
27354
28151
  name: "gift-bonus",
@@ -27359,7 +28156,7 @@ var RedeemRow = ({
27359
28156
  )
27360
28157
  }
27361
28158
  ),
27362
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28159
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27363
28160
  "p",
27364
28161
  {
27365
28162
  className: cn(
@@ -27371,11 +28168,11 @@ var RedeemRow = ({
27371
28168
  }
27372
28169
  )
27373
28170
  ] }),
27374
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(OutcomeBadge, { label: activity.outcomeLabel, tone })
28171
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(OutcomeBadge, { label: activity.outcomeLabel, tone })
27375
28172
  ] }),
27376
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
27377
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
27378
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28173
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
28174
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
28175
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27379
28176
  RemoteImage,
27380
28177
  {
27381
28178
  src: activity.thumbnailSrc,
@@ -27384,9 +28181,9 @@ var RedeemRow = ({
27384
28181
  classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
27385
28182
  }
27386
28183
  ) }),
27387
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
27388
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
27389
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28184
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
28185
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
28186
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27390
28187
  "p",
27391
28188
  {
27392
28189
  className: cn(
@@ -27396,13 +28193,13 @@ var RedeemRow = ({
27396
28193
  children: activity.title
27397
28194
  }
27398
28195
  ),
27399
- shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28196
+ shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27400
28197
  LoadingIcon,
27401
28198
  {
27402
28199
  size: "small",
27403
28200
  className: cn("shrink-0", statusVisual.iconClassName)
27404
28201
  }
27405
- ) : /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28202
+ ) : /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27406
28203
  Icon,
27407
28204
  {
27408
28205
  name: statusVisual.icon,
@@ -27411,9 +28208,9 @@ var RedeemRow = ({
27411
28208
  }
27412
28209
  ) : null
27413
28210
  ] }),
27414
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
27415
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "hidden sm:block", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
27416
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28211
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
28212
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "hidden sm:block", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
28213
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27417
28214
  "p",
27418
28215
  {
27419
28216
  className: cn(
@@ -27426,7 +28223,7 @@ var RedeemRow = ({
27426
28223
  ] })
27427
28224
  ] })
27428
28225
  ] }),
27429
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28226
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27430
28227
  AmountTimeStack,
27431
28228
  {
27432
28229
  amountLabel: activity.amountLabel,
@@ -27436,7 +28233,7 @@ var RedeemRow = ({
27436
28233
  }
27437
28234
  )
27438
28235
  ] }),
27439
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28236
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27440
28237
  AmountTimeStack,
27441
28238
  {
27442
28239
  amountLabel: activity.amountLabel,
@@ -27457,7 +28254,7 @@ var TradeRow = ({
27457
28254
  onClick
27458
28255
  }) => {
27459
28256
  const tone = resolveToneClasses(activity);
27460
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
28257
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
27461
28258
  "div",
27462
28259
  {
27463
28260
  className: cn(
@@ -27465,10 +28262,10 @@ var TradeRow = ({
27465
28262
  "relative z-10"
27466
28263
  ),
27467
28264
  children: [
27468
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
27469
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex items-center gap-2", children: [
27470
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
27471
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28265
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
28266
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex items-center gap-2", children: [
28267
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
28268
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27472
28269
  "p",
27473
28270
  {
27474
28271
  className: cn(
@@ -27480,12 +28277,12 @@ var TradeRow = ({
27480
28277
  }
27481
28278
  )
27482
28279
  ] }),
27483
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(TradeOutcomeShares, { activity, tone }) })
28280
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(TradeOutcomeShares, { activity, tone }) })
27484
28281
  ] }),
27485
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(TradeTypeCell, { activity, tone }),
27486
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
27487
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
27488
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28282
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(TradeTypeCell, { activity, tone }),
28283
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
28284
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
28285
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27489
28286
  RemoteImage,
27490
28287
  {
27491
28288
  src: activity.thumbnailSrc,
@@ -27494,8 +28291,8 @@ var TradeRow = ({
27494
28291
  classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
27495
28292
  }
27496
28293
  ) }),
27497
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
27498
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28294
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
28295
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27499
28296
  "p",
27500
28297
  {
27501
28298
  className: cn(
@@ -27505,10 +28302,10 @@ var TradeRow = ({
27505
28302
  children: activity.title
27506
28303
  }
27507
28304
  ),
27508
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(TradeOutcomeShares, { activity, tone }) })
28305
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(TradeOutcomeShares, { activity, tone }) })
27509
28306
  ] })
27510
28307
  ] }),
27511
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28308
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27512
28309
  AmountTimeStack,
27513
28310
  {
27514
28311
  amountLabel: activity.amountLabel,
@@ -27518,7 +28315,7 @@ var TradeRow = ({
27518
28315
  }
27519
28316
  )
27520
28317
  ] }),
27521
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28318
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27522
28319
  AmountTimeStack,
27523
28320
  {
27524
28321
  amountLabel: activity.amountLabel,
@@ -27540,7 +28337,7 @@ var TransferRow = ({
27540
28337
  const transferStatus = resolveActivityStatus(activity);
27541
28338
  const transferIconName = TRANSFER_ICON[activity.kind];
27542
28339
  const statusVisual = getStatusVisual(activity);
27543
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28340
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27544
28341
  RowWrapper,
27545
28342
  {
27546
28343
  className,
@@ -27548,7 +28345,7 @@ var TransferRow = ({
27548
28345
  target: href ? "_blank" : void 0,
27549
28346
  rel: href ? "noopener noreferrer" : void 0,
27550
28347
  onClick,
27551
- children: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
28348
+ children: /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)(
27552
28349
  "div",
27553
28350
  {
27554
28351
  className: cn(
@@ -27556,9 +28353,9 @@ var TransferRow = ({
27556
28353
  "relative z-10"
27557
28354
  ),
27558
28355
  children: [
27559
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(TransferTypeCell, { activity, tone }),
27560
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex items-center gap-2", children: [
27561
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28356
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(TransferTypeCell, { activity, tone }),
28357
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex items-center gap-2", children: [
28358
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27562
28359
  Icon,
27563
28360
  {
27564
28361
  name: transferIconName,
@@ -27569,7 +28366,7 @@ var TransferRow = ({
27569
28366
  )
27570
28367
  }
27571
28368
  ),
27572
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28369
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27573
28370
  "p",
27574
28371
  {
27575
28372
  className: cn(
@@ -27581,14 +28378,14 @@ var TransferRow = ({
27581
28378
  }
27582
28379
  )
27583
28380
  ] }) }),
27584
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
27585
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
27586
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28381
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex w-full items-center justify-between sm:contents", children: [
28382
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
28383
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27587
28384
  "div",
27588
28385
  {
27589
28386
  className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
27590
28387
  "data-status": transferStatus,
27591
- children: statusVisual.spin ? /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28388
+ children: statusVisual.spin ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27592
28389
  Icon,
27593
28390
  {
27594
28391
  name: statusVisual.icon,
@@ -27598,8 +28395,8 @@ var TransferRow = ({
27598
28395
  )
27599
28396
  }
27600
28397
  ),
27601
- /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
27602
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28398
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
28399
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27603
28400
  "p",
27604
28401
  {
27605
28402
  className: cn(
@@ -27609,7 +28406,7 @@ var TransferRow = ({
27609
28406
  children: activity.title
27610
28407
  }
27611
28408
  ),
27612
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28409
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27613
28410
  "p",
27614
28411
  {
27615
28412
  className: cn(
@@ -27621,7 +28418,7 @@ var TransferRow = ({
27621
28418
  )
27622
28419
  ] })
27623
28420
  ] }),
27624
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28421
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27625
28422
  AmountTimeStack,
27626
28423
  {
27627
28424
  amountLabel: activity.amountLabel,
@@ -27631,7 +28428,7 @@ var TransferRow = ({
27631
28428
  }
27632
28429
  )
27633
28430
  ] }),
27634
- /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28431
+ /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27635
28432
  AmountTimeStack,
27636
28433
  {
27637
28434
  amountLabel: activity.amountLabel,
@@ -27657,10 +28454,10 @@ var ActivityRow = ({ activity, href, onClick }) => {
27657
28454
  "before:bg-agg-secondary-hover before:rounded-agg-xl"
27658
28455
  );
27659
28456
  if (activity.kind === "trade") {
27660
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
28457
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
27661
28458
  }
27662
28459
  if (activity.kind === "redeem") {
27663
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28460
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27664
28461
  RedeemRow,
27665
28462
  {
27666
28463
  activity,
@@ -27670,7 +28467,7 @@ var ActivityRow = ({ activity, href, onClick }) => {
27670
28467
  }
27671
28468
  );
27672
28469
  }
27673
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
28470
+ return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
27674
28471
  TransferRow,
27675
28472
  {
27676
28473
  activity,
@@ -27683,19 +28480,19 @@ var ActivityRow = ({ activity, href, onClick }) => {
27683
28480
  ActivityRow.displayName = "ActivityRow";
27684
28481
 
27685
28482
  // src/pages/user-profile/components/empty-state.tsx
27686
- var import_jsx_runtime169 = require("react/jsx-runtime");
28483
+ var import_jsx_runtime170 = require("react/jsx-runtime");
27687
28484
  var EmptyState = ({ title: title2, description, className }) => {
27688
- return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
28485
+ return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
27689
28486
  "div",
27690
28487
  {
27691
28488
  className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
27692
28489
  role: "status",
27693
28490
  "aria-live": "polite",
27694
- children: /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
27695
- /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
27696
- /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
27697
- /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title2 }),
27698
- description ? /* @__PURE__ */ (0, import_jsx_runtime169.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
28491
+ children: /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
28492
+ /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
28493
+ /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
28494
+ /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title2 }),
28495
+ description ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
27699
28496
  ] })
27700
28497
  ] })
27701
28498
  }
@@ -27704,8 +28501,8 @@ var EmptyState = ({ title: title2, description, className }) => {
27704
28501
  EmptyState.displayName = "EmptyState";
27705
28502
 
27706
28503
  // src/pages/user-profile/components/open-order-row.tsx
27707
- var import_hooks72 = require("@agg-build/hooks");
27708
- var import_jsx_runtime170 = require("react/jsx-runtime");
28504
+ var import_hooks73 = require("@agg-build/hooks");
28505
+ var import_jsx_runtime171 = require("react/jsx-runtime");
27709
28506
  var shouldUseNativeLinkNavigation2 = (event) => {
27710
28507
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
27711
28508
  };
@@ -27736,7 +28533,7 @@ var OpenOrderRow = ({
27736
28533
  expirationHeader
27737
28534
  }) => {
27738
28535
  var _a, _b, _c, _d;
27739
- const labels = (0, import_hooks72.useLabels)().userProfile.openOrders;
28536
+ const labels = (0, import_hooks73.useLabels)().userProfile.openOrders;
27740
28537
  const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
27741
28538
  const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
27742
28539
  const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
@@ -27773,7 +28570,7 @@ var OpenOrderRow = ({
27773
28570
  handleDivClick();
27774
28571
  }
27775
28572
  };
27776
- return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
28573
+ return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
27777
28574
  Wrapper,
27778
28575
  __spreadProps(__spreadValues({
27779
28576
  "aria-label": order.title,
@@ -27784,45 +28581,45 @@ var OpenOrderRow = ({
27784
28581
  "hover:before:opacity-100 focus-visible:before:opacity-100"
27785
28582
  )
27786
28583
  }, wrapperProps), {
27787
- children: /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "agg-open-order-row-content relative z-10 flex w-full flex-col gap-3 rounded-agg-xl px-3 py-2.5 text-left lg:flex-row lg:items-center lg:gap-6 lg:px-0 lg:py-0", children: [
27788
- /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 lg:gap-4", children: [
27789
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
28584
+ children: /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "agg-open-order-row-content relative z-10 flex w-full flex-col gap-3 rounded-agg-xl px-3 py-2.5 text-left lg:flex-row lg:items-center lg:gap-6 lg:px-0 lg:py-0", children: [
28585
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 lg:gap-4", children: [
28586
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
27790
28587
  RemoteImage,
27791
28588
  {
27792
- src: (0, import_hooks72.optimizedImageUrl)(order.thumbnailSrc, 60),
28589
+ src: (0, import_hooks73.optimizedImageUrl)(order.thumbnailSrc, 60),
27793
28590
  alt: "",
27794
28591
  className: "h-full w-full rounded-agg-sm object-cover"
27795
28592
  }
27796
28593
  ) }),
27797
- /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
27798
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
27799
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) })
28594
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
28595
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
28596
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) })
27800
28597
  ] })
27801
28598
  ] }),
27802
- /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
27803
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) }),
28599
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
28600
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: order.outcomeLabel }) }),
27804
28601
  [
27805
28602
  { label: resolvedLimitPriceHeader, value: (_a = order.limitPriceLabel) != null ? _a : "\u2014" },
27806
28603
  { label: resolvedFilledHeader, value: order.filledLabel },
27807
28604
  { label: resolvedTotalHeader, value: order.valueLabel },
27808
28605
  { label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
27809
- ].map(({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
27810
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
27811
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label2 })
28606
+ ].map(({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
28607
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
28608
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label2 })
27812
28609
  ] }, label2))
27813
28610
  ] }),
27814
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
27815
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
27816
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
27817
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
27818
- /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
28611
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
28612
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
28613
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
28614
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
28615
+ /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
27819
28616
  "div",
27820
28617
  {
27821
28618
  className: cn(
27822
28619
  "shrink-0 justify-end",
27823
28620
  canCancel ? "flex w-full lg:w-[80px]" : "hidden lg:flex lg:w-[80px]"
27824
28621
  ),
27825
- children: canCancel ? /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
28622
+ children: canCancel ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
27826
28623
  Button,
27827
28624
  {
27828
28625
  variant: "secondary",
@@ -27844,8 +28641,8 @@ var OpenOrderRow = ({
27844
28641
  OpenOrderRow.displayName = "OpenOrderRow";
27845
28642
 
27846
28643
  // src/pages/user-profile/components/position-row.tsx
27847
- var import_hooks73 = require("@agg-build/hooks");
27848
- var import_jsx_runtime171 = require("react/jsx-runtime");
28644
+ var import_hooks74 = require("@agg-build/hooks");
28645
+ var import_jsx_runtime172 = require("react/jsx-runtime");
27849
28646
  var shouldUseNativeLinkNavigation3 = (event) => {
27850
28647
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
27851
28648
  };
@@ -27854,21 +28651,21 @@ var toneTextClassName = (tone) => {
27854
28651
  if (tone === "negative") return "text-agg-error";
27855
28652
  return "text-agg-muted-foreground";
27856
28653
  };
27857
- var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label2 }) });
27858
- var ResolutionPill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
28654
+ var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label2 }) });
28655
+ var ResolutionPill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
27859
28656
  var VenueShares = ({
27860
28657
  model,
27861
28658
  className,
27862
28659
  keyPrefix
27863
28660
  }) => {
27864
28661
  if (model.venueShareBreakdown.length === 0) return null;
27865
- return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28662
+ return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: cn(className, "gap-x-3 gap-y-2"), children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
27866
28663
  "div",
27867
28664
  {
27868
28665
  className: "flex min-w-0 max-w-full items-center gap-1",
27869
28666
  children: [
27870
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
27871
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
28667
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
28668
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
27872
28669
  ]
27873
28670
  },
27874
28671
  `${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
@@ -27880,7 +28677,7 @@ var StatusBadge = ({
27880
28677
  }) => {
27881
28678
  if (status === "lost" || status === "won_claimed") return null;
27882
28679
  const isWon = status === "won_unclaimed";
27883
- return /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28680
+ return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
27884
28681
  "span",
27885
28682
  {
27886
28683
  className: cn(
@@ -27889,7 +28686,7 @@ var StatusBadge = ({
27889
28686
  isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
27890
28687
  ),
27891
28688
  children: [
27892
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
28689
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
27893
28690
  isWon ? labels.won : labels.open
27894
28691
  ]
27895
28692
  }
@@ -27902,7 +28699,7 @@ var ResultBadge = ({
27902
28699
  if (status !== "won_claimed" && status !== "lost" && status !== "sold") return null;
27903
28700
  const isWon = status === "won_claimed";
27904
28701
  const isSold = status === "sold";
27905
- return /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28702
+ return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
27906
28703
  "span",
27907
28704
  {
27908
28705
  className: cn(
@@ -27911,7 +28708,7 @@ var ResultBadge = ({
27911
28708
  isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : isSold ? "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-muted-foreground" : "border-agg-error/50 bg-agg-error/10 text-agg-error"
27912
28709
  ),
27913
28710
  children: [
27914
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28711
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
27915
28712
  Icon,
27916
28713
  {
27917
28714
  name: isWon ? "check-circle" : isSold ? "hourglass-start" : "cross-circle",
@@ -27927,27 +28724,27 @@ var ResultBadge = ({
27927
28724
  var TotalTradedCell = ({
27928
28725
  model,
27929
28726
  className
27930
- }) => /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28727
+ }) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
27931
28728
  "div",
27932
28729
  {
27933
28730
  className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
27934
28731
  children: [
27935
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
27936
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
28732
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
28733
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
27937
28734
  ]
27938
28735
  }
27939
28736
  );
27940
28737
  var PositionValueCell = ({
27941
28738
  value,
27942
28739
  className
27943
- }) => /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28740
+ }) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
27944
28741
  "div",
27945
28742
  {
27946
28743
  className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
27947
28744
  children: [
27948
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
27949
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
27950
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28745
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
28746
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
28747
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
27951
28748
  "p",
27952
28749
  {
27953
28750
  className: cn(
@@ -27958,9 +28755,9 @@ var PositionValueCell = ({
27958
28755
  }
27959
28756
  )
27960
28757
  ] }),
27961
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
27962
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
27963
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28758
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex items-baseline gap-1.5", children: [
28759
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
28760
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
27964
28761
  "p",
27965
28762
  {
27966
28763
  className: cn(
@@ -27982,8 +28779,8 @@ var PositionRow = ({
27982
28779
  onClaim,
27983
28780
  isClaiming = false
27984
28781
  }) => {
27985
- const labels = (0, import_hooks73.useLabels)().userProfile.positions;
27986
- const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks73.useAggUiConfig)().formatting;
28782
+ const labels = (0, import_hooks74.useLabels)().userProfile.positions;
28783
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks74.useAggUiConfig)().formatting;
27987
28784
  const model = toPositionRowViewModel(
27988
28785
  position,
27989
28786
  {
@@ -28028,7 +28825,7 @@ var PositionRow = ({
28028
28825
  handleDivClick();
28029
28826
  }
28030
28827
  };
28031
- return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28828
+ return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
28032
28829
  "div",
28033
28830
  {
28034
28831
  className: cn(
@@ -28036,21 +28833,21 @@ var PositionRow = ({
28036
28833
  isClosed ? "md:gap-8" : "md:gap-6"
28037
28834
  ),
28038
28835
  children: [
28039
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:min-w-0 md:flex-1 md:justify-start md:gap-4", children: [
28040
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
28041
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28836
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:min-w-0 md:flex-1 md:justify-start md:gap-4", children: [
28837
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
28838
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28042
28839
  RemoteImage,
28043
28840
  {
28044
- src: (0, import_hooks73.optimizedImageUrl)(model.thumbnailSrc, 60),
28841
+ src: (0, import_hooks74.optimizedImageUrl)(model.thumbnailSrc, 60),
28045
28842
  alt: "",
28046
28843
  className: "h-full w-full rounded-agg-sm object-cover"
28047
28844
  }
28048
28845
  ) }),
28049
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
28050
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "agg-position-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] md:block md:truncate md:text-agg-base md:leading-agg-6", children: model.title }),
28051
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
28052
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(OutcomePill, { label: model.selectedOutcomeLabel }),
28053
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28846
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
28847
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-position-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] md:block md:truncate md:text-agg-base md:leading-agg-6", children: model.title }),
28848
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
28849
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(OutcomePill, { label: model.selectedOutcomeLabel }),
28850
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28054
28851
  VenueShares,
28055
28852
  {
28056
28853
  model,
@@ -28061,10 +28858,10 @@ var PositionRow = ({
28061
28858
  ] })
28062
28859
  ] })
28063
28860
  ] }),
28064
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(OutcomePill, { label: model.selectedOutcomeLabel }) })
28861
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(OutcomePill, { label: model.selectedOutcomeLabel }) })
28065
28862
  ] }),
28066
- isClosed ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
28067
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28863
+ isClosed ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
28864
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28068
28865
  VenueShares,
28069
28866
  {
28070
28867
  model,
@@ -28072,14 +28869,14 @@ var PositionRow = ({
28072
28869
  className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
28073
28870
  }
28074
28871
  ),
28075
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
28076
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex min-w-0 items-center gap-5", children: [
28077
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(TotalTradedCell, { model }),
28078
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
28872
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
28873
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 items-center gap-5", children: [
28874
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TotalTradedCell, { model }),
28875
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
28079
28876
  ] }),
28080
- isClosed ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
28081
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(StatusBadge, { status: model.positionStatus, labels }),
28082
- model.canClaim ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28877
+ isClosed ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
28878
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(StatusBadge, { status: model.positionStatus, labels }),
28879
+ model.canClaim ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
28083
28880
  "button",
28084
28881
  {
28085
28882
  type: "button",
@@ -28088,48 +28885,48 @@ var PositionRow = ({
28088
28885
  disabled: isClaiming,
28089
28886
  "aria-busy": isClaiming || void 0,
28090
28887
  children: [
28091
- isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
28888
+ isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
28092
28889
  labels.claim
28093
28890
  ]
28094
28891
  }
28095
28892
  ) : null
28096
28893
  ] })
28097
28894
  ] }),
28098
- isClosed ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_jsx_runtime171.Fragment, { children: [
28099
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(ResolutionPill, { label: model.resolutionLabel }) }),
28100
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28895
+ isClosed ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_jsx_runtime172.Fragment, { children: [
28896
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(ResolutionPill, { label: model.resolutionLabel }) }),
28897
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28101
28898
  TotalTradedCell,
28102
28899
  {
28103
28900
  model,
28104
28901
  className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
28105
28902
  }
28106
28903
  ),
28107
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28904
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28108
28905
  PositionValueCell,
28109
28906
  {
28110
28907
  value: model.payout,
28111
28908
  className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
28112
28909
  }
28113
28910
  ),
28114
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(ResultBadge, { status: model.positionStatus, labels }) })
28115
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_jsx_runtime171.Fragment, { children: [
28116
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28911
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(ResultBadge, { status: model.positionStatus, labels }) })
28912
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_jsx_runtime172.Fragment, { children: [
28913
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28117
28914
  TotalTradedCell,
28118
28915
  {
28119
28916
  model,
28120
28917
  className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
28121
28918
  }
28122
28919
  ),
28123
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28920
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28124
28921
  PositionValueCell,
28125
28922
  {
28126
28923
  value: model.currentValue,
28127
28924
  className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
28128
28925
  }
28129
28926
  ),
28130
- /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
28131
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(StatusBadge, { status: model.positionStatus, labels }),
28132
- model.canClaim ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
28927
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
28928
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(StatusBadge, { status: model.positionStatus, labels }),
28929
+ model.canClaim ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
28133
28930
  "button",
28134
28931
  {
28135
28932
  type: "button",
@@ -28138,14 +28935,14 @@ var PositionRow = ({
28138
28935
  disabled: isClaiming,
28139
28936
  "aria-busy": isClaiming || void 0,
28140
28937
  children: [
28141
- isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
28938
+ isClaiming ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
28142
28939
  labels.claim
28143
28940
  ]
28144
28941
  }
28145
28942
  ) : null
28146
28943
  ] })
28147
28944
  ] }),
28148
- /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
28945
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
28149
28946
  Icon,
28150
28947
  {
28151
28948
  name: "chevron-right",
@@ -28160,15 +28957,15 @@ var PositionRow = ({
28160
28957
  PositionRow.displayName = "PositionRow";
28161
28958
 
28162
28959
  // src/pages/user-profile/components/positions-activity.tsx
28163
- var import_jsx_runtime172 = require("react/jsx-runtime");
28960
+ var import_jsx_runtime173 = require("react/jsx-runtime");
28164
28961
  var getTabItems = (tabsLabels, showOpenOrders) => [
28165
28962
  { value: USER_PROFILE_TAB_POSITIONS, label: tabsLabels.positions },
28166
28963
  ...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
28167
28964
  { value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
28168
28965
  ];
28169
- var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_react47.Fragment, { children: [
28170
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
28171
- index < acc.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
28966
+ var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_react48.Fragment, { children: [
28967
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
28968
+ index < acc.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
28172
28969
  ] }, index)) });
28173
28970
  var PositionsActivity = ({
28174
28971
  activePositions = [],
@@ -28210,16 +29007,16 @@ var PositionsActivity = ({
28210
29007
  initialPositionFilter = "active",
28211
29008
  className
28212
29009
  }) => {
28213
- const userProfileLabels = (0, import_hooks74.useLabels)().userProfile;
29010
+ const userProfileLabels = (0, import_hooks75.useLabels)().userProfile;
28214
29011
  const positionsLabels = userProfileLabels.positions;
28215
29012
  const openOrdersLabels = userProfileLabels.openOrders;
28216
- const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks74.useAggUiConfig)().formatting;
28217
- const tabItems = (0, import_react47.useMemo)(
29013
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks75.useAggUiConfig)().formatting;
29014
+ const tabItems = (0, import_react48.useMemo)(
28218
29015
  () => getTabItems(userProfileLabels.tabs, showOpenOrders),
28219
29016
  [showOpenOrders, userProfileLabels.tabs]
28220
29017
  );
28221
29018
  const isTabControlled = tab !== void 0;
28222
- const [internalActiveTab, setInternalActiveTab] = (0, import_react47.useState)(
29019
+ const [internalActiveTab, setInternalActiveTab] = (0, import_react48.useState)(
28223
29020
  tab != null ? tab : USER_PROFILE_TAB_POSITIONS
28224
29021
  );
28225
29022
  const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
@@ -28229,21 +29026,21 @@ var PositionsActivity = ({
28229
29026
  if (!isTabControlled) setInternalActiveTab(next);
28230
29027
  onTabChange == null ? void 0 : onTabChange(next);
28231
29028
  };
28232
- const [positionFilter, setPositionFilter] = (0, import_react47.useState)(initialPositionFilter);
28233
- const [searchValue, setSearchValue] = (0, import_react47.useState)("");
28234
- const [isSearchFocused, setIsSearchFocused] = (0, import_react47.useState)(false);
28235
- const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0, import_react47.useState)(
29029
+ const [positionFilter, setPositionFilter] = (0, import_react48.useState)(initialPositionFilter);
29030
+ const [searchValue, setSearchValue] = (0, import_react48.useState)("");
29031
+ const [isSearchFocused, setIsSearchFocused] = (0, import_react48.useState)(false);
29032
+ const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0, import_react48.useState)(
28236
29033
  () => /* @__PURE__ */ new Set()
28237
29034
  );
28238
- const positionsLoadMoreRef = (0, import_react47.useRef)(null);
28239
- const openOrdersLoadMoreRef = (0, import_react47.useRef)(null);
28240
- const activitiesLoadMoreRef = (0, import_react47.useRef)(null);
28241
- const rowsScrollRef = (0, import_react47.useRef)(null);
29035
+ const positionsLoadMoreRef = (0, import_react48.useRef)(null);
29036
+ const openOrdersLoadMoreRef = (0, import_react48.useRef)(null);
29037
+ const activitiesLoadMoreRef = (0, import_react48.useRef)(null);
29038
+ const rowsScrollRef = (0, import_react48.useRef)(null);
28242
29039
  const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
28243
29040
  const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
28244
29041
  const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
28245
29042
  const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
28246
- const positionsForCurrentFilter = (0, import_react47.useMemo)(() => {
29043
+ const positionsForCurrentFilter = (0, import_react48.useMemo)(() => {
28247
29044
  if (positionFilter === "active") {
28248
29045
  return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
28249
29046
  }
@@ -28260,7 +29057,7 @@ var PositionsActivity = ({
28260
29057
  }
28261
29058
  return Array.from(byId.values());
28262
29059
  }, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
28263
- const filteredPositions = (0, import_react47.useMemo)(() => {
29060
+ const filteredPositions = (0, import_react48.useMemo)(() => {
28264
29061
  if (!searchValue.trim()) return positionsForCurrentFilter;
28265
29062
  const q = searchValue.toLowerCase();
28266
29063
  return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
@@ -28285,7 +29082,7 @@ var PositionsActivity = ({
28285
29082
  const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
28286
29083
  const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
28287
29084
  const filteredActivities = activities;
28288
- const searchResults = (0, import_react47.useMemo)(() => {
29085
+ const searchResults = (0, import_react48.useMemo)(() => {
28289
29086
  if (!isPositionsTab || !searchValue.trim()) return [];
28290
29087
  return filteredPositions.slice(0, 5).map((position) => ({
28291
29088
  id: position.id,
@@ -28314,11 +29111,11 @@ var PositionsActivity = ({
28314
29111
  const handleSearchChange = (event) => {
28315
29112
  setSearchValue(event.target.value);
28316
29113
  };
28317
- (0, import_react47.useEffect)(() => {
29114
+ (0, import_react48.useEffect)(() => {
28318
29115
  if (isPositionsTab) return;
28319
29116
  setIsSearchFocused(false);
28320
29117
  }, [isPositionsTab]);
28321
- (0, import_react47.useEffect)(() => {
29118
+ (0, import_react48.useEffect)(() => {
28322
29119
  if (!isPositionsTab || !hasMorePositions) return;
28323
29120
  const target = positionsLoadMoreRef.current;
28324
29121
  if (!target || !loadMorePositions) return;
@@ -28340,7 +29137,7 @@ var PositionsActivity = ({
28340
29137
  isPositionsTab,
28341
29138
  loadMorePositions
28342
29139
  ]);
28343
- (0, import_react47.useEffect)(() => {
29140
+ (0, import_react48.useEffect)(() => {
28344
29141
  if (!isActivityTab || !hasMoreActivities) return;
28345
29142
  const target = activitiesLoadMoreRef.current;
28346
29143
  if (!target || !onLoadMoreActivities) return;
@@ -28362,7 +29159,7 @@ var PositionsActivity = ({
28362
29159
  isLoadingMoreActivities,
28363
29160
  onLoadMoreActivities
28364
29161
  ]);
28365
- (0, import_react47.useEffect)(() => {
29162
+ (0, import_react48.useEffect)(() => {
28366
29163
  if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
28367
29164
  const target = openOrdersLoadMoreRef.current;
28368
29165
  if (!target || !onLoadMoreOpenOrders) return;
@@ -28384,7 +29181,7 @@ var PositionsActivity = ({
28384
29181
  isOpenOrdersTab,
28385
29182
  onLoadMoreOpenOrders
28386
29183
  ]);
28387
- return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
29184
+ return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
28388
29185
  "div",
28389
29186
  {
28390
29187
  className: cn(
@@ -28393,7 +29190,7 @@ var PositionsActivity = ({
28393
29190
  className
28394
29191
  ),
28395
29192
  children: [
28396
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29193
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28397
29194
  Tabs,
28398
29195
  {
28399
29196
  items: tabItems,
@@ -28407,7 +29204,7 @@ var PositionsActivity = ({
28407
29204
  }
28408
29205
  }
28409
29206
  ),
28410
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
29207
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
28411
29208
  "div",
28412
29209
  {
28413
29210
  className: cn(
@@ -28415,12 +29212,12 @@ var PositionsActivity = ({
28415
29212
  isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
28416
29213
  ),
28417
29214
  children: [
28418
- isPositionsTab ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
28419
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
29215
+ isPositionsTab ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
29216
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
28420
29217
  const isActive = filter.value === positionFilter;
28421
- return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-1 items-stretch", children: [
28422
- idx > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
28423
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29218
+ return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex flex-1 items-stretch", children: [
29219
+ idx > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
29220
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28424
29221
  "button",
28425
29222
  {
28426
29223
  type: "button",
@@ -28435,7 +29232,7 @@ var PositionsActivity = ({
28435
29232
  )
28436
29233
  ] }, filter.value);
28437
29234
  }) }),
28438
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
29235
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
28439
29236
  "div",
28440
29237
  {
28441
29238
  className: "agg-position-search relative flex w-full min-w-0 flex-1",
@@ -28446,9 +29243,9 @@ var PositionsActivity = ({
28446
29243
  setIsSearchFocused(false);
28447
29244
  },
28448
29245
  children: [
28449
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex h-11 w-full items-center gap-3 rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5 focus-within:border-2 focus-within:border-agg-primary sm:h-10", children: [
28450
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
28451
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29246
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex h-11 w-full items-center gap-3 rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5 focus-within:border-2 focus-within:border-agg-primary sm:h-10", children: [
29247
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
29248
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28452
29249
  "input",
28453
29250
  {
28454
29251
  value: searchValue,
@@ -28463,7 +29260,7 @@ var PositionsActivity = ({
28463
29260
  }
28464
29261
  )
28465
29262
  ] }) }),
28466
- isSearchFocused && searchValue.trim() ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "agg-position-search-results absolute left-0 right-0 top-full z-50 mt-1 w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary pt-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]", children: searchResults.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29263
+ isSearchFocused && searchValue.trim() ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "agg-position-search-results absolute left-0 right-0 top-full z-50 mt-1 w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary pt-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]", children: searchResults.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28467
29264
  "ul",
28468
29265
  {
28469
29266
  className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
@@ -28476,26 +29273,26 @@ var PositionsActivity = ({
28476
29273
  setIsSearchFocused(false);
28477
29274
  onPositionClick == null ? void 0 : onPositionClick(item.raw);
28478
29275
  };
28479
- const innerContent = /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_jsx_runtime172.Fragment, { children: [
28480
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
28481
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29276
+ const innerContent = /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_jsx_runtime173.Fragment, { children: [
29277
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
29278
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28482
29279
  "img",
28483
29280
  {
28484
- src: (0, import_hooks74.optimizedImageUrl)(item.thumbnailSrc, 48),
29281
+ src: (0, import_hooks75.optimizedImageUrl)(item.thumbnailSrc, 48),
28485
29282
  alt: "",
28486
29283
  className: "size-12 shrink-0 rounded-agg-lg object-cover"
28487
29284
  }
28488
29285
  ),
28489
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
28490
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: item.title }),
28491
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
28492
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "shrink-0 whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaPrimary }),
28493
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
28494
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaSecondary })
29286
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
29287
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: item.title }),
29288
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
29289
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "shrink-0 whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaPrimary }),
29290
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
29291
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaSecondary })
28495
29292
  ] })
28496
29293
  ] })
28497
29294
  ] }),
28498
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29295
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28499
29296
  Icon,
28500
29297
  {
28501
29298
  name: "chevron-right",
@@ -28504,7 +29301,7 @@ var PositionsActivity = ({
28504
29301
  }
28505
29302
  )
28506
29303
  ] });
28507
- return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29304
+ return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28508
29305
  "li",
28509
29306
  {
28510
29307
  role: "presentation",
@@ -28512,7 +29309,7 @@ var PositionsActivity = ({
28512
29309
  "agg-position-search-result-item",
28513
29310
  index > 0 && "border-t border-agg-separator"
28514
29311
  ),
28515
- children: itemHref ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29312
+ children: itemHref ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28516
29313
  "a",
28517
29314
  {
28518
29315
  href: itemHref,
@@ -28527,7 +29324,7 @@ var PositionsActivity = ({
28527
29324
  },
28528
29325
  children: innerContent
28529
29326
  }
28530
- ) : /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29327
+ ) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28531
29328
  "button",
28532
29329
  {
28533
29330
  type: "button",
@@ -28541,42 +29338,42 @@ var PositionsActivity = ({
28541
29338
  );
28542
29339
  })
28543
29340
  }
28544
- ) : /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
29341
+ ) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
28545
29342
  ]
28546
29343
  }
28547
29344
  )
28548
29345
  ] }) : null,
28549
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
28550
- /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "w-full px-4 sm:px-6", children: [
28551
- isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
28552
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
28553
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
28554
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
28555
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
28556
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
28557
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
28558
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
28559
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
28560
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
28561
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
28562
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
28563
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
29346
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
29347
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "w-full px-4 sm:px-6", children: [
29348
+ isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
29349
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
29350
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
29351
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
29352
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
29353
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
29354
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
29355
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
29356
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
29357
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
29358
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
29359
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
29360
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
28564
29361
  ] }) : null,
28565
- isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "hidden items-start gap-6 px-0 lg:flex", children: [
28566
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: openOrdersLabels.marketHeader }),
28567
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.limitPriceHeader }),
28568
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.filledHeader }),
28569
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.totalHeader }),
28570
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[140px] shrink-0", children: openOrdersLabels.expirationHeader }),
28571
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "w-[80px] shrink-0", "aria-hidden": true })
29362
+ isOpenOrdersTab && openOrders.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "hidden items-start gap-6 px-0 lg:flex", children: [
29363
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: openOrdersLabels.marketHeader }),
29364
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.limitPriceHeader }),
29365
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.filledHeader }),
29366
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0", children: openOrdersLabels.totalHeader }),
29367
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[140px] shrink-0", children: openOrdersLabels.expirationHeader }),
29368
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "w-[80px] shrink-0", "aria-hidden": true })
28572
29369
  ] }) : null,
28573
- isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
28574
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
28575
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
28576
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
29370
+ isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
29371
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
29372
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
29373
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
28577
29374
  ] }) : null
28578
29375
  ] }),
28579
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29376
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28580
29377
  "div",
28581
29378
  {
28582
29379
  ref: rowsScrollRef,
@@ -28588,8 +29385,8 @@ var PositionsActivity = ({
28588
29385
  "[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
28589
29386
  "[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
28590
29387
  ),
28591
- children: isPositionsTab ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
28592
- isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29388
+ children: isPositionsTab ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
29389
+ isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28593
29390
  EmptyState,
28594
29391
  {
28595
29392
  title: "Unable to load positions",
@@ -28597,15 +29394,15 @@ var PositionsActivity = ({
28597
29394
  }
28598
29395
  ) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
28599
29396
  var _a;
28600
- return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_react47.Fragment, { children: [
28601
- index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29397
+ return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_react48.Fragment, { children: [
29398
+ index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28602
29399
  "div",
28603
29400
  {
28604
29401
  className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
28605
29402
  "aria-hidden": true
28606
29403
  }
28607
29404
  ) : null,
28608
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29405
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28609
29406
  PositionRow,
28610
29407
  {
28611
29408
  position,
@@ -28619,15 +29416,15 @@ var PositionsActivity = ({
28619
29416
  }
28620
29417
  )
28621
29418
  ] }, position.id);
28622
- }) : /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29419
+ }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28623
29420
  EmptyState,
28624
29421
  {
28625
29422
  title: "No positions yet",
28626
29423
  description: "Your open trades will appear here once you place an order."
28627
29424
  }
28628
29425
  ),
28629
- isLoadingMorePositions ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
28630
- hasMorePositions ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29426
+ isLoadingMorePositions ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
29427
+ hasMorePositions ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28631
29428
  "div",
28632
29429
  {
28633
29430
  ref: positionsLoadMoreRef,
@@ -28635,22 +29432,22 @@ var PositionsActivity = ({
28635
29432
  "aria-hidden": true
28636
29433
  }
28637
29434
  ) : null
28638
- ] }) : isOpenOrdersTab ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "agg-open-orders-list flex flex-col gap-5", children: [
28639
- isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loading }) : openOrdersError && openOrders.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29435
+ ] }) : isOpenOrdersTab ? /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "agg-open-orders-list flex flex-col gap-5", children: [
29436
+ isLoadingOpenOrders && openOrders.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loading }) : openOrdersError && openOrders.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28640
29437
  EmptyState,
28641
29438
  {
28642
29439
  title: openOrdersLabels.errorTitle,
28643
29440
  description: openOrdersLabels.errorDescription
28644
29441
  }
28645
- ) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_react47.Fragment, { children: [
28646
- index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29442
+ ) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_react48.Fragment, { children: [
29443
+ index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28647
29444
  "div",
28648
29445
  {
28649
29446
  className: "agg-open-order-divider h-px w-full shrink-0 bg-agg-separator",
28650
29447
  "aria-hidden": true
28651
29448
  }
28652
29449
  ) : null,
28653
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29450
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28654
29451
  OpenOrderRow,
28655
29452
  {
28656
29453
  order,
@@ -28666,15 +29463,15 @@ var PositionsActivity = ({
28666
29463
  expirationHeader: openOrdersLabels.expirationHeader
28667
29464
  }
28668
29465
  )
28669
- ] }, order.id)) : /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29466
+ ] }, order.id)) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28670
29467
  EmptyState,
28671
29468
  {
28672
29469
  title: openOrdersLabels.emptyTitle,
28673
29470
  description: openOrdersLabels.emptyDescription
28674
29471
  }
28675
29472
  ),
28676
- isLoadingMoreOpenOrders ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loadingMore }) : null,
28677
- hasMoreOpenOrders ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29473
+ isLoadingMoreOpenOrders ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(TabRowsSkeleton, { ariaLabel: openOrdersLabels.loadingMore }) : null,
29474
+ hasMoreOpenOrders ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28678
29475
  "div",
28679
29476
  {
28680
29477
  ref: openOrdersLoadMoreRef,
@@ -28682,22 +29479,22 @@ var PositionsActivity = ({
28682
29479
  "aria-hidden": true
28683
29480
  }
28684
29481
  ) : null
28685
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "agg-activity-list flex flex-col gap-5", children: [
28686
- isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29482
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "agg-activity-list flex flex-col gap-5", children: [
29483
+ isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28687
29484
  EmptyState,
28688
29485
  {
28689
29486
  title: "Unable to load activity",
28690
29487
  description: "Please try again in a moment."
28691
29488
  }
28692
- ) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_react47.Fragment, { children: [
28693
- index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29489
+ ) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(import_react48.Fragment, { children: [
29490
+ index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28694
29491
  "div",
28695
29492
  {
28696
29493
  className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
28697
29494
  "aria-hidden": true
28698
29495
  }
28699
29496
  ) : null,
28700
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29497
+ /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28701
29498
  ActivityRow,
28702
29499
  {
28703
29500
  activity,
@@ -28705,15 +29502,15 @@ var PositionsActivity = ({
28705
29502
  onClick: onActivityClick
28706
29503
  }
28707
29504
  )
28708
- ] }, activity.id)) : /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29505
+ ] }, activity.id)) : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28709
29506
  EmptyState,
28710
29507
  {
28711
29508
  title: "No activity yet",
28712
29509
  description: "Your trading activity will appear here."
28713
29510
  }
28714
29511
  ),
28715
- isLoadingMoreActivities ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
28716
- hasMoreActivities ? /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
29512
+ isLoadingMoreActivities ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
29513
+ hasMoreActivities ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
28717
29514
  "div",
28718
29515
  {
28719
29516
  ref: activitiesLoadMoreRef,
@@ -28735,7 +29532,7 @@ var PositionsActivity = ({
28735
29532
  PositionsActivity.displayName = "PositionsActivity";
28736
29533
 
28737
29534
  // src/pages/user-profile/components/positions-value-card.tsx
28738
- var import_jsx_runtime173 = require("react/jsx-runtime");
29535
+ var import_jsx_runtime174 = require("react/jsx-runtime");
28739
29536
  var PositionsValueCard = ({
28740
29537
  label: label2,
28741
29538
  valueLabel,
@@ -28743,7 +29540,7 @@ var PositionsValueCard = ({
28743
29540
  className,
28744
29541
  icon
28745
29542
  }) => {
28746
- return /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(
29543
+ return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
28747
29544
  "div",
28748
29545
  {
28749
29546
  className: cn(
@@ -28752,8 +29549,8 @@ var PositionsValueCard = ({
28752
29549
  className
28753
29550
  ),
28754
29551
  children: [
28755
- /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)("div", { className: "flex items-center gap-2", children: [
28756
- icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
29552
+ /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { className: "flex items-center gap-2", children: [
29553
+ icon != null ? icon : /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
28757
29554
  "svg",
28758
29555
  {
28759
29556
  xmlns: "http://www.w3.org/2000/svg",
@@ -28762,7 +29559,7 @@ var PositionsValueCard = ({
28762
29559
  viewBox: "0 0 16 16",
28763
29560
  fill: "none",
28764
29561
  "aria-hidden": "true",
28765
- children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
29562
+ children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
28766
29563
  "path",
28767
29564
  {
28768
29565
  d: "M16 7.99957C16 8.36757 15.702 8.66623 15.3333 8.66623H13.6893C13.388 8.66623 13.1233 8.86957 13.0453 9.15957L11.9273 13.3209C11.8 13.7376 11.444 13.9996 11.0333 13.9996H11.022C10.6067 13.9949 10.252 13.7229 10.1393 13.3236L7.95667 4.50623L5.838 11.9989C5.71067 12.3969 5.378 12.6496 4.98467 12.6649C4.57667 12.6869 4.23867 12.4549 4.088 12.0902L3.02133 9.10757C2.926 8.84357 2.674 8.66557 2.39333 8.66557H0.666667C0.298 8.66557 0 8.3669 0 7.9989C0 7.6309 0.298 7.33223 0.666667 7.33223H2.394C3.23667 7.33223 3.99267 7.8649 4.27733 8.65823L4.90267 10.4089L7.092 2.66557C7.226 2.2489 7.57667 1.9809 7.99933 1.9989C8.41133 2.00623 8.76333 2.27757 8.876 2.67357L11.0487 11.4509L11.7567 8.81357C11.9907 7.94157 12.7847 7.33223 13.688 7.33223H15.332C15.7007 7.33223 15.9987 7.6309 15.9987 7.9989L16 7.99957Z",
@@ -28771,9 +29568,9 @@ var PositionsValueCard = ({
28771
29568
  )
28772
29569
  }
28773
29570
  ),
28774
- /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label2 })
29571
+ /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label2 })
28775
29572
  ] }),
28776
- /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime173.jsx)("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
29573
+ /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
28777
29574
  ]
28778
29575
  }
28779
29576
  );
@@ -28802,7 +29599,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
28802
29599
  };
28803
29600
 
28804
29601
  // src/pages/user-profile/components/user-info-card.tsx
28805
- var import_hooks75 = require("@agg-build/hooks");
29602
+ var import_hooks76 = require("@agg-build/hooks");
28806
29603
 
28807
29604
  // src/primitives/conditional-wrapper.tsx
28808
29605
  var ConditionalWrapper = ({
@@ -28813,9 +29610,9 @@ var ConditionalWrapper = ({
28813
29610
  ConditionalWrapper.displayName = "ConditionalWrapper";
28814
29611
 
28815
29612
  // src/pages/user-profile/components/default-avatar.tsx
28816
- var import_jsx_runtime174 = require("react/jsx-runtime");
29613
+ var import_jsx_runtime175 = require("react/jsx-runtime");
28817
29614
  var DefaultAvatar = ({ className }) => {
28818
- return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
29615
+ return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
28819
29616
  "svg",
28820
29617
  {
28821
29618
  xmlns: "http://www.w3.org/2000/svg",
@@ -28826,15 +29623,15 @@ var DefaultAvatar = ({ className }) => {
28826
29623
  className: cn("shrink-0 text-agg-muted-foreground", className),
28827
29624
  "aria-hidden": true,
28828
29625
  children: [
28829
- /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("g", { clipPath: "url(#clip0_default_avatar)", children: [
28830
- /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
29626
+ /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("g", { clipPath: "url(#clip0_default_avatar)", children: [
29627
+ /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
28831
29628
  "path",
28832
29629
  {
28833
29630
  d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
28834
29631
  fill: "var(--agg-color-secondary-hover)"
28835
29632
  }
28836
29633
  ),
28837
- /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
29634
+ /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
28838
29635
  "path",
28839
29636
  {
28840
29637
  d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
@@ -28842,7 +29639,7 @@ var DefaultAvatar = ({ className }) => {
28842
29639
  fillOpacity: "0.12"
28843
29640
  }
28844
29641
  ),
28845
- /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
29642
+ /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
28846
29643
  "path",
28847
29644
  {
28848
29645
  d: "M73.7338 64.1259C80.4187 59.6756 84.8276 52.0804 84.8276 43.4487C84.8276 29.7376 73.7111 18.6211 60 18.6211C46.2890 18.6211 35.1724 29.7376 35.1724 43.4487C35.1724 52.0804 39.5814 59.6756 46.2662 64.1259C46.2662 64.1259 46.2683 64.1280 46.2704 64.1280C46.2683 64.1280 46.2683 64.1259 46.2683 64.1259C30.2669 68.9487 17.8076 81.9356 13.7959 98.2742L13.7980 98.2763C14.4518 99.0645 15.1304 99.8342 15.8235 100.589C15.9911 100.774 16.1669 100.949 16.3387 101.129C16.8724 101.696 17.4124 102.255 17.9669 102.801C18.1966 103.027 18.4304 103.244 18.6642 103.465C19.1773 103.954 19.6966 104.436 20.2262 104.905C20.4890 105.137 20.7559 105.367 21.0207 105.594C21.5400 106.039 22.0656 106.476 22.6014 106.902C22.8828 107.127 23.1662 107.349 23.4497 107.570C23.9918 107.988 24.5421 108.394 25.0987 108.791C25.3862 108.996 25.6697 109.205 25.9614 109.405C26.5490 109.811 27.1469 110.200 27.7490 110.585C28.0200 110.756 28.2849 110.934 28.5580 111.104C29.2531 111.532 29.9607 111.942 30.6745 112.343C30.8628 112.449 31.0469 112.562 31.2373 112.666C32.1600 113.171 33.0973 113.655 34.0490 114.112C34.0718 114.122 34.0966 114.133 34.1193 114.143C35.0276 114.578 35.9504 114.989 36.8835 115.378C37.1731 115.500 37.4690 115.608 37.7607 115.724C38.4352 115.993 39.1097 116.258 39.7966 116.502C40.1607 116.632 40.5290 116.750 40.8952 116.874C41.5200 117.085 42.1490 117.290 42.7821 117.478C43.1835 117.598 43.5869 117.710 43.9924 117.822C44.6049 117.991 45.2214 118.153 45.8442 118.304C46.2642 118.405 46.6862 118.502 47.1104 118.596C47.7331 118.732 48.3580 118.856 48.9869 118.972C49.4131 119.051 49.8373 119.131 50.2676 119.200C50.9173 119.305 51.5711 119.394 52.2269 119.479C52.6407 119.533 53.0524 119.593 53.4683 119.636C54.1924 119.715 54.9228 119.771 55.6531 119.822C56.0069 119.847 56.3566 119.885 56.7104 119.903C57.8007 119.965 58.8952 120 60 120C61.1049 120 62.1993 119.965 63.2897 119.907C63.6435 119.889 63.9952 119.851 64.3469 119.827C65.0793 119.775 65.8097 119.719 66.5318 119.640C66.9476 119.595 67.3593 119.537 67.7731 119.483C68.4290 119.398 69.0828 119.309 69.7324 119.204C70.1607 119.134 70.5869 119.055 71.0131 118.976C71.6421 118.860 72.2690 118.736 72.8897 118.600C73.3138 118.507 73.7359 118.409 74.1559 118.308C74.7766 118.157 75.3931 117.996 76.0076 117.826C76.4111 117.714 76.8166 117.602 77.2180 117.482C77.8531 117.292 78.4800 117.087 79.1049 116.878C79.4711 116.754 79.8414 116.636 80.2035 116.506C80.8883 116.260 81.5649 115.997 82.2393 115.728C82.5311 115.612 82.8269 115.502 83.1166 115.382C84.0456 114.994 84.9642 114.586 85.8683 114.151C85.8952 114.139 85.9242 114.127 85.9511 114.114C86.9028 113.657 87.8400 113.173 88.7628 112.668C88.9531 112.565 89.1373 112.451 89.3256 112.345C90.0393 111.944 90.7469 111.534 91.4421 111.106C91.7152 110.938 91.9821 110.760 92.2511 110.587C92.8531 110.202 93.4511 109.811 94.0387 109.407C94.3283 109.207 94.6138 109.000 94.9014 108.793C95.4580 108.394 96.0083 107.988 96.5504 107.572C96.8359 107.353 97.1173 107.129 97.3987 106.904C97.9324 106.478 98.4600 106.041 98.9793 105.596C99.2462 105.369 99.5131 105.139 99.7738 104.907C100.303 104.438 100.823 103.956 101.336 103.467C101.568 103.246 101.803 103.027 102.033 102.803C102.588 102.257 103.130 101.698 103.661 101.131C103.831 100.949 104.007 100.774 104.177 100.591C104.870 99.8363 105.548 99.0666 106.202 98.2783L106.204 98.2763C102.195 81.9356 89.7352 68.9487 73.7338 64.1259Z",
@@ -28851,7 +29648,7 @@ var DefaultAvatar = ({ className }) => {
28851
29648
  }
28852
29649
  )
28853
29650
  ] }),
28854
- /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ (0, import_jsx_runtime174.jsx)("rect", { width: "120", height: "120", fill: "white" }) }) })
29651
+ /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("rect", { width: "120", height: "120", fill: "white" }) }) })
28855
29652
  ]
28856
29653
  }
28857
29654
  );
@@ -28859,7 +29656,7 @@ var DefaultAvatar = ({ className }) => {
28859
29656
  DefaultAvatar.displayName = "DefaultAvatar";
28860
29657
 
28861
29658
  // src/pages/user-profile/components/user-info-card.tsx
28862
- var import_jsx_runtime175 = require("react/jsx-runtime");
29659
+ var import_jsx_runtime176 = require("react/jsx-runtime");
28863
29660
  var UserInfoCard = ({
28864
29661
  user,
28865
29662
  onEditProfile,
@@ -28869,10 +29666,10 @@ var UserInfoCard = ({
28869
29666
  className
28870
29667
  }) => {
28871
29668
  var _a;
28872
- const labels = (0, import_hooks75.useLabels)();
29669
+ const labels = (0, import_hooks76.useLabels)();
28873
29670
  const wallets = (_a = user.connectedWallets) != null ? _a : [];
28874
29671
  const hasWallets = wallets.length > 0;
28875
- return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
29672
+ return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
28876
29673
  "div",
28877
29674
  {
28878
29675
  className: cn(
@@ -28881,26 +29678,26 @@ var UserInfoCard = ({
28881
29678
  className
28882
29679
  ),
28883
29680
  children: [
28884
- /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
28885
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
29681
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
29682
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
28886
29683
  RemoteImage,
28887
29684
  {
28888
- src: (0, import_hooks75.optimizedImageUrl)(user.avatarUrl, 120),
29685
+ src: (0, import_hooks76.optimizedImageUrl)(user.avatarUrl, 120),
28889
29686
  alt: user.username,
28890
29687
  className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
28891
29688
  }
28892
- ) : /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
28893
- /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
28894
- /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
28895
- /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
28896
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
28897
- user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
29689
+ ) : /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
29690
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
29691
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
29692
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
29693
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
29694
+ user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
28898
29695
  const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
28899
- const iconNode = /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary sm:size-8", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
29696
+ const iconNode = /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary sm:size-8", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
28900
29697
  if (!social.handle) {
28901
- return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { children: iconNode }, `${social.platform}-icon`);
29698
+ return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { children: iconNode }, `${social.platform}-icon`);
28902
29699
  }
28903
- return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
29700
+ return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
28904
29701
  "a",
28905
29702
  {
28906
29703
  href: social.handle,
@@ -28913,55 +29710,55 @@ var UserInfoCard = ({
28913
29710
  );
28914
29711
  }) }) : null
28915
29712
  ] }),
28916
- onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
29713
+ onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
28917
29714
  "button",
28918
29715
  {
28919
29716
  type: "button",
28920
29717
  onClick: onEditProfile,
28921
29718
  className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
28922
29719
  children: [
28923
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
28924
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
29720
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
29721
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
28925
29722
  ]
28926
29723
  }
28927
29724
  ) : null
28928
29725
  ] }),
28929
- hasWallets || !!user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
29726
+ hasWallets || !!user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
28930
29727
  wallets.map((wallet, idx) => {
28931
29728
  const chainLower = wallet.chain.toLowerCase();
28932
29729
  const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
28933
- return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
29730
+ return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
28934
29731
  "div",
28935
29732
  {
28936
29733
  className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
28937
29734
  children: [
28938
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
28939
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: wallet.displayAddress })
29735
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
29736
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: wallet.displayAddress })
28940
29737
  ]
28941
29738
  },
28942
29739
  `wallet-${idx}`
28943
29740
  );
28944
29741
  }),
28945
- user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle }) }) : null
29742
+ user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle }) }) : null
28946
29743
  ] }) : null
28947
29744
  ] })
28948
29745
  ] }),
28949
- (onDeposit || onWithdraw) && /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
28950
- onDeposit ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
29746
+ (onDeposit || onWithdraw) && /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
29747
+ onDeposit ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
28951
29748
  ConditionalWrapper,
28952
29749
  {
28953
29750
  condition: isDepositBlocked,
28954
- wrapper: (children) => /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
29751
+ wrapper: (children) => /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
28955
29752
  Tooltip,
28956
29753
  {
28957
- content: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
29754
+ content: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
28958
29755
  size: "small",
28959
29756
  side: "bottom",
28960
29757
  sideOffset: 4,
28961
29758
  children
28962
29759
  }
28963
29760
  ),
28964
- children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
29761
+ children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
28965
29762
  Button,
28966
29763
  __spreadProps(__spreadValues({
28967
29764
  variant: "primary",
@@ -28973,7 +29770,7 @@ var UserInfoCard = ({
28973
29770
  )
28974
29771
  }
28975
29772
  ) : null,
28976
- onWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
29773
+ onWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
28977
29774
  Button,
28978
29775
  {
28979
29776
  variant: "secondary",
@@ -28983,15 +29780,15 @@ var UserInfoCard = ({
28983
29780
  children: labels.auth.withdraw
28984
29781
  }
28985
29782
  ) : null,
28986
- onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(
29783
+ onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
28987
29784
  "button",
28988
29785
  {
28989
29786
  type: "button",
28990
29787
  onClick: onEditProfile,
28991
29788
  className: "flex sm:hidden shrink-0 cursor-pointer items-center gap-1.5 bg-transparent px-2 py-2 text-agg-primary hover:opacity-80",
28992
29789
  children: [
28993
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
28994
- /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
29790
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
29791
+ /* @__PURE__ */ (0, import_jsx_runtime176.jsx)("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
28995
29792
  ]
28996
29793
  }
28997
29794
  ) : null
@@ -29003,7 +29800,7 @@ var UserInfoCard = ({
29003
29800
  UserInfoCard.displayName = "UserInfoCard";
29004
29801
 
29005
29802
  // src/pages/user-profile/index.tsx
29006
- var import_jsx_runtime176 = require("react/jsx-runtime");
29803
+ var import_jsx_runtime177 = require("react/jsx-runtime");
29007
29804
  var currencyFormatter = new Intl.NumberFormat("en-US", {
29008
29805
  style: "currency",
29009
29806
  currency: "USD",
@@ -29413,10 +30210,10 @@ var toRedeemTransactions = (item) => {
29413
30210
  });
29414
30211
  };
29415
30212
  var POSITION_ROW_VENUE_ORDER = [
29416
- import_sdk25.Venue.polymarket,
29417
- import_sdk25.Venue.kalshi,
29418
- import_sdk25.Venue.opinion,
29419
- import_sdk25.Venue.limitless
30213
+ import_sdk26.Venue.polymarket,
30214
+ import_sdk26.Venue.kalshi,
30215
+ import_sdk26.Venue.opinion,
30216
+ import_sdk26.Venue.limitless
29420
30217
  ];
29421
30218
  function venueBreakdownSortKey(venue) {
29422
30219
  const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
@@ -29501,117 +30298,127 @@ var UserProfilePage = ({
29501
30298
  onError
29502
30299
  }) => {
29503
30300
  var _a, _b;
29504
- const [isHydrated, setIsHydrated] = (0, import_react48.useState)(false);
29505
- (0, import_react48.useEffect)(() => {
30301
+ const [isHydrated, setIsHydrated] = (0, import_react49.useState)(false);
30302
+ (0, import_react49.useEffect)(() => {
29506
30303
  setIsHydrated(true);
29507
30304
  }, []);
29508
- const { user: currentUser, isAuthenticated } = (0, import_hooks76.useAggAuthState)();
29509
- const { isDepositBlocked } = (0, import_hooks76.useGeoBlock)();
29510
- const balanceState = (0, import_hooks76.useAggBalance)();
29511
- const labels = (0, import_hooks76.useLabels)();
30305
+ const { user: currentUser, isAuthenticated } = (0, import_hooks77.useAggAuthState)();
30306
+ const { isDepositBlocked } = (0, import_hooks77.useGeoBlock)();
30307
+ const balanceState = (0, import_hooks77.useAggBalance)();
30308
+ const labels = (0, import_hooks77.useLabels)();
29512
30309
  const {
29513
30310
  features: { showLimitOrders },
29514
30311
  trading: { executionMode: configuredExecutionMode }
29515
- } = (0, import_hooks76.useSdkUiConfig)();
29516
- const client = (0, import_hooks76.useAggClient)();
29517
- const cancelOrderMutation = (0, import_hooks76.useCancelManagedOrder)();
30312
+ } = (0, import_hooks77.useSdkUiConfig)();
30313
+ const client = (0, import_hooks77.useAggClient)();
30314
+ const cancelOrderMutation = (0, import_hooks77.useCancelManagedOrder)();
29518
30315
  const toastContext = useOptionalToast();
29519
- const [internalCancellingIds, setInternalCancellingIds] = (0, import_react48.useState)({});
30316
+ const [internalCancellingIds, setInternalCancellingIds] = (0, import_react49.useState)({});
29520
30317
  const { claim: startClaim, claimingKeys } = useClaimWinnings({
29521
30318
  onClaim,
29522
30319
  onClaimResult,
29523
30320
  onClaimSubmitError,
29524
30321
  externalClaimingKeys: claimingPositionKeys
29525
30322
  });
29526
- const [profileUser, setProfileUser] = (0, import_react48.useState)(void 0);
30323
+ const [profileUser, setProfileUser] = (0, import_react49.useState)(void 0);
29527
30324
  const shouldUseHookData = !user;
29528
- const connectedVenues = (0, import_react48.useMemo)(() => {
30325
+ const connectedVenues = (0, import_react49.useMemo)(() => {
29529
30326
  var _a2;
29530
30327
  if (!shouldUseHookData) return [];
29531
30328
  const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
29532
30329
  return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
29533
30330
  }, [balanceState, shouldUseHookData]);
29534
- const [positionFilter, setPositionFilter] = (0, import_react48.useState)(initialPositionFilter);
29535
- const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react48.useState)(null);
30331
+ const [positionFilter, setPositionFilter] = (0, import_react49.useState)(initialPositionFilter);
30332
+ const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react49.useState)(null);
30333
+ const [isManageBalancesOpen, setIsManageBalancesOpen] = (0, import_react49.useState)(false);
30334
+ const manageBalancesButtonRef = (0, import_react49.useRef)(null);
29536
30335
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
29537
30336
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
29538
- const activePositionsQuery = (0, import_hooks76.useExecutionPositions)({
30337
+ const handleManageBalancesOpenChange = (0, import_react49.useCallback)((open) => {
30338
+ setIsManageBalancesOpen(open);
30339
+ if (open) return;
30340
+ requestAnimationFrame(() => {
30341
+ var _a2;
30342
+ return (_a2 = manageBalancesButtonRef.current) == null ? void 0 : _a2.focus();
30343
+ });
30344
+ }, []);
30345
+ const activePositionsQuery = (0, import_hooks77.useExecutionPositions)({
29539
30346
  enabled: shouldUseHookData && isAuthenticated,
29540
30347
  status: "active",
29541
30348
  limit: 25,
29542
30349
  mode: queryExecutionMode
29543
30350
  });
29544
- const closedPositionsQuery = (0, import_hooks76.useExecutionPositions)({
30351
+ const closedPositionsQuery = (0, import_hooks77.useExecutionPositions)({
29545
30352
  enabled: shouldUseHookData && isAuthenticated,
29546
30353
  status: "closed",
29547
30354
  limit: 25,
29548
30355
  mode: queryExecutionMode
29549
30356
  });
29550
- const handlePositionFilterChange = (0, import_react48.useCallback)(
30357
+ const handlePositionFilterChange = (0, import_react49.useCallback)(
29551
30358
  (filter) => {
29552
30359
  setPositionFilter(filter);
29553
30360
  onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
29554
30361
  },
29555
30362
  [onPositionFilterChangeProp]
29556
30363
  );
29557
- (0, import_react48.useEffect)(() => {
30364
+ (0, import_react49.useEffect)(() => {
29558
30365
  setPositionFilter(initialPositionFilter);
29559
30366
  }, [initialPositionFilter]);
29560
- const ordersQuery = (0, import_hooks76.useExecutionOrders)({
30367
+ const ordersQuery = (0, import_hooks77.useExecutionOrders)({
29561
30368
  enabled: shouldUseHookData && isAuthenticated,
29562
30369
  limit: 25,
29563
30370
  mode: queryExecutionMode,
29564
30371
  refetchIntervalMs: 5e3
29565
30372
  });
29566
- const pendingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30373
+ const pendingOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29567
30374
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29568
30375
  status: OPEN_ORDER_QUERY_STATUSES[0],
29569
30376
  limit: 25,
29570
30377
  mode: queryExecutionMode
29571
30378
  });
29572
- const signingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30379
+ const signingOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29573
30380
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29574
30381
  status: OPEN_ORDER_QUERY_STATUSES[1],
29575
30382
  limit: 25,
29576
30383
  mode: queryExecutionMode
29577
30384
  });
29578
- const pendingBridgeOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30385
+ const pendingBridgeOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29579
30386
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29580
30387
  status: OPEN_ORDER_QUERY_STATUSES[2],
29581
30388
  limit: 25,
29582
30389
  mode: queryExecutionMode
29583
30390
  });
29584
- const submittingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30391
+ const submittingOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29585
30392
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29586
30393
  status: OPEN_ORDER_QUERY_STATUSES[3],
29587
30394
  limit: 25,
29588
30395
  mode: queryExecutionMode
29589
30396
  });
29590
- const submittedOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30397
+ const submittedOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29591
30398
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29592
30399
  status: OPEN_ORDER_QUERY_STATUSES[4],
29593
30400
  limit: 25,
29594
30401
  mode: queryExecutionMode
29595
30402
  });
29596
- const openOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30403
+ const openOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29597
30404
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29598
30405
  status: OPEN_ORDER_QUERY_STATUSES[5],
29599
30406
  limit: 25,
29600
30407
  mode: queryExecutionMode
29601
30408
  });
29602
- const partiallyFilledOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30409
+ const partiallyFilledOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29603
30410
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29604
30411
  status: OPEN_ORDER_QUERY_STATUSES[6],
29605
30412
  limit: 25,
29606
30413
  mode: queryExecutionMode
29607
30414
  });
29608
- const cancelPendingOpenOrdersQuery = (0, import_hooks76.useExecutionOrders)({
30415
+ const cancelPendingOpenOrdersQuery = (0, import_hooks77.useExecutionOrders)({
29609
30416
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
29610
30417
  status: OPEN_ORDER_QUERY_STATUSES[7],
29611
30418
  limit: 25,
29612
30419
  mode: queryExecutionMode
29613
30420
  });
29614
- const openOrderQueries = (0, import_react48.useMemo)(
30421
+ const openOrderQueries = (0, import_react49.useMemo)(
29615
30422
  () => [
29616
30423
  pendingOpenOrdersQuery,
29617
30424
  signingOpenOrdersQuery,
@@ -29633,11 +30440,11 @@ var UserProfilePage = ({
29633
30440
  submittingOpenOrdersQuery
29634
30441
  ]
29635
30442
  );
29636
- const activityQuery = (0, import_hooks76.useUserActivity)({
30443
+ const activityQuery = (0, import_hooks77.useUserActivity)({
29637
30444
  enabled: shouldUseHookData && isAuthenticated,
29638
30445
  limit: 25
29639
30446
  });
29640
- const handleCancelOrder = (0, import_react48.useCallback)(
30447
+ const handleCancelOrder = (0, import_react49.useCallback)(
29641
30448
  (order) => __async(null, null, function* () {
29642
30449
  if (onCancelOrder) {
29643
30450
  onCancelOrder(order);
@@ -29670,7 +30477,7 @@ var UserProfilePage = ({
29670
30477
  }),
29671
30478
  [cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
29672
30479
  );
29673
- const handleClaimPosition = (0, import_react48.useCallback)(
30480
+ const handleClaimPosition = (0, import_react49.useCallback)(
29674
30481
  (position) => {
29675
30482
  var _a2, _b2;
29676
30483
  return startClaim({
@@ -29681,7 +30488,7 @@ var UserProfilePage = ({
29681
30488
  },
29682
30489
  [startClaim]
29683
30490
  );
29684
- const handleActivityRowClick = (0, import_react48.useCallback)(
30491
+ const handleActivityRowClick = (0, import_react49.useCallback)(
29685
30492
  (activity) => {
29686
30493
  if (activity.kind === "redeem") {
29687
30494
  setSelectedClaimActivity(activity);
@@ -29691,13 +30498,13 @@ var UserProfilePage = ({
29691
30498
  },
29692
30499
  [onActivityClick]
29693
30500
  );
29694
- const handleClaimTransactionSelect = (0, import_react48.useCallback)((transaction) => {
30501
+ const handleClaimTransactionSelect = (0, import_react49.useCallback)((transaction) => {
29695
30502
  const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
29696
30503
  setSelectedClaimActivity(null);
29697
30504
  if (!href || typeof window === "undefined") return;
29698
30505
  window.open(href, "_blank", "noopener,noreferrer");
29699
30506
  }, []);
29700
- (0, import_react48.useEffect)(() => {
30507
+ (0, import_react49.useEffect)(() => {
29701
30508
  if (!shouldUseHookData || !isAuthenticated) {
29702
30509
  setProfileUser(void 0);
29703
30510
  return;
@@ -29716,11 +30523,11 @@ var UserProfilePage = ({
29716
30523
  isActive = false;
29717
30524
  };
29718
30525
  }, [client, currentUser, isAuthenticated, shouldUseHookData]);
29719
- const resolvedUser = (0, import_react48.useMemo)(() => {
30526
+ const resolvedUser = (0, import_react49.useMemo)(() => {
29720
30527
  var _a2, _b2, _c, _d, _e, _f;
29721
30528
  if (user) return user;
29722
30529
  const fullUser = profileUser != null ? profileUser : currentUser;
29723
- const walletAddress = (0, import_hooks76.getWalletAddressFromUserProfile)(fullUser);
30530
+ const walletAddress = (0, import_hooks77.getWalletAddressFromUserProfile)(fullUser);
29724
30531
  const fallbackUsername = walletAddress && shortenAddress(walletAddress) || "username";
29725
30532
  const twitterAccount = (_a2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a2.find(
29726
30533
  (account) => String(account.provider).toLowerCase() === "twitter"
@@ -29750,7 +30557,7 @@ var UserProfilePage = ({
29750
30557
  socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
29751
30558
  };
29752
30559
  }, [connectedVenues, currentUser, profileUser, user]);
29753
- const _resolvedVenueBalances = (0, import_react48.useMemo)(() => {
30560
+ const _resolvedVenueBalances = (0, import_react49.useMemo)(() => {
29754
30561
  if (_venueBalances) return _venueBalances;
29755
30562
  return balanceState.balanceBreakdown.map((item) => ({
29756
30563
  chain: item.label,
@@ -29758,32 +30565,24 @@ var UserProfilePage = ({
29758
30565
  balanceLabel: formatUsd2(item.balance)
29759
30566
  }));
29760
30567
  }, [_venueBalances, balanceState.balanceBreakdown]);
29761
- const positionsValueLabel = (0, import_react48.useMemo)(() => {
30568
+ const positionsValueLabel = (0, import_react49.useMemo)(() => {
29762
30569
  var _a2;
29763
30570
  if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
29764
- const managed = balanceState.managedBalances;
29765
- const positions = (_a2 = managed == null ? void 0 : managed.positions) != null ? _a2 : [];
29766
- const positionsValueTotal = positions.reduce((sum, p) => sum + (Number(p.balance) || 0), 0);
29767
- return formatUsd2(positionsValueTotal);
29768
- }, [balance, balanceState]);
29769
- const availableBalanceLabel = (0, import_react48.useMemo)(() => {
30571
+ return formatUsd2((_a2 = balanceState.positionsBalanceTotal) != null ? _a2 : 0);
30572
+ }, [balance == null ? void 0 : balance.totalLabel, balanceState.positionsBalanceTotal]);
30573
+ const availableBalanceLabel = (0, import_react49.useMemo)(() => {
29770
30574
  var _a2, _b2;
29771
30575
  return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
29772
30576
  }, [balanceState.availableBalance, balanceState.totalBalance]);
29773
- const reservedBalanceLabel = (0, import_react48.useMemo)(() => {
29774
- var _a2;
29775
- const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
29776
- return reserved > 0 ? formatUsd2(reserved) : void 0;
29777
- }, [balanceState.reservedBalance]);
29778
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks76.useAppConfig)();
29779
- const isKalshiAvailable = (0, import_hooks76.getVenueAvailabilityState)({
29780
- venueId: import_sdk25.Venue.kalshi,
30577
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks77.useAppConfig)();
30578
+ const isKalshiAvailable = (0, import_hooks77.getVenueAvailabilityState)({
30579
+ venueId: import_sdk26.Venue.kalshi,
29781
30580
  disabledVenues,
29782
30581
  isConfigLoading: isAppConfigLoading
29783
30582
  }) === "available";
29784
30583
  const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
29785
30584
  const isAvailableBalanceLoading = balanceState.isLoading;
29786
- const resolvedActivities = (0, import_react48.useMemo)(() => {
30585
+ const resolvedActivities = (0, import_react49.useMemo)(() => {
29787
30586
  if (activities) return activities.filter(isVisibleUserProfileActivity);
29788
30587
  const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
29789
30588
  return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
@@ -29934,7 +30733,7 @@ var UserProfilePage = ({
29934
30733
  };
29935
30734
  });
29936
30735
  }, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
29937
- const resolvedOpenOrders = (0, import_react48.useMemo)(() => {
30736
+ const resolvedOpenOrders = (0, import_react49.useMemo)(() => {
29938
30737
  if (openOrders) return openOrders;
29939
30738
  const orderRowsById = /* @__PURE__ */ new Map();
29940
30739
  for (const query of openOrderQueries) {
@@ -29975,34 +30774,34 @@ var UserProfilePage = ({
29975
30774
  });
29976
30775
  });
29977
30776
  }, [labels, openOrderQueries, openOrders]);
29978
- const isOpenOrdersQueryLoading = (0, import_react48.useMemo)(
30777
+ const isOpenOrdersQueryLoading = (0, import_react49.useMemo)(
29979
30778
  () => openOrderQueries.some((query) => query.isLoading),
29980
30779
  [openOrderQueries]
29981
30780
  );
29982
- const hasOpenOrdersQueryError = (0, import_react48.useMemo)(
30781
+ const hasOpenOrdersQueryError = (0, import_react49.useMemo)(
29983
30782
  () => openOrderQueries.some((query) => query.error),
29984
30783
  [openOrderQueries]
29985
30784
  );
29986
- const hasMoreOpenOrdersQuery = (0, import_react48.useMemo)(
30785
+ const hasMoreOpenOrdersQuery = (0, import_react49.useMemo)(
29987
30786
  () => openOrderQueries.some((query) => query.hasNextPage),
29988
30787
  [openOrderQueries]
29989
30788
  );
29990
- const isLoadingMoreOpenOrdersQuery = (0, import_react48.useMemo)(
30789
+ const isLoadingMoreOpenOrdersQuery = (0, import_react49.useMemo)(
29991
30790
  () => openOrderQueries.some((query) => query.isFetchingNextPage),
29992
30791
  [openOrderQueries]
29993
30792
  );
29994
- const handleLoadMoreOpenOrders = (0, import_react48.useCallback)(() => {
30793
+ const handleLoadMoreOpenOrders = (0, import_react49.useCallback)(() => {
29995
30794
  for (const query of openOrderQueries) {
29996
30795
  if (query.hasNextPage) {
29997
30796
  void query.fetchNextPage();
29998
30797
  }
29999
30798
  }
30000
30799
  }, [openOrderQueries]);
30001
- const adaptPositionGroups = (0, import_react48.useCallback)(
30800
+ const adaptPositionGroups = (0, import_react49.useCallback)(
30002
30801
  (groups) => {
30003
30802
  return groups.flatMap((group) => {
30004
30803
  var _a2, _b2, _c, _d;
30005
- const closedTotals = (0, import_hooks76.computeClosedPositionTotals)(group);
30804
+ const closedTotals = (0, import_hooks77.computeClosedPositionTotals)(group);
30006
30805
  const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
30007
30806
  (outcome) => outcome.winner === true
30008
30807
  );
@@ -30068,15 +30867,15 @@ var UserProfilePage = ({
30068
30867
  },
30069
30868
  []
30070
30869
  );
30071
- const resolvedActivePositions = (0, import_react48.useMemo)(() => {
30870
+ const resolvedActivePositions = (0, import_react49.useMemo)(() => {
30072
30871
  const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
30073
30872
  return source.filter(shouldIncludeByShares);
30074
30873
  }, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
30075
- const resolvedClosedPositions = (0, import_react48.useMemo)(() => {
30874
+ const resolvedClosedPositions = (0, import_react49.useMemo)(() => {
30076
30875
  const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
30077
30876
  return source.filter(shouldIncludeByShares);
30078
30877
  }, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
30079
- return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(AggErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30878
+ return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(AggErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30080
30879
  "section",
30081
30880
  {
30082
30881
  className: cn(
@@ -30084,7 +30883,7 @@ var UserProfilePage = ({
30084
30883
  "w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1440px]",
30085
30884
  classNames == null ? void 0 : classNames.root
30086
30885
  ),
30087
- children: /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
30886
+ children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
30088
30887
  "div",
30089
30888
  {
30090
30889
  className: cn(
@@ -30094,8 +30893,8 @@ var UserProfilePage = ({
30094
30893
  classNames == null ? void 0 : classNames.topRow
30095
30894
  ),
30096
30895
  children: [
30097
- /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
30098
- /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30896
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
30897
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30099
30898
  "div",
30100
30899
  {
30101
30900
  className: cn(
@@ -30103,7 +30902,7 @@ var UserProfilePage = ({
30103
30902
  "flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
30104
30903
  classNames == null ? void 0 : classNames.leftColumn
30105
30904
  ),
30106
- children: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30905
+ children: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30107
30906
  UserInfoCard,
30108
30907
  {
30109
30908
  user: resolvedUser,
@@ -30116,7 +30915,7 @@ var UserProfilePage = ({
30116
30915
  )
30117
30916
  }
30118
30917
  ),
30119
- /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
30918
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
30120
30919
  "div",
30121
30920
  {
30122
30921
  className: cn(
@@ -30124,7 +30923,7 @@ var UserProfilePage = ({
30124
30923
  classNames == null ? void 0 : classNames.rightColumn
30125
30924
  ),
30126
30925
  children: [
30127
- /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
30926
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
30128
30927
  "div",
30129
30928
  {
30130
30929
  className: cn(
@@ -30132,7 +30931,7 @@ var UserProfilePage = ({
30132
30931
  isKalshiAvailable ? "grid-cols-1 sm:grid-cols-2" : "grid-cols-1"
30133
30932
  ),
30134
30933
  children: [
30135
- /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30934
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30136
30935
  PositionsValueCard,
30137
30936
  {
30138
30937
  label: labels.userProfile.balance.positionsValue,
@@ -30140,22 +30939,21 @@ var UserProfilePage = ({
30140
30939
  isLoading: isPositionsValueLoading
30141
30940
  }
30142
30941
  ),
30143
- isKalshiAvailable ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30942
+ isKalshiAvailable ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30144
30943
  PositionsValueCard,
30145
30944
  {
30146
30945
  label: labels.userProfile.balance.kalshiBalance,
30147
30946
  valueLabel: formatUsd2((_a = balanceState.kalshiBalance) != null ? _a : 0),
30148
- icon: /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(VenueLogo, { venue: import_sdk25.Venue.kalshi, size: "small", className: "size-4" })
30947
+ icon: /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(VenueLogo, { venue: import_sdk26.Venue.kalshi, size: "small", className: "size-4" })
30149
30948
  }
30150
30949
  ) : null
30151
30950
  ]
30152
30951
  }
30153
30952
  ),
30154
- /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30953
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30155
30954
  AvailableBalanceCard,
30156
30955
  {
30157
30956
  valueLabel: availableBalanceLabel,
30158
- reservedValueLabel: reservedBalanceLabel,
30159
30957
  isLoading: isAvailableBalanceLoading,
30160
30958
  chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
30161
30959
  key: b.key,
@@ -30163,14 +30961,16 @@ var UserProfilePage = ({
30163
30961
  balance: b.balance,
30164
30962
  accountCount: b.accountCount,
30165
30963
  venues: b.venues
30166
- }))
30964
+ })),
30965
+ manageButtonRef: manageBalancesButtonRef,
30966
+ onManage: () => handleManageBalancesOpenChange(true)
30167
30967
  }
30168
30968
  )
30169
30969
  ]
30170
30970
  }
30171
30971
  )
30172
30972
  ] }),
30173
- /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
30973
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30174
30974
  PositionsActivity,
30175
30975
  {
30176
30976
  tab,
@@ -30222,7 +31022,7 @@ var UserProfilePage = ({
30222
31022
  className: classNames == null ? void 0 : classNames.positionsActivity
30223
31023
  }
30224
31024
  ),
30225
- /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
31025
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
30226
31026
  ClaimActivityBreakdownModal,
30227
31027
  {
30228
31028
  activity: selectedClaimActivity,
@@ -30232,6 +31032,13 @@ var UserProfilePage = ({
30232
31032
  },
30233
31033
  onTransactionSelect: handleClaimTransactionSelect
30234
31034
  }
31035
+ ),
31036
+ /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
31037
+ ManageBalancesModal,
31038
+ {
31039
+ open: isManageBalancesOpen,
31040
+ onOpenChange: handleManageBalancesOpenChange
31041
+ }
30235
31042
  )
30236
31043
  ]
30237
31044
  }
@@ -30245,6 +31052,7 @@ UserProfilePage.displayName = "UserProfilePage";
30245
31052
  DEPOSIT_MODAL_OPEN_EVENT,
30246
31053
  EventMarketPage,
30247
31054
  HomePage,
31055
+ ManageBalancesModal,
30248
31056
  USER_PROFILE_TAB_ACTIVITY,
30249
31057
  USER_PROFILE_TAB_OPEN_ORDERS,
30250
31058
  USER_PROFILE_TAB_POSITIONS,