"use strict";var e=require("react"),r=require("./user-D2oPA-vS.js"),t=require("zustand"),n=require("./internal-context-CdsQ3LEl.js"),o=require("./errors-CBapWvRs.js"),i=require("./privy-context-UTJouJ1x.js");const s=(e,{chainType:r,walletIndex:t}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==t&&e.walletIndex!==t||void 0!==r&&e.chainType!==r)))??[],a=t.create((()=>({ethereumExternal:[],areExternalConnectorsReady:!1,ethereumEmbedded:[]}))),l=/*#__PURE__*/e.createContext(!1);const d=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")};exports.PrivySingletonContext=l,exports.getEntropyDetailsForUser=(e,r)=>{if(r?.imported)return d(r);let t=i.getPrivyPrimaryWallet(e);if(!t)throw Error("Failed to find primary wallet");return d(t)},exports.getPrivyWalletsWithFilter=s,exports.setAreExternalConnectorsReady=e=>a.setState({areExternalConnectorsReady:e}),exports.toEntropyDetailsFromAccount=d,exports.useRequireSinglePrivyContext=()=>{if(e.useContext(l))throw new o.PrivyClientError("Multiple PrivyProvider instances found","Found multiple instances of PrivyProvider, ensure there is only one mounted in your application tree.")},exports.useWalletStore=a,exports.useWallets=function(){let t=e.useContext(l),o=n.usePrivyInternal(),i=a((e=>e.ethereumEmbedded)),d=a((e=>e.ethereumExternal)),u=a((e=>e.areExternalConnectorsReady)),y=r.useUserStore((e=>e.user)),c=r.useUserStore((e=>e.hasResolvedInitialUser)),p=e.useMemo((()=>[...i,...d].sort(((e,r)=>r.connectedAt-e.connectedAt))),[i,d]),x=s(y,{chainType:"ethereum"}).length>0,h=i.length>0,v=!!u&&!!c&&!!o.walletProxy&&(!x||h);return t?e.useMemo((()=>({wallets:p,ready:v})),[p,v]):(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1})};
//# sourceMappingURL=get-entropy-details-for-user-D63rM5_a.js.map
