import{gt as e}from"./ccip.js";import{Ht as t,Vt as n,n as r,r as i,st as a,zt as o}from"./_esm.js";import{D as s,E as c,T as l,U as u,d,n as f,o as p,t as m,w as h}from"./ApiController.js";import{t as g}from"./ConstantsUtil.js";function _(e,t={}){let{key:n=`fallback`,name:r=`Fallback`,rank:a=!1,shouldThrow:o=v,retryCount:s,retryDelay:c}=t;return(({chain:t,pollingInterval:l=4e3,timeout:u,...d})=>{let f=e,p=()=>{},m=i({key:n,name:r,async request({method:e,params:n}){let r,i=async(a=0)=>{let s=f[a]({...d,chain:t,retryCount:0,timeout:u});try{let t=await s.request({method:e,params:n});return p({method:e,params:n,response:t,transport:s,status:`success`}),t}catch(c){if(p({error:c,method:e,params:n,transport:s,status:`error`}),o(c)||a===f.length-1||(r??=f.slice(a+1).some(n=>{let{include:r,exclude:i}=n({chain:t}).config.methods||{};return r?r.includes(e):!i||!i.includes(e)}),!r))throw c;return i(a+1)}};return i()},retryCount:s,retryDelay:c,type:`fallback`},{onResponse:e=>p=e,transports:f.map(e=>e({chain:t,retryCount:0}))});if(a){let e=typeof a==`object`?a:{};y({chain:t,interval:e.interval??l,onTransports:e=>f=e,ping:e.ping,sampleCount:e.sampleCount,timeout:e.timeout,transports:f,weights:e.weights})}return m})}function v(r){return!!(`code`in r&&typeof r.code==`number`&&(r.code===o.code||r.code===n.code||r.code===t.code||e.nodeMessage.test(r.message)||r.code===5e3))}function y({chain:e,interval:t=4e3,onTransports:n,ping:r,sampleCount:i=10,timeout:o=1e3,transports:s,weights:c={}}){let{stability:l=.7,latency:u=.3}=c,d=[],f=async()=>{let c=await Promise.all(s.map(async t=>{let n=t({chain:e,retryCount:0,timeout:o}),i=Date.now(),a,s;try{await(r?r({transport:n}):n.request({method:`net_listening`})),s=1}catch{s=0}finally{a=Date.now()}return{latency:a-i,success:s}}));d.push(c),d.length>i&&d.shift();let p=Math.max(...d.map(e=>Math.max(...e.map(({latency:e})=>e))));n(s.map((e,t)=>{let n=d.map(e=>e[t].latency),r=1-n.reduce((e,t)=>e+t,0)/n.length/p,i=d.map(e=>e[t].success),a=i.reduce((e,t)=>e+t,0)/i.length;return a===0?[0,t]:[u*r+l*a,t]}).sort((e,t)=>t[0]-e[0]).map(([,e])=>s[e])),await a(t),f()};f()}var b={METMASK_CONNECTOR_NAME:`MetaMask`,TRUST_CONNECTOR_NAME:`Trust Wallet`,SOLFLARE_CONNECTOR_NAME:`Solflare`,PHANTOM_CONNECTOR_NAME:`Phantom`,COIN98_CONNECTOR_NAME:`Coin98`,MAGIC_EDEN_CONNECTOR_NAME:`Magic Eden`,BACKPACK_CONNECTOR_NAME:`Backpack`,BITGET_CONNECTOR_NAME:`Bitget Wallet`,FRONTIER_CONNECTOR_NAME:`Frontier`,XVERSE_CONNECTOR_NAME:`Xverse Wallet`,LEATHER_CONNECTOR_NAME:`Leather`,OKX_CONNECTOR_NAME:`OKX Wallet`,EIP155:u.CHAIN.EVM,ADD_CHAIN_METHOD:`wallet_addEthereumChain`,EIP6963_ANNOUNCE_EVENT:`eip6963:announceProvider`,EIP6963_REQUEST_EVENT:`eip6963:requestProvider`,CONNECTOR_RDNS_MAP:{coinbaseWallet:`com.coinbase.wallet`,coinbaseWalletSDK:`com.coinbase.wallet`},CONNECTOR_TYPE_EXTERNAL:`EXTERNAL`,CONNECTOR_TYPE_WALLET_CONNECT:`WALLET_CONNECT`,CONNECTOR_TYPE_INJECTED:`INJECTED`,CONNECTOR_TYPE_ANNOUNCED:`ANNOUNCED`,CONNECTOR_TYPE_AUTH:`AUTH`,CONNECTOR_TYPE_MULTI_CHAIN:`MULTI_CHAIN`,CONNECTOR_TYPE_W3M_AUTH:`ID_AUTH`,getSDKVersionWarningMessage(e,t){return`
     @@@@@@@           @@@@@@@@@@@@@@@@@@      
   @@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@@   
  @@@@@@@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@@@@@  
 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@  
 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@   @@@@@@@@@@@ 
 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@   @@@@@@@@@@@@ 
 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@  @@@@@@@@@@@@@
 @@@@@@@@@@@@@@@  @@@@@@@@@@@@   @@@@@@@@@@@@@    
 @@@@@@   @@@@@@  @@@@@@@@@@@   @@@@@@@@@@@@@@    
 @@@@@@   @@@@@@  @@@@@@@@@@@  @@@@@@@@@@@@@@@ 
 @@@@@@@@@@@@@@@  @@@@@@@@@@   @@@@@@@@@@@@@@@ 
 @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@  
  @@@@@@@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@@@@@  
   @@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@@   
      @@@@@            @@@@@@@@@@@@@@@@@@  
      
AppKit SDK version ${e} is outdated. Latest version is ${t}. Please update to the latest version for bug fixes and new features.
            
Changelog: https://github.com/reown-com/appkit/releases
NPM Registry: https://www.npmjs.com/package/@reown/appkit`}},x={ConnectorExplorerIds:{[u.CONNECTOR_ID.COINBASE]:`fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa`,[u.CONNECTOR_ID.COINBASE_SDK]:`fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa`,[u.CONNECTOR_ID.SAFE]:`225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f`,[u.CONNECTOR_ID.LEDGER]:`19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927`,[u.CONNECTOR_ID.OKX]:`971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709`,[b.METMASK_CONNECTOR_NAME]:`c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96`,[b.TRUST_CONNECTOR_NAME]:`4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0`,[b.SOLFLARE_CONNECTOR_NAME]:`1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79`,[b.PHANTOM_CONNECTOR_NAME]:`a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393`,[b.COIN98_CONNECTOR_NAME]:`2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01`,[b.MAGIC_EDEN_CONNECTOR_NAME]:`8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6`,[b.BACKPACK_CONNECTOR_NAME]:`2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0`,[b.BITGET_CONNECTOR_NAME]:`38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662`,[b.FRONTIER_CONNECTOR_NAME]:`85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041`,[b.XVERSE_CONNECTOR_NAME]:`2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b`,[b.LEATHER_CONNECTOR_NAME]:`483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13`,[b.OKX_CONNECTOR_NAME]:`971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709`},NetworkImageIds:{1:`ba0ba0cd-17c6-4806-ad93-f9d174f17900`,42161:`3bff954d-5cb0-47a0-9a23-d20192e74600`,43114:`30c46e53-e989-45fb-4549-be3bd4eb3b00`,56:`93564157-2e8e-4ce7-81df-b264dbee9b00`,250:`06b26297-fe0c-4733-5d6b-ffa5498aac00`,10:`ab9c186a-c52f-464b-2906-ca59d760a400`,137:`41d04d42-da3b-4453-8506-668cc0727900`,5e3:`e86fae9b-b770-4eea-e520-150e12c81100`,295:`6a97d510-cac8-4e58-c7ce-e8681b044c00`,11155111:`e909ea0a-f92a-4512-c8fc-748044ea6800`,84532:`a18a7ecd-e307-4360-4746-283182228e00`,1301:`4eeea7ef-0014-4649-5d1d-07271a80f600`,130:`2257980a-3463-48c6-cbac-a42d2a956e00`,10143:`0a728e83-bacb-46db-7844-948f05434900`,100:`02b53f6a-e3d4-479e-1cb4-21178987d100`,9001:`f926ff41-260d-4028-635e-91913fc28e00`,324:`b310f07f-4ef7-49f3-7073-2a0a39685800`,314:`5a73b3dd-af74-424e-cae0-0de859ee9400`,4689:`34e68754-e536-40da-c153-6ef2e7188a00`,1088:`3897a66d-40b9-4833-162f-a2c90531c900`,1284:`161038da-44ae-4ec7-1208-0ea569454b00`,1285:`f1d73bb6-5450-4e18-38f7-fb6484264a00`,7777777:`845c60df-d429-4991-e687-91ae45791600`,42220:`ab781bbc-ccc6-418d-d32d-789b15da1f00`,8453:`7289c336-3981-4081-c5f4-efc26ac64a00`,1313161554:`3ff73439-a619-4894-9262-4470c773a100`,2020:`b8101fc0-9c19-4b6f-ec65-f6dfff106e00`,2021:`b8101fc0-9c19-4b6f-ec65-f6dfff106e00`,80094:`e329c2c9-59b0-4a02-83e4-212ff3779900`,2741:`fc2427d1-5af9-4a9c-8da5-6f94627cd900`,"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":`a1b58899-f671-4276-6a5e-56ca5bd59700`,"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":`a1b58899-f671-4276-6a5e-56ca5bd59700`,EtWTRABZaYq6iMfeYKouRu166VU2xqa1:`a1b58899-f671-4276-6a5e-56ca5bd59700`,"000000000019d6689c085ae165831e93":`0b4838db-0161-4ffe-022d-532bf03dba00`,"000000000933ea01ad0ee984209779ba":`39354064-d79b-420b-065d-f980c4b78200`,"00000008819873e925422c1ff0f99f7c":`b3406e4a-bbfc-44fb-e3a6-89673c78b700`},ConnectorImageIds:{[u.CONNECTOR_ID.COINBASE]:`0c2840c3-5b04-4c44-9661-fbd4b49e1800`,[u.CONNECTOR_ID.COINBASE_SDK]:`0c2840c3-5b04-4c44-9661-fbd4b49e1800`,[u.CONNECTOR_ID.SAFE]:`461db637-8616-43ce-035a-d89b8a1d5800`,[u.CONNECTOR_ID.LEDGER]:`54a1aa77-d202-4f8d-0fb2-5d2bb6db0300`,[u.CONNECTOR_ID.WALLET_CONNECT]:`ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400`,[u.CONNECTOR_ID.INJECTED]:`07ba87ed-43aa-4adf-4540-9e6a2b9cae00`},ConnectorNamesMap:{[u.CONNECTOR_ID.INJECTED]:`Browser Wallet`,[u.CONNECTOR_ID.WALLET_CONNECT]:`WalletConnect`,[u.CONNECTOR_ID.COINBASE]:`Coinbase`,[u.CONNECTOR_ID.COINBASE_SDK]:`Coinbase`,[u.CONNECTOR_ID.LEDGER]:`Ledger`,[u.CONNECTOR_ID.SAFE]:`Safe`},ConnectorTypesMap:{[u.CONNECTOR_ID.INJECTED]:`INJECTED`,[u.CONNECTOR_ID.WALLET_CONNECT]:`WALLET_CONNECT`,[u.CONNECTOR_ID.EIP6963]:`ANNOUNCED`,[u.CONNECTOR_ID.AUTH]:`AUTH`,[b.CONNECTOR_TYPE_AUTH]:`AUTH`},WalletConnectRpcChainIds:[1,5,11155111,10,420,42161,421613,137,80001,42220,1313161554,1313161555,56,97,43114,43113,100,8453,84531,7777777,999,324,280]},S={getCaipTokens(e){if(!e)return;let t={};return Object.entries(e).forEach(([e,n])=>{t[`${b.EIP155}:${e}`]=n}),t},isLowerCaseMatch(e,t){return e?.toLowerCase()===t?.toLowerCase()},getActiveNamespaceConnectedToAuth(){let e=f.state.activeChain;return u.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(t=>d.getConnectorId(t)===u.CONNECTOR_ID.AUTH&&t===e)},withRetry({conditionFn:e,intervalMs:t,maxRetries:n}){let r=0;return new Promise(i=>{async function a(){return r+=1,await e()?i(!0):r>=n?i(!1):(setTimeout(a,t),null)}a()})},userChainIdToChainNamespace(e){if(typeof e==`number`)return u.CHAIN.EVM;let[t]=e.split(`:`);return t},getOtherAuthNamespaces(e){return e?u.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(t=>t!==e):[]},getConnectorStorageInfo(e,t){let n=s.getConnections()[t]??[];return{hasDisconnected:s.isConnectorDisconnected(e,t),hasConnected:n.some(t=>S.isLowerCaseMatch(t.connectorId,e))}}},C=`rpc.walletconnect.org`;function w(e,t){let n=new URL(`https://rpc.walletconnect.org/v1/`);return n.searchParams.set(`chainId`,e),n.searchParams.set(`projectId`,t),n.toString()}var T=`near:mainnet.solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp.eip155:1101.eip155:56.eip155:42161.eip155:7777777.eip155:59144.eip155:324.solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1.eip155:5000.solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz.eip155:80084.eip155:5003.eip155:100.eip155:8453.eip155:42220.eip155:1313161555.eip155:17000.eip155:1.eip155:300.eip155:1313161554.eip155:1329.eip155:84532.eip155:421614.eip155:11155111.eip155:8217.eip155:43114.solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z.eip155:999999999.eip155:11155420.eip155:80002.eip155:97.eip155:43113.eip155:137.eip155:10.eip155:1301.eip155:80094.eip155:80069.eip155:560048.eip155:31.eip155:2818.eip155:57054.eip155:911867.eip155:534351.eip155:1112.eip155:534352.eip155:1111.eip155:146.eip155:130.eip155:1284.eip155:30.eip155:2810.bip122:000000000019d6689c085ae165831e93.bip122:000000000933ea01ad0ee984209779ba`.split(`.`),E={extendRpcUrlWithProjectId(e,t){let n=!1;try{n=new URL(e).host===C}catch{n=!1}if(n){let n=new URL(e);return n.searchParams.has(`projectId`)||n.searchParams.set(`projectId`,t),n.toString()}return e},isCaipNetwork(e){return`chainNamespace`in e&&`caipNetworkId`in e},getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:u.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${u.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,n){let r=e.rpcUrls?.default?.http?.[0];return T.includes(t)?w(t,n):r||``},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){let i=this.getChainNamespace(e),a=this.getCaipNetworkId(e),o=e.rpcUrls?.default?.http?.[0],s=this.getDefaultRpcUrl(e,a,n),c=e?.rpcUrls?.chainDefault?.http?.[0]||o,l=r?.[a]?.map(e=>e.url)||[],u=[...l,...s?[s]:[]],d=[...l];return c&&!d.includes(c)&&d.push(c),{...e,chainNamespace:i,caipNetworkId:a,assets:{imageId:x.NetworkImageIds[e.id],imageUrl:t?.[e.id]},rpcUrls:{...e.rpcUrls,default:{http:u},chainDefault:{http:d}}}},extendCaipNetworks(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){return e.map(e=>E.extendCaipNetwork(e,{customNetworkImageUrls:t,customRpcUrls:r,projectId:n}))},getViemTransport(e,t,n){let i=[];return n?.forEach(e=>{i.push(r(e.url,e.config))}),T.includes(e.caipNetworkId)&&i.push(r(w(e.caipNetworkId,t),{fetchOptions:{headers:{"Content-Type":`text/plain`}}})),e?.rpcUrls?.default?.http?.forEach(e=>{i.push(r(e))}),_(i)},extendWagmiTransports(e,t,n){if(T.includes(e.caipNetworkId)){let i=this.getDefaultRpcUrl(e,e.caipNetworkId,t);return _([n,r(i)])}return n},getUnsupportedNetwork(e){return{id:e.split(`:`)[1],caipNetworkId:e,name:u.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(`:`)[0],nativeCurrency:{name:``,decimals:0,symbol:``},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(e){let t=s.getActiveCaipNetworkId(),n=f.getAllRequestedCaipNetworks(),r=Array.from(f.state.chains?.keys()||[]),i=t?.split(`:`)[0],a=i?r.includes(i):!1,o=n?.find(e=>e.caipNetworkId===t);return a&&!o&&t?this.getUnsupportedNetwork(t):o||e||n?.[0]}},D={filterOutDuplicatesByRDNS(e){let t=h.state.enableEIP6963?d.state.connectors:[],n=s.getRecentWallets(),r=t.map(e=>e.info?.rdns).filter(Boolean),i=n.map(e=>e.rdns).filter(Boolean),a=r.concat(i);if(a.includes(`io.metamask.mobile`)&&c.isMobile()){let e=a.indexOf(`io.metamask.mobile`);a[e]=`io.metamask`}return e.filter(e=>!(e?.rdns&&a.includes(String(e.rdns))||!e?.rdns&&t.some(t=>t.name===e.name)))},filterOutDuplicatesByIds(e){let t=d.state.connectors.filter(e=>e.type===`ANNOUNCED`||e.type===`INJECTED`),n=s.getRecentWallets(),r=t.map(e=>e.explorerId),i=n.map(e=>e.id),a=r.concat(i);return e.filter(e=>!a.includes(e?.id))},filterOutDuplicateWallets(e){let t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){let{connectors:t}=d.state,{featuredWalletIds:n}=h.state,r=t.filter(e=>e.type===`ANNOUNCED`).reduce((e,t)=>(t.info?.rdns&&(e[t.info.rdns]=!0),e),{});return e.map(e=>({...e,installed:!!e.rdns&&!!r[e.rdns??``]})).sort((e,t)=>{let r=Number(t.installed)-Number(e.installed);if(r!==0)return r;if(n?.length){let r=n.indexOf(e.id),i=n.indexOf(t.id);if(r!==-1&&i!==-1)return r-i;if(r!==-1)return-1;if(i!==-1)return 1}return 0})},getConnectOrderMethod(e,t){let n=e?.connectMethodsOrder||h.state.features?.connectMethodsOrder,r=t||d.state.connectors;if(n)return n;let{injected:i,announced:a}=O.getConnectorsByType(r,m.state.recommended,m.state.featured),o=i.filter(O.showConnector),s=a.filter(O.showConnector);return o.length||s.length?[`wallet`,`email`,`social`]:g.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(e){let t=!!e.rdns&&m.state.excludedWallets.some(t=>t.rdns===e.rdns),n=!!e.name&&m.state.excludedWallets.some(t=>S.isLowerCaseMatch(t.name,e.name));return t||n},markWalletsWithDisplayIndex(e){return e.map((e,t)=>({...e,display_index:t}))}},O={getConnectorsByType(e,t,n){let{customWallets:r}=h.state,i=s.getRecentWallets(),a=D.filterOutDuplicateWallets(t),o=D.filterOutDuplicateWallets(n),c=e.filter(e=>e.type===`MULTI_CHAIN`),l=e.filter(e=>e.type===`ANNOUNCED`),u=e.filter(e=>e.type===`INJECTED`);return{custom:r,recent:i,external:e.filter(e=>e.type===`EXTERNAL`),multiChain:c,announced:l,injected:u,recommended:a,featured:o}},showConnector(e){let t=e.info?.rdns,n=!!t&&m.state.excludedWallets.some(e=>!!e.rdns&&e.rdns===t),r=!!e.name&&m.state.excludedWallets.some(t=>S.isLowerCaseMatch(t.name,e.name));return!(e.type===`INJECTED`&&(e.name===`Browser Wallet`&&(!c.isMobile()||c.isMobile()&&!t&&!p.checkInstalled())||n||r)||(e.type===`ANNOUNCED`||e.type===`EXTERNAL`)&&(n||r))},getIsConnectedWithWC(){return Array.from(f.state.chains.values()).some(e=>d.getConnectorId(e.namespace)===u.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:e,featured:t,custom:n,recent:r,announced:i,injected:a,multiChain:o,external:s,overriddenConnectors:c=h.state.features?.connectorTypeOrder??[]}){let l=[{type:`walletConnect`,isEnabled:!0},{type:`recent`,isEnabled:r.length>0},{type:`injected`,isEnabled:[...a,...i,...o].length>0},{type:`featured`,isEnabled:t.length>0},{type:`custom`,isEnabled:n&&n.length>0},{type:`external`,isEnabled:s.length>0},{type:`recommended`,isEnabled:e.length>0}].filter(e=>e.isEnabled),u=new Set(l.map(e=>e.type)),d=c.filter(e=>u.has(e)).map(e=>({type:e,isEnabled:!0})),f=l.filter(({type:e})=>!d.some(({type:t})=>t===e));return Array.from(new Set([...d,...f].map(({type:e})=>e)))},sortConnectorsByExplorerWallet(e){return[...e].sort((e,t)=>e.explorerWallet&&t.explorerWallet?(e.explorerWallet.order??0)-(t.explorerWallet.order??0):e.explorerWallet?-1:+!!t.explorerWallet)},getAuthName({email:e,socialUsername:t,socialProvider:n}){return t?n&&n===`discord`&&t.endsWith(`0`)?t.slice(0,-1):t:e.length>30?`${e.slice(0,-3)}...`:e},async fetchProviderData(e){try{if(e.name===`Browser Wallet`&&!c.isMobile()||e.id===u.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};let[t,n]=await Promise.all([e.provider?.request({method:`eth_accounts`}),e.provider?.request({method:`eth_chainId`}).then(e=>Number(e))]);return{accounts:t,chainId:n}}catch(t){return console.warn(`Failed to fetch provider data for ${e.name}`,t),{accounts:[],chainId:void 0}}},getFilteredCustomWallets(e){let t=s.getRecentWallets(),n=d.state.connectors.map(e=>e.info?.rdns).filter(Boolean),r=t.map(e=>e.rdns).filter(Boolean),i=n.concat(r);if(i.includes(`io.metamask.mobile`)&&c.isMobile()){let e=i.indexOf(`io.metamask.mobile`);i[e]=`io.metamask`}return e.filter(e=>!i.includes(String(e?.rdns)))},hasWalletConnector(e){return d.state.connectors.some(t=>t.id===e.id||t.name===e.name)},isWalletCompatibleWithCurrentChain(e){let t=f.state.activeChain;return t&&e.chains?e.chains.some(e=>{let n=e.split(`:`)[0];return t===n}):!0},getFilteredRecentWallets(){return s.getRecentWallets().filter(e=>!D.isExcluded(e)).filter(e=>!this.hasWalletConnector(e)).filter(e=>this.isWalletCompatibleWithCurrentChain(e))},getCappedRecommendedWallets(e){let{connectors:t}=d.state,{customWallets:n,featuredWalletIds:r}=h.state,i=t.find(e=>e.id===`walletConnect`),a=t.filter(e=>e.type===`INJECTED`||e.type===`ANNOUNCED`||e.type===`MULTI_CHAIN`);if(!i&&!a.length&&!n?.length)return[];let o=l.isEmailEnabled(),s=l.isSocialsEnabled(),c=a.filter(e=>e.name!==`Browser Wallet`),u=r?.length||0,f=n?.length||0,p=c.length||0,m=+!!o,g=+!!s,_=u+f+p+m+g,v=Math.max(0,4-_);return v<=0?[]:D.filterOutDuplicateWallets(e).slice(0,v)}};export{x as a,S as i,D as n,b as o,E as r,O as t};