"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("react-device-detect"),i=require("./wallet-connect-BuohfvHK.js"),n=require("./context-rs-ygOK2.js"),o=require("./index-Ub4KpwSY.js"),s=require("./internal-context-CdsQ3LEl.js"),a=require("./modal-context-BgeioxwT.js"),l=require("./ScreenLayout-DaFW0I3a.js"),u=require("./toViemAccount-CopJpCYv.js"),c=require("./ConnectionStatusScreen-_i3FVj8K.js");require("./errors-CBapWvRs.js"),require("ofetch"),require("./getPublicClient-CFd_sHBk.js"),require("viem"),require("viem/chains"),require("@privy-io/js-sdk-core"),require("eventemitter3"),require("tinycolor2"),require("zustand"),require("viem/utils"),require("./ModalHeader-Cpls13mi.js"),require("styled-components"),require("./useActiveWallet-dTc6deka.js"),require("./events-context-Di6--rDg.js"),require("./privy-context-UTJouJ1x.js"),require("@privy-io/are-addresses-equal"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("./Screen-8NusMFtu.js"),require("./index-ByFhjjzH.js"),require("jose"),require("@coinbase/wallet-sdk"),require("@walletconnect/ethereum-provider"),require("./pkce-CmuJlEgn.js"),require("./paths-DizMb-lU.js"),require("./PrivyPluginContext-DsLtVhZA.js"),require("js-cookie"),require("@privy-io/ethereum"),require("viem/accounts"),require("./index-BoiKFBqR.js"),require("mipd"),require("@scure/base"),require("./usePrivy-Dt4_yE6Q.js"),require("./use-unlink-wallet-DAxmY7kq.js"),require("@privy-io/popup"),require("@headlessui/react"),require("@privy-io/urls"),require("./getEmbeddedConnectedWallet-D6YL2FS9.js"),require("./frame-BHa-PKpX.js"),require("@privy-io/routes"),require("./use-deposit-address-CVyd0fqP.js"),require("x402/client"),require("@privy-io/api-base"),require("./use-sign-with-user-signer-BhoaqeNG.js"),require("./Link-BdtTp2J4.js"),require("./useI18n-DMbkgRzj.js"),require("./shouldProceedtoEmbeddedWalletCreationFlow-DTSTIV1u.js");const d=({walletLogo:r,success:t,errorMessage:n,title:o,subtitle:s,onRetry:a,onUseDifferentWallet:u,onBack:c,numRetries:d,maxRetries:q})=>/*#__PURE__*/e.jsx(l.ScreenLayout,{title:o,subtitle:s,icon:r,iconVariant:"loading",iconLoadingStatus:{success:t,fail:!!n},primaryCta:n===i.ConnectorErrors.ERROR_USER_EXISTS?{label:"Use a different wallet",onClick:u}:!t&&n?.retryable&&d<q?{label:"Retry",onClick:a,disabled:!n?.retryable||d>=q}:!t&&n&&d>=q?{label:"Use a different wallet",onClick:u}:void 0,onBack:c,watermark:!0}),q={component:()=>{let i,{navigateBack:l,navigate:q,lastScreen:p,currentScreen:w,data:m,setModalData:j}=a.usePrivyModal(),{walletConnectionStatus:y,closePrivyModal:C}=s.usePrivyInternal(),[g,v]=r.useState(void 0),[S,f]=r.useState(0),h=o.useExternalWalletListing(y?.connector?.walletClientType||"unknown"),k="connected"===y?.status,x="switching_to_supported_chain"===y?.status;r.useEffect((()=>{if(k){let e;if(m?.externalConnectWallet?.onCompleteNavigateTo){let r=m.externalConnectWallet.onCompleteNavigateTo,t=y.connectedWallet?.address;e=setTimeout((()=>{if(m.funding&&y.connector){let e=y.connector.wallets.find((e=>e.address===t));j({...m,funding:{...m.funding,connectedWallet:e}})}q(r({address:t,walletClientType:y.connector?.walletClientType,walletChainType:y.connector?.chainType}))}),n.DEFAULT_SUCCESS_SCREEN_DURATION_MS)}else e=setTimeout(C,n.DEFAULT_SUCCESS_SCREEN_DURATION_MS);return()=>clearTimeout(e)}}),[k]);r.useEffect((()=>{y?.connectError&&(e=>{v(c.getErrorDetails(e))})(y?.connectError)}),[y]);let b=y?.connector?.connectorType||"injected",E=y?.connector?.walletClientType||"unknown",R=h?.metadata?.shortName||h?.name||y?.connector?.walletBranding.name||"Browser Extension",T=h?.image_url?.md||y?.connector?.walletBranding.icon||(r=>/*#__PURE__*/e.jsx(u.BrowserExtensionWallet,{...r})),_="Browser Extension"===R?R.toLowerCase():R;i=k?`Successfully connected with ${_}`:g?g.message:x?"Switching networks":`Waiting for ${_}`;let M="Don’t see your wallet? Check your other browser windows.";return k?M="You’re good to go!":S>=2&&g?M="Unable to connect wallet":g?M=g.detail:x?M="Switch your wallet to the requested network.":"metamask"===E&&t.isMobile?M="Click to continue to open and connect MetaMask.":"metamask"===E?M="For the best experience, connect only one wallet at a time.":"wallet_connect_v2"===b?M="Open your mobile wallet app to continue":"coinbase_wallet"===b&&(M="Confirm in the Coinbase app/popup to continue."),/*#__PURE__*/e.jsx(d,{walletName:R,walletLogo:T,success:k,errorMessage:g,title:i,subtitle:M,onRetry:()=>{f(S+1),v(void 0),y?.connectRetry()},onUseDifferentWallet:l,onBack:w===p?void 0:l,numRetries:S,maxRetries:2})}};exports.ConnectOnlyStatusScreen=q,exports.ConnectOnlyStatusScreenView=d,exports.default=q;
//# sourceMappingURL=ConnectOnlyStatusScreen-D12EvZT0.js.map
