@funkit/connect 9.19.1 → 9.21.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 (128) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{chunk-PFIXC5YK.js → chunk-36KVHK22.js} +5 -2
  3. package/dist/{chunk-6K4U3Z4Z.js → chunk-4YEAUICE.js} +5 -0
  4. package/dist/{chunk-NBECXHBY.js → chunk-67BKQQNG.js} +5 -2
  5. package/dist/clients/argentWallet-2WSTOUAO.js +7 -0
  6. package/dist/clients/bifrostWallet-5NQVDZ5P.js +7 -0
  7. package/dist/clients/bitgetWallet-CBQAJOIK.js +7 -0
  8. package/dist/clients/bitskiWallet-OLIYN3IU.js +7 -0
  9. package/dist/clients/bitverseWallet-AQMAJ2NN.js +7 -0
  10. package/dist/clients/bloomWallet-MJRQJYSG.js +7 -0
  11. package/dist/clients/braveWallet-T76TVZA6.js +7 -0
  12. package/dist/clients/bybitWallet-GOPAS32Q.js +7 -0
  13. package/dist/clients/chunk-4752IYY6.js +94 -0
  14. package/dist/clients/chunk-52NKHZS2.js +69 -0
  15. package/dist/clients/chunk-KSSSSWR6.js +54 -0
  16. package/dist/clients/{polymarket.js → chunk-MOUTRRN3.js} +12 -4
  17. package/dist/clients/chunk-MRBN4XCA.js +96 -0
  18. package/dist/clients/chunk-NCCAYPLO.js +230 -0
  19. package/dist/clients/chunk-OWXKWC7I.js +2382 -0
  20. package/dist/clients/chunk-ZMVXBMON.js +186 -0
  21. package/dist/clients/clvWallet-VVMLP7BK.js +7 -0
  22. package/dist/clients/coin98Wallet-I5CP5KYZ.js +7 -0
  23. package/dist/clients/coinbaseWallet-ICYEIYQD.js +7 -0
  24. package/dist/clients/coreWallet-RFVUHOVE.js +7 -0
  25. package/dist/clients/dawnWallet-QBFTQLS4.js +7 -0
  26. package/dist/clients/desigWallet-IBKYOHSY.js +7 -0
  27. package/dist/clients/enkryptWallet-ZVUZMI7H.js +7 -0
  28. package/dist/clients/fanatics.css +2891 -2702
  29. package/dist/clients/fanatics.js +43 -84
  30. package/dist/clients/foxWallet-I7D5KIW4.js +7 -0
  31. package/dist/clients/frameWallet-UDD4OVZX.js +7 -0
  32. package/dist/clients/frontierWallet-5QV7ZACT.js +7 -0
  33. package/dist/clients/gateWallet-CJNGQQCV.js +7 -0
  34. package/dist/clients/imTokenWallet-UPA7ADZ2.js +7 -0
  35. package/dist/clients/injectedWallet-OIRJSVBZ.js +7 -0
  36. package/dist/clients/kresusWallet-7ROCNWAU.js +7 -0
  37. package/dist/clients/ledgerWallet-3FCEIKPD.js +7 -0
  38. package/dist/clients/lighter.css +2891 -2702
  39. package/dist/clients/lighter.js +9 -179
  40. package/dist/clients/metaMaskWallet-RMHEKBDR.js +7 -0
  41. package/dist/clients/mewWallet-ANFGVCZT.js +7 -0
  42. package/dist/clients/nado.d.ts +78 -0
  43. package/dist/clients/nado.js +107 -0
  44. package/dist/clients/oktoWallet-Q5XCEOTD.js +7 -0
  45. package/dist/clients/okxWallet-GJMKZIND.js +7 -0
  46. package/dist/clients/omniWallet-YH4FEL6J.js +7 -0
  47. package/dist/clients/oneInchWallet-4S73ZPPN.js +7 -0
  48. package/dist/clients/oneKeyWallet-YVJDPHJS.js +7 -0
  49. package/dist/clients/phantomWallet-LZDJJ5XR.js +7 -0
  50. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +17485 -0
  51. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.d.ts +30 -0
  52. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +14 -0
  53. package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +54 -0
  54. package/dist/clients/polymarket/createPolymarketDepositConfig.js +15 -0
  55. package/dist/clients/polymarket/index.css +17485 -0
  56. package/dist/clients/polymarket/index.d.ts +8 -0
  57. package/dist/clients/polymarket/index.js +42 -0
  58. package/dist/clients/{polymarket.d.ts → polymarket/polymarket.d.ts} +59 -2
  59. package/dist/clients/polymarket/polymarket.js +24 -0
  60. package/dist/clients/polymarket/usePolymarketAccountBalances.d.ts +66 -0
  61. package/dist/clients/polymarket/usePolymarketAccountBalances.js +12 -0
  62. package/dist/clients/rabbyWallet-TYX2JDHU.js +7 -0
  63. package/dist/clients/rainbowWallet-MFJQCICF.js +7 -0
  64. package/dist/clients/ramperWallet-Q2XAH4WA.js +7 -0
  65. package/dist/clients/rolly.d.ts +2 -0
  66. package/dist/clients/rolly.js +6 -2
  67. package/dist/clients/roninWallet-SAB5ESVK.js +7 -0
  68. package/dist/clients/safeWallet-Y3VPODK2.js +7 -0
  69. package/dist/clients/safeheronWallet-MCFXLKO5.js +7 -0
  70. package/dist/clients/safepalWallet-7YULGM2L.js +7 -0
  71. package/dist/clients/subWallet-5WUZ4IIO.js +7 -0
  72. package/dist/clients/tahoWallet-U2VWWO76.js +7 -0
  73. package/dist/clients/talismanWallet-ZYTPIANG.js +7 -0
  74. package/dist/clients/tokenPocketWallet-FLFG3JUQ.js +7 -0
  75. package/dist/clients/tokenaryWallet-S3JS2IGK.js +7 -0
  76. package/dist/clients/trustWallet-2N5TZJGC.js +7 -0
  77. package/dist/clients/uniswapWallet-NJQBP5VM.js +7 -0
  78. package/dist/clients/walletConnectWallet-E4OQJ4DC.js +7 -0
  79. package/dist/clients/xdefiWallet-ZKBEFEOH.js +7 -0
  80. package/dist/clients/zealWallet-7VO3C4PM.js +7 -0
  81. package/dist/clients/zerionWallet-SEPREHKH.js +7 -0
  82. package/dist/components/Box/Box.d.ts +21 -21
  83. package/dist/components/Dropdown/AccountSelectDropdown.d.ts +45 -0
  84. package/dist/components/Dropdown/BaseDropdownItem.d.ts +3 -1
  85. package/dist/components/FreeUsdcBanner/FreeUsdcBanner.css.d.ts +15 -0
  86. package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +5 -5
  87. package/dist/components/FunButton/FunButton.css.d.ts +1 -0
  88. package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
  89. package/dist/components/ModalHeightAnimationLayer/ModalHeightAnimationLayer.d.ts +8 -0
  90. package/dist/css/sprinkles.css.d.ts +33 -21
  91. package/dist/domains/aave.d.ts +28 -0
  92. package/dist/domains/dynamicRouting.d.ts +13 -1
  93. package/dist/domains/quote.d.ts +2 -2
  94. package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
  95. package/dist/hooks/useExchangeOptions.d.ts +11 -2
  96. package/dist/hooks/useTokenAndChainDropdown.d.ts +1 -1
  97. package/dist/index.css +4289 -2860
  98. package/dist/index.js +4434 -3375
  99. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -1
  100. package/dist/modals/CheckoutModal/InputAmount/aaveClient.d.ts +3 -7
  101. package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +2 -19
  102. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +1 -1
  103. package/dist/modals/CheckoutModal/SourceChange/useSourceChangeLayout.d.ts +10 -0
  104. package/dist/modals/CheckoutModal/stepTransition.d.ts +27 -1
  105. package/dist/modals/PolymarketPerpsTransfer/DirectionSwapButton.d.ts +17 -0
  106. package/dist/modals/PolymarketPerpsTransfer/PerpsTransferBottomBar.d.ts +11 -0
  107. package/dist/modals/PolymarketPerpsTransfer/PerpsTransferRows.d.ts +10 -0
  108. package/dist/modals/PolymarketPerpsTransfer/PerpsTransferStep.d.ts +11 -0
  109. package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +52 -0
  110. package/dist/modals/PolymarketPerpsTransfer/TransferActionButton.d.ts +34 -0
  111. package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.css.d.ts +13 -0
  112. package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.d.ts +27 -0
  113. package/dist/modals/PolymarketPerpsTransfer/usePerpsTransferForm.d.ts +66 -0
  114. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +7 -0
  115. package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -1
  116. package/dist/providers/FunkitCheckoutContext/types.d.ts +63 -3
  117. package/dist/providers/FunkitConfigContext.d.ts +13 -2
  118. package/dist/providers/FunkitQuoteContext.d.ts +16 -0
  119. package/dist/providers/FunkitThemeProvider.d.ts +18 -0
  120. package/dist/themes/baseTheme.d.ts +3 -1
  121. package/dist/themes/baseTheme.js +1 -1
  122. package/dist/themes/darkTheme.js +2 -2
  123. package/dist/themes/lightTheme.js +2 -2
  124. package/dist/utils/freeUsdcBanner.d.ts +3 -0
  125. package/dist/utils/tokenMath.d.ts +6 -0
  126. package/dist/wallets/walletConnectors/index.js +42 -42
  127. package/package.json +7 -6
  128. package/dist/clients/chunk-TFZV2HO4.js +0 -290
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import {
3
+ Box
4
+ } from "./chunk-52NKHZS2.js";
5
+
6
+ // src/components/Text/Text.tsx
7
+ import React from "react";
8
+ var Text = React.forwardRef(
9
+ ({
10
+ as = "div",
11
+ children,
12
+ className,
13
+ color = "primaryText",
14
+ display,
15
+ font = "body",
16
+ id,
17
+ size = "16",
18
+ style,
19
+ tabIndex,
20
+ title,
21
+ textAlign = "inherit",
22
+ textTransform = "none",
23
+ weight = "regular",
24
+ testId
25
+ }, ref) => {
26
+ return /* @__PURE__ */ React.createElement(
27
+ Box,
28
+ {
29
+ as,
30
+ className,
31
+ color: color === "inherit" ? void 0 : color,
32
+ display,
33
+ fontFamily: font,
34
+ fontSize: size,
35
+ fontWeight: weight,
36
+ id,
37
+ title,
38
+ ref,
39
+ style,
40
+ tabIndex,
41
+ textAlign,
42
+ textTransform,
43
+ testId,
44
+ background: { selection: "textSelection" }
45
+ },
46
+ children
47
+ );
48
+ }
49
+ );
50
+ Text.displayName = "Text";
51
+
52
+ export {
53
+ Text
54
+ };
@@ -3,7 +3,7 @@ import {
3
3
  logger
4
4
  } from "./chunk-UUHGOBKZ.js";
5
5
 
6
- // src/clients/polymarket.tsx
6
+ // src/clients/polymarket/polymarket.tsx
7
7
  import {
8
8
  POLYMARKET_API_KEY,
9
9
  initializeCheckoutTokenTransferAddress
@@ -366,7 +366,7 @@ function checkFeatureGate(name) {
366
366
  }
367
367
  }
368
368
 
369
- // src/clients/polymarket.tsx
369
+ // src/clients/polymarket/polymarket.tsx
370
370
  var PMCT_WITHDRAW_ACTION_TYPE = "PMCT_WITHDRAW";
371
371
  var POLYGON_USDCE = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
372
372
  var PUSD_TOKEN = {
@@ -682,7 +682,15 @@ function createPerpsGenerateActionParams(config) {
682
682
  ];
683
683
  };
684
684
  }
685
+
685
686
  export {
686
- createPerpsGenerateActionParams,
687
- createPolymarketWithdrawalConfig
687
+ POLYGON_USDCE,
688
+ PUSD_TOKEN,
689
+ createPolymarketWithdrawalConfig,
690
+ COLLATERAL_ONRAMP_ADDRESS,
691
+ COLLATERAL_ONRAMP_ABI,
692
+ VAULT_DEPOSITOR_POLYGON,
693
+ VAULT_DEPOSITOR_ABI,
694
+ AMOUNT_PLACEHOLDER,
695
+ createPerpsGenerateActionParams
688
696
  };
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ import {
3
+ logger
4
+ } from "./chunk-UUHGOBKZ.js";
5
+
6
+ // src/clients/polymarket/usePolymarketAccountBalances.ts
7
+ import {
8
+ skipToken,
9
+ useQuery,
10
+ useQueryClient
11
+ } from "@tanstack/react-query";
12
+ import * as dnum from "dnum";
13
+ var DEFAULT_BALANCE_REFETCH_MS = 1e3;
14
+ var polymarketAccountBalanceQueryKey = (address) => ["polymarket", "accountBalanceUsd", address ?? null];
15
+ var polymarketBalanceSettleUntilQueryKey = (address) => ["polymarket", "accountBalanceSettleUntil", address];
16
+ var PUSD_DECIMALS = 6;
17
+ var SETTLEMENT_WINDOW_MS = 3e4;
18
+ function applyOptimisticTransferBalances(queryClient, transfer) {
19
+ const { fromAddress, toAddress, amountUsd } = transfer;
20
+ const amount = dnum.from(amountUsd, PUSD_DECIMALS);
21
+ shiftBalance(queryClient, fromAddress, dnum.multiply(amount, -1));
22
+ shiftBalance(queryClient, toAddress, amount);
23
+ }
24
+ function shiftBalance(queryClient, address, deltaUsd) {
25
+ const balanceKey = polymarketAccountBalanceQueryKey(address);
26
+ const displayedUsd = queryClient.getQueryData(balanceKey);
27
+ if (displayedUsd === void 0) {
28
+ return;
29
+ }
30
+ void queryClient.cancelQueries({ queryKey: balanceKey });
31
+ queryClient.setQueryData(
32
+ polymarketBalanceSettleUntilQueryKey(address),
33
+ Date.now() + SETTLEMENT_WINDOW_MS
34
+ );
35
+ queryClient.setQueryData(
36
+ balanceKey,
37
+ Math.max(0, dnum.toNumber(dnum.add(displayedUsd, deltaUsd, PUSD_DECIMALS)))
38
+ );
39
+ }
40
+ async function fetchAccountBalance(queryClient, getBalanceUsd, queryKey) {
41
+ const [, , address] = queryKey;
42
+ if (address === null) {
43
+ throw new Error("polymarket balance query ran without an address");
44
+ }
45
+ try {
46
+ const serverUsd = await getBalanceUsd();
47
+ const settleUntil = queryClient.getQueryData(
48
+ polymarketBalanceSettleUntilQueryKey(address)
49
+ );
50
+ const displayedUsd = queryClient.getQueryData(
51
+ polymarketAccountBalanceQueryKey(address)
52
+ );
53
+ if (settleUntil !== void 0 && Date.now() < settleUntil && displayedUsd !== void 0) {
54
+ return displayedUsd;
55
+ }
56
+ return serverUsd;
57
+ } catch (error) {
58
+ logger.warn("polymarket:accountBalance:fetchFailed", {
59
+ address,
60
+ error: String(error)
61
+ });
62
+ throw error;
63
+ }
64
+ }
65
+ function useAccountBalance(account, refetchIntervalMs) {
66
+ const queryClient = useQueryClient();
67
+ const getBalanceUsd = account?.getBalanceUsd;
68
+ const address = account?.address;
69
+ const query = useQuery({
70
+ queryKey: polymarketAccountBalanceQueryKey(address),
71
+ // `skipToken` disables the query when the account isn't configured (the
72
+ // perps-transfer config is optional). It is *not* a fallback for a missing
73
+ // balance — the getter is the single source of truth.
74
+ queryFn: getBalanceUsd && address ? ({ queryKey }) => fetchAccountBalance(queryClient, getBalanceUsd, queryKey) : skipToken,
75
+ refetchInterval: refetchIntervalMs,
76
+ // The poll interval is the freshness contract: a reader mounting within it
77
+ // (e.g. navigating between the deposit picker and the transfer step) reads
78
+ // the cached balance as-is instead of kicking off an extra mount fetch —
79
+ // that's what makes the navigation flash-free *and* fetch-free.
80
+ staleTime: refetchIntervalMs
81
+ });
82
+ return { balanceUsd: query.data };
83
+ }
84
+ function usePolymarketAccountBalances(accounts, options) {
85
+ const refetchIntervalMs = options?.refetchIntervalMs ?? DEFAULT_BALANCE_REFETCH_MS;
86
+ return {
87
+ predictions: useAccountBalance(accounts.predictions, refetchIntervalMs),
88
+ perps: useAccountBalance(accounts.perps, refetchIntervalMs)
89
+ };
90
+ }
91
+
92
+ export {
93
+ polymarketAccountBalanceQueryKey,
94
+ applyOptimisticTransferBalances,
95
+ usePolymarketAccountBalances
96
+ };
@@ -0,0 +1,230 @@
1
+ "use client";
2
+ import {
3
+ Box
4
+ } from "./chunk-52NKHZS2.js";
5
+ import {
6
+ logger
7
+ } from "./chunk-UUHGOBKZ.js";
8
+
9
+ // src/components/AsyncImage/useAsyncImage.ts
10
+ import { useEffect, useReducer } from "react";
11
+ var cachedUrls = /* @__PURE__ */ new Map();
12
+ var cachedRequestPromises = /* @__PURE__ */ new Map();
13
+ async function loadAsyncImage(asyncImage) {
14
+ const cachedRequestPromise = cachedRequestPromises.get(asyncImage);
15
+ if (cachedRequestPromise) {
16
+ return cachedRequestPromise;
17
+ }
18
+ const load = async () => asyncImage().then(async (url) => {
19
+ cachedUrls.set(asyncImage, url);
20
+ return url;
21
+ });
22
+ const requestPromise = load().catch(async () => {
23
+ return load().catch(() => {
24
+ cachedRequestPromises.delete(asyncImage);
25
+ return void 0;
26
+ });
27
+ });
28
+ cachedRequestPromises.set(asyncImage, requestPromise);
29
+ return requestPromise;
30
+ }
31
+ function useForceUpdate() {
32
+ const [, forceUpdate] = useReducer((x) => x + 1, 0);
33
+ return forceUpdate;
34
+ }
35
+ function useAsyncImage(url) {
36
+ const cachedUrl = typeof url === "function" ? cachedUrls.get(url) : void 0;
37
+ const forceUpdate = useForceUpdate();
38
+ useEffect(() => {
39
+ if (typeof url === "function" && !cachedUrl) {
40
+ loadAsyncImage(url).then(forceUpdate);
41
+ }
42
+ }, [url, cachedUrl, forceUpdate]);
43
+ return typeof url === "function" ? cachedUrl : url;
44
+ }
45
+ var REMOTE_IMG_CACHE = /* @__PURE__ */ new Set();
46
+ function preloadRemoteImages(...imageUrls) {
47
+ for (const imageUrl of imageUrls) {
48
+ try {
49
+ const { protocol } = new URL(imageUrl);
50
+ if (protocol !== "https:" && protocol !== "http:") {
51
+ logger.warn("preloadRemoteImages:invalidUrl", {
52
+ message: "Invalid protocol",
53
+ imageUrl
54
+ });
55
+ continue;
56
+ }
57
+ if (!REMOTE_IMG_CACHE.has(imageUrl)) {
58
+ REMOTE_IMG_CACHE.add(imageUrl);
59
+ const preloadImage = new Image();
60
+ preloadImage.src = imageUrl;
61
+ }
62
+ } catch (error) {
63
+ logger.warn("preloadRemoteImages:error", {
64
+ message: "Unable to preload image",
65
+ imageUrl,
66
+ error
67
+ });
68
+ }
69
+ }
70
+ }
71
+
72
+ // src/components/AsyncImage/AsyncImage.tsx
73
+ import React, { useMemo, useReducer as useReducer2, useState } from "react";
74
+
75
+ // src/utils/sanitizeUrl.ts
76
+ var SAFE_URL_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
77
+ function sanitizeUrl(url) {
78
+ if (!url) {
79
+ return void 0;
80
+ }
81
+ try {
82
+ const parsed = new URL(url);
83
+ if (SAFE_URL_PROTOCOLS.has(parsed.protocol)) {
84
+ return parsed.href;
85
+ }
86
+ return void 0;
87
+ } catch {
88
+ return void 0;
89
+ }
90
+ }
91
+ function sanitizeCssUrl(url) {
92
+ const safeUrl = sanitizeUrl(url);
93
+ if (!safeUrl) {
94
+ return void 0;
95
+ }
96
+ return safeUrl.replace(/['()\\]/g, (char) => {
97
+ return `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`;
98
+ });
99
+ }
100
+
101
+ // src/components/AsyncImage/AsyncImage.tsx
102
+ function useTriggeredOnce() {
103
+ return useReducer2(() => true, false);
104
+ }
105
+ function AsyncImage({
106
+ alt,
107
+ background,
108
+ borderColor,
109
+ borderRadius,
110
+ boxShadow,
111
+ height,
112
+ useAsImage,
113
+ src: srcProp,
114
+ fallbackSrc,
115
+ fallbackElement,
116
+ width,
117
+ testId
118
+ }) {
119
+ const src = useAsyncImage(srcProp || fallbackSrc);
120
+ const isRemoteImage = src !== void 0 && /^(https?|data):/.test(src);
121
+ const [isRemoteImageLoaded, setRemoteImageLoaded] = useTriggeredOnce();
122
+ const [hasError, setHasError] = useState(
123
+ srcProp === void 0 && fallbackSrc === void 0
124
+ );
125
+ const { asyncStyle, imgProps } = useMemo(() => {
126
+ const asyncStyle2 = !useAsImage ? getRemoteImageStyles(isRemoteImage, isRemoteImageLoaded, src) : {};
127
+ if (useAsImage || isRemoteImage) {
128
+ const imgProps2 = {
129
+ as: "img",
130
+ src,
131
+ "aria-hidden": true,
132
+ onError: ({
133
+ currentTarget
134
+ }) => {
135
+ currentTarget.onerror = null;
136
+ if (fallbackSrc !== void 0) {
137
+ currentTarget.src = fallbackSrc;
138
+ } else {
139
+ setHasError(true);
140
+ }
141
+ },
142
+ onLoad: isRemoteImage ? setRemoteImageLoaded : void 0
143
+ };
144
+ return { imgProps: imgProps2, asyncStyle: asyncStyle2 };
145
+ }
146
+ return {
147
+ imgProps: {
148
+ backgroundSize: "cover"
149
+ },
150
+ asyncStyle: {
151
+ ...asyncStyle2,
152
+ // has to be added as a inline style because vanilla-extract doesn't recognize this as a valid style
153
+ backgroundPosition: "center"
154
+ }
155
+ };
156
+ }, [
157
+ fallbackSrc,
158
+ isRemoteImage,
159
+ isRemoteImageLoaded,
160
+ src,
161
+ useAsImage,
162
+ setRemoteImageLoaded
163
+ ]);
164
+ const mainElement = hasError && fallbackElement || /* @__PURE__ */ React.createElement(
165
+ Box,
166
+ {
167
+ ...imgProps,
168
+ height: "full",
169
+ position: "absolute",
170
+ style: {
171
+ WebkitTouchCallout: "none",
172
+ transition: "opacity .15s linear",
173
+ userSelect: "none",
174
+ ...asyncStyle
175
+ },
176
+ width: "full"
177
+ }
178
+ );
179
+ return /* @__PURE__ */ React.createElement(
180
+ Box,
181
+ {
182
+ "aria-label": alt,
183
+ borderRadius,
184
+ boxShadow,
185
+ height: typeof height === "string" ? height : void 0,
186
+ overflow: "hidden",
187
+ position: "relative",
188
+ role: "img",
189
+ style: {
190
+ background,
191
+ height: typeof height === "number" ? height : void 0,
192
+ width: typeof width === "number" ? width : void 0
193
+ },
194
+ width: typeof width === "string" ? width : void 0,
195
+ testId
196
+ },
197
+ mainElement,
198
+ borderColor ? /* @__PURE__ */ React.createElement(
199
+ Box,
200
+ {
201
+ ...typeof borderColor === "object" && "custom" in borderColor ? { style: { borderColor: borderColor.custom } } : { borderColor },
202
+ borderRadius,
203
+ borderStyle: "solid",
204
+ borderWidth: "1",
205
+ height: "full",
206
+ position: "relative",
207
+ width: "full"
208
+ }
209
+ ) : null
210
+ );
211
+ }
212
+ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
213
+ if (isRemoteImage) {
214
+ return {
215
+ opacity: isRemoteImageLoaded ? 1 : 0
216
+ };
217
+ }
218
+ const safeSrc = sanitizeCssUrl(src);
219
+ return {
220
+ // note the url must have quotation, see https://github.com/evanw/esbuild/issues/1843#issuecomment-1370108070
221
+ backgroundImage: safeSrc ? `url('${safeSrc}')` : void 0,
222
+ backgroundRepeat: "no-repeat",
223
+ opacity: src ? 1 : 0
224
+ };
225
+ };
226
+
227
+ export {
228
+ preloadRemoteImages,
229
+ AsyncImage
230
+ };